@walkeros/cli 4.3.0-next-1784055686454 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -6
- package/dist/cli.js +484 -391
- package/dist/index.d.ts +86 -8
- package/dist/index.js +135 -42
- package/dist/index.js.map +1 -1
- package/openapi/spec.json +106 -8
- package/package.json +12 -11
package/dist/cli.js
CHANGED
|
@@ -284,18 +284,18 @@ function Q(e4, t4, n5, r6, o4, s4) {
|
|
|
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`);
|
|
287
|
-
const
|
|
288
|
-
if (
|
|
289
|
-
M(`Cyclic $var reference: ${[...
|
|
287
|
+
const u3 = s4 ?? /* @__PURE__ */ new Set();
|
|
288
|
+
if (u3.has(a5)) {
|
|
289
|
+
M(`Cyclic $var reference: ${[...u3, a5].join(" -> ")}`);
|
|
290
290
|
}
|
|
291
|
-
let
|
|
292
|
-
|
|
291
|
+
let f4;
|
|
292
|
+
u3.add(a5);
|
|
293
293
|
try {
|
|
294
|
-
|
|
294
|
+
f4 = Q(t4[a5], t4, n5, r6, o4, u3);
|
|
295
295
|
} finally {
|
|
296
|
-
|
|
296
|
+
u3.delete(a5);
|
|
297
297
|
}
|
|
298
|
-
return c3 && (
|
|
298
|
+
return c3 && (f4 = Y(f4, c3, `$var.${a5}`)), f4;
|
|
299
299
|
}
|
|
300
300
|
const a4 = e4.match(q);
|
|
301
301
|
if (a4 && r6) {
|
|
@@ -324,32 +324,32 @@ function Q(e4, t4, n5, r6, o4, s4) {
|
|
|
324
324
|
} else a5 = Y(a5, r7, `$flow.${t5}`);
|
|
325
325
|
return a5;
|
|
326
326
|
}
|
|
327
|
-
const
|
|
328
|
-
if (
|
|
329
|
-
const e5 =
|
|
327
|
+
const u2 = e4.match(K);
|
|
328
|
+
if (u2) {
|
|
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
|
|
334
|
-
const a5 = i6.split("."), c3 = a5[0],
|
|
333
|
+
let f3 = e4.replace(U, (e5, i6) => {
|
|
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
|
-
const
|
|
337
|
-
if (
|
|
338
|
-
M(`Cyclic $var reference: ${[...
|
|
336
|
+
const f4 = s4 ?? /* @__PURE__ */ new Set();
|
|
337
|
+
if (f4.has(c3)) {
|
|
338
|
+
M(`Cyclic $var reference: ${[...f4, c3].join(" -> ")}`);
|
|
339
339
|
}
|
|
340
340
|
let l3;
|
|
341
|
-
|
|
341
|
+
f4.add(c3);
|
|
342
342
|
try {
|
|
343
|
-
l3 = Q(t4[c3], t4, n5, r6, o4,
|
|
343
|
+
l3 = Q(t4[c3], t4, n5, r6, o4, f4);
|
|
344
344
|
} finally {
|
|
345
|
-
|
|
345
|
+
f4.delete(c3);
|
|
346
346
|
}
|
|
347
|
-
if (
|
|
347
|
+
if (u3 && (l3 = Y(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
|
|
352
|
+
return f3 = f3.replace(D, (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) {
|
|
@@ -396,20 +396,20 @@ function te(e4, t4, n5) {
|
|
|
396
396
|
o5.config = Q(o5.config, i6, n6, s5, r7);
|
|
397
397
|
}
|
|
398
398
|
if (o5.sources) for (const [i6, a5] of Object.entries(o5.sources)) {
|
|
399
|
-
const c3 = H(e5.variables, t5.variables, a5.variables),
|
|
400
|
-
o5.sources[i6] = { package: a5.package, import: a5.import, config:
|
|
399
|
+
const c3 = H(e5.variables, t5.variables, a5.variables), u2 = Q(a5.config, c3, n6, s5, r7), f3 = Q(a5.env, c3, n6, s5, r7);
|
|
400
|
+
o5.sources[i6] = { package: a5.package, import: a5.import, config: u2, env: f3, primary: a5.primary, variables: a5.variables, before: a5.before, next: a5.next, cache: a5.cache, code: a5.code };
|
|
401
401
|
}
|
|
402
402
|
if (o5.destinations) for (const [i6, a5] of Object.entries(o5.destinations)) {
|
|
403
|
-
const c3 = H(e5.variables, t5.variables, a5.variables),
|
|
404
|
-
o5.destinations[i6] = { package: a5.package, import: a5.import, config:
|
|
403
|
+
const c3 = H(e5.variables, t5.variables, a5.variables), u2 = Q(a5.config, c3, n6, s5, r7), f3 = Q(a5.env, c3, n6, s5, r7);
|
|
404
|
+
o5.destinations[i6] = { package: a5.package, import: a5.import, config: u2, env: f3, variables: a5.variables, before: a5.before, next: a5.next, cache: a5.cache, code: a5.code };
|
|
405
405
|
}
|
|
406
406
|
if (o5.stores) for (const [i6, a5] of Object.entries(o5.stores)) {
|
|
407
|
-
const c3 = H(e5.variables, t5.variables, a5.variables),
|
|
408
|
-
o5.stores[i6] = { package: a5.package, import: a5.import, config:
|
|
407
|
+
const c3 = H(e5.variables, t5.variables, a5.variables), u2 = Q(a5.config, c3, n6, s5, r7), f3 = Q(a5.env, c3, n6, s5, r7);
|
|
408
|
+
o5.stores[i6] = { package: a5.package, import: a5.import, config: u2, env: f3, cache: a5.cache, variables: a5.variables, code: a5.code };
|
|
409
409
|
}
|
|
410
410
|
if (o5.transformers) for (const [i6, a5] of Object.entries(o5.transformers)) {
|
|
411
|
-
const c3 = H(e5.variables, t5.variables, a5.variables),
|
|
412
|
-
o5.transformers[i6] = { package: a5.package, import: a5.import, config:
|
|
411
|
+
const c3 = H(e5.variables, t5.variables, a5.variables), u2 = Q(a5.config, c3, n6, s5, r7), f3 = Q(a5.env, c3, n6, s5, r7);
|
|
412
|
+
o5.transformers[i6] = { package: a5.package, import: a5.import, config: u2, env: f3, variables: a5.variables, before: a5.before, next: a5.next, cache: a5.cache, code: a5.code };
|
|
413
413
|
}
|
|
414
414
|
if (o5.collector) {
|
|
415
415
|
const i6 = H(e5.variables, t5.variables), a5 = Q(o5.collector, i6, n6, s5, r7);
|
|
@@ -440,7 +440,7 @@ function ie(e4) {
|
|
|
440
440
|
function ae(e4) {
|
|
441
441
|
return "boolean" == typeof e4;
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function ue(e4) {
|
|
444
444
|
return void 0 !== e4;
|
|
445
445
|
}
|
|
446
446
|
function le(e4) {
|
|
@@ -496,7 +496,7 @@ function ve(e4, t4 = "", n5) {
|
|
|
496
496
|
}
|
|
497
497
|
if (o4 = de(o4) || ie(o4) ? o4[t5] : void 0, void 0 === o4) break;
|
|
498
498
|
}
|
|
499
|
-
return
|
|
499
|
+
return ue(o4) ? o4 : n5;
|
|
500
500
|
}
|
|
501
501
|
function ye(e4, t4, n5) {
|
|
502
502
|
if (!de(e4)) return e4;
|
|
@@ -602,22 +602,22 @@ function Ue(e4, t4) {
|
|
|
602
602
|
}
|
|
603
603
|
function De(e4, t4 = 1e3, n5 = false) {
|
|
604
604
|
const { wait: r6, size: o4, age: s4 } = Ue(t4, 1e3);
|
|
605
|
-
let i5, a4, c2 = null,
|
|
605
|
+
let i5, a4, c2 = null, u2 = null, f3 = false, l3 = [], p3 = 0;
|
|
606
606
|
const d2 = () => {
|
|
607
|
-
c2 && (clearTimeout(c2), c2 = null),
|
|
607
|
+
c2 && (clearTimeout(c2), c2 = null), u2 && (clearTimeout(u2), u2 = null), p3 = 0, a4 = void 0;
|
|
608
608
|
}, m3 = () => {
|
|
609
609
|
const t5 = a4, n6 = l3;
|
|
610
610
|
if (d2(), l3 = [], t5) return i5 = e4(...t5), n6.forEach((e5) => e5(i5)), i5;
|
|
611
611
|
n6.forEach((e5) => e5(void 0));
|
|
612
612
|
}, g3 = (...t5) => new Promise((d3) => {
|
|
613
|
-
const g4 = n5 && !
|
|
613
|
+
const g4 = n5 && !f3;
|
|
614
614
|
if (a4 = t5, p3 += 1, l3.push(d3), c2 && clearTimeout(c2), c2 = setTimeout(() => {
|
|
615
|
-
c2 = null, n5 && !
|
|
616
|
-
}, r6), void 0 === s4 ||
|
|
617
|
-
|
|
615
|
+
c2 = null, n5 && !f3 || m3();
|
|
616
|
+
}, r6), void 0 === s4 || u2 || (u2 = setTimeout(() => {
|
|
617
|
+
u2 = null, m3();
|
|
618
618
|
}, s4)), void 0 !== o4 && p3 >= o4) m3();
|
|
619
619
|
else if (g4) {
|
|
620
|
-
|
|
620
|
+
f3 = true, i5 = e4(...t5);
|
|
621
621
|
const n6 = l3;
|
|
622
622
|
l3 = [], n6.forEach((e5) => e5(i5));
|
|
623
623
|
}
|
|
@@ -656,7 +656,7 @@ function We(e4) {
|
|
|
656
656
|
}, scope: (e5) => We({ level: t4, handler: n5, jsonHandler: r6, scope: [...o4, e5] }) };
|
|
657
657
|
}
|
|
658
658
|
function Ve(e4) {
|
|
659
|
-
return ae(e4) || ge(e4) || pe(e4) || !
|
|
659
|
+
return ae(e4) || ge(e4) || pe(e4) || !ue(e4) || ie(e4) && e4.every(Ve) || de(e4) && Object.values(e4).every(Ve);
|
|
660
660
|
}
|
|
661
661
|
function Je(e4) {
|
|
662
662
|
return Ve(e4) ? e4 : void 0;
|
|
@@ -689,7 +689,7 @@ async function Qe(e4, t4, n5) {
|
|
|
689
689
|
const [r6, o4] = (e4.name || "").split(" ");
|
|
690
690
|
if (!t4 || !r6 || !o4) return {};
|
|
691
691
|
let s4, i5 = "", a4 = r6, c2 = o4;
|
|
692
|
-
const
|
|
692
|
+
const u2 = (t5) => {
|
|
693
693
|
if (!t5) return;
|
|
694
694
|
return (ie(t5) ? t5 : [t5]).find((t6) => {
|
|
695
695
|
if (!t6.condition) return true;
|
|
@@ -699,11 +699,11 @@ async function Qe(e4, t4, n5) {
|
|
|
699
699
|
});
|
|
700
700
|
};
|
|
701
701
|
t4[a4] || (a4 = "*");
|
|
702
|
-
const
|
|
703
|
-
return
|
|
702
|
+
const f3 = t4[a4];
|
|
703
|
+
return f3 && (f3[c2] || (c2 = "*"), s4 = u2(f3[c2])), s4 || (a4 = "*", c2 = "*", s4 = u2(t4[a4]?.[c2])), s4 && (i5 = `${a4} ${c2}`), { eventMapping: s4, mappingKey: i5 };
|
|
704
704
|
}
|
|
705
705
|
async function et(e4, t4 = {}, n5 = {}) {
|
|
706
|
-
if (!
|
|
706
|
+
if (!ue(e4)) return;
|
|
707
707
|
const r6 = de(e4) && e4.consent || n5.consent || n5.collector?.consent, o4 = n5.event ?? (de(e4) ? e4 : {});
|
|
708
708
|
if (!n5.collector) throw new Error("getMappingValue: context.collector is required");
|
|
709
709
|
const s4 = { event: o4, mapping: t4, collector: n5.collector, logger: n5.collector.logger, consent: r6 }, i5 = ie(t4) ? t4 : [t4];
|
|
@@ -712,7 +712,7 @@ async function et(e4, t4 = {}, n5 = {}) {
|
|
|
712
712
|
if (e5 instanceof Ye) throw e5;
|
|
713
713
|
n5.collector && n5.collector.status.failed++, s4.logger.error("mapping processing failed", { event: o4, error: e5 });
|
|
714
714
|
})(e4, t5, { ...s4, mapping: t5 });
|
|
715
|
-
if (
|
|
715
|
+
if (ue(r7)) return r7;
|
|
716
716
|
}
|
|
717
717
|
}
|
|
718
718
|
async function tt(e4, t4, n5) {
|
|
@@ -721,29 +721,29 @@ async function tt(e4, t4, n5) {
|
|
|
721
721
|
if (o4) return o4;
|
|
722
722
|
const s4 = ge(r6) ? { key: r6 } : r6;
|
|
723
723
|
if (!Object.keys(s4).length) return;
|
|
724
|
-
const { condition: i5, consent: a4, fn: c2, key:
|
|
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
725
|
if (i5 && !await Xe(i5, (e5) => {
|
|
726
726
|
if (e5 instanceof Ye) 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
|
-
let h2 =
|
|
730
|
+
let h2 = ue(m3) ? m3 : e4;
|
|
731
731
|
if (c2 && (h2 = await Xe(c2, (e5) => {
|
|
732
732
|
if (e5 instanceof Ye) throw e5;
|
|
733
733
|
g3.logger.error("mapping fn failed", { event: g3.event, error: e5 });
|
|
734
|
-
})(e4, g3)),
|
|
735
|
-
const [t6, n6] =
|
|
736
|
-
ie(r7) && (h2 = (await Promise.all(r7.map((e5) => et(e5, n6, g3)))).filter(
|
|
734
|
+
})(e4, g3)), u2 && (h2 = ve(e4, u2, m3)), f3) {
|
|
735
|
+
const [t6, n6] = f3, r7 = "this" === t6 ? [e4] : await et(e4, t6, g3);
|
|
736
|
+
ie(r7) && (h2 = (await Promise.all(r7.map((e5) => et(e5, n6, g3)))).filter(ue));
|
|
737
737
|
} else l3 ? h2 = await Object.entries(l3).reduce(async (t6, [n6, r7]) => {
|
|
738
738
|
const o5 = await t6, s5 = await et(e4, r7, g3);
|
|
739
|
-
return
|
|
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
741
|
d2 && !await Xe(d2, (e5) => {
|
|
742
742
|
if (e5 instanceof Ye) 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);
|
|
746
|
-
return
|
|
746
|
+
return ue(v3) ? v3 : Je(m3);
|
|
747
747
|
}, Promise.resolve(void 0));
|
|
748
748
|
}
|
|
749
749
|
async function nt(e4, t4, n5) {
|
|
@@ -783,19 +783,19 @@ function gt(e4, t4, n5, r6) {
|
|
|
783
783
|
const o4 = e4;
|
|
784
784
|
return function(...e5) {
|
|
785
785
|
let s4;
|
|
786
|
-
const i5 = "pre" + t4, a4 = "post" + t4, c2 = n5[i5],
|
|
786
|
+
const i5 = "pre" + t4, a4 = "post" + t4, c2 = n5[i5], u2 = n5[a4], f3 = (e6, t5) => {
|
|
787
787
|
r6 ? r6.warn(e6, { error: t5 }) : console.warn(e6, t5);
|
|
788
788
|
};
|
|
789
789
|
if (c2) try {
|
|
790
790
|
s4 = c2({ fn: o4 }, ...e5);
|
|
791
791
|
} catch (t5) {
|
|
792
|
-
|
|
792
|
+
f3(`Hook ${String(i5)} failed, falling back to original function`, t5), s4 = o4(...e5);
|
|
793
793
|
}
|
|
794
794
|
else s4 = o4(...e5);
|
|
795
|
-
if (
|
|
796
|
-
s4 =
|
|
795
|
+
if (u2) try {
|
|
796
|
+
s4 = u2({ fn: o4, result: s4 }, ...e5);
|
|
797
797
|
} catch (e6) {
|
|
798
|
-
|
|
798
|
+
f3(`Hook ${String(a4)} failed, keeping original result`, e6);
|
|
799
799
|
}
|
|
800
800
|
return s4;
|
|
801
801
|
};
|
|
@@ -818,10 +818,10 @@ function vt(e4, t4) {
|
|
|
818
818
|
if ("off" === o4) return;
|
|
819
819
|
const s4 = r6.sample, i5 = "number" == typeof s4 && Number.isFinite(s4) ? s4 : 1;
|
|
820
820
|
if (t5.eventId && !ht(t5.eventId, i5)) return;
|
|
821
|
-
const a4 = r6.includeIn ?? "trace" === o4, c2 = r6.includeOut ?? "trace" === o4,
|
|
822
|
-
a4 || delete
|
|
821
|
+
const a4 = r6.includeIn ?? "trace" === o4, c2 = r6.includeOut ?? "trace" === o4, u2 = r6.includeMappingKey ?? "trace" === o4, f3 = { ...t5 };
|
|
822
|
+
a4 || delete f3.inEvent, c2 || (delete f3.outEvent, delete f3.calls), u2 || delete f3.mappingKey, "trace" !== o4 && f3.error?.message && f3.error.message.length > 256 && (f3.error = { ...f3.error, message: f3.error.message.slice(0, 256) + "\u2026" });
|
|
823
823
|
try {
|
|
824
|
-
e4(
|
|
824
|
+
e4(f3);
|
|
825
825
|
} catch {
|
|
826
826
|
}
|
|
827
827
|
};
|
|
@@ -876,7 +876,7 @@ function At(e4) {
|
|
|
876
876
|
function jt(e4) {
|
|
877
877
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
|
|
878
878
|
}
|
|
879
|
-
function
|
|
879
|
+
function St(e4) {
|
|
880
880
|
if (!e4) return null;
|
|
881
881
|
const t4 = e4.split("."), [n5, r6, o4] = t4;
|
|
882
882
|
if (3 !== t4.length || !n5 || !r6 || !o4) return null;
|
|
@@ -890,18 +890,18 @@ function xt(e4) {
|
|
|
890
890
|
const t5 = e5;
|
|
891
891
|
return "string" == typeof t5.iss && Array.isArray(t5.aud) && t5.aud.every((e6) => "string" == typeof e6) && "number" == typeof t5.iat && "number" == typeof t5.sxp && "string" == typeof t5.art && wt.test(t5.art) && "string" == typeof t5.sri && "string" == typeof t5.pb && "activate" === t5.cap && "string" == typeof t5.jti && "string" == typeof t5.pid && (void 0 === t5.ses || "string" == typeof t5.ses) && (void 0 === t5.sb || "string" == typeof t5.sb);
|
|
892
892
|
})(c2)) return null;
|
|
893
|
-
const
|
|
894
|
-
return
|
|
893
|
+
const u2 = kt(o4);
|
|
894
|
+
return u2 && 64 === u2.byteLength ? { grant: c2, kid: i5, signed: $t(`${n5}.${r6}`), signature: u2 } : null;
|
|
895
895
|
}
|
|
896
896
|
async function Et(e4, t4) {
|
|
897
|
-
const n5 =
|
|
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;
|
|
900
900
|
if (r6.iss !== t4.iss) return { ok: false, reason: "foreign-issuer" };
|
|
901
901
|
if ("activate" !== r6.cap) return { ok: false, reason: "cap-mismatch" };
|
|
902
902
|
if (1e3 * r6.iat > t4.now + 6e4) return { ok: false, reason: "expired" };
|
|
903
903
|
if (1e3 * r6.sxp - 1e3 * r6.iat > Ot) return { ok: false, reason: "expired" };
|
|
904
|
-
const a4 = "url" === t4.source ? Math.min(1e3 * r6.iat +
|
|
904
|
+
const a4 = "url" === t4.source ? Math.min(1e3 * r6.iat + xt, 1e3 * r6.sxp) : 1e3 * r6.sxp;
|
|
905
905
|
if (t4.now >= a4) return { ok: false, reason: "expired" };
|
|
906
906
|
if (void 0 !== t4.origin && !r6.aud.includes(t4.origin)) return { ok: false, reason: "aud-mismatch" };
|
|
907
907
|
if (t4.acceptForeign) {
|
|
@@ -914,13 +914,13 @@ async function Et(e4, t4) {
|
|
|
914
914
|
if (r6.ses !== t4.expectSession.ses) return { ok: false, reason: "sb-mismatch" };
|
|
915
915
|
if (!r6.sb || r6.sb !== t4.expectSession.sb) return { ok: false, reason: "sb-mismatch" };
|
|
916
916
|
} else if (c2) return { ok: false, reason: "sb-mismatch" };
|
|
917
|
-
const
|
|
918
|
-
if (!
|
|
919
|
-
const
|
|
917
|
+
const u2 = t4.keyring.find((e5) => e5.kid === o4);
|
|
918
|
+
if (!u2) return { ok: false, reason: "kid-mismatch" };
|
|
919
|
+
const f3 = t4.crypto ?? globalThis.crypto, l3 = f3?.subtle;
|
|
920
920
|
if (!l3) return { ok: false, reason: "no-subtle" };
|
|
921
921
|
const p3 = (function(e5) {
|
|
922
922
|
return kt(e5);
|
|
923
|
-
})(
|
|
923
|
+
})(u2.spki);
|
|
924
924
|
if (!p3) return { ok: false, reason: "kid-mismatch" };
|
|
925
925
|
try {
|
|
926
926
|
const e5 = await l3.importKey("spki", p3, { name: "ECDSA", namedCurve: "P-256" }, false, ["verify"]);
|
|
@@ -930,13 +930,13 @@ async function Et(e4, t4) {
|
|
|
930
930
|
}
|
|
931
931
|
return { ok: true, grant: r6 };
|
|
932
932
|
}
|
|
933
|
-
function
|
|
934
|
-
return
|
|
933
|
+
function tn() {
|
|
934
|
+
return en;
|
|
935
935
|
}
|
|
936
|
-
function
|
|
937
|
-
|
|
936
|
+
function nn(e4) {
|
|
937
|
+
en = e4;
|
|
938
938
|
}
|
|
939
|
-
function
|
|
939
|
+
function rn(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,10 +944,10 @@ function nn(e4, t4) {
|
|
|
944
944
|
} catch {
|
|
945
945
|
}
|
|
946
946
|
}
|
|
947
|
-
function
|
|
947
|
+
function on(e4) {
|
|
948
948
|
const t4 = e4.batchMs, n5 = "number" == typeof t4 && Number.isFinite(t4) && t4 > 0 ? Math.floor(t4) : 50, r6 = e4.batchSize, o4 = "number" == typeof r6 && Number.isFinite(r6) && r6 >= 1 ? Math.floor(r6) : 50, s4 = e4.maxBodyBytes, i5 = "number" == typeof s4 && Number.isFinite(s4) && s4 >= 1 ? Math.floor(s4) : 6e4, a4 = e4.fetch ?? ((e5, t5) => globalThis.fetch(e5, t5)), c2 = e4.onError ?? (() => {
|
|
949
949
|
});
|
|
950
|
-
let
|
|
950
|
+
let u2 = [], f3 = null, l3 = 0;
|
|
951
951
|
function p3(e5) {
|
|
952
952
|
const t5 = JSON.stringify(e5);
|
|
953
953
|
if (e5.length <= 1) return [t5];
|
|
@@ -975,22 +975,22 @@ function rn(e4) {
|
|
|
975
975
|
});
|
|
976
976
|
}
|
|
977
977
|
function m3() {
|
|
978
|
-
if (0 ===
|
|
979
|
-
const e5 =
|
|
980
|
-
|
|
978
|
+
if (0 === u2.length) return;
|
|
979
|
+
const e5 = u2;
|
|
980
|
+
u2 = [], f3 && (clearTimeout(f3), f3 = null);
|
|
981
981
|
const t5 = p3(e5);
|
|
982
982
|
(async () => {
|
|
983
983
|
for (const e6 of t5) await d2(e6);
|
|
984
984
|
})();
|
|
985
985
|
}
|
|
986
986
|
return (e5) => {
|
|
987
|
-
|
|
987
|
+
u2.push({ ...e5, seq: ++l3 }), u2.length >= o4 ? m3() : null === f3 && (f3 = setTimeout(m3, n5));
|
|
988
988
|
};
|
|
989
989
|
}
|
|
990
|
-
function
|
|
990
|
+
function hn(e4) {
|
|
991
991
|
return "string" == typeof e4 || Array.isArray(e4) && e4.every((e5) => "string" == typeof e5) ? e4 : void 0;
|
|
992
992
|
}
|
|
993
|
-
async function
|
|
993
|
+
async function vn(e4, t4) {
|
|
994
994
|
const n5 = t4?.version || "latest", r6 = t4?.timeout || 1e4, o4 = new AbortController(), s4 = setTimeout(() => o4.abort(), r6), i5 = o4.signal, a4 = t4?.client ? { "X-Walkeros-Client": t4.client } : void 0;
|
|
995
995
|
try {
|
|
996
996
|
if (t4?.baseUrl) {
|
|
@@ -1001,41 +1001,41 @@ async function hn(e4, t4) {
|
|
|
1001
1001
|
return { packageName: n6.package || e5, version: "string" == typeof n6.version ? n6.version : t5, ...void 0 !== n6.description && { description: n6.description }, ...void 0 !== n6.type && { type: n6.type }, ...void 0 !== c2 && { platform: c2 }, schemas: r9, examples: o7, ...void 0 !== n6.docs && { docs: n6.docs }, ...void 0 !== n6.source && { source: n6.source }, ...s5 && Object.keys(s5).length > 0 ? { hints: s5 } : {}, hintKeys: i6, exampleSummaries: a5 };
|
|
1002
1002
|
})(e4, n5, await o6.json());
|
|
1003
1003
|
}
|
|
1004
|
-
const r7 = `https://cdn.jsdelivr.net/npm/${e4}@${n5}`, o5 = await
|
|
1004
|
+
const r7 = `https://cdn.jsdelivr.net/npm/${e4}@${n5}`, o5 = await yn(`${r7}/package.json`, i5, a4);
|
|
1005
1005
|
return (function(e5, t5, n6, r8) {
|
|
1006
|
-
const o6 = r8.$meta || {}, s5 = r8.schemas || {}, i6 = r8.examples || {}, a5 = r8.hints, c2 = a5 ? Object.keys(a5) : [],
|
|
1007
|
-
for (const [e6, t6] of Object.entries(
|
|
1006
|
+
const o6 = r8.$meta || {}, s5 = r8.schemas || {}, i6 = r8.examples || {}, a5 = r8.hints, c2 = a5 ? Object.keys(a5) : [], u2 = [], f3 = i6.step || {};
|
|
1007
|
+
for (const [e6, t6] of Object.entries(f3)) {
|
|
1008
1008
|
const n7 = t6, r9 = { name: e6 };
|
|
1009
|
-
"string" == typeof n7?.description && (r9.description = n7.description),
|
|
1009
|
+
"string" == typeof n7?.description && (r9.description = n7.description), u2.push(r9);
|
|
1010
1010
|
}
|
|
1011
1011
|
const l3 = "string" == typeof o6.docs ? o6.docs : void 0, p3 = "string" == typeof o6.source ? o6.source : void 0;
|
|
1012
|
-
return { packageName: e5, version: "string" == typeof n6.version ? n6.version : t5, description: "string" == typeof n6.description ? n6.description : void 0, type: "string" == typeof o6.type ? o6.type : void 0, platform:
|
|
1013
|
-
})(e4, n5, o5, await
|
|
1012
|
+
return { packageName: e5, version: "string" == typeof n6.version ? n6.version : t5, description: "string" == typeof n6.description ? n6.description : void 0, type: "string" == typeof o6.type ? o6.type : void 0, platform: hn(o6.platform), schemas: s5, examples: i6, ...l3 ? { docs: l3 } : {}, ...p3 ? { source: p3 } : {}, ...a5 && Object.keys(a5).length > 0 ? { hints: a5 } : {}, hintKeys: c2, exampleSummaries: u2 };
|
|
1013
|
+
})(e4, n5, o5, await yn(`${r7}/dist/walkerOS.json`, i5, a4));
|
|
1014
1014
|
} finally {
|
|
1015
1015
|
clearTimeout(s4);
|
|
1016
1016
|
}
|
|
1017
1017
|
}
|
|
1018
|
-
async function
|
|
1018
|
+
async function yn(e4, t4, n5) {
|
|
1019
1019
|
const r6 = await fetch(e4, { signal: t4, ...n5 && { headers: n5 } });
|
|
1020
1020
|
if (!r6.ok) throw new Error(`Failed to fetch ${e4} (HTTP ${r6.status})`);
|
|
1021
1021
|
return await r6.json();
|
|
1022
1022
|
}
|
|
1023
|
-
async function
|
|
1024
|
-
const n5 = await
|
|
1023
|
+
async function bn(e4, t4) {
|
|
1024
|
+
const n5 = await vn(e4, t4);
|
|
1025
1025
|
return { packageName: n5.packageName, version: n5.version, type: n5.type, platform: n5.platform, schemas: n5.schemas, examples: n5.examples, ...n5.hints ? { hints: n5.hints } : {} };
|
|
1026
1026
|
}
|
|
1027
|
-
function
|
|
1028
|
-
const t4 = (e4.startsWith(
|
|
1027
|
+
function An(e4) {
|
|
1028
|
+
const t4 = (e4.startsWith($n) ? e4.slice(5) : e4).split(".");
|
|
1029
1029
|
return t4.some((e5) => "" === e5) ? [] : t4;
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1031
|
+
function In(e4) {
|
|
1032
1032
|
if (void 0 === e4 || "*" === e4) return () => true;
|
|
1033
1033
|
if ("and" in e4) {
|
|
1034
|
-
const t4 = e4.and.map(
|
|
1034
|
+
const t4 = e4.and.map(In);
|
|
1035
1035
|
return (e5) => t4.every((t5) => t5(e5));
|
|
1036
1036
|
}
|
|
1037
1037
|
if ("or" in e4) {
|
|
1038
|
-
const t4 = e4.or.map(
|
|
1038
|
+
const t4 = e4.or.map(In);
|
|
1039
1039
|
return (e5) => t4.some((t5) => t5(e5));
|
|
1040
1040
|
}
|
|
1041
1041
|
return (function(e5) {
|
|
@@ -1071,70 +1071,70 @@ function Sn(e4) {
|
|
|
1071
1071
|
};
|
|
1072
1072
|
})(e4);
|
|
1073
1073
|
}
|
|
1074
|
-
function In(e4) {
|
|
1075
|
-
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4) && ("match" in e4 || "next" in e4 || "one" in e4 || "many" in e4);
|
|
1076
|
-
}
|
|
1077
1074
|
function On(e4) {
|
|
1078
|
-
return Array.isArray(e4) && e4
|
|
1075
|
+
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4) && ("match" in e4 || "next" in e4 || "one" in e4 || "many" in e4);
|
|
1079
1076
|
}
|
|
1080
1077
|
function En(e4) {
|
|
1078
|
+
return Array.isArray(e4) && e4.length > 0 && e4.every((e5) => On(e5));
|
|
1079
|
+
}
|
|
1080
|
+
function _n(e4) {
|
|
1081
1081
|
return e4.map((e5) => {
|
|
1082
1082
|
if ("string" == typeof e5) return { match: () => true, next: { type: "static", value: e5 } };
|
|
1083
|
-
if (Array.isArray(e5)) return { match: () => true, next:
|
|
1083
|
+
if (Array.isArray(e5)) return { match: () => true, next: Nn(e5) ?? { type: "chain", value: [] } };
|
|
1084
1084
|
const t4 = e5;
|
|
1085
|
-
return { match: t4.match ?
|
|
1085
|
+
return { match: t4.match ? In(t4.match) : () => true, next: Nn(t4) ?? { type: "chain", value: [] } };
|
|
1086
1086
|
});
|
|
1087
1087
|
}
|
|
1088
|
-
function
|
|
1088
|
+
function Nn(e4) {
|
|
1089
1089
|
if (null == e4) return;
|
|
1090
1090
|
if ("string" == typeof e4) return { type: "static", value: e4 };
|
|
1091
1091
|
if (Array.isArray(e4)) {
|
|
1092
1092
|
if (0 === e4.length) return;
|
|
1093
|
-
if (
|
|
1093
|
+
if (En(e4)) return Nn({ one: e4 });
|
|
1094
1094
|
if (e4.every((e5) => "string" == typeof e5)) return { type: "chain", value: e4 };
|
|
1095
1095
|
const t5 = [];
|
|
1096
1096
|
for (const n5 of e4) {
|
|
1097
|
-
const e5 =
|
|
1097
|
+
const e5 = Nn(n5);
|
|
1098
1098
|
void 0 !== e5 && t5.push(e5);
|
|
1099
1099
|
}
|
|
1100
1100
|
if (0 === t5.length) return;
|
|
1101
1101
|
return { type: "sequence", value: t5 };
|
|
1102
1102
|
}
|
|
1103
1103
|
const t4 = e4;
|
|
1104
|
-
if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match:
|
|
1104
|
+
if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match: In(t4.match), next: Nn(t4.next) } : Nn(t4.next);
|
|
1105
1105
|
if ("one" in t4 && t4.one) {
|
|
1106
|
-
const e5 =
|
|
1107
|
-
return t4.match ? { type: "gate", match:
|
|
1106
|
+
const e5 = _n(t4.one);
|
|
1107
|
+
return t4.match ? { type: "gate", match: In(t4.match), next: { type: "one", routes: e5 } } : { type: "one", routes: e5 };
|
|
1108
1108
|
}
|
|
1109
1109
|
if ("many" in t4 && t4.many) {
|
|
1110
|
-
const e5 =
|
|
1111
|
-
return t4.match ? { type: "gate", match:
|
|
1110
|
+
const e5 = _n(t4.many);
|
|
1111
|
+
return t4.match ? { type: "gate", match: In(t4.match), next: { type: "many", routes: e5 } } : { type: "many", routes: e5 };
|
|
1112
1112
|
}
|
|
1113
|
-
return t4.match ? { type: "gate", match:
|
|
1113
|
+
return t4.match ? { type: "gate", match: In(t4.match) } : void 0;
|
|
1114
1114
|
}
|
|
1115
|
-
function
|
|
1115
|
+
function Tn(e4, t4 = {}) {
|
|
1116
1116
|
if (null == e4) return [];
|
|
1117
1117
|
let n5;
|
|
1118
1118
|
if ("object" == typeof e4) {
|
|
1119
|
-
const t5 =
|
|
1120
|
-
t5 ? n5 = t5 : (n5 =
|
|
1121
|
-
} else n5 =
|
|
1119
|
+
const t5 = Mn.get(e4);
|
|
1120
|
+
t5 ? n5 = t5 : (n5 = Nn(e4), n5 && Mn.set(e4, n5));
|
|
1121
|
+
} else n5 = Nn(e4);
|
|
1122
1122
|
if (!n5) return [];
|
|
1123
|
-
const r6 =
|
|
1123
|
+
const r6 = Cn(n5, t4);
|
|
1124
1124
|
return void 0 === r6 ? [] : Array.isArray(r6) ? r6 : [r6];
|
|
1125
1125
|
}
|
|
1126
|
-
function
|
|
1126
|
+
function Cn(e4, t4 = {}) {
|
|
1127
1127
|
if (e4) {
|
|
1128
1128
|
if ("static" === e4.type) return e4.value;
|
|
1129
1129
|
if ("chain" === e4.type) return e4.value;
|
|
1130
1130
|
if ("gate" === e4.type) {
|
|
1131
1131
|
if (!e4.match(t4)) return;
|
|
1132
|
-
return
|
|
1132
|
+
return Cn(e4.next, t4);
|
|
1133
1133
|
}
|
|
1134
1134
|
if ("sequence" === e4.type) {
|
|
1135
1135
|
const n5 = [];
|
|
1136
1136
|
for (const r6 of e4.value) {
|
|
1137
|
-
const e5 =
|
|
1137
|
+
const e5 = Cn(r6, t4);
|
|
1138
1138
|
void 0 !== e5 && (Array.isArray(e5) ? n5.push(...e5) : n5.push(e5));
|
|
1139
1139
|
}
|
|
1140
1140
|
return n5.length > 0 ? n5 : void 0;
|
|
@@ -1143,61 +1143,61 @@ function Tn(e4, t4 = {}) {
|
|
|
1143
1143
|
const n5 = [];
|
|
1144
1144
|
for (const r6 of e4.routes) {
|
|
1145
1145
|
if (!r6.match(t4)) continue;
|
|
1146
|
-
const e5 =
|
|
1146
|
+
const e5 = Cn(r6.next, t4);
|
|
1147
1147
|
void 0 !== e5 && (Array.isArray(e5) ? n5.push(...e5) : n5.push(e5));
|
|
1148
1148
|
}
|
|
1149
1149
|
return n5.length > 0 ? n5 : void 0;
|
|
1150
1150
|
}
|
|
1151
|
-
for (const n5 of e4.routes) if (n5.match(t4)) return
|
|
1151
|
+
for (const n5 of e4.routes) if (n5.match(t4)) return Cn(n5.next, t4);
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
|
-
function
|
|
1155
|
-
const r6 = { [
|
|
1156
|
-
return void 0 !== t4 && (r6[
|
|
1154
|
+
function Rn(e4, t4, n5 = Date.now) {
|
|
1155
|
+
const r6 = { [Pn]: e4 };
|
|
1156
|
+
return void 0 !== t4 && (r6[zn] = n5() + t4), r6;
|
|
1157
1157
|
}
|
|
1158
|
-
function
|
|
1158
|
+
function Fn(e4, t4 = Date.now) {
|
|
1159
1159
|
if (void 0 === e4) return;
|
|
1160
|
-
if (null === (n5 = e4) || "object" != typeof n5 || Array.isArray(n5) || !(
|
|
1160
|
+
if (null === (n5 = e4) || "object" != typeof n5 || Array.isArray(n5) || !(Pn in e4)) return { value: e4 };
|
|
1161
1161
|
var n5;
|
|
1162
|
-
const r6 = e4[
|
|
1163
|
-
return "number" == typeof r6 && t4() > r6 ? { expired: true } : { value: e4[
|
|
1162
|
+
const r6 = e4[zn];
|
|
1163
|
+
return "number" == typeof r6 && t4() > r6 ? { expired: true } : { value: e4[Pn] };
|
|
1164
1164
|
}
|
|
1165
|
-
function
|
|
1165
|
+
function qn(e4) {
|
|
1166
1166
|
return null !== e4 && "object" == typeof e4 && !Array.isArray(e4);
|
|
1167
1167
|
}
|
|
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 ||
|
|
1168
|
+
function Ln(e4) {
|
|
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 || Ln(e5)) : !!qn(e4) && Object.values(e4).every((e5) => void 0 === e5 || Ln(e5)));
|
|
1170
1170
|
}
|
|
1171
|
-
function
|
|
1171
|
+
function Hn(e4, t4) {
|
|
1172
1172
|
const n5 = { ingest: e4 ?? {} };
|
|
1173
1173
|
return void 0 !== t4 && (n5.event = t4), n5;
|
|
1174
1174
|
}
|
|
1175
|
-
function
|
|
1176
|
-
return { stop: e4.stop ?? false, storeId: e4.store, namespace: e4.namespace, rules: e4.rules.map((e5) => ({ match: e5.match ?
|
|
1175
|
+
function Jn(e4) {
|
|
1176
|
+
return { stop: e4.stop ?? false, storeId: e4.store, namespace: e4.namespace, rules: e4.rules.map((e5) => ({ match: e5.match ? In(e5.match) : () => true, key: e5.key, ttl: e5.ttl, update: e5.update })) };
|
|
1177
1177
|
}
|
|
1178
|
-
async function
|
|
1178
|
+
async function Gn(e4, t4, n5, r6) {
|
|
1179
1179
|
const o4 = e4.rules.find((e5) => e5.match(n5));
|
|
1180
1180
|
if (!o4) return null;
|
|
1181
1181
|
const s4 = o4.key.map((e5) => String(ve(n5, e5) ?? ""));
|
|
1182
1182
|
if (s4.every((e5) => "" === e5)) return null;
|
|
1183
|
-
const i5 = s4.join(":"), a4 = r6 ?? e4.namespace, c2 = a4 ? `${a4}:${i5}` : i5,
|
|
1184
|
-
if (void 0 ===
|
|
1185
|
-
if ("expired" in
|
|
1183
|
+
const i5 = s4.join(":"), a4 = r6 ?? e4.namespace, c2 = a4 ? `${a4}:${i5}` : i5, u2 = Fn(await t4.get(c2));
|
|
1184
|
+
if (void 0 === u2) return { status: "MISS", key: c2, rule: o4 };
|
|
1185
|
+
if ("expired" in u2) {
|
|
1186
1186
|
try {
|
|
1187
1187
|
await t4.delete(c2);
|
|
1188
1188
|
} catch {
|
|
1189
1189
|
}
|
|
1190
1190
|
return { status: "MISS", key: c2, rule: o4 };
|
|
1191
1191
|
}
|
|
1192
|
-
return { status: "HIT", key: c2, value:
|
|
1192
|
+
return { status: "HIT", key: c2, value: u2.value, rule: o4 };
|
|
1193
1193
|
}
|
|
1194
|
-
function
|
|
1195
|
-
if (!
|
|
1196
|
-
const o4 = 1e3 * r6, s4 = e4.set(t4,
|
|
1194
|
+
function Xn(e4, t4, n5, r6) {
|
|
1195
|
+
if (!Ln(n5)) return;
|
|
1196
|
+
const o4 = 1e3 * r6, s4 = e4.set(t4, Rn(n5, o4), o4);
|
|
1197
1197
|
s4 instanceof Promise && s4.catch(() => {
|
|
1198
1198
|
});
|
|
1199
1199
|
}
|
|
1200
|
-
async function
|
|
1200
|
+
async function Yn(e4, t4, n5, r6) {
|
|
1201
1201
|
if (!t4) return e4;
|
|
1202
1202
|
let o4 = e4;
|
|
1203
1203
|
for (const [e5, s4] of Object.entries(t4)) {
|
|
@@ -1205,10 +1205,10 @@ async function Xn(e4, t4, n5, r6) {
|
|
|
1205
1205
|
}
|
|
1206
1206
|
return o4;
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1208
|
+
function Qn(e4) {
|
|
1209
1209
|
return ie(e4) ? e4 : [e4];
|
|
1210
1210
|
}
|
|
1211
|
-
async function
|
|
1211
|
+
async function er(e4, t4, n5, r6) {
|
|
1212
1212
|
let o4 = n5;
|
|
1213
1213
|
for (const n6 of e4) await Xe(async () => {
|
|
1214
1214
|
const e5 = t4(n6.store);
|
|
@@ -1218,13 +1218,13 @@ async function Qn(e4, t4, n5, r6) {
|
|
|
1218
1218
|
const i5 = n6.store ? s4 : `state:${s4}`;
|
|
1219
1219
|
if ("set" === n6.mode) {
|
|
1220
1220
|
const t5 = await et(o4, n6.value, { collector: r6, event: o4 });
|
|
1221
|
-
if (!
|
|
1221
|
+
if (!ue(t5)) return;
|
|
1222
1222
|
await e5.set(i5, t5);
|
|
1223
1223
|
} else {
|
|
1224
1224
|
const t5 = ge(a4 = n6.value) ? a4 : de(a4) && ge(a4.key) ? a4.key : void 0;
|
|
1225
1225
|
if (!t5) return;
|
|
1226
1226
|
const r7 = await e5.get(i5);
|
|
1227
|
-
if (!
|
|
1227
|
+
if (!ue(r7)) return;
|
|
1228
1228
|
o4 = ye(o4, t5, r7);
|
|
1229
1229
|
}
|
|
1230
1230
|
var a4;
|
|
@@ -1234,18 +1234,18 @@ async function Qn(e4, t4, n5, r6) {
|
|
|
1234
1234
|
})();
|
|
1235
1235
|
return o4;
|
|
1236
1236
|
}
|
|
1237
|
-
function
|
|
1237
|
+
function sr(e4, t4) {
|
|
1238
1238
|
const n5 = (function(e5) {
|
|
1239
|
-
return /* @__PURE__ */ new Set([...
|
|
1239
|
+
return /* @__PURE__ */ new Set([...tr[e5], ...nr, ...rr[e5]]);
|
|
1240
1240
|
})(t4);
|
|
1241
1241
|
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
1242
|
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 &&
|
|
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 && or.test(e4.import) ? { ok: true } : { ok: false, code: "INVALID_IMPORT", key: "import", reason: `import must match ${or.source}. Got: ${JSON.stringify(e4.import)}.` };
|
|
1244
1244
|
}
|
|
1245
|
-
function
|
|
1245
|
+
function ir(e4, t4) {
|
|
1246
1246
|
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
1247
|
}
|
|
1248
|
-
var e, t, r, i,
|
|
1248
|
+
var e, t, r, i, f, l, m, v, b, T, F, U, D, q, Z, K, J, G, re, we, Ee, Pe, Ke, Ye, wt, xt, Ot, en, wn, $n, Mn, Pn, zn, tr, nr, rr, or;
|
|
1249
1249
|
var init_dist = __esm({
|
|
1250
1250
|
"../core/dist/index.mjs"() {
|
|
1251
1251
|
"use strict";
|
|
@@ -1257,8 +1257,8 @@ var init_dist = __esm({
|
|
|
1257
1257
|
t(r, { stepId: () => o });
|
|
1258
1258
|
i = {};
|
|
1259
1259
|
t(i, { getDestination: () => a });
|
|
1260
|
-
|
|
1261
|
-
t(
|
|
1260
|
+
f = {};
|
|
1261
|
+
t(f, { Level: () => l });
|
|
1262
1262
|
l = ((e4) => (e4[e4.ERROR = 0] = "ERROR", e4[e4.WARN = 1] = "WARN", e4[e4.INFO = 2] = "INFO", e4[e4.DEBUG = 3] = "DEBUG", e4))(l || {});
|
|
1263
1263
|
m = {};
|
|
1264
1264
|
t(m, { getTransformer: () => g });
|
|
@@ -1289,18 +1289,18 @@ var init_dist = __esm({
|
|
|
1289
1289
|
}
|
|
1290
1290
|
};
|
|
1291
1291
|
wt = /^[A-Za-z0-9_-]+$/;
|
|
1292
|
-
|
|
1292
|
+
xt = 9e5;
|
|
1293
1293
|
Ot = 39e5;
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1294
|
+
en = null;
|
|
1295
|
+
wn = "observe";
|
|
1296
|
+
$n = "call:";
|
|
1297
|
+
Mn = /* @__PURE__ */ new WeakMap();
|
|
1298
|
+
Pn = "__walkeros_cache_v__";
|
|
1299
|
+
zn = "__walkeros_cache_exp__";
|
|
1300
|
+
tr = { 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"] };
|
|
1301
|
+
nr = ["config", "env", "variables", "examples", "disabled", "id", "logger", "mock", "chainMocks"];
|
|
1302
|
+
rr = { Source: ["primary"], Transformer: [], Destination: [], Store: [] };
|
|
1303
|
+
or = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
1304
1304
|
}
|
|
1305
1305
|
});
|
|
1306
1306
|
|
|
@@ -1309,9 +1309,9 @@ import * as r3 from "http";
|
|
|
1309
1309
|
import * as s from "https";
|
|
1310
1310
|
import { createHash as n2 } from "crypto";
|
|
1311
1311
|
function a2(a4, n5, i5 = {}) {
|
|
1312
|
-
const
|
|
1312
|
+
const u2 = pt(i5.headers), c2 = lt(n5), m3 = i5.method || "POST", d2 = i5.timeout || 5e3;
|
|
1313
1313
|
return new Promise((t4) => {
|
|
1314
|
-
const e4 = new URL(a4), n6 = "https:" === e4.protocol ? s : r3, i6 = { method: m3, headers:
|
|
1314
|
+
const e4 = new URL(a4), n6 = "https:" === e4.protocol ? s : r3, i6 = { method: m3, headers: u2 }, p3 = n6.request(e4, i6, (e5) => {
|
|
1315
1315
|
const r6 = [];
|
|
1316
1316
|
e5.on("data", (t5) => {
|
|
1317
1317
|
r6.push(t5);
|
|
@@ -2170,7 +2170,7 @@ function fn2(e4, t4) {
|
|
|
2170
2170
|
if (e5 instanceof SyntaxError) {
|
|
2171
2171
|
const i7 = e5.message.match(/position\s+(\d+)/);
|
|
2172
2172
|
if (i7) {
|
|
2173
|
-
return
|
|
2173
|
+
return Dn(t6, parseInt(i7[1], 10));
|
|
2174
2174
|
}
|
|
2175
2175
|
const n7 = e5.message.match(/line\s+(\d+)\s+column\s+(\d+)/);
|
|
2176
2176
|
if (n7) return { line: parseInt(n7[1], 10), column: parseInt(n7[2], 10) };
|
|
@@ -2244,8 +2244,8 @@ function fn2(e4, t4) {
|
|
|
2244
2244
|
})(e5, i6, o5), (function(e6, t6, i7) {
|
|
2245
2245
|
const n7 = t6.stepNames?.stores ?? [];
|
|
2246
2246
|
let o6;
|
|
2247
|
-
|
|
2248
|
-
for (; null !== (o6 =
|
|
2247
|
+
gn2.lastIndex = 0;
|
|
2248
|
+
for (; null !== (o6 = gn2.exec(e6)); ) if (!n7.includes(o6[1])) {
|
|
2249
2249
|
const t7 = En2(e6, o6.index, o6[0].length);
|
|
2250
2250
|
i7.push({ message: `Unknown store "$store.${o6[1]}". Defined: ${n7.join(", ") || "none"}`, severity: "warning", path: `$store.${o6[1]}`, ...t7 });
|
|
2251
2251
|
}
|
|
@@ -2275,7 +2275,7 @@ function fn2(e4, t4) {
|
|
|
2275
2275
|
if (!In2(i8)) continue;
|
|
2276
2276
|
const t7 = i8.config, a5 = !In2(t7) || "web" !== t7.platform && "server" !== t7.platform ? void 0 : t7.platform, s4 = JSON.stringify(i8);
|
|
2277
2277
|
let c2;
|
|
2278
|
-
for (
|
|
2278
|
+
for (Sn.lastIndex = 0; null !== (c2 = Sn.exec(s4)); ) {
|
|
2279
2279
|
const t8 = c2[0], i9 = c2[1], s5 = e6.indexOf(t8), l3 = -1 === s5 ? { line: 1, column: 1 } : En2(e6, s5, t8.length);
|
|
2280
2280
|
"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
2281
|
}
|
|
@@ -2299,11 +2299,11 @@ function xn(e4, t4, i5) {
|
|
|
2299
2299
|
function jn(e4, t4, i5, n5) {
|
|
2300
2300
|
for (const o4 of Object.values(t4)) {
|
|
2301
2301
|
if (!In2(o4)) continue;
|
|
2302
|
-
if (o4.package !==
|
|
2302
|
+
if (o4.package !== wn2) continue;
|
|
2303
2303
|
if (!In2(o4.env)) continue;
|
|
2304
2304
|
const t5 = o4.env.store;
|
|
2305
2305
|
if ("string" != typeof t5) continue;
|
|
2306
|
-
const r6 =
|
|
2306
|
+
const r6 = kn.exec(t5);
|
|
2307
2307
|
if (!r6) continue;
|
|
2308
2308
|
const a4 = r6[1], s4 = i5[a4];
|
|
2309
2309
|
if (!In2(s4)) continue;
|
|
@@ -2313,15 +2313,15 @@ function jn(e4, t4, i5, n5) {
|
|
|
2313
2313
|
}
|
|
2314
2314
|
function Pn2(e4, t4) {
|
|
2315
2315
|
const i5 = e4.indexOf(`"${t4}"`);
|
|
2316
|
-
return -1 === i5 ? { line: 1, column: 1 } :
|
|
2316
|
+
return -1 === i5 ? { line: 1, column: 1 } : Dn(e4, i5);
|
|
2317
2317
|
}
|
|
2318
|
-
function
|
|
2318
|
+
function Dn(e4, t4) {
|
|
2319
2319
|
let i5 = 1, n5 = 1;
|
|
2320
2320
|
for (let o4 = 0; o4 < t4 && o4 < e4.length; o4++) "\n" === e4[o4] ? (i5++, n5 = 1) : n5++;
|
|
2321
2321
|
return { line: i5, column: n5 };
|
|
2322
2322
|
}
|
|
2323
2323
|
function En2(e4, t4, i5) {
|
|
2324
|
-
const n5 =
|
|
2324
|
+
const n5 = Dn(e4, t4), o4 = Dn(e4, t4 + i5);
|
|
2325
2325
|
return { line: n5.line, column: n5.column, endLine: o4.line, endColumn: o4.column };
|
|
2326
2326
|
}
|
|
2327
2327
|
function On2(e4, t4) {
|
|
@@ -2329,7 +2329,7 @@ function On2(e4, t4) {
|
|
|
2329
2329
|
const i5 = t4[t4.length - 1];
|
|
2330
2330
|
if ("string" == typeof i5) {
|
|
2331
2331
|
const t5 = `"${i5}"`, n5 = e4.lastIndexOf(t5);
|
|
2332
|
-
if (-1 !== n5) return
|
|
2332
|
+
if (-1 !== n5) return Dn(e4, n5);
|
|
2333
2333
|
}
|
|
2334
2334
|
return { line: 1, column: 1 };
|
|
2335
2335
|
}
|
|
@@ -2376,7 +2376,7 @@ function Tn2(e4) {
|
|
|
2376
2376
|
}
|
|
2377
2377
|
return "array" === e4.type && e4.items && (t4.items = Tn2(e4.items)), t4;
|
|
2378
2378
|
}
|
|
2379
|
-
function
|
|
2379
|
+
function Fn2(e4, t4) {
|
|
2380
2380
|
const i5 = { type: "array", items: Tn2(e4) };
|
|
2381
2381
|
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
2382
|
}
|
|
@@ -2384,24 +2384,24 @@ function $n2(e4, t4 = "string", i5) {
|
|
|
2384
2384
|
const n5 = { type: t4, enum: [...e4] };
|
|
2385
2385
|
return i5?.description && (n5.description = i5.description), i5?.title && (n5.title = i5.title), n5;
|
|
2386
2386
|
}
|
|
2387
|
-
function
|
|
2388
|
-
return
|
|
2387
|
+
function An2(e4, t4, i5) {
|
|
2388
|
+
return Fn2({ type: "object" }, { minItems: 2, maxItems: 2, description: i5 || "Tuple with exactly 2 elements [source, transform]" });
|
|
2389
2389
|
}
|
|
2390
2390
|
function zn2(e4) {
|
|
2391
2391
|
const t4 = n3.toJSONSchema(e4, { target: "draft-7" });
|
|
2392
|
-
return
|
|
2392
|
+
return Ln2(t4), t4;
|
|
2393
2393
|
}
|
|
2394
|
-
function
|
|
2394
|
+
function Ln2(e4) {
|
|
2395
2395
|
const t4 = e4.properties;
|
|
2396
2396
|
if (t4 && "object" == typeof t4) {
|
|
2397
2397
|
Array.isArray(e4.required) && (e4.required = e4.required.filter((e5) => {
|
|
2398
2398
|
const i5 = t4[e5];
|
|
2399
2399
|
return !(i5 && "object" == typeof i5 && "default" in i5);
|
|
2400
2400
|
}));
|
|
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),
|
|
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), Ln2(i5));
|
|
2402
2402
|
}
|
|
2403
2403
|
}
|
|
2404
|
-
var e3, t3, i3, r4, a3, s2, c, l2, d, p,
|
|
2404
|
+
var e3, t3, i3, r4, a3, s2, c, l2, d, p, u, m2, f2, g2, h, b2, v2, S, y2, w2, k2, C2, x, j, P3, D3, E2, O, I, J3, $, A2, z3, L2, q2, N, W2, B, U2, _2, H2, V2, Z2, G3, K3, Q3, X3, Y3, ee3, te3, ie2, ne3, oe3, re2, ae2, se, ce, le2, de2, pe2, ue2, me2, fe, ge2, he2, be2, ve2, Se, ye2, we2, ke2, Ce2, xe, je2, Pe3, De2, Ee2, Oe2, Ie2, Je3, Re2, Me2, Te2, Fe2, $e2, Ae, ze3, Le3, qe, Ne3, We3, Be3, Ue3, _e3, He2, Ve3, Ze3, Ge3, Ke3, Qe3, Xe3, Ye3, et3, tt3, it2, nt3, ot2, rt2, at2, st2, ct2, lt3, dt2, pt3, ut2, mt2, ft2, gt3, ht3, bt3, vt3, St3, yt2, wt3, kt3, Ct2, xt3, jt3, Pt, Dt2, Et3, Ot3, It2, Jt, Rt2, Mt, Tt, Ft2, $t2, At3, zt, Lt, qt2, Nt, Wt2, Bt2, Ut2, _t, Ht2, Vt2, Zt, Gt2, Kt2, Qt, Xt, Yt, ei, ti, ii, ni, oi, ri, ai, si, ci, li, di, pi, ui, mi, fi, gi, hi, bi, vi, Si, yi, wi, ki, Ci, xi, ji, Di, Ei, Oi, Ii, Ji, Ri, Mi, Ti, Fi, $i, Ai, zi, Bi, Ui, _i, Hi, Vi, Zi, Gi, Ki, Qi, Xi, en3, tn2, nn2, on2, rn2, an2, sn, ln, gn2, hn3, bn2, vn2, Sn, yn2, wn2, kn, Nn2;
|
|
2405
2405
|
var init_dev = __esm({
|
|
2406
2406
|
"../core/dist/dev.mjs"() {
|
|
2407
2407
|
"use strict";
|
|
@@ -2410,7 +2410,7 @@ var init_dev = __esm({
|
|
|
2410
2410
|
for (var n5 in i5) e3(t4, n5, { get: i5[n5], enumerable: true });
|
|
2411
2411
|
};
|
|
2412
2412
|
i3 = {};
|
|
2413
|
-
t3(i3, { BaseContextConfig: () => A2, CacheRuleSchema: () => Ye3, CacheSchema: () => et3, CacheSchemas: () => Ze3, ClickIdEntrySchema: () =>
|
|
2413
|
+
t3(i3, { BaseContextConfig: () => A2, CacheRuleSchema: () => Ye3, CacheSchema: () => et3, CacheSchemas: () => Ze3, ClickIdEntrySchema: () => on2, CodeSchema: () => en3, CollectorSchemas: () => Ot3, ConsentSchema: () => Z2, ContractActionsSchema: () => Ri, ContractRuleSchema: () => Ti, ContractSchema: () => Fi, ContractSchemaEntry: () => Ji, Counter: () => d, CredentialsSchema: () => an2, DeepPartialEventSchema: () => ie2, DestinationSchemas: () => Me2, DestinationsMapConfig: () => q2, EntitiesSchema: () => Y3, EntitySchema: () => X3, EventCacheRuleSchema: () => Ge3, EventCacheSchema: () => Ke3, EventSchema: () => ee3, FlowBundlePackageSchema: () => vi, FlowBundleSchema: () => Si, FlowCodeSchema: () => yi, FlowConfigSchema: () => $i, FlowDestinationSchema: () => Oi, FlowJsonSchema: () => zi, FlowSchema: () => Ai, FlowSchemas: () => fi, FlowSourceSchema: () => Di, FlowStoreSchema: () => Ii, FlowTransformerSchema: () => Ei, GenericEnvConfig: () => J3, GenericSettingsConfig: () => I, HandlersConfig: () => x, HintSchema: () => tn2, HintsSchema: () => nn2, IdConfig: () => D3, Identifier: () => c, InitConfig: () => E2, LoggerConfigSchema: () => nt3, LoggerHandlerSchema: () => it2, LoopSchema: () => fe, MapSchema: () => he2, MappingResultSchema: () => Ce2, MappingSchemas: () => pe2, MatchExpressionSchema: () => Ae, MatcherSchemas: () => Te2, OptionalPrimitiveValue: () => u, OrderedPropertiesSchema: () => H2, PartialEventSchema: () => te3, PolicySchema: () => ve2, PrimaryConfig: () => O, PrimitiveValue: () => p, ProcessingControlConfig: () => z3, PropertiesSchema: () => _2, PropertySchema: () => U2, PropertyTypeSchema: () => B, QueueConfig: () => P3, RequiredBoolean: () => s2, RequiredNumber: () => a3, RequiredString: () => r4, RouteSchema: () => Be3, RouteWithoutManySchema: () => Ve3, RuleSchema: () => ye2, RulesSchema: () => we2, RuntimeInstanceConfig: () => $, ServiceAccountSchema: () => rn2, SetSchema: () => ge2, SourceSchema: () => Q3, SourceSchemas: () => Ut2, SourceTypeSchema: () => V2, SourcesMapConfig: () => L2, StateSchema: () => tt3, StoreCacheRuleSchema: () => Qe3, StoreCacheSchema: () => Xe3, StoreSchemas: () => li, Timestamp: () => l2, TransformerSchemas: () => oi, UserSchema: () => G3, UtilitySchemas: () => m2, ValidateEventsSchema: () => ji, ValueConfigSchema: () => be2, ValueSchema: () => ue2, ValuesSchema: () => me2, VerboseConfig: () => j, WalkerOSSchemas: () => N, configJsonSchema: () => Bi, consentJsonSchema: () => de2, contractJsonSchema: () => Qi, contractRuleJsonSchema: () => Ki, createArraySchema: () => Fn2, createConsentConfig: () => F2, createDataTransformationConfig: () => R2, createEnumSchema: () => $n2, createMappingRulesConfig: () => M3, createObjectSchema: () => Mn2, createPolicyConfig: () => T3, createTupleSchema: () => An2, credentialsJsonSchema: () => sn, destinationJsonSchema: () => Vi, entityJsonSchema: () => ce, eventJsonSchema: () => ne3, flowConfigJsonSchema: () => _i, flowJsonSchema: () => Ui, loopJsonSchema: () => Pe3, mapJsonSchema: () => Ee2, orderedPropertiesJsonSchema: () => se, parseConfig: () => Li, parseFlow: () => Ni, partialEventJsonSchema: () => oe3, policyJsonSchema: () => Oe2, propertiesJsonSchema: () => ae2, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Je3, safeParseConfig: () => qi, safeParseFlow: () => Wi, setJsonSchema: () => De2, sourceJsonSchema: () => Hi, sourceTypeJsonSchema: () => le2, storeJsonSchema: () => Gi, transformerJsonSchema: () => Zi, userJsonSchema: () => re2, validateEventsJsonSchema: () => Xi, validateFlowConfig: () => fn2, valueConfigJsonSchema: () => je2, valueJsonSchema: () => xe, z: () => n3, zodToSchema: () => zn2 });
|
|
2414
2414
|
r4 = n3.string();
|
|
2415
2415
|
a3 = n3.number();
|
|
2416
2416
|
s2 = n3.boolean();
|
|
@@ -2418,15 +2418,15 @@ var init_dev = __esm({
|
|
|
2418
2418
|
l2 = n3.number().int().positive();
|
|
2419
2419
|
d = n3.number().int().nonnegative();
|
|
2420
2420
|
p = n3.union([n3.string(), n3.number(), n3.boolean()]);
|
|
2421
|
-
|
|
2421
|
+
u = p.optional();
|
|
2422
2422
|
m2 = {};
|
|
2423
|
-
t3(m2, { ErrorHandlerSchema: () => h, HandlerSchema: () => v2, LogHandlerSchema: () => b2, StorageSchema: () => g2, StorageTypeSchema: () =>
|
|
2424
|
-
|
|
2423
|
+
t3(m2, { ErrorHandlerSchema: () => h, HandlerSchema: () => v2, LogHandlerSchema: () => b2, StorageSchema: () => g2, StorageTypeSchema: () => f2, errorHandlerJsonSchema: () => w2, handlerJsonSchema: () => C2, logHandlerJsonSchema: () => k2, storageJsonSchema: () => y2, storageTypeJsonSchema: () => S });
|
|
2424
|
+
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
2425
|
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
2426
|
h = n3.unknown().meta({ id: "ErrorHandler", title: "Error.Handler", description: "Error handler function: (error, state?) => void." }).describe("Error handler function: (error, state?) => void");
|
|
2427
2427
|
b2 = n3.unknown().meta({ id: "LogHandler", title: "Log.Handler", description: "Log handler function: (message, verbose?) => void." }).describe("Log handler function: (message, verbose?) => void");
|
|
2428
2428
|
v2 = n3.object({ Error: h.describe("Error handler function"), Log: b2.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
|
-
S = o2(
|
|
2429
|
+
S = o2(f2);
|
|
2430
2430
|
y2 = o2(g2);
|
|
2431
2431
|
w2 = o2(h);
|
|
2432
2432
|
k2 = o2(b2);
|
|
@@ -2469,22 +2469,22 @@ var init_dev = __esm({
|
|
|
2469
2469
|
le2 = o2(V2);
|
|
2470
2470
|
de2 = o2(Z2);
|
|
2471
2471
|
pe2 = {};
|
|
2472
|
-
t3(pe2, { ConfigSchema: () => ke2, LoopSchema: () =>
|
|
2473
|
-
|
|
2474
|
-
me2 = n3.array(
|
|
2475
|
-
|
|
2476
|
-
ge2 = n3.lazy(() => n3.array(
|
|
2477
|
-
he2 = n3.lazy(() => n3.record(n3.string(),
|
|
2478
|
-
be2 = W2 = n3.object({ key: n3.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'), value: n3.union([n3.string(), n3.number(), n3.boolean()]).optional().describe("Static primitive value"), fn: n3.string().optional().describe("Custom transformation function as string (serialized)"), map: he2.optional().describe("Object mapping: transform event data to structured output"), loop:
|
|
2479
|
-
ve2 = n3.record(n3.string(),
|
|
2480
|
-
Se = n3.object({ name: n3.string().nullable().optional(), data: n3.union([
|
|
2481
|
-
ye2 = n3.object({ name: n3.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), data: n3.union([
|
|
2472
|
+
t3(pe2, { ConfigSchema: () => ke2, LoopSchema: () => fe, MapSchema: () => he2, PolicySchema: () => ve2, ResultSchema: () => Ce2, RulePatchSchema: () => Se, RuleSchema: () => ye2, RulesSchema: () => we2, SetSchema: () => ge2, ValueConfigSchema: () => be2, ValueSchema: () => ue2, ValuesSchema: () => me2, configJsonSchema: () => Re2, loopJsonSchema: () => Pe3, mapJsonSchema: () => Ee2, policyJsonSchema: () => Oe2, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Je3, setJsonSchema: () => De2, valueConfigJsonSchema: () => je2, valueJsonSchema: () => xe });
|
|
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(() => W2), 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
|
+
me2 = n3.array(ue2).meta({ id: "MappingValues", title: "Mapping.Values", description: "Array of transformation values." }).describe("Array of transformation values");
|
|
2475
|
+
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
|
+
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
|
+
he2 = 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." });
|
|
2478
|
+
be2 = W2 = n3.object({ key: n3.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'), value: n3.union([n3.string(), n3.number(), n3.boolean()]).optional().describe("Static primitive value"), fn: n3.string().optional().describe("Custom transformation function as string (serialized)"), map: he2.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
|
+
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
|
+
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
|
+
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");
|
|
2482
2482
|
we2 = n3.record(n3.string(), n3.record(n3.string(), n3.union([ye2, n3.array(ye2)])).optional()).meta({ id: "MappingRules", title: "Mapping.Rules", description: 'Event mapping rules tree: entity \u2192 action \u2192 Rule (or Rule[]). Use "*" as wildcard for entity or action.' }).describe('Event mapping rules: entity \u2192 action \u2192 Rule. Keys match event name split by space. Use "*" as wildcard for entity or action. Priority: exact > entity wildcard > action wildcard > global wildcard (*\u2192*).');
|
|
2483
|
-
ke2 = n3.object({ consent: Z2.optional().describe("Required consent states to process any events"), data: n3.union([
|
|
2483
|
+
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
2484
|
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
|
-
xe = o2(
|
|
2485
|
+
xe = o2(ue2);
|
|
2486
2486
|
je2 = o2(be2);
|
|
2487
|
-
Pe3 = o2(
|
|
2487
|
+
Pe3 = o2(fe);
|
|
2488
2488
|
De2 = o2(ge2);
|
|
2489
2489
|
Ee2 = o2(he2);
|
|
2490
2490
|
Oe2 = o2(ve2);
|
|
@@ -2510,13 +2510,13 @@ var init_dev = __esm({
|
|
|
2510
2510
|
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
2511
|
Ze3 = {};
|
|
2512
2512
|
t3(Ze3, { CacheRuleSchema: () => Ye3, CacheSchema: () => et3, EventCacheRuleSchema: () => Ge3, EventCacheSchema: () => Ke3, StoreCacheRuleSchema: () => Qe3, StoreCacheSchema: () => Xe3 });
|
|
2513
|
-
Ge3 = n3.object({ match: Ae.optional().describe("Optional match expression \u2014 omit for always-match."), key: n3.array(n3.string()).min(1).describe("Dot-path fields used to build the cache key"), ttl: n3.number().positive().describe("Time-to-live in seconds"), update: n3.record(n3.string(),
|
|
2513
|
+
Ge3 = n3.object({ match: Ae.optional().describe("Optional match expression \u2014 omit for always-match."), key: n3.array(n3.string()).min(1).describe("Dot-path fields used to build the cache key"), ttl: n3.number().positive().describe("Time-to-live in seconds"), update: n3.record(n3.string(), ue2).optional().describe("Response mutations applied on cache hit (key \u2192 Value mapping)") }).meta({ id: "EventCacheRule", title: "EventCache.Rule", description: "Single event-cache rule: when it applies (match), what event fields it keys off, TTL, and optional response mutations on hit." });
|
|
2514
2514
|
Ke3 = n3.object({ stop: n3.boolean().optional().describe("Stop the chain on cache HIT (default: false). When true, skip remaining steps and return cached value."), store: n3.string().optional().describe("Store ID for persistent caching (references a configured store)"), namespace: n3.string().optional().describe("Optional key prefix. Omit to write keys directly to the store. Same store + same key + same namespace = same cache entry."), rules: n3.array(Ge3).min(1).describe("Cache rules \u2014 at least one required") }).meta({ id: "EventCacheConfig", title: "EventCache.Config", description: "Top-level cache configuration for an event-context pipeline step (source / transformer / destination)." });
|
|
2515
2515
|
Qe3 = n3.strictObject({ match: Ae.optional().describe("Optional match expression evaluated against `{ key, value? }`. Omit for always-match."), ttl: n3.number().positive().describe("Time-to-live in seconds") }).meta({ id: "StoreCacheRule", title: "StoreCache.Rule", description: "Single store-cache rule: optional match against `{ key, value? }` and a TTL. No `key` (caller provides it) and no `update` (no event to mutate)." });
|
|
2516
2516
|
Xe3 = n3.strictObject({ store: n3.string().optional().describe("Store ID for persistent caching (references a configured store)"), namespace: n3.string().min(1).optional().describe("Optional key prefix. Omit to default to the host store id. Empty string is rejected."), rules: n3.array(Qe3).min(1).describe("Cache rules \u2014 at least one required") }).meta({ id: "StoreCacheConfig", title: "StoreCache.Config", description: "Top-level cache configuration for a store wrapper. No `stop` (always falls through on miss); namespace defaults to the host store id." });
|
|
2517
2517
|
Ye3 = Ge3;
|
|
2518
2518
|
et3 = Ke3;
|
|
2519
|
-
tt3 = n3.object({ mode: n3.enum(["get", "set"]).describe("Direction: 'get' reads from the store, 'set' writes to it"), store: n3.string().optional().describe("Store id; defaults to the in-memory __cache store when omitted"), key:
|
|
2519
|
+
tt3 = n3.object({ mode: n3.enum(["get", "set"]).describe("Direction: 'get' reads from the store, 'set' writes to it"), store: n3.string().optional().describe("Store id; defaults to the in-memory __cache store when omitted"), key: ue2.describe("Resolves against the event to the store key"), value: ue2.optional().describe("set: resolves to the payload to store. get: its key/bare-string path is the event write-target.") }).superRefine((e4, t4) => {
|
|
2520
2520
|
if (void 0 !== e4.value) {
|
|
2521
2521
|
if ("get" === e4.mode) {
|
|
2522
2522
|
const i5 = e4.value;
|
|
@@ -2533,7 +2533,7 @@ var init_dev = __esm({
|
|
|
2533
2533
|
}).meta({ id: "StateConfig", title: "State.Config", description: "Declarative store operation: stash (set) or fetch (get) a value against a store. key = store side, value = event side, mode = direction." });
|
|
2534
2534
|
it2 = n3.any().meta({ id: "LoggerHandler", title: "Logger.Handler", description: "Custom log handler function (level, ...args) => void" });
|
|
2535
2535
|
nt3 = n3.object({ level: n3.union([n3.number(), n3.enum(["ERROR", "WARN", "INFO", "DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"), handler: it2.optional().describe("Custom log handler function") }).meta({ id: "LoggerConfig", title: "Logger.Config", description: "Logger configuration (level, handler) to override the collector defaults" });
|
|
2536
|
-
ot2 = n3.object({ consent: Z2.optional().describe("Required consent states to send events to this destination"), settings: n3.any().meta({ id: "DestinationSettings", title: "Destination.Settings", description: "Implementation-specific configuration (destination-defined shape)." }).describe("Implementation-specific configuration").optional(), credentials: n3.any().meta({ id: "DestinationCredentials", title: "Destination.Credentials", description: "Optional credentials slot (destination-defined shape); back it with a managed secret via $secret.NAME (credentials use $secret, not $env). The per-package shape is supplied via mergeConfigSchema." }).describe("Optional credentials (destination-defined shape)").optional(), data: n3.union([
|
|
2536
|
+
ot2 = n3.object({ consent: Z2.optional().describe("Required consent states to send events to this destination"), settings: n3.any().meta({ id: "DestinationSettings", title: "Destination.Settings", description: "Implementation-specific configuration (destination-defined shape)." }).describe("Implementation-specific configuration").optional(), credentials: n3.any().meta({ id: "DestinationCredentials", title: "Destination.Credentials", description: "Optional credentials slot (destination-defined shape); back it with a managed secret via $secret.NAME (credentials use $secret, not $env). The per-package shape is supplied via mergeConfigSchema." }).describe("Optional credentials (destination-defined shape)").optional(), data: n3.union([ue2, me2]).optional().describe("Global data transformation applied to all events for this destination"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), env: n3.any().meta({ id: "DestinationEnv", title: "Destination.Env", description: "Environment dependencies (destination-defined shape) \u2014 platform, SDK, or mock hook." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Destination instance identifier (defaults to destination key)").optional(), init: n3.boolean().describe("Whether to initialize immediately").optional(), loadScript: n3.boolean().describe("Whether to load external script (for web destinations)").optional(), mapping: we2.optional().describe("Entity-action specific mapping rules for this destination"), policy: ve2.optional().describe("Pre-processing policy rules applied before event mapping"), queue: n3.boolean().describe("Whether to queue events when consent is not granted").optional(), require: n3.array(n3.string()).optional().describe('Defer destination initialization until these collector events fire (e.g., ["consent"])'), logger: nt3.optional().describe("Logger configuration (level, handler) to override the collector defaults"), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)"), before: Ve3.optional().describe("Post-collector transformer chain applied before this destination receives the event. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), next: Ve3.optional().describe("Post-push transformer chain. Runs after destination push completes; push response is available at ingest._response. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), cache: Ke3.optional().describe("Cache configuration for deduplication; skip push on cache HIT"), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this destination"), disabled: n3.boolean().describe("Completely skip this destination (no init, no push, no queue)").optional(), mock: n3.unknown().meta({ id: "DestinationMock", title: "Destination.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Dev/testing only."), queueMax: n3.number().optional().describe("Maximum consent-denied events retained in queuePush for this destination. FIFO drop on overflow. Default 1000."), dlqMax: n3.number().optional().describe("Maximum failed-push entries retained in dlq for this destination. FIFO drop on overflow. Default 100."), timeout: n3.number().optional().describe("Per-destination delivery timeout in ms (default 10000); a delivery that does not settle in this window is routed to the DLQ like a thrown push."), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).optional().describe("Enables batching for all of this destination's events into one shared default buffer; a mapping rule's own batch splits that entity-action into its own buffer and overrides per field. Bare number is the debounce wait window; object form supports wait (debounce ms), size (count cap, default 1000), age (max ms since first entry, default 30000)."), breaker: n3.union([n3.number(), n3.object({ threshold: n3.number().optional(), cooldown: n3.number().optional() })]).optional().describe("Per-destination circuit breaker (presence-gated). After threshold consecutive transport failures the breaker opens and events are skipped until cooldown ms elapse, then one probe is admitted; success closes it, failure re-opens it. Partial-batch row failures are breaker-neutral. Bare number is the threshold; object form supports threshold (default 5) and cooldown (default 30000ms).") }).meta({ id: "DestinationConfig", title: "Destination.Config", description: "Destination configuration: consent, settings, data, env, mapping rules, policy, queue, logger, before/next chains, cache." }).describe("Destination configuration");
|
|
2537
2537
|
rt2 = ot2.partial().meta({ id: "DestinationPartialConfig", title: "Destination.PartialConfig", description: "Partial destination configuration with all fields optional." }).describe("Partial destination configuration with all fields optional");
|
|
2538
2538
|
at2 = ve2.describe("Destination policy rules for event pre-processing");
|
|
2539
2539
|
st2 = n3.object({ collector: n3.unknown().meta({ id: "DestinationContextCollector", title: "Collector.Instance", description: "Collector instance handed to the destination (runtime object)." }).describe("Collector instance (runtime object)"), config: ot2.describe("Destination configuration"), data: n3.union([n3.unknown(), n3.array(n3.unknown())]).optional().describe("Transformed event data"), env: n3.unknown().meta({ id: "DestinationContextEnv", title: "Destination.Env", description: "Environment dependencies (destination-defined shape)." }).describe("Environment dependencies") }).meta({ id: "DestinationContext", title: "Destination.Context", description: "Destination context passed to init and push functions." }).describe("Destination context for init and push functions");
|
|
@@ -2575,20 +2575,20 @@ var init_dev = __esm({
|
|
|
2575
2575
|
Wt2 = o2(Tt);
|
|
2576
2576
|
Bt2 = o2(At3);
|
|
2577
2577
|
Ut2 = {};
|
|
2578
|
-
t3(Ut2, { BaseEnvSchema: () => _t, ConfigSchema: () => Ht2, InitSchema: () => Gt2, InitSourceSchema: () => Kt2, InitSourcesSchema: () =>
|
|
2578
|
+
t3(Ut2, { BaseEnvSchema: () => _t, ConfigSchema: () => Ht2, InitSchema: () => Gt2, InitSourceSchema: () => Kt2, InitSourcesSchema: () => Qt, InstanceSchema: () => Zt, PartialConfigSchema: () => Vt2, baseEnvJsonSchema: () => Xt, configJsonSchema: () => Yt, initSourceJsonSchema: () => ii, initSourcesJsonSchema: () => ni, instanceJsonSchema: () => ti, partialConfigJsonSchema: () => ei });
|
|
2579
2579
|
_t = 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");
|
|
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: _t.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([
|
|
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: _t.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
2581
|
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
2582
|
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
2583
|
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
2584
|
Kt2 = n3.object({ code: Gt2.describe("Source initialization function"), config: Vt2.optional().describe("Partial configuration overrides"), env: _t.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");
|
|
2585
|
-
|
|
2585
|
+
Qt = n3.record(n3.string(), Kt2).meta({ id: "SourceInitSources", title: "Source.InitSources", description: "Map of source IDs to initialization configurations." }).describe("Map of source IDs to initialization configurations");
|
|
2586
2586
|
Xt = o2(_t);
|
|
2587
2587
|
Yt = o2(Ht2);
|
|
2588
2588
|
ei = o2(Vt2);
|
|
2589
2589
|
ti = o2(Zt);
|
|
2590
2590
|
ii = o2(Kt2);
|
|
2591
|
-
ni = o2(
|
|
2591
|
+
ni = o2(Qt);
|
|
2592
2592
|
oi = {};
|
|
2593
2593
|
t3(oi, { ConfigSchema: () => ri, PartialConfigSchema: () => ai, configJsonSchema: () => si, partialConfigJsonSchema: () => ci });
|
|
2594
2594
|
ri = n3.object({ settings: n3.any().meta({ id: "TransformerSettings", title: "Transformer.Settings", description: "Implementation-specific configuration (transformer-defined shape)." }).describe("Implementation-specific configuration").optional(), env: n3.any().meta({ id: "TransformerEnv", title: "Transformer.Env", description: "Environment dependencies (transformer-defined shape)." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Transformer instance identifier (defaults to transformer key)").optional(), logger: nt3.optional().describe("Logger configuration (level, handler) to override the collector defaults"), before: Be3.optional().describe("Pre-transformer chain that runs before this transformer pushes"), next: Be3.optional().describe("Graph wiring to the next transformer in the chain"), cache: Ke3.optional().describe("Step-level cache configuration for this transformer"), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this transformer"), init: n3.boolean().describe("Whether to initialize immediately").optional(), disabled: n3.boolean().describe("Completely skip this transformer in chains").optional(), mock: n3.unknown().meta({ id: "TransformerMock", title: "Transformer.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Global mock for all chains. Dev/testing only."), chainMocks: n3.record(n3.string(), n3.unknown().meta({ id: "TransformerChainMock", title: "Transformer.ChainMock", description: "Chain-path-specific mock value. Dev/testing only." })).optional().describe("Path-specific mock values keyed by chain path. Takes precedence over global mock. Dev/testing only."), mapping: ke2.optional().describe("Declarative event-to-event mapping applied when this transformer step has no code. At this position, only event-mutating fields apply (policy, mapping[].policy, mapping[].name, mapping[].ignore, mapping[].consent, include); vendor-payload fields are ignored.") }).strict().meta({ id: "TransformerConfig", title: "Transformer.Config", description: "Transformer configuration (settings, env, chain wiring, cache, mocks)." }).describe("Transformer configuration");
|
|
@@ -2639,19 +2639,19 @@ var init_dev = __esm({
|
|
|
2639
2639
|
en3 = Yi.object({ lang: Yi.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"), code: Yi.string().describe("Code snippet") });
|
|
2640
2640
|
tn2 = Yi.object({ text: Yi.string().describe("Short actionable hint text focused on walkerOS usage"), code: Yi.array(en3).optional().describe("Optional code snippets") });
|
|
2641
2641
|
nn2 = Yi.record(Yi.string(), tn2).describe("Keyed hints for AI consumption \u2014 lightweight context beyond schemas and examples");
|
|
2642
|
-
|
|
2642
|
+
on2 = n3.object({ param: n3.string().describe("Lowercase URL parameter name. Match is case-insensitive on lookup."), platform: n3.string().describe("Canonical platform identifier (lowercase, kebab-case).") });
|
|
2643
2643
|
rn2 = 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");
|
|
2644
2644
|
an2 = n3.union([n3.string(), rn2]).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");
|
|
2645
2645
|
sn = o2(an2);
|
|
2646
2646
|
ln = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
|
|
2647
|
-
|
|
2647
|
+
gn2 = /\$store\.([a-zA-Z_][a-zA-Z0-9_]*)/g;
|
|
2648
2648
|
hn3 = /\$env\.([A-Za-z_]\w*)(=[^"}\s]*)?/g;
|
|
2649
2649
|
bn2 = /\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?/g;
|
|
2650
2650
|
vn2 = /\$(var|store|flow|secret):([a-zA-Z_][a-zA-Z0-9_]*)/g;
|
|
2651
|
-
|
|
2651
|
+
Sn = /\$secret\.([A-Z0-9_]+)/g;
|
|
2652
2652
|
yn2 = ["@walkeros/server-store-fs", "@walkeros/server-store-s3", "@walkeros/server-store-gcs"];
|
|
2653
|
-
|
|
2654
|
-
|
|
2653
|
+
wn2 = "@walkeros/server-transformer-file";
|
|
2654
|
+
kn = /^\$store\.([a-zA-Z_][a-zA-Z0-9_]*)$/;
|
|
2655
2655
|
Nn2 = { source: Ut2.configJsonSchema, destination: Me2.configJsonSchema, store: li.configJsonSchema };
|
|
2656
2656
|
}
|
|
2657
2657
|
});
|
|
@@ -3094,7 +3094,7 @@ function hasCodeReference(code) {
|
|
|
3094
3094
|
}
|
|
3095
3095
|
function validateReference(type, name, ref) {
|
|
3096
3096
|
if (type === "Transformer") {
|
|
3097
|
-
const r6 =
|
|
3097
|
+
const r6 = sr({ ...ref }, "Transformer");
|
|
3098
3098
|
if (!r6.ok) {
|
|
3099
3099
|
throw new Error(`Transformer "${name}": ${r6.reason ?? "invalid entry."}`);
|
|
3100
3100
|
}
|
|
@@ -3826,7 +3826,7 @@ async function traceAndCopy(opts) {
|
|
|
3826
3826
|
function assertDepsTraced(opts) {
|
|
3827
3827
|
const missing = opts.expectedPackages.filter((dep) => {
|
|
3828
3828
|
const expected = `node_modules/${dep}/package.json`;
|
|
3829
|
-
return !opts.fileList.some((
|
|
3829
|
+
return !opts.fileList.some((f3) => f3.endsWith(expected));
|
|
3830
3830
|
});
|
|
3831
3831
|
if (missing.length > 0) {
|
|
3832
3832
|
throw new Error(
|
|
@@ -4587,7 +4587,7 @@ async function runNftServerPath(outputPath, flowSettings, buildOptions, tempDir,
|
|
|
4587
4587
|
});
|
|
4588
4588
|
}
|
|
4589
4589
|
const stagedRel = path12.relative(await fs11.realpath(tempDir), stagedEntry);
|
|
4590
|
-
const trimmedFileList = result.fileList.filter((
|
|
4590
|
+
const trimmedFileList = result.fileList.filter((f3) => f3 !== stagedRel);
|
|
4591
4591
|
await fs11.remove(path12.join(outDir, stagedRel)).catch(() => {
|
|
4592
4592
|
});
|
|
4593
4593
|
if (expectedPackages.length > 0) {
|
|
@@ -4991,12 +4991,12 @@ function buildSplitConfigObject(flowSettings, namedImports) {
|
|
|
4991
4991
|
return buildSplitStepEntry("destinations", key, dest);
|
|
4992
4992
|
});
|
|
4993
4993
|
const transformersEntries = Object.entries(transformers).filter(
|
|
4994
|
-
([, transformer]) => transformer.package || hasCodeReference2(transformer.code) ||
|
|
4994
|
+
([, transformer]) => transformer.package || hasCodeReference2(transformer.code) || ir({ ...transformer }, "Transformer")
|
|
4995
4995
|
).map(([key, transformer]) => {
|
|
4996
4996
|
if (isInlineCode2(transformer.code)) {
|
|
4997
4997
|
return ` ${key}: ${generateInlineCode(transformer.code, transformer.config || {}, transformer.env, { before: transformer.before, next: transformer.next })}`;
|
|
4998
4998
|
}
|
|
4999
|
-
if (
|
|
4999
|
+
if (ir({ ...transformer }, "Transformer")) {
|
|
5000
5000
|
const chainLines = [];
|
|
5001
5001
|
if (transformer.before !== void 0) {
|
|
5002
5002
|
chainLines.push(`before: ${JSON.stringify(transformer.before)}`);
|
|
@@ -5822,7 +5822,7 @@ var init_contract = __esm({
|
|
|
5822
5822
|
"src/core/contract.ts"() {
|
|
5823
5823
|
"use strict";
|
|
5824
5824
|
init_config_file();
|
|
5825
|
-
bakedContractVersion = true ? "
|
|
5825
|
+
bakedContractVersion = true ? "3.1.0" : PLACEHOLDER;
|
|
5826
5826
|
}
|
|
5827
5827
|
});
|
|
5828
5828
|
|
|
@@ -6146,7 +6146,8 @@ __export(previews_exports, {
|
|
|
6146
6146
|
createPreview: () => createPreview,
|
|
6147
6147
|
deletePreview: () => deletePreview,
|
|
6148
6148
|
getPreview: () => getPreview,
|
|
6149
|
-
listPreviews: () => listPreviews
|
|
6149
|
+
listPreviews: () => listPreviews,
|
|
6150
|
+
regrantPreview: () => regrantPreview
|
|
6150
6151
|
});
|
|
6151
6152
|
async function listPreviews(options) {
|
|
6152
6153
|
const pid = options.projectId ?? requireProjectId();
|
|
@@ -6222,11 +6223,37 @@ async function createPreview(options) {
|
|
|
6222
6223
|
);
|
|
6223
6224
|
if (!grantResponse.ok) {
|
|
6224
6225
|
const body = await grantResponse.json().catch(() => ({}));
|
|
6225
|
-
|
|
6226
|
+
try {
|
|
6227
|
+
throwApiError(body, "Failed to mint preview activation grant");
|
|
6228
|
+
} catch (error) {
|
|
6229
|
+
if (error instanceof Error) {
|
|
6230
|
+
error.message += ` (preview ${created.id} was created but has no working activation URL; delete it or mint a grant with regrantPreview)`;
|
|
6231
|
+
}
|
|
6232
|
+
throw error;
|
|
6233
|
+
}
|
|
6226
6234
|
}
|
|
6227
6235
|
const grant = await grantResponse.json();
|
|
6228
6236
|
return { ...created, activationUrl: grant.activationUrl };
|
|
6229
6237
|
}
|
|
6238
|
+
async function regrantPreview(options) {
|
|
6239
|
+
const pid = options.projectId ?? requireProjectId();
|
|
6240
|
+
const response = await apiFetch(
|
|
6241
|
+
`/api/projects/${pid}/flows/${options.flowId}/previews/${options.previewId}/grant`,
|
|
6242
|
+
{
|
|
6243
|
+
method: "POST",
|
|
6244
|
+
headers: { "Content-Type": "application/json" },
|
|
6245
|
+
body: JSON.stringify({
|
|
6246
|
+
origins: options.origins,
|
|
6247
|
+
...options.sessionId ? { sessionId: options.sessionId } : {}
|
|
6248
|
+
})
|
|
6249
|
+
}
|
|
6250
|
+
);
|
|
6251
|
+
if (!response.ok) {
|
|
6252
|
+
const body = await response.json().catch(() => ({}));
|
|
6253
|
+
throwApiError(body, "Failed to mint preview activation grant");
|
|
6254
|
+
}
|
|
6255
|
+
return response.json();
|
|
6256
|
+
}
|
|
6230
6257
|
async function deletePreview(options) {
|
|
6231
6258
|
const pid = options.projectId ?? requireProjectId();
|
|
6232
6259
|
const response = await apiFetch(
|
|
@@ -6271,7 +6298,7 @@ function formatPreviewCreated(preview, options) {
|
|
|
6271
6298
|
` Created by: ${preview.createdBy}`,
|
|
6272
6299
|
` Bundle URL: ${preview.bundleUrl}`,
|
|
6273
6300
|
"",
|
|
6274
|
-
|
|
6301
|
+
preview.activationUrl ? ` Activate: ${preview.activationUrl}` : " Activate: No activation grant minted yet. Re-run with --url <your site> to mint one.",
|
|
6275
6302
|
deactivationUrl ? ` Deactivate: ${deactivationUrl}` : ` Deactivate: Append ?elbPreview=off to any URL on your site`,
|
|
6276
6303
|
""
|
|
6277
6304
|
];
|
|
@@ -6280,7 +6307,7 @@ function formatPreviewCreated(preview, options) {
|
|
|
6280
6307
|
function printPreviewCreated(preview, options) {
|
|
6281
6308
|
const { stdoutLast, stderr } = formatPreviewCreated(preview, options);
|
|
6282
6309
|
process.stderr.write(stderr + "\n");
|
|
6283
|
-
process.stdout.write(stdoutLast + "\n");
|
|
6310
|
+
if (stdoutLast) process.stdout.write(stdoutLast + "\n");
|
|
6284
6311
|
}
|
|
6285
6312
|
var init_output2 = __esm({
|
|
6286
6313
|
"src/commands/previews/output.ts"() {
|
|
@@ -6383,7 +6410,7 @@ function T2(e4, t4, n5) {
|
|
|
6383
6410
|
function _(e4) {
|
|
6384
6411
|
const t4 = [], n5 = [], { simulation: o4, ...r6 } = e4, s4 = T2(r6, /* @__PURE__ */ new WeakMap(), 0);
|
|
6385
6412
|
for (const e5 of o4) {
|
|
6386
|
-
const o5 =
|
|
6413
|
+
const o5 = An(e5);
|
|
6387
6414
|
if (0 === o5.length) continue;
|
|
6388
6415
|
const r7 = o5.join(".");
|
|
6389
6416
|
if (o5.length - 1 >= 8) {
|
|
@@ -6404,9 +6431,9 @@ function _(e4) {
|
|
|
6404
6431
|
n5.push(r7);
|
|
6405
6432
|
continue;
|
|
6406
6433
|
}
|
|
6407
|
-
const
|
|
6408
|
-
"function" == typeof
|
|
6409
|
-
return t4.push({ fn: r7, args: e6, ts: Date.now() }),
|
|
6434
|
+
const u2 = a4[c2];
|
|
6435
|
+
"function" == typeof u2 ? a4[c2] = function(...e6) {
|
|
6436
|
+
return t4.push({ fn: r7, args: e6, ts: Date.now() }), u2.apply(this, e6);
|
|
6410
6437
|
} : n5.push(r7);
|
|
6411
6438
|
}
|
|
6412
6439
|
return { wrappedEnv: s4, calls: t4, unresolved: n5 };
|
|
@@ -6502,8 +6529,8 @@ function oe2(e4, t4, n5, o4, r6) {
|
|
|
6502
6529
|
const t7 = ne2(e5.status, o("destination", n6), "dlq", c2.dropped);
|
|
6503
6530
|
V(a5, s5, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: n6, cap: i5.max, droppedCount: t7 });
|
|
6504
6531
|
} else a5.length < i5.max && L(a5);
|
|
6505
|
-
const
|
|
6506
|
-
|
|
6532
|
+
const u2 = te2(e5, n6);
|
|
6533
|
+
u2.failed++, u2.dlqSize = a5.length, e5.status.failed++;
|
|
6507
6534
|
const d2 = Q2(t6.config.breaker);
|
|
6508
6535
|
if (d2) {
|
|
6509
6536
|
const o6 = t6.config.id || n6;
|
|
@@ -6562,14 +6589,14 @@ async function Ke2(e4, t4, n5) {
|
|
|
6562
6589
|
async function Fe(e4, t4, n5, o4, r6, s4) {
|
|
6563
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: { ...He(t4.config.env), ...s4 ? { respond: s4 } : {} }, reportError: oe2(e4, "transformer", n5, i5) };
|
|
6564
6591
|
i5.debug("push", { event: o4.name });
|
|
6565
|
-
const
|
|
6566
|
-
g3.inEvent = o4,
|
|
6592
|
+
const u2 = "string" == typeof o4.id ? o4.id : "", { traceId: d2, sourceId: l3, parentEventId: f3 } = D2(o4, r6, e4), p3 = Date.now(), g3 = A(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "in", eventId: u2, now: p3, traceId: d2, sourceId: l3, parentEventId: f3 });
|
|
6593
|
+
g3.inEvent = o4, rn(e4, g3);
|
|
6567
6594
|
try {
|
|
6568
|
-
const r7 = await gt(t4.push, "TransformerPush", e4.hooks, e4.logger)(o4, c2), s5 = Date.now(), a5 = A(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "out", eventId:
|
|
6569
|
-
return a5.durationMs = s5 - p3, a5.outEvent = r7,
|
|
6595
|
+
const r7 = await gt(t4.push, "TransformerPush", e4.hooks, e4.logger)(o4, c2), s5 = Date.now(), a5 = A(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "out", eventId: u2, now: s5, traceId: d2, sourceId: l3, parentEventId: f3 });
|
|
6596
|
+
return a5.durationMs = s5 - p3, a5.outEvent = r7, rn(e4, a5), i5.debug("push done"), r7;
|
|
6570
6597
|
} catch (t5) {
|
|
6571
|
-
const o5 = Date.now(), r7 = A(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "error", eventId:
|
|
6572
|
-
throw r7.durationMs = o5 - p3, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) },
|
|
6598
|
+
const o5 = Date.now(), r7 = A(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "error", eventId: u2, now: o5, traceId: d2, sourceId: l3, parentEventId: f3 });
|
|
6599
|
+
throw r7.durationMs = o5 - p3, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, rn(e4, r7), t5;
|
|
6573
6600
|
}
|
|
6574
6601
|
}
|
|
6575
6602
|
function Ue2(e4, t4) {
|
|
@@ -6600,10 +6627,10 @@ async function Be2(e4, t4, n5, o4, r6, s4, a4) {
|
|
|
6600
6627
|
continue;
|
|
6601
6628
|
}
|
|
6602
6629
|
if (s5.config?.disabled) continue;
|
|
6603
|
-
const
|
|
6630
|
+
const u2 = s5.config?.cache, d2 = u2 ? Jn(u2) : void 0, l3 = d2 ? Me(d2, e4) : void 0, f3 = s5.config?.state ? Qn(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 ? er(g3, (t6) => Te(t6, e4), t5, e4) : t5;
|
|
6604
6631
|
let h2;
|
|
6605
6632
|
if (d2 && l3) {
|
|
6606
|
-
const e5 =
|
|
6633
|
+
const e5 = Hn(r6, i5), t5 = await Gn(d2, l3, e5);
|
|
6607
6634
|
if ("HIT" === t5?.status && t5.value) {
|
|
6608
6635
|
if (i5 = t5.value, d2.stop) return { event: i5, respond: c2, stopped: true };
|
|
6609
6636
|
continue;
|
|
@@ -6612,7 +6639,7 @@ async function Be2(e4, t4, n5, o4, r6, s4, a4) {
|
|
|
6612
6639
|
}
|
|
6613
6640
|
const v3 = s5.config.before;
|
|
6614
6641
|
if (v3) {
|
|
6615
|
-
const n6 =
|
|
6642
|
+
const n6 = Tn(v3, Hn(r6, i5));
|
|
6616
6643
|
if (1 === n6.length) {
|
|
6617
6644
|
const o6 = ze2(n6[0], _e2(t4));
|
|
6618
6645
|
if (o6.length > 0) {
|
|
@@ -6623,26 +6650,26 @@ async function Be2(e4, t4, n5, o4, r6, s4, a4) {
|
|
|
6623
6650
|
}
|
|
6624
6651
|
} else n6.length > 1 && await Promise.all(n6.map((n7) => Xe(Be2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, ze2(n7, _e2(t4)), i5, Ue2(r6, n7), void 0, a4)));
|
|
6625
6652
|
}
|
|
6626
|
-
p3 && p3.length > 0 && (i5 = await
|
|
6653
|
+
p3 && p3.length > 0 && (i5 = await er(p3, (t5) => Te(t5, e4), i5, e4));
|
|
6627
6654
|
const y3 = await Xe(Fe, (t5) => (e4.logger.scope(`transformer:${s5.type || "unknown"}`).error("Push failed", { error: t5 }), false))(e4, s5, o5, i5, r6, c2);
|
|
6628
|
-
if (false === y3) return { event: null, respond: c2 };
|
|
6655
|
+
if (false === y3) return { event: null, respond: c2, droppedBy: o5 };
|
|
6629
6656
|
if (Array.isArray(y3)) {
|
|
6630
|
-
const s6 = n5.slice(n5.indexOf(o5) + 1),
|
|
6631
|
-
const o6 = await m3(n6.event || i5),
|
|
6657
|
+
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 = Ue2(r6, "unknown");
|
|
6632
6659
|
if (n6.next) {
|
|
6633
|
-
const r7 =
|
|
6660
|
+
const r7 = Tn(n6.next, Hn(u4, o6));
|
|
6634
6661
|
if (0 === r7.length) return { event: o6, respond: c2 };
|
|
6635
6662
|
if (1 === r7.length) {
|
|
6636
6663
|
const n7 = ze2(r7[0], _e2(t4));
|
|
6637
|
-
return n7.length > 0 ? Be2(e4, t4, n7, o6,
|
|
6664
|
+
return n7.length > 0 ? Be2(e4, t4, n7, o6, u4, c2, a4) : { event: o6, respond: c2 };
|
|
6638
6665
|
}
|
|
6639
|
-
return (await Promise.all(r7.map((n7) => Xe(Be2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, ze2(n7, _e2(t4)), o6, Ue2(
|
|
6666
|
+
return (await Promise.all(r7.map((n7) => Xe(Be2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, ze2(n7, _e2(t4)), o6, Ue2(u4, n7), void 0, a4)))).map((e5) => ({ event: e5.event, respond: void 0 }));
|
|
6640
6667
|
}
|
|
6641
|
-
return s6.length > 0 ? Be2(e4, t4, s6, o6,
|
|
6668
|
+
return s6.length > 0 ? Be2(e4, t4, s6, o6, u4, c2, a4) : { event: o6, respond: c2 };
|
|
6642
6669
|
}));
|
|
6643
6670
|
let d3 = c2;
|
|
6644
6671
|
const l4 = [];
|
|
6645
|
-
for (const e5 of
|
|
6672
|
+
for (const e5 of u3.flat()) if (null !== e5) if (e5 && "object" == typeof e5 && "event" in e5) {
|
|
6646
6673
|
const t5 = e5;
|
|
6647
6674
|
if (t5.respond && (d3 = t5.respond), null === t5.event) continue;
|
|
6648
6675
|
Array.isArray(t5.event) ? l4.push(...t5.event) : l4.push(t5.event);
|
|
@@ -6652,23 +6679,23 @@ async function Be2(e4, t4, n5, o4, r6, s4, a4) {
|
|
|
6652
6679
|
if (y3 && "object" == typeof y3) {
|
|
6653
6680
|
const { event: n6, respond: o6, next: s6 } = y3;
|
|
6654
6681
|
if (o6 && (c2 = o6), void 0 !== s6) {
|
|
6655
|
-
const o7 = await m3(n6 || i5),
|
|
6656
|
-
if (0 ===
|
|
6682
|
+
const o7 = await m3(n6 || i5), u3 = Tn(s6, Hn(r6, o7));
|
|
6683
|
+
if (0 === u3.length) {
|
|
6657
6684
|
i5 = o7;
|
|
6658
6685
|
continue;
|
|
6659
6686
|
}
|
|
6660
|
-
if (1 ===
|
|
6661
|
-
const n7 = ze2(
|
|
6687
|
+
if (1 === u3.length) {
|
|
6688
|
+
const n7 = ze2(u3[0], _e2(t4));
|
|
6662
6689
|
return n7.length > 0 ? Be2(e4, t4, n7, o7, r6, c2, a4) : (e4.logger.warn(`Branch target not found: ${JSON.stringify(s6)}`), { event: null, respond: c2 });
|
|
6663
6690
|
}
|
|
6664
|
-
return await Promise.all(
|
|
6691
|
+
return await Promise.all(u3.map((n7) => Xe(Be2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, ze2(n7, _e2(t4)), o7, Ue2(r6, n7), void 0, a4))), { event: null, respond: void 0 };
|
|
6665
6692
|
}
|
|
6666
6693
|
n6 && (i5 = n6);
|
|
6667
6694
|
}
|
|
6668
|
-
g3 && g3.length > 0 && (i5 = await
|
|
6695
|
+
g3 && g3.length > 0 && (i5 = await er(g3, (t5) => Te(t5, e4), i5, e4)), h2 && l3 && Xn(l3, h2.key, i5, h2.ttl);
|
|
6669
6696
|
const w3 = s5.config.next, b3 = "string" == typeof w3 || Array.isArray(w3) && w3.every((e5) => "string" == typeof e5), k3 = void 0 !== w3 && !b3;
|
|
6670
6697
|
if ((!y3 || "object" == typeof y3 && !y3.next) && k3) {
|
|
6671
|
-
const n6 =
|
|
6698
|
+
const n6 = Tn(s5.config.next, Hn(r6, i5));
|
|
6672
6699
|
if (1 === n6.length) {
|
|
6673
6700
|
const o6 = ze2(n6[0], _e2(t4));
|
|
6674
6701
|
return o6.length > 0 ? Be2(e4, t4, o6, i5, r6, c2, a4) : { event: i5, respond: c2 };
|
|
@@ -6701,16 +6728,16 @@ function Ve2(e4) {
|
|
|
6701
6728
|
return "object" == typeof e4 && null !== e4;
|
|
6702
6729
|
}
|
|
6703
6730
|
async function Le2(e4, t4, n5) {
|
|
6704
|
-
const { code: o4, config: r6 = {}, env: s4 = {}, primary: a4, next: i5, before: c2, cache:
|
|
6731
|
+
const { code: o4, config: r6 = {}, env: s4 = {}, primary: a4, next: i5, before: c2, cache: u2 } = n5, d2 = r6.state ?? n5.state, l3 = d2 ? Qn(d2) : void 0, f3 = u2, p3 = f3 ? Jn({ ...f3, stop: f3.stop ?? true }) : void 0, g3 = Re(i5) ? ze2(i5, _e2(e4.transformers)) : void 0, m3 = Re(c2) ? ze2(c2, _e2(e4.transformers)) : void 0, h2 = s4.push, v3 = h2 ?? e4.push, y3 = Boolean(h2), w3 = async (n6, o5, s5) => {
|
|
6705
6732
|
let a5;
|
|
6706
|
-
const
|
|
6707
|
-
const t5 =
|
|
6733
|
+
const u3 = m3 ?? (void 0 !== c2 ? (() => {
|
|
6734
|
+
const t5 = Tn(c2, Hn(s5.ingest));
|
|
6708
6735
|
if (0 === t5.length) return [];
|
|
6709
6736
|
return ze2(1 === t5.length ? t5[0] : t5, _e2(e4.transformers));
|
|
6710
6737
|
})() : []);
|
|
6711
6738
|
let d3 = [n6];
|
|
6712
|
-
if (
|
|
6713
|
-
const o6 = await Be2(e4, e4.transformers,
|
|
6739
|
+
if (u3.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
6740
|
+
const o6 = await Be2(e4, e4.transformers, u3, n6, s5.ingest, s5.respond, `source.${t4}.before`);
|
|
6714
6741
|
if (null === o6.event) return { ok: true };
|
|
6715
6742
|
if (o6.stopped) return o6.respond && (s5.respond = o6.respond), { ok: true };
|
|
6716
6743
|
o6.respond && (s5.respond = o6.respond), d3 = Array.isArray(o6.event) ? o6.event : [o6.event];
|
|
@@ -6718,32 +6745,32 @@ async function Le2(e4, t4, n5) {
|
|
|
6718
6745
|
if (p3) {
|
|
6719
6746
|
const t5 = Me(p3, e4);
|
|
6720
6747
|
if (t5) {
|
|
6721
|
-
const n7 =
|
|
6748
|
+
const n7 = Hn(s5.ingest), o6 = await Gn(p3, t5, n7);
|
|
6722
6749
|
if (o6) {
|
|
6723
6750
|
if ("HIT" === o6.status && void 0 !== o6.value && p3.stop) {
|
|
6724
6751
|
let t6 = o6.value;
|
|
6725
|
-
return o6.rule.update && (t6 = await
|
|
6752
|
+
return o6.rule.update && (t6 = await Yn(t6, o6.rule.update, { ...n7, cache: { status: "HIT" } }, e4)), s5.respond?.(t6), { ok: true };
|
|
6726
6753
|
}
|
|
6727
6754
|
if ("MISS" === o6.status && p3.stop && s5.respond) {
|
|
6728
|
-
const r7 = s5.respond, i6 = o6.rule.update, c3 = { ...n7, cache: { status: "MISS" } },
|
|
6729
|
-
|
|
6730
|
-
const t6 = await
|
|
6755
|
+
const r7 = s5.respond, i6 = o6.rule.update, c3 = { ...n7, cache: { status: "MISS" } }, u4 = o6.key, d4 = o6.rule.ttl, l4 = (n8) => {
|
|
6756
|
+
Xn(t5, u4, n8, d4), i6 ? a5 = (async () => {
|
|
6757
|
+
const t6 = await Yn(n8, i6, c3, e4);
|
|
6731
6758
|
r7(t6);
|
|
6732
6759
|
})() : r7(n8);
|
|
6733
6760
|
};
|
|
6734
6761
|
s5.respond = l4;
|
|
6735
6762
|
}
|
|
6736
|
-
"MISS" !== o6.status || p3.stop ||
|
|
6763
|
+
"MISS" !== o6.status || p3.stop || Xn(t5, o6.key, true, o6.rule.ttl);
|
|
6737
6764
|
}
|
|
6738
6765
|
}
|
|
6739
6766
|
}
|
|
6740
|
-
const
|
|
6741
|
-
const t5 =
|
|
6767
|
+
const f4 = g3 ? { kind: "single", preChain: g3 } : void 0 !== i5 ? (() => {
|
|
6768
|
+
const t5 = Tn(i5, Hn(s5.ingest));
|
|
6742
6769
|
return 0 === t5.length ? { kind: "single", preChain: [] } : 1 === t5.length ? { kind: "single", preChain: ze2(t5[0], _e2(e4.transformers)) } : { kind: "many", branches: t5.map((t6) => ze2(t6, _e2(e4.transformers))) };
|
|
6743
6770
|
})() : { kind: "single", preChain: [] };
|
|
6744
|
-
!y3 && l3 && l3.length > 0 && (d3 = await Promise.all(d3.map((t5) =>
|
|
6771
|
+
!y3 && l3 && l3.length > 0 && (d3 = await Promise.all(d3.map((t5) => er(l3, (t6) => Te(t6, e4), t5, e4))));
|
|
6745
6772
|
let h3 = { ok: true };
|
|
6746
|
-
for (const n7 of d3) "many" ===
|
|
6773
|
+
for (const n7 of d3) "many" === f4.kind ? (await Promise.all(f4.branches.map((a6, i6) => Xe(async () => y3 ? v3(n7) : v3(n7, { ...o5, id: t4, ingest: Ue2(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 });
|
|
6747
6774
|
return a5 && await a5, h3;
|
|
6748
6775
|
}, b3 = async (n6) => {
|
|
6749
6776
|
const o5 = E(t4), s5 = ze((function(e5) {
|
|
@@ -7038,14 +7065,14 @@ function Ct(e4, t4, n5) {
|
|
|
7038
7065
|
if (!e4) return [];
|
|
7039
7066
|
if (Array.isArray(e4) && e4.every((e5) => "string" == typeof e5)) return ze2(e4, t4);
|
|
7040
7067
|
if ("string" == typeof e4) return ze2(e4, t4);
|
|
7041
|
-
const o4 =
|
|
7068
|
+
const o4 = Tn(e4, Hn(n5));
|
|
7042
7069
|
return 0 === o4.length ? [] : 1 === o4.length ? ze2(o4[0], t4) : ze2(o4, t4);
|
|
7043
7070
|
}
|
|
7044
7071
|
async function Et2(e4, t4) {
|
|
7045
7072
|
const { code: n5, config: o4 = {}, env: r6 = {}, before: s4, next: a4, cache: i5, state: c2 } = t4;
|
|
7046
7073
|
if (!le(n5.push)) return Ot2({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
|
|
7047
|
-
const
|
|
7048
|
-
let d2 = s4 ? { ...
|
|
7074
|
+
const u2 = o4 || { init: false };
|
|
7075
|
+
let d2 = s4 ? { ...u2, before: s4 } : { ...u2 };
|
|
7049
7076
|
a4 && (d2 = { ...d2, next: a4 }), i5 && (d2 = { ...d2, cache: i5 }), void 0 !== c2 && void 0 === d2.state && (d2 = { ...d2, state: c2 });
|
|
7050
7077
|
let l3 = d2.id;
|
|
7051
7078
|
if (!l3) do {
|
|
@@ -7056,8 +7083,8 @@ async function Et2(e4, t4) {
|
|
|
7056
7083
|
const n6 = e4.destinations[l3];
|
|
7057
7084
|
return n6 ? qt(e4, void 0, {}, { [l3]: n6 }) : Ot2({ ok: true });
|
|
7058
7085
|
}
|
|
7059
|
-
const
|
|
7060
|
-
return e4.destinations[l3] =
|
|
7086
|
+
const f3 = { ...n5, config: d2, env: At2(n5.env, r6) };
|
|
7087
|
+
return e4.destinations[l3] = f3, false !== f3.config.queue && (f3.queuePush = [...e4.queue]), qt(e4, void 0, {}, { [l3]: f3 });
|
|
7061
7088
|
}
|
|
7062
7089
|
async function qt(e4, t4, n5 = {}, o4) {
|
|
7063
7090
|
const { allowed: r6, consent: s4, globals: a4, user: g3 } = e4;
|
|
@@ -7111,7 +7138,7 @@ async function qt(e4, t4, n5 = {}, o4) {
|
|
|
7111
7138
|
const n6 = je(r7.config.consent, s4, t5.consent);
|
|
7112
7139
|
if (n6) return t5.consent = n6, j2.push(t5), false;
|
|
7113
7140
|
const a5 = A(e4, { stepId: o("destination", o5), stepType: "destination", phase: "skip", eventId: "string" == typeof t5.id ? t5.id : "", now: Date.now(), ...D2(t5, S2, e4) });
|
|
7114
|
-
return a5.skipReason = "consent", s4 && (a5.consent = { ...s4 }), r7.config.consent && (a5.meta = { required: { ...r7.config.consent } }),
|
|
7141
|
+
return a5.skipReason = "consent", s4 && (a5.consent = { ...s4 }), r7.config.consent && (a5.meta = { required: { ...r7.config.consent } }), rn(e4, a5), true;
|
|
7115
7142
|
});
|
|
7116
7143
|
if ($2.length > 0) {
|
|
7117
7144
|
const t5 = r7.queuePush, n6 = r7.config.id || o5, s5 = { max: r7.config.queueMax ?? 1e3 };
|
|
@@ -7136,44 +7163,44 @@ async function qt(e4, t4, n5 = {}, o4) {
|
|
|
7136
7163
|
}
|
|
7137
7164
|
if (!_3) return I2(), { id: o5, destination: r7, queue: C3 };
|
|
7138
7165
|
r7.dlq || (r7.dlq = []);
|
|
7139
|
-
const P4 = Ct(r7.config.before, h2, S2), z5 = r7.config.next, K4 = r7.config?.cache, F3 = K4 ?
|
|
7166
|
+
const P4 = Ct(r7.config.before, h2, S2), z5 = r7.config.next, K4 = r7.config?.cache, F3 = K4 ? Jn(K4) : void 0, U3 = F3 ? Me(F3, e4) : void 0, B2 = r7.config?.state ? Qn(r7.config.state) : void 0, H3 = B2?.filter((e5) => "get" === e5.mode), R3 = B2?.filter((e5) => "set" === e5.mode);
|
|
7140
7167
|
let W3 = 0, N2 = 0;
|
|
7141
7168
|
return await Promise.all(j2.map(async (t5) => {
|
|
7142
7169
|
let s5;
|
|
7143
7170
|
if (t5.globals = oe(a4, t5.globals), t5.user = oe(g3, t5.user), F3?.stop && U3) {
|
|
7144
|
-
const e5 =
|
|
7171
|
+
const e5 = Hn(S2, t5), n6 = await Gn(F3, U3, e5);
|
|
7145
7172
|
if ("HIT" === n6?.status) return t5;
|
|
7146
7173
|
"MISS" === n6?.status && (s5 = { key: n6.key, ttl: n6.rule.ttl });
|
|
7147
7174
|
}
|
|
7148
|
-
let
|
|
7175
|
+
let u2 = t5, d2 = n5.respond;
|
|
7149
7176
|
if (P4.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
7150
7177
|
const r8 = await Be2(e4, e4.transformers, P4, t5, S2, n5.respond, `destination.${o5}.before`);
|
|
7151
7178
|
if (null === r8.event) return t5;
|
|
7152
|
-
r8.respond && (d2 = r8.respond),
|
|
7179
|
+
r8.respond && (d2 = r8.respond), u2 = Array.isArray(r8.event) ? r8.event[0] : r8.event;
|
|
7153
7180
|
}
|
|
7154
7181
|
if (F3 && !F3.stop && U3) {
|
|
7155
|
-
const e5 =
|
|
7182
|
+
const e5 = Hn(S2, u2), n6 = await Gn(F3, U3, e5);
|
|
7156
7183
|
if ("HIT" === n6?.status) return t5;
|
|
7157
7184
|
"MISS" === n6?.status && (s5 = { key: n6.key, ttl: n6.rule.ttl });
|
|
7158
7185
|
}
|
|
7159
|
-
H3 && H3.length > 0 &&
|
|
7186
|
+
H3 && H3.length > 0 && u2 && (u2 = await er(H3, (t6) => Te(t6, e4), u2, e4));
|
|
7160
7187
|
const p3 = Date.now();
|
|
7161
7188
|
let m3 = false;
|
|
7162
7189
|
const v3 = await Xe(xt2, (t6) => {
|
|
7163
7190
|
const n6 = r7.type || "unknown";
|
|
7164
|
-
e4.logger.scope(n6).error("Push failed", { error: t6, event:
|
|
7165
|
-
const s6 = r7.dlq, a5 = r7.config.id || o5, i5 = { max: r7.config.dlqMax ?? ee2 }, c2 = G2(s6, [
|
|
7191
|
+
e4.logger.scope(n6).error("Push failed", { error: t6, event: u2.name }), M4 = t6, m3 = true;
|
|
7192
|
+
const s6 = r7.dlq, a5 = r7.config.id || o5, i5 = { max: r7.config.dlqMax ?? ee2 }, c2 = G2(s6, [u2, t6], i5);
|
|
7166
7193
|
if (c2.dropped > 0) {
|
|
7167
7194
|
te2(e4, a5);
|
|
7168
7195
|
const t7 = ne2(e4.status, o("destination", a5), "dlq", c2.dropped);
|
|
7169
7196
|
V(s6, e4.logger.scope(r7.type || "unknown"), "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: a5, cap: i5.max, droppedCount: t7 });
|
|
7170
7197
|
} else s6.length < i5.max && L(s6);
|
|
7171
|
-
})(e4, r7, o5,
|
|
7172
|
-
if (W3 += Date.now() - p3, s5 && U3 && void 0 === r7.config.mock &&
|
|
7198
|
+
})(e4, r7, o5, u2, S2, d2);
|
|
7199
|
+
if (W3 += Date.now() - p3, s5 && U3 && void 0 === r7.config.mock && Xn(U3, s5.key, v3 ?? true, s5.ttl), !m3 && !kt2(v3) && R3 && R3.length > 0 && u2 && (u2 = await er(R3, (t6) => Te(t6, e4), u2, e4)), void 0 === v3 || kt2(v3) || (T4 = v3), kt2(v3) && N2++, !m3 && z5) {
|
|
7173
7200
|
void 0 !== v3 && (S2._response = v3);
|
|
7174
7201
|
const t6 = Ct(z5, h2, S2);
|
|
7175
7202
|
if (t6.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
7176
|
-
const n6 = await Be2(e4, e4.transformers, t6,
|
|
7203
|
+
const n6 = await Be2(e4, e4.transformers, t6, u2, S2, d2, `destination.${o5}.next`);
|
|
7177
7204
|
n6.respond && (d2 = n6.respond);
|
|
7178
7205
|
}
|
|
7179
7206
|
}
|
|
@@ -7208,12 +7235,12 @@ async function St2(e4, t4, n5, o4 = false) {
|
|
|
7208
7235
|
s4.debug("init");
|
|
7209
7236
|
const i5 = Date.now();
|
|
7210
7237
|
let c2;
|
|
7211
|
-
|
|
7238
|
+
rn(e4, A(e4, { stepId: o("destination", n5), stepType: "destination", phase: "init", eventId: "", now: i5 }));
|
|
7212
7239
|
try {
|
|
7213
7240
|
c2 = await gt(t4.init, "DestinationInit", e4.hooks, e4.logger)(a4);
|
|
7214
7241
|
} catch (t5) {
|
|
7215
7242
|
const o5 = Date.now(), r7 = A(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: "", now: o5 });
|
|
7216
|
-
throw r7.durationMs = o5 - i5, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) },
|
|
7243
|
+
throw r7.durationMs = o5 - i5, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, rn(e4, r7), t5;
|
|
7217
7244
|
}
|
|
7218
7245
|
if (false === c2) return c2;
|
|
7219
7246
|
if (t4.config = { ...c2 || t4.config, init: true }, t4.queueOn?.length) {
|
|
@@ -7228,22 +7255,22 @@ async function St2(e4, t4, n5, o4 = false) {
|
|
|
7228
7255
|
async function xt2(e4, t4, n5, o4, r6, s4) {
|
|
7229
7256
|
const { config: a4 } = t4, i5 = await nt(o4, a4, e4);
|
|
7230
7257
|
if (i5.ignore) return false;
|
|
7231
|
-
const c2 = t4.type || "unknown",
|
|
7232
|
-
if (void 0 !== a4.mock) return
|
|
7233
|
-
const l3 = i5.mapping,
|
|
7234
|
-
if ((
|
|
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: { ...At2(t4.env, a4.env), ...s4 ? { respond: s4 } : {} }, reportError: oe2(e4, "destination", n5, u2, t4) };
|
|
7259
|
+
if (void 0 !== a4.mock) return u2.debug("mock", { event: i5.event.name }), a4.mock;
|
|
7260
|
+
const l3 = i5.mapping, f3 = void 0 !== l3?.batch, p3 = f3 ? i5.mappingKey || "* *" : " batch-all";
|
|
7261
|
+
if ((f3 || void 0 !== a4.batch) && t4.pushBatch && void 0 === a4.mock) {
|
|
7235
7262
|
if (t4.batches = t4.batches || {}, !t4.batches[p3]) {
|
|
7236
7263
|
const o5 = { key: p3, entries: [], events: [], data: [] }, r7 = It(l3?.batch), s5 = It(a4.batch), i6 = r7.wait ?? s5.wait ?? 3e4, c4 = r7.size ?? s5.size ?? 1e3, d4 = r7.age ?? s5.age ?? 3e4, h3 = At2(t4.env, a4.env), v4 = De(async () => {
|
|
7237
7264
|
const o6 = t4.batches[p3], r8 = o6.batched;
|
|
7238
7265
|
if (0 === r8.entries.length) return;
|
|
7239
7266
|
const s6 = { key: r8.key, entries: r8.entries, events: r8.events, data: r8.data };
|
|
7240
7267
|
r8.entries = [], r8.events = [], r8.data = [];
|
|
7241
|
-
const i7 = s6.entries[0], { traceId: c5, sourceId: d5, parentEventId: l4 } = D2(i7.event, i7.ingest, e4),
|
|
7242
|
-
|
|
7268
|
+
const i7 = s6.entries[0], { traceId: c5, sourceId: d5, parentEventId: l4 } = D2(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: { ...h3, ...i7.respond ? { respond: i7.respond } : {} }, reportError: oe2(e4, "destination", n5, u2, t4) };
|
|
7269
|
+
u2.debug("push batch", { events: s6.entries.length });
|
|
7243
7270
|
const g3 = t4.config.id || n5, v5 = te2(e4, g3), y4 = Q2(t4.config.breaker), w3 = o("destination", g3), b4 = (t5) => {
|
|
7244
7271
|
y4 && X2(e4.status.breakers, w3, t5, y4.threshold, y4.cooldown);
|
|
7245
7272
|
}, I3 = Date.now(), C4 = A(e4, { stepId: o("destination", n5), stepType: "destination", phase: "flush", eventId: "", now: I3, traceId: c5, sourceId: d5, parentEventId: l4 });
|
|
7246
|
-
C4.batch = { size: s6.entries.length, index: 0 },
|
|
7273
|
+
C4.batch = { size: s6.entries.length, index: 0 }, rn(e4, C4);
|
|
7247
7274
|
const x2 = (n6) => {
|
|
7248
7275
|
const o7 = t4.dlq = t4.dlq || [], r9 = { max: t4.config.dlqMax ?? ee2 };
|
|
7249
7276
|
let s7 = 0;
|
|
@@ -7252,7 +7279,7 @@ async function xt2(e4, t4, n5, o4, r6, s4) {
|
|
|
7252
7279
|
}
|
|
7253
7280
|
if (s7 > 0) {
|
|
7254
7281
|
const t5 = ne2(e4.status, o("destination", g3), "dlq", s7);
|
|
7255
|
-
V(o7,
|
|
7282
|
+
V(o7, u2, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: g3, cap: r9.max, droppedCount: t5 });
|
|
7256
7283
|
} else o7.length < r9.max && L(o7);
|
|
7257
7284
|
v5.failed += n6.length, v5.dlqSize = o7.length, e4.status.failed += n6.length;
|
|
7258
7285
|
};
|
|
@@ -7260,48 +7287,48 @@ async function xt2(e4, t4, n5, o4, r6, s4) {
|
|
|
7260
7287
|
const j2 = vt2(a4.timeout), $2 = await Xe((o7, r9) => wt2(Promise.resolve(gt(t4.pushBatch, "DestinationPushBatch", e4.hooks, e4.logger)(o7, r9)), j2, `Destination "${n5}" batch delivery timed out after ${j2}ms`), (t5) => {
|
|
7261
7288
|
O2 = 0;
|
|
7262
7289
|
const o7 = Date.now(), r9 = A(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: "", now: o7, traceId: c5, sourceId: d5, parentEventId: l4 });
|
|
7263
|
-
r9.durationMs = o7 - I3, r9.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, r9.batch = { size: s6.entries.length, index: 0 },
|
|
7264
|
-
})(s6,
|
|
7290
|
+
r9.durationMs = o7 - I3, r9.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, r9.batch = { size: s6.entries.length, index: 0 }, rn(e4, r9), x2(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
|
+
})(s6, f4);
|
|
7265
7292
|
if (de(M4 = $2) && Array.isArray(M4.failed) && $2.failed.length > 0) {
|
|
7266
7293
|
const e5 = [], t5 = /* @__PURE__ */ new Set();
|
|
7267
7294
|
for (const n6 of $2.failed) {
|
|
7268
7295
|
const o7 = s6.entries[n6.index];
|
|
7269
7296
|
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)`)]));
|
|
7270
7297
|
}
|
|
7271
|
-
e5.length > 0 && (x2(e5), O2 = Math.max(0, s6.entries.length - e5.length),
|
|
7298
|
+
e5.length > 0 && (x2(e5), O2 = Math.max(0, s6.entries.length - e5.length), u2.error("Push batch partial failure", { failed: e5.length, delivered: O2, entries: s6.entries.length }));
|
|
7272
7299
|
}
|
|
7273
7300
|
var M4;
|
|
7274
|
-
|
|
7301
|
+
u2.debug("push batch done"), v5.inFlightBatch = Math.max(0, (v5.inFlightBatch ?? 0) - s6.entries.length), O2 > 0 && (v5.count += O2, v5.lastAt = Date.now(), e4.status.out += O2, b4("success"));
|
|
7275
7302
|
}, { wait: i6, size: c4, age: d4 });
|
|
7276
|
-
t4.batches[p3] = { batched: o5, isDefault: !
|
|
7303
|
+
t4.batches[p3] = { batched: o5, isDefault: !f3, batchFn: () => {
|
|
7277
7304
|
v4();
|
|
7278
7305
|
}, flush: async () => {
|
|
7279
7306
|
await v4.flush();
|
|
7280
7307
|
} };
|
|
7281
7308
|
}
|
|
7282
7309
|
const c3 = t4.batches[p3];
|
|
7283
|
-
c3.batched.entries.push({ event: i5.event, ingest: r6, respond: s4, rule: l3, data: i5.data }), c3.batched.events.push(i5.event),
|
|
7310
|
+
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);
|
|
7284
7311
|
const d3 = "string" == typeof i5.event.id ? i5.event.id : "", h2 = D2(o4, r6, e4), v3 = Date.now(), y3 = A(e4, { stepId: o("destination", n5), stepType: "destination", phase: "in", eventId: d3, now: v3, traceId: h2.traceId, sourceId: h2.sourceId, parentEventId: h2.parentEventId });
|
|
7285
|
-
i5.mappingKey && (y3.mappingKey = i5.mappingKey), i5.event.consent && (y3.consent = { ...i5.event.consent }), y3.inEvent = i5.event,
|
|
7312
|
+
i5.mappingKey && (y3.mappingKey = i5.mappingKey), i5.event.consent && (y3.consent = { ...i5.event.consent }), y3.inEvent = i5.event, rn(e4, y3);
|
|
7286
7313
|
const b3 = A(e4, { stepId: o("destination", n5), stepType: "destination", phase: "out", eventId: d3, now: v3, traceId: h2.traceId, sourceId: h2.sourceId, parentEventId: h2.parentEventId });
|
|
7287
|
-
i5.mappingKey && (b3.mappingKey = i5.mappingKey), b3.outEvent = i5.event, b3.batch = { size: c3.batched.entries.length, index: c3.batched.entries.length - 1 },
|
|
7314
|
+
i5.mappingKey && (b3.mappingKey = i5.mappingKey), b3.outEvent = i5.event, b3.batch = { size: c3.batched.entries.length, index: c3.batched.entries.length - 1 }, rn(e4, b3);
|
|
7288
7315
|
const I2 = t4.config.id || n5, C3 = te2(e4, I2);
|
|
7289
7316
|
return C3.inFlightBatch = (C3.inFlightBatch ?? 0) + 1, c3.batchFn(), bt2;
|
|
7290
7317
|
}
|
|
7291
7318
|
{
|
|
7292
7319
|
let s5;
|
|
7293
|
-
if (
|
|
7320
|
+
if (u2.debug("push", { event: i5.event.name }), "trace" === e4.observeLevel?.() && Array.isArray(t4.calls) && t4.calls.length > 0) {
|
|
7294
7321
|
const e5 = _({ ...d2.env, simulation: t4.calls });
|
|
7295
|
-
d2.env = e5.wrappedEnv, s5 = e5.calls, e5.unresolved.length > 0 && (e5.wrappedEnv[
|
|
7322
|
+
d2.env = e5.wrappedEnv, s5 = e5.calls, e5.unresolved.length > 0 && (e5.wrappedEnv[wn] = { paths: e5.unresolved, record: (t5, n6) => e5.calls.push({ fn: t5, args: n6, ts: Date.now() }) });
|
|
7296
7323
|
}
|
|
7297
|
-
const c3 = "string" == typeof i5.event.id ? i5.event.id : "", { traceId: l4, sourceId:
|
|
7298
|
-
i5.mappingKey && (h2.mappingKey = i5.mappingKey), i5.event.consent && (h2.consent = { ...i5.event.consent }), h2.inEvent = i5.event,
|
|
7324
|
+
const c3 = "string" == typeof i5.event.id ? i5.event.id : "", { traceId: l4, sourceId: f4, parentEventId: p4 } = D2(o4, r6, e4), g3 = Date.now(), h2 = A(e4, { stepId: o("destination", n5), stepType: "destination", phase: "in", eventId: c3, now: g3, traceId: l4, sourceId: f4, parentEventId: p4 });
|
|
7325
|
+
i5.mappingKey && (h2.mappingKey = i5.mappingKey), i5.event.consent && (h2.consent = { ...i5.event.consent }), h2.inEvent = i5.event, rn(e4, h2);
|
|
7299
7326
|
try {
|
|
7300
|
-
const o5 = vt2(a4.timeout), r7 = await wt2(Promise.resolve(gt(t4.push, "DestinationPush", e4.hooks, e4.logger)(i5.event, d2)), o5, `Destination "${n5}" delivery timed out after ${o5}ms`), h3 = Date.now(), v3 = A(e4, { stepId: o("destination", n5), stepType: "destination", phase: "out", eventId: c3, now: h3, traceId: l4, sourceId:
|
|
7301
|
-
return v3.durationMs = h3 - g3, v3.outEvent = i5.event, s5 && s5.length > 0 && (v3.calls = K2(s5)),
|
|
7327
|
+
const o5 = vt2(a4.timeout), r7 = await wt2(Promise.resolve(gt(t4.push, "DestinationPush", e4.hooks, e4.logger)(i5.event, d2)), o5, `Destination "${n5}" delivery timed out after ${o5}ms`), h3 = Date.now(), v3 = A(e4, { stepId: o("destination", n5), stepType: "destination", phase: "out", eventId: c3, now: h3, traceId: l4, sourceId: f4, parentEventId: p4 });
|
|
7328
|
+
return v3.durationMs = h3 - g3, v3.outEvent = i5.event, s5 && s5.length > 0 && (v3.calls = K2(s5)), ue(r7) && (v3.meta = { ...v3.meta, response: r7 }), i5.mappingKey && (v3.mappingKey = i5.mappingKey), rn(e4, v3), u2.debug("push done"), r7;
|
|
7302
7329
|
} catch (t5) {
|
|
7303
|
-
const o5 = Date.now(), r7 = A(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: c3, now: o5, traceId: l4, sourceId:
|
|
7304
|
-
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 = K2(s5)), i5.mappingKey && (r7.mappingKey = i5.mappingKey),
|
|
7330
|
+
const o5 = Date.now(), r7 = A(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: c3, now: o5, traceId: l4, sourceId: f4, parentEventId: p4 });
|
|
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 = K2(s5)), i5.mappingKey && (r7.mappingKey = i5.mappingKey), rn(e4, r7), t5;
|
|
7305
7332
|
}
|
|
7306
7333
|
}
|
|
7307
7334
|
}
|
|
@@ -7311,8 +7338,8 @@ function Ot2(e4) {
|
|
|
7311
7338
|
function jt2(e4) {
|
|
7312
7339
|
const { code: t4, config: n5 = {}, env: o4 = {}, cache: r6, state: s4 } = e4, { config: a4 } = Pe2(e4, "before"), { config: i5 } = Pe2({ ...e4, config: a4 }, "next"), c2 = { ...t4.config, ...n5, ...i5 };
|
|
7313
7340
|
r6 && (c2.cache = r6), void 0 !== s4 && void 0 === c2.state && (c2.state = s4);
|
|
7314
|
-
const
|
|
7315
|
-
return { ...t4, config: c2, env:
|
|
7341
|
+
const u2 = At2(t4.env, o4);
|
|
7342
|
+
return { ...t4, config: c2, env: u2 };
|
|
7316
7343
|
}
|
|
7317
7344
|
async function Dt(e4, t4 = {}) {
|
|
7318
7345
|
const n5 = {};
|
|
@@ -7435,10 +7462,10 @@ function Gt(e4, t4, n5) {
|
|
|
7435
7462
|
if (!t4.name) throw new Error("Event name is required");
|
|
7436
7463
|
const [o4, r6] = t4.name.split(" ");
|
|
7437
7464
|
if (!o4 || !r6) throw new Error("Event name is invalid");
|
|
7438
|
-
const { timestamp: s4 = Date.now(), name: a4 = `${o4} ${r6}`, data: i5 = {}, context: c2 = {}, globals:
|
|
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, I2 = { ...w3, count: b3 };
|
|
7439
7466
|
void 0 !== k3 && (I2.trace = k3);
|
|
7440
|
-
const C3 = e4.name ?? w3.platform ?? "default", E3 = e4.release ?? "4.3.0
|
|
7441
|
-
return I2.release = { ...w3.release, [C3]: E3 }, { name: a4, data: i5, context: c2, globals:
|
|
7467
|
+
const C3 = e4.name ?? w3.platform ?? "default", E3 = e4.release ?? "4.3.0";
|
|
7468
|
+
return I2.release = { ...w3.release, [C3]: E3 }, { 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: I2 };
|
|
7442
7469
|
}
|
|
7443
7470
|
function Wt(e4, t4, n5) {
|
|
7444
7471
|
return Gt(e4, Rt(e4, t4), n5);
|
|
@@ -7451,8 +7478,8 @@ async function Vt(e4, t4) {
|
|
|
7451
7478
|
}
|
|
7452
7479
|
function en2(e4, t4) {
|
|
7453
7480
|
const n5 = gt(async (n6, o4 = {}) => await Xe(async () => {
|
|
7454
|
-
const r6 = Date.now(), { id: s4, ingest: a4, respond: i5, mapping: c2, preChain:
|
|
7455
|
-
let
|
|
7481
|
+
const r6 = Date.now(), { id: s4, ingest: a4, respond: i5, mapping: c2, preChain: u2, include: d2, exclude: l3 } = o4;
|
|
7482
|
+
let f3 = i5, p3 = n6;
|
|
7456
7483
|
const g3 = d2 || l3 ? (function(e5, t5, n7) {
|
|
7457
7484
|
let o5 = e5;
|
|
7458
7485
|
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;
|
|
@@ -7465,14 +7492,14 @@ function en2(e4, t4) {
|
|
|
7465
7492
|
}
|
|
7466
7493
|
p3 = t5.event;
|
|
7467
7494
|
}
|
|
7468
|
-
if (
|
|
7469
|
-
const n7 = await Be2(e4, e4.transformers,
|
|
7470
|
-
if (null === n7.event) return Ot2({ ok: true });
|
|
7471
|
-
if (n7.stopped) return n7.respond && (
|
|
7472
|
-
if (n7.respond && (
|
|
7495
|
+
if (u2?.length && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
7496
|
+
const n7 = await Be2(e4, e4.transformers, u2, p3, m3, f3, s4 ? `source.${s4}.next` : void 0);
|
|
7497
|
+
if (null === n7.event) return e4.logger.debug("Event dropped by transformer chain" + (n7.droppedBy ? ` (${n7.droppedBy})` : "")), Ot2({ ok: true, dropped: true });
|
|
7498
|
+
if (n7.stopped) return n7.respond && (f3 = n7.respond), Ot2({ ok: true });
|
|
7499
|
+
if (n7.respond && (f3 = n7.respond), Array.isArray(n7.event)) {
|
|
7473
7500
|
const o5 = await Promise.all(n7.event.map(async (n8) => {
|
|
7474
7501
|
const o6 = t4(n8), r7 = Gt(e4, o6, m3);
|
|
7475
|
-
return qt(e4, r7, { id: s4, ingest: m3, respond:
|
|
7502
|
+
return qt(e4, r7, { id: s4, ingest: m3, respond: f3 }, g3);
|
|
7476
7503
|
}));
|
|
7477
7504
|
if (s4) {
|
|
7478
7505
|
e4.status.sources[s4] || (e4.status.sources[s4] = { count: 0, duration: 0 });
|
|
@@ -7483,7 +7510,7 @@ function en2(e4, t4) {
|
|
|
7483
7510
|
}
|
|
7484
7511
|
p3 = n7.event;
|
|
7485
7512
|
}
|
|
7486
|
-
const h2 = Wt(e4, p3, m3), v3 = await qt(e4, h2, { id: s4, ingest: m3, respond:
|
|
7513
|
+
const h2 = Wt(e4, p3, m3), v3 = await qt(e4, h2, { id: s4, ingest: m3, respond: f3 }, g3);
|
|
7487
7514
|
if (s4) {
|
|
7488
7515
|
e4.status.sources[s4] || (e4.status.sources[s4] = { count: 0, duration: 0 });
|
|
7489
7516
|
const t5 = e4.status.sources[s4];
|
|
@@ -7495,14 +7522,14 @@ function en2(e4, t4) {
|
|
|
7495
7522
|
return e4.status.failed++, e4.logger.error("push failed", { event: n6, ingest: o4.ingest, error: t5 }), Ot2({ ok: false });
|
|
7496
7523
|
})(), "Push", e4.hooks, e4.logger);
|
|
7497
7524
|
return async (t5, o4) => {
|
|
7498
|
-
const r6 = "string" == typeof t5.id ? t5.id : "", { traceId: s4, sourceId: a4, parentEventId: i5 } = D2(t5, o4?.ingest, e4), c2 = Date.now(),
|
|
7499
|
-
|
|
7525
|
+
const r6 = "string" == typeof t5.id ? t5.id : "", { traceId: s4, sourceId: a4, parentEventId: i5 } = D2(t5, o4?.ingest, e4), c2 = Date.now(), u2 = A(e4, { stepId: "collector.push", stepType: "collector", phase: "in", eventId: r6, now: c2, traceId: s4, sourceId: a4, parentEventId: i5 });
|
|
7526
|
+
u2.inEvent = t5, rn(e4, u2);
|
|
7500
7527
|
try {
|
|
7501
|
-
const
|
|
7502
|
-
return l3.durationMs = d2 - c2, l3.outEvent =
|
|
7528
|
+
const u3 = await n5(t5, o4), d2 = Date.now(), l3 = A(e4, { stepId: "collector.push", stepType: "collector", phase: "out", eventId: r6, now: d2, traceId: s4, sourceId: a4, parentEventId: i5 });
|
|
7529
|
+
return l3.durationMs = d2 - c2, l3.outEvent = u3, rn(e4, l3), u3;
|
|
7503
7530
|
} catch (t6) {
|
|
7504
7531
|
const n6 = Date.now(), o5 = A(e4, { stepId: "collector.push", stepType: "collector", phase: "error", eventId: r6, now: n6, traceId: s4, sourceId: a4, parentEventId: i5 });
|
|
7505
|
-
throw o5.durationMs = n6 - c2, o5.error = t6 instanceof Error ? { name: t6.name, message: t6.message } : { message: String(t6) },
|
|
7532
|
+
throw o5.durationMs = n6 - c2, o5.error = t6 instanceof Error ? { name: t6.name, message: t6.message } : { message: String(t6) }, rn(e4, o5), t6;
|
|
7506
7533
|
}
|
|
7507
7534
|
};
|
|
7508
7535
|
}
|
|
@@ -7543,19 +7570,19 @@ function fn(e4, t4) {
|
|
|
7543
7570
|
const { cacheConfig: n5, cacheStore: o4, namespace: r6, logger: s4, storeId: a4, collector: i5 } = t4, c2 = (e5, t5) => {
|
|
7544
7571
|
if (!i5) return;
|
|
7545
7572
|
const n6 = A(i5, { stepId: `store.${a4}`, stepType: "store", phase: "in", eventId: "", now: Date.now() });
|
|
7546
|
-
n6.meta = { op: "cache", cached: "hit" === t5, status: t5, key: e5 },
|
|
7547
|
-
},
|
|
7548
|
-
function
|
|
7573
|
+
n6.meta = { op: "cache", cached: "hit" === t5, status: t5, key: e5 }, rn(i5, n6);
|
|
7574
|
+
}, u2 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, inflight_dedups: 0 }, d2 = n5.rules.map((e5) => ({ match: e5.match ? In(e5.match) : () => true, ttl: e5.ttl })), l3 = (e5) => `${r6}:${e5}`;
|
|
7575
|
+
function f3(e5, t5) {
|
|
7549
7576
|
const n6 = void 0 === t5 ? { key: e5 } : { key: e5, value: t5 };
|
|
7550
7577
|
return d2.find((e6) => e6.match(n6));
|
|
7551
7578
|
}
|
|
7552
7579
|
const p3 = /* @__PURE__ */ new Map();
|
|
7553
7580
|
return { type: e4.type, config: e4.config, setup: e4.setup, get counters() {
|
|
7554
|
-
return { ...
|
|
7581
|
+
return { ...u2 };
|
|
7555
7582
|
}, async get(t5) {
|
|
7556
|
-
const n6 = l3(t5), r7 = await o4.get(n6), s5 =
|
|
7583
|
+
const n6 = l3(t5), r7 = await o4.get(n6), s5 = Fn(r7);
|
|
7557
7584
|
if (void 0 !== s5) {
|
|
7558
|
-
if (!("expired" in s5)) return
|
|
7585
|
+
if (!("expired" in s5)) return u2.hits++, c2(t5, "hit"), s5.value;
|
|
7559
7586
|
try {
|
|
7560
7587
|
await o4.delete(n6);
|
|
7561
7588
|
} catch (e5) {
|
|
@@ -7563,16 +7590,16 @@ function fn(e4, t4) {
|
|
|
7563
7590
|
}
|
|
7564
7591
|
}
|
|
7565
7592
|
const a5 = p3.get(n6);
|
|
7566
|
-
if (a5) return
|
|
7567
|
-
|
|
7593
|
+
if (a5) return u2.inflight_dedups++, c2(t5, "hit"), a5;
|
|
7594
|
+
u2.misses++, c2(t5, "miss");
|
|
7568
7595
|
const i6 = (async () => {
|
|
7569
7596
|
try {
|
|
7570
7597
|
const r8 = await e4.get(t5);
|
|
7571
7598
|
if (void 0 === r8) return;
|
|
7572
|
-
const s6 =
|
|
7599
|
+
const s6 = f3(t5, r8);
|
|
7573
7600
|
if (s6) try {
|
|
7574
7601
|
const e5 = 1e3 * s6.ttl;
|
|
7575
|
-
await o4.set(n6,
|
|
7602
|
+
await o4.set(n6, Rn(r8, e5), e5), u2.populates++;
|
|
7576
7603
|
} catch (e5) {
|
|
7577
7604
|
g3("set", t5, e5);
|
|
7578
7605
|
}
|
|
@@ -7583,16 +7610,16 @@ function fn(e4, t4) {
|
|
|
7583
7610
|
})();
|
|
7584
7611
|
return p3.set(n6, i6), i6;
|
|
7585
7612
|
}, async set(t5, n6, r7) {
|
|
7586
|
-
|
|
7587
|
-
const s5 =
|
|
7613
|
+
u2.writes++, await e4.set(t5, n6, r7);
|
|
7614
|
+
const s5 = f3(t5, n6);
|
|
7588
7615
|
if (s5) try {
|
|
7589
7616
|
const e5 = 1e3 * s5.ttl;
|
|
7590
|
-
await o4.set(l3(t5),
|
|
7617
|
+
await o4.set(l3(t5), Rn(n6, e5), e5);
|
|
7591
7618
|
} catch (e5) {
|
|
7592
7619
|
g3("set", t5, e5);
|
|
7593
7620
|
}
|
|
7594
7621
|
}, async delete(t5) {
|
|
7595
|
-
|
|
7622
|
+
u2.deletes++, await e4.delete(t5);
|
|
7596
7623
|
try {
|
|
7597
7624
|
await o4.delete(l3(t5));
|
|
7598
7625
|
} catch (e5) {
|
|
@@ -7608,43 +7635,43 @@ function pn(e4, t4, n5) {
|
|
|
7608
7635
|
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);
|
|
7609
7636
|
t4.get = async (t5) => {
|
|
7610
7637
|
const n6 = Date.now(), s5 = A(e4, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: n6 });
|
|
7611
|
-
s5.meta = { op: "get", key: t5 },
|
|
7638
|
+
s5.meta = { op: "get", key: t5 }, rn(e4, s5);
|
|
7612
7639
|
try {
|
|
7613
7640
|
const s6 = await r6(t5), a5 = Date.now(), i5 = A(e4, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: a5 });
|
|
7614
|
-
return i5.durationMs = a5 - n6, i5.meta = { op: "get", key: t5 },
|
|
7641
|
+
return i5.durationMs = a5 - n6, i5.meta = { op: "get", key: t5 }, rn(e4, i5), s6;
|
|
7615
7642
|
} catch (r7) {
|
|
7616
7643
|
const s6 = Date.now(), a5 = A(e4, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: s6 });
|
|
7617
|
-
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) },
|
|
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) }, rn(e4, a5), r7;
|
|
7618
7645
|
}
|
|
7619
7646
|
}, t4.set = async (t5, n6, r7) => {
|
|
7620
7647
|
const a5 = Date.now(), i5 = A(e4, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: a5 });
|
|
7621
|
-
i5.meta = { op: "set", key: t5 },
|
|
7648
|
+
i5.meta = { op: "set", key: t5 }, rn(e4, i5);
|
|
7622
7649
|
try {
|
|
7623
7650
|
await s4(t5, n6, r7);
|
|
7624
7651
|
const i6 = Date.now(), c2 = A(e4, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: i6 });
|
|
7625
|
-
c2.durationMs = i6 - a5, c2.meta = { op: "set", key: t5 },
|
|
7652
|
+
c2.durationMs = i6 - a5, c2.meta = { op: "set", key: t5 }, rn(e4, c2);
|
|
7626
7653
|
} catch (n7) {
|
|
7627
7654
|
const r8 = Date.now(), s5 = A(e4, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: r8 });
|
|
7628
|
-
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) },
|
|
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) }, rn(e4, s5), n7;
|
|
7629
7656
|
}
|
|
7630
7657
|
}, t4.delete = async (t5) => {
|
|
7631
7658
|
const n6 = Date.now(), r7 = A(e4, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: n6 });
|
|
7632
|
-
r7.meta = { op: "delete", key: t5 },
|
|
7659
|
+
r7.meta = { op: "delete", key: t5 }, rn(e4, r7);
|
|
7633
7660
|
try {
|
|
7634
7661
|
await a4(t5);
|
|
7635
7662
|
const r8 = Date.now(), s5 = A(e4, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: r8 });
|
|
7636
|
-
s5.durationMs = r8 - n6, s5.meta = { op: "delete", key: t5 },
|
|
7663
|
+
s5.durationMs = r8 - n6, s5.meta = { op: "delete", key: t5 }, rn(e4, s5);
|
|
7637
7664
|
} catch (r8) {
|
|
7638
7665
|
const s5 = Date.now(), a5 = A(e4, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: s5 });
|
|
7639
|
-
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) },
|
|
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) }, rn(e4, a5), r8;
|
|
7640
7667
|
}
|
|
7641
7668
|
};
|
|
7642
7669
|
}
|
|
7643
|
-
async function
|
|
7670
|
+
async function gn(e4, t4 = {}) {
|
|
7644
7671
|
const n5 = {};
|
|
7645
7672
|
for (const [o5, r7] of Object.entries(t4)) {
|
|
7646
|
-
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: oe2(e4, "store", o5, i5) },
|
|
7647
|
-
n5[o5] =
|
|
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: oe2(e4, "store", o5, i5) }, u2 = await t5(c2);
|
|
7674
|
+
n5[o5] = u2;
|
|
7648
7675
|
}
|
|
7649
7676
|
const o4 = t4, r6 = (function(e5) {
|
|
7650
7677
|
const t5 = {};
|
|
@@ -7702,7 +7729,7 @@ async function mn(e4) {
|
|
|
7702
7729
|
};
|
|
7703
7730
|
})(i5);
|
|
7704
7731
|
const c2 = e4.stores || {};
|
|
7705
|
-
return i5.stores = await
|
|
7732
|
+
return i5.stores = await gn(i5, c2), (function(e5, t5, n6) {
|
|
7706
7733
|
const o5 = /* @__PURE__ */ new Map();
|
|
7707
7734
|
for (const [n7, r8] of Object.entries(e5)) t5[n7] && o5.set(r8, t5[n7]);
|
|
7708
7735
|
if (0 !== o5.size) {
|
|
@@ -7719,12 +7746,12 @@ async function mn(e4) {
|
|
|
7719
7746
|
})(c2, i5.stores, e4), i5.stores.__cache || (i5.stores.__cache = an()), i5.destinations = await Dt(i5, e4.destinations || {}), i5.transformers = await (async function(e5, t5 = {}) {
|
|
7720
7747
|
const n6 = {};
|
|
7721
7748
|
for (const [o5, r7] of Object.entries(t5)) {
|
|
7722
|
-
const { code: t6, env: s4 = {} } = r7, a4 =
|
|
7749
|
+
const { code: t6, env: s4 = {} } = r7, a4 = sr(r7, "Transformer");
|
|
7723
7750
|
if (!a4.ok) {
|
|
7724
7751
|
e5.logger.warn(`Transformer ${o5} invalid (${a4.code}): ${a4.reason}. Skipping.`);
|
|
7725
7752
|
continue;
|
|
7726
7753
|
}
|
|
7727
|
-
const { config: i6 } = Pe2(r7, "before"), { config: c3 } = Pe2({ ...r7, config: i6 }, "next"),
|
|
7754
|
+
const { config: i6 } = Pe2(r7, "before"), { config: c3 } = Pe2({ ...r7, config: i6 }, "next"), u2 = Object.keys(s4).length > 0 ? { ...c3, env: s4 } : c3, { 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: E(o5), config: p3, env: s4, reportError: oe2(e5, "transformer", o5, g3) }, h2 = t6 ?? ((e6) => {
|
|
7728
7755
|
const t7 = r7.mapping;
|
|
7729
7756
|
if (t7) {
|
|
7730
7757
|
const n7 = [];
|
|
@@ -7742,7 +7769,7 @@ async function mn(e4) {
|
|
|
7742
7769
|
}
|
|
7743
7770
|
return { type: "pass", config: e6.config, push: (e7) => ({ event: e7 }) };
|
|
7744
7771
|
}), v3 = await h2(m3);
|
|
7745
|
-
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 !==
|
|
7772
|
+
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;
|
|
7746
7773
|
}
|
|
7747
7774
|
return n6;
|
|
7748
7775
|
})(i5, e4.transformers || {}), i5;
|
|
@@ -7764,7 +7791,7 @@ init_dist2();
|
|
|
7764
7791
|
var destinationAPI = { type: "api", config: {}, env: { sendServer: a2 }, async push(event, { config, rule, data, env, logger }) {
|
|
7765
7792
|
const { settings } = config, { url, headers, method, transform, timeout } = settings || {};
|
|
7766
7793
|
if (!url) return;
|
|
7767
|
-
const eventData =
|
|
7794
|
+
const eventData = ue(data) ? data : event, body = transform ? transform(eventData, config, rule) : JSON.stringify(eventData);
|
|
7768
7795
|
logger?.debug("API destination sending request", { url, method: method || "POST", eventName: event.name });
|
|
7769
7796
|
const sendServerFn = env?.sendServer || a2, response = await sendServerFn(url, body, { headers, method, timeout });
|
|
7770
7797
|
logger?.debug("API destination response", { ok: response?.ok });
|
|
@@ -8772,7 +8799,7 @@ function resolveBeforeChain(before, transformers, ingest, event) {
|
|
|
8772
8799
|
if (Array.isArray(before) && before.every(isString)) {
|
|
8773
8800
|
return before;
|
|
8774
8801
|
}
|
|
8775
|
-
const ids =
|
|
8802
|
+
const ids = Tn(before, Hn(ingest, event));
|
|
8776
8803
|
if (ids.length === 0) return [];
|
|
8777
8804
|
if (ids.length === 1) return walkStaticChain(ids[0], transformers);
|
|
8778
8805
|
return ids;
|
|
@@ -10198,11 +10225,14 @@ function createPoller(config, logger) {
|
|
|
10198
10225
|
init_dist();
|
|
10199
10226
|
import http from "http";
|
|
10200
10227
|
var PREVIEW_LOG = "[walkerOS:preview]";
|
|
10201
|
-
function answerPreviewPreflight(res) {
|
|
10228
|
+
function answerPreviewPreflight(req, res) {
|
|
10229
|
+
const requested = req.headers["access-control-request-headers"];
|
|
10230
|
+
const requestedHeaders = Array.isArray(requested) ? requested.join(", ") : requested;
|
|
10202
10231
|
res.writeHead(204, {
|
|
10203
10232
|
"Access-Control-Allow-Origin": "*",
|
|
10204
10233
|
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
|
|
10205
|
-
"Access-Control-Allow-Headers": "Content-Type, X-Walkeros-Preview"
|
|
10234
|
+
"Access-Control-Allow-Headers": requestedHeaders || "Content-Type, X-Walkeros-Preview",
|
|
10235
|
+
Vary: "Access-Control-Request-Headers"
|
|
10206
10236
|
});
|
|
10207
10237
|
res.end();
|
|
10208
10238
|
}
|
|
@@ -10228,21 +10258,36 @@ function guardPreviewIntake(req, res, gate, logger, onPass) {
|
|
|
10228
10258
|
source: "storage",
|
|
10229
10259
|
now: gate.now ? gate.now() : Date.now(),
|
|
10230
10260
|
crypto: gate.crypto
|
|
10231
|
-
}).then(
|
|
10232
|
-
|
|
10233
|
-
|
|
10234
|
-
|
|
10261
|
+
}).then(
|
|
10262
|
+
(result) => {
|
|
10263
|
+
if (!result.ok) {
|
|
10264
|
+
logger.info(
|
|
10265
|
+
`${PREVIEW_LOG} rejected ${req.method} ${req.url}: ${result.reason}`
|
|
10266
|
+
);
|
|
10267
|
+
rejectPreview(res);
|
|
10268
|
+
return;
|
|
10269
|
+
}
|
|
10270
|
+
try {
|
|
10271
|
+
onPass();
|
|
10272
|
+
} catch (error) {
|
|
10273
|
+
logger.info(
|
|
10274
|
+
`${PREVIEW_LOG} flow handler error on ${req.method} ${req.url}: ${error instanceof Error ? error.message : String(error)}`
|
|
10275
|
+
);
|
|
10276
|
+
if (!res.headersSent) {
|
|
10277
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
10278
|
+
res.end(JSON.stringify({ error: "Internal Server Error" }));
|
|
10279
|
+
} else {
|
|
10280
|
+
res.end();
|
|
10281
|
+
}
|
|
10282
|
+
}
|
|
10283
|
+
},
|
|
10284
|
+
(error) => {
|
|
10235
10285
|
logger.info(
|
|
10236
|
-
`${PREVIEW_LOG}
|
|
10286
|
+
`${PREVIEW_LOG} verification error on ${req.method} ${req.url}: ${error instanceof Error ? error.message : String(error)}`
|
|
10237
10287
|
);
|
|
10238
10288
|
rejectPreview(res);
|
|
10239
10289
|
}
|
|
10240
|
-
|
|
10241
|
-
logger.info(
|
|
10242
|
-
`${PREVIEW_LOG} verification error on ${req.method} ${req.url}: ${error instanceof Error ? error.message : String(error)}`
|
|
10243
|
-
);
|
|
10244
|
-
rejectPreview(res);
|
|
10245
|
-
});
|
|
10290
|
+
);
|
|
10246
10291
|
}
|
|
10247
10292
|
function createHealthServer(port, logger, previewGate) {
|
|
10248
10293
|
return new Promise((resolve4, reject) => {
|
|
@@ -10277,7 +10322,7 @@ function createHealthServer(port, logger, previewGate) {
|
|
|
10277
10322
|
};
|
|
10278
10323
|
if (previewGate) {
|
|
10279
10324
|
if (req.method === "OPTIONS") {
|
|
10280
|
-
answerPreviewPreflight(res);
|
|
10325
|
+
answerPreviewPreflight(req, res);
|
|
10281
10326
|
return;
|
|
10282
10327
|
}
|
|
10283
10328
|
guardPreviewIntake(req, res, previewGate, logger, delegate);
|
|
@@ -10627,9 +10672,9 @@ function createTracePoller(config, logger) {
|
|
|
10627
10672
|
if (!("traceUntil" in parsed)) return;
|
|
10628
10673
|
const value = parsed.traceUntil;
|
|
10629
10674
|
if (typeof value === "string" && value.length > 0) {
|
|
10630
|
-
|
|
10675
|
+
nn(value);
|
|
10631
10676
|
} else if (value === null) {
|
|
10632
|
-
|
|
10677
|
+
nn(null);
|
|
10633
10678
|
}
|
|
10634
10679
|
} finally {
|
|
10635
10680
|
inFlight = false;
|
|
@@ -11056,12 +11101,12 @@ function buildTelemetryObservers(flowId, observeLevel) {
|
|
|
11056
11101
|
const deploymentId = process.env.WALKEROS_DEPLOYMENT_ID;
|
|
11057
11102
|
if (!base || !token || !deploymentId) return void 0;
|
|
11058
11103
|
const url = `${base}/ingest/${deploymentId}`;
|
|
11059
|
-
const emit =
|
|
11104
|
+
const emit = on({ url, token });
|
|
11060
11105
|
const observe = observeLevel !== void 0 ? { level: observeLevel } : void 0;
|
|
11061
11106
|
return [
|
|
11062
11107
|
vt(
|
|
11063
11108
|
emit,
|
|
11064
|
-
() => bt({ flowId, observe, traceUntil:
|
|
11109
|
+
() => bt({ flowId, observe, traceUntil: tn() })
|
|
11065
11110
|
)
|
|
11066
11111
|
];
|
|
11067
11112
|
}
|
|
@@ -11071,7 +11116,7 @@ function buildObserveLevelSupplier(flowId, observeLevel) {
|
|
|
11071
11116
|
const opts = bt({
|
|
11072
11117
|
flowId,
|
|
11073
11118
|
observe,
|
|
11074
|
-
traceUntil:
|
|
11119
|
+
traceUntil: tn()
|
|
11075
11120
|
});
|
|
11076
11121
|
return opts ? opts.level ?? "standard" : "off";
|
|
11077
11122
|
};
|
|
@@ -11576,11 +11621,14 @@ init_config();
|
|
|
11576
11621
|
import chalk3 from "chalk";
|
|
11577
11622
|
|
|
11578
11623
|
// src/commands/validate/validators/contract.ts
|
|
11624
|
+
init_dist();
|
|
11579
11625
|
var SECTION_KEYS = ["globals", "context", "custom", "user", "consent"];
|
|
11580
11626
|
var KNOWN_KEYS = /* @__PURE__ */ new Set([
|
|
11581
11627
|
"extend",
|
|
11628
|
+
"tagging",
|
|
11582
11629
|
"description",
|
|
11583
11630
|
"events",
|
|
11631
|
+
"schema",
|
|
11584
11632
|
...SECTION_KEYS
|
|
11585
11633
|
]);
|
|
11586
11634
|
function validateContract(input) {
|
|
@@ -11598,7 +11646,19 @@ function validateContract(input) {
|
|
|
11598
11646
|
const contracts = input;
|
|
11599
11647
|
const contractNames = Object.keys(contracts);
|
|
11600
11648
|
details.contractCount = contractNames.length;
|
|
11649
|
+
for (const name of contractNames) {
|
|
11650
|
+
if (name.startsWith("$")) {
|
|
11651
|
+
errors.push({
|
|
11652
|
+
path: name,
|
|
11653
|
+
message: `"${name}" is not a named contract entry. This looks like the flat shape; use named ContractRule entries, lift $tagging to the rule field "tagging", and nest entity-action schemas under "events".`,
|
|
11654
|
+
code: "FLAT_CONTRACT_SHAPE"
|
|
11655
|
+
});
|
|
11656
|
+
}
|
|
11657
|
+
}
|
|
11601
11658
|
for (const [name, entry] of Object.entries(contracts)) {
|
|
11659
|
+
if (name.startsWith("$")) {
|
|
11660
|
+
continue;
|
|
11661
|
+
}
|
|
11602
11662
|
if (typeof entry !== "object" || entry === null) {
|
|
11603
11663
|
errors.push({
|
|
11604
11664
|
path: name,
|
|
@@ -11608,6 +11668,39 @@ function validateContract(input) {
|
|
|
11608
11668
|
continue;
|
|
11609
11669
|
}
|
|
11610
11670
|
const obj = entry;
|
|
11671
|
+
const keys = Object.keys(obj);
|
|
11672
|
+
const unknownKeys = keys.filter((k3) => !KNOWN_KEYS.has(k3));
|
|
11673
|
+
const hasKnownKey = keys.some((k3) => KNOWN_KEYS.has(k3));
|
|
11674
|
+
const objectValuedUnknown = unknownKeys.filter((k3) => de(obj[k3]));
|
|
11675
|
+
if (!hasKnownKey && objectValuedUnknown.length > 0) {
|
|
11676
|
+
errors.push({
|
|
11677
|
+
path: name,
|
|
11678
|
+
message: `Contract "${name}" looks like a flat entity-action map. Nest entity-action schemas under an "events" key of a named ContractRule.`,
|
|
11679
|
+
code: "FLAT_CONTRACT_SHAPE"
|
|
11680
|
+
});
|
|
11681
|
+
continue;
|
|
11682
|
+
}
|
|
11683
|
+
for (const key of unknownKeys) {
|
|
11684
|
+
warnings.push({
|
|
11685
|
+
path: `${name}.${key}`,
|
|
11686
|
+
message: `Unknown contract key "${key}" is ignored`,
|
|
11687
|
+
code: "UNKNOWN_CONTRACT_KEY"
|
|
11688
|
+
});
|
|
11689
|
+
}
|
|
11690
|
+
if (obj.tagging !== void 0 && typeof obj.tagging !== "number") {
|
|
11691
|
+
errors.push({
|
|
11692
|
+
path: `${name}.tagging`,
|
|
11693
|
+
message: "tagging must be a number",
|
|
11694
|
+
code: "INVALID_TAGGING"
|
|
11695
|
+
});
|
|
11696
|
+
}
|
|
11697
|
+
if (obj.schema !== void 0 && !de(obj.schema)) {
|
|
11698
|
+
errors.push({
|
|
11699
|
+
path: `${name}.schema`,
|
|
11700
|
+
message: "schema must be a JSON Schema object",
|
|
11701
|
+
code: "INVALID_SCHEMA"
|
|
11702
|
+
});
|
|
11703
|
+
}
|
|
11611
11704
|
if (obj.extend !== void 0) {
|
|
11612
11705
|
if (typeof obj.extend !== "string") {
|
|
11613
11706
|
errors.push({
|
|
@@ -12898,7 +12991,7 @@ function validateFlow(input, options = {}) {
|
|
|
12898
12991
|
transformersValue
|
|
12899
12992
|
)) {
|
|
12900
12993
|
if (!de(transformerValue)) continue;
|
|
12901
|
-
const result =
|
|
12994
|
+
const result = sr(transformerValue, "Transformer");
|
|
12902
12995
|
if (!result.ok) {
|
|
12903
12996
|
errors.push({
|
|
12904
12997
|
path: `flows.${flowName}.transformers.${name}`,
|
|
@@ -13359,7 +13452,7 @@ function validateMapping(input) {
|
|
|
13359
13452
|
// src/commands/validate/validators/entry.ts
|
|
13360
13453
|
init_dist();
|
|
13361
13454
|
import Ajv from "ajv";
|
|
13362
|
-
var CLIENT_HEADER = "walkeros-cli/4.3.0
|
|
13455
|
+
var CLIENT_HEADER = "walkeros-cli/4.3.0";
|
|
13363
13456
|
var SECTIONS = ["destinations", "sources", "transformers"];
|
|
13364
13457
|
function resolveEntry(path19, flowConfig) {
|
|
13365
13458
|
const flows = flowConfig.flows;
|
|
@@ -13435,7 +13528,7 @@ async function validateEntry(path19, flowConfig) {
|
|
|
13435
13528
|
}
|
|
13436
13529
|
let schemas;
|
|
13437
13530
|
try {
|
|
13438
|
-
const info = await
|
|
13531
|
+
const info = await bn(packageName, {
|
|
13439
13532
|
client: CLIENT_HEADER
|
|
13440
13533
|
});
|
|
13441
13534
|
schemas = info.schemas;
|
|
@@ -13696,8 +13789,8 @@ async function loginCommand(options) {
|
|
|
13696
13789
|
}
|
|
13697
13790
|
async function requestDeviceCode(options = {}) {
|
|
13698
13791
|
const appUrl = options.url || resolveAppUrl();
|
|
13699
|
-
const
|
|
13700
|
-
const response = await
|
|
13792
|
+
const f3 = options.fetch ?? globalThis.fetch;
|
|
13793
|
+
const response = await f3(`${appUrl}/api/auth/device/code`, {
|
|
13701
13794
|
method: "POST",
|
|
13702
13795
|
headers: { "Content-Type": "application/json" },
|
|
13703
13796
|
body: JSON.stringify({})
|
|
@@ -13726,7 +13819,7 @@ async function requestDeviceCode(options = {}) {
|
|
|
13726
13819
|
}
|
|
13727
13820
|
async function pollForToken(deviceCode, options = {}) {
|
|
13728
13821
|
const appUrl = options.url || resolveAppUrl();
|
|
13729
|
-
const
|
|
13822
|
+
const f3 = options.fetch ?? globalThis.fetch;
|
|
13730
13823
|
const timeoutMs = options.timeoutMs ?? DEFAULT_POLL_TIMEOUT_MS;
|
|
13731
13824
|
let intervalMs = options.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
13732
13825
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -13738,7 +13831,7 @@ async function pollForToken(deviceCode, options = {}) {
|
|
|
13738
13831
|
const timeoutHandle = setTimeout(() => controller.abort(), remaining);
|
|
13739
13832
|
let tokenResponse;
|
|
13740
13833
|
try {
|
|
13741
|
-
tokenResponse = await
|
|
13834
|
+
tokenResponse = await f3(`${appUrl}/api/auth/device/token`, {
|
|
13742
13835
|
method: "POST",
|
|
13743
13836
|
headers: { "Content-Type": "application/json" },
|
|
13744
13837
|
body: JSON.stringify({ deviceCode, hostname: hostname() }),
|
|
@@ -13850,7 +13943,7 @@ async function login(options = {}) {
|
|
|
13850
13943
|
const intervalMs = (interval ?? 5) * 1e3;
|
|
13851
13944
|
if (options.maxPollAttempts !== void 0) {
|
|
13852
13945
|
const appUrl = urlOption || resolveAppUrl();
|
|
13853
|
-
const
|
|
13946
|
+
const f3 = fetchOption;
|
|
13854
13947
|
let pollInterval = intervalMs;
|
|
13855
13948
|
let attempts = 0;
|
|
13856
13949
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -13862,7 +13955,7 @@ async function login(options = {}) {
|
|
|
13862
13955
|
const timeoutHandle = setTimeout(() => controller.abort(), remaining);
|
|
13863
13956
|
let tokenResponse;
|
|
13864
13957
|
try {
|
|
13865
|
-
tokenResponse = await
|
|
13958
|
+
tokenResponse = await f3(`${appUrl}/api/auth/device/token`, {
|
|
13866
13959
|
method: "POST",
|
|
13867
13960
|
headers: { "Content-Type": "application/json" },
|
|
13868
13961
|
body: JSON.stringify({ deviceCode, hostname: hostname() }),
|