@walkeros/cli 4.3.0 → 4.3.1
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 +28 -0
- package/dist/cli.js +1266 -901
- package/dist/index.d.ts +40 -38
- package/dist/index.js +55 -121
- package/dist/index.js.map +1 -1
- package/openapi/spec.json +77 -13
- 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) {
|
|
@@ -556,7 +556,7 @@ function je(e4, t4 = {}, n5 = {}) {
|
|
|
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
729
|
if (a4 && !je(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);
|
|
@@ -893,7 +893,7 @@ function St(e4) {
|
|
|
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
|
|
896
|
+
async function It(e4, t4) {
|
|
897
897
|
const n5 = St(e4);
|
|
898
898
|
if (!n5) return { ok: false, reason: "malformed" };
|
|
899
899
|
const { grant: r6, kid: o4, signed: s4, signature: i5 } = n5;
|
|
@@ -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,53 +944,57 @@ 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
|
-
});
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
949
|
+
}), u2 = {};
|
|
950
|
+
for (const [t5, n6] of Object.entries(e4.headers ?? {})) {
|
|
951
|
+
const e5 = t5.toLowerCase();
|
|
952
|
+
"authorization" !== e5 && "content-type" !== e5 && (u2[t5] = n6);
|
|
953
|
+
}
|
|
954
|
+
let f3 = [], l3 = null, p3 = 0;
|
|
955
|
+
function d2(e5) {
|
|
956
|
+
const t5 = { v: 1, records: e5 }, n6 = JSON.stringify(t5);
|
|
957
|
+
if (e5.length <= 1) return [n6];
|
|
954
958
|
if ((function(e6) {
|
|
955
959
|
let t6 = 0;
|
|
956
960
|
for (let n7 = 0; n7 < e6.length; n7++) {
|
|
957
|
-
const
|
|
958
|
-
if (
|
|
959
|
-
else if (
|
|
960
|
-
else if (
|
|
961
|
-
const
|
|
962
|
-
|
|
961
|
+
const r8 = e6.charCodeAt(n7);
|
|
962
|
+
if (r8 < 128) t6 += 1;
|
|
963
|
+
else if (r8 < 2048) t6 += 2;
|
|
964
|
+
else if (r8 >= 55296 && r8 <= 56319 && n7 + 1 < e6.length) {
|
|
965
|
+
const r9 = e6.charCodeAt(n7 + 1);
|
|
966
|
+
r9 >= 56320 && r9 <= 57343 ? (t6 += 4, n7++) : t6 += 3;
|
|
963
967
|
} else t6 += 3;
|
|
964
968
|
}
|
|
965
969
|
return t6;
|
|
966
|
-
})(
|
|
967
|
-
const
|
|
968
|
-
return [...
|
|
970
|
+
})(n6) <= i5) return [n6];
|
|
971
|
+
const r7 = Math.floor(e5.length / 2);
|
|
972
|
+
return [...d2(e5.slice(0, r7)), ...d2(e5.slice(r7))];
|
|
969
973
|
}
|
|
970
|
-
function
|
|
971
|
-
return Promise.resolve().then(() => a4(e4.url, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${e4.token}` }, body: t5 })).then((
|
|
972
|
-
|
|
974
|
+
function m3(t5) {
|
|
975
|
+
return Promise.resolve().then(() => a4(e4.url, { method: "POST", headers: { ...u2, "Content-Type": "application/json", Authorization: `Bearer ${e4.token}` }, body: t5 })).then((t6) => {
|
|
976
|
+
t6 && "object" == typeof t6 && "number" == typeof t6.status && e4.onStatus?.(t6.status), t6 && "object" == typeof t6 && "ok" in t6 && !t6.ok && c2(new Error(`Observer responded ${t6.status}`));
|
|
973
977
|
}).catch((e5) => {
|
|
974
978
|
c2(e5);
|
|
975
979
|
});
|
|
976
980
|
}
|
|
977
|
-
function
|
|
978
|
-
if (0 ===
|
|
979
|
-
const e5 =
|
|
980
|
-
|
|
981
|
-
const t5 =
|
|
981
|
+
function g3() {
|
|
982
|
+
if (0 === f3.length) return;
|
|
983
|
+
const e5 = f3;
|
|
984
|
+
f3 = [], l3 && (clearTimeout(l3), l3 = null);
|
|
985
|
+
const t5 = d2(e5);
|
|
982
986
|
(async () => {
|
|
983
|
-
for (const e6 of t5) await
|
|
987
|
+
for (const e6 of t5) await m3(e6);
|
|
984
988
|
})();
|
|
985
989
|
}
|
|
986
990
|
return (e5) => {
|
|
987
|
-
|
|
991
|
+
f3.push({ ...e5, seq: ++p3 }), f3.length >= o4 ? g3() : null === l3 && (l3 = setTimeout(g3, n5));
|
|
988
992
|
};
|
|
989
993
|
}
|
|
990
|
-
function
|
|
994
|
+
function vn(e4) {
|
|
991
995
|
return "string" == typeof e4 || Array.isArray(e4) && e4.every((e5) => "string" == typeof e5) ? e4 : void 0;
|
|
992
996
|
}
|
|
993
|
-
async function
|
|
997
|
+
async function yn(e4, t4) {
|
|
994
998
|
const n5 = t4?.version || "latest", r6 = t4?.timeout || 1e4, o4 = new AbortController(), s4 = setTimeout(() => o4.abort(), r6), i5 = o4.signal, a4 = t4?.client ? { "X-Walkeros-Client": t4.client } : void 0;
|
|
995
999
|
try {
|
|
996
1000
|
if (t4?.baseUrl) {
|
|
@@ -1001,7 +1005,7 @@ async function vn(e4, t4) {
|
|
|
1001
1005
|
return { packageName: n6.package || e5, version: "string" == typeof n6.version ? n6.version : t5, ...void 0 !== n6.description && { description: n6.description }, ...void 0 !== n6.type && { type: n6.type }, ...void 0 !== c2 && { platform: c2 }, schemas: r9, examples: o7, ...void 0 !== n6.docs && { docs: n6.docs }, ...void 0 !== n6.source && { source: n6.source }, ...s5 && Object.keys(s5).length > 0 ? { hints: s5 } : {}, hintKeys: i6, exampleSummaries: a5 };
|
|
1002
1006
|
})(e4, n5, await o6.json());
|
|
1003
1007
|
}
|
|
1004
|
-
const r7 = `https://cdn.jsdelivr.net/npm/${e4}@${n5}`, o5 = await
|
|
1008
|
+
const r7 = `https://cdn.jsdelivr.net/npm/${e4}@${n5}`, o5 = await bn(`${r7}/package.json`, i5, a4);
|
|
1005
1009
|
return (function(e5, t5, n6, r8) {
|
|
1006
1010
|
const o6 = r8.$meta || {}, s5 = r8.schemas || {}, i6 = r8.examples || {}, a5 = r8.hints, c2 = a5 ? Object.keys(a5) : [], u2 = [], f3 = i6.step || {};
|
|
1007
1011
|
for (const [e6, t6] of Object.entries(f3)) {
|
|
@@ -1009,33 +1013,38 @@ async function vn(e4, t4) {
|
|
|
1009
1013
|
"string" == typeof n7?.description && (r9.description = n7.description), u2.push(r9);
|
|
1010
1014
|
}
|
|
1011
1015
|
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
|
|
1016
|
+
return { packageName: e5, version: "string" == typeof n6.version ? n6.version : t5, description: "string" == typeof n6.description ? n6.description : void 0, type: "string" == typeof o6.type ? o6.type : void 0, platform: vn(o6.platform), schemas: s5, examples: i6, ...l3 ? { docs: l3 } : {}, ...p3 ? { source: p3 } : {}, ...a5 && Object.keys(a5).length > 0 ? { hints: a5 } : {}, hintKeys: c2, exampleSummaries: u2 };
|
|
1017
|
+
})(e4, n5, o5, await bn(`${r7}/dist/walkerOS.json`, i5, a4));
|
|
1014
1018
|
} finally {
|
|
1015
1019
|
clearTimeout(s4);
|
|
1016
1020
|
}
|
|
1017
1021
|
}
|
|
1018
|
-
async function
|
|
1022
|
+
async function bn(e4, t4, n5) {
|
|
1019
1023
|
const r6 = await fetch(e4, { signal: t4, ...n5 && { headers: n5 } });
|
|
1020
1024
|
if (!r6.ok) throw new Error(`Failed to fetch ${e4} (HTTP ${r6.status})`);
|
|
1021
1025
|
return await r6.json();
|
|
1022
1026
|
}
|
|
1023
|
-
async function
|
|
1024
|
-
const n5 = await
|
|
1027
|
+
async function wn(e4, t4) {
|
|
1028
|
+
const n5 = await yn(e4, t4);
|
|
1025
1029
|
return { packageName: n5.packageName, version: n5.version, type: n5.type, platform: n5.platform, schemas: n5.schemas, examples: n5.examples, ...n5.hints ? { hints: n5.hints } : {} };
|
|
1026
1030
|
}
|
|
1027
|
-
function
|
|
1028
|
-
const t4 = (e4.startsWith(
|
|
1031
|
+
function jn(e4) {
|
|
1032
|
+
const t4 = (e4.startsWith(An) ? e4.slice(5) : e4).split(".");
|
|
1029
1033
|
return t4.some((e5) => "" === e5) ? [] : t4;
|
|
1030
1034
|
}
|
|
1031
|
-
function
|
|
1035
|
+
function xn(e4) {
|
|
1036
|
+
if (!e4.startsWith(Sn)) return null;
|
|
1037
|
+
const t4 = e4.slice(5).split("."), [n5, r6, o4] = t4;
|
|
1038
|
+
return 3 === t4.length && n5 && r6 && o4 ? { pb: n5, ses: r6, secret: o4 } : null;
|
|
1039
|
+
}
|
|
1040
|
+
function Nn(e4) {
|
|
1032
1041
|
if (void 0 === e4 || "*" === e4) return () => true;
|
|
1033
1042
|
if ("and" in e4) {
|
|
1034
|
-
const t4 = e4.and.map(
|
|
1043
|
+
const t4 = e4.and.map(Nn);
|
|
1035
1044
|
return (e5) => t4.every((t5) => t5(e5));
|
|
1036
1045
|
}
|
|
1037
1046
|
if ("or" in e4) {
|
|
1038
|
-
const t4 = e4.or.map(
|
|
1047
|
+
const t4 = e4.or.map(Nn);
|
|
1039
1048
|
return (e5) => t4.some((t5) => t5(e5));
|
|
1040
1049
|
}
|
|
1041
1050
|
return (function(e5) {
|
|
@@ -1071,70 +1080,70 @@ function In(e4) {
|
|
|
1071
1080
|
};
|
|
1072
1081
|
})(e4);
|
|
1073
1082
|
}
|
|
1074
|
-
function
|
|
1083
|
+
function Mn(e4) {
|
|
1075
1084
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4) && ("match" in e4 || "next" in e4 || "one" in e4 || "many" in e4);
|
|
1076
1085
|
}
|
|
1077
|
-
function
|
|
1078
|
-
return Array.isArray(e4) && e4.length > 0 && e4.every((e5) =>
|
|
1086
|
+
function Tn(e4) {
|
|
1087
|
+
return Array.isArray(e4) && e4.length > 0 && e4.every((e5) => Mn(e5));
|
|
1079
1088
|
}
|
|
1080
|
-
function
|
|
1089
|
+
function Cn(e4) {
|
|
1081
1090
|
return e4.map((e5) => {
|
|
1082
1091
|
if ("string" == typeof e5) return { match: () => true, next: { type: "static", value: e5 } };
|
|
1083
|
-
if (Array.isArray(e5)) return { match: () => true, next:
|
|
1092
|
+
if (Array.isArray(e5)) return { match: () => true, next: Pn(e5) ?? { type: "chain", value: [] } };
|
|
1084
1093
|
const t4 = e5;
|
|
1085
|
-
return { match: t4.match ?
|
|
1094
|
+
return { match: t4.match ? Nn(t4.match) : () => true, next: Pn(t4) ?? { type: "chain", value: [] } };
|
|
1086
1095
|
});
|
|
1087
1096
|
}
|
|
1088
|
-
function
|
|
1097
|
+
function Pn(e4) {
|
|
1089
1098
|
if (null == e4) return;
|
|
1090
1099
|
if ("string" == typeof e4) return { type: "static", value: e4 };
|
|
1091
1100
|
if (Array.isArray(e4)) {
|
|
1092
1101
|
if (0 === e4.length) return;
|
|
1093
|
-
if (
|
|
1102
|
+
if (Tn(e4)) return Pn({ one: e4 });
|
|
1094
1103
|
if (e4.every((e5) => "string" == typeof e5)) return { type: "chain", value: e4 };
|
|
1095
1104
|
const t5 = [];
|
|
1096
1105
|
for (const n5 of e4) {
|
|
1097
|
-
const e5 =
|
|
1106
|
+
const e5 = Pn(n5);
|
|
1098
1107
|
void 0 !== e5 && t5.push(e5);
|
|
1099
1108
|
}
|
|
1100
1109
|
if (0 === t5.length) return;
|
|
1101
1110
|
return { type: "sequence", value: t5 };
|
|
1102
1111
|
}
|
|
1103
1112
|
const t4 = e4;
|
|
1104
|
-
if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match:
|
|
1113
|
+
if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match: Nn(t4.match), next: Pn(t4.next) } : Pn(t4.next);
|
|
1105
1114
|
if ("one" in t4 && t4.one) {
|
|
1106
|
-
const e5 =
|
|
1107
|
-
return t4.match ? { type: "gate", match:
|
|
1115
|
+
const e5 = Cn(t4.one);
|
|
1116
|
+
return t4.match ? { type: "gate", match: Nn(t4.match), next: { type: "one", routes: e5 } } : { type: "one", routes: e5 };
|
|
1108
1117
|
}
|
|
1109
1118
|
if ("many" in t4 && t4.many) {
|
|
1110
|
-
const e5 =
|
|
1111
|
-
return t4.match ? { type: "gate", match:
|
|
1119
|
+
const e5 = Cn(t4.many);
|
|
1120
|
+
return t4.match ? { type: "gate", match: Nn(t4.match), next: { type: "many", routes: e5 } } : { type: "many", routes: e5 };
|
|
1112
1121
|
}
|
|
1113
|
-
return t4.match ? { type: "gate", match:
|
|
1122
|
+
return t4.match ? { type: "gate", match: Nn(t4.match) } : void 0;
|
|
1114
1123
|
}
|
|
1115
|
-
function
|
|
1124
|
+
function zn(e4, t4 = {}) {
|
|
1116
1125
|
if (null == e4) return [];
|
|
1117
1126
|
let n5;
|
|
1118
1127
|
if ("object" == typeof e4) {
|
|
1119
|
-
const t5 =
|
|
1120
|
-
t5 ? n5 = t5 : (n5 =
|
|
1121
|
-
} else n5 =
|
|
1128
|
+
const t5 = Rn.get(e4);
|
|
1129
|
+
t5 ? n5 = t5 : (n5 = Pn(e4), n5 && Rn.set(e4, n5));
|
|
1130
|
+
} else n5 = Pn(e4);
|
|
1122
1131
|
if (!n5) return [];
|
|
1123
|
-
const r6 =
|
|
1132
|
+
const r6 = Dn(n5, t4);
|
|
1124
1133
|
return void 0 === r6 ? [] : Array.isArray(r6) ? r6 : [r6];
|
|
1125
1134
|
}
|
|
1126
|
-
function
|
|
1135
|
+
function Dn(e4, t4 = {}) {
|
|
1127
1136
|
if (e4) {
|
|
1128
1137
|
if ("static" === e4.type) return e4.value;
|
|
1129
1138
|
if ("chain" === e4.type) return e4.value;
|
|
1130
1139
|
if ("gate" === e4.type) {
|
|
1131
1140
|
if (!e4.match(t4)) return;
|
|
1132
|
-
return
|
|
1141
|
+
return Dn(e4.next, t4);
|
|
1133
1142
|
}
|
|
1134
1143
|
if ("sequence" === e4.type) {
|
|
1135
1144
|
const n5 = [];
|
|
1136
1145
|
for (const r6 of e4.value) {
|
|
1137
|
-
const e5 =
|
|
1146
|
+
const e5 = Dn(r6, t4);
|
|
1138
1147
|
void 0 !== e5 && (Array.isArray(e5) ? n5.push(...e5) : n5.push(e5));
|
|
1139
1148
|
}
|
|
1140
1149
|
return n5.length > 0 ? n5 : void 0;
|
|
@@ -1143,44 +1152,44 @@ function Cn(e4, t4 = {}) {
|
|
|
1143
1152
|
const n5 = [];
|
|
1144
1153
|
for (const r6 of e4.routes) {
|
|
1145
1154
|
if (!r6.match(t4)) continue;
|
|
1146
|
-
const e5 =
|
|
1155
|
+
const e5 = Dn(r6.next, t4);
|
|
1147
1156
|
void 0 !== e5 && (Array.isArray(e5) ? n5.push(...e5) : n5.push(e5));
|
|
1148
1157
|
}
|
|
1149
1158
|
return n5.length > 0 ? n5 : void 0;
|
|
1150
1159
|
}
|
|
1151
|
-
for (const n5 of e4.routes) if (n5.match(t4)) return
|
|
1160
|
+
for (const n5 of e4.routes) if (n5.match(t4)) return Dn(n5.next, t4);
|
|
1152
1161
|
}
|
|
1153
1162
|
}
|
|
1154
|
-
function
|
|
1155
|
-
const r6 = { [
|
|
1156
|
-
return void 0 !== t4 && (r6[
|
|
1163
|
+
function Ln(e4, t4, n5 = Date.now) {
|
|
1164
|
+
const r6 = { [Fn]: e4 };
|
|
1165
|
+
return void 0 !== t4 && (r6[Un] = n5() + t4), r6;
|
|
1157
1166
|
}
|
|
1158
|
-
function
|
|
1167
|
+
function Kn(e4, t4 = Date.now) {
|
|
1159
1168
|
if (void 0 === e4) return;
|
|
1160
|
-
if (null === (n5 = e4) || "object" != typeof n5 || Array.isArray(n5) || !(
|
|
1169
|
+
if (null === (n5 = e4) || "object" != typeof n5 || Array.isArray(n5) || !(Fn in e4)) return { value: e4 };
|
|
1161
1170
|
var n5;
|
|
1162
|
-
const r6 = e4[
|
|
1163
|
-
return "number" == typeof r6 && t4() > r6 ? { expired: true } : { value: e4[
|
|
1171
|
+
const r6 = e4[Un];
|
|
1172
|
+
return "number" == typeof r6 && t4() > r6 ? { expired: true } : { value: e4[Fn] };
|
|
1164
1173
|
}
|
|
1165
|
-
function
|
|
1174
|
+
function Bn(e4) {
|
|
1166
1175
|
return null !== e4 && "object" == typeof e4 && !Array.isArray(e4);
|
|
1167
1176
|
}
|
|
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 ||
|
|
1177
|
+
function Jn(e4) {
|
|
1178
|
+
return null === e4 || "string" == typeof e4 || "number" == typeof e4 || "boolean" == typeof e4 || e4 instanceof Uint8Array || (Array.isArray(e4) ? e4.every((e5) => void 0 === e5 || Jn(e5)) : !!Bn(e4) && Object.values(e4).every((e5) => void 0 === e5 || Jn(e5)));
|
|
1170
1179
|
}
|
|
1171
|
-
function
|
|
1180
|
+
function Xn(e4, t4) {
|
|
1172
1181
|
const n5 = { ingest: e4 ?? {} };
|
|
1173
1182
|
return void 0 !== t4 && (n5.event = t4), n5;
|
|
1174
1183
|
}
|
|
1175
|
-
function
|
|
1176
|
-
return { stop: e4.stop ?? false, storeId: e4.store, namespace: e4.namespace, rules: e4.rules.map((e5) => ({ match: e5.match ?
|
|
1184
|
+
function Qn(e4) {
|
|
1185
|
+
return { stop: e4.stop ?? false, storeId: e4.store, namespace: e4.namespace, rules: e4.rules.map((e5) => ({ match: e5.match ? Nn(e5.match) : () => true, key: e5.key, ttl: e5.ttl, update: e5.update })) };
|
|
1177
1186
|
}
|
|
1178
|
-
async function
|
|
1187
|
+
async function er(e4, t4, n5, r6) {
|
|
1179
1188
|
const o4 = e4.rules.find((e5) => e5.match(n5));
|
|
1180
1189
|
if (!o4) return null;
|
|
1181
1190
|
const s4 = o4.key.map((e5) => String(ve(n5, e5) ?? ""));
|
|
1182
1191
|
if (s4.every((e5) => "" === e5)) return null;
|
|
1183
|
-
const i5 = s4.join(":"), a4 = r6 ?? e4.namespace, c2 = a4 ? `${a4}:${i5}` : i5, u2 =
|
|
1192
|
+
const i5 = s4.join(":"), a4 = r6 ?? e4.namespace, c2 = a4 ? `${a4}:${i5}` : i5, u2 = Kn(await t4.get(c2));
|
|
1184
1193
|
if (void 0 === u2) return { status: "MISS", key: c2, rule: o4 };
|
|
1185
1194
|
if ("expired" in u2) {
|
|
1186
1195
|
try {
|
|
@@ -1191,13 +1200,13 @@ async function Gn(e4, t4, n5, r6) {
|
|
|
1191
1200
|
}
|
|
1192
1201
|
return { status: "HIT", key: c2, value: u2.value, rule: o4 };
|
|
1193
1202
|
}
|
|
1194
|
-
function
|
|
1195
|
-
if (!
|
|
1196
|
-
const o4 = 1e3 * r6, s4 = e4.set(t4,
|
|
1203
|
+
function tr(e4, t4, n5, r6) {
|
|
1204
|
+
if (!Jn(n5)) return;
|
|
1205
|
+
const o4 = 1e3 * r6, s4 = e4.set(t4, Ln(n5, o4), o4);
|
|
1197
1206
|
s4 instanceof Promise && s4.catch(() => {
|
|
1198
1207
|
});
|
|
1199
1208
|
}
|
|
1200
|
-
async function
|
|
1209
|
+
async function nr(e4, t4, n5, r6) {
|
|
1201
1210
|
if (!t4) return e4;
|
|
1202
1211
|
let o4 = e4;
|
|
1203
1212
|
for (const [e5, s4] of Object.entries(t4)) {
|
|
@@ -1205,12 +1214,12 @@ async function Yn(e4, t4, n5, r6) {
|
|
|
1205
1214
|
}
|
|
1206
1215
|
return o4;
|
|
1207
1216
|
}
|
|
1208
|
-
function
|
|
1217
|
+
function rr(e4) {
|
|
1209
1218
|
return ie(e4) ? e4 : [e4];
|
|
1210
1219
|
}
|
|
1211
|
-
async function
|
|
1220
|
+
async function or(e4, t4, n5, r6) {
|
|
1212
1221
|
let o4 = n5;
|
|
1213
|
-
for (const n6 of e4) await
|
|
1222
|
+
for (const n6 of e4) await Ye(async () => {
|
|
1214
1223
|
const e5 = t4(n6.store);
|
|
1215
1224
|
if (!e5) return;
|
|
1216
1225
|
const s4 = await et(o4, n6.key, { collector: r6, event: o4 });
|
|
@@ -1229,23 +1238,23 @@ async function er(e4, t4, n5, r6) {
|
|
|
1229
1238
|
}
|
|
1230
1239
|
var a4;
|
|
1231
1240
|
}, (e5) => {
|
|
1232
|
-
if (e5 instanceof
|
|
1241
|
+
if (e5 instanceof Xe) throw e5;
|
|
1233
1242
|
r6.logger?.error?.("[state] operation failed", e5);
|
|
1234
1243
|
})();
|
|
1235
1244
|
return o4;
|
|
1236
1245
|
}
|
|
1237
|
-
function
|
|
1246
|
+
function ur(e4, t4) {
|
|
1238
1247
|
const n5 = (function(e5) {
|
|
1239
|
-
return /* @__PURE__ */ new Set([...
|
|
1248
|
+
return /* @__PURE__ */ new Set([...sr[e5], ...ir, ...ar[e5]]);
|
|
1240
1249
|
})(t4);
|
|
1241
1250
|
for (const r7 of Object.keys(e4)) if (!n5.has(r7)) return { ok: false, code: "UNKNOWN_KEY", key: r7, reason: `Unknown key "${r7}" on ${t4}. Allowed: ${[...n5].sort().join(", ")}.` };
|
|
1242
1251
|
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 &&
|
|
1252
|
+
return s4 && "string" == typeof e4.code ? { ok: false, code: "OBSOLETE_CODE_STRING", key: "code", reason: `code: "<name>" is no longer supported. Use import: "${e4.code}" with the package field instead.` } : s4 && ("object" != typeof e4.code && "function" != typeof e4.code || null === e4.code || Array.isArray(e4.code)) ? { ok: false, code: "INVALID_CODE_SHAPE", key: "code", reason: "code must be an object ({ push, type?, init? }) or a resolved function value." } : s4 && r6 ? { ok: false, code: "CONFLICT", key: "package", reason: "Cannot specify both `code` and `package`. Use one or the other." } : s4 && o4 ? { ok: false, code: "CONFLICT", key: "import", reason: "Cannot specify both `code` and `import`." } : o4 && !r6 ? { ok: false, code: "MISSING_PACKAGE", key: "import", reason: "`import` requires `package` to be set." } : !o4 || "string" == typeof e4.import && cr.test(e4.import) ? { ok: true } : { ok: false, code: "INVALID_IMPORT", key: "import", reason: `import must match ${cr.source}. Got: ${JSON.stringify(e4.import)}.` };
|
|
1244
1253
|
}
|
|
1245
|
-
function
|
|
1254
|
+
function fr(e4, t4) {
|
|
1246
1255
|
return "Transformer" === t4 && (void 0 === e4.code && void 0 === e4.package && void 0 === e4.import && (void 0 !== e4.before || void 0 !== e4.next || void 0 !== e4.cache || void 0 !== e4.state || void 0 !== e4.mapping));
|
|
1247
1256
|
}
|
|
1248
|
-
var e, t, r, i, f, l, m, v, b, T, F, U,
|
|
1257
|
+
var e, t, r, i, f, l, m, v, b, T, D, F, U, L, K, q, J, G, re, we, Ie, Pe, qe, Xe, wt, xt, Ot, Nt, tn, kn, An, Sn, Rn, Fn, Un, sr, ir, ar, cr;
|
|
1249
1258
|
var init_dist = __esm({
|
|
1250
1259
|
"../core/dist/index.mjs"() {
|
|
1251
1260
|
"use strict";
|
|
@@ -1267,23 +1276,23 @@ var init_dist = __esm({
|
|
|
1267
1276
|
b = {};
|
|
1268
1277
|
t(b, { getStore: () => w, getStoreValue: () => k });
|
|
1269
1278
|
T = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1279
|
+
D = /^\$var\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)$/;
|
|
1280
|
+
F = /\$var\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)/g;
|
|
1281
|
+
U = /\$env\.([a-zA-Z_][a-zA-Z0-9_]*)(?::([^"}\s]*))?/g;
|
|
1282
|
+
L = /^\$contract\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.(.+))?$/;
|
|
1283
|
+
K = /^\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?$/;
|
|
1284
|
+
q = /^\$secret\.([A-Z0-9_]+)$/;
|
|
1276
1285
|
J = "__WALKEROS_ENV:";
|
|
1277
1286
|
G = "__WALKEROS_SECRET:";
|
|
1278
1287
|
re = { merge: true, shallow: true, extend: true };
|
|
1279
1288
|
we = { data: (e4) => e4.data, globals: (e4) => e4.globals, context: (e4) => e4.context, user: (e4) => e4.user, source: (e4) => e4.source, event: (e4) => ({ entity: e4.entity, action: e4.action, id: e4.id, timestamp: e4.timestamp, name: e4.name, trigger: e4.trigger, timing: e4.timing }) };
|
|
1280
|
-
|
|
1289
|
+
Ie = "0123456789abcdef";
|
|
1281
1290
|
Pe = /^(?<version>[0-9a-f]{2})-(?<trace>[0-9a-f]{32})-(?<span>[0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
1282
|
-
|
|
1291
|
+
qe = (e4, t4, n5, r6) => {
|
|
1283
1292
|
const o4 = `${l[e4]}${r6.length > 0 ? ` [${r6.join(":")}]` : ""}`, s4 = Object.keys(n5).length > 0, i5 = 0 === e4 ? console.error : 1 === e4 ? console.warn : console.log;
|
|
1284
1293
|
s4 ? i5(o4, t4, n5) : i5(o4, t4);
|
|
1285
1294
|
};
|
|
1286
|
-
|
|
1295
|
+
Xe = class e2 extends Error {
|
|
1287
1296
|
constructor(t4, n5) {
|
|
1288
1297
|
super(t4, n5), this.name = "FatalError", Object.setPrototypeOf(this, e2.prototype);
|
|
1289
1298
|
}
|
|
@@ -1291,16 +1300,18 @@ var init_dist = __esm({
|
|
|
1291
1300
|
wt = /^[A-Za-z0-9_-]+$/;
|
|
1292
1301
|
xt = 9e5;
|
|
1293
1302
|
Ot = 39e5;
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1303
|
+
Nt = "elbObserve";
|
|
1304
|
+
tn = null;
|
|
1305
|
+
kn = "observe";
|
|
1306
|
+
An = "call:";
|
|
1307
|
+
Sn = "obsw_";
|
|
1308
|
+
Rn = /* @__PURE__ */ new WeakMap();
|
|
1309
|
+
Fn = "__walkeros_cache_v__";
|
|
1310
|
+
Un = "__walkeros_cache_exp__";
|
|
1311
|
+
sr = { Source: ["code", "package", "import", "before", "next", "cache", "state"], Transformer: ["code", "package", "import", "before", "next", "cache", "state", "mapping"], Destination: ["code", "package", "import", "before", "next", "cache", "state"], Store: ["code", "package", "import", "cache"] };
|
|
1312
|
+
ir = ["config", "env", "variables", "examples", "disabled", "id", "logger", "mock", "chainMocks"];
|
|
1313
|
+
ar = { Source: ["primary"], Transformer: [], Destination: [], Store: [] };
|
|
1314
|
+
cr = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
1304
1315
|
}
|
|
1305
1316
|
});
|
|
1306
1317
|
|
|
@@ -1574,7 +1585,7 @@ function createCLILoggerConfig(options = {}) {
|
|
|
1574
1585
|
};
|
|
1575
1586
|
}
|
|
1576
1587
|
function createCLILogger(options = {}) {
|
|
1577
|
-
return
|
|
1588
|
+
return Be(createCLILoggerConfig(options));
|
|
1578
1589
|
}
|
|
1579
1590
|
var init_cli_logger = __esm({
|
|
1580
1591
|
"src/core/cli-logger.ts"() {
|
|
@@ -2051,54 +2062,54 @@ var init_sse = __esm({
|
|
|
2051
2062
|
|
|
2052
2063
|
// ../core/dist/dev.mjs
|
|
2053
2064
|
import { z as n3 } from "zod";
|
|
2054
|
-
import { z as
|
|
2065
|
+
import { z as en } from "zod";
|
|
2055
2066
|
function o2(e4, t4, i5 = "draft-7") {
|
|
2056
2067
|
return n3.toJSONSchema(e4, { target: i5 });
|
|
2057
2068
|
}
|
|
2058
|
-
function
|
|
2069
|
+
function J3(e4, t4) {
|
|
2059
2070
|
return n3.object({ data: n3.union([e4, t4]).optional().describe("Data transformation rules") }).partial();
|
|
2060
2071
|
}
|
|
2061
|
-
function
|
|
2072
|
+
function M2(e4) {
|
|
2062
2073
|
return n3.object({ mapping: e4.optional().describe("Event mapping rules") }).partial();
|
|
2063
2074
|
}
|
|
2064
2075
|
function T3(e4) {
|
|
2065
2076
|
return n3.object({ policy: e4.optional().describe("Pre-processing policy rules") }).partial();
|
|
2066
2077
|
}
|
|
2067
|
-
function
|
|
2078
|
+
function F3(e4) {
|
|
2068
2079
|
return n3.object({ consent: e4.optional().describe("Required consent states") }).partial();
|
|
2069
2080
|
}
|
|
2070
2081
|
function Pi(e4, t4) {
|
|
2071
2082
|
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
2083
|
}
|
|
2073
|
-
function Li(e4) {
|
|
2074
|
-
return zi.parse(e4);
|
|
2075
|
-
}
|
|
2076
2084
|
function qi(e4) {
|
|
2077
|
-
return
|
|
2085
|
+
return Li.parse(e4);
|
|
2078
2086
|
}
|
|
2079
2087
|
function Ni(e4) {
|
|
2080
|
-
return
|
|
2088
|
+
return Li.safeParse(e4);
|
|
2081
2089
|
}
|
|
2082
2090
|
function Wi(e4) {
|
|
2083
|
-
return
|
|
2091
|
+
return zi.parse(e4);
|
|
2084
2092
|
}
|
|
2085
|
-
function
|
|
2093
|
+
function Bi(e4) {
|
|
2094
|
+
return zi.safeParse(e4);
|
|
2095
|
+
}
|
|
2096
|
+
function ln2(e4) {
|
|
2086
2097
|
throw new Error(String(e4));
|
|
2087
2098
|
}
|
|
2088
|
-
function
|
|
2099
|
+
function pn(e4, t4) {
|
|
2089
2100
|
const i5 = false !== t4?.stripAnnotations, n5 = {}, o4 = /* @__PURE__ */ new Set();
|
|
2090
2101
|
function r6(t5) {
|
|
2091
2102
|
if (n5[t5]) return n5[t5];
|
|
2092
|
-
o4.has(t5) &&
|
|
2103
|
+
o4.has(t5) && ln2(`Circular extend chain detected: ${[...o4, t5].join(" \u2192 ")}`);
|
|
2093
2104
|
const a4 = e4[t5];
|
|
2094
|
-
a4 ||
|
|
2105
|
+
a4 || ln2(`Contract "${t5}" not found`), o4.add(t5);
|
|
2095
2106
|
let s4 = {};
|
|
2096
2107
|
if (a4.extend) {
|
|
2097
2108
|
s4 = (function(e5, t6) {
|
|
2098
2109
|
const i6 = {};
|
|
2099
2110
|
void 0 === e5.tagging && void 0 === t6.tagging || (i6.tagging = t6.tagging ?? e5.tagging);
|
|
2100
2111
|
void 0 === e5.description && void 0 === t6.description || (i6.description = t6.description ?? e5.description);
|
|
2101
|
-
e5.schema && t6.schema ? i6.schema =
|
|
2112
|
+
e5.schema && t6.schema ? i6.schema = un(e5.schema, t6.schema) : (e5.schema || t6.schema) && (i6.schema = { ...e5.schema || t6.schema });
|
|
2102
2113
|
if (e5.events || t6.events) {
|
|
2103
2114
|
const n6 = {}, o5 = /* @__PURE__ */ new Set([...Object.keys(e5.events || {}), ...Object.keys(t6.events || {})]);
|
|
2104
2115
|
for (const i7 of o5) {
|
|
@@ -2106,7 +2117,7 @@ function dn(e4, t4) {
|
|
|
2106
2117
|
n6[i7] = {};
|
|
2107
2118
|
for (const e6 of a5) {
|
|
2108
2119
|
const t7 = o6[e6], a6 = r7[e6];
|
|
2109
|
-
n6[i7][e6] = t7 && a6 ?
|
|
2120
|
+
n6[i7][e6] = t7 && a6 ? un(t7, a6) : { ...t7 || a6 };
|
|
2110
2121
|
}
|
|
2111
2122
|
}
|
|
2112
2123
|
i6.events = n6;
|
|
@@ -2121,13 +2132,13 @@ function dn(e4, t4) {
|
|
|
2121
2132
|
for (const n6 of Object.keys(e5[i6] || {})) {
|
|
2122
2133
|
let o5 = {};
|
|
2123
2134
|
const r7 = e5["*"]?.["*"];
|
|
2124
|
-
r7 && (o5 =
|
|
2135
|
+
r7 && (o5 = un(o5, r7));
|
|
2125
2136
|
const a5 = e5["*"]?.[n6];
|
|
2126
|
-
a5 && "*" !== n6 && (o5 =
|
|
2137
|
+
a5 && "*" !== n6 && (o5 = un(o5, a5));
|
|
2127
2138
|
const s5 = e5[i6]?.["*"];
|
|
2128
|
-
s5 && "*" !== n6 && (o5 =
|
|
2139
|
+
s5 && "*" !== n6 && (o5 = un(o5, s5));
|
|
2129
2140
|
const c2 = e5[i6]?.[n6];
|
|
2130
|
-
c2 && (o5 =
|
|
2141
|
+
c2 && (o5 = un(o5, c2)), t6[i6][n6] = o5;
|
|
2131
2142
|
}
|
|
2132
2143
|
}
|
|
2133
2144
|
e5["*"] && (t6["*"] = { ...e5["*"] });
|
|
@@ -2136,7 +2147,7 @@ function dn(e4, t4) {
|
|
|
2136
2147
|
const e5 = {};
|
|
2137
2148
|
for (const [t6, i6] of Object.entries(s4.events)) {
|
|
2138
2149
|
e5[t6] = {};
|
|
2139
|
-
for (const [n6, o5] of Object.entries(i6)) e5[t6][n6] =
|
|
2150
|
+
for (const [n6, o5] of Object.entries(i6)) e5[t6][n6] = mn(o5);
|
|
2140
2151
|
}
|
|
2141
2152
|
s4.events = e5;
|
|
2142
2153
|
}
|
|
@@ -2145,23 +2156,23 @@ function dn(e4, t4) {
|
|
|
2145
2156
|
for (const t5 of Object.keys(e4)) r6(t5);
|
|
2146
2157
|
return n5;
|
|
2147
2158
|
}
|
|
2148
|
-
function
|
|
2159
|
+
function un(e4, t4) {
|
|
2149
2160
|
const i5 = { ...e4 };
|
|
2150
2161
|
for (const n5 of Object.keys(t4)) {
|
|
2151
2162
|
const o4 = e4[n5], r6 = t4[n5];
|
|
2152
|
-
"required" === n5 && Array.isArray(o4) && Array.isArray(r6) ? i5[n5] = [.../* @__PURE__ */ new Set([...o4, ...r6])] :
|
|
2163
|
+
"required" === n5 && Array.isArray(o4) && Array.isArray(r6) ? i5[n5] = [.../* @__PURE__ */ new Set([...o4, ...r6])] : fn(o4) && fn(r6) ? i5[n5] = un(o4, r6) : i5[n5] = r6;
|
|
2153
2164
|
}
|
|
2154
2165
|
return i5;
|
|
2155
2166
|
}
|
|
2156
|
-
function
|
|
2167
|
+
function mn(e4) {
|
|
2157
2168
|
const t4 = {};
|
|
2158
|
-
for (const [i5, n5] of Object.entries(e4))
|
|
2169
|
+
for (const [i5, n5] of Object.entries(e4)) dn.has(i5) || (null === n5 || "object" != typeof n5 || Array.isArray(n5) ? t4[i5] = n5 : t4[i5] = mn(n5));
|
|
2159
2170
|
return t4;
|
|
2160
2171
|
}
|
|
2161
|
-
function
|
|
2172
|
+
function fn(e4) {
|
|
2162
2173
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
|
|
2163
2174
|
}
|
|
2164
|
-
function
|
|
2175
|
+
function gn(e4, t4) {
|
|
2165
2176
|
let i5;
|
|
2166
2177
|
try {
|
|
2167
2178
|
i5 = JSON.parse(e4);
|
|
@@ -2170,7 +2181,7 @@ function fn2(e4, t4) {
|
|
|
2170
2181
|
if (e5 instanceof SyntaxError) {
|
|
2171
2182
|
const i7 = e5.message.match(/position\s+(\d+)/);
|
|
2172
2183
|
if (i7) {
|
|
2173
|
-
return
|
|
2184
|
+
return En2(t6, parseInt(i7[1], 10));
|
|
2174
2185
|
}
|
|
2175
2186
|
const n7 = e5.message.match(/line\s+(\d+)\s+column\s+(\d+)/);
|
|
2176
2187
|
if (n7) return { line: parseInt(n7[1], 10), column: parseInt(n7[2], 10) };
|
|
@@ -2179,45 +2190,45 @@ function fn2(e4, t4) {
|
|
|
2179
2190
|
})(t5, e4);
|
|
2180
2191
|
return { valid: false, errors: [{ message: t5 instanceof Error ? t5.message : "Invalid JSON", severity: "error", line: i6, column: n6 }], warnings: [] };
|
|
2181
2192
|
}
|
|
2182
|
-
const n5 = [], o4 = [], r6 =
|
|
2193
|
+
const n5 = [], o4 = [], r6 = Li.safeParse(i5);
|
|
2183
2194
|
if (!r6.success) for (const t5 of r6.error.issues) {
|
|
2184
|
-
const i6 = t5.path.join("."), o5 =
|
|
2195
|
+
const i6 = t5.path.join("."), o5 = In2(e4, t5.path);
|
|
2185
2196
|
n5.push({ message: t5.message, severity: "error", path: i6 || "root", ...o5 });
|
|
2186
2197
|
}
|
|
2187
2198
|
const a4 = (function(e5) {
|
|
2188
|
-
if (!(
|
|
2199
|
+
if (!(Rn2(e5) && "version" in e5 && "flows" in e5 && Rn2(e5.flows))) return;
|
|
2189
2200
|
const t5 = {}, i6 = [], n6 = [], o5 = [], r7 = [], a5 = [], s4 = [];
|
|
2190
2201
|
let c2;
|
|
2191
2202
|
const l3 = Object.keys(e5.flows);
|
|
2192
2203
|
Jn2(t5, e5.variables), (function(e6, t6) {
|
|
2193
|
-
if (!
|
|
2204
|
+
if (!Rn2(t6)) return;
|
|
2194
2205
|
let i7;
|
|
2195
2206
|
try {
|
|
2196
|
-
i7 =
|
|
2207
|
+
i7 = pn(t6, { stripAnnotations: false });
|
|
2197
2208
|
} catch {
|
|
2198
2209
|
return;
|
|
2199
2210
|
}
|
|
2200
2211
|
for (const t7 of Object.values(i7)) {
|
|
2201
2212
|
const i8 = t7.events;
|
|
2202
|
-
if (
|
|
2203
|
-
if (!
|
|
2213
|
+
if (Rn2(i8)) for (const [t8, n7] of Object.entries(i8)) {
|
|
2214
|
+
if (!Rn2(n7)) continue;
|
|
2204
2215
|
let i9 = e6.find((e7) => e7.entity === t8);
|
|
2205
2216
|
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] =
|
|
2217
|
+
for (const [e7, t9] of Object.entries(n7)) i9.actions.includes(e7) || i9.actions.push(e7), i9.properties[e7] = Mn2(t9);
|
|
2207
2218
|
}
|
|
2208
2219
|
}
|
|
2209
2220
|
})(s4, e5.contract);
|
|
2210
|
-
for (const s5 of Object.values(e5.flows)) if (
|
|
2221
|
+
for (const s5 of Object.values(e5.flows)) if (Rn2(s5)) {
|
|
2211
2222
|
if (!c2) {
|
|
2212
2223
|
const e6 = s5.config;
|
|
2213
|
-
!
|
|
2224
|
+
!Rn2(e6) || "web" !== e6.platform && "server" !== e6.platform || (c2 = e6.platform);
|
|
2214
2225
|
}
|
|
2215
2226
|
Jn2(t5, s5.variables);
|
|
2216
2227
|
for (const e6 of ["sources", "destinations", "transformers"]) {
|
|
2217
2228
|
const r8 = "sources" === e6 ? "source" : "destinations" === e6 ? "destination" : "transformer", l4 = "sources" === e6 ? i6 : "destinations" === e6 ? n6 : o5;
|
|
2218
|
-
if (
|
|
2229
|
+
if (Rn2(s5[e6])) for (const [i7, n7] of Object.entries(s5[e6])) l4.push(i7), Rn2(n7) && (Jn2(t5, n7.variables), "string" == typeof n7.package && a5.push({ package: n7.package, shortName: i7, type: r8, platform: c2 || "web" }));
|
|
2219
2230
|
}
|
|
2220
|
-
if (
|
|
2231
|
+
if (Rn2(s5.stores)) for (const [e6, i7] of Object.entries(s5.stores)) r7.push(e6), Rn2(i7) && Jn2(t5, i7.variables);
|
|
2221
2232
|
}
|
|
2222
2233
|
const d2 = { variables: t5, stepNames: { sources: i6, destinations: n6, transformers: o5, stores: r7 }, flowNames: l3 };
|
|
2223
2234
|
c2 && (d2.platform = c2);
|
|
@@ -2228,9 +2239,9 @@ function fn2(e4, t4) {
|
|
|
2228
2239
|
return a4 && (t4?.secrets && (a4.secrets = t4.secrets), (function(e5, t5, i6, n6, o5) {
|
|
2229
2240
|
(function(e6, t6, i7) {
|
|
2230
2241
|
let n7;
|
|
2231
|
-
|
|
2232
|
-
for (; null !== (n7 =
|
|
2233
|
-
const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 =
|
|
2242
|
+
Sn2.lastIndex = 0;
|
|
2243
|
+
for (; null !== (n7 = Sn2.exec(e6)); ) {
|
|
2244
|
+
const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 = On(e6, n7.index, t7.length);
|
|
2234
2245
|
i7.push({ message: `Malformed reference "${t7}", use a dot, not a colon: "$${o6}.${r7}".`, severity: "warning", path: t7, ...a5 });
|
|
2235
2246
|
}
|
|
2236
2247
|
})(e5, 0, o5), (function(e6, t6, i7) {
|
|
@@ -2238,170 +2249,170 @@ function fn2(e4, t4) {
|
|
|
2238
2249
|
const n7 = /\$var\.(\w+)/g;
|
|
2239
2250
|
let o6;
|
|
2240
2251
|
for (; null !== (o6 = n7.exec(e6)); ) if (!(o6[1] in t6.variables)) {
|
|
2241
|
-
const n8 =
|
|
2252
|
+
const n8 = On(e6, o6.index, o6[0].length);
|
|
2242
2253
|
i7.push({ message: `Unknown variable "$var.${o6[1]}". Defined: ${Object.keys(t6.variables).join(", ") || "none"}`, severity: "warning", path: `$var.${o6[1]}`, ...n8 });
|
|
2243
2254
|
}
|
|
2244
2255
|
})(e5, i6, o5), (function(e6, t6, i7) {
|
|
2245
2256
|
const n7 = t6.stepNames?.stores ?? [];
|
|
2246
2257
|
let o6;
|
|
2247
|
-
|
|
2248
|
-
for (; null !== (o6 =
|
|
2249
|
-
const t7 =
|
|
2258
|
+
bn3.lastIndex = 0;
|
|
2259
|
+
for (; null !== (o6 = bn3.exec(e6)); ) if (!n7.includes(o6[1])) {
|
|
2260
|
+
const t7 = On(e6, o6.index, o6[0].length);
|
|
2250
2261
|
i7.push({ message: `Unknown store "$store.${o6[1]}". Defined: ${n7.join(", ") || "none"}`, severity: "warning", path: `$store.${o6[1]}`, ...t7 });
|
|
2251
2262
|
}
|
|
2252
2263
|
})(e5, i6, o5), (function(e6, t6, i7) {
|
|
2253
2264
|
let n7;
|
|
2254
|
-
|
|
2255
|
-
for (; null !== (n7 =
|
|
2256
|
-
const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 =
|
|
2265
|
+
hn2.lastIndex = 0;
|
|
2266
|
+
for (; null !== (n7 = hn2.exec(e6)); ) {
|
|
2267
|
+
const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 = On(e6, n7.index, t7.length);
|
|
2257
2268
|
r7 ? i7.push({ message: `Malformed $env reference "${t7}". Use ":" for default values, not "=" (e.g., "$env.${o6}:fallback").`, severity: "warning", path: t7, ...a5 }) : /^[A-Z][A-Z0-9_]*$/.test(o6) || i7.push({ message: `$env.${o6} should use UPPER_SNAKE_CASE by convention (e.g., $env.${o6.toUpperCase()}).`, severity: "warning", path: t7, ...a5 });
|
|
2258
2269
|
}
|
|
2259
2270
|
})(e5, 0, o5), (function(e6, t6, i7) {
|
|
2260
2271
|
const n7 = t6.flowNames ?? [];
|
|
2261
2272
|
if (0 === n7.length) return;
|
|
2262
2273
|
let o6;
|
|
2263
|
-
|
|
2264
|
-
for (; null !== (o6 =
|
|
2274
|
+
vn3.lastIndex = 0;
|
|
2275
|
+
for (; null !== (o6 = vn3.exec(e6)); ) {
|
|
2265
2276
|
const t7 = o6[0], r7 = o6[1];
|
|
2266
2277
|
if (!n7.includes(r7)) {
|
|
2267
|
-
const a5 =
|
|
2278
|
+
const a5 = On(e6, o6.index, t7.length);
|
|
2268
2279
|
i7.push({ message: `Unknown flow "$flow.${r7}". Defined: ${n7.join(", ")}`, severity: "warning", path: t7, ...a5 });
|
|
2269
2280
|
}
|
|
2270
2281
|
}
|
|
2271
2282
|
})(e5, i6, o5), (function(e6, t6, i7, n7, o6) {
|
|
2272
2283
|
const r7 = i7.secrets;
|
|
2273
|
-
if (!
|
|
2284
|
+
if (!Rn2(t6) || !Rn2(t6.flows)) return;
|
|
2274
2285
|
for (const i8 of Object.values(t6.flows)) {
|
|
2275
|
-
if (!
|
|
2276
|
-
const t7 = i8.config, a5 = !
|
|
2286
|
+
if (!Rn2(i8)) continue;
|
|
2287
|
+
const t7 = i8.config, a5 = !Rn2(t7) || "web" !== t7.platform && "server" !== t7.platform ? void 0 : t7.platform, s4 = JSON.stringify(i8);
|
|
2277
2288
|
let c2;
|
|
2278
|
-
for (
|
|
2279
|
-
const t8 = c2[0], i9 = c2[1], s5 = e6.indexOf(t8), l3 = -1 === s5 ? { line: 1, column: 1 } :
|
|
2289
|
+
for (yn3.lastIndex = 0; null !== (c2 = yn3.exec(s4)); ) {
|
|
2290
|
+
const t8 = c2[0], i9 = c2[1], s5 = e6.indexOf(t8), l3 = -1 === s5 ? { line: 1, column: 1 } : On(e6, s5, t8.length);
|
|
2280
2291
|
"web" !== a5 ? r7 && !r7.includes(i9) && o6.push({ message: `Unknown secret "$secret.${i9}"; not in the project's registered secrets.`, severity: "warning", path: t8, ...l3 }) : n7.push({ message: `Secret "$secret.${i9}" cannot be used in a web flow \u2014 secrets are never sent to the browser; use a server flow.`, severity: "error", path: t8, ...l3 });
|
|
2281
2292
|
}
|
|
2282
2293
|
}
|
|
2283
2294
|
})(e5, t5, i6, n6, o5);
|
|
2284
2295
|
})(e4, i5, a4, n5, o4)), (function(e5, t5, i6) {
|
|
2285
|
-
if (!
|
|
2296
|
+
if (!Rn2(t5) || !Rn2(t5.flows)) return;
|
|
2286
2297
|
for (const n6 of Object.values(t5.flows)) {
|
|
2287
|
-
if (!
|
|
2288
|
-
const t6 =
|
|
2289
|
-
t6 &&
|
|
2298
|
+
if (!Rn2(n6)) continue;
|
|
2299
|
+
const t6 = Rn2(n6.stores) ? n6.stores : void 0;
|
|
2300
|
+
t6 && jn2(e5, t6, i6), t6 && Rn2(n6.transformers) && Pn2(e5, n6.transformers, t6, i6);
|
|
2290
2301
|
}
|
|
2291
2302
|
})(e4, i5, o4), { valid: 0 === n5.length, errors: n5, warnings: o4, context: a4 };
|
|
2292
2303
|
}
|
|
2293
|
-
function
|
|
2294
|
-
return
|
|
2304
|
+
function xn2(e4) {
|
|
2305
|
+
return Rn2(e4.config) && true === e4.config.file;
|
|
2295
2306
|
}
|
|
2296
|
-
function
|
|
2297
|
-
for (const [n5, o4] of Object.entries(t4))
|
|
2307
|
+
function jn2(e4, t4, i5) {
|
|
2308
|
+
for (const [n5, o4] of Object.entries(t4)) Rn2(o4) && xn2(o4) && void 0 !== o4.cache && i5.push({ message: `Store "${n5}" sets file: true and cache. The cache holds structured values; caching a byte-serving store offers no benefit. Remove cache or unset file.`, severity: "warning", path: `stores.${n5}`, ...Dn2(e4, n5) });
|
|
2298
2309
|
}
|
|
2299
|
-
function
|
|
2310
|
+
function Pn2(e4, t4, i5, n5) {
|
|
2300
2311
|
for (const o4 of Object.values(t4)) {
|
|
2301
|
-
if (!
|
|
2302
|
-
if (o4.package !==
|
|
2303
|
-
if (!
|
|
2312
|
+
if (!Rn2(o4)) continue;
|
|
2313
|
+
if (o4.package !== kn3) continue;
|
|
2314
|
+
if (!Rn2(o4.env)) continue;
|
|
2304
2315
|
const t5 = o4.env.store;
|
|
2305
2316
|
if ("string" != typeof t5) continue;
|
|
2306
|
-
const r6 =
|
|
2317
|
+
const r6 = Cn3.exec(t5);
|
|
2307
2318
|
if (!r6) continue;
|
|
2308
2319
|
const a4 = r6[1], s4 = i5[a4];
|
|
2309
|
-
if (!
|
|
2320
|
+
if (!Rn2(s4)) continue;
|
|
2310
2321
|
const c2 = s4.package;
|
|
2311
|
-
"string" == typeof c2 &&
|
|
2322
|
+
"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
2323
|
}
|
|
2313
2324
|
}
|
|
2314
|
-
function
|
|
2325
|
+
function Dn2(e4, t4) {
|
|
2315
2326
|
const i5 = e4.indexOf(`"${t4}"`);
|
|
2316
|
-
return -1 === i5 ? { line: 1, column: 1 } :
|
|
2327
|
+
return -1 === i5 ? { line: 1, column: 1 } : En2(e4, i5);
|
|
2317
2328
|
}
|
|
2318
|
-
function
|
|
2329
|
+
function En2(e4, t4) {
|
|
2319
2330
|
let i5 = 1, n5 = 1;
|
|
2320
2331
|
for (let o4 = 0; o4 < t4 && o4 < e4.length; o4++) "\n" === e4[o4] ? (i5++, n5 = 1) : n5++;
|
|
2321
2332
|
return { line: i5, column: n5 };
|
|
2322
2333
|
}
|
|
2323
|
-
function
|
|
2324
|
-
const n5 =
|
|
2334
|
+
function On(e4, t4, i5) {
|
|
2335
|
+
const n5 = En2(e4, t4), o4 = En2(e4, t4 + i5);
|
|
2325
2336
|
return { line: n5.line, column: n5.column, endLine: o4.line, endColumn: o4.column };
|
|
2326
2337
|
}
|
|
2327
|
-
function
|
|
2338
|
+
function In2(e4, t4) {
|
|
2328
2339
|
if (0 === t4.length) return { line: 1, column: 1 };
|
|
2329
2340
|
const i5 = t4[t4.length - 1];
|
|
2330
2341
|
if ("string" == typeof i5) {
|
|
2331
2342
|
const t5 = `"${i5}"`, n5 = e4.lastIndexOf(t5);
|
|
2332
|
-
if (-1 !== n5) return
|
|
2343
|
+
if (-1 !== n5) return En2(e4, n5);
|
|
2333
2344
|
}
|
|
2334
2345
|
return { line: 1, column: 1 };
|
|
2335
2346
|
}
|
|
2336
|
-
function
|
|
2347
|
+
function Rn2(e4) {
|
|
2337
2348
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
|
|
2338
2349
|
}
|
|
2339
2350
|
function Jn2(e4, t4) {
|
|
2340
|
-
if (
|
|
2351
|
+
if (Rn2(t4)) for (const [i5, n5] of Object.entries(t4)) e4[i5] = n5;
|
|
2341
2352
|
}
|
|
2342
|
-
function
|
|
2353
|
+
function Mn2(e4) {
|
|
2343
2354
|
const t4 = {};
|
|
2344
|
-
if (!
|
|
2345
|
-
const i5 =
|
|
2346
|
-
if (!
|
|
2355
|
+
if (!Rn2(e4)) return t4;
|
|
2356
|
+
const i5 = Rn2(e4.properties) ? e4.properties.data : void 0;
|
|
2357
|
+
if (!Rn2(i5)) return t4;
|
|
2347
2358
|
const n5 = Array.isArray(i5.required) ? i5.required.filter((e5) => "string" == typeof e5) : [], o4 = i5.properties;
|
|
2348
|
-
if (!
|
|
2359
|
+
if (!Rn2(o4)) return t4;
|
|
2349
2360
|
for (const [e5, i6] of Object.entries(o4)) {
|
|
2350
2361
|
const o5 = {};
|
|
2351
|
-
|
|
2362
|
+
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
2363
|
}
|
|
2353
2364
|
return t4;
|
|
2354
2365
|
}
|
|
2355
|
-
function
|
|
2366
|
+
function Tn2(e4, t4) {
|
|
2356
2367
|
const i5 = [], n5 = {};
|
|
2357
2368
|
for (const [t5, o5] of Object.entries(e4)) {
|
|
2358
2369
|
o5.required && i5.push(t5);
|
|
2359
2370
|
const e5 = { type: o5.type };
|
|
2360
2371
|
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
2372
|
const t6 = {};
|
|
2362
|
-
for (const [e6, i6] of Object.entries(o5.properties)) t6[e6] =
|
|
2373
|
+
for (const [e6, i6] of Object.entries(o5.properties)) t6[e6] = Fn2(i6);
|
|
2363
2374
|
e5.properties = t6;
|
|
2364
2375
|
}
|
|
2365
|
-
"array" === o5.type && o5.items && (e5.items =
|
|
2376
|
+
"array" === o5.type && o5.items && (e5.items = Fn2(o5.items)), n5[t5] = e5;
|
|
2366
2377
|
}
|
|
2367
2378
|
const o4 = { type: "object", properties: n5 };
|
|
2368
2379
|
return t4 && (o4.title = t4), i5.length > 0 && (o4.required = i5), o4;
|
|
2369
2380
|
}
|
|
2370
|
-
function
|
|
2381
|
+
function Fn2(e4) {
|
|
2371
2382
|
const t4 = { type: e4.type };
|
|
2372
2383
|
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
2384
|
const i5 = {};
|
|
2374
|
-
for (const [t5, n5] of Object.entries(e4.properties)) i5[t5] =
|
|
2385
|
+
for (const [t5, n5] of Object.entries(e4.properties)) i5[t5] = Fn2(n5);
|
|
2375
2386
|
t4.properties = i5;
|
|
2376
2387
|
}
|
|
2377
|
-
return "array" === e4.type && e4.items && (t4.items =
|
|
2388
|
+
return "array" === e4.type && e4.items && (t4.items = Fn2(e4.items)), t4;
|
|
2378
2389
|
}
|
|
2379
|
-
function
|
|
2380
|
-
const i5 = { type: "array", items:
|
|
2390
|
+
function $n(e4, t4) {
|
|
2391
|
+
const i5 = { type: "array", items: Fn2(e4) };
|
|
2381
2392
|
return void 0 !== t4?.minItems && (i5.minItems = t4.minItems), void 0 !== t4?.maxItems && (i5.maxItems = t4.maxItems), t4?.description && (i5.description = t4.description), t4?.title && (i5.title = t4.title), i5;
|
|
2382
2393
|
}
|
|
2383
|
-
function
|
|
2394
|
+
function An2(e4, t4 = "string", i5) {
|
|
2384
2395
|
const n5 = { type: t4, enum: [...e4] };
|
|
2385
2396
|
return i5?.description && (n5.description = i5.description), i5?.title && (n5.title = i5.title), n5;
|
|
2386
2397
|
}
|
|
2387
|
-
function
|
|
2388
|
-
return
|
|
2398
|
+
function zn2(e4, t4, i5) {
|
|
2399
|
+
return $n({ type: "object" }, { minItems: 2, maxItems: 2, description: i5 || "Tuple with exactly 2 elements [source, transform]" });
|
|
2389
2400
|
}
|
|
2390
|
-
function
|
|
2401
|
+
function Ln2(e4) {
|
|
2391
2402
|
const t4 = n3.toJSONSchema(e4, { target: "draft-7" });
|
|
2392
|
-
return
|
|
2403
|
+
return qn(t4), t4;
|
|
2393
2404
|
}
|
|
2394
|
-
function
|
|
2405
|
+
function qn(e4) {
|
|
2395
2406
|
const t4 = e4.properties;
|
|
2396
2407
|
if (t4 && "object" == typeof t4) {
|
|
2397
2408
|
Array.isArray(e4.required) && (e4.required = e4.required.filter((e5) => {
|
|
2398
2409
|
const i5 = t4[e5];
|
|
2399
2410
|
return !(i5 && "object" == typeof i5 && "default" in i5);
|
|
2400
2411
|
}));
|
|
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),
|
|
2412
|
+
for (const [e5, i5] of Object.entries(t4)) i5 && "object" == typeof i5 && ("object" === i5.type && i5.properties && "string" != typeof i5.title && (i5.title = e5), qn(i5));
|
|
2402
2413
|
}
|
|
2403
2414
|
}
|
|
2404
|
-
var e3, t3, i3, r4, a3, s2, c, l2, d, p, u, m2, f2, g2,
|
|
2415
|
+
var e3, t3, i3, r4, a3, s2, c, l2, d, p, u, m2, f2, g2, b2, h, v2, S, y2, w2, k2, C2, x, j, P2, D2, E, O, I2, R3, $, A, z3, L2, q2, N2, W, B2, U3, _2, H2, V, Z2, G2, K3, Q2, X3, Y3, ee3, te3, ie3, ne3, oe2, re3, ae3, se2, ce, le2, de2, pe2, ue2, me2, fe, ge2, be2, he2, ve2, Se, ye2, we2, ke2, Ce2, xe, je2, Pe2, De, Ee2, Oe2, Ie2, Re3, Je3, Me, Te, Fe3, $e2, Ae, ze2, Le2, qe2, Ne3, We3, Be3, Ue3, _e2, He2, Ve3, Ze3, Ge3, Ke3, Qe3, Xe3, Ye3, et3, tt3, it2, nt3, ot2, rt2, at2, st2, ct2, lt3, dt2, pt3, ut2, mt2, ft2, gt3, bt3, ht3, vt3, St3, yt2, wt3, kt3, Ct2, xt3, jt3, Pt, Dt2, Et2, Ot3, It3, Rt2, Jt2, Mt2, Tt2, Ft, $t3, At3, zt, Lt2, qt2, Nt3, Wt2, Bt, Ut, _t2, Ht2, Vt2, Zt, Gt2, Kt, Qt, Xt, Yt2, ei, ti, ii, ni, oi, ri, ai, si, ci, li, di, pi, ui, mi, fi, gi, bi, hi, vi, Si, yi, wi, ki, Ci, xi, ji, Di, Ei, Oi, Ii, Ri, Ji, Mi, Ti, Fi, $i, Ai, zi, Li, Ui, _i, Hi, Vi, Zi, Gi, Ki, Qi, Xi, Yi, tn2, nn2, on2, rn3, an, sn2, cn, dn, bn3, hn2, vn3, Sn2, yn3, wn3, kn3, Cn3, Wn;
|
|
2405
2416
|
var init_dev = __esm({
|
|
2406
2417
|
"../core/dist/dev.mjs"() {
|
|
2407
2418
|
"use strict";
|
|
@@ -2410,7 +2421,7 @@ var init_dev = __esm({
|
|
|
2410
2421
|
for (var n5 in i5) e3(t4, n5, { get: i5[n5], enumerable: true });
|
|
2411
2422
|
};
|
|
2412
2423
|
i3 = {};
|
|
2413
|
-
t3(i3, { BaseContextConfig: () =>
|
|
2424
|
+
t3(i3, { BaseContextConfig: () => A, CacheRuleSchema: () => Ye3, CacheSchema: () => et3, CacheSchemas: () => Ze3, ClickIdEntrySchema: () => rn3, CodeSchema: () => tn2, CollectorSchemas: () => Ot3, ConsentSchema: () => Z2, ContractActionsSchema: () => Ji, ContractRuleSchema: () => Ti, ContractSchema: () => Fi, ContractSchemaEntry: () => Ri, Counter: () => d, CredentialsSchema: () => sn2, DeepPartialEventSchema: () => ie3, DestinationSchemas: () => Me, DestinationsMapConfig: () => q2, EntitiesSchema: () => Y3, EntitySchema: () => X3, EventCacheRuleSchema: () => Ge3, EventCacheSchema: () => Ke3, EventSchema: () => ee3, FlowBundlePackageSchema: () => vi, FlowBundleSchema: () => Si, FlowCodeSchema: () => yi, FlowConfigSchema: () => Ai, FlowDestinationSchema: () => Oi, FlowJsonSchema: () => Li, FlowSchema: () => zi, FlowSchemas: () => fi, FlowSourceSchema: () => Di, FlowStoreSchema: () => Ii, FlowTransformerSchema: () => Ei, GenericEnvConfig: () => R3, GenericSettingsConfig: () => I2, HandlersConfig: () => x, HintSchema: () => nn2, HintsSchema: () => on2, IdConfig: () => D2, Identifier: () => c, InitConfig: () => E, LoggerConfigSchema: () => nt3, LoggerHandlerSchema: () => it2, LoopSchema: () => fe, MapSchema: () => be2, MappingResultSchema: () => Ce2, MappingSchemas: () => pe2, MatchExpressionSchema: () => Ae, MatcherSchemas: () => Te, OptionalPrimitiveValue: () => u, OrderedPropertiesSchema: () => H2, PartialEventSchema: () => te3, PolicySchema: () => ve2, PrimaryConfig: () => O, PrimitiveValue: () => p, ProcessingControlConfig: () => z3, PropertiesSchema: () => _2, PropertySchema: () => U3, PropertyTypeSchema: () => B2, QueueConfig: () => P2, RequiredBoolean: () => s2, RequiredNumber: () => a3, RequiredString: () => r4, RouteSchema: () => Be3, RouteWithoutManySchema: () => Ve3, RuleSchema: () => ye2, RulesSchema: () => we2, RuntimeInstanceConfig: () => $, ServiceAccountSchema: () => an, SetSchema: () => ge2, SourceSchema: () => Q2, SourceSchemas: () => Ut, SourceTypeSchema: () => V, SourcesMapConfig: () => L2, StateSchema: () => tt3, StoreCacheRuleSchema: () => Qe3, StoreCacheSchema: () => Xe3, StoreSchemas: () => li, Timestamp: () => l2, TransformerSchemas: () => oi, UserSchema: () => G2, UtilitySchemas: () => m2, ValidateEventsSchema: () => ji, ValueConfigSchema: () => he2, ValueSchema: () => ue2, ValuesSchema: () => me2, VerboseConfig: () => j, WalkerOSSchemas: () => N2, configJsonSchema: () => Ui, consentJsonSchema: () => de2, contractJsonSchema: () => Xi, contractRuleJsonSchema: () => Qi, createArraySchema: () => $n, createConsentConfig: () => F3, createDataTransformationConfig: () => J3, createEnumSchema: () => An2, createMappingRulesConfig: () => M2, createObjectSchema: () => Tn2, createPolicyConfig: () => T3, createTupleSchema: () => zn2, credentialsJsonSchema: () => cn, destinationJsonSchema: () => Zi, entityJsonSchema: () => ce, eventJsonSchema: () => ne3, flowConfigJsonSchema: () => Hi, flowJsonSchema: () => _i, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee2, orderedPropertiesJsonSchema: () => se2, parseConfig: () => qi, parseFlow: () => Wi, partialEventJsonSchema: () => oe2, policyJsonSchema: () => Oe2, propertiesJsonSchema: () => ae3, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Re3, safeParseConfig: () => Ni, safeParseFlow: () => Bi, setJsonSchema: () => De, sourceJsonSchema: () => Vi, sourceTypeJsonSchema: () => le2, storeJsonSchema: () => Ki, transformerJsonSchema: () => Gi, userJsonSchema: () => re3, validateEventsJsonSchema: () => Yi, validateFlowConfig: () => gn, valueConfigJsonSchema: () => je2, valueJsonSchema: () => xe, z: () => n3, zodToSchema: () => Ln2 });
|
|
2414
2425
|
r4 = n3.string();
|
|
2415
2426
|
a3 = n3.number();
|
|
2416
2427
|
s2 = n3.boolean();
|
|
@@ -2420,62 +2431,62 @@ var init_dev = __esm({
|
|
|
2420
2431
|
p = n3.union([n3.string(), n3.number(), n3.boolean()]);
|
|
2421
2432
|
u = p.optional();
|
|
2422
2433
|
m2 = {};
|
|
2423
|
-
t3(m2, { ErrorHandlerSchema: () =>
|
|
2434
|
+
t3(m2, { ErrorHandlerSchema: () => b2, HandlerSchema: () => v2, LogHandlerSchema: () => h, StorageSchema: () => g2, StorageTypeSchema: () => f2, errorHandlerJsonSchema: () => w2, handlerJsonSchema: () => C2, logHandlerJsonSchema: () => k2, storageJsonSchema: () => y2, storageTypeJsonSchema: () => S });
|
|
2424
2435
|
f2 = n3.enum(["local", "session", "cookie"]).meta({ id: "StorageType", title: "Storage.Type", description: "Storage mechanism: local, session, or cookie." }).describe("Storage mechanism: local, session, or cookie");
|
|
2425
2436
|
g2 = n3.object({ Local: n3.literal("local"), Session: n3.literal("session"), Cookie: n3.literal("cookie") }).meta({ id: "StorageConstants", title: "Storage", description: "Storage type constants for type-safe references." }).describe("Storage type constants for type-safe references");
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
v2 = n3.object({ Error:
|
|
2437
|
+
b2 = n3.unknown().meta({ id: "ErrorHandler", title: "Error.Handler", description: "Error handler function: (error, state?) => void." }).describe("Error handler function: (error, state?) => void");
|
|
2438
|
+
h = n3.unknown().meta({ id: "LogHandler", title: "Log.Handler", description: "Log handler function: (message, verbose?) => void." }).describe("Log handler function: (message, verbose?) => void");
|
|
2439
|
+
v2 = n3.object({ Error: b2.describe("Error handler function"), Log: h.describe("Log handler function") }).meta({ id: "Handler", title: "Handler", description: "Handler interface with error and log functions." }).describe("Handler interface with error and log functions");
|
|
2429
2440
|
S = o2(f2);
|
|
2430
2441
|
y2 = o2(g2);
|
|
2431
|
-
w2 = o2(
|
|
2432
|
-
k2 = o2(
|
|
2442
|
+
w2 = o2(b2);
|
|
2443
|
+
k2 = o2(h);
|
|
2433
2444
|
C2 = o2(v2);
|
|
2434
|
-
x = n3.object({ onError:
|
|
2445
|
+
x = n3.object({ onError: b2.optional().describe("Error handler function: (error, state?) => void"), onLog: h.optional().describe("Log handler function: (message, verbose?) => void") }).partial();
|
|
2435
2446
|
j = n3.object({ verbose: n3.boolean().describe("Enable verbose logging for debugging").optional() }).partial();
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2447
|
+
P2 = n3.object({ queue: n3.boolean().describe("Whether to queue events when consent is not granted").optional() }).partial();
|
|
2448
|
+
D2 = n3.object({}).partial();
|
|
2449
|
+
E = n3.object({ init: n3.boolean().describe("Whether to initialize immediately").optional(), loadScript: n3.boolean().describe("Whether to load external script (for web destinations)").optional() }).partial();
|
|
2439
2450
|
O = n3.object({ primary: n3.boolean().describe("Mark as primary (only one can be primary)").optional() }).partial();
|
|
2440
|
-
|
|
2441
|
-
|
|
2451
|
+
I2 = n3.object({ settings: n3.any().optional().describe("Implementation-specific configuration") }).partial();
|
|
2452
|
+
R3 = n3.object({ env: n3.any().optional().describe("Environment dependencies (platform-specific)") }).partial();
|
|
2442
2453
|
$ = n3.object({ type: n3.string().optional().describe("Instance type identifier"), config: n3.unknown().describe("Instance configuration") }).partial();
|
|
2443
|
-
|
|
2454
|
+
A = n3.object({ collector: n3.unknown().describe("Collector instance (runtime object)"), config: n3.unknown().describe("Configuration"), env: n3.unknown().describe("Environment dependencies") }).partial();
|
|
2444
2455
|
z3 = n3.object({ ignore: n3.boolean().describe("Set to true to skip processing").optional(), condition: n3.string().optional().describe("Condition function: return true to process") }).partial();
|
|
2445
2456
|
L2 = n3.object({ sources: n3.record(n3.string(), n3.unknown()).describe("Map of source instances") }).partial();
|
|
2446
2457
|
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
|
-
|
|
2458
|
+
N2 = {};
|
|
2459
|
+
t3(N2, { ConsentSchema: () => Z2, DeepPartialEventSchema: () => ie3, EntitiesSchema: () => Y3, EntitySchema: () => X3, EventSchema: () => ee3, OrderedPropertiesSchema: () => H2, PartialEventSchema: () => te3, PropertiesSchema: () => _2, PropertySchema: () => U3, PropertyTypeSchema: () => B2, SourceFieldsSchema: () => K3, SourceSchema: () => Q2, SourceTypeSchema: () => V, UserSchema: () => G2, consentJsonSchema: () => de2, entityJsonSchema: () => ce, eventJsonSchema: () => ne3, orderedPropertiesJsonSchema: () => se2, partialEventJsonSchema: () => oe2, propertiesJsonSchema: () => ae3, sourceTypeJsonSchema: () => le2, userJsonSchema: () => re3 });
|
|
2460
|
+
B2 = n3.lazy(() => n3.union([n3.boolean(), n3.string(), n3.number(), n3.record(n3.string(), U3)])).meta({ id: "WalkerOSPropertyType", title: "WalkerOS.PropertyType", description: "Base property value types (boolean, string, number, or nested Property record)." });
|
|
2461
|
+
U3 = n3.lazy(() => n3.union([B2, n3.array(B2)])).meta({ id: "WalkerOSProperty", title: "WalkerOS.Property", description: "PropertyType or an array of PropertyType. Recursive structure for nested objects and arrays." });
|
|
2462
|
+
_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");
|
|
2463
|
+
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");
|
|
2464
|
+
V = n3.union([n3.enum(["web", "server", "app", "other"]), n3.string()]).meta({ id: "WalkerOSSourceType", title: "WalkerOS.SourceType", description: "Source type identifier. Standard: web, server, app, other. Extensible to custom strings." }).describe("Source type: web, server, app, other, or custom");
|
|
2454
2465
|
Z2 = n3.record(n3.string(), n3.boolean()).meta({ id: "WalkerOSConsent", title: "WalkerOS.Consent", description: "Consent state mapping. Keys are consent groups (e.g. marketing, functional), values are booleans for granted/denied." }).describe("Consent requirement mapping (group name to state)");
|
|
2455
|
-
|
|
2466
|
+
G2 = _2.and(n3.object({ id: n3.string().optional().describe("User identifier"), device: n3.string().optional().describe("Device identifier"), session: n3.string().optional().describe("Session identifier"), hash: n3.string().optional().describe("Hashed identifier"), address: n3.string().optional().describe("User address"), email: n3.string().email().optional().describe("User email address"), phone: n3.string().optional().describe("User phone number"), userAgent: n3.string().optional().describe("Browser user agent string"), browser: n3.string().optional().describe("Browser name"), browserVersion: n3.string().optional().describe("Browser version"), deviceType: n3.string().optional().describe("Device type (mobile, desktop, tablet)"), os: n3.string().optional().describe("Operating system"), osVersion: n3.string().optional().describe("Operating system version"), screenSize: n3.string().optional().describe("Screen dimensions"), language: n3.string().optional().describe("User language"), country: n3.string().optional().describe("User country"), region: n3.string().optional().describe("User region/state"), city: n3.string().optional().describe("User city"), zip: n3.string().optional().describe("User postal code"), timezone: n3.string().optional().describe("User timezone"), ip: n3.string().optional().describe("User IP address"), internal: n3.boolean().optional().describe("Internal user flag (employee, test user)") })).meta({ id: "WalkerOSUser", title: "WalkerOS.User", description: "User identification and attributes." }).describe("User identification and properties");
|
|
2456
2467
|
K3 = n3.object({ type: n3.string().describe("Source kind (browser, dataLayer, gtag, ...)"), platform: n3.string().optional().describe("Runtime platform (web, server, app, ios, android, terminal, ...)"), version: n3.string().optional().describe("Deployment version of the source emitter"), schema: n3.string().optional().describe('Event model spec version (collector defaults to "4")'), count: n3.number().int().nonnegative().optional().describe("Emission sequence per run"), trace: n3.string().optional().describe("Trace id shared by every event of a run (W3C trace-id shape)"), release: n3.record(n3.string(), n3.string()).optional().describe("Per-flow config release map, keyed by flow name; accumulates across walkerOS crossings"), url: n3.string().optional(), referrer: n3.string().optional(), tool: n3.string().optional(), command: n3.string().optional() });
|
|
2457
|
-
|
|
2468
|
+
Q2 = _2.and(K3).meta({ id: "WalkerOSSource", title: "WalkerOS.Source", description: "Event source information (origin of the event)." }).describe("Event source information");
|
|
2458
2469
|
X3 = n3.lazy(() => n3.object({ entity: n3.string().describe("Entity name"), data: _2.describe("Entity-specific properties"), nested: n3.array(X3).optional().describe("Nested child entities"), context: H2.optional().describe("Entity context data") })).meta({ id: "WalkerOSEntity", title: "WalkerOS.Entity", description: "Nested entity structure with recursive nesting support." }).describe("Nested entity structure with recursive nesting support");
|
|
2459
2470
|
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:
|
|
2471
|
+
ee3 = n3.object({ name: n3.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: _2.describe("Event-specific properties"), context: H2.describe("Ordered context properties with priorities"), globals: _2.describe("Global properties shared across events"), custom: _2.describe("Custom implementation-specific properties"), user: G2.describe("User identification and attributes"), nested: Y3.describe("Related nested entities"), consent: Z2.describe("Consent states at event time"), id: c.describe("W3C span_id, 16 lowercase hex characters"), trigger: r4.describe("Event trigger identifier"), entity: r4.describe("Parsed entity from event name"), action: r4.describe("Parsed action from event name"), timestamp: l2.describe("Unix timestamp in milliseconds since epoch"), timing: a3.describe("Event processing timing information"), source: Q2.describe("Event source information") }).meta({ id: "WalkerOSEvent", title: "WalkerOS.Event", description: "Complete walkerOS event structure." }).describe("Complete walkerOS event structure");
|
|
2461
2472
|
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
|
-
|
|
2473
|
+
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
2474
|
ne3 = o2(ee3);
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2475
|
+
oe2 = o2(te3);
|
|
2476
|
+
re3 = o2(G2);
|
|
2477
|
+
ae3 = o2(_2);
|
|
2478
|
+
se2 = o2(H2);
|
|
2468
2479
|
ce = o2(X3);
|
|
2469
|
-
le2 = o2(
|
|
2480
|
+
le2 = o2(V);
|
|
2470
2481
|
de2 = o2(Z2);
|
|
2471
2482
|
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(() =>
|
|
2483
|
+
t3(pe2, { ConfigSchema: () => ke2, LoopSchema: () => fe, MapSchema: () => be2, PolicySchema: () => ve2, ResultSchema: () => Ce2, RulePatchSchema: () => Se, RuleSchema: () => ye2, RulesSchema: () => we2, SetSchema: () => ge2, ValueConfigSchema: () => he2, ValueSchema: () => ue2, ValuesSchema: () => me2, configJsonSchema: () => Je3, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee2, policyJsonSchema: () => Oe2, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Re3, setJsonSchema: () => De, valueConfigJsonSchema: () => je2, valueJsonSchema: () => xe });
|
|
2484
|
+
ue2 = n3.lazy(() => n3.union([n3.string().describe('String value or property path (e.g., "data.id")'), n3.number().describe("Numeric value"), n3.boolean().describe("Boolean value"), n3.lazy(() => W), n3.array(ue2).describe("Array of values")])).meta({ id: "MappingValue", title: "Mapping.Value", description: "Polymorphic transform primitive used in every mapping field. A string path, constant, operator object (map/loop/set/condition/consent), or array of values." });
|
|
2474
2485
|
me2 = n3.array(ue2).meta({ id: "MappingValues", title: "Mapping.Values", description: "Array of transformation values." }).describe("Array of transformation values");
|
|
2475
2486
|
fe = n3.lazy(() => n3.tuple([ue2, ue2]).describe("Loop transformation: [source, transform] tuple for array processing")).meta({ id: "MappingLoop", title: "Mapping.Loop", description: "Loop tuple [source, transform] for iterating and transforming arrays." });
|
|
2476
2487
|
ge2 = n3.lazy(() => n3.array(ue2).describe("Set: Array of values for selection or combination")).meta({ id: "MappingSet", title: "Mapping.Set", description: "Set: array of values for selection or combination." });
|
|
2477
|
-
|
|
2478
|
-
|
|
2488
|
+
be2 = n3.lazy(() => n3.record(n3.string(), ue2).describe("Map: Object mapping keys to transformation values")).meta({ id: "MappingMap", title: "Mapping.Map", description: "Map: object mapping keys to transformation values." });
|
|
2489
|
+
he2 = W = n3.object({ key: n3.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'), value: n3.union([n3.string(), n3.number(), n3.boolean()]).optional().describe("Static primitive value"), fn: n3.string().optional().describe("Custom transformation function as string (serialized)"), map: be2.optional().describe("Object mapping: transform event data to structured output"), loop: fe.optional().describe("Loop transformation: [source, transform] for array processing"), set: ge2.optional().describe("Set of values: combine or select from multiple values"), consent: Z2.optional().describe("Required consent states to include this value"), condition: n3.string().optional().describe("Condition function as string: return true to include value"), validate: n3.string().optional().describe("Validation function as string: return true if value is valid") }).refine((e4) => Object.keys(e4).length > 0, { message: "ValueConfig must have at least one property" }).meta({ id: "MappingValueConfig", title: "Mapping.ValueConfig", description: "Object-form value transformation with map/loop/set/condition/consent etc." }).describe("Value transformation configuration with multiple strategies");
|
|
2479
2490
|
ve2 = n3.record(n3.string(), ue2).meta({ id: "MappingPolicy", title: "Mapping.Policy", description: "Policy rules for event pre-processing (key \u2192 value transformation)." }).describe("Policy rules for event pre-processing (key \u2192 value mapping)");
|
|
2480
2491
|
Se = n3.object({ name: n3.string().nullable().optional(), data: n3.union([ue2, me2]).nullable().optional(), settings: n3.unknown().nullable().optional(), condition: n3.string().nullable().optional(), consent: Z2.nullable().optional(), policy: ve2.nullable().optional(), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).nullable().optional(), include: n3.array(n3.string()).nullable().optional(), ignore: n3.boolean().nullable().optional(), silent: n3.boolean().nullable().optional() }).meta({ id: "MappingRulePatch", title: "Mapping.RulePatch", description: "Partial rule deep-merged onto a package-shipped default; a null value clears the inherited field." }).describe("Partial rule for `extend`; null clears an inherited field");
|
|
2481
2492
|
ye2 = n3.object({ name: n3.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), data: n3.union([ue2, me2]).optional().describe("Data transformation rules for event"), settings: n3.unknown().optional().describe("Destination-specific settings for this event mapping"), condition: n3.string().optional().describe("Condition function as string: return true to process event"), consent: Z2.optional().describe("Required consent states to process this event"), policy: ve2.optional().describe("Event-level policy overrides (applied after config-level policy)"), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).optional().describe("Batch scheduling: bare number is the debounce wait window (legacy); object form supports wait/size/age."), include: n3.array(n3.string()).optional().describe('Event sections (e.g. ["context", "globals"]) flattened into context.data'), ignore: n3.boolean().optional().describe("Skip the event entirely. No push, no side effects. Use for suppression."), silent: n3.boolean().optional().describe("Run side effects (settings.identify, ...) but suppress the destination default push call."), extend: Se.optional().describe("Merge mode: a partial rule deep-merged onto the package-shipped default at this key (instead of replacing it). A null value clears an inherited field."), remove: n3.array(n3.string()).optional().describe("Dotted paths stripped from the produced data payload after evaluation (applied last).") }).meta({ id: "MappingRule", title: "Mapping.Rule", description: "Configuration for transforming a single event at one stage of the flow (source or destination)." }).describe("Mapping rule for specific entity-action combination");
|
|
@@ -2483,30 +2494,30 @@ var init_dev = __esm({
|
|
|
2483
2494
|
ke2 = n3.object({ consent: Z2.optional().describe("Required consent states to process any events"), data: n3.union([ue2, me2]).optional().describe("Global data transformation applied to all events"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), mapping: we2.optional().describe("Entity-action specific mapping rules"), policy: ve2.optional().describe("Pre-processing policy rules applied before mapping") }).meta({ id: "MappingConfig", title: "Mapping.Config", description: "Shared mapping configuration (consent, data, include, mapping, policy)." }).describe("Shared mapping configuration for sources and destinations");
|
|
2484
2495
|
Ce2 = n3.object({ eventMapping: ye2.optional().describe("Resolved mapping rule for event"), mappingKey: n3.string().optional().describe('Mapping key used (e.g., "product.view")') }).meta({ id: "MappingResult", title: "Mapping.Result", description: "Mapping resolution result (matched rule + key)." }).describe("Mapping resolution result");
|
|
2485
2496
|
xe = o2(ue2);
|
|
2486
|
-
je2 = o2(
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
Ee2 = o2(
|
|
2497
|
+
je2 = o2(he2);
|
|
2498
|
+
Pe2 = o2(fe);
|
|
2499
|
+
De = o2(ge2);
|
|
2500
|
+
Ee2 = o2(be2);
|
|
2490
2501
|
Oe2 = o2(ve2);
|
|
2491
2502
|
Ie2 = o2(ye2);
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
t3(
|
|
2496
|
-
|
|
2497
|
-
t3(
|
|
2498
|
-
|
|
2499
|
-
$e2 = n3.object({ key: n3.string(), operator:
|
|
2503
|
+
Re3 = o2(we2);
|
|
2504
|
+
Je3 = o2(ke2);
|
|
2505
|
+
Me = {};
|
|
2506
|
+
t3(Me, { BatchSchema: () => ut2, ConfigSchema: () => ot2, ContextSchema: () => st2, DLQSchema: () => wt3, DataSchema: () => mt2, DestinationPolicySchema: () => at2, DestinationsSchema: () => ht3, InitDestinationsSchema: () => bt3, InitSchema: () => gt3, InstanceSchema: () => ft2, PartialConfigSchema: () => rt2, PushBatchContextSchema: () => lt3, PushContextSchema: () => ct2, PushEventSchema: () => dt2, PushEventsSchema: () => pt3, PushResultSchema: () => St3, RefSchema: () => vt3, ResultSchema: () => yt2, batchJsonSchema: () => Pt, configJsonSchema: () => kt3, contextJsonSchema: () => xt3, instanceJsonSchema: () => Dt2, partialConfigJsonSchema: () => Ct2, pushContextJsonSchema: () => jt3, resultJsonSchema: () => Et2 });
|
|
2507
|
+
Te = {};
|
|
2508
|
+
t3(Te, { MatchExpressionSchema: () => Ae, RouteSchema: () => Be3, RouteWithoutManySchema: () => Ve3 });
|
|
2509
|
+
Fe3 = n3.enum(["eq", "contains", "prefix", "suffix", "regex", "gt", "lt", "exists"]).meta({ id: "MatcherOperator", title: "Matcher.Operator", description: "Supported operators for a match condition." });
|
|
2510
|
+
$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
2511
|
Ae = n3.union([$e2, n3.object({ and: n3.array(n3.lazy(() => Ae)) }), n3.object({ or: n3.array(n3.lazy(() => Ae)) })]).meta({ id: "MatcherExpression", title: "Matcher.Expression", description: "Boolean expression tree of match conditions (leaf, and, or)." });
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2512
|
+
ze2 = n3.strictObject({ match: Ae.optional(), next: n3.lazy(() => Be3) });
|
|
2513
|
+
Le2 = n3.strictObject({ match: Ae.optional(), one: n3.array(n3.lazy(() => Be3)) });
|
|
2514
|
+
qe2 = n3.strictObject({ match: Ae.optional(), many: n3.array(n3.lazy(() => Be3)) });
|
|
2504
2515
|
Ne3 = n3.strictObject({ match: Ae });
|
|
2505
|
-
We3 = n3.union([
|
|
2516
|
+
We3 = n3.union([ze2, Le2, qe2, Ne3]);
|
|
2506
2517
|
Be3 = n3.union([n3.string(), n3.array(n3.lazy(() => Be3)), We3]).meta({ id: "Route", title: "Route", description: "Recursive route: string ID, sequence of routes, or a RouteConfig (next/one/many/gate)." });
|
|
2507
2518
|
Ue3 = n3.strictObject({ match: Ae.optional(), next: n3.lazy(() => Ve3) });
|
|
2508
|
-
|
|
2509
|
-
He2 = n3.union([Ue3,
|
|
2519
|
+
_e2 = n3.strictObject({ match: Ae.optional(), one: n3.array(n3.lazy(() => Ve3)) });
|
|
2520
|
+
He2 = n3.union([Ue3, _e2, Ne3]);
|
|
2510
2521
|
Ve3 = n3.union([n3.string(), n3.array(n3.lazy(() => Ve3)), He2]).meta({ id: "RouteWithoutMany", title: "RouteWithoutMany", description: "Route variant for post-collector positions (destination.before). Excludes the many operator \u2014 post-collector fan-out uses the destinations map." });
|
|
2511
2522
|
Ze3 = {};
|
|
2512
2523
|
t3(Ze3, { CacheRuleSchema: () => Ye3, CacheSchema: () => et3, EventCacheRuleSchema: () => Ge3, EventCacheSchema: () => Ke3, StoreCacheRuleSchema: () => Qe3, StoreCacheSchema: () => Xe3 });
|
|
@@ -2545,8 +2556,8 @@ var init_dev = __esm({
|
|
|
2545
2556
|
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
2557
|
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
2558
|
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
|
-
|
|
2559
|
+
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");
|
|
2560
|
+
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
2561
|
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
2562
|
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
2563
|
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 +2568,37 @@ var init_dev = __esm({
|
|
|
2557
2568
|
jt3 = o2(ct2);
|
|
2558
2569
|
Pt = o2(ut2);
|
|
2559
2570
|
Dt2 = o2(ft2);
|
|
2560
|
-
|
|
2571
|
+
Et2 = o2(yt2);
|
|
2561
2572
|
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:
|
|
2573
|
+
t3(Ot3, { CommandTypeSchema: () => It3, ConfigSchema: () => Rt2, DestinationsSchema: () => $t3, InitConfigSchema: () => Mt2, InstanceSchema: () => At3, PushContextSchema: () => Tt2, SessionDataSchema: () => Jt2, SourcesSchema: () => Ft, commandTypeJsonSchema: () => zt, configJsonSchema: () => Lt2, initConfigJsonSchema: () => Nt3, instanceJsonSchema: () => Bt, pushContextJsonSchema: () => Wt2, sessionDataJsonSchema: () => qt2 });
|
|
2574
|
+
It3 = n3.union([n3.enum(["action", "config", "consent", "context", "destination", "elb", "globals", "hook", "init", "link", "run", "user", "walker"]), n3.string()]).meta({ id: "CollectorCommandType", title: "Collector.CommandType", description: "Collector command type identifier (standard or extension string)." }).describe("Collector command type: standard commands or custom string for extensions");
|
|
2575
|
+
Rt2 = n3.object({ run: n3.boolean().describe("Whether to run collector automatically on initialization").optional(), globalsStatic: _2.describe("Static global properties that persist across collector runs"), sessionStatic: n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorSessionStatic", title: "Collector.SessionStatic", description: "Static session data that persists across collector runs." }).describe("Static session data that persists across collector runs"), logger: nt3.optional().describe("Logger configuration (level, handler)"), queueMax: n3.number().optional().describe("Maximum events retained in collector.queue (late-registration replay). FIFO drop on overflow. Default 1000."), name: n3.string().optional().describe("Flow name; keys this flow's entry in event.source.release and the observer flowId."), release: n3.string().optional().describe("Config release id stamped into event.source.release for this flow.") }).meta({ id: "CollectorConfig", title: "Collector.Config", description: "Core collector configuration (globals/session statics, logger, buffer bounds)." }).describe("Core collector configuration");
|
|
2576
|
+
Jt2 = _2.and(n3.object({ isStart: n3.boolean().describe("Whether this is a new session start"), storage: n3.boolean().describe("Whether storage is available"), id: c.describe("Session identifier").optional(), start: l2.describe("Session start timestamp").optional(), marketing: n3.literal(true).optional().describe("Marketing attribution flag"), updated: l2.describe("Last update timestamp").optional(), isNew: n3.boolean().describe("Whether this is a new session").optional(), device: c.describe("Device identifier").optional(), count: d.describe("Event count in session").optional(), runs: d.describe("Number of runs").optional() })).meta({ id: "CollectorSessionData", title: "Collector.SessionData", description: "Session state and tracking data." }).describe("Session state and tracking data");
|
|
2577
|
+
Mt2 = Rt2.partial().extend({ consent: Z2.optional().describe("Initial consent state"), user: G2.optional().describe("Initial user data"), globals: _2.optional().describe("Initial global properties"), sources: n3.unknown().meta({ id: "CollectorInitSources", title: "Source.InitSources", description: "Source configurations map (id \u2192 InitSource)." }).optional().describe("Source configurations"), destinations: n3.unknown().meta({ id: "CollectorInitDestinations", title: "Destination.InitDestinations", description: "Destination configurations map (id \u2192 Init)." }).optional().describe("Destination configurations"), transformers: n3.unknown().meta({ id: "CollectorInitTransformers", title: "Transformer.Configs", description: "Transformer configurations map (id \u2192 Config)." }).optional().describe("Transformer configurations"), stores: n3.unknown().meta({ id: "CollectorInitStores", title: "Store.Configs", description: "Store configurations map (id \u2192 Config)." }).optional().describe("Store configurations"), custom: _2.optional().describe("Initial custom implementation-specific properties"), hooks: n3.unknown().meta({ id: "CollectorHooks", title: "Collector.Hooks", description: "Pipeline observation hooks." }).optional().describe("Pipeline observation hooks"), observe: n3.union([n3.object({ url: n3.string().describe("Observer base URL"), binding: n3.string().describe("Public project binding the web credential must match") }), n3.object({ url: n3.string().describe("Observer base URL"), sessionId: n3.string().describe("Session id the runtime posts under"), token: n3.string().describe("Ingest bearer token"), level: n3.enum(["off", "standard", "trace"]).optional().describe("Telemetry level"), sample: n3.number().optional().describe("Deterministic sample fraction in [0, 1]") })]).meta({ id: "CollectorObserve", title: "Observe", description: "Observation session connect config: web arm (url + binding) or server arm (url + sessionId + token)." }).optional().describe("Observation session connect config"), observers: n3.unknown().meta({ id: "CollectorObservers", title: "Collector.Observers", description: "Caller-supplied advisory observer functions (runtime objects)." }).optional().describe("Caller-supplied advisory observer functions") }).meta({ id: "CollectorInitConfig", title: "Collector.InitConfig", description: "Collector initialization configuration with initial state (consent, user, globals, components, hooks)." }).describe("Collector initialization configuration with initial state");
|
|
2578
|
+
Tt2 = n3.object({ mapping: ke2.optional().describe("Source-level mapping configuration") }).meta({ id: "CollectorPushContext", title: "Collector.PushContext", description: "Push context with optional source-level mapping." }).describe("Push context with optional source mapping");
|
|
2579
|
+
Ft = n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorSources", title: "Collector.Sources", description: "Map of source IDs to runtime source instances." }).describe("Map of source IDs to source instances");
|
|
2580
|
+
$t3 = n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorDestinations", title: "Collector.Destinations", description: "Map of destination IDs to runtime destination instances." }).describe("Map of destination IDs to destination instances");
|
|
2581
|
+
At3 = n3.object({ push: n3.unknown().describe("Push function for processing events"), command: n3.unknown().describe("Command function for walker commands"), allowed: n3.boolean().describe("Whether event processing is allowed"), config: Rt2.describe("Current collector configuration"), consent: Z2.describe("Current consent state"), custom: _2.describe("Custom implementation-specific properties"), sources: Ft.describe("Registered source instances"), destinations: $t3.describe("Registered destination instances"), globals: _2.describe("Current global properties"), hooks: n3.unknown().describe("Lifecycle hook functions"), on: n3.unknown().describe("Event lifecycle configuration"), queue: n3.array(ee3).describe("Queued events awaiting processing"), round: n3.number().describe("Collector run count (increments with each run)"), session: n3.union([Jt2]).describe("Current session state"), timing: n3.number().describe("Event processing timing information"), user: G2.describe("Current user data") }).meta({ id: "CollectorInstance", title: "Collector.Instance", description: "Collector instance (runtime object with push/command + full state and component maps)." }).describe("Collector instance with state and methods");
|
|
2582
|
+
zt = o2(It3);
|
|
2583
|
+
Lt2 = o2(Rt2);
|
|
2584
|
+
qt2 = o2(Jt2);
|
|
2585
|
+
Nt3 = o2(Mt2);
|
|
2586
|
+
Wt2 = o2(Tt2);
|
|
2587
|
+
Bt = o2(At3);
|
|
2588
|
+
Ut = {};
|
|
2589
|
+
t3(Ut, { BaseEnvSchema: () => _t2, ConfigSchema: () => Ht2, InitSchema: () => Gt2, InitSourceSchema: () => Kt, InitSourcesSchema: () => Qt, InstanceSchema: () => Zt, PartialConfigSchema: () => Vt2, baseEnvJsonSchema: () => Xt, configJsonSchema: () => Yt2, initSourceJsonSchema: () => ii, initSourcesJsonSchema: () => ni, instanceJsonSchema: () => ti, partialConfigJsonSchema: () => ei });
|
|
2590
|
+
_t2 = n3.object({ push: n3.unknown().meta({ id: "SourcePushFn", title: "Source.PushFn", description: "Collector push function passed to the source via dependency injection." }).describe("Collector push function"), command: n3.unknown().meta({ id: "SourceCommandFn", title: "Source.CommandFn", description: "Collector command function passed to the source." }).describe("Collector command function"), sources: n3.unknown().optional().describe("Map of registered source instances"), elb: n3.unknown().meta({ id: "ElbFn", title: "Elb.Fn", description: "Public `elb(...)` API function alias for collector.push." }).describe("Public API function (alias for collector.push)") }).catchall(n3.unknown()).meta({ id: "SourceBaseEnv", title: "Source.BaseEnv", description: "Base environment for source dependency injection; platform-specific sources extend this." }).describe("Base environment for dependency injection - platform-specific sources extend this");
|
|
2591
|
+
Ht2 = ke2.extend({ settings: n3.any().meta({ id: "SourceSettings", title: "Source.Settings", description: "Implementation-specific configuration (source-defined shape)." }).describe("Implementation-specific configuration").optional(), credentials: n3.any().meta({ id: "SourceCredentials", title: "Source.Credentials", description: "Optional credentials slot (source-defined shape); back it with a managed secret via $secret.NAME (credentials use $secret, not $env). The per-package shape is supplied via mergeConfigSchema." }).describe("Optional credentials (source-defined shape)").optional(), env: _t2.optional().describe("Environment dependencies (platform-specific)"), id: c.describe("Source identifier (defaults to source key)").optional(), primary: n3.boolean().describe("Mark as primary (only one can be primary)").optional(), require: n3.array(n3.string()).optional().describe('Defer source initialization until these collector events fire (e.g., ["consent"])'), logger: nt3.optional().describe("Logger configuration (level, handler) to override the collector defaults"), async: n3.boolean().optional().describe('Respond-first acknowledgement for response-producing server sources (express today; future fetch/lambda). When true (the default for such sources) the source responds 2xx ("accepted") before the event is delivered; when false it waits for delivery to settle. Browser/dataLayer sources have no HTTP response to defer and ignore it. A 2xx means accepted, not delivered. Default is per source type.'), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)"), ingest: n3.union([ue2, me2]).optional().describe("Ingest metadata extraction mapping. Extracts values from raw request objects (Express req, Lambda event) using mapping syntax."), disabled: n3.boolean().describe("Completely skip this source (no init, no event capture)").optional(), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this source"), init: n3.boolean().optional().describe("Init lifecycle flag set by collector to true after Instance.init() runs") }).meta({ id: "SourceConfig", title: "Source.Config", description: "Source configuration with mapping, environment, and lifecycle hooks." }).describe("Source configuration with mapping and environment");
|
|
2581
2592
|
Vt2 = Ht2.partial().meta({ id: "SourcePartialConfig", title: "Source.PartialConfig", description: "Partial source configuration with all fields optional." }).describe("Partial source configuration with all fields optional");
|
|
2582
2593
|
Zt = n3.object({ type: n3.string().describe('Source type identifier (e.g., "browser", "dataLayer")'), config: Ht2.describe("Current source configuration"), push: n3.any().meta({ id: "SourceInstancePushFn", title: "Source.PushFn", description: "Push function \u2014 THE HANDLER (flexible signature for platform compatibility)." }).describe("Push function - THE HANDLER (flexible signature for platform compatibility)"), destroy: n3.any().meta({ id: "SourceDestroyFn", title: "Source.DestroyFn", description: "Cleanup function called when the source is removed." }).optional().describe("Cleanup function called when source is removed"), on: n3.unknown().optional().describe("Lifecycle hook function for event types") }).meta({ id: "SourceInstance", title: "Source.Instance", description: "Source instance (runtime object with push handler and lifecycle methods)." }).describe("Source instance with push handler and lifecycle methods");
|
|
2583
2594
|
Gt2 = n3.any().meta({ id: "SourceInit", title: "Source.Init", description: "Source initialization function: (config, env) => Instance | Promise<Instance>." }).describe("Source initialization function: (config, env) => Instance | Promise<Instance>");
|
|
2584
|
-
|
|
2585
|
-
Qt = n3.record(n3.string(),
|
|
2586
|
-
Xt = o2(
|
|
2587
|
-
|
|
2595
|
+
Kt = n3.object({ code: Gt2.describe("Source initialization function"), config: Vt2.optional().describe("Partial configuration overrides"), env: _t2.partial().optional().describe("Partial environment overrides"), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this source"), primary: n3.boolean().optional().describe("Mark as primary source (only one can be primary)") }).meta({ id: "SourceInitSource", title: "Source.InitSource", description: "Source initialization bundle (init function + config + env + primary flag)." }).describe("Source initialization configuration");
|
|
2596
|
+
Qt = n3.record(n3.string(), Kt).meta({ id: "SourceInitSources", title: "Source.InitSources", description: "Map of source IDs to initialization configurations." }).describe("Map of source IDs to initialization configurations");
|
|
2597
|
+
Xt = o2(_t2);
|
|
2598
|
+
Yt2 = o2(Ht2);
|
|
2588
2599
|
ei = o2(Vt2);
|
|
2589
2600
|
ti = o2(Zt);
|
|
2590
|
-
ii = o2(
|
|
2601
|
+
ii = o2(Kt);
|
|
2591
2602
|
ni = o2(Qt);
|
|
2592
2603
|
oi = {};
|
|
2593
2604
|
t3(oi, { ConfigSchema: () => ri, PartialConfigSchema: () => ai, configJsonSchema: () => si, partialConfigJsonSchema: () => ci });
|
|
@@ -2602,12 +2613,12 @@ var init_dev = __esm({
|
|
|
2602
2613
|
ui = o2(di);
|
|
2603
2614
|
mi = o2(pi);
|
|
2604
2615
|
fi = {};
|
|
2605
|
-
t3(fi, { BundlePackageSchema: () => vi, BundleSchema: () => Si, CodeSchema: () => yi, ConfigSchema: () =>
|
|
2616
|
+
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
2617
|
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
|
-
|
|
2618
|
+
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");
|
|
2619
|
+
hi = /^(@[a-z0-9\-~][a-z0-9\-._~]*\/)?[a-z0-9\-~][a-z0-9\-._~]*$/;
|
|
2609
2620
|
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(
|
|
2621
|
+
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
2622
|
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
2623
|
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
2624
|
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 +2629,42 @@ var init_dev = __esm({
|
|
|
2618
2629
|
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
2630
|
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
2631
|
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(),
|
|
2632
|
+
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");
|
|
2633
|
+
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");
|
|
2634
|
+
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
2635
|
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
2636
|
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
|
-
|
|
2637
|
+
$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");
|
|
2638
|
+
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");
|
|
2639
|
+
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");
|
|
2640
|
+
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)");
|
|
2641
|
+
Ui = n3.toJSONSchema(Li, { target: "draft-7" });
|
|
2642
|
+
_i = o2(zi);
|
|
2643
|
+
Hi = o2(Ai);
|
|
2644
|
+
Vi = o2(Di);
|
|
2645
|
+
Zi = o2(Oi);
|
|
2646
|
+
Gi = o2(Ei);
|
|
2647
|
+
Ki = o2(Ii);
|
|
2648
|
+
Qi = o2(Ti);
|
|
2649
|
+
Xi = o2(Fi);
|
|
2650
|
+
Yi = o2(ji);
|
|
2651
|
+
tn2 = en.object({ lang: en.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"), code: en.string().describe("Code snippet") });
|
|
2652
|
+
nn2 = en.object({ text: en.string().describe("Short actionable hint text focused on walkerOS usage"), code: en.array(tn2).optional().describe("Optional code snippets") });
|
|
2653
|
+
on2 = en.record(en.string(), nn2).describe("Keyed hints for AI consumption \u2014 lightweight context beyond schemas and examples");
|
|
2654
|
+
rn3 = n3.object({ param: n3.string().describe("Lowercase URL parameter name. Match is case-insensitive on lookup."), platform: n3.string().describe("Canonical platform identifier (lowercase, kebab-case).") });
|
|
2655
|
+
an = n3.object({ client_email: n3.string().describe("Service account client email"), private_key: n3.string().describe("Service account private key (PEM)"), project_id: n3.string().optional().describe("GCP project id (derived from environment when omitted)") }).meta({ id: "ServiceAccount", title: "ServiceAccount", description: "Google-style service account credentials (client_email, private_key, optional project_id)." }).describe("Google-style service account credentials");
|
|
2656
|
+
sn2 = n3.union([n3.string(), an]).meta({ id: "Credentials", title: "Credentials", description: "Service account credentials: a JSON string (back it with a managed secret via $secret.NAME) or a parsed service account object." }).describe("Service account credentials: a JSON string (back it with a managed secret via $secret.NAME) or a parsed object");
|
|
2657
|
+
cn = o2(sn2);
|
|
2658
|
+
dn = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
|
|
2659
|
+
bn3 = /\$store\.([a-zA-Z_][a-zA-Z0-9_]*)/g;
|
|
2660
|
+
hn2 = /\$env\.([A-Za-z_]\w*)(=[^"}\s]*)?/g;
|
|
2661
|
+
vn3 = /\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?/g;
|
|
2662
|
+
Sn2 = /\$(var|store|flow|secret):([a-zA-Z_][a-zA-Z0-9_]*)/g;
|
|
2663
|
+
yn3 = /\$secret\.([A-Z0-9_]+)/g;
|
|
2664
|
+
wn3 = ["@walkeros/server-store-fs", "@walkeros/server-store-s3", "@walkeros/server-store-gcs"];
|
|
2665
|
+
kn3 = "@walkeros/server-transformer-file";
|
|
2666
|
+
Cn3 = /^\$store\.([a-zA-Z_][a-zA-Z0-9_]*)$/;
|
|
2667
|
+
Wn = { source: Ut.configJsonSchema, destination: Me.configJsonSchema, store: li.configJsonSchema };
|
|
2656
2668
|
}
|
|
2657
2669
|
});
|
|
2658
2670
|
|
|
@@ -3094,7 +3106,7 @@ function hasCodeReference(code) {
|
|
|
3094
3106
|
}
|
|
3095
3107
|
function validateReference(type, name, ref) {
|
|
3096
3108
|
if (type === "Transformer") {
|
|
3097
|
-
const r6 =
|
|
3109
|
+
const r6 = ur({ ...ref }, "Transformer");
|
|
3098
3110
|
if (!r6.ok) {
|
|
3099
3111
|
throw new Error(`Transformer "${name}": ${r6.reason ?? "invalid entry."}`);
|
|
3100
3112
|
}
|
|
@@ -3271,7 +3283,7 @@ function describeError(error) {
|
|
|
3271
3283
|
function withSignal(opts, signal) {
|
|
3272
3284
|
return { ...opts, signal };
|
|
3273
3285
|
}
|
|
3274
|
-
async function withPacoteRetry(
|
|
3286
|
+
async function withPacoteRetry(fn2, label, options = {}) {
|
|
3275
3287
|
const attempts = options.attempts ?? PACOTE_RETRY_ATTEMPTS;
|
|
3276
3288
|
const perAttemptTimeoutMs = options.perAttemptTimeoutMs ?? PACOTE_PER_ATTEMPT_TIMEOUT_MS;
|
|
3277
3289
|
const maxTotalMs = options.maxTotalMs ?? PACOTE_MAX_TOTAL_MS;
|
|
@@ -3286,7 +3298,7 @@ async function withPacoteRetry(fn3, label, options = {}) {
|
|
|
3286
3298
|
const controller = new AbortController();
|
|
3287
3299
|
const timeoutId = setTimeout(() => controller.abort(), attemptTimeoutMs);
|
|
3288
3300
|
try {
|
|
3289
|
-
return await
|
|
3301
|
+
return await fn2(controller.signal);
|
|
3290
3302
|
} catch (error) {
|
|
3291
3303
|
lastError = error;
|
|
3292
3304
|
if (isPermanentError(error)) throw error;
|
|
@@ -4378,7 +4390,8 @@ ${dataDeclaration}`;
|
|
|
4378
4390
|
const stage2Entry = (buildOptions.platform || "node") === "browser" ? generateWebEntry(stage1Path, dataPayload, {
|
|
4379
4391
|
windowCollector: buildOptions.windowCollector,
|
|
4380
4392
|
windowElb: buildOptions.windowElb,
|
|
4381
|
-
platform: buildOptions.platform
|
|
4393
|
+
platform: buildOptions.platform,
|
|
4394
|
+
observe: readObserveConnect(flowSettings, logger)
|
|
4382
4395
|
}) : generateServerEntry(stage1Path, dataPayload);
|
|
4383
4396
|
const stage2EntryPath = path12.join(TEMP_DIR, "stage2.mjs");
|
|
4384
4397
|
await fs11.writeFile(stage2EntryPath, stage2Entry);
|
|
@@ -4991,12 +5004,12 @@ function buildSplitConfigObject(flowSettings, namedImports) {
|
|
|
4991
5004
|
return buildSplitStepEntry("destinations", key, dest);
|
|
4992
5005
|
});
|
|
4993
5006
|
const transformersEntries = Object.entries(transformers).filter(
|
|
4994
|
-
([, transformer]) => transformer.package || hasCodeReference2(transformer.code) ||
|
|
5007
|
+
([, transformer]) => transformer.package || hasCodeReference2(transformer.code) || fr({ ...transformer }, "Transformer")
|
|
4995
5008
|
).map(([key, transformer]) => {
|
|
4996
5009
|
if (isInlineCode2(transformer.code)) {
|
|
4997
5010
|
return ` ${key}: ${generateInlineCode(transformer.code, transformer.config || {}, transformer.env, { before: transformer.before, next: transformer.next })}`;
|
|
4998
5011
|
}
|
|
4999
|
-
if (
|
|
5012
|
+
if (fr({ ...transformer }, "Transformer")) {
|
|
5000
5013
|
const chainLines = [];
|
|
5001
5014
|
if (transformer.before !== void 0) {
|
|
5002
5015
|
chainLines.push(`before: ${JSON.stringify(transformer.before)}`);
|
|
@@ -5134,6 +5147,45 @@ export default async function(context = {}) {
|
|
|
5134
5147
|
return { ...result, httpHandler: httpSource ? httpSource.httpHandler : undefined };
|
|
5135
5148
|
}`;
|
|
5136
5149
|
}
|
|
5150
|
+
function readObserveConnect(flowSettings, logger) {
|
|
5151
|
+
const observe = flowSettings.config?.observe;
|
|
5152
|
+
if (!observe) return void 0;
|
|
5153
|
+
const { url, binding, level, sample } = observe;
|
|
5154
|
+
if (url === void 0 && binding === void 0) return void 0;
|
|
5155
|
+
const trimmedUrl = typeof url === "string" ? url.trim() : "";
|
|
5156
|
+
const trimmedBinding = typeof binding === "string" ? binding.trim() : "";
|
|
5157
|
+
if (trimmedUrl !== "" && trimmedBinding !== "") {
|
|
5158
|
+
return {
|
|
5159
|
+
url: trimmedUrl,
|
|
5160
|
+
binding: trimmedBinding,
|
|
5161
|
+
// Same JSON-borne prudence as the pair: only known-shaped public
|
|
5162
|
+
// values reach the emitted literal.
|
|
5163
|
+
...level === "off" || level === "standard" || level === "trace" ? { level } : {},
|
|
5164
|
+
// Sample is a fraction in [0, 1] per the Flow.Observe contract; the
|
|
5165
|
+
// range test also drops NaN and the infinities.
|
|
5166
|
+
...typeof sample === "number" && sample >= 0 && sample <= 1 ? { sample } : {}
|
|
5167
|
+
};
|
|
5168
|
+
}
|
|
5169
|
+
const missing = [
|
|
5170
|
+
...trimmedUrl === "" ? ["url"] : [],
|
|
5171
|
+
...trimmedBinding === "" ? ["binding"] : []
|
|
5172
|
+
].join(" and ");
|
|
5173
|
+
logger?.warn(
|
|
5174
|
+
`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.`
|
|
5175
|
+
);
|
|
5176
|
+
return void 0;
|
|
5177
|
+
}
|
|
5178
|
+
function emitObserveAssignment(observe) {
|
|
5179
|
+
const literal = {
|
|
5180
|
+
url: observe.url,
|
|
5181
|
+
binding: observe.binding,
|
|
5182
|
+
...observe.flowId !== void 0 ? { flowId: observe.flowId } : {},
|
|
5183
|
+
...observe.level !== void 0 ? { level: observe.level } : {},
|
|
5184
|
+
...observe.sample !== void 0 ? { sample: observe.sample } : {}
|
|
5185
|
+
};
|
|
5186
|
+
return `
|
|
5187
|
+
config.observe = ${JSON.stringify(literal)};`;
|
|
5188
|
+
}
|
|
5137
5189
|
function generateWebEntry(stage1Path, dataPayload, options = {}) {
|
|
5138
5190
|
const assignments = [];
|
|
5139
5191
|
if (options.windowCollector) {
|
|
@@ -5154,30 +5206,14 @@ function generateWebEntry(stage1Path, dataPayload, options = {}) {
|
|
|
5154
5206
|
}
|
|
5155
5207
|
}` : "";
|
|
5156
5208
|
const stage1Specifier = toFileImportSpecifier(stage1Path);
|
|
5157
|
-
const
|
|
5158
|
-
import {
|
|
5159
|
-
const telemetryBlock = options.telemetry ? `
|
|
5160
|
-
// --- Telemetry wiring ---
|
|
5161
|
-
{
|
|
5162
|
-
const __emit = __cbp({
|
|
5163
|
-
url: ${JSON.stringify(options.telemetry.observerUrl)},
|
|
5164
|
-
token: ${JSON.stringify(options.telemetry.ingestToken)},
|
|
5165
|
-
});
|
|
5166
|
-
const __observer = __cto(__emit, {
|
|
5167
|
-
flowId: ${JSON.stringify(options.telemetry.flowId)},
|
|
5168
|
-
level: ${JSON.stringify(options.telemetry.level ?? "standard")},
|
|
5169
|
-
sample: ${JSON.stringify(options.telemetry.sample ?? 1)},
|
|
5170
|
-
});
|
|
5171
|
-
collector.observers.add(__observer);
|
|
5172
|
-
collector.observeLevel = function () { return ${JSON.stringify(options.telemetry.level ?? "standard")}; };
|
|
5173
|
-
}` : "";
|
|
5174
|
-
return `import { startFlow, wireConfig } from '${stage1Specifier}';${telemetryImport}
|
|
5209
|
+
const observeBlock = options.observe ? emitObserveAssignment(options.observe) : "";
|
|
5210
|
+
return `import { startFlow, wireConfig } from '${stage1Specifier}';
|
|
5175
5211
|
|
|
5176
5212
|
const __configData = ${dataPayload};
|
|
5177
5213
|
|
|
5178
5214
|
(async () => {
|
|
5179
|
-
const config = wireConfig(__configData);${envBlock}
|
|
5180
|
-
const { collector, elb } = await startFlow(config);${
|
|
5215
|
+
const config = wireConfig(__configData);${envBlock}${observeBlock}
|
|
5216
|
+
const { collector, elb } = await startFlow(config);${assignmentCode}
|
|
5181
5217
|
})();`;
|
|
5182
5218
|
}
|
|
5183
5219
|
function processConfigValue(value) {
|
|
@@ -5822,7 +5858,7 @@ var init_contract = __esm({
|
|
|
5822
5858
|
"src/core/contract.ts"() {
|
|
5823
5859
|
"use strict";
|
|
5824
5860
|
init_config_file();
|
|
5825
|
-
bakedContractVersion = true ? "
|
|
5861
|
+
bakedContractVersion = true ? "4.0.0" : PLACEHOLDER;
|
|
5826
5862
|
}
|
|
5827
5863
|
});
|
|
5828
5864
|
|
|
@@ -5921,9 +5957,9 @@ async function deleteProject(options = {}) {
|
|
|
5921
5957
|
if (getDefaultProject() === id) clearDefaultProject();
|
|
5922
5958
|
return data ?? { success: true };
|
|
5923
5959
|
}
|
|
5924
|
-
async function handleResult(
|
|
5960
|
+
async function handleResult(fn2, options) {
|
|
5925
5961
|
try {
|
|
5926
|
-
const result = await
|
|
5962
|
+
const result = await fn2();
|
|
5927
5963
|
await writeResult(JSON.stringify(result, null, 2), options);
|
|
5928
5964
|
} catch (error) {
|
|
5929
5965
|
handleCliError(error);
|
|
@@ -6064,9 +6100,9 @@ async function duplicateFlow(options) {
|
|
|
6064
6100
|
if (error) throwApiError(error, "Failed to duplicate flow");
|
|
6065
6101
|
return data;
|
|
6066
6102
|
}
|
|
6067
|
-
async function handleResult2(
|
|
6103
|
+
async function handleResult2(fn2, options) {
|
|
6068
6104
|
try {
|
|
6069
|
-
const result = await
|
|
6105
|
+
const result = await fn2();
|
|
6070
6106
|
await writeResult(JSON.stringify(result, null, 2), options);
|
|
6071
6107
|
} catch (error) {
|
|
6072
6108
|
handleCliError(error);
|
|
@@ -6294,7 +6330,6 @@ function formatPreviewCreated(preview, options) {
|
|
|
6294
6330
|
}
|
|
6295
6331
|
const lines = [
|
|
6296
6332
|
`Preview created (${preview.id})`,
|
|
6297
|
-
` Token: ${preview.token}`,
|
|
6298
6333
|
` Created by: ${preview.createdBy}`,
|
|
6299
6334
|
` Bundle URL: ${preview.bundleUrl}`,
|
|
6300
6335
|
"",
|
|
@@ -6315,6 +6350,244 @@ var init_output2 = __esm({
|
|
|
6315
6350
|
}
|
|
6316
6351
|
});
|
|
6317
6352
|
|
|
6353
|
+
// src/commands/observe/index.ts
|
|
6354
|
+
var observe_exports = {};
|
|
6355
|
+
__export(observe_exports, {
|
|
6356
|
+
formatObserveSession: () => formatObserveSession,
|
|
6357
|
+
getObserveSession: () => getObserveSession,
|
|
6358
|
+
heartbeatObserveSession: () => heartbeatObserveSession,
|
|
6359
|
+
observeStartCommand: () => observeStartCommand,
|
|
6360
|
+
startObserveSession: () => startObserveSession,
|
|
6361
|
+
waitForObserveSessionSettled: () => waitForObserveSessionSettled
|
|
6362
|
+
});
|
|
6363
|
+
function isObserveLevel(value) {
|
|
6364
|
+
return OBSERVE_LEVELS2.includes(value);
|
|
6365
|
+
}
|
|
6366
|
+
async function startObserveSession(options) {
|
|
6367
|
+
const pid = options.projectId ?? requireProjectId();
|
|
6368
|
+
const body = {
|
|
6369
|
+
settingsName: options.settingsName,
|
|
6370
|
+
...options.replace ? { replace: true } : {},
|
|
6371
|
+
...options.level !== void 0 ? { level: options.level } : {}
|
|
6372
|
+
};
|
|
6373
|
+
const response = await apiFetch(
|
|
6374
|
+
`/api/projects/${pid}/flows/${options.flowId}/observe-sessions`,
|
|
6375
|
+
{
|
|
6376
|
+
method: "POST",
|
|
6377
|
+
headers: { "Content-Type": "application/json" },
|
|
6378
|
+
body: JSON.stringify(body)
|
|
6379
|
+
}
|
|
6380
|
+
);
|
|
6381
|
+
if (!response.ok) {
|
|
6382
|
+
const errorBody = await response.json().catch(() => ({}));
|
|
6383
|
+
throwApiResponseError(
|
|
6384
|
+
response,
|
|
6385
|
+
errorBody,
|
|
6386
|
+
"Failed to start observe session"
|
|
6387
|
+
);
|
|
6388
|
+
}
|
|
6389
|
+
return response.json();
|
|
6390
|
+
}
|
|
6391
|
+
async function getObserveSession(options) {
|
|
6392
|
+
const pid = options.projectId ?? requireProjectId();
|
|
6393
|
+
const response = await apiFetch(
|
|
6394
|
+
`/api/projects/${pid}/flows/${options.flowId}/observe-sessions/${options.sessionId}`
|
|
6395
|
+
);
|
|
6396
|
+
if (!response.ok) {
|
|
6397
|
+
const errorBody = await response.json().catch(() => ({}));
|
|
6398
|
+
throwApiResponseError(response, errorBody, "Failed to get observe session");
|
|
6399
|
+
}
|
|
6400
|
+
return response.json();
|
|
6401
|
+
}
|
|
6402
|
+
async function heartbeatObserveSession(options) {
|
|
6403
|
+
const pid = options.projectId ?? requireProjectId();
|
|
6404
|
+
try {
|
|
6405
|
+
await apiFetch(
|
|
6406
|
+
`/api/projects/${pid}/flows/${options.flowId}/observe-sessions/${options.sessionId}/heartbeat`,
|
|
6407
|
+
{ method: "POST" }
|
|
6408
|
+
);
|
|
6409
|
+
} catch {
|
|
6410
|
+
}
|
|
6411
|
+
}
|
|
6412
|
+
async function waitForObserveSessionSettled(options) {
|
|
6413
|
+
const deadline = Date.now() + options.timeoutMs;
|
|
6414
|
+
for (; ; ) {
|
|
6415
|
+
await heartbeatObserveSession(options);
|
|
6416
|
+
const session = await getObserveSession(options);
|
|
6417
|
+
const remainingMs = deadline - Date.now();
|
|
6418
|
+
if (session.status !== "arming" || remainingMs <= 0) return session;
|
|
6419
|
+
await new Promise(
|
|
6420
|
+
(resolve4) => setTimeout(resolve4, Math.min(options.pollIntervalMs, remainingMs))
|
|
6421
|
+
);
|
|
6422
|
+
}
|
|
6423
|
+
}
|
|
6424
|
+
function formatObserveSession(session) {
|
|
6425
|
+
const arming = session.status === "arming";
|
|
6426
|
+
const lines = [`Observe session ${session.id} (${session.status})`];
|
|
6427
|
+
if (session.errorMessage) lines.push(` Error: ${session.errorMessage}`);
|
|
6428
|
+
lines.push("");
|
|
6429
|
+
if (session.web) {
|
|
6430
|
+
lines.push(" Web");
|
|
6431
|
+
lines.push(` Bundle URL: ${session.web.bundleUrl}`);
|
|
6432
|
+
lines.push(` Credential: ${session.web.credential}`);
|
|
6433
|
+
if (session.web.activationUrl) {
|
|
6434
|
+
lines.push(` Activate: ${session.web.activationUrl}`);
|
|
6435
|
+
} else if (session.web.previewEnabled) {
|
|
6436
|
+
lines.push(
|
|
6437
|
+
` Activate: no activation link minted yet${arming ? " (still arming)" : ""}; open the Observe window in the app to mint one`
|
|
6438
|
+
);
|
|
6439
|
+
} else {
|
|
6440
|
+
lines.push(
|
|
6441
|
+
" Activate: not available: the deployed web bundle cannot verify activation grants (redeploy the web flow first)"
|
|
6442
|
+
);
|
|
6443
|
+
}
|
|
6444
|
+
} else {
|
|
6445
|
+
lines.push(` Web: no web part${arming ? " yet (still arming)" : ""}`);
|
|
6446
|
+
}
|
|
6447
|
+
lines.push("");
|
|
6448
|
+
if (session.server) {
|
|
6449
|
+
lines.push(" Server");
|
|
6450
|
+
if (session.serverFlowName) {
|
|
6451
|
+
lines.push(` Flow: ${session.serverFlowName}`);
|
|
6452
|
+
}
|
|
6453
|
+
lines.push(
|
|
6454
|
+
session.server.endpoint ? ` Endpoint: ${session.server.endpoint}` : ` Endpoint: not live${arming ? " yet (still arming)" : ""}`
|
|
6455
|
+
);
|
|
6456
|
+
lines.push(" Env:");
|
|
6457
|
+
lines.push(
|
|
6458
|
+
` WALKEROS_OBSERVER_URL=${session.server.env.WALKEROS_OBSERVER_URL}`
|
|
6459
|
+
);
|
|
6460
|
+
lines.push(
|
|
6461
|
+
` WALKEROS_DEPLOYMENT_ID=${session.server.env.WALKEROS_DEPLOYMENT_ID}`
|
|
6462
|
+
);
|
|
6463
|
+
lines.push(
|
|
6464
|
+
` WALKEROS_INGEST_TOKEN=${session.server.env.WALKEROS_INGEST_TOKEN}`
|
|
6465
|
+
);
|
|
6466
|
+
} else {
|
|
6467
|
+
lines.push(
|
|
6468
|
+
` Server: no server part${arming ? " yet (still arming)" : ""}`
|
|
6469
|
+
);
|
|
6470
|
+
}
|
|
6471
|
+
lines.push("");
|
|
6472
|
+
lines.push(` Expires: ${session.expiresAt}`);
|
|
6473
|
+
lines.push(` Records: ${session.recordsReceived}`);
|
|
6474
|
+
lines.push("");
|
|
6475
|
+
lines.push(
|
|
6476
|
+
" The session lives server-side; closing this terminal does not end it."
|
|
6477
|
+
);
|
|
6478
|
+
lines.push(
|
|
6479
|
+
" Sessions idle out server-side when no tab or traffic keeps them alive."
|
|
6480
|
+
);
|
|
6481
|
+
return {
|
|
6482
|
+
stdoutLast: session.server?.endpoint ?? null,
|
|
6483
|
+
stderr: lines.join("\n")
|
|
6484
|
+
};
|
|
6485
|
+
}
|
|
6486
|
+
function printLoginCta() {
|
|
6487
|
+
process.stderr.write(
|
|
6488
|
+
[
|
|
6489
|
+
"Not logged in.",
|
|
6490
|
+
"",
|
|
6491
|
+
"Starting an observe session needs a walkerOS account.",
|
|
6492
|
+
" 1. Run: walkeros auth login (opens the browser; creates your account if you do not have one)",
|
|
6493
|
+
" 2. Re-run: walkeros observe start <flowId>",
|
|
6494
|
+
""
|
|
6495
|
+
].join("\n") + "\n"
|
|
6496
|
+
);
|
|
6497
|
+
}
|
|
6498
|
+
async function resolveSingleSettingsName(options) {
|
|
6499
|
+
const flow = await getFlow(options);
|
|
6500
|
+
const settings = flow.settings ?? [];
|
|
6501
|
+
const only = settings[0];
|
|
6502
|
+
if (!only) throw new Error("Flow has no settings.");
|
|
6503
|
+
if (settings.length > 1) {
|
|
6504
|
+
throw new Error(
|
|
6505
|
+
`This flow has multiple settings. Use --flow <name> to specify one.
|
|
6506
|
+
Available: ${settings.map((entry) => entry.name).join(", ")}`
|
|
6507
|
+
);
|
|
6508
|
+
}
|
|
6509
|
+
return only.name;
|
|
6510
|
+
}
|
|
6511
|
+
async function observeStartCommand(flowId, options) {
|
|
6512
|
+
try {
|
|
6513
|
+
if (!resolveToken()?.token) {
|
|
6514
|
+
printLoginCta();
|
|
6515
|
+
return;
|
|
6516
|
+
}
|
|
6517
|
+
let level;
|
|
6518
|
+
if (options.level !== void 0) {
|
|
6519
|
+
if (!isObserveLevel(options.level)) {
|
|
6520
|
+
throw new Error(
|
|
6521
|
+
`Invalid --level value: ${options.level} (expected ${OBSERVE_LEVELS2.join(", ")})`
|
|
6522
|
+
);
|
|
6523
|
+
}
|
|
6524
|
+
level = options.level;
|
|
6525
|
+
}
|
|
6526
|
+
let timeoutSeconds = DEFAULT_WAIT_SECONDS;
|
|
6527
|
+
if (options.timeout !== void 0) {
|
|
6528
|
+
const rawTimeout = options.timeout.trim();
|
|
6529
|
+
timeoutSeconds = rawTimeout === "" ? Number.NaN : Number(rawTimeout);
|
|
6530
|
+
if (!Number.isFinite(timeoutSeconds) || timeoutSeconds < 0) {
|
|
6531
|
+
throw new Error(
|
|
6532
|
+
`Invalid --timeout value: ${options.timeout} (expected a non-negative number of seconds)`
|
|
6533
|
+
);
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
const projectId = options.project ?? requireProjectId();
|
|
6537
|
+
const settingsName = options.flow ?? await resolveSingleSettingsName({ projectId, flowId });
|
|
6538
|
+
let session = await startObserveSession({
|
|
6539
|
+
projectId,
|
|
6540
|
+
flowId,
|
|
6541
|
+
settingsName,
|
|
6542
|
+
...options.replace === true ? { replace: true } : {},
|
|
6543
|
+
...level !== void 0 ? { level } : {}
|
|
6544
|
+
});
|
|
6545
|
+
let timedOut = false;
|
|
6546
|
+
if (options.wait !== false) {
|
|
6547
|
+
session = await waitForObserveSessionSettled({
|
|
6548
|
+
projectId,
|
|
6549
|
+
flowId,
|
|
6550
|
+
sessionId: session.id,
|
|
6551
|
+
timeoutMs: timeoutSeconds * 1e3,
|
|
6552
|
+
pollIntervalMs: options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2
|
|
6553
|
+
});
|
|
6554
|
+
timedOut = session.status === "arming";
|
|
6555
|
+
}
|
|
6556
|
+
if (options.json) {
|
|
6557
|
+
await writeResult(JSON.stringify(session, null, 2), {});
|
|
6558
|
+
} else {
|
|
6559
|
+
const { stdoutLast, stderr } = formatObserveSession(session);
|
|
6560
|
+
process.stderr.write(stderr + "\n");
|
|
6561
|
+
if (stdoutLast) process.stdout.write(stdoutLast + "\n");
|
|
6562
|
+
}
|
|
6563
|
+
if (timedOut) {
|
|
6564
|
+
process.stderr.write(
|
|
6565
|
+
`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.
|
|
6566
|
+
`
|
|
6567
|
+
);
|
|
6568
|
+
process.exitCode = 1;
|
|
6569
|
+
}
|
|
6570
|
+
if (session.status === "failed") process.exitCode = 1;
|
|
6571
|
+
} catch (error) {
|
|
6572
|
+
handleCliError(error);
|
|
6573
|
+
}
|
|
6574
|
+
}
|
|
6575
|
+
var OBSERVE_LEVELS2, DEFAULT_WAIT_SECONDS, DEFAULT_POLL_INTERVAL_MS2;
|
|
6576
|
+
var init_observe = __esm({
|
|
6577
|
+
"src/commands/observe/index.ts"() {
|
|
6578
|
+
"use strict";
|
|
6579
|
+
init_auth();
|
|
6580
|
+
init_http();
|
|
6581
|
+
init_api_error();
|
|
6582
|
+
init_output();
|
|
6583
|
+
init_config_file();
|
|
6584
|
+
init_flows();
|
|
6585
|
+
OBSERVE_LEVELS2 = ["off", "standard", "trace"];
|
|
6586
|
+
DEFAULT_WAIT_SECONDS = 300;
|
|
6587
|
+
DEFAULT_POLL_INTERVAL_MS2 = 3e3;
|
|
6588
|
+
}
|
|
6589
|
+
});
|
|
6590
|
+
|
|
6318
6591
|
// src/cli.ts
|
|
6319
6592
|
import { Command } from "commander";
|
|
6320
6593
|
|
|
@@ -6373,6 +6646,7 @@ init_dist();
|
|
|
6373
6646
|
init_dist();
|
|
6374
6647
|
init_dist();
|
|
6375
6648
|
init_dist();
|
|
6649
|
+
init_dist();
|
|
6376
6650
|
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
6651
|
var n = { Commands: t2, Utils: { Storage: { Cookie: "cookie", Local: "local", Session: "session" } } };
|
|
6378
6652
|
function r2(e4, t4) {
|
|
@@ -6381,17 +6655,17 @@ function r2(e4, t4) {
|
|
|
6381
6655
|
n5[e5] = !!t5;
|
|
6382
6656
|
}), e4.consent = oe(e4.consent, n5), { update: n5 };
|
|
6383
6657
|
}
|
|
6384
|
-
function
|
|
6658
|
+
function T2(e4, t4, n5) {
|
|
6385
6659
|
return { traceId: e4.source?.trace ?? t4?._meta.trace ?? n5.trace, sourceId: t4?._meta.path[0], parentEventId: t4?._meta.parentEventId };
|
|
6386
6660
|
}
|
|
6387
|
-
function
|
|
6661
|
+
function _(e4, t4) {
|
|
6388
6662
|
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
6663
|
return t4.traceId && (o4.traceId = t4.traceId), t4.sourceId && (o4.sourceId = t4.sourceId), t4.parentEventId && (o4.parentEventId = t4.parentEventId), o4;
|
|
6390
6664
|
}
|
|
6391
|
-
function
|
|
6665
|
+
function z2(e4) {
|
|
6392
6666
|
return "object" == typeof e4 && null !== e4;
|
|
6393
6667
|
}
|
|
6394
|
-
function
|
|
6668
|
+
function U2(e4, t4, n5) {
|
|
6395
6669
|
if (null === e4 || "object" != typeof e4) return e4;
|
|
6396
6670
|
if (n5 >= 8) return e4;
|
|
6397
6671
|
const o4 = t4.get(e4);
|
|
@@ -6399,18 +6673,18 @@ function T2(e4, t4, n5) {
|
|
|
6399
6673
|
if (Array.isArray(e4)) {
|
|
6400
6674
|
const o5 = [];
|
|
6401
6675
|
t4.set(e4, o5);
|
|
6402
|
-
for (const r7 of e4) o5.push(
|
|
6676
|
+
for (const r7 of e4) o5.push(U2(r7, t4, n5 + 1));
|
|
6403
6677
|
return o5;
|
|
6404
6678
|
}
|
|
6405
6679
|
const r6 = {};
|
|
6406
6680
|
t4.set(e4, r6);
|
|
6407
|
-
for (const [o5, s4] of Object.entries(e4)) r6[o5] = "function" == typeof s4 ? s4 :
|
|
6681
|
+
for (const [o5, s4] of Object.entries(e4)) r6[o5] = "function" == typeof s4 ? s4 : U2(s4, t4, n5 + 1);
|
|
6408
6682
|
return r6;
|
|
6409
6683
|
}
|
|
6410
|
-
function
|
|
6411
|
-
const t4 = [], n5 = [], { simulation: o4, ...r6 } = e4, s4 =
|
|
6684
|
+
function K2(e4) {
|
|
6685
|
+
const t4 = [], n5 = [], { simulation: o4, ...r6 } = e4, s4 = U2(r6, /* @__PURE__ */ new WeakMap(), 0);
|
|
6412
6686
|
for (const e5 of o4) {
|
|
6413
|
-
const o5 =
|
|
6687
|
+
const o5 = jn(e5);
|
|
6414
6688
|
if (0 === o5.length) continue;
|
|
6415
6689
|
const r7 = o5.join(".");
|
|
6416
6690
|
if (o5.length - 1 >= 8) {
|
|
@@ -6420,7 +6694,7 @@ function _(e4) {
|
|
|
6420
6694
|
let a4 = s4, i5 = true;
|
|
6421
6695
|
for (let e6 = 0; e6 < o5.length - 1; e6++) {
|
|
6422
6696
|
const t5 = a4[o5[e6]];
|
|
6423
|
-
if (!
|
|
6697
|
+
if (!z2(t5)) {
|
|
6424
6698
|
i5 = false;
|
|
6425
6699
|
break;
|
|
6426
6700
|
}
|
|
@@ -6438,14 +6712,14 @@ function _(e4) {
|
|
|
6438
6712
|
}
|
|
6439
6713
|
return { wrappedEnv: s4, calls: t4, unresolved: n5 };
|
|
6440
6714
|
}
|
|
6441
|
-
function
|
|
6715
|
+
function B(e4, t4) {
|
|
6442
6716
|
try {
|
|
6443
6717
|
return e4[t4];
|
|
6444
6718
|
} catch {
|
|
6445
6719
|
return "[unreadable]";
|
|
6446
6720
|
}
|
|
6447
6721
|
}
|
|
6448
|
-
function
|
|
6722
|
+
function F2(e4) {
|
|
6449
6723
|
const t4 = /* @__PURE__ */ new WeakSet(), n5 = (e5, o4) => {
|
|
6450
6724
|
if (null === e5) return null;
|
|
6451
6725
|
if ("function" == typeof e5) return "[function]";
|
|
@@ -6465,7 +6739,7 @@ function z2(e4) {
|
|
|
6465
6739
|
return t5 === Object.prototype || null === t5;
|
|
6466
6740
|
})(r6)) {
|
|
6467
6741
|
const e6 = {};
|
|
6468
|
-
for (const t5 of Object.keys(r6)) e6[t5] = n5(
|
|
6742
|
+
for (const t5 of Object.keys(r6)) e6[t5] = n5(B(r6, t5), o4 + 1);
|
|
6469
6743
|
s4 = e6;
|
|
6470
6744
|
} else s4 = (function(e6) {
|
|
6471
6745
|
try {
|
|
@@ -6481,60 +6755,60 @@ function z2(e4) {
|
|
|
6481
6755
|
};
|
|
6482
6756
|
return e4.map((e5) => n5(e5, 0));
|
|
6483
6757
|
}
|
|
6484
|
-
function
|
|
6485
|
-
return e4.map((e5) => ({ fn: e5.fn, args:
|
|
6758
|
+
function R2(e4) {
|
|
6759
|
+
return e4.map((e5) => ({ fn: e5.fn, args: F2(e5.args), ts: e5.ts }));
|
|
6486
6760
|
}
|
|
6487
|
-
function
|
|
6761
|
+
function N(e4, t4, n5, o4) {
|
|
6488
6762
|
if (!Number.isFinite(n5.max) || n5.max <= 0) throw new Error(`pushBounded: max must be > 0 (got ${n5.max})`);
|
|
6489
6763
|
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
6764
|
const r6 = [];
|
|
6491
6765
|
for (; e4.length >= n5.max; ) r6.push(e4.shift());
|
|
6492
6766
|
return e4.push(t4), r6.length > 0 && o4 && o4(r6), { appended: true, dropped: r6.length };
|
|
6493
6767
|
}
|
|
6494
|
-
var
|
|
6495
|
-
function
|
|
6496
|
-
|
|
6768
|
+
var Y2 = /* @__PURE__ */ new WeakMap();
|
|
6769
|
+
function J2(e4, t4, n5, o4) {
|
|
6770
|
+
Y2.get(e4) || (Y2.set(e4, true), t4.warn(n5, o4));
|
|
6497
6771
|
}
|
|
6498
|
-
function
|
|
6499
|
-
|
|
6772
|
+
function X2(e4) {
|
|
6773
|
+
Y2.delete(e4);
|
|
6500
6774
|
}
|
|
6501
|
-
var
|
|
6502
|
-
var
|
|
6503
|
-
function
|
|
6504
|
-
if (void 0 !== e4) return "number" == typeof e4 ? { threshold: e4, cooldown:
|
|
6775
|
+
var Z = 3e4;
|
|
6776
|
+
var ee2 = () => Date.now();
|
|
6777
|
+
function te2(e4) {
|
|
6778
|
+
if (void 0 !== e4) return "number" == typeof e4 ? { threshold: e4, cooldown: Z } : { threshold: e4.threshold ?? 5, cooldown: e4.cooldown ?? Z };
|
|
6505
6779
|
}
|
|
6506
|
-
function
|
|
6780
|
+
function ne2(e4, t4, n5, o4, r6) {
|
|
6507
6781
|
if ("partial" === n5) return;
|
|
6508
6782
|
const s4 = (function(e5, t5) {
|
|
6509
6783
|
return e5[t5] || (e5[t5] = { state: "closed", consecutiveFailures: 0 }), e5[t5];
|
|
6510
6784
|
})(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 =
|
|
6785
|
+
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
6786
|
}
|
|
6513
|
-
var
|
|
6514
|
-
function
|
|
6787
|
+
var re2 = 100;
|
|
6788
|
+
function se(e4, t4) {
|
|
6515
6789
|
return e4.status.destinations[t4] || (e4.status.destinations[t4] = { count: 0, failed: 0, duration: 0, queuePushSize: 0, dlqSize: 0 }), e4.status.destinations[t4];
|
|
6516
6790
|
}
|
|
6517
|
-
function
|
|
6791
|
+
function ae2(e4, t4, n5, o4) {
|
|
6518
6792
|
e4.dropped[t4] || (e4.dropped[t4] = {});
|
|
6519
6793
|
const r6 = e4.dropped[t4];
|
|
6520
6794
|
return r6[n5] = (r6[n5] ?? 0) + o4, r6[n5];
|
|
6521
6795
|
}
|
|
6522
|
-
function
|
|
6796
|
+
function ie2(e4, t4, n5, o4, r6) {
|
|
6523
6797
|
const s4 = o(t4, n5);
|
|
6524
6798
|
return (t5, a4) => {
|
|
6525
6799
|
try {
|
|
6526
6800
|
if (a4) return r6 ? (function(e5, t6, n6, o5, r7, s5) {
|
|
6527
|
-
const a5 = t6.dlq = t6.dlq || [], i5 = { max: t6.config.dlqMax ??
|
|
6801
|
+
const a5 = t6.dlq = t6.dlq || [], i5 = { max: t6.config.dlqMax ?? re2 }, c2 = N(a5, [o5, r7], i5);
|
|
6528
6802
|
if (c2.dropped > 0) {
|
|
6529
|
-
const t7 =
|
|
6530
|
-
|
|
6531
|
-
} else a5.length < i5.max &&
|
|
6532
|
-
const u2 =
|
|
6803
|
+
const t7 = ae2(e5.status, o("destination", n6), "dlq", c2.dropped);
|
|
6804
|
+
J2(a5, s5, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: n6, cap: i5.max, droppedCount: t7 });
|
|
6805
|
+
} else a5.length < i5.max && X2(a5);
|
|
6806
|
+
const u2 = se(e5, n6);
|
|
6533
6807
|
u2.failed++, u2.dlqSize = a5.length, e5.status.failed++;
|
|
6534
|
-
const d2 =
|
|
6808
|
+
const d2 = te2(t6.config.breaker);
|
|
6535
6809
|
if (d2) {
|
|
6536
6810
|
const o6 = t6.config.id || n6;
|
|
6537
|
-
|
|
6811
|
+
ne2(e5.status.breakers, o("destination", o6), "transport-failure", d2.threshold, d2.cooldown);
|
|
6538
6812
|
}
|
|
6539
6813
|
})(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
6814
|
e4.status.connectionErrors[s4] = (e4.status.connectionErrors[s4] ?? 0) + 1, o4.error("connection error", { error: t5 instanceof Error ? t5.message : String(t5) });
|
|
@@ -6542,13 +6816,13 @@ function oe2(e4, t4, n5, o4, r6) {
|
|
|
6542
6816
|
}
|
|
6543
6817
|
};
|
|
6544
6818
|
}
|
|
6545
|
-
function
|
|
6819
|
+
function ze(e4, t4) {
|
|
6546
6820
|
return e4.storeId && t4.stores[e4.storeId] ? t4.stores[e4.storeId] : t4.stores.__cache;
|
|
6547
6821
|
}
|
|
6548
|
-
function
|
|
6822
|
+
function Ue2(e4, t4) {
|
|
6549
6823
|
return e4 ? t4.stores[e4] : t4.stores.__cache;
|
|
6550
6824
|
}
|
|
6551
|
-
function
|
|
6825
|
+
function Ke2(e4) {
|
|
6552
6826
|
const t4 = {};
|
|
6553
6827
|
for (const [n5, o4] of Object.entries(e4)) {
|
|
6554
6828
|
const e5 = o4.config?.next;
|
|
@@ -6556,11 +6830,11 @@ function _e2(e4) {
|
|
|
6556
6830
|
}
|
|
6557
6831
|
return t4;
|
|
6558
6832
|
}
|
|
6559
|
-
function
|
|
6833
|
+
function Be2(e4, t4) {
|
|
6560
6834
|
const n5 = e4.config || {}, o4 = e4[t4];
|
|
6561
6835
|
return void 0 !== o4 ? { config: { ...n5, [t4]: o4 }, chainValue: o4 } : { config: n5, chainValue: void 0 };
|
|
6562
6836
|
}
|
|
6563
|
-
function
|
|
6837
|
+
function Fe2(e4, t4 = {}) {
|
|
6564
6838
|
if (!e4) return [];
|
|
6565
6839
|
if (Array.isArray(e4)) return e4;
|
|
6566
6840
|
const n5 = [], o4 = /* @__PURE__ */ new Set();
|
|
@@ -6576,9 +6850,9 @@ function ze2(e4, t4 = {}) {
|
|
|
6576
6850
|
}
|
|
6577
6851
|
return n5;
|
|
6578
6852
|
}
|
|
6579
|
-
async function
|
|
6853
|
+
async function Re2(e4, t4, n5) {
|
|
6580
6854
|
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:
|
|
6855
|
+
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
6856
|
r6.debug("init");
|
|
6583
6857
|
const a4 = await gt(t4.init, "TransformerInit", e4.hooks, e4.logger)(s4);
|
|
6584
6858
|
if (false === a4) return false;
|
|
@@ -6586,24 +6860,24 @@ async function Ke2(e4, t4, n5) {
|
|
|
6586
6860
|
}
|
|
6587
6861
|
return true;
|
|
6588
6862
|
}
|
|
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: { ...
|
|
6863
|
+
async function He(e4, t4, n5, o4, r6, s4) {
|
|
6864
|
+
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
6865
|
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,
|
|
6866
|
+
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 });
|
|
6867
|
+
g3.inEvent = o4, on(e4, g3);
|
|
6594
6868
|
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,
|
|
6869
|
+
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 });
|
|
6870
|
+
return a5.durationMs = s5 - p3, a5.outEvent = r7, on(e4, a5), i5.debug("push done"), r7;
|
|
6597
6871
|
} 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) },
|
|
6872
|
+
const o5 = Date.now(), r7 = _(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "error", eventId: u2, now: o5, traceId: d2, sourceId: l3, parentEventId: f3 });
|
|
6873
|
+
throw r7.durationMs = o5 - p3, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, on(e4, r7), t5;
|
|
6600
6874
|
}
|
|
6601
6875
|
}
|
|
6602
|
-
function
|
|
6603
|
-
return e4 ? { ...e4, _meta: { ...e4._meta, path: [...e4._meta.path] } } :
|
|
6876
|
+
function Ge2(e4, t4) {
|
|
6877
|
+
return e4 ? { ...e4, _meta: { ...e4._meta, path: [...e4._meta.path] } } : I(t4);
|
|
6604
6878
|
}
|
|
6605
|
-
async function
|
|
6606
|
-
r6 || (r6 =
|
|
6879
|
+
async function We2(e4, t4, n5, o4, r6, s4, a4) {
|
|
6880
|
+
r6 || (r6 = I(n5[0] ?? "chain")), a4 && r6._meta && (r6._meta.chainPath = a4);
|
|
6607
6881
|
let i5 = o4, c2 = s4;
|
|
6608
6882
|
for (const o5 of n5) {
|
|
6609
6883
|
const s5 = t4[o5];
|
|
@@ -6613,8 +6887,8 @@ async function Be2(e4, t4, n5, o4, r6, s4, a4) {
|
|
|
6613
6887
|
}
|
|
6614
6888
|
if (r6 && r6._meta && r6._meta.path.length > 256) return e4.logger.error(`Max path length exceeded at ${o5}`), { event: null, respond: c2 };
|
|
6615
6889
|
r6 && r6._meta && (r6._meta.hops++, r6._meta.path.push(o5));
|
|
6616
|
-
if (!await
|
|
6617
|
-
if (t5 instanceof
|
|
6890
|
+
if (!await Ye(Re2, (t5) => {
|
|
6891
|
+
if (t5 instanceof Xe) throw t5;
|
|
6618
6892
|
return e4.status.failed++, e4.logger.scope(`transformer:${s5.type || "unknown"}`).error("transformer init failed", { transformer: o5, error: t5 }), false;
|
|
6619
6893
|
})(e4, s5, o5)) return { event: null, respond: c2 };
|
|
6620
6894
|
if (a4 && void 0 !== s5.config?.chainMocks?.[a4]) {
|
|
@@ -6627,10 +6901,10 @@ async function Be2(e4, t4, n5, o4, r6, s4, a4) {
|
|
|
6627
6901
|
continue;
|
|
6628
6902
|
}
|
|
6629
6903
|
if (s5.config?.disabled) continue;
|
|
6630
|
-
const u2 = s5.config?.cache, d2 = u2 ?
|
|
6904
|
+
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
6905
|
let h2;
|
|
6632
6906
|
if (d2 && l3) {
|
|
6633
|
-
const e5 =
|
|
6907
|
+
const e5 = Xn(r6, i5), t5 = await er(d2, l3, e5);
|
|
6634
6908
|
if ("HIT" === t5?.status && t5.value) {
|
|
6635
6909
|
if (i5 = t5.value, d2.stop) return { event: i5, respond: c2, stopped: true };
|
|
6636
6910
|
continue;
|
|
@@ -6639,33 +6913,33 @@ async function Be2(e4, t4, n5, o4, r6, s4, a4) {
|
|
|
6639
6913
|
}
|
|
6640
6914
|
const v3 = s5.config.before;
|
|
6641
6915
|
if (v3) {
|
|
6642
|
-
const n6 =
|
|
6916
|
+
const n6 = zn(v3, Xn(r6, i5));
|
|
6643
6917
|
if (1 === n6.length) {
|
|
6644
|
-
const o6 =
|
|
6918
|
+
const o6 = Fe2(n6[0], Ke2(t4));
|
|
6645
6919
|
if (o6.length > 0) {
|
|
6646
|
-
const n7 = await
|
|
6920
|
+
const n7 = await We2(e4, t4, o6, i5, r6, c2, a4);
|
|
6647
6921
|
if (null === n7.event) return { event: null, respond: n7.respond ?? c2 };
|
|
6648
6922
|
if (n7.stopped) return { event: Array.isArray(n7.event) ? n7.event[0] : n7.event, respond: n7.respond ?? c2, stopped: true };
|
|
6649
6923
|
n7.respond && (c2 = n7.respond), i5 = Array.isArray(n7.event) ? n7.event[0] : n7.event;
|
|
6650
6924
|
}
|
|
6651
|
-
} else n6.length > 1 && await Promise.all(n6.map((n7) =>
|
|
6925
|
+
} 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
6926
|
}
|
|
6653
|
-
p3 && p3.length > 0 && (i5 = await
|
|
6654
|
-
const y3 = await
|
|
6927
|
+
p3 && p3.length > 0 && (i5 = await or(p3, (t5) => Ue2(t5, e4), i5, e4));
|
|
6928
|
+
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
6929
|
if (false === y3) return { event: null, respond: c2, droppedBy: o5 };
|
|
6656
6930
|
if (Array.isArray(y3)) {
|
|
6657
6931
|
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 =
|
|
6932
|
+
const o6 = await m3(n6.event || i5), u4 = Ge2(r6, "unknown");
|
|
6659
6933
|
if (n6.next) {
|
|
6660
|
-
const r7 =
|
|
6934
|
+
const r7 = zn(n6.next, Xn(u4, o6));
|
|
6661
6935
|
if (0 === r7.length) return { event: o6, respond: c2 };
|
|
6662
6936
|
if (1 === r7.length) {
|
|
6663
|
-
const n7 =
|
|
6664
|
-
return n7.length > 0 ?
|
|
6937
|
+
const n7 = Fe2(r7[0], Ke2(t4));
|
|
6938
|
+
return n7.length > 0 ? We2(e4, t4, n7, o6, u4, c2, a4) : { event: o6, respond: c2 };
|
|
6665
6939
|
}
|
|
6666
|
-
return (await Promise.all(r7.map((n7) =>
|
|
6940
|
+
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
6941
|
}
|
|
6668
|
-
return s6.length > 0 ?
|
|
6942
|
+
return s6.length > 0 ? We2(e4, t4, s6, o6, u4, c2, a4) : { event: o6, respond: c2 };
|
|
6669
6943
|
}));
|
|
6670
6944
|
let d3 = c2;
|
|
6671
6945
|
const l4 = [];
|
|
@@ -6679,104 +6953,104 @@ async function Be2(e4, t4, n5, o4, r6, s4, a4) {
|
|
|
6679
6953
|
if (y3 && "object" == typeof y3) {
|
|
6680
6954
|
const { event: n6, respond: o6, next: s6 } = y3;
|
|
6681
6955
|
if (o6 && (c2 = o6), void 0 !== s6) {
|
|
6682
|
-
const o7 = await m3(n6 || i5), u3 =
|
|
6956
|
+
const o7 = await m3(n6 || i5), u3 = zn(s6, Xn(r6, o7));
|
|
6683
6957
|
if (0 === u3.length) {
|
|
6684
6958
|
i5 = o7;
|
|
6685
6959
|
continue;
|
|
6686
6960
|
}
|
|
6687
6961
|
if (1 === u3.length) {
|
|
6688
|
-
const n7 =
|
|
6689
|
-
return n7.length > 0 ?
|
|
6962
|
+
const n7 = Fe2(u3[0], Ke2(t4));
|
|
6963
|
+
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
6964
|
}
|
|
6691
|
-
return await Promise.all(u3.map((n7) =>
|
|
6965
|
+
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
6966
|
}
|
|
6693
6967
|
n6 && (i5 = n6);
|
|
6694
6968
|
}
|
|
6695
|
-
g3 && g3.length > 0 && (i5 = await
|
|
6969
|
+
g3 && g3.length > 0 && (i5 = await or(g3, (t5) => Ue2(t5, e4), i5, e4)), h2 && l3 && tr(l3, h2.key, i5, h2.ttl);
|
|
6696
6970
|
const w3 = s5.config.next, b3 = "string" == typeof w3 || Array.isArray(w3) && w3.every((e5) => "string" == typeof e5), k3 = void 0 !== w3 && !b3;
|
|
6697
6971
|
if ((!y3 || "object" == typeof y3 && !y3.next) && k3) {
|
|
6698
|
-
const n6 =
|
|
6972
|
+
const n6 = zn(s5.config.next, Xn(r6, i5));
|
|
6699
6973
|
if (1 === n6.length) {
|
|
6700
|
-
const o6 =
|
|
6701
|
-
return o6.length > 0 ?
|
|
6974
|
+
const o6 = Fe2(n6[0], Ke2(t4));
|
|
6975
|
+
return o6.length > 0 ? We2(e4, t4, o6, i5, r6, c2, a4) : { event: i5, respond: c2 };
|
|
6702
6976
|
}
|
|
6703
|
-
return n6.length > 1 ? (await Promise.all(n6.map((n7) =>
|
|
6977
|
+
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
6978
|
}
|
|
6705
6979
|
}
|
|
6706
6980
|
return { event: i5, respond: c2 };
|
|
6707
6981
|
}
|
|
6708
|
-
function
|
|
6982
|
+
function Le(e4) {
|
|
6709
6983
|
return e4 && de(e4) ? e4 : {};
|
|
6710
6984
|
}
|
|
6711
|
-
function
|
|
6985
|
+
function Ve2(e4) {
|
|
6712
6986
|
return "string" == typeof e4 || !(!Array.isArray(e4) || !e4.every((e5) => "string" == typeof e5));
|
|
6713
6987
|
}
|
|
6714
|
-
async function
|
|
6988
|
+
async function Ne2(e4, t4, n5) {
|
|
6715
6989
|
if (!t4.on || !t4.queueOn?.length) return;
|
|
6716
6990
|
const o4 = t4.queueOn;
|
|
6717
6991
|
t4.queueOn = [];
|
|
6718
6992
|
const r6 = n5 || t4.config?.id || "unknown";
|
|
6719
|
-
for (const { type: n6, data: s4 } of o4)
|
|
6720
|
-
if (t5 instanceof
|
|
6993
|
+
for (const { type: n6, data: s4 } of o4) st(n6) && !dt(e4, t4, n6) || (await Ye(t4.on, (t5) => {
|
|
6994
|
+
if (t5 instanceof Xe) throw t5;
|
|
6721
6995
|
e4.status.failed++, e4.logger.scope("source").error("source on flush failed", { sourceId: r6, type: n6, error: t5 });
|
|
6722
|
-
})(n6, s4),
|
|
6996
|
+
})(n6, s4), st(n6) && ut(e4, t4, n6));
|
|
6723
6997
|
}
|
|
6724
|
-
function
|
|
6998
|
+
function Ye2(e4) {
|
|
6725
6999
|
return Boolean(e4.config.init) && !e4.config.require?.length;
|
|
6726
7000
|
}
|
|
6727
|
-
function
|
|
7001
|
+
function Je2(e4) {
|
|
6728
7002
|
return "object" == typeof e4 && null !== e4;
|
|
6729
7003
|
}
|
|
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 ?
|
|
7004
|
+
async function Xe2(e4, t4, n5) {
|
|
7005
|
+
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
7006
|
let a5;
|
|
6733
7007
|
const u3 = m3 ?? (void 0 !== c2 ? (() => {
|
|
6734
|
-
const t5 =
|
|
7008
|
+
const t5 = zn(c2, Xn(s5.ingest));
|
|
6735
7009
|
if (0 === t5.length) return [];
|
|
6736
|
-
return
|
|
7010
|
+
return Fe2(1 === t5.length ? t5[0] : t5, Ke2(e4.transformers));
|
|
6737
7011
|
})() : []);
|
|
6738
7012
|
let d3 = [n6];
|
|
6739
7013
|
if (u3.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
6740
|
-
const o6 = await
|
|
7014
|
+
const o6 = await We2(e4, e4.transformers, u3, n6, s5.ingest, s5.respond, `source.${t4}.before`);
|
|
6741
7015
|
if (null === o6.event) return { ok: true };
|
|
6742
7016
|
if (o6.stopped) return o6.respond && (s5.respond = o6.respond), { ok: true };
|
|
6743
7017
|
o6.respond && (s5.respond = o6.respond), d3 = Array.isArray(o6.event) ? o6.event : [o6.event];
|
|
6744
7018
|
}
|
|
6745
7019
|
if (p3) {
|
|
6746
|
-
const t5 =
|
|
7020
|
+
const t5 = ze(p3, e4);
|
|
6747
7021
|
if (t5) {
|
|
6748
|
-
const n7 =
|
|
7022
|
+
const n7 = Xn(s5.ingest), o6 = await er(p3, t5, n7);
|
|
6749
7023
|
if (o6) {
|
|
6750
7024
|
if ("HIT" === o6.status && void 0 !== o6.value && p3.stop) {
|
|
6751
7025
|
let t6 = o6.value;
|
|
6752
|
-
return o6.rule.update && (t6 = await
|
|
7026
|
+
return o6.rule.update && (t6 = await nr(t6, o6.rule.update, { ...n7, cache: { status: "HIT" } }, e4)), s5.respond?.(t6), { ok: true };
|
|
6753
7027
|
}
|
|
6754
7028
|
if ("MISS" === o6.status && p3.stop && s5.respond) {
|
|
6755
7029
|
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
|
|
7030
|
+
tr(t5, u4, n8, d4), i6 ? a5 = (async () => {
|
|
7031
|
+
const t6 = await nr(n8, i6, c3, e4);
|
|
6758
7032
|
r7(t6);
|
|
6759
7033
|
})() : r7(n8);
|
|
6760
7034
|
};
|
|
6761
7035
|
s5.respond = l4;
|
|
6762
7036
|
}
|
|
6763
|
-
"MISS" !== o6.status || p3.stop ||
|
|
7037
|
+
"MISS" !== o6.status || p3.stop || tr(t5, o6.key, true, o6.rule.ttl);
|
|
6764
7038
|
}
|
|
6765
7039
|
}
|
|
6766
7040
|
}
|
|
6767
7041
|
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:
|
|
7042
|
+
const t5 = zn(i5, Xn(s5.ingest));
|
|
7043
|
+
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
7044
|
})() : { kind: "single", preChain: [] };
|
|
6771
|
-
!y3 && l3 && l3.length > 0 && (d3 = await Promise.all(d3.map((t5) =>
|
|
7045
|
+
!y3 && l3 && l3.length > 0 && (d3 = await Promise.all(d3.map((t5) => or(l3, (t6) => Ue2(t6, e4), t5, e4))));
|
|
6772
7046
|
let h3 = { ok: true };
|
|
6773
|
-
for (const n7 of d3) "many" === f4.kind ? (await Promise.all(f4.branches.map((a6, i6) =>
|
|
7047
|
+
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
7048
|
return a5 && await a5, h3;
|
|
6775
7049
|
}, b3 = async (n6) => {
|
|
6776
|
-
const o5 =
|
|
6777
|
-
if (!
|
|
7050
|
+
const o5 = I(t4), s5 = Re((function(e5) {
|
|
7051
|
+
if (!Je2(e5)) return;
|
|
6778
7052
|
const t5 = e5.headers;
|
|
6779
|
-
if (
|
|
7053
|
+
if (Je2(t5)) {
|
|
6780
7054
|
if ((function(e6) {
|
|
6781
7055
|
return "get" in e6 && "function" == typeof e6.get;
|
|
6782
7056
|
})(t5)) return t5.get("traceparent") ?? void 0;
|
|
@@ -6787,24 +7061,24 @@ async function Le2(e4, t4, n5) {
|
|
|
6787
7061
|
if (s5 && (o5._meta.trace = s5.trace, o5._meta.parentEventId = s5.parentSpan), !r6.ingest || void 0 === n6) return o5;
|
|
6788
7062
|
const a5 = await et(n6, r6.ingest, { collector: e4 });
|
|
6789
7063
|
return { ...o5, ...a5, _meta: o5._meta };
|
|
6790
|
-
}, k3 = e4.logger.scope("source").scope(t4),
|
|
6791
|
-
const o5 = { ingest:
|
|
7064
|
+
}, k3 = e4.logger.scope("source").scope(t4), I3 = { command: e4.command, sources: e4.sources, elb: e4.elb, logger: k3, ...s4, push: async (e5, n6 = {}) => {
|
|
7065
|
+
const o5 = { ingest: I(t4), respond: void 0 };
|
|
6792
7066
|
return w3(e5, n6, o5);
|
|
6793
|
-
} }, C3 = { collector: e4, logger: k3, id: t4, config: r6, env:
|
|
7067
|
+
} }, C3 = { collector: e4, logger: k3, id: t4, config: r6, env: I3, withScope: async (e5, t5, n6) => {
|
|
6794
7068
|
const o5 = { ingest: await b3(e5), respond: t5 };
|
|
6795
|
-
return n6({ ...
|
|
6796
|
-
}, reportError:
|
|
6797
|
-
if (n6 instanceof
|
|
7069
|
+
return n6({ ...I3, push: (e6, t6 = {}) => w3(e6, t6, o5), ingest: o5.ingest, respond: o5.respond });
|
|
7070
|
+
}, reportError: ie2(e4, "source", t4, k3) }, E2 = await Ye(o4, (n6) => {
|
|
7071
|
+
if (n6 instanceof Xe) throw n6;
|
|
6798
7072
|
e4.status.failed++, e4.logger.scope("source").error("source factory failed", { sourceId: t4, error: n6 });
|
|
6799
7073
|
})(C3);
|
|
6800
|
-
if (!
|
|
6801
|
-
const
|
|
6802
|
-
return
|
|
7074
|
+
if (!E2) return;
|
|
7075
|
+
const S2 = E2.type || "unknown", q3 = e4.logger.scope(S2).scope(t4);
|
|
7076
|
+
return I3.logger = q3, a4 && (E2.config = { ...E2.config, primary: a4 }), E2;
|
|
6803
7077
|
}
|
|
6804
|
-
async function
|
|
7078
|
+
async function Qe2(e4, t4 = {}) {
|
|
6805
7079
|
const n5 = {};
|
|
6806
7080
|
for (const [o4, r6] of Object.entries(t4)) {
|
|
6807
|
-
const t5 = await
|
|
7081
|
+
const t5 = await Xe2(e4, o4, r6);
|
|
6808
7082
|
if (!t5) continue;
|
|
6809
7083
|
const s4 = r6.config?.require;
|
|
6810
7084
|
t5.config = { ...t5.config, init: false, ...s4 ? { require: [...s4] } : {} }, n5[o4] = t5;
|
|
@@ -6813,51 +7087,51 @@ async function Ne2(e4, t4 = {}) {
|
|
|
6813
7087
|
for (const t5 of Object.keys(n5)) {
|
|
6814
7088
|
const n6 = e4.sources[t5];
|
|
6815
7089
|
let o4 = false;
|
|
6816
|
-
n6.init && await
|
|
6817
|
-
if (n7 instanceof
|
|
7090
|
+
n6.init && await Ye(n6.init.bind(n6), (n7) => {
|
|
7091
|
+
if (n7 instanceof Xe) throw n7;
|
|
6818
7092
|
o4 = true, e4.status.failed++, e4.logger.scope("source").error("source init failed", { sourceId: t5, error: n7 });
|
|
6819
|
-
})(), o4 || (n6.config.init = true,
|
|
7093
|
+
})(), o4 || (n6.config.init = true, Ye2(n6) && await Ne2(e4, n6, t5));
|
|
6820
7094
|
}
|
|
6821
|
-
return await
|
|
7095
|
+
return await Ze2(e4), n5;
|
|
6822
7096
|
}
|
|
6823
|
-
async function
|
|
7097
|
+
async function Ze2(e4) {
|
|
6824
7098
|
for (const [t4, n5] of Object.entries(e4.sources)) {
|
|
6825
|
-
if (
|
|
7099
|
+
if (Ye2(n5)) continue;
|
|
6826
7100
|
const o4 = n5.config.require;
|
|
6827
7101
|
if (!o4?.length) continue;
|
|
6828
|
-
const r6 = o4.filter((t5) => !
|
|
6829
|
-
r6.length !== o4.length && (n5.config.require = r6,
|
|
7102
|
+
const r6 = o4.filter((t5) => !it(e4, t5));
|
|
7103
|
+
r6.length !== o4.length && (n5.config.require = r6, Ye2(n5) && await Ne2(e4, n5, t4));
|
|
6830
7104
|
}
|
|
6831
7105
|
for (const [t4, n5] of Object.entries(e4.pending.destinations)) {
|
|
6832
7106
|
if (!e4.pending.destinations[t4] || e4.destinations[t4]) continue;
|
|
6833
7107
|
const o4 = n5.config?.require;
|
|
6834
7108
|
if (!o4) continue;
|
|
6835
|
-
const r6 = o4.filter((t5) => !
|
|
7109
|
+
const r6 = o4.filter((t5) => !it(e4, t5));
|
|
6836
7110
|
if (n5.config && (n5.config.require = r6), r6.length > 0) continue;
|
|
6837
7111
|
delete e4.pending.destinations[t4];
|
|
6838
|
-
const s4 =
|
|
7112
|
+
const s4 = Mt(n5);
|
|
6839
7113
|
false !== s4.config.queue && (s4.queuePush = [...e4.queue]), e4.destinations[t4] = s4;
|
|
6840
7114
|
}
|
|
6841
7115
|
}
|
|
6842
|
-
function
|
|
7116
|
+
function et2(e4) {
|
|
6843
7117
|
if ("object" != typeof e4 || null === e4) return false;
|
|
6844
7118
|
if (!("logger" in e4)) return false;
|
|
6845
7119
|
const t4 = e4.logger;
|
|
6846
7120
|
return "object" == typeof t4 && null !== t4 && ("scope" in t4 && "function" == typeof t4.scope);
|
|
6847
7121
|
}
|
|
6848
|
-
var
|
|
6849
|
-
function
|
|
6850
|
-
|
|
7122
|
+
var tt2 = false;
|
|
7123
|
+
function nt2() {
|
|
7124
|
+
tt2 || (tt2 = true, "undefined" != typeof console && "function" == typeof console.warn && console.warn("walkerOS: ignored an on-dispatch call with a non-collector argument"));
|
|
6851
7125
|
}
|
|
6852
|
-
function
|
|
6853
|
-
if (n5 instanceof
|
|
7126
|
+
function ot(e4, t4, n5, o4) {
|
|
7127
|
+
if (n5 instanceof Xe) throw n5;
|
|
6854
7128
|
e4.logger.scope("on").error("on callback failed", { kind: t4, ...o4, error: n5 });
|
|
6855
7129
|
}
|
|
6856
|
-
var
|
|
6857
|
-
function
|
|
6858
|
-
return
|
|
7130
|
+
var rt = [n.Commands.Consent, n.Commands.User, n.Commands.Globals, n.Commands.Custom];
|
|
7131
|
+
function st(e4) {
|
|
7132
|
+
return rt.includes(e4);
|
|
6859
7133
|
}
|
|
6860
|
-
function
|
|
7134
|
+
function at(e4, t4) {
|
|
6861
7135
|
switch (t4) {
|
|
6862
7136
|
case n.Commands.Consent:
|
|
6863
7137
|
return Object.keys(e4.consent).length > 0;
|
|
@@ -6871,13 +7145,13 @@ function nt2(e4, t4) {
|
|
|
6871
7145
|
return false;
|
|
6872
7146
|
}
|
|
6873
7147
|
}
|
|
6874
|
-
function
|
|
7148
|
+
function it(e4, t4) {
|
|
6875
7149
|
switch (t4) {
|
|
6876
7150
|
case n.Commands.Consent:
|
|
6877
7151
|
case n.Commands.User:
|
|
6878
7152
|
case n.Commands.Globals:
|
|
6879
7153
|
case n.Commands.Custom:
|
|
6880
|
-
return
|
|
7154
|
+
return at(e4, t4);
|
|
6881
7155
|
case n.Commands.Run:
|
|
6882
7156
|
case n.Commands.Ready:
|
|
6883
7157
|
return true === e4.allowed;
|
|
@@ -6885,26 +7159,26 @@ function ot(e4, t4) {
|
|
|
6885
7159
|
return e4.seenEvents.has(String(t4));
|
|
6886
7160
|
}
|
|
6887
7161
|
}
|
|
6888
|
-
function
|
|
7162
|
+
function ct(e4, t4) {
|
|
6889
7163
|
return e4.cellVersion[String(t4)] ?? 0;
|
|
6890
7164
|
}
|
|
6891
|
-
function
|
|
7165
|
+
function ut(e4, t4, n5) {
|
|
6892
7166
|
let o4 = e4.delivery.get(t4);
|
|
6893
|
-
o4 || (o4 = {}, e4.delivery.set(t4, o4)), o4[String(n5)] =
|
|
7167
|
+
o4 || (o4 = {}, e4.delivery.set(t4, o4)), o4[String(n5)] = ct(e4, n5);
|
|
6894
7168
|
}
|
|
6895
|
-
function
|
|
6896
|
-
return e4.allowed &&
|
|
7169
|
+
function dt(e4, t4, n5) {
|
|
7170
|
+
return e4.allowed && ct(e4, n5) > (function(e5, t5, n6) {
|
|
6897
7171
|
const o4 = e5.delivery.get(t5), r6 = o4?.[String(n6)];
|
|
6898
7172
|
return void 0 === r6 ? -1 : r6;
|
|
6899
7173
|
})(e4, t4, n5);
|
|
6900
7174
|
}
|
|
6901
|
-
function
|
|
7175
|
+
function lt2(e4) {
|
|
6902
7176
|
return e4.cascade ? () => {
|
|
6903
7177
|
} : (e4.cascade = { counts: /* @__PURE__ */ new WeakMap() }, () => {
|
|
6904
7178
|
e4.cascade = void 0;
|
|
6905
7179
|
});
|
|
6906
7180
|
}
|
|
6907
|
-
function
|
|
7181
|
+
function ft(e4, t4, n5) {
|
|
6908
7182
|
const o4 = e4.cascade;
|
|
6909
7183
|
if (!o4) return true;
|
|
6910
7184
|
let r6 = o4.counts.get(t4);
|
|
@@ -6912,72 +7186,72 @@ function ct(e4, t4, n5) {
|
|
|
6912
7186
|
const s4 = String(n5), a4 = (r6[s4] || 0) + 1;
|
|
6913
7187
|
return r6[s4] = a4, a4 <= 8 || (9 === a4 && e4.logger.error("state delivery did not converge", { type: s4 }), false);
|
|
6914
7188
|
}
|
|
6915
|
-
function
|
|
7189
|
+
function pt2(e4, t4) {
|
|
6916
7190
|
return { collector: e4, logger: e4.logger.scope("on").scope(String(t4)) };
|
|
6917
7191
|
}
|
|
6918
|
-
async function
|
|
6919
|
-
if (!
|
|
7192
|
+
async function gt2(e4, t4, n5) {
|
|
7193
|
+
if (!et2(e4)) return void nt2();
|
|
6920
7194
|
const o4 = e4.on, r6 = o4[t4] || [], s4 = ie(n5) ? n5 : [n5];
|
|
6921
7195
|
s4.forEach((e5) => {
|
|
6922
7196
|
r6.push(e5);
|
|
6923
|
-
}), o4[t4] = r6,
|
|
7197
|
+
}), o4[t4] = r6, ht2(e4, t4, s4);
|
|
6924
7198
|
}
|
|
6925
|
-
function
|
|
7199
|
+
function mt(e4, t4, n5, o4, r6) {
|
|
6926
7200
|
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) =>
|
|
7201
|
+
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) };
|
|
7202
|
+
Ge(t4.on, (t5) => ot(e4, "destination", t5, { destId: n5, type: o4 }))(o4, i5);
|
|
6929
7203
|
}
|
|
6930
|
-
function
|
|
6931
|
-
if (!
|
|
6932
|
-
const s4 =
|
|
7204
|
+
function ht2(e4, t4, o4, r6) {
|
|
7205
|
+
if (!et2(e4)) return void nt2();
|
|
7206
|
+
const s4 = vt2(e4, t4, r6);
|
|
6933
7207
|
if (o4.length) switch (t4) {
|
|
6934
7208
|
case n.Commands.Consent:
|
|
6935
7209
|
!(function(e5, t5, o5) {
|
|
6936
|
-
const r7 = o5 || e5.consent, s5 =
|
|
7210
|
+
const r7 = o5 || e5.consent, s5 = pt2(e5, n.Commands.Consent);
|
|
6937
7211
|
t5.forEach((t6) => {
|
|
6938
|
-
|
|
6939
|
-
Ge(t6[n5], (t7) =>
|
|
6940
|
-
}),
|
|
7212
|
+
dt(e5, t6, n.Commands.Consent) && ft(e5, t6, n.Commands.Consent) && (Object.keys(r7).filter((e6) => e6 in t6).forEach((n5) => {
|
|
7213
|
+
Ge(t6[n5], (t7) => ot(e5, "consent", t7, { key: n5 }))(r7, s5);
|
|
7214
|
+
}), ut(e5, t6, n.Commands.Consent));
|
|
6941
7215
|
});
|
|
6942
7216
|
})(e4, o4, r6);
|
|
6943
7217
|
break;
|
|
6944
7218
|
case n.Commands.Ready:
|
|
6945
7219
|
!(function(e5, t5) {
|
|
6946
7220
|
if (!e5.allowed) return;
|
|
6947
|
-
const o5 =
|
|
7221
|
+
const o5 = pt2(e5, n.Commands.Ready);
|
|
6948
7222
|
t5.forEach((t6) => {
|
|
6949
|
-
Ge(t6, (t7) =>
|
|
7223
|
+
Ge(t6, (t7) => ot(e5, "ready", t7))(void 0, o5);
|
|
6950
7224
|
});
|
|
6951
7225
|
})(e4, o4);
|
|
6952
7226
|
break;
|
|
6953
7227
|
case n.Commands.Run:
|
|
6954
7228
|
!(function(e5, t5) {
|
|
6955
7229
|
if (!e5.allowed) return;
|
|
6956
|
-
const o5 =
|
|
7230
|
+
const o5 = pt2(e5, n.Commands.Run);
|
|
6957
7231
|
t5.forEach((t6) => {
|
|
6958
|
-
Ge(t6, (t7) =>
|
|
7232
|
+
Ge(t6, (t7) => ot(e5, "run", t7))(void 0, o5);
|
|
6959
7233
|
});
|
|
6960
7234
|
})(e4, o4);
|
|
6961
7235
|
break;
|
|
6962
7236
|
case n.Commands.Session:
|
|
6963
7237
|
!(function(e5, t5) {
|
|
6964
7238
|
if (!e5.session) return;
|
|
6965
|
-
const o5 =
|
|
7239
|
+
const o5 = pt2(e5, n.Commands.Session);
|
|
6966
7240
|
t5.forEach((t6) => {
|
|
6967
|
-
Ge(t6, (t7) =>
|
|
7241
|
+
Ge(t6, (t7) => ot(e5, "session", t7))(e5.session, o5);
|
|
6968
7242
|
});
|
|
6969
7243
|
})(e4, o4);
|
|
6970
7244
|
break;
|
|
6971
7245
|
default: {
|
|
6972
|
-
const n5 =
|
|
7246
|
+
const n5 = pt2(e4, t4), r7 = st(t4);
|
|
6973
7247
|
o4.forEach((o5) => {
|
|
6974
|
-
"function" == typeof o5 && (r7 && !
|
|
7248
|
+
"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
7249
|
});
|
|
6976
7250
|
break;
|
|
6977
7251
|
}
|
|
6978
7252
|
}
|
|
6979
7253
|
}
|
|
6980
|
-
function
|
|
7254
|
+
function vt2(e4, t4, o4) {
|
|
6981
7255
|
switch (t4) {
|
|
6982
7256
|
case n.Commands.Consent:
|
|
6983
7257
|
return o4 || e4.consent;
|
|
@@ -6995,364 +7269,364 @@ function pt2(e4, t4, o4) {
|
|
|
6995
7269
|
return;
|
|
6996
7270
|
}
|
|
6997
7271
|
}
|
|
6998
|
-
async function
|
|
7272
|
+
async function yt(e4, t4, n5, o4, r6) {
|
|
6999
7273
|
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 (!
|
|
7274
|
+
if (st(o4) && !dt(e4, t4, o4)) return false;
|
|
7275
|
+
if (st(o4) && !ft(e4, t4, o4)) return false;
|
|
7276
|
+
const s4 = await Ye(t4.on, (t5) => ot(e4, "source", t5, { sourceId: n5, type: o4 }))(o4, r6);
|
|
7277
|
+
return st(o4) && ut(e4, t4, o4), false === s4;
|
|
7278
|
+
}
|
|
7279
|
+
async function wt2(e4) {
|
|
7280
|
+
if (et2(e4)) for (const t4 of rt) {
|
|
7281
|
+
if (!at(e4, t4)) continue;
|
|
7282
|
+
const n5 = vt2(e4, t4);
|
|
7283
|
+
ht2(e4, t4, e4.on[t4] || []);
|
|
7284
|
+
for (const [o4, r6] of Object.entries(e4.sources)) Ye2(r6) && await yt(e4, r6, o4, t4, n5);
|
|
7285
|
+
}
|
|
7286
|
+
else nt2();
|
|
7287
|
+
}
|
|
7288
|
+
async function bt2(e4, t4, n5, o4) {
|
|
7289
|
+
if (!et2(e4)) return nt2(), true;
|
|
7016
7290
|
e4.seenEvents.add(String(t4));
|
|
7017
7291
|
let r6 = n5 || [];
|
|
7018
7292
|
n5 || (r6 = e4.on[t4] || []);
|
|
7019
|
-
const s4 =
|
|
7293
|
+
const s4 = vt2(e4, t4, o4);
|
|
7020
7294
|
let a4 = false;
|
|
7021
7295
|
for (const [n6, o5] of Object.entries(e4.sources)) {
|
|
7022
7296
|
if (o5.config.require?.length) {
|
|
7023
7297
|
const e5 = o5.config.require.indexOf(t4);
|
|
7024
7298
|
-1 !== e5 && o5.config.require.splice(e5, 1);
|
|
7025
7299
|
}
|
|
7026
|
-
if (o5.on) if (
|
|
7027
|
-
await
|
|
7300
|
+
if (o5.on) if (Ye2(o5)) {
|
|
7301
|
+
await yt(e4, o5, n6, t4, s4) && (a4 = true);
|
|
7028
7302
|
} else o5.queueOn = o5.queueOn || [], o5.queueOn.push({ type: t4, data: s4 });
|
|
7029
7303
|
}
|
|
7030
7304
|
Object.entries(e4.destinations).forEach(([n6, o5]) => {
|
|
7031
7305
|
if (o5.on) {
|
|
7032
7306
|
if (!o5.config.init) return o5.queueOn = o5.queueOn || [], void o5.queueOn.push({ type: t4, data: s4 });
|
|
7033
|
-
|
|
7307
|
+
mt(e4, o5, n6, t4, s4);
|
|
7034
7308
|
}
|
|
7035
7309
|
});
|
|
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
|
|
7310
|
+
for (const [t5, n6] of Object.entries(e4.sources)) Ye2(n6) && n6.queueOn?.length && await Ne2(e4, n6, t5);
|
|
7311
|
+
const i5 = Object.values(e4.sources).some((e5) => !Ye2(e5) && e5.config.require?.length);
|
|
7312
|
+
return (Object.keys(e4.pending.destinations).length > 0 || i5) && await Ze2(e4), ht2(e4, t4, r6, o4), !a4;
|
|
7039
7313
|
}
|
|
7040
|
-
function
|
|
7314
|
+
function kt2(e4) {
|
|
7041
7315
|
return "number" == typeof e4 && e4 > 0 ? e4 : 1e4;
|
|
7042
7316
|
}
|
|
7043
|
-
var
|
|
7317
|
+
var It2 = class extends Error {
|
|
7044
7318
|
constructor(e4) {
|
|
7045
7319
|
super(e4), this.name = "DestinationTimeoutError";
|
|
7046
7320
|
}
|
|
7047
7321
|
};
|
|
7048
|
-
function
|
|
7322
|
+
function Ct(e4, t4, n5) {
|
|
7049
7323
|
let o4;
|
|
7050
7324
|
const r6 = new Promise((e5, r7) => {
|
|
7051
|
-
o4 = setTimeout(() => r7(new
|
|
7325
|
+
o4 = setTimeout(() => r7(new It2(n5)), t4);
|
|
7052
7326
|
});
|
|
7053
7327
|
return Promise.race([e4, r6]).finally(() => {
|
|
7054
7328
|
o4 && clearTimeout(o4);
|
|
7055
7329
|
});
|
|
7056
7330
|
}
|
|
7057
|
-
var
|
|
7058
|
-
function
|
|
7059
|
-
return e4 ===
|
|
7331
|
+
var Et = Object.freeze({ batched: true });
|
|
7332
|
+
function St2(e4) {
|
|
7333
|
+
return e4 === Et;
|
|
7060
7334
|
}
|
|
7061
|
-
function
|
|
7335
|
+
function qt(e4) {
|
|
7062
7336
|
return void 0 === e4 ? {} : "number" == typeof e4 ? { wait: e4 } : { wait: e4.wait, size: e4.size, age: e4.age };
|
|
7063
7337
|
}
|
|
7064
|
-
function
|
|
7338
|
+
function xt2(e4, t4, n5) {
|
|
7065
7339
|
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 ?
|
|
7340
|
+
if (Array.isArray(e4) && e4.every((e5) => "string" == typeof e5)) return Fe2(e4, t4);
|
|
7341
|
+
if ("string" == typeof e4) return Fe2(e4, t4);
|
|
7342
|
+
const o4 = zn(e4, Xn(n5));
|
|
7343
|
+
return 0 === o4.length ? [] : 1 === o4.length ? Fe2(o4[0], t4) : Fe2(o4, t4);
|
|
7070
7344
|
}
|
|
7071
|
-
async function
|
|
7345
|
+
async function Ot2(e4, t4) {
|
|
7072
7346
|
const { code: n5, config: o4 = {}, env: r6 = {}, before: s4, next: a4, cache: i5, state: c2 } = t4;
|
|
7073
|
-
if (!le(n5.push)) return
|
|
7347
|
+
if (!le(n5.push)) return Dt({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
|
|
7074
7348
|
const u2 = o4 || { init: false };
|
|
7075
7349
|
let d2 = s4 ? { ...u2, before: s4 } : { ...u2 };
|
|
7076
7350
|
a4 && (d2 = { ...d2, next: a4 }), i5 && (d2 = { ...d2, cache: i5 }), void 0 !== c2 && void 0 === d2.state && (d2 = { ...d2, state: c2 });
|
|
7077
7351
|
let l3 = d2.id;
|
|
7078
7352
|
if (!l3) do {
|
|
7079
|
-
l3 =
|
|
7353
|
+
l3 = Ee(5, "abcdefghijklmnopqrstuvwxyz");
|
|
7080
7354
|
} while (e4.destinations[l3] || e4.pending.destinations[l3]);
|
|
7081
7355
|
if (d2.require?.length) {
|
|
7082
|
-
e4.pending.destinations[l3] = t4, await
|
|
7356
|
+
e4.pending.destinations[l3] = t4, await Ze2(e4);
|
|
7083
7357
|
const n6 = e4.destinations[l3];
|
|
7084
|
-
return n6 ?
|
|
7358
|
+
return n6 ? jt2(e4, void 0, {}, { [l3]: n6 }) : Dt({ ok: true });
|
|
7085
7359
|
}
|
|
7086
|
-
const f3 = { ...n5, config: d2, env:
|
|
7087
|
-
return e4.destinations[l3] = f3, false !== f3.config.queue && (f3.queuePush = [...e4.queue]),
|
|
7360
|
+
const f3 = { ...n5, config: d2, env: _t(n5.env, r6) };
|
|
7361
|
+
return e4.destinations[l3] = f3, false !== f3.config.queue && (f3.queuePush = [...e4.queue]), jt2(e4, void 0, {}, { [l3]: f3 });
|
|
7088
7362
|
}
|
|
7089
|
-
async function
|
|
7090
|
-
const { allowed: r6, consent: s4, globals: a4, user:
|
|
7091
|
-
if (!r6) return
|
|
7363
|
+
async function jt2(e4, t4, n5 = {}, o4) {
|
|
7364
|
+
const { allowed: r6, consent: s4, globals: a4, user: i5 } = e4;
|
|
7365
|
+
if (!r6) return Dt({ ok: false });
|
|
7092
7366
|
if (t4) {
|
|
7093
7367
|
const n6 = e4.config.queueMax;
|
|
7094
7368
|
if (void 0 === n6) throw new Error("Collector.Config.queueMax is undefined; defaults must be seeded by collector()");
|
|
7095
|
-
const o5 =
|
|
7369
|
+
const o5 = N(e4.queue, t4, { max: n6 });
|
|
7096
7370
|
if (o5.dropped > 0) {
|
|
7097
|
-
const t5 =
|
|
7098
|
-
|
|
7099
|
-
} else e4.queue.length < n6 &&
|
|
7371
|
+
const t5 = ae2(e4.status, o("collector"), "queue", o5.dropped);
|
|
7372
|
+
J2(e4.queue, e4.logger, "collector.queue overflow; oldest events dropped", { buffer: "queue", cap: n6, droppedCount: t5 });
|
|
7373
|
+
} else e4.queue.length < n6 && X2(e4.queue);
|
|
7100
7374
|
e4.status.in++;
|
|
7101
7375
|
}
|
|
7102
7376
|
o4 || (o4 = e4.destinations);
|
|
7103
|
-
const
|
|
7377
|
+
const c2 = e4.transformers ? Ke2(e4.transformers) : {}, u2 = await Promise.all(Object.entries(o4 || {}).map(async ([o5, r7]) => {
|
|
7104
7378
|
if (r7.config.disabled) return { id: o5, destination: r7, skipped: true };
|
|
7105
|
-
const
|
|
7106
|
-
if (
|
|
7379
|
+
const u3 = r7.config.id || o5, d3 = o("destination", u3), y4 = te2(r7.config.breaker);
|
|
7380
|
+
if (y4 && (function(e5, t5, n6) {
|
|
7107
7381
|
const o6 = e5[t5];
|
|
7108
7382
|
if (!o6 || "closed" === o6.state) return false;
|
|
7109
7383
|
if ("half-open" === o6.state) return true === o6.probing;
|
|
7110
|
-
const r8 =
|
|
7384
|
+
const r8 = ee2();
|
|
7111
7385
|
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
|
-
|
|
7386
|
+
})(e4.status.breakers, d3, y4.cooldown)) return { id: o5, destination: r7, skipped: true };
|
|
7387
|
+
const b4 = (t5) => {
|
|
7388
|
+
y4 && ne2(e4.status.breakers, d3, t5, y4.threshold, y4.cooldown);
|
|
7389
|
+
}, I3 = () => {
|
|
7390
|
+
y4 && (function(e5, t5) {
|
|
7117
7391
|
const n6 = e5[t5];
|
|
7118
7392
|
n6 && "half-open" === n6.state && true === n6.probing && (n6.state = "open", n6.probing = false);
|
|
7119
|
-
})(e4.status.breakers,
|
|
7393
|
+
})(e4.status.breakers, d3);
|
|
7120
7394
|
};
|
|
7121
7395
|
let C3 = (r7.queuePush || []).map((e5) => ({ ...e5, consent: s4 }));
|
|
7122
7396
|
r7.queuePush = [], t4 && C3.push(he(t4));
|
|
7123
|
-
const
|
|
7124
|
-
if (!C3.length && !r7.queueOn?.length) return
|
|
7397
|
+
const E2 = n5.ingest ? { ...n5.ingest, _meta: { ...n5.ingest._meta, path: [...n5.ingest._meta.path] } } : I("unknown");
|
|
7398
|
+
if (!C3.length && !r7.queueOn?.length) return I3(), { id: o5, destination: r7, skipped: true };
|
|
7125
7399
|
if (!C3.length && r7.queueOn?.length) {
|
|
7126
|
-
if (!je(r7.config.consent, s4)) return
|
|
7400
|
+
if (!je(r7.config.consent, s4)) return I3(), { id: o5, destination: r7, skipped: true };
|
|
7127
7401
|
let t5 = false;
|
|
7128
7402
|
try {
|
|
7129
|
-
t5 = await
|
|
7403
|
+
t5 = await $t2(e4, r7, o5, true);
|
|
7130
7404
|
} catch (t6) {
|
|
7131
7405
|
e4.status.failed++;
|
|
7132
7406
|
const n6 = r7.type || "unknown";
|
|
7133
|
-
e4.logger.scope(n6).error("destination init failed", { error: t6 instanceof Error ? t6.message : String(t6) }),
|
|
7407
|
+
e4.logger.scope(n6).error("destination init failed", { error: t6 instanceof Error ? t6.message : String(t6) }), b4("transport-failure");
|
|
7134
7408
|
}
|
|
7135
|
-
return
|
|
7409
|
+
return I3(), { id: o5, destination: r7, skipped: !t5 };
|
|
7136
7410
|
}
|
|
7137
|
-
const
|
|
7411
|
+
const S2 = [], q3 = C3.filter((t5) => {
|
|
7138
7412
|
const n6 = je(r7.config.consent, s4, t5.consent);
|
|
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 } }),
|
|
7413
|
+
if (n6) return t5.consent = n6, S2.push(t5), false;
|
|
7414
|
+
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) });
|
|
7415
|
+
return a5.skipReason = "consent", s4 && (a5.consent = { ...s4 }), r7.config.consent && (a5.meta = { required: { ...r7.config.consent } }), on(e4, a5), true;
|
|
7142
7416
|
});
|
|
7143
|
-
if (
|
|
7417
|
+
if (q3.length > 0) {
|
|
7144
7418
|
const t5 = r7.queuePush, n6 = r7.config.id || o5, s5 = { max: r7.config.queueMax ?? 1e3 };
|
|
7145
7419
|
let a5 = 0;
|
|
7146
|
-
for (const e5 of
|
|
7147
|
-
a5 +=
|
|
7420
|
+
for (const e5 of q3) {
|
|
7421
|
+
a5 += N(t5, e5, s5).dropped;
|
|
7148
7422
|
}
|
|
7149
7423
|
if (a5 > 0) {
|
|
7150
|
-
|
|
7151
|
-
const o6 =
|
|
7152
|
-
|
|
7153
|
-
} else t5.length < s5.max &&
|
|
7424
|
+
se(e4, n6);
|
|
7425
|
+
const o6 = ae2(e4.status, o("destination", n6), "queue", a5);
|
|
7426
|
+
J2(t5, e4.logger.scope(r7.type || "unknown"), "destination.queuePush overflow; oldest events dropped", { buffer: "queuePush", destination: n6, cap: s5.max, droppedCount: o6 });
|
|
7427
|
+
} else t5.length < s5.max && X2(t5);
|
|
7154
7428
|
}
|
|
7155
|
-
if (!
|
|
7156
|
-
let
|
|
7429
|
+
if (!S2.length) return I3(), { id: o5, destination: r7, queue: C3 };
|
|
7430
|
+
let x2, $2, M3 = false;
|
|
7157
7431
|
try {
|
|
7158
|
-
|
|
7432
|
+
M3 = await $t2(e4, r7, o5, true);
|
|
7159
7433
|
} catch (t5) {
|
|
7160
7434
|
e4.status.failed++;
|
|
7161
7435
|
const n6 = r7.type || "unknown";
|
|
7162
|
-
e4.logger.scope(n6).error("destination init failed", { error: t5 instanceof Error ? t5.message : String(t5) }),
|
|
7436
|
+
e4.logger.scope(n6).error("destination init failed", { error: t5 instanceof Error ? t5.message : String(t5) }), b4("transport-failure");
|
|
7163
7437
|
}
|
|
7164
|
-
if (!
|
|
7438
|
+
if (!M3) return I3(), { id: o5, destination: r7, queue: C3 };
|
|
7165
7439
|
r7.dlq || (r7.dlq = []);
|
|
7166
|
-
const
|
|
7167
|
-
let
|
|
7168
|
-
return await Promise.all(
|
|
7440
|
+
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);
|
|
7441
|
+
let G3 = 0, W2 = 0;
|
|
7442
|
+
return await Promise.all(S2.map(async (t5) => {
|
|
7169
7443
|
let s5;
|
|
7170
|
-
if (t5.globals = oe(a4, t5.globals), t5.user = oe(
|
|
7171
|
-
const e5 =
|
|
7444
|
+
if (t5.globals = oe(a4, t5.globals), t5.user = oe(i5, t5.user), K4?.stop && B3) {
|
|
7445
|
+
const e5 = Xn(E2, t5), n6 = await er(K4, B3, e5);
|
|
7172
7446
|
if ("HIT" === n6?.status) return t5;
|
|
7173
7447
|
"MISS" === n6?.status && (s5 = { key: n6.key, ttl: n6.rule.ttl });
|
|
7174
7448
|
}
|
|
7175
|
-
let
|
|
7176
|
-
if (
|
|
7177
|
-
const r8 = await
|
|
7449
|
+
let u4 = t5, d4 = n5.respond;
|
|
7450
|
+
if (P3.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
7451
|
+
const r8 = await We2(e4, e4.transformers, P3, t5, E2, n5.respond, `destination.${o5}.before`);
|
|
7178
7452
|
if (null === r8.event) return t5;
|
|
7179
|
-
r8.respond && (
|
|
7453
|
+
r8.respond && (d4 = r8.respond), u4 = Array.isArray(r8.event) ? r8.event[0] : r8.event;
|
|
7180
7454
|
}
|
|
7181
|
-
if (
|
|
7182
|
-
const e5 =
|
|
7455
|
+
if (K4 && !K4.stop && B3) {
|
|
7456
|
+
const e5 = Xn(E2, u4), n6 = await er(K4, B3, e5);
|
|
7183
7457
|
if ("HIT" === n6?.status) return t5;
|
|
7184
7458
|
"MISS" === n6?.status && (s5 = { key: n6.key, ttl: n6.rule.ttl });
|
|
7185
7459
|
}
|
|
7186
|
-
|
|
7460
|
+
R4 && R4.length > 0 && u4 && (u4 = await or(R4, (t6) => Ue2(t6, e4), u4, e4));
|
|
7187
7461
|
const p3 = Date.now();
|
|
7188
|
-
let
|
|
7189
|
-
const v3 = await
|
|
7462
|
+
let g3 = false;
|
|
7463
|
+
const v3 = await Ye(At2, (t6) => {
|
|
7190
7464
|
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 =
|
|
7465
|
+
e4.logger.scope(n6).error("Push failed", { error: t6, event: u4.name }), x2 = t6, g3 = true;
|
|
7466
|
+
const s6 = r7.dlq, a5 = r7.config.id || o5, i6 = { max: r7.config.dlqMax ?? re2 }, c3 = N(s6, [u4, t6], i6);
|
|
7467
|
+
if (c3.dropped > 0) {
|
|
7468
|
+
se(e4, a5);
|
|
7469
|
+
const t7 = ae2(e4.status, o("destination", a5), "dlq", c3.dropped);
|
|
7470
|
+
J2(s6, e4.logger.scope(r7.type || "unknown"), "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: a5, cap: i6.max, droppedCount: t7 });
|
|
7471
|
+
} else s6.length < i6.max && X2(s6);
|
|
7472
|
+
})(e4, r7, o5, u4, E2, d4);
|
|
7473
|
+
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) {
|
|
7474
|
+
void 0 !== v3 && (E2._response = v3);
|
|
7475
|
+
const t6 = xt2(z5, c2, E2);
|
|
7202
7476
|
if (t6.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
7203
|
-
const n6 = await
|
|
7204
|
-
n6.respond && (
|
|
7477
|
+
const n6 = await We2(e4, e4.transformers, t6, u4, E2, d4, `destination.${o5}.next`);
|
|
7478
|
+
n6.respond && (d4 = n6.respond);
|
|
7205
7479
|
}
|
|
7206
7480
|
}
|
|
7207
7481
|
return t5;
|
|
7208
|
-
})), { id: o5, destination: r7, error:
|
|
7209
|
-
})),
|
|
7210
|
-
for (const t5 of
|
|
7482
|
+
})), { id: o5, destination: r7, error: x2, response: $2, totalDuration: G3, batchedCount: W2, allowedCount: S2.length, canonicalId: u3, breakerConfig: y4 };
|
|
7483
|
+
})), d2 = {}, y3 = {}, b3 = {};
|
|
7484
|
+
for (const t5 of u2) {
|
|
7211
7485
|
if (t5.skipped) continue;
|
|
7212
7486
|
const n6 = t5.destination, o5 = { type: n6.type || "unknown", data: t5.response };
|
|
7213
|
-
|
|
7487
|
+
se(e4, t5.id);
|
|
7214
7488
|
const r7 = e4.status.destinations[t5.id], s5 = Date.now();
|
|
7215
7489
|
r7.queuePushSize = n6.queuePush?.length ?? 0, r7.dlqSize = n6.dlq?.length ?? 0;
|
|
7216
|
-
const a5 = t5.breakerConfig,
|
|
7217
|
-
a5 &&
|
|
7490
|
+
const a5 = t5.breakerConfig, i6 = t5.canonicalId ? o("destination", t5.canonicalId) : void 0, c3 = (t6) => {
|
|
7491
|
+
a5 && i6 && ne2(e4.status.breakers, i6, t6, a5.threshold, a5.cooldown);
|
|
7218
7492
|
};
|
|
7219
|
-
if (t5.error) o5.error = t5.error,
|
|
7220
|
-
else if (t5.queue && t5.queue.length)
|
|
7493
|
+
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");
|
|
7494
|
+
else if (t5.queue && t5.queue.length) y3[t5.id] = o5;
|
|
7221
7495
|
else {
|
|
7222
7496
|
const n7 = t5.batchedCount ?? 0, a6 = t5.allowedCount ?? 0;
|
|
7223
|
-
(Math.max(0, a6 - n7) > 0 || 0 === a6) && (
|
|
7497
|
+
(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
7498
|
}
|
|
7225
7499
|
}
|
|
7226
|
-
return
|
|
7500
|
+
return Dt({ event: t4, ...Object.keys(d2).length && { done: d2 }, ...Object.keys(y3).length && { queued: y3 }, ...Object.keys(b3).length && { failed: b3 } });
|
|
7227
7501
|
}
|
|
7228
|
-
async function
|
|
7502
|
+
async function $t2(e4, t4, n5, o4 = false) {
|
|
7229
7503
|
if (t4.init && !t4.config.init) {
|
|
7230
7504
|
if (!o4 && (function(e5) {
|
|
7231
7505
|
const t5 = e5.config.consent;
|
|
7232
7506
|
return !!t5 && Object.keys(t5).length > 0;
|
|
7233
7507
|
})(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:
|
|
7508
|
+
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
7509
|
s4.debug("init");
|
|
7236
7510
|
const i5 = Date.now();
|
|
7237
7511
|
let c2;
|
|
7238
|
-
|
|
7512
|
+
on(e4, _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "init", eventId: "", now: i5 }));
|
|
7239
7513
|
try {
|
|
7240
7514
|
c2 = await gt(t4.init, "DestinationInit", e4.hooks, e4.logger)(a4);
|
|
7241
7515
|
} 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) },
|
|
7516
|
+
const o5 = Date.now(), r7 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: "", now: o5 });
|
|
7517
|
+
throw r7.durationMs = o5 - i5, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, on(e4, r7), t5;
|
|
7244
7518
|
}
|
|
7245
7519
|
if (false === c2) return c2;
|
|
7246
7520
|
if (t4.config = { ...c2 || t4.config, init: true }, t4.queueOn?.length) {
|
|
7247
7521
|
const o5 = t4.queueOn;
|
|
7248
7522
|
t4.queueOn = [];
|
|
7249
|
-
for (const { type: r7, data: s5 } of o5)
|
|
7523
|
+
for (const { type: r7, data: s5 } of o5) mt(e4, t4, n5, r7, s5);
|
|
7250
7524
|
}
|
|
7251
7525
|
s4.debug("init done");
|
|
7252
7526
|
}
|
|
7253
7527
|
return true;
|
|
7254
7528
|
}
|
|
7255
|
-
async function
|
|
7529
|
+
async function At2(e4, t4, n5, o4, r6, s4) {
|
|
7256
7530
|
const { config: a4 } = t4, i5 = await nt(o4, a4, e4);
|
|
7257
7531
|
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: { ...
|
|
7532
|
+
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
7533
|
if (void 0 !== a4.mock) return u2.debug("mock", { event: i5.event.name }), a4.mock;
|
|
7260
7534
|
const l3 = i5.mapping, f3 = void 0 !== l3?.batch, p3 = f3 ? i5.mappingKey || "* *" : " batch-all";
|
|
7261
7535
|
if ((f3 || void 0 !== a4.batch) && t4.pushBatch && void 0 === a4.mock) {
|
|
7262
7536
|
if (t4.batches = t4.batches || {}, !t4.batches[p3]) {
|
|
7263
|
-
const o5 = { key: p3, entries: [], events: [], data: [] }, r7 =
|
|
7537
|
+
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
7538
|
const o6 = t4.batches[p3], r8 = o6.batched;
|
|
7265
7539
|
if (0 === r8.entries.length) return;
|
|
7266
7540
|
const s6 = { key: r8.key, entries: r8.entries, events: r8.events, data: r8.data };
|
|
7267
7541
|
r8.entries = [], r8.events = [], r8.data = [];
|
|
7268
|
-
const i7 = s6.entries[0], { traceId: c5, sourceId: d5, parentEventId: l4 } =
|
|
7542
|
+
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
7543
|
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 ??
|
|
7544
|
+
const m5 = t4.config.id || n5, h3 = se(e4, m5), v4 = te2(t4.config.breaker), y3 = o("destination", m5), b4 = (t5) => {
|
|
7545
|
+
v4 && ne2(e4.status.breakers, y3, t5, v4.threshold, v4.cooldown);
|
|
7546
|
+
}, k4 = Date.now(), I3 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "flush", eventId: "", now: k4, traceId: c5, sourceId: d5, parentEventId: l4 });
|
|
7547
|
+
I3.batch = { size: s6.entries.length, index: 0 }, on(e4, I3);
|
|
7548
|
+
const C3 = (n6) => {
|
|
7549
|
+
const o7 = t4.dlq = t4.dlq || [], r9 = { max: t4.config.dlqMax ?? re2 };
|
|
7276
7550
|
let s7 = 0;
|
|
7277
7551
|
for (const e5 of n6) {
|
|
7278
|
-
s7 +=
|
|
7552
|
+
s7 += N(o7, e5, r9).dropped;
|
|
7279
7553
|
}
|
|
7280
7554
|
if (s7 > 0) {
|
|
7281
|
-
const t5 =
|
|
7282
|
-
|
|
7283
|
-
} else o7.length < r9.max &&
|
|
7284
|
-
|
|
7555
|
+
const t5 = ae2(e4.status, o("destination", m5), "dlq", s7);
|
|
7556
|
+
J2(o7, u2, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: m5, cap: r9.max, droppedCount: t5 });
|
|
7557
|
+
} else o7.length < r9.max && X2(o7);
|
|
7558
|
+
h3.failed += n6.length, h3.dlqSize = o7.length, e4.status.failed += n6.length;
|
|
7285
7559
|
};
|
|
7286
|
-
let
|
|
7287
|
-
const
|
|
7288
|
-
|
|
7289
|
-
const o7 = Date.now(), r9 =
|
|
7290
|
-
r9.durationMs = o7 -
|
|
7560
|
+
let E2 = s6.entries.length;
|
|
7561
|
+
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) => {
|
|
7562
|
+
E2 = 0;
|
|
7563
|
+
const o7 = Date.now(), r9 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: "", now: o7, traceId: c5, sourceId: d5, parentEventId: l4 });
|
|
7564
|
+
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
7565
|
})(s6, f4);
|
|
7292
|
-
if (de(
|
|
7566
|
+
if (de(A2 = x2) && Array.isArray(A2.failed) && x2.failed.length > 0) {
|
|
7293
7567
|
const e5 = [], t5 = /* @__PURE__ */ new Set();
|
|
7294
|
-
for (const n6 of
|
|
7568
|
+
for (const n6 of x2.failed) {
|
|
7295
7569
|
const o7 = s6.entries[n6.index];
|
|
7296
7570
|
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
7571
|
}
|
|
7298
|
-
e5.length > 0 && (
|
|
7572
|
+
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
7573
|
}
|
|
7300
|
-
var
|
|
7301
|
-
u2.debug("push batch done"),
|
|
7574
|
+
var A2;
|
|
7575
|
+
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
7576
|
}, { wait: i6, size: c4, age: d4 });
|
|
7303
7577
|
t4.batches[p3] = { batched: o5, isDefault: !f3, batchFn: () => {
|
|
7304
|
-
|
|
7578
|
+
m4();
|
|
7305
7579
|
}, flush: async () => {
|
|
7306
|
-
await
|
|
7580
|
+
await m4.flush();
|
|
7307
7581
|
} };
|
|
7308
7582
|
}
|
|
7309
7583
|
const c3 = t4.batches[p3];
|
|
7310
7584
|
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
|
|
7585
|
+
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 });
|
|
7586
|
+
i5.mappingKey && (h2.mappingKey = i5.mappingKey), i5.event.consent && (h2.consent = { ...i5.event.consent }), h2.inEvent = i5.event, on(e4, h2);
|
|
7587
|
+
const v3 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "out", eventId: d3, now: m3, traceId: g3.traceId, sourceId: g3.sourceId, parentEventId: g3.parentEventId });
|
|
7588
|
+
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);
|
|
7589
|
+
const b3 = t4.config.id || n5, k3 = se(e4, b3);
|
|
7590
|
+
return k3.inFlightBatch = (k3.inFlightBatch ?? 0) + 1, c3.batchFn(), Et;
|
|
7317
7591
|
}
|
|
7318
7592
|
{
|
|
7319
7593
|
let s5;
|
|
7320
7594
|
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[
|
|
7595
|
+
const e5 = K2({ ...d2.env, simulation: t4.calls });
|
|
7596
|
+
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
7597
|
}
|
|
7324
|
-
const c3 = "string" == typeof i5.event.id ? i5.event.id : "", { traceId: l4, sourceId: f4, parentEventId: p4 } =
|
|
7325
|
-
i5.mappingKey && (
|
|
7598
|
+
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 });
|
|
7599
|
+
i5.mappingKey && (m3.mappingKey = i5.mappingKey), i5.event.consent && (m3.consent = { ...i5.event.consent }), m3.inEvent = i5.event, on(e4, m3);
|
|
7326
7600
|
try {
|
|
7327
|
-
const o5 =
|
|
7328
|
-
return
|
|
7601
|
+
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 });
|
|
7602
|
+
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
7603
|
} 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 =
|
|
7604
|
+
const o5 = Date.now(), r7 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: c3, now: o5, traceId: l4, sourceId: f4, parentEventId: p4 });
|
|
7605
|
+
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
7606
|
}
|
|
7333
7607
|
}
|
|
7334
7608
|
}
|
|
7335
|
-
function
|
|
7609
|
+
function Dt(e4) {
|
|
7336
7610
|
return { ok: !e4?.failed, ...e4 };
|
|
7337
7611
|
}
|
|
7338
|
-
function
|
|
7339
|
-
const { code: t4, config: n5 = {}, env: o4 = {}, cache: r6, state: s4 } = e4, { config: a4 } =
|
|
7612
|
+
function Mt(e4) {
|
|
7613
|
+
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
7614
|
r6 && (c2.cache = r6), void 0 !== s4 && void 0 === c2.state && (c2.state = s4);
|
|
7341
|
-
const u2 =
|
|
7615
|
+
const u2 = _t(t4.env, o4);
|
|
7342
7616
|
return { ...t4, config: c2, env: u2 };
|
|
7343
7617
|
}
|
|
7344
|
-
async function
|
|
7618
|
+
async function Tt(e4, t4 = {}) {
|
|
7345
7619
|
const n5 = {};
|
|
7346
|
-
for (const [o4, r6] of Object.entries(t4)) r6.config?.require?.length ? e4.pending.destinations[o4] = r6 : n5[o4] =
|
|
7620
|
+
for (const [o4, r6] of Object.entries(t4)) r6.config?.require?.length ? e4.pending.destinations[o4] = r6 : n5[o4] = Mt(r6);
|
|
7347
7621
|
return n5;
|
|
7348
7622
|
}
|
|
7349
|
-
function
|
|
7623
|
+
function _t(e4, t4) {
|
|
7350
7624
|
return e4 || t4 ? t4 ? e4 && de(e4) && de(t4) ? { ...e4, ...t4 } : t4 : e4 : {};
|
|
7351
7625
|
}
|
|
7352
|
-
var
|
|
7353
|
-
async function
|
|
7626
|
+
var Rt = 5e3;
|
|
7627
|
+
async function Ht(e4) {
|
|
7354
7628
|
const t4 = e4.logger;
|
|
7355
|
-
await
|
|
7629
|
+
await Gt(e4.sources, "source", t4), await (async function(e5, t5) {
|
|
7356
7630
|
const n5 = Object.entries(e5).flatMap(([e6, n6]) => {
|
|
7357
7631
|
const o4 = n6.batches;
|
|
7358
7632
|
if (!o4) return [];
|
|
@@ -7361,7 +7635,7 @@ async function Ft(e4) {
|
|
|
7361
7635
|
let n7;
|
|
7362
7636
|
try {
|
|
7363
7637
|
await Promise.race([t6.flush(), new Promise((t7, o5) => {
|
|
7364
|
-
n7 = setTimeout(() => o5(new Error(`destination '${e6}' batch flush timed out`)),
|
|
7638
|
+
n7 = setTimeout(() => o5(new Error(`destination '${e6}' batch flush timed out`)), Rt);
|
|
7365
7639
|
})]);
|
|
7366
7640
|
} catch (t7) {
|
|
7367
7641
|
r6.error(`destination '${e6}' batch flush failed: ${t7}`);
|
|
@@ -7371,9 +7645,9 @@ async function Ft(e4) {
|
|
|
7371
7645
|
});
|
|
7372
7646
|
});
|
|
7373
7647
|
await Promise.allSettled(n5);
|
|
7374
|
-
})(e4.destinations, t4), await
|
|
7648
|
+
})(e4.destinations, t4), await Gt(e4.destinations, "destination", t4), await Gt(e4.transformers, "transformer", t4), await Gt(e4.stores, "store", t4);
|
|
7375
7649
|
}
|
|
7376
|
-
async function
|
|
7650
|
+
async function Gt(e4, t4, n5) {
|
|
7377
7651
|
const o4 = Object.entries(e4).map(async ([e5, o5]) => {
|
|
7378
7652
|
const r6 = o5.destroy;
|
|
7379
7653
|
if (!r6) return;
|
|
@@ -7381,7 +7655,7 @@ async function Ut(e4, t4, n5) {
|
|
|
7381
7655
|
let c2;
|
|
7382
7656
|
try {
|
|
7383
7657
|
await Promise.race([r6(i5), new Promise((n6, o6) => {
|
|
7384
|
-
c2 = setTimeout(() => o6(new Error(`${t4} '${e5}' destroy timed out`)),
|
|
7658
|
+
c2 = setTimeout(() => o6(new Error(`${t4} '${e5}' destroy timed out`)), Rt);
|
|
7385
7659
|
})]);
|
|
7386
7660
|
} catch (n6) {
|
|
7387
7661
|
a4.error(`${t4} '${e5}' destroy failed: ${n6}`);
|
|
@@ -7391,12 +7665,12 @@ async function Ut(e4, t4, n5) {
|
|
|
7391
7665
|
});
|
|
7392
7666
|
await Promise.allSettled(o4);
|
|
7393
7667
|
}
|
|
7394
|
-
function
|
|
7668
|
+
function Wt(e4, t4) {
|
|
7395
7669
|
e4.stateVersion++, e4.cellVersion[t4] = e4.stateVersion;
|
|
7396
7670
|
}
|
|
7397
|
-
async function
|
|
7671
|
+
async function Lt(e4, t4, o4) {
|
|
7398
7672
|
let s4, a4, i5 = false;
|
|
7399
|
-
const c2 =
|
|
7673
|
+
const c2 = lt2(e4);
|
|
7400
7674
|
try {
|
|
7401
7675
|
return await (async function() {
|
|
7402
7676
|
switch (t4) {
|
|
@@ -7406,17 +7680,17 @@ async function Ht(e4, t4, o4) {
|
|
|
7406
7680
|
case n.Commands.Consent:
|
|
7407
7681
|
if (de(o4)) {
|
|
7408
7682
|
const { update: t5 } = r2(e4, o4);
|
|
7409
|
-
|
|
7683
|
+
Wt(e4, n.Commands.Consent), a4 = t5, i5 = true;
|
|
7410
7684
|
}
|
|
7411
7685
|
break;
|
|
7412
7686
|
case n.Commands.Custom:
|
|
7413
|
-
de(o4) && (e4.custom = oe(e4.custom, o4),
|
|
7687
|
+
de(o4) && (e4.custom = oe(e4.custom, o4), Wt(e4, n.Commands.Custom), a4 = o4, i5 = true);
|
|
7414
7688
|
break;
|
|
7415
7689
|
case n.Commands.Destination:
|
|
7416
|
-
de(o4) && "code" in o4 && de(o4.code) && (s4 = await
|
|
7690
|
+
de(o4) && "code" in o4 && de(o4.code) && (s4 = await Ot2(e4, o4));
|
|
7417
7691
|
break;
|
|
7418
7692
|
case n.Commands.Globals:
|
|
7419
|
-
de(o4) && (e4.globals = oe(e4.globals, o4),
|
|
7693
|
+
de(o4) && (e4.globals = oe(e4.globals, o4), Wt(e4, n.Commands.Globals), a4 = o4, i5 = true);
|
|
7420
7694
|
break;
|
|
7421
7695
|
case n.Commands.Hook:
|
|
7422
7696
|
if (de(o4) && ge(o4.name) && le(o4.fn)) {
|
|
@@ -7427,90 +7701,90 @@ async function Ht(e4, t4, o4) {
|
|
|
7427
7701
|
case n.Commands.On:
|
|
7428
7702
|
if (de(o4) && ge(o4.type)) {
|
|
7429
7703
|
const { type: t5, rules: n5 } = o4;
|
|
7430
|
-
await
|
|
7704
|
+
await gt2(e4, t5, n5);
|
|
7431
7705
|
}
|
|
7432
7706
|
break;
|
|
7433
7707
|
case n.Commands.Ready:
|
|
7434
7708
|
i5 = true;
|
|
7435
7709
|
break;
|
|
7436
7710
|
case n.Commands.Run:
|
|
7437
|
-
s4 = await
|
|
7711
|
+
s4 = await Jt(e4, o4), i5 = true;
|
|
7438
7712
|
break;
|
|
7439
7713
|
case n.Commands.Session:
|
|
7440
7714
|
i5 = true;
|
|
7441
7715
|
break;
|
|
7442
7716
|
case n.Commands.Shutdown:
|
|
7443
|
-
e4.hasShutdown || (e4.hasShutdown = true, await
|
|
7717
|
+
e4.hasShutdown || (e4.hasShutdown = true, await Ht(e4));
|
|
7444
7718
|
break;
|
|
7445
7719
|
case n.Commands.User:
|
|
7446
|
-
de(o4) && (oe(e4.user, o4, { shallow: false }),
|
|
7720
|
+
de(o4) && (oe(e4.user, o4, { shallow: false }), Wt(e4, n.Commands.User), a4 = o4, i5 = true);
|
|
7447
7721
|
break;
|
|
7448
7722
|
default:
|
|
7449
|
-
return e4.logger.warn("unknown command", { command: t4 }),
|
|
7723
|
+
return e4.logger.warn("unknown command", { command: t4 }), Dt({ ok: false });
|
|
7450
7724
|
}
|
|
7451
|
-
i5 && (await
|
|
7452
|
-
return s4 ||
|
|
7725
|
+
i5 && (await bt2(e4, t4, void 0, a4), s4 = await jt2(e4));
|
|
7726
|
+
return s4 || Dt({ ok: true });
|
|
7453
7727
|
})();
|
|
7454
7728
|
} finally {
|
|
7455
7729
|
c2();
|
|
7456
7730
|
}
|
|
7457
7731
|
}
|
|
7458
|
-
function
|
|
7732
|
+
function Vt(e4, t4) {
|
|
7459
7733
|
return { timing: Math.round((Date.now() - e4.timing) / 10) / 100, source: { type: "collector", schema: "4" }, ...t4 };
|
|
7460
7734
|
}
|
|
7461
|
-
function
|
|
7735
|
+
function Nt2(e4, t4, n5) {
|
|
7462
7736
|
if (!t4.name) throw new Error("Event name is required");
|
|
7463
7737
|
const [o4, r6] = t4.name.split(" ");
|
|
7464
7738
|
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
|
|
7739
|
+
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 };
|
|
7740
|
+
void 0 !== k3 && (I3.trace = k3);
|
|
7741
|
+
const C3 = e4.name ?? w3.platform ?? "default", E2 = e4.release ?? "4.3.1";
|
|
7742
|
+
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
7743
|
}
|
|
7470
|
-
function
|
|
7471
|
-
return
|
|
7744
|
+
function Yt(e4, t4, n5) {
|
|
7745
|
+
return Nt2(e4, Vt(e4, t4), n5);
|
|
7472
7746
|
}
|
|
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),
|
|
7747
|
+
async function Jt(e4, t4) {
|
|
7748
|
+
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
7749
|
e5.queuePush = [];
|
|
7476
|
-
}), e4.queue = [], e4.round++, await
|
|
7477
|
-
return await
|
|
7750
|
+
}), e4.queue = [], e4.round++, await Ze2(e4), await wt2(e4);
|
|
7751
|
+
return await jt2(e4);
|
|
7478
7752
|
}
|
|
7479
|
-
function
|
|
7480
|
-
const n5 = gt(async (n6, o4 = {}) => await
|
|
7753
|
+
function rn2(e4, t4) {
|
|
7754
|
+
const n5 = gt(async (n6, o4 = {}) => await Ye(async () => {
|
|
7481
7755
|
const r6 = Date.now(), { id: s4, ingest: a4, respond: i5, mapping: c2, preChain: u2, include: d2, exclude: l3 } = o4;
|
|
7482
7756
|
let f3 = i5, p3 = n6;
|
|
7483
7757
|
const g3 = d2 || l3 ? (function(e5, t5, n7) {
|
|
7484
7758
|
let o5 = e5;
|
|
7485
7759
|
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 ??
|
|
7760
|
+
})(e4.destinations, d2, l3) : void 0, m3 = a4 ?? I(s4 || "unknown");
|
|
7487
7761
|
if (c2) {
|
|
7488
7762
|
const t5 = await nt(p3, c2, e4);
|
|
7489
|
-
if (t5.ignore) return
|
|
7763
|
+
if (t5.ignore) return Dt({ ok: true });
|
|
7490
7764
|
if (c2.consent) {
|
|
7491
|
-
if (!je(c2.consent, e4.consent, t5.event.consent)) return
|
|
7765
|
+
if (!je(c2.consent, e4.consent, t5.event.consent)) return Dt({ ok: true });
|
|
7492
7766
|
}
|
|
7493
7767
|
p3 = t5.event;
|
|
7494
7768
|
}
|
|
7495
7769
|
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),
|
|
7770
|
+
const n7 = await We2(e4, e4.transformers, u2, p3, m3, f3, s4 ? `source.${s4}.next` : void 0);
|
|
7771
|
+
if (null === n7.event) return e4.logger.debug("Event dropped by transformer chain" + (n7.droppedBy ? ` (${n7.droppedBy})` : "")), Dt({ ok: true, dropped: true });
|
|
7772
|
+
if (n7.stopped) return n7.respond && (f3 = n7.respond), Dt({ ok: true });
|
|
7499
7773
|
if (n7.respond && (f3 = n7.respond), Array.isArray(n7.event)) {
|
|
7500
7774
|
const o5 = await Promise.all(n7.event.map(async (n8) => {
|
|
7501
|
-
const o6 = t4(n8), r7 =
|
|
7502
|
-
return
|
|
7775
|
+
const o6 = t4(n8), r7 = Nt2(e4, o6, m3);
|
|
7776
|
+
return jt2(e4, r7, { id: s4, ingest: m3, respond: f3 }, g3);
|
|
7503
7777
|
}));
|
|
7504
7778
|
if (s4) {
|
|
7505
7779
|
e4.status.sources[s4] || (e4.status.sources[s4] = { count: 0, duration: 0 });
|
|
7506
7780
|
const t5 = e4.status.sources[s4];
|
|
7507
7781
|
t5.count += n7.event.length, t5.lastAt = Date.now(), t5.duration += Date.now() - r6;
|
|
7508
7782
|
}
|
|
7509
|
-
return o5[0] ??
|
|
7783
|
+
return o5[0] ?? Dt({ ok: true });
|
|
7510
7784
|
}
|
|
7511
7785
|
p3 = n7.event;
|
|
7512
7786
|
}
|
|
7513
|
-
const h2 =
|
|
7787
|
+
const h2 = Yt(e4, p3, m3), v3 = await jt2(e4, h2, { id: s4, ingest: m3, respond: f3 }, g3);
|
|
7514
7788
|
if (s4) {
|
|
7515
7789
|
e4.status.sources[s4] || (e4.status.sources[s4] = { count: 0, duration: 0 });
|
|
7516
7790
|
const t5 = e4.status.sources[s4];
|
|
@@ -7518,22 +7792,22 @@ function en2(e4, t4) {
|
|
|
7518
7792
|
}
|
|
7519
7793
|
return v3;
|
|
7520
7794
|
}, (t5) => {
|
|
7521
|
-
if (t5 instanceof
|
|
7522
|
-
return e4.status.failed++, e4.logger.error("push failed", { event: n6, ingest: o4.ingest, error: t5 }),
|
|
7795
|
+
if (t5 instanceof Xe) throw t5;
|
|
7796
|
+
return e4.status.failed++, e4.logger.error("push failed", { event: n6, ingest: o4.ingest, error: t5 }), Dt({ ok: false });
|
|
7523
7797
|
})(), "Push", e4.hooks, e4.logger);
|
|
7524
7798
|
return async (t5, o4) => {
|
|
7525
|
-
const r6 = "string" == typeof t5.id ? t5.id : "", { traceId: s4, sourceId: a4, parentEventId: i5 } =
|
|
7526
|
-
u2.inEvent = t5,
|
|
7799
|
+
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 });
|
|
7800
|
+
u2.inEvent = t5, on(e4, u2);
|
|
7527
7801
|
try {
|
|
7528
|
-
const u3 = await n5(t5, o4), d2 = Date.now(), l3 =
|
|
7529
|
-
return l3.durationMs = d2 - c2, l3.outEvent = u3,
|
|
7802
|
+
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 });
|
|
7803
|
+
return l3.durationMs = d2 - c2, l3.outEvent = u3, on(e4, l3), u3;
|
|
7530
7804
|
} 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) },
|
|
7805
|
+
const n6 = Date.now(), o5 = _(e4, { stepId: "collector.push", stepType: "collector", phase: "error", eventId: r6, now: n6, traceId: s4, sourceId: a4, parentEventId: i5 });
|
|
7806
|
+
throw o5.durationMs = n6 - c2, o5.error = t6 instanceof Error ? { name: t6.name, message: t6.message } : { message: String(t6) }, on(e4, o5), t6;
|
|
7533
7807
|
}
|
|
7534
7808
|
};
|
|
7535
7809
|
}
|
|
7536
|
-
function
|
|
7810
|
+
function ln(e4 = {}) {
|
|
7537
7811
|
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
7812
|
let i5;
|
|
7539
7813
|
o4 > 0 && (i5 = setInterval(function() {
|
|
@@ -7566,12 +7840,12 @@ function an(e4 = {}) {
|
|
|
7566
7840
|
void 0 !== i5 && (clearInterval(i5), i5 = void 0), s4.clear();
|
|
7567
7841
|
} };
|
|
7568
7842
|
}
|
|
7569
|
-
function
|
|
7843
|
+
function hn(e4, t4) {
|
|
7570
7844
|
const { cacheConfig: n5, cacheStore: o4, namespace: r6, logger: s4, storeId: a4, collector: i5 } = t4, c2 = (e5, t5) => {
|
|
7571
7845
|
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 ?
|
|
7846
|
+
const n6 = _(i5, { stepId: `store.${a4}`, stepType: "store", phase: "in", eventId: "", now: Date.now() });
|
|
7847
|
+
n6.meta = { op: "cache", cached: "hit" === t5, status: t5, key: e5 }, on(i5, n6);
|
|
7848
|
+
}, 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
7849
|
function f3(e5, t5) {
|
|
7576
7850
|
const n6 = void 0 === t5 ? { key: e5 } : { key: e5, value: t5 };
|
|
7577
7851
|
return d2.find((e6) => e6.match(n6));
|
|
@@ -7580,7 +7854,7 @@ function fn(e4, t4) {
|
|
|
7580
7854
|
return { type: e4.type, config: e4.config, setup: e4.setup, get counters() {
|
|
7581
7855
|
return { ...u2 };
|
|
7582
7856
|
}, async get(t5) {
|
|
7583
|
-
const n6 = l3(t5), r7 = await o4.get(n6), s5 =
|
|
7857
|
+
const n6 = l3(t5), r7 = await o4.get(n6), s5 = Kn(r7);
|
|
7584
7858
|
if (void 0 !== s5) {
|
|
7585
7859
|
if (!("expired" in s5)) return u2.hits++, c2(t5, "hit"), s5.value;
|
|
7586
7860
|
try {
|
|
@@ -7599,7 +7873,7 @@ function fn(e4, t4) {
|
|
|
7599
7873
|
const s6 = f3(t5, r8);
|
|
7600
7874
|
if (s6) try {
|
|
7601
7875
|
const e5 = 1e3 * s6.ttl;
|
|
7602
|
-
await o4.set(n6,
|
|
7876
|
+
await o4.set(n6, Ln(r8, e5), e5), u2.populates++;
|
|
7603
7877
|
} catch (e5) {
|
|
7604
7878
|
g3("set", t5, e5);
|
|
7605
7879
|
}
|
|
@@ -7614,7 +7888,7 @@ function fn(e4, t4) {
|
|
|
7614
7888
|
const s5 = f3(t5, n6);
|
|
7615
7889
|
if (s5) try {
|
|
7616
7890
|
const e5 = 1e3 * s5.ttl;
|
|
7617
|
-
await o4.set(l3(t5),
|
|
7891
|
+
await o4.set(l3(t5), Ln(n6, e5), e5);
|
|
7618
7892
|
} catch (e5) {
|
|
7619
7893
|
g3("set", t5, e5);
|
|
7620
7894
|
}
|
|
@@ -7631,46 +7905,46 @@ function fn(e4, t4) {
|
|
|
7631
7905
|
s4 ? s4.warn(o5, { error: n6 }) : console.warn(o5, n6);
|
|
7632
7906
|
}
|
|
7633
7907
|
}
|
|
7634
|
-
function
|
|
7908
|
+
function vn2(e4, t4, n5) {
|
|
7635
7909
|
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
7910
|
t4.get = async (t5) => {
|
|
7637
|
-
const n6 = Date.now(), s5 =
|
|
7638
|
-
s5.meta = { op: "get", key: t5 },
|
|
7911
|
+
const n6 = Date.now(), s5 = _(e4, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: n6 });
|
|
7912
|
+
s5.meta = { op: "get", key: t5 }, on(e4, s5);
|
|
7639
7913
|
try {
|
|
7640
|
-
const s6 = await r6(t5), a5 = Date.now(), i5 =
|
|
7641
|
-
return i5.durationMs = a5 - n6, i5.meta = { op: "get", key: t5 },
|
|
7914
|
+
const s6 = await r6(t5), a5 = Date.now(), i5 = _(e4, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: a5 });
|
|
7915
|
+
return i5.durationMs = a5 - n6, i5.meta = { op: "get", key: t5 }, on(e4, i5), s6;
|
|
7642
7916
|
} 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) },
|
|
7917
|
+
const s6 = Date.now(), a5 = _(e4, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: s6 });
|
|
7918
|
+
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
7919
|
}
|
|
7646
7920
|
}, t4.set = async (t5, n6, r7) => {
|
|
7647
|
-
const a5 = Date.now(), i5 =
|
|
7648
|
-
i5.meta = { op: "set", key: t5 },
|
|
7921
|
+
const a5 = Date.now(), i5 = _(e4, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: a5 });
|
|
7922
|
+
i5.meta = { op: "set", key: t5 }, on(e4, i5);
|
|
7649
7923
|
try {
|
|
7650
7924
|
await s4(t5, n6, r7);
|
|
7651
|
-
const i6 = Date.now(), c2 =
|
|
7652
|
-
c2.durationMs = i6 - a5, c2.meta = { op: "set", key: t5 },
|
|
7925
|
+
const i6 = Date.now(), c2 = _(e4, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: i6 });
|
|
7926
|
+
c2.durationMs = i6 - a5, c2.meta = { op: "set", key: t5 }, on(e4, c2);
|
|
7653
7927
|
} 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) },
|
|
7928
|
+
const r8 = Date.now(), s5 = _(e4, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: r8 });
|
|
7929
|
+
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
7930
|
}
|
|
7657
7931
|
}, t4.delete = async (t5) => {
|
|
7658
|
-
const n6 = Date.now(), r7 =
|
|
7659
|
-
r7.meta = { op: "delete", key: t5 },
|
|
7932
|
+
const n6 = Date.now(), r7 = _(e4, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: n6 });
|
|
7933
|
+
r7.meta = { op: "delete", key: t5 }, on(e4, r7);
|
|
7660
7934
|
try {
|
|
7661
7935
|
await a4(t5);
|
|
7662
|
-
const r8 = Date.now(), s5 =
|
|
7663
|
-
s5.durationMs = r8 - n6, s5.meta = { op: "delete", key: t5 },
|
|
7936
|
+
const r8 = Date.now(), s5 = _(e4, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: r8 });
|
|
7937
|
+
s5.durationMs = r8 - n6, s5.meta = { op: "delete", key: t5 }, on(e4, s5);
|
|
7664
7938
|
} 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) },
|
|
7939
|
+
const s5 = Date.now(), a5 = _(e4, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: s5 });
|
|
7940
|
+
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
7941
|
}
|
|
7668
7942
|
};
|
|
7669
7943
|
}
|
|
7670
|
-
async function
|
|
7944
|
+
async function yn2(e4, t4 = {}) {
|
|
7671
7945
|
const n5 = {};
|
|
7672
7946
|
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:
|
|
7947
|
+
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
7948
|
n5[o5] = u2;
|
|
7675
7949
|
}
|
|
7676
7950
|
const o4 = t4, r6 = (function(e5) {
|
|
@@ -7699,37 +7973,37 @@ async function gn(e4, t4 = {}) {
|
|
|
7699
7973
|
const r7 = o4[t5].cache;
|
|
7700
7974
|
if (!r7) continue;
|
|
7701
7975
|
let s4, a4;
|
|
7702
|
-
void 0 !== r7.store ? (s4 = n5[r7.store], a4 = r7.store) : (n5.__cache || (n5.__cache =
|
|
7976
|
+
void 0 !== r7.store ? (s4 = n5[r7.store], a4 = r7.store) : (n5.__cache || (n5.__cache = ln()), s4 = n5.__cache, a4 = "__cache");
|
|
7703
7977
|
const i5 = r7.namespace ?? t5;
|
|
7704
|
-
e4.logger.scope("store-cache").scope(t5).info(`store "${t5}" caches with namespace "${i5}:" via ${a4}`), n5[t5] =
|
|
7978
|
+
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
7979
|
}
|
|
7706
|
-
for (const [t5, o5] of Object.entries(n5)) "__cache" !== t5 &&
|
|
7980
|
+
for (const [t5, o5] of Object.entries(n5)) "__cache" !== t5 && vn2(e4, o5, t5);
|
|
7707
7981
|
return n5;
|
|
7708
7982
|
}
|
|
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 }),
|
|
7983
|
+
async function wn2(e4) {
|
|
7984
|
+
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 };
|
|
7985
|
+
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) {
|
|
7986
|
+
return gt(async (n6, o5, r7) => await Ye(async () => await t5(e5, n6, o5, r7), (t6) => {
|
|
7987
|
+
if (t6 instanceof Xe) throw t6;
|
|
7988
|
+
return e5.status.failed++, e5.logger.error("command failed", { command: n6, data: o5, error: t6 }), Dt({ ok: false });
|
|
7715
7989
|
})(), "Command", e5.hooks, e5.logger);
|
|
7716
|
-
})(
|
|
7717
|
-
return async (t5, n6, o5, r7,
|
|
7990
|
+
})(s4, Lt), s4.elb = /* @__PURE__ */ (function(e5) {
|
|
7991
|
+
return async (t5, n6, o5, r7, s5) => {
|
|
7718
7992
|
if ("string" == typeof t5 && t5.startsWith("walker ")) {
|
|
7719
7993
|
const o6 = t5.replace("walker ", "");
|
|
7720
7994
|
return e5.command(o6, n6);
|
|
7721
7995
|
}
|
|
7722
|
-
let
|
|
7723
|
-
if ("string" == typeof t5)
|
|
7996
|
+
let a5;
|
|
7997
|
+
if ("string" == typeof t5) a5 = { name: t5 }, n6 && "object" == typeof n6 && !Array.isArray(n6) && (a5.data = n6);
|
|
7724
7998
|
else {
|
|
7725
|
-
if (!t5 || "object" != typeof t5 || Array.isArray(t5)) return
|
|
7726
|
-
|
|
7999
|
+
if (!t5 || "object" != typeof t5 || Array.isArray(t5)) return Dt({ ok: false });
|
|
8000
|
+
a5 = { ...t5 }, n6 && "object" == typeof n6 && !Array.isArray(n6) && (a5.data = { ...a5.data || {}, ...n6 });
|
|
7727
8001
|
}
|
|
7728
|
-
return o5 && "object" == typeof o5 && (
|
|
8002
|
+
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
8003
|
};
|
|
7730
|
-
})(
|
|
7731
|
-
const
|
|
7732
|
-
return
|
|
8004
|
+
})(s4);
|
|
8005
|
+
const a4 = e4.stores || {};
|
|
8006
|
+
return s4.stores = await yn2(s4, a4), (function(e5, t5, n6) {
|
|
7733
8007
|
const o5 = /* @__PURE__ */ new Map();
|
|
7734
8008
|
for (const [n7, r8] of Object.entries(e5)) t5[n7] && o5.set(r8, t5[n7]);
|
|
7735
8009
|
if (0 !== o5.size) {
|
|
@@ -7743,15 +8017,15 @@ async function mn(e4) {
|
|
|
7743
8017
|
}
|
|
7744
8018
|
}
|
|
7745
8019
|
}
|
|
7746
|
-
})(
|
|
8020
|
+
})(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
8021
|
const n6 = {};
|
|
7748
8022
|
for (const [o5, r7] of Object.entries(t5)) {
|
|
7749
|
-
const { code: t6, env:
|
|
7750
|
-
if (!
|
|
7751
|
-
e5.logger.warn(`Transformer ${o5} invalid (${
|
|
8023
|
+
const { code: t6, env: s5 = {} } = r7, a5 = ur(r7, "Transformer");
|
|
8024
|
+
if (!a5.ok) {
|
|
8025
|
+
e5.logger.warn(`Transformer ${o5} invalid (${a5.code}): ${a5.reason}. Skipping.`);
|
|
7752
8026
|
continue;
|
|
7753
8027
|
}
|
|
7754
|
-
const { config:
|
|
8028
|
+
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
8029
|
const t7 = r7.mapping;
|
|
7756
8030
|
if (t7) {
|
|
7757
8031
|
const n7 = [];
|
|
@@ -7772,12 +8046,79 @@ async function mn(e4) {
|
|
|
7772
8046
|
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
8047
|
}
|
|
7774
8048
|
return n6;
|
|
7775
|
-
})(
|
|
8049
|
+
})(s4, e4.transformers || {}), s4;
|
|
7776
8050
|
}
|
|
7777
|
-
|
|
8051
|
+
var bn2 = globalThis;
|
|
8052
|
+
function kn2(e4) {
|
|
8053
|
+
try {
|
|
8054
|
+
const t4 = bn2.window;
|
|
8055
|
+
if (!t4) return;
|
|
8056
|
+
t4.localStorage.getItem(Nt) === e4 && t4.localStorage.removeItem(Nt);
|
|
8057
|
+
} catch {
|
|
8058
|
+
}
|
|
8059
|
+
}
|
|
8060
|
+
function In(e4, t4) {
|
|
8061
|
+
return void 0 === t4 ? e4 : (n5) => e4({ ...n5, release: t4 });
|
|
8062
|
+
}
|
|
8063
|
+
function Cn2(e4, t4) {
|
|
8064
|
+
if (t4.observers) for (const n6 of t4.observers) e4.observers.add(n6);
|
|
8065
|
+
const n5 = t4.observe;
|
|
8066
|
+
if (!n5) return;
|
|
8067
|
+
const o4 = e4.name ?? "default";
|
|
8068
|
+
if ("binding" in n5) {
|
|
8069
|
+
const t5 = (function() {
|
|
8070
|
+
const e5 = bn2.window, t6 = bn2.URLSearchParams;
|
|
8071
|
+
if (!e5 || !t6) return null;
|
|
8072
|
+
try {
|
|
8073
|
+
const n6 = new t6(e5.location.search.replace(/^\?/, "")).getAll(Nt);
|
|
8074
|
+
return n6.length > 0 ? n6[n6.length - 1] ?? null : null;
|
|
8075
|
+
} catch {
|
|
8076
|
+
return null;
|
|
8077
|
+
}
|
|
8078
|
+
})(), r7 = t5 ?? (function() {
|
|
8079
|
+
try {
|
|
8080
|
+
return bn2.window?.localStorage.getItem(Nt) ?? null;
|
|
8081
|
+
} catch {
|
|
8082
|
+
return null;
|
|
8083
|
+
}
|
|
8084
|
+
})();
|
|
8085
|
+
if (!r7) return;
|
|
8086
|
+
const u2 = xn(r7);
|
|
8087
|
+
if (!u2) return void (null === t5 ? (e4.logger.warn("observe: malformed stored credential cleared"), kn2(r7)) : e4.logger.warn("observe: malformed credential ignored"));
|
|
8088
|
+
if (u2.pb !== n5.binding) return void e4.logger.warn("observe: credential binding mismatch, credential ignored");
|
|
8089
|
+
let d2;
|
|
8090
|
+
!(function(e5) {
|
|
8091
|
+
try {
|
|
8092
|
+
bn2.window?.localStorage.setItem(Nt, e5);
|
|
8093
|
+
} catch {
|
|
8094
|
+
}
|
|
8095
|
+
})(r7), null !== t5 && (function() {
|
|
8096
|
+
const e5 = bn2.window, t6 = bn2.URLSearchParams;
|
|
8097
|
+
if (e5 && t6) try {
|
|
8098
|
+
const n6 = e5.location.href, o5 = n6.indexOf("#"), r8 = o5 >= 0 ? n6.slice(o5) : "", a4 = o5 >= 0 ? n6.slice(0, o5) : n6, i5 = a4.indexOf("?"), c2 = i5 >= 0 ? a4.slice(0, i5) : a4, u3 = new t6(i5 >= 0 ? a4.slice(i5 + 1) : "");
|
|
8099
|
+
u3.delete(Nt);
|
|
8100
|
+
const d3 = u3.toString();
|
|
8101
|
+
e5.history.replaceState({}, "", `${c2}${d3 ? `?${d3}` : ""}${r8}`);
|
|
8102
|
+
} catch {
|
|
8103
|
+
}
|
|
8104
|
+
})();
|
|
8105
|
+
const l3 = sn({ url: `${n5.url}/ingest/${u2.ses}`, token: u2.secret, headers: { "X-Walkeros-Binding": n5.binding }, onStatus: (t6) => {
|
|
8106
|
+
401 === t6 && (kn2(r7), d2 && e4.observers.delete(d2));
|
|
8107
|
+
} });
|
|
8108
|
+
d2 = vt(/* @__PURE__ */ (function(e5, t6) {
|
|
8109
|
+
return void 0 === t6 ? e5 : (n6) => e5({ ...n6, flowId: t6 });
|
|
8110
|
+
})(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);
|
|
8111
|
+
const f3 = n5.level;
|
|
8112
|
+
return void (void 0 !== f3 && (e4.observeLevel = () => f3));
|
|
8113
|
+
}
|
|
8114
|
+
if ("off" === n5.level) return;
|
|
8115
|
+
const r6 = n5.level;
|
|
8116
|
+
void 0 !== r6 && (e4.observeLevel = () => r6), e4.observers.add(vt(In(sn({ url: `${n5.url}/ingest/${n5.sessionId}`, token: n5.token }), e4.release), { flowId: o4, level: n5.level, sample: n5.sample }));
|
|
8117
|
+
}
|
|
8118
|
+
async function En(e4) {
|
|
7778
8119
|
e4 = e4 || {};
|
|
7779
|
-
const t4 = await
|
|
7780
|
-
await
|
|
8120
|
+
const t4 = await wn2(e4);
|
|
8121
|
+
Cn2(t4, e4), await Qe2(t4, e4.sources || {});
|
|
7781
8122
|
const { consent: n5, user: o4, globals: r6, custom: s4 } = e4;
|
|
7782
8123
|
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
8124
|
let a4 = t4.elb;
|
|
@@ -7927,7 +8268,7 @@ async function createEmitter(opts) {
|
|
|
7927
8268
|
}
|
|
7928
8269
|
}
|
|
7929
8270
|
};
|
|
7930
|
-
const { elb } = await
|
|
8271
|
+
const { elb } = await En(collectorConfig);
|
|
7931
8272
|
elbFn = elb;
|
|
7932
8273
|
return elbFn;
|
|
7933
8274
|
}
|
|
@@ -8339,7 +8680,7 @@ function defaultPushError(error, startTime) {
|
|
|
8339
8680
|
error: getErrorMessage(error)
|
|
8340
8681
|
};
|
|
8341
8682
|
}
|
|
8342
|
-
async function withFlowContext(options,
|
|
8683
|
+
async function withFlowContext(options, fn2, onError) {
|
|
8343
8684
|
const {
|
|
8344
8685
|
esmPath,
|
|
8345
8686
|
platform,
|
|
@@ -8414,7 +8755,7 @@ async function withFlowContext(options, fn3, onError) {
|
|
|
8414
8755
|
const stopPump = drainPump ? startDrainPump(timerControl.pending) : null;
|
|
8415
8756
|
let result;
|
|
8416
8757
|
try {
|
|
8417
|
-
result = await
|
|
8758
|
+
result = await fn2(flowModule);
|
|
8418
8759
|
} finally {
|
|
8419
8760
|
if (stopPump) stopPump();
|
|
8420
8761
|
}
|
|
@@ -8427,9 +8768,9 @@ async function withFlowContext(options, fn3, onError) {
|
|
|
8427
8768
|
timeout
|
|
8428
8769
|
);
|
|
8429
8770
|
});
|
|
8430
|
-
return await Promise.race([
|
|
8771
|
+
return await Promise.race([fn2(flowModule), timeoutPromise]);
|
|
8431
8772
|
}
|
|
8432
|
-
return await
|
|
8773
|
+
return await fn2(flowModule);
|
|
8433
8774
|
} catch (error) {
|
|
8434
8775
|
return (onError ?? defaultPushError)(error, startTime);
|
|
8435
8776
|
} finally {
|
|
@@ -8799,7 +9140,7 @@ function resolveBeforeChain(before, transformers, ingest, event) {
|
|
|
8799
9140
|
if (Array.isArray(before) && before.every(isString)) {
|
|
8800
9141
|
return before;
|
|
8801
9142
|
}
|
|
8802
|
-
const ids =
|
|
9143
|
+
const ids = zn(before, Xn(ingest, event));
|
|
8803
9144
|
if (ids.length === 0) return [];
|
|
8804
9145
|
if (ids.length === 1) return walkStaticChain(ids[0], transformers);
|
|
8805
9146
|
return ids;
|
|
@@ -9112,7 +9453,7 @@ async function simulateSource(configOrPath, input, options) {
|
|
|
9112
9453
|
const captured = [];
|
|
9113
9454
|
flowConfig.hooks = {
|
|
9114
9455
|
...flowConfig.hooks || {},
|
|
9115
|
-
prePush: ({ fn:
|
|
9456
|
+
prePush: ({ fn: fn2 }, event) => {
|
|
9116
9457
|
captured.push({ event, timestamp: Date.now() });
|
|
9117
9458
|
return { ok: true };
|
|
9118
9459
|
}
|
|
@@ -9228,7 +9569,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
9228
9569
|
`Transformer "${options.transformerId}" not found in collector. Available: ${Object.keys(collector.transformers || {}).join(", ") || "none"}`
|
|
9229
9570
|
);
|
|
9230
9571
|
}
|
|
9231
|
-
const initialized = await
|
|
9572
|
+
const initialized = await Re2(
|
|
9232
9573
|
collector,
|
|
9233
9574
|
transformer,
|
|
9234
9575
|
options.transformerId
|
|
@@ -9240,7 +9581,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
9240
9581
|
}
|
|
9241
9582
|
const inputEvent = event;
|
|
9242
9583
|
const ingest = {
|
|
9243
|
-
...
|
|
9584
|
+
...I(options.transformerId),
|
|
9244
9585
|
...options.ingest
|
|
9245
9586
|
};
|
|
9246
9587
|
const captured = [];
|
|
@@ -9255,7 +9596,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
9255
9596
|
processedEvent
|
|
9256
9597
|
);
|
|
9257
9598
|
if (beforeChainIds.length > 0) {
|
|
9258
|
-
const beforeResult = await
|
|
9599
|
+
const beforeResult = await We2(
|
|
9259
9600
|
collector,
|
|
9260
9601
|
collector.transformers,
|
|
9261
9602
|
beforeChainIds,
|
|
@@ -9277,7 +9618,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
9277
9618
|
processedEvent = Array.isArray(beforeResult) ? beforeResult[0] : beforeResult;
|
|
9278
9619
|
}
|
|
9279
9620
|
}
|
|
9280
|
-
const pushResult = await
|
|
9621
|
+
const pushResult = await He(
|
|
9281
9622
|
collector,
|
|
9282
9623
|
transformer,
|
|
9283
9624
|
options.transformerId,
|
|
@@ -9400,7 +9741,7 @@ async function simulateCollector(configOrPath, event, options) {
|
|
|
9400
9741
|
if (options.state.timing !== void 0)
|
|
9401
9742
|
collector.timing = options.state.timing;
|
|
9402
9743
|
}
|
|
9403
|
-
const enriched =
|
|
9744
|
+
const enriched = Yt(collector, event);
|
|
9404
9745
|
const captured = [{ event: enriched, timestamp: Date.now() }];
|
|
9405
9746
|
await collector.command("shutdown");
|
|
9406
9747
|
return buildSimulationResult({
|
|
@@ -9506,7 +9847,7 @@ async function simulateDestination(configOrPath, event, options) {
|
|
|
9506
9847
|
...devEnv.push,
|
|
9507
9848
|
simulation: devEnv.simulation
|
|
9508
9849
|
};
|
|
9509
|
-
const { wrappedEnv, calls } =
|
|
9850
|
+
const { wrappedEnv, calls } = K2(combined);
|
|
9510
9851
|
if (destConfig) destConfig.env = wrappedEnv;
|
|
9511
9852
|
trackedCalls = calls;
|
|
9512
9853
|
}
|
|
@@ -10250,7 +10591,7 @@ function readGrantHeader(req) {
|
|
|
10250
10591
|
return "";
|
|
10251
10592
|
}
|
|
10252
10593
|
function guardPreviewIntake(req, res, gate, logger, onPass) {
|
|
10253
|
-
|
|
10594
|
+
It(readGrantHeader(req), {
|
|
10254
10595
|
keyring: gate.keyring,
|
|
10255
10596
|
iss: gate.iss,
|
|
10256
10597
|
pb: gate.pb,
|
|
@@ -10672,9 +11013,9 @@ function createTracePoller(config, logger) {
|
|
|
10672
11013
|
if (!("traceUntil" in parsed)) return;
|
|
10673
11014
|
const value = parsed.traceUntil;
|
|
10674
11015
|
if (typeof value === "string" && value.length > 0) {
|
|
10675
|
-
|
|
11016
|
+
rn(value);
|
|
10676
11017
|
} else if (value === null) {
|
|
10677
|
-
|
|
11018
|
+
rn(null);
|
|
10678
11019
|
}
|
|
10679
11020
|
} finally {
|
|
10680
11021
|
inFlight = false;
|
|
@@ -11101,12 +11442,12 @@ function buildTelemetryObservers(flowId, observeLevel) {
|
|
|
11101
11442
|
const deploymentId = process.env.WALKEROS_DEPLOYMENT_ID;
|
|
11102
11443
|
if (!base || !token || !deploymentId) return void 0;
|
|
11103
11444
|
const url = `${base}/ingest/${deploymentId}`;
|
|
11104
|
-
const emit =
|
|
11445
|
+
const emit = sn({ url, token });
|
|
11105
11446
|
const observe = observeLevel !== void 0 ? { level: observeLevel } : void 0;
|
|
11106
11447
|
return [
|
|
11107
11448
|
vt(
|
|
11108
11449
|
emit,
|
|
11109
|
-
() => bt({ flowId, observe, traceUntil:
|
|
11450
|
+
() => bt({ flowId, observe, traceUntil: nn() })
|
|
11110
11451
|
)
|
|
11111
11452
|
];
|
|
11112
11453
|
}
|
|
@@ -11116,7 +11457,7 @@ function buildObserveLevelSupplier(flowId, observeLevel) {
|
|
|
11116
11457
|
const opts = bt({
|
|
11117
11458
|
flowId,
|
|
11118
11459
|
observe,
|
|
11119
|
-
traceUntil:
|
|
11460
|
+
traceUntil: nn()
|
|
11120
11461
|
});
|
|
11121
11462
|
return opts ? opts.level ?? "standard" : "off";
|
|
11122
11463
|
};
|
|
@@ -11479,11 +11820,11 @@ function resolveEnvMarkers(value) {
|
|
|
11479
11820
|
function resolveEnvMarkersInString(input) {
|
|
11480
11821
|
if (!input.includes(J)) return input;
|
|
11481
11822
|
const esc = J.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
11482
|
-
const
|
|
11823
|
+
const re4 = new RegExp(
|
|
11483
11824
|
esc + "([a-zA-Z_][a-zA-Z0-9_]*)(?::((?:(?!" + esc + `)[^\\s"'])*))?`,
|
|
11484
11825
|
"g"
|
|
11485
11826
|
);
|
|
11486
|
-
return input.replace(
|
|
11827
|
+
return input.replace(re4, (match, name, defaultValue) => {
|
|
11487
11828
|
if (typeof process !== "undefined" && process.env?.[name] !== void 0) {
|
|
11488
11829
|
return process.env[name];
|
|
11489
11830
|
}
|
|
@@ -12991,7 +13332,7 @@ function validateFlow(input, options = {}) {
|
|
|
12991
13332
|
transformersValue
|
|
12992
13333
|
)) {
|
|
12993
13334
|
if (!de(transformerValue)) continue;
|
|
12994
|
-
const result =
|
|
13335
|
+
const result = ur(transformerValue, "Transformer");
|
|
12995
13336
|
if (!result.ok) {
|
|
12996
13337
|
errors.push({
|
|
12997
13338
|
path: `flows.${flowName}.transformers.${name}`,
|
|
@@ -13452,7 +13793,7 @@ function validateMapping(input) {
|
|
|
13452
13793
|
// src/commands/validate/validators/entry.ts
|
|
13453
13794
|
init_dist();
|
|
13454
13795
|
import Ajv from "ajv";
|
|
13455
|
-
var CLIENT_HEADER = "walkeros-cli/4.3.
|
|
13796
|
+
var CLIENT_HEADER = "walkeros-cli/4.3.1";
|
|
13456
13797
|
var SECTIONS = ["destinations", "sources", "transformers"];
|
|
13457
13798
|
function resolveEntry(path19, flowConfig) {
|
|
13458
13799
|
const flows = flowConfig.flows;
|
|
@@ -13528,7 +13869,7 @@ async function validateEntry(path19, flowConfig) {
|
|
|
13528
13869
|
}
|
|
13529
13870
|
let schemas;
|
|
13530
13871
|
try {
|
|
13531
|
-
const info = await
|
|
13872
|
+
const info = await wn(packageName, {
|
|
13532
13873
|
client: CLIENT_HEADER
|
|
13533
13874
|
});
|
|
13534
13875
|
schemas = info.schemas;
|
|
@@ -14363,9 +14704,9 @@ async function deleteDeployment(options) {
|
|
|
14363
14704
|
const data = await response.json().catch(() => null);
|
|
14364
14705
|
return data ?? { success: true };
|
|
14365
14706
|
}
|
|
14366
|
-
async function handleResult3(
|
|
14707
|
+
async function handleResult3(fn2, options) {
|
|
14367
14708
|
try {
|
|
14368
|
-
const result = await
|
|
14709
|
+
const result = await fn2();
|
|
14369
14710
|
await writeResult(JSON.stringify(result, null, 2), options);
|
|
14370
14711
|
} catch (error) {
|
|
14371
14712
|
handleCliError(error);
|
|
@@ -14855,6 +15196,30 @@ previewsCmd.command("delete <flowId> <previewId>").description("Delete a preview
|
|
|
14855
15196
|
handleCliError(err);
|
|
14856
15197
|
}
|
|
14857
15198
|
});
|
|
15199
|
+
var observeCmd = program.command("observe").description("Observe live events flowing through a flow");
|
|
15200
|
+
observeCmd.command("start <flowId>").description(
|
|
15201
|
+
"Start an observe session: mints it via the app and prints the web and server attach info"
|
|
15202
|
+
).option(
|
|
15203
|
+
"-f, --flow <name>",
|
|
15204
|
+
"Flow settings name (auto-resolved when the flow has exactly one)"
|
|
15205
|
+
).option("--project <projectId>", "Project ID (overrides default)").option(
|
|
15206
|
+
"--level <level>",
|
|
15207
|
+
"Observation detail level: off, standard, or trace"
|
|
15208
|
+
).option("--replace", "Replace an existing active session for this flow").option("--no-wait", "Do not wait for the session to settle").option(
|
|
15209
|
+
"--timeout <seconds>",
|
|
15210
|
+
"Seconds to wait for the session to settle (default: 300)"
|
|
15211
|
+
).option("--json", "Output the session as JSON").action(async (flowId, options) => {
|
|
15212
|
+
const { observeStartCommand: observeStartCommand2 } = await Promise.resolve().then(() => (init_observe(), observe_exports));
|
|
15213
|
+
await observeStartCommand2(flowId, {
|
|
15214
|
+
project: options.project,
|
|
15215
|
+
flow: options.flow,
|
|
15216
|
+
level: options.level,
|
|
15217
|
+
replace: options.replace,
|
|
15218
|
+
wait: options.wait,
|
|
15219
|
+
timeout: options.timeout,
|
|
15220
|
+
json: options.json
|
|
15221
|
+
});
|
|
15222
|
+
});
|
|
14858
15223
|
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
15224
|
"--env-file <path>",
|
|
14860
15225
|
"load environment variables from a dotenv file (opt-in; existing env wins; refuses group/other-readable files)"
|