@walkeros/cli 4.1.1-next-1779485810490 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -5
- package/dist/cli.js +1112 -901
- package/dist/index.d.ts +29 -1
- package/dist/index.js +144 -15
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/cli.js
CHANGED
|
@@ -120,16 +120,16 @@ function w(e4, t4) {
|
|
|
120
120
|
function E(e4) {
|
|
121
121
|
return { _meta: { hops: 0, path: [e4] } };
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function T(e4) {
|
|
124
124
|
throw new Error(String(e4));
|
|
125
125
|
}
|
|
126
126
|
function I(e4) {
|
|
127
127
|
const t4 = {}, n4 = /* @__PURE__ */ new Set();
|
|
128
128
|
function r4(o3) {
|
|
129
129
|
if (t4[o3]) return t4[o3];
|
|
130
|
-
n4.has(o3) &&
|
|
130
|
+
n4.has(o3) && T(`Circular extend chain detected: ${[...n4, o3].join(" \u2192 ")}`);
|
|
131
131
|
const i2 = e4[o3];
|
|
132
|
-
i2 ||
|
|
132
|
+
i2 || T(`Contract "${o3}" not found`), n4.add(o3);
|
|
133
133
|
let a4 = {};
|
|
134
134
|
if (i2.extend) {
|
|
135
135
|
a4 = (function(e5, t5) {
|
|
@@ -193,18 +193,18 @@ function z(e4, t4) {
|
|
|
193
193
|
}
|
|
194
194
|
function P(e4) {
|
|
195
195
|
const t4 = {};
|
|
196
|
-
for (const [n4, r4] of Object.entries(e4))
|
|
196
|
+
for (const [n4, r4] of Object.entries(e4)) C.has(n4) || (null === r4 || "object" != typeof r4 || Array.isArray(r4) ? t4[n4] = r4 : t4[n4] = P(r4));
|
|
197
197
|
return t4;
|
|
198
198
|
}
|
|
199
199
|
function M(e4) {
|
|
200
200
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function K(...e4) {
|
|
203
203
|
const t4 = {};
|
|
204
204
|
for (const n4 of e4) n4 && Object.assign(t4, n4);
|
|
205
205
|
return t4;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function q(e4, t4, n4) {
|
|
208
208
|
const r4 = `$flow.${e4}${t4 ? `.${t4}` : ""}`;
|
|
209
209
|
if ("unknown-flow" === n4) return `${r4} cannot resolve: flow "${e4}" does not exist in this config.`;
|
|
210
210
|
return `${r4} is empty. Set ${t4 ? `flows.${e4}.config.${t4}` : `flows.${e4}.config`}, or run \`walkeros deploy ${e4}\` first.`;
|
|
@@ -216,12 +216,12 @@ function B(e4, t4, n4) {
|
|
|
216
216
|
const i2 = r4[e5];
|
|
217
217
|
if (null == o3 || "object" != typeof o3) {
|
|
218
218
|
const o4 = r4.slice(0, e5).join(".");
|
|
219
|
-
|
|
219
|
+
T(`Path "${t4}" not found in "${n4}": "${i2}" does not exist${o4 ? ` in "${o4}"` : ""}`);
|
|
220
220
|
}
|
|
221
221
|
const a4 = o3;
|
|
222
222
|
if (!(i2 in a4)) {
|
|
223
223
|
const o4 = r4.slice(0, e5).join(".");
|
|
224
|
-
|
|
224
|
+
T(`Path "${t4}" not found in "${n4}": "${i2}" does not exist${o4 ? ` in "${o4}"` : ""}`);
|
|
225
225
|
}
|
|
226
226
|
o3 = a4[i2];
|
|
227
227
|
}
|
|
@@ -232,10 +232,10 @@ function J(e4, t4, n4, r4, o3, i2) {
|
|
|
232
232
|
const a4 = e4.match(R);
|
|
233
233
|
if (a4) {
|
|
234
234
|
const e5 = a4[1].split("."), s6 = e5[0], c3 = e5.slice(1).join(".");
|
|
235
|
-
void 0 === t4[s6] &&
|
|
235
|
+
void 0 === t4[s6] && T(`Variable "${s6}" not found`);
|
|
236
236
|
const l3 = i2 ?? /* @__PURE__ */ new Set();
|
|
237
237
|
if (l3.has(s6)) {
|
|
238
|
-
|
|
238
|
+
T(`Cyclic $var reference: ${[...l3, s6].join(" -> ")}`);
|
|
239
239
|
}
|
|
240
240
|
let u4;
|
|
241
241
|
l3.add(s6);
|
|
@@ -249,36 +249,36 @@ function J(e4, t4, n4, r4, o3, i2) {
|
|
|
249
249
|
const s5 = e4.match(U);
|
|
250
250
|
if (s5 && r4) {
|
|
251
251
|
const e5 = s5[1], t5 = s5[2];
|
|
252
|
-
e5 in r4 ||
|
|
252
|
+
e5 in r4 || T(`Contract "${e5}" not found`);
|
|
253
253
|
let n5 = r4[e5];
|
|
254
254
|
return t5 && (n5 = B(n5, t5, `$contract.${e5}`)), n5;
|
|
255
255
|
}
|
|
256
|
-
const c2 = e4.match(
|
|
256
|
+
const c2 = e4.match(Z);
|
|
257
257
|
if (c2) {
|
|
258
258
|
const t5 = c2[1], r5 = c2[2], i3 = false === n4?.strictFlowRefs;
|
|
259
|
-
o3 ||
|
|
259
|
+
o3 || T(`$flow.${t5}${r5 ? `.${r5}` : ""} cannot be resolved without a flow resolver`);
|
|
260
260
|
const a5 = o3(t5);
|
|
261
261
|
if (!a5) {
|
|
262
|
-
if (i3) return n4?.onWarning?.(
|
|
263
|
-
|
|
262
|
+
if (i3) return n4?.onWarning?.(q(t5, r5, "unknown-flow")), e4;
|
|
263
|
+
T(`Flow "${t5}" not found in $flow.${t5}`);
|
|
264
264
|
}
|
|
265
265
|
let s6 = a5;
|
|
266
266
|
if (r5) if (i3) {
|
|
267
267
|
try {
|
|
268
268
|
s6 = B(s6, r5, `$flow.${t5}`);
|
|
269
269
|
} catch {
|
|
270
|
-
return n4?.onWarning?.(
|
|
270
|
+
return n4?.onWarning?.(q(t5, r5, "missing-key")), e4;
|
|
271
271
|
}
|
|
272
|
-
if (null == s6 || "" === s6) return n4?.onWarning?.(
|
|
272
|
+
if (null == s6 || "" === s6) return n4?.onWarning?.(q(t5, r5, "missing-key")), e4;
|
|
273
273
|
} else s6 = B(s6, r5, `$flow.${t5}`);
|
|
274
274
|
return s6;
|
|
275
275
|
}
|
|
276
|
-
let l2 = e4.replace(
|
|
276
|
+
let l2 = e4.replace(D, (e5, a5) => {
|
|
277
277
|
const s6 = a5.split("."), c3 = s6[0], l3 = s6.slice(1).join(".");
|
|
278
|
-
void 0 === t4[c3] &&
|
|
278
|
+
void 0 === t4[c3] && T(`Variable "${c3}" not found`);
|
|
279
279
|
const u4 = i2 ?? /* @__PURE__ */ new Set();
|
|
280
280
|
if (u4.has(c3)) {
|
|
281
|
-
|
|
281
|
+
T(`Cyclic $var reference: ${[...u4, c3].join(" -> ")}`);
|
|
282
282
|
}
|
|
283
283
|
let f3;
|
|
284
284
|
u4.add(c3);
|
|
@@ -288,11 +288,11 @@ function J(e4, t4, n4, r4, o3, i2) {
|
|
|
288
288
|
u4.delete(c3);
|
|
289
289
|
}
|
|
290
290
|
if (l3 && (f3 = B(f3, l3, `$var.${c3}`)), null === f3 || "string" != typeof f3 && "number" != typeof f3 && "boolean" != typeof f3) {
|
|
291
|
-
|
|
291
|
+
T(`Variable "${a5}" resolves to non-scalar (${Array.isArray(f3) ? "array" : typeof f3}) and cannot be inlined into a string. Use it as a whole-string reference: "$var.${a5}"`);
|
|
292
292
|
}
|
|
293
293
|
return String(f3);
|
|
294
294
|
});
|
|
295
|
-
return l2 = l2.replace(
|
|
295
|
+
return l2 = l2.replace(F, (e5, t5, r5) => n4?.deferred ? void 0 !== r5 ? `${V}${t5}:${r5}` : `${V}${t5}` : "undefined" != typeof process && void 0 !== process.env?.[t5] ? process.env[t5] : void 0 !== r5 ? r5 : void T(`Environment variable "${t5}" not found and no default provided`)), l2;
|
|
296
296
|
}
|
|
297
297
|
if (Array.isArray(e4)) return e4.map((e5) => J(e5, t4, n4, r4, o3, i2));
|
|
298
298
|
if (null !== e4 && "object" == typeof e4) {
|
|
@@ -312,50 +312,50 @@ function X(e4, t4, n4) {
|
|
|
312
312
|
const s6 = e4.flows[t5];
|
|
313
313
|
if (s6) {
|
|
314
314
|
if (o3.has(t5)) {
|
|
315
|
-
|
|
315
|
+
T(`Cyclic $flow reference: ${[...i2, t5].join(" -> ")}`);
|
|
316
316
|
}
|
|
317
317
|
o3.add(t5), i2.push(t5);
|
|
318
318
|
try {
|
|
319
|
-
const o4 =
|
|
319
|
+
const o4 = K(e4.variables, s6.variables), i3 = J(s6.config ?? {}, o4, n4, void 0, a4);
|
|
320
320
|
return r4.set(t5, i3), i3;
|
|
321
321
|
} finally {
|
|
322
322
|
o3.delete(t5), i2.pop();
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
}, s5 = Object.keys(e4.flows);
|
|
326
|
-
t4 || (1 === s5.length ? t4 = s5[0] :
|
|
326
|
+
t4 || (1 === s5.length ? t4 = s5[0] : T(`Multiple flows found (${s5.join(", ")}). Please specify a flow.`));
|
|
327
327
|
const c2 = e4.flows[t4];
|
|
328
|
-
c2 ||
|
|
328
|
+
c2 || T(`Flow "${t4}" not found. Available: ${s5.join(", ")}`), o3.add(t4), i2.push(t4);
|
|
329
329
|
try {
|
|
330
330
|
return (function(e5, t5, n5, r5) {
|
|
331
331
|
const o4 = JSON.parse(JSON.stringify(t5));
|
|
332
332
|
let i3;
|
|
333
333
|
if (e5.contract) {
|
|
334
|
-
const o5 =
|
|
334
|
+
const o5 = K(e5.variables, t5.variables);
|
|
335
335
|
i3 = I(J(e5.contract, o5, n5, void 0, r5));
|
|
336
336
|
}
|
|
337
337
|
if (o4.config) {
|
|
338
|
-
const a5 =
|
|
338
|
+
const a5 = K(e5.variables, t5.variables);
|
|
339
339
|
o4.config = J(o4.config, a5, n5, i3, r5);
|
|
340
340
|
}
|
|
341
341
|
if (o4.sources) for (const [a5, s6] of Object.entries(o4.sources)) {
|
|
342
|
-
const c3 =
|
|
342
|
+
const c3 = K(e5.variables, t5.variables, s6.variables), l2 = J(s6.config, c3, n5, i3, r5), u4 = J(s6.env, c3, n5, i3, r5);
|
|
343
343
|
o4.sources[a5] = { package: s6.package, import: s6.import, config: l2, env: u4, primary: s6.primary, variables: s6.variables, before: s6.before, next: s6.next, cache: s6.cache, validate: s6.validate, code: s6.code };
|
|
344
344
|
}
|
|
345
345
|
if (o4.destinations) for (const [a5, s6] of Object.entries(o4.destinations)) {
|
|
346
|
-
const c3 =
|
|
346
|
+
const c3 = K(e5.variables, t5.variables, s6.variables), l2 = J(s6.config, c3, n5, i3, r5), u4 = J(s6.env, c3, n5, i3, r5);
|
|
347
347
|
o4.destinations[a5] = { package: s6.package, import: s6.import, config: l2, env: u4, variables: s6.variables, before: s6.before, next: s6.next, cache: s6.cache, validate: s6.validate, code: s6.code };
|
|
348
348
|
}
|
|
349
349
|
if (o4.stores) for (const [a5, s6] of Object.entries(o4.stores)) {
|
|
350
|
-
const c3 =
|
|
350
|
+
const c3 = K(e5.variables, t5.variables, s6.variables), l2 = J(s6.config, c3, n5, i3, r5), u4 = J(s6.env, c3, n5, i3, r5);
|
|
351
351
|
o4.stores[a5] = { package: s6.package, import: s6.import, config: l2, env: u4, cache: s6.cache, variables: s6.variables, code: s6.code };
|
|
352
352
|
}
|
|
353
353
|
if (o4.transformers) for (const [a5, s6] of Object.entries(o4.transformers)) {
|
|
354
|
-
const c3 =
|
|
354
|
+
const c3 = K(e5.variables, t5.variables, s6.variables), l2 = J(s6.config, c3, n5, i3, r5), u4 = J(s6.env, c3, n5, i3, r5);
|
|
355
355
|
o4.transformers[a5] = { package: s6.package, import: s6.import, config: l2, env: u4, variables: s6.variables, before: s6.before, next: s6.next, cache: s6.cache, validate: s6.validate, code: s6.code };
|
|
356
356
|
}
|
|
357
357
|
if (o4.collector) {
|
|
358
|
-
const a5 =
|
|
358
|
+
const a5 = K(e5.variables, t5.variables), s6 = J(o4.collector, a5, n5, i3, r5);
|
|
359
359
|
o4.collector = s6;
|
|
360
360
|
}
|
|
361
361
|
return o4;
|
|
@@ -367,7 +367,7 @@ function X(e4, t4, n4) {
|
|
|
367
367
|
function Y(e4) {
|
|
368
368
|
const t4 = e4.config?.platform;
|
|
369
369
|
if ("web" === t4 || "server" === t4) return t4;
|
|
370
|
-
|
|
370
|
+
T('Flow must have config.platform set to "web" or "server"');
|
|
371
371
|
}
|
|
372
372
|
function ee(e4, t4 = {}, n4 = {}) {
|
|
373
373
|
n4 = { ...Q, ...n4 };
|
|
@@ -556,12 +556,12 @@ function _e(e4, t4 = 1e3, n4 = false) {
|
|
|
556
556
|
f3 = [], d2(), e5.forEach((e6) => e6(void 0));
|
|
557
557
|
}, g3.size = () => p2, g3;
|
|
558
558
|
}
|
|
559
|
-
function
|
|
559
|
+
function Te(e4) {
|
|
560
560
|
return { message: e4.message, name: e4.name, stack: e4.stack, cause: e4.cause };
|
|
561
561
|
}
|
|
562
|
-
function
|
|
562
|
+
function Ce(e4, t4) {
|
|
563
563
|
let n4, r4 = {};
|
|
564
|
-
return e4 instanceof Error ? (n4 = e4.message, r4.error =
|
|
564
|
+
return e4 instanceof Error ? (n4 = e4.message, r4.error = Te(e4)) : n4 = e4, void 0 !== t4 && (t4 instanceof Error ? r4.error = Te(t4) : "object" == typeof t4 && null !== t4 ? (r4 = { ...r4, ...t4 }, "error" in r4 && r4.error instanceof Error && (r4.error = Te(r4.error))) : r4.value = t4), { message: n4, context: r4 };
|
|
565
565
|
}
|
|
566
566
|
function ze(e4 = {}) {
|
|
567
567
|
return Pe({ level: void 0 !== e4.level ? (function(e5) {
|
|
@@ -571,12 +571,12 @@ function ze(e4 = {}) {
|
|
|
571
571
|
function Pe(e4) {
|
|
572
572
|
const { level: t4, handler: n4, jsonHandler: r4, scope: o3 } = e4, i2 = (e5, r5, i3) => {
|
|
573
573
|
if (e5 <= t4) {
|
|
574
|
-
const t5 =
|
|
574
|
+
const t5 = Ce(r5, i3);
|
|
575
575
|
n4 ? n4(e5, t5.message, t5.context, o3, Ie) : Ie(e5, t5.message, t5.context, o3);
|
|
576
576
|
}
|
|
577
577
|
};
|
|
578
578
|
return { error: (e5, t5) => i2(0, e5, t5), warn: (e5, t5) => i2(1, e5, t5), info: (e5, t5) => i2(2, e5, t5), debug: (e5, t5) => i2(3, e5, t5), throw: (e5, t5) => {
|
|
579
|
-
const r5 =
|
|
579
|
+
const r5 = Ce(e5, t5);
|
|
580
580
|
throw n4 ? n4(0, r5.message, r5.context, o3, Ie) : Ie(0, r5.message, r5.context, o3), new Error(r5.message);
|
|
581
581
|
}, json: (e5) => {
|
|
582
582
|
r4 ? r4(e5) : console.log(JSON.stringify(e5, null, 2));
|
|
@@ -585,10 +585,10 @@ function Pe(e4) {
|
|
|
585
585
|
function Me(e4) {
|
|
586
586
|
return re(e4) || fe(e4) || ce(e4) || !ie(e4) || ne(e4) && e4.every(Me) || le(e4) && Object.values(e4).every(Me);
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function De(e4) {
|
|
589
589
|
return Me(e4) ? e4 : void 0;
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function Fe(e4, t4, n4) {
|
|
592
592
|
return function(...r4) {
|
|
593
593
|
try {
|
|
594
594
|
return e4(...r4);
|
|
@@ -636,7 +636,7 @@ async function He(e4, t4 = {}, n4 = {}) {
|
|
|
636
636
|
const i2 = { event: o3, mapping: t4, collector: n4.collector, logger: n4.collector.logger, consent: r4 }, a4 = ne(t4) ? t4 : [t4];
|
|
637
637
|
for (const t5 of a4) {
|
|
638
638
|
const r5 = await Ue(Le, (e5) => {
|
|
639
|
-
if (e5 instanceof
|
|
639
|
+
if (e5 instanceof Ze) throw e5;
|
|
640
640
|
n4.collector && n4.collector.status.failed++, i2.logger.error("mapping processing failed", { event: o3, error: e5 });
|
|
641
641
|
})(e4, t5, { ...i2, mapping: t5 });
|
|
642
642
|
if (ie(r5)) return r5;
|
|
@@ -650,13 +650,13 @@ async function Le(e4, t4, n4) {
|
|
|
650
650
|
if (!Object.keys(i2).length) return;
|
|
651
651
|
const { condition: a4, consent: s5, fn: c2, key: l2, loop: u4, map: f3, set: p2, validate: d2, value: m3 } = i2, g3 = { ...n4, mapping: r4 };
|
|
652
652
|
if (a4 && !await Ue(a4, (e5) => {
|
|
653
|
-
if (e5 instanceof
|
|
653
|
+
if (e5 instanceof Ze) throw e5;
|
|
654
654
|
return g3.logger.error("mapping condition failed", { event: g3.event, error: e5 }), false;
|
|
655
655
|
})(e4, g3)) return;
|
|
656
656
|
if (s5 && !be(s5, g3.consent)) return m3;
|
|
657
657
|
let y2 = ie(m3) ? m3 : e4;
|
|
658
658
|
if (c2 && (y2 = await Ue(c2, (e5) => {
|
|
659
|
-
if (e5 instanceof
|
|
659
|
+
if (e5 instanceof Ze) throw e5;
|
|
660
660
|
g3.logger.error("mapping fn failed", { event: g3.event, error: e5 });
|
|
661
661
|
})(e4, g3)), l2 && (y2 = de(e4, l2, m3)), u4) {
|
|
662
662
|
const [t6, n5] = u4, r5 = "this" === t6 ? [e4] : await He(e4, t6, g3);
|
|
@@ -666,14 +666,14 @@ async function Le(e4, t4, n4) {
|
|
|
666
666
|
return ie(i3) && (o4[n5] = i3), o4;
|
|
667
667
|
}, Promise.resolve({})) : p2 && (y2 = await Promise.all(p2.map((t6) => Le(e4, t6, g3))));
|
|
668
668
|
d2 && !await Ue(d2, (e5) => {
|
|
669
|
-
if (e5 instanceof
|
|
669
|
+
if (e5 instanceof Ze) throw e5;
|
|
670
670
|
return g3.logger.error("mapping validate failed", { event: g3.event, error: e5 }), false;
|
|
671
671
|
})(y2, g3) && (y2 = void 0);
|
|
672
|
-
const h3 =
|
|
673
|
-
return ie(h3) ? h3 :
|
|
672
|
+
const h3 = De(y2);
|
|
673
|
+
return ie(h3) ? h3 : De(m3);
|
|
674
674
|
}, Promise.resolve(void 0));
|
|
675
675
|
}
|
|
676
|
-
async function
|
|
676
|
+
async function Ke(e4, t4, n4) {
|
|
677
677
|
t4.policy && await Promise.all(Object.entries(t4.policy).map(async ([t5, r5]) => {
|
|
678
678
|
const o4 = await He(e4, r5, { collector: n4, event: e4 });
|
|
679
679
|
e4 = me(e4, t5, o4);
|
|
@@ -707,29 +707,92 @@ function tt(e4 = {}) {
|
|
|
707
707
|
return ee({ "Content-Type": "application/json; charset=utf-8" }, e4);
|
|
708
708
|
}
|
|
709
709
|
function ot(e4, t4, n4, r4) {
|
|
710
|
-
|
|
710
|
+
const o3 = e4;
|
|
711
|
+
return function(...e5) {
|
|
711
712
|
let i2;
|
|
712
|
-
const a4 = "pre" + t4, s5 = "post" + t4, c2 = n4[a4], l2 = n4[s5], u4 = (
|
|
713
|
-
r4 ? r4.warn(
|
|
713
|
+
const a4 = "pre" + t4, s5 = "post" + t4, c2 = n4[a4], l2 = n4[s5], u4 = (e6, t5) => {
|
|
714
|
+
r4 ? r4.warn(e6, { error: t5 }) : console.warn(e6, t5);
|
|
714
715
|
};
|
|
715
716
|
if (c2) try {
|
|
716
|
-
i2 = c2({ fn:
|
|
717
|
+
i2 = c2({ fn: o3 }, ...e5);
|
|
717
718
|
} catch (t5) {
|
|
718
|
-
u4(`Hook ${String(a4)} failed, falling back to original function`, t5), i2 =
|
|
719
|
+
u4(`Hook ${String(a4)} failed, falling back to original function`, t5), i2 = o3(...e5);
|
|
719
720
|
}
|
|
720
|
-
else i2 =
|
|
721
|
+
else i2 = o3(...e5);
|
|
721
722
|
if (l2) try {
|
|
722
|
-
i2 = l2({ fn:
|
|
723
|
-
} catch (
|
|
724
|
-
u4(`Hook ${String(s5)} failed, keeping original result`,
|
|
723
|
+
i2 = l2({ fn: o3, result: i2 }, ...e5);
|
|
724
|
+
} catch (e6) {
|
|
725
|
+
u4(`Hook ${String(s5)} failed, keeping original result`, e6);
|
|
725
726
|
}
|
|
726
727
|
return i2;
|
|
727
728
|
};
|
|
728
729
|
}
|
|
729
|
-
function
|
|
730
|
+
function it(e4, t4) {
|
|
731
|
+
if (t4 >= 1) return true;
|
|
732
|
+
if (t4 <= 0) return false;
|
|
733
|
+
return (function(e5) {
|
|
734
|
+
let t5 = 2166136261;
|
|
735
|
+
for (let n4 = 0; n4 < e5.length; n4++) t5 ^= e5.charCodeAt(n4), t5 = t5 + ((t5 << 1) + (t5 << 4) + (t5 << 7) + (t5 << 8) + (t5 << 24)) >>> 0;
|
|
736
|
+
return t5 >>> 0;
|
|
737
|
+
})(e4) / 4294967295 < t4;
|
|
738
|
+
}
|
|
739
|
+
function at(e4, t4) {
|
|
740
|
+
const n4 = "function" == typeof t4 ? t4 : () => t4;
|
|
741
|
+
return function(t5) {
|
|
742
|
+
const r4 = n4();
|
|
743
|
+
if (!r4) return;
|
|
744
|
+
const o3 = r4.level ?? "standard";
|
|
745
|
+
if ("off" === o3) return;
|
|
746
|
+
const i2 = r4.sample, a4 = "number" == typeof i2 && Number.isFinite(i2) ? i2 : 1;
|
|
747
|
+
if (t5.eventId && !it(t5.eventId, a4)) return;
|
|
748
|
+
const s5 = r4.includeIn ?? "trace" === o3, c2 = r4.includeOut ?? "trace" === o3, l2 = r4.includeMappingKey ?? "trace" === o3, u4 = { ...t5 };
|
|
749
|
+
s5 || delete u4.inEvent, c2 || delete u4.outEvent, l2 || delete u4.mappingKey, "trace" !== o3 && u4.error?.message && u4.error.message.length > 256 && (u4.error = { ...u4.error, message: u4.error.message.slice(0, 256) + "\u2026" });
|
|
750
|
+
try {
|
|
751
|
+
e4(u4);
|
|
752
|
+
} catch {
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
function ct(e4) {
|
|
757
|
+
const t4 = e4.env ?? ("undefined" != typeof process ? process.env : {}), n4 = e4.now ?? (() => Date.now()), r4 = t4.WALKEROS_TRACE_UNTIL;
|
|
758
|
+
if ("string" == typeof r4 && r4.length > 0) {
|
|
759
|
+
const t5 = Date.parse(r4);
|
|
760
|
+
if (!Number.isNaN(t5) && t5 > n4()) return { flowId: e4.flowId, level: "trace", includeIn: true, includeOut: true, sample: 1 };
|
|
761
|
+
}
|
|
762
|
+
const o3 = e4.observe?.level ?? "standard";
|
|
763
|
+
if ("off" === o3) return null;
|
|
764
|
+
const i2 = e4.observe?.sample ?? 1;
|
|
765
|
+
return { flowId: e4.flowId, level: o3, sample: i2 };
|
|
766
|
+
}
|
|
767
|
+
function lt(e4, t4) {
|
|
768
|
+
if (0 === e4.observers.size) return;
|
|
769
|
+
const n4 = Array.from(e4.observers);
|
|
770
|
+
for (const e5 of n4) try {
|
|
771
|
+
e5(t4);
|
|
772
|
+
} catch {
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
function ut(e4) {
|
|
776
|
+
const t4 = e4.batchMs, n4 = "number" == typeof t4 && Number.isFinite(t4) && t4 > 0 ? Math.floor(t4) : 50, r4 = e4.batchSize, o3 = "number" == typeof r4 && Number.isFinite(r4) && r4 >= 1 ? Math.floor(r4) : 50, i2 = e4.fetch ?? ((e5, t5) => globalThis.fetch(e5, t5)), a4 = e4.onError ?? (() => {
|
|
777
|
+
});
|
|
778
|
+
let s5 = [], c2 = null;
|
|
779
|
+
function l2() {
|
|
780
|
+
if (0 === s5.length) return;
|
|
781
|
+
const t5 = s5;
|
|
782
|
+
s5 = [], c2 && (clearTimeout(c2), c2 = null), Promise.resolve().then(() => i2(e4.url, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${e4.token}` }, body: JSON.stringify(t5) })).then((e5) => {
|
|
783
|
+
e5 && "object" == typeof e5 && "ok" in e5 && !e5.ok && a4(new Error(`Observer responded ${e5.status}`));
|
|
784
|
+
}).catch((e5) => {
|
|
785
|
+
a4(e5);
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
return (e5) => {
|
|
789
|
+
s5.push(e5), s5.length >= o3 ? l2() : null === c2 && (c2 = setTimeout(l2, n4));
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
function kt(e4) {
|
|
730
793
|
return "string" == typeof e4 || Array.isArray(e4) && e4.every((e5) => "string" == typeof e5) ? e4 : void 0;
|
|
731
794
|
}
|
|
732
|
-
async function
|
|
795
|
+
async function $t(e4, t4) {
|
|
733
796
|
const n4 = t4?.version || "latest", r4 = t4?.timeout || 1e4, o3 = new AbortController(), i2 = setTimeout(() => o3.abort(), r4), a4 = o3.signal, s5 = t4?.client ? { "X-Walkeros-Client": t4.client } : void 0;
|
|
734
797
|
try {
|
|
735
798
|
if (t4?.baseUrl) {
|
|
@@ -740,7 +803,7 @@ async function yt(e4, t4) {
|
|
|
740
803
|
return { packageName: n5.package || e5, version: "string" == typeof n5.version ? n5.version : t5, ...void 0 !== n5.description && { description: n5.description }, ...void 0 !== n5.type && { type: n5.type }, ...void 0 !== c2 && { platform: c2 }, schemas: r7, examples: o6, ...void 0 !== n5.docs && { docs: n5.docs }, ...void 0 !== n5.source && { source: n5.source }, ...i3 && Object.keys(i3).length > 0 ? { hints: i3 } : {}, hintKeys: a5, exampleSummaries: s6 };
|
|
741
804
|
})(e4, n4, await o5.json());
|
|
742
805
|
}
|
|
743
|
-
const r5 = `https://cdn.jsdelivr.net/npm/${e4}@${n4}`, o4 = await
|
|
806
|
+
const r5 = `https://cdn.jsdelivr.net/npm/${e4}@${n4}`, o4 = await jt(`${r5}/package.json`, a4, s5);
|
|
744
807
|
return (function(e5, t5, n5, r6) {
|
|
745
808
|
const o5 = r6.$meta || {}, i3 = r6.schemas || {}, a5 = r6.examples || {}, s6 = r6.hints, c2 = s6 ? Object.keys(s6) : [], l2 = [], u4 = a5.step || {};
|
|
746
809
|
for (const [e6, t6] of Object.entries(u4)) {
|
|
@@ -748,29 +811,29 @@ async function yt(e4, t4) {
|
|
|
748
811
|
"string" == typeof n6?.description && (r7.description = n6.description), l2.push(r7);
|
|
749
812
|
}
|
|
750
813
|
const f3 = "string" == typeof o5.docs ? o5.docs : void 0, p2 = "string" == typeof o5.source ? o5.source : void 0;
|
|
751
|
-
return { packageName: e5, version: "string" == typeof n5.version ? n5.version : t5, description: "string" == typeof n5.description ? n5.description : void 0, type: "string" == typeof o5.type ? o5.type : void 0, platform:
|
|
752
|
-
})(e4, n4, o4, await
|
|
814
|
+
return { packageName: e5, version: "string" == typeof n5.version ? n5.version : t5, description: "string" == typeof n5.description ? n5.description : void 0, type: "string" == typeof o5.type ? o5.type : void 0, platform: kt(o5.platform), schemas: i3, examples: a5, ...f3 ? { docs: f3 } : {}, ...p2 ? { source: p2 } : {}, ...s6 && Object.keys(s6).length > 0 ? { hints: s6 } : {}, hintKeys: c2, exampleSummaries: l2 };
|
|
815
|
+
})(e4, n4, o4, await jt(`${r5}/dist/walkerOS.json`, a4, s5));
|
|
753
816
|
} finally {
|
|
754
817
|
clearTimeout(i2);
|
|
755
818
|
}
|
|
756
819
|
}
|
|
757
|
-
async function
|
|
820
|
+
async function jt(e4, t4, n4) {
|
|
758
821
|
const r4 = await fetch(e4, { signal: t4, ...n4 && { headers: n4 } });
|
|
759
822
|
if (!r4.ok) throw new Error(`Failed to fetch ${e4} (HTTP ${r4.status})`);
|
|
760
823
|
return await r4.json();
|
|
761
824
|
}
|
|
762
|
-
async function
|
|
763
|
-
const n4 = await
|
|
825
|
+
async function xt(e4, t4) {
|
|
826
|
+
const n4 = await $t(e4, t4);
|
|
764
827
|
return { packageName: n4.packageName, version: n4.version, type: n4.type, platform: n4.platform, schemas: n4.schemas, examples: n4.examples, ...n4.hints ? { hints: n4.hints } : {} };
|
|
765
828
|
}
|
|
766
|
-
function
|
|
829
|
+
function Et(e4) {
|
|
767
830
|
if (void 0 === e4 || "*" === e4) return () => true;
|
|
768
831
|
if ("and" in e4) {
|
|
769
|
-
const t4 = e4.and.map(
|
|
832
|
+
const t4 = e4.and.map(Et);
|
|
770
833
|
return (e5) => t4.every((t5) => t5(e5));
|
|
771
834
|
}
|
|
772
835
|
if ("or" in e4) {
|
|
773
|
-
const t4 = e4.or.map(
|
|
836
|
+
const t4 = e4.or.map(Et);
|
|
774
837
|
return (e5) => t4.some((t5) => t5(e5));
|
|
775
838
|
}
|
|
776
839
|
return (function(e5) {
|
|
@@ -806,69 +869,69 @@ function $t(e4) {
|
|
|
806
869
|
};
|
|
807
870
|
})(e4);
|
|
808
871
|
}
|
|
809
|
-
function
|
|
872
|
+
function _t(e4) {
|
|
810
873
|
return Array.isArray(e4) && e4.length > 0 && e4.every((e5) => (function(e6) {
|
|
811
874
|
return "object" == typeof e6 && null !== e6 && !Array.isArray(e6) && ("match" in e6 || "next" in e6 || "one" in e6 || "many" in e6);
|
|
812
875
|
})(e5));
|
|
813
876
|
}
|
|
814
|
-
function
|
|
877
|
+
function Nt(e4) {
|
|
815
878
|
return e4.map((e5) => {
|
|
816
879
|
if ("string" == typeof e5) return { match: () => true, next: { type: "static", value: e5 } };
|
|
817
|
-
if (Array.isArray(e5)) return { match: () => true, next:
|
|
880
|
+
if (Array.isArray(e5)) return { match: () => true, next: Tt(e5) ?? { type: "chain", value: [] } };
|
|
818
881
|
const t4 = e5;
|
|
819
|
-
return { match: t4.match ?
|
|
882
|
+
return { match: t4.match ? Et(t4.match) : () => true, next: Tt(t4) ?? { type: "chain", value: [] } };
|
|
820
883
|
});
|
|
821
884
|
}
|
|
822
|
-
function
|
|
885
|
+
function Tt(e4) {
|
|
823
886
|
if (null == e4) return;
|
|
824
887
|
if ("string" == typeof e4) return { type: "static", value: e4 };
|
|
825
888
|
if (Array.isArray(e4)) {
|
|
826
889
|
if (0 === e4.length) return;
|
|
827
|
-
if (
|
|
890
|
+
if (_t(e4)) return Tt({ one: e4 });
|
|
828
891
|
if (e4.every((e5) => "string" == typeof e5)) return { type: "chain", value: e4 };
|
|
829
892
|
const t5 = [];
|
|
830
893
|
for (const n4 of e4) {
|
|
831
|
-
const e5 =
|
|
894
|
+
const e5 = Tt(n4);
|
|
832
895
|
void 0 !== e5 && t5.push(e5);
|
|
833
896
|
}
|
|
834
897
|
if (0 === t5.length) return;
|
|
835
898
|
return { type: "sequence", value: t5 };
|
|
836
899
|
}
|
|
837
900
|
const t4 = e4;
|
|
838
|
-
if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match:
|
|
901
|
+
if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match: Et(t4.match), next: Tt(t4.next) } : Tt(t4.next);
|
|
839
902
|
if ("one" in t4 && t4.one) {
|
|
840
|
-
const e5 =
|
|
841
|
-
return t4.match ? { type: "gate", match:
|
|
903
|
+
const e5 = Nt(t4.one);
|
|
904
|
+
return t4.match ? { type: "gate", match: Et(t4.match), next: { type: "one", routes: e5 } } : { type: "one", routes: e5 };
|
|
842
905
|
}
|
|
843
906
|
if ("many" in t4 && t4.many) {
|
|
844
|
-
const e5 =
|
|
845
|
-
return t4.match ? { type: "gate", match:
|
|
907
|
+
const e5 = Nt(t4.many);
|
|
908
|
+
return t4.match ? { type: "gate", match: Et(t4.match), next: { type: "many", routes: e5 } } : { type: "many", routes: e5 };
|
|
846
909
|
}
|
|
847
|
-
return t4.match ? { type: "gate", match:
|
|
910
|
+
return t4.match ? { type: "gate", match: Et(t4.match) } : void 0;
|
|
848
911
|
}
|
|
849
|
-
function
|
|
912
|
+
function It(e4, t4 = {}) {
|
|
850
913
|
if (null == e4) return [];
|
|
851
914
|
let n4;
|
|
852
915
|
if ("object" == typeof e4) {
|
|
853
|
-
const t5 =
|
|
854
|
-
t5 ? n4 = t5 : (n4 =
|
|
855
|
-
} else n4 =
|
|
916
|
+
const t5 = Ct.get(e4);
|
|
917
|
+
t5 ? n4 = t5 : (n4 = Tt(e4), n4 && Ct.set(e4, n4));
|
|
918
|
+
} else n4 = Tt(e4);
|
|
856
919
|
if (!n4) return [];
|
|
857
|
-
const r4 =
|
|
920
|
+
const r4 = zt(n4, t4);
|
|
858
921
|
return void 0 === r4 ? [] : Array.isArray(r4) ? r4 : [r4];
|
|
859
922
|
}
|
|
860
|
-
function
|
|
923
|
+
function zt(e4, t4 = {}) {
|
|
861
924
|
if (e4) {
|
|
862
925
|
if ("static" === e4.type) return e4.value;
|
|
863
926
|
if ("chain" === e4.type) return e4.value;
|
|
864
927
|
if ("gate" === e4.type) {
|
|
865
928
|
if (!e4.match(t4)) return;
|
|
866
|
-
return
|
|
929
|
+
return zt(e4.next, t4);
|
|
867
930
|
}
|
|
868
931
|
if ("sequence" === e4.type) {
|
|
869
932
|
const n4 = [];
|
|
870
933
|
for (const r4 of e4.value) {
|
|
871
|
-
const e5 =
|
|
934
|
+
const e5 = zt(r4, t4);
|
|
872
935
|
void 0 !== e5 && (Array.isArray(e5) ? n4.push(...e5) : n4.push(e5));
|
|
873
936
|
}
|
|
874
937
|
return n4.length > 0 ? n4 : void 0;
|
|
@@ -877,22 +940,22 @@ function Et(e4, t4 = {}) {
|
|
|
877
940
|
const n4 = [];
|
|
878
941
|
for (const r4 of e4.routes) {
|
|
879
942
|
if (!r4.match(t4)) continue;
|
|
880
|
-
const e5 =
|
|
943
|
+
const e5 = zt(r4.next, t4);
|
|
881
944
|
void 0 !== e5 && (Array.isArray(e5) ? n4.push(...e5) : n4.push(e5));
|
|
882
945
|
}
|
|
883
946
|
return n4.length > 0 ? n4 : void 0;
|
|
884
947
|
}
|
|
885
|
-
for (const n4 of e4.routes) if (n4.match(t4)) return
|
|
948
|
+
for (const n4 of e4.routes) if (n4.match(t4)) return zt(n4.next, t4);
|
|
886
949
|
}
|
|
887
950
|
}
|
|
888
|
-
function
|
|
951
|
+
function Pt(e4, t4) {
|
|
889
952
|
const n4 = { ingest: e4 ?? {} };
|
|
890
953
|
return void 0 !== t4 && (n4.event = t4), n4;
|
|
891
954
|
}
|
|
892
|
-
function
|
|
893
|
-
return { stop: e4.stop ?? false, storeId: e4.store, namespace: e4.namespace, rules: e4.rules.map((e5) => ({ match: e5.match ?
|
|
955
|
+
function Mt(e4) {
|
|
956
|
+
return { stop: e4.stop ?? false, storeId: e4.store, namespace: e4.namespace, rules: e4.rules.map((e5) => ({ match: e5.match ? Et(e5.match) : () => true, key: e5.key, ttl: e5.ttl, update: e5.update })) };
|
|
894
957
|
}
|
|
895
|
-
async function
|
|
958
|
+
async function Rt(e4, t4, n4, r4) {
|
|
896
959
|
const o3 = e4.rules.find((e5) => e5.match(n4));
|
|
897
960
|
if (!o3) return null;
|
|
898
961
|
const i2 = o3.key.map((e5) => String(de(n4, e5) ?? ""));
|
|
@@ -900,10 +963,10 @@ async function Ct(e4, t4, n4, r4) {
|
|
|
900
963
|
const a4 = i2.join(":"), s5 = r4 ?? e4.namespace, c2 = s5 ? `${s5}:${a4}` : a4, l2 = await t4.get(c2);
|
|
901
964
|
return void 0 !== l2 ? { status: "HIT", key: c2, value: l2, rule: o3 } : { status: "MISS", key: c2, rule: o3 };
|
|
902
965
|
}
|
|
903
|
-
function
|
|
966
|
+
function Dt(e4, t4, n4, r4) {
|
|
904
967
|
e4.set(t4, n4, 1e3 * r4);
|
|
905
968
|
}
|
|
906
|
-
async function
|
|
969
|
+
async function Ft(e4, t4, n4, r4) {
|
|
907
970
|
if (!t4) return e4;
|
|
908
971
|
let o3 = e4;
|
|
909
972
|
for (const [e5, i2] of Object.entries(t4)) {
|
|
@@ -911,18 +974,18 @@ async function It(e4, t4, n4, r4) {
|
|
|
911
974
|
}
|
|
912
975
|
return o3;
|
|
913
976
|
}
|
|
914
|
-
function
|
|
977
|
+
function Lt(e4, t4) {
|
|
915
978
|
const n4 = (function(e5) {
|
|
916
|
-
return /* @__PURE__ */ new Set([...
|
|
979
|
+
return /* @__PURE__ */ new Set([...Ut[e5], ...Zt, ...Wt[e5]]);
|
|
917
980
|
})(t4);
|
|
918
981
|
for (const r5 of Object.keys(e4)) if (!n4.has(r5)) return { ok: false, code: "UNKNOWN_KEY", key: r5, reason: `Unknown key "${r5}" on ${t4}. Allowed: ${[...n4].sort().join(", ")}.` };
|
|
919
982
|
const r4 = void 0 !== e4.package, o3 = void 0 !== e4.import, i2 = void 0 !== e4.code;
|
|
920
|
-
return i2 && "string" == typeof e4.code ? { ok: false, code: "OBSOLETE_CODE_STRING", key: "code", reason: `code: "<name>" is no longer supported. Use import: "${e4.code}" with the package field instead.` } : i2 && ("object" != typeof e4.code && "function" != typeof e4.code || null === e4.code || Array.isArray(e4.code)) ? { ok: false, code: "INVALID_CODE_SHAPE", key: "code", reason: "code must be an object ({ push, type?, init? }) or a resolved function value." } : i2 && r4 ? { ok: false, code: "CONFLICT", key: "package", reason: "Cannot specify both `code` and `package`. Use one or the other." } : i2 && o3 ? { ok: false, code: "CONFLICT", key: "import", reason: "Cannot specify both `code` and `import`." } : o3 && !r4 ? { ok: false, code: "MISSING_PACKAGE", key: "import", reason: "`import` requires `package` to be set." } : !o3 || "string" == typeof e4.import &&
|
|
983
|
+
return i2 && "string" == typeof e4.code ? { ok: false, code: "OBSOLETE_CODE_STRING", key: "code", reason: `code: "<name>" is no longer supported. Use import: "${e4.code}" with the package field instead.` } : i2 && ("object" != typeof e4.code && "function" != typeof e4.code || null === e4.code || Array.isArray(e4.code)) ? { ok: false, code: "INVALID_CODE_SHAPE", key: "code", reason: "code must be an object ({ push, type?, init? }) or a resolved function value." } : i2 && r4 ? { ok: false, code: "CONFLICT", key: "package", reason: "Cannot specify both `code` and `package`. Use one or the other." } : i2 && o3 ? { ok: false, code: "CONFLICT", key: "import", reason: "Cannot specify both `code` and `import`." } : o3 && !r4 ? { ok: false, code: "MISSING_PACKAGE", key: "import", reason: "`import` requires `package` to be set." } : !o3 || "string" == typeof e4.import && Ht.test(e4.import) ? { ok: true } : { ok: false, code: "INVALID_IMPORT", key: "import", reason: `import must match ${Ht.source}. Got: ${JSON.stringify(e4.import)}.` };
|
|
921
984
|
}
|
|
922
|
-
function
|
|
985
|
+
function Kt(e4, t4) {
|
|
923
986
|
return "Transformer" === t4 && (void 0 === e4.code && void 0 === e4.package && void 0 === e4.import && (void 0 !== e4.before || void 0 !== e4.next || void 0 !== e4.cache || void 0 !== e4.mapping));
|
|
924
987
|
}
|
|
925
|
-
var e, t, r, a, u, f, m, h, b,
|
|
988
|
+
var e, t, r, a, u, f, m, h, b, C, R, D, F, U, Z, V, Q, ye, Ie, Ze, Ct, Ut, Zt, Wt, Ht;
|
|
926
989
|
var init_dist = __esm({
|
|
927
990
|
"../core/dist/index.mjs"() {
|
|
928
991
|
"use strict";
|
|
@@ -943,29 +1006,29 @@ var init_dist = __esm({
|
|
|
943
1006
|
t(h, { getSource: () => v });
|
|
944
1007
|
b = {};
|
|
945
1008
|
t(b, { getStore: () => w });
|
|
946
|
-
|
|
1009
|
+
C = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
|
|
947
1010
|
R = /^\$var\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)$/;
|
|
948
|
-
|
|
949
|
-
|
|
1011
|
+
D = /\$var\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)/g;
|
|
1012
|
+
F = /\$env\.([a-zA-Z_][a-zA-Z0-9_]*)(?::([^"}\s]*))?/g;
|
|
950
1013
|
U = /^\$contract\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.(.+))?$/;
|
|
951
|
-
|
|
952
|
-
|
|
1014
|
+
Z = /^\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?$/;
|
|
1015
|
+
V = "__WALKEROS_ENV:";
|
|
953
1016
|
Q = { merge: true, shallow: true, extend: true };
|
|
954
1017
|
ye = { data: (e4) => e4.data, globals: (e4) => e4.globals, context: (e4) => e4.context, user: (e4) => e4.user, source: (e4) => e4.source, event: (e4) => ({ entity: e4.entity, action: e4.action, id: e4.id, timestamp: e4.timestamp, name: e4.name, trigger: e4.trigger, timing: e4.timing }) };
|
|
955
1018
|
Ie = (e4, t4, n4, r4) => {
|
|
956
1019
|
const o3 = `${f[e4]}${r4.length > 0 ? ` [${r4.join(":")}]` : ""}`, i2 = Object.keys(n4).length > 0, a4 = 0 === e4 ? console.error : 1 === e4 ? console.warn : console.log;
|
|
957
1020
|
i2 ? a4(o3, t4, n4) : a4(o3, t4);
|
|
958
1021
|
};
|
|
959
|
-
|
|
1022
|
+
Ze = class e2 extends Error {
|
|
960
1023
|
constructor(t4, n4) {
|
|
961
1024
|
super(t4, n4), this.name = "FatalError", Object.setPrototypeOf(this, e2.prototype);
|
|
962
1025
|
}
|
|
963
1026
|
};
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1027
|
+
Ct = /* @__PURE__ */ new WeakMap();
|
|
1028
|
+
Ut = { Source: ["code", "package", "import", "before", "next", "cache"], Transformer: ["code", "package", "import", "before", "next", "cache", "mapping"], Destination: ["code", "package", "import", "before", "next", "cache"], Store: ["code", "package", "import", "cache"] };
|
|
1029
|
+
Zt = ["config", "env", "validate", "variables", "examples", "disabled", "id", "logger", "mock", "chainMocks"];
|
|
1030
|
+
Wt = { Source: ["primary"], Transformer: [], Destination: [], Store: [] };
|
|
1031
|
+
Ht = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
969
1032
|
}
|
|
970
1033
|
});
|
|
971
1034
|
|
|
@@ -981,7 +1044,7 @@ function a2(a4, n4, u4 = {}) {
|
|
|
981
1044
|
e5.on("data", (t5) => {
|
|
982
1045
|
r4.push(t5);
|
|
983
1046
|
}), e5.on("end", () => {
|
|
984
|
-
const s5 = !!(e5.statusCode && e5.statusCode >= 200 && e5.statusCode < 300), a5 = Buffer.concat(r4).toString(), n6 =
|
|
1047
|
+
const s5 = !!(e5.statusCode && e5.statusCode >= 200 && e5.statusCode < 300), a5 = Buffer.concat(r4).toString(), n6 = Fe(JSON.parse, () => a5)(a5);
|
|
985
1048
|
t4({ ok: s5, data: n6, error: s5 ? void 0 : `${e5.statusCode} ${e5.statusMessage}` });
|
|
986
1049
|
});
|
|
987
1050
|
});
|
|
@@ -1615,7 +1678,7 @@ function Ni(e4) {
|
|
|
1615
1678
|
function Ai(e4) {
|
|
1616
1679
|
return zi.safeParse(e4);
|
|
1617
1680
|
}
|
|
1618
|
-
function
|
|
1681
|
+
function rn(e4) {
|
|
1619
1682
|
let t4;
|
|
1620
1683
|
try {
|
|
1621
1684
|
t4 = JSON.parse(e4);
|
|
@@ -1635,7 +1698,7 @@ function rn2(e4) {
|
|
|
1635
1698
|
}
|
|
1636
1699
|
const i2 = [], n4 = [], o3 = Li.safeParse(t4);
|
|
1637
1700
|
if (!o3.success) for (const t5 of o3.error.issues) {
|
|
1638
|
-
const n5 = t5.path.join("."), o4 =
|
|
1701
|
+
const n5 = t5.path.join("."), o4 = un(e4, t5.path);
|
|
1639
1702
|
i2.push({ message: t5.message, severity: "error", path: n5 || "root", ...o4 });
|
|
1640
1703
|
}
|
|
1641
1704
|
const r4 = (function(e5) {
|
|
@@ -1679,8 +1742,8 @@ function rn2(e4) {
|
|
|
1679
1742
|
const i3 = [];
|
|
1680
1743
|
return (function(e6, t7, i4) {
|
|
1681
1744
|
let n5;
|
|
1682
|
-
|
|
1683
|
-
for (; null !== (n5 =
|
|
1745
|
+
ln.lastIndex = 0;
|
|
1746
|
+
for (; null !== (n5 = ln.exec(e6)); ) {
|
|
1684
1747
|
const t8 = n5[0], o4 = n5[1], r5 = n5[2], a4 = pn(e6, n5.index, t8.length);
|
|
1685
1748
|
i4.push({ message: `Malformed reference "${t8}", use a dot, not a colon: "$${o4}.${r5}".`, severity: "warning", path: t8, ...a4 });
|
|
1686
1749
|
}
|
|
@@ -1695,15 +1758,15 @@ function rn2(e4) {
|
|
|
1695
1758
|
})(e5, t6, i3), (function(e6, t7, i4) {
|
|
1696
1759
|
const n5 = t7.stepNames?.stores ?? [];
|
|
1697
1760
|
let o4;
|
|
1698
|
-
|
|
1699
|
-
for (; null !== (o4 =
|
|
1761
|
+
an.lastIndex = 0;
|
|
1762
|
+
for (; null !== (o4 = an.exec(e6)); ) if (!n5.includes(o4[1])) {
|
|
1700
1763
|
const t8 = pn(e6, o4.index, o4[0].length);
|
|
1701
1764
|
i4.push({ message: `Unknown store "$store.${o4[1]}". Defined: ${n5.join(", ") || "none"}`, severity: "warning", path: `$store.${o4[1]}`, ...t8 });
|
|
1702
1765
|
}
|
|
1703
1766
|
})(e5, t6, i3), (function(e6, t7, i4) {
|
|
1704
1767
|
let n5;
|
|
1705
|
-
|
|
1706
|
-
for (; null !== (n5 =
|
|
1768
|
+
sn.lastIndex = 0;
|
|
1769
|
+
for (; null !== (n5 = sn.exec(e6)); ) {
|
|
1707
1770
|
const t8 = n5[0], o4 = n5[1], r5 = n5[2], a4 = pn(e6, n5.index, t8.length);
|
|
1708
1771
|
r5 ? i4.push({ message: `Malformed $env reference "${t8}". Use ":" for default values, not "=" (e.g., "$env.${o4}:fallback").`, severity: "warning", path: t8, ...a4 }) : /^[A-Z][A-Z0-9_]*$/.test(o4) || i4.push({ message: `$env.${o4} should use UPPER_SNAKE_CASE by convention (e.g., $env.${o4.toUpperCase()}).`, severity: "warning", path: t8, ...a4 });
|
|
1709
1772
|
}
|
|
@@ -1711,8 +1774,8 @@ function rn2(e4) {
|
|
|
1711
1774
|
const n5 = t7.flowNames ?? [];
|
|
1712
1775
|
if (0 === n5.length) return;
|
|
1713
1776
|
let o4;
|
|
1714
|
-
|
|
1715
|
-
for (; null !== (o4 =
|
|
1777
|
+
cn.lastIndex = 0;
|
|
1778
|
+
for (; null !== (o4 = cn.exec(e6)); ) {
|
|
1716
1779
|
const t8 = o4[0], r5 = o4[1];
|
|
1717
1780
|
if (!n5.includes(r5)) {
|
|
1718
1781
|
const a4 = pn(e6, o4.index, t8.length);
|
|
@@ -1734,7 +1797,7 @@ function pn(e4, t4, i2) {
|
|
|
1734
1797
|
const n4 = dn(e4, t4), o3 = dn(e4, t4 + i2);
|
|
1735
1798
|
return { line: n4.line, column: n4.column, endLine: o3.line, endColumn: o3.column };
|
|
1736
1799
|
}
|
|
1737
|
-
function
|
|
1800
|
+
function un(e4, t4) {
|
|
1738
1801
|
if (0 === t4.length) return { line: 1, column: 1 };
|
|
1739
1802
|
const i2 = t4[t4.length - 1];
|
|
1740
1803
|
if ("string" == typeof i2) {
|
|
@@ -1798,7 +1861,7 @@ function wn(e4) {
|
|
|
1798
1861
|
for (const [e5, i2] of Object.entries(t4)) i2 && "object" == typeof i2 && ("object" === i2.type && i2.properties && "string" != typeof i2.title && (i2.title = e5), wn(i2));
|
|
1799
1862
|
}
|
|
1800
1863
|
}
|
|
1801
|
-
var e3, t3, i, r3, a3, s4, c, l, d, p, u3, m2, f2, g2, h2, b2, v2,
|
|
1864
|
+
var e3, t3, i, r3, a3, s4, c, l, d, p, u3, m2, f2, g2, h2, b2, v2, S2, y, w2, k, C2, x, P2, j, E2, D2, I2, O, J2, z2, L, $, q2, N, A, W, B2, U2, V2, H, _, Z2, G2, K2, Q2, X2, Y2, ee2, te, ie3, ne3, oe2, re3, ae2, se3, ce3, le3, de3, pe3, ue3, me3, fe3, ge3, he3, be3, ve2, Se2, ye3, we2, ke2, Ce3, xe3, Pe3, je3, Ee3, De3, Ie3, Oe2, Je, Re2, Me3, Te3, Fe2, ze3, Le3, $e3, qe2, Ne2, Ae3, We2, Be2, Ue3, Ve2, He2, _e3, Ze2, Ge, Ke2, Qe, Xe, Ye, et2, tt2, it2, nt2, ot2, rt, at2, st, ct3, lt3, dt, pt2, ut2, mt2, ft2, gt2, ht2, bt, vt, St, yt2, wt, kt2, Ct2, xt2, Pt2, jt2, Et2, Dt2, It2, Ot, Jt, Rt2, Mt2, Tt2, Ft2, zt2, Lt2, $t2, qt, Nt2, At, Wt2, Bt, Ut2, Vt, Ht2, _t2, Zt2, Gt, 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, Ei, Di, Ii, Oi, Ji, Ri, Mi, Ti, Fi, zi, Li, Wi, Bi, Ui, Vi, Hi, _i, Zi, Gi, Ki, Qi, Xi, en, tn, nn, on, an, sn, cn, ln, Cn;
|
|
1802
1865
|
var init_dev = __esm({
|
|
1803
1866
|
"../core/dist/dev.mjs"() {
|
|
1804
1867
|
"use strict";
|
|
@@ -1807,7 +1870,7 @@ var init_dev = __esm({
|
|
|
1807
1870
|
for (var n4 in i2) e3(t4, n4, { get: i2[n4], enumerable: true });
|
|
1808
1871
|
};
|
|
1809
1872
|
i = {};
|
|
1810
|
-
t3(i, { BaseContextConfig: () => L, CacheRuleSchema: () => Xe, CacheSchema: () => Ye, CacheSchemas: () => _e3, ClickIdEntrySchema: () =>
|
|
1873
|
+
t3(i, { BaseContextConfig: () => L, CacheRuleSchema: () => Xe, CacheSchema: () => Ye, CacheSchemas: () => _e3, ClickIdEntrySchema: () => on, CodeSchema: () => en, CollectorSchemas: () => Et2, ConsentSchema: () => Z2, ContractActionsSchema: () => Ji, ContractRuleSchema: () => Mi, ContractSchema: () => Ti, ContractSchemaEntry: () => Oi, Counter: () => d, DeepPartialEventSchema: () => te, DestinationSchemas: () => Re2, DestinationsMapConfig: () => N, EntitiesSchema: () => X2, EntitySchema: () => Q2, EventCacheRuleSchema: () => Ze2, EventCacheSchema: () => Ge, EventSchema: () => Y2, FlowBundlePackageSchema: () => hi, FlowBundleSchema: () => bi, FlowCodeSchema: () => vi, FlowConfigSchema: () => Fi, FlowDestinationSchema: () => Di, FlowJsonSchema: () => Li, FlowSchema: () => zi, FlowSchemas: () => ui, FlowSourceSchema: () => ji, FlowStoreSchema: () => Ii, FlowTransformerSchema: () => Ei, GenericEnvConfig: () => J2, GenericSettingsConfig: () => O, HandlersConfig: () => x, HintSchema: () => tn, HintsSchema: () => nn, IdConfig: () => E2, Identifier: () => c, InitConfig: () => D2, LoggerConfigSchema: () => tt2, LoggerHandlerSchema: () => et2, LoopSchema: () => me3, MapSchema: () => ge3, MappingResultSchema: () => ke2, MappingSchemas: () => de3, MatchExpressionSchema: () => ze3, MatcherSchemas: () => Me3, OptionalPrimitiveValue: () => u3, OrderedPropertiesSchema: () => H, PartialEventSchema: () => ee2, PolicySchema: () => be3, PrimaryConfig: () => I2, PrimitiveValue: () => p, ProcessingControlConfig: () => $, PropertiesSchema: () => V2, PropertySchema: () => U2, PropertyTypeSchema: () => B2, QueueConfig: () => j, RequiredBoolean: () => s4, RequiredNumber: () => a3, RequiredString: () => r3, RouteSchema: () => We2, RouteWithoutManySchema: () => He2, RuleSchema: () => Se2, RulesSchema: () => ye3, RuntimeInstanceConfig: () => z2, SetSchema: () => fe3, SourceSchema: () => K2, SourceSchemas: () => Wt2, SourceTypeSchema: () => _, SourcesMapConfig: () => q2, StoreCacheRuleSchema: () => Ke2, StoreCacheSchema: () => Qe, StoreSchemas: () => si, Timestamp: () => l, TransformerSchemas: () => ii, UserSchema: () => G2, UtilitySchemas: () => m2, ValidateEventsSchema: () => Ci, ValidateSchema: () => xi, ValueConfigSchema: () => he3, ValueSchema: () => pe3, ValuesSchema: () => ue3, VerboseConfig: () => P2, WalkerOSSchemas: () => A, configJsonSchema: () => Wi, consentJsonSchema: () => le3, contractJsonSchema: () => Ki, contractRuleJsonSchema: () => Gi, createArraySchema: () => bn, createConsentConfig: () => F2, createDataTransformationConfig: () => R2, createEnumSchema: () => vn, createMappingRulesConfig: () => M2, createObjectSchema: () => gn, createPolicyConfig: () => T2, createTupleSchema: () => Sn, destinationJsonSchema: () => Hi, entityJsonSchema: () => se3, eventJsonSchema: () => ie3, flowConfigJsonSchema: () => Ui, flowJsonSchema: () => Bi, loopJsonSchema: () => Pe3, mapJsonSchema: () => Ee3, orderedPropertiesJsonSchema: () => ae2, parseConfig: () => $i, parseFlow: () => Ni, partialEventJsonSchema: () => ne3, policyJsonSchema: () => De3, propertiesJsonSchema: () => re3, ruleJsonSchema: () => Ie3, rulesJsonSchema: () => Oe2, safeParseConfig: () => qi, safeParseFlow: () => Ai, setJsonSchema: () => je3, sourceJsonSchema: () => Vi, sourceTypeJsonSchema: () => ce3, storeJsonSchema: () => Zi, transformerJsonSchema: () => _i, userJsonSchema: () => oe2, validateEventsJsonSchema: () => Xi, validateFlowConfig: () => rn, validateJsonSchema: () => Qi, valueConfigJsonSchema: () => xe3, valueJsonSchema: () => Ce3, z: () => n3, zodToSchema: () => yn });
|
|
1811
1874
|
r3 = n3.string();
|
|
1812
1875
|
a3 = n3.number();
|
|
1813
1876
|
s4 = n3.boolean();
|
|
@@ -1817,13 +1880,13 @@ var init_dev = __esm({
|
|
|
1817
1880
|
p = n3.union([n3.string(), n3.number(), n3.boolean()]);
|
|
1818
1881
|
u3 = p.optional();
|
|
1819
1882
|
m2 = {};
|
|
1820
|
-
t3(m2, { ErrorHandlerSchema: () => h2, HandlerSchema: () => v2, LogHandlerSchema: () => b2, StorageSchema: () => g2, StorageTypeSchema: () => f2, errorHandlerJsonSchema: () => w2, handlerJsonSchema: () => C2, logHandlerJsonSchema: () => k, storageJsonSchema: () => y, storageTypeJsonSchema: () =>
|
|
1883
|
+
t3(m2, { ErrorHandlerSchema: () => h2, HandlerSchema: () => v2, LogHandlerSchema: () => b2, StorageSchema: () => g2, StorageTypeSchema: () => f2, errorHandlerJsonSchema: () => w2, handlerJsonSchema: () => C2, logHandlerJsonSchema: () => k, storageJsonSchema: () => y, storageTypeJsonSchema: () => S2 });
|
|
1821
1884
|
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");
|
|
1822
1885
|
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");
|
|
1823
1886
|
h2 = n3.unknown().meta({ id: "ErrorHandler", title: "Error.Handler", description: "Error handler function: (error, state?) => void." }).describe("Error handler function: (error, state?) => void");
|
|
1824
1887
|
b2 = n3.unknown().meta({ id: "LogHandler", title: "Log.Handler", description: "Log handler function: (message, verbose?) => void." }).describe("Log handler function: (message, verbose?) => void");
|
|
1825
1888
|
v2 = n3.object({ Error: h2.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");
|
|
1826
|
-
|
|
1889
|
+
S2 = o2(f2);
|
|
1827
1890
|
y = o2(g2);
|
|
1828
1891
|
w2 = o2(h2);
|
|
1829
1892
|
k = o2(b2);
|
|
@@ -1842,41 +1905,41 @@ var init_dev = __esm({
|
|
|
1842
1905
|
q2 = n3.object({ sources: n3.record(n3.string(), n3.unknown()).describe("Map of source instances") }).partial();
|
|
1843
1906
|
N = n3.object({ destinations: n3.record(n3.string(), n3.unknown()).describe("Map of destination instances") }).partial();
|
|
1844
1907
|
A = {};
|
|
1845
|
-
t3(A, { ConsentSchema: () =>
|
|
1908
|
+
t3(A, { ConsentSchema: () => Z2, DeepPartialEventSchema: () => te, EntitiesSchema: () => X2, EntitySchema: () => Q2, EventSchema: () => Y2, OrderedPropertiesSchema: () => H, PartialEventSchema: () => ee2, PropertiesSchema: () => V2, PropertySchema: () => U2, PropertyTypeSchema: () => B2, SourceSchema: () => K2, SourceTypeSchema: () => _, UserSchema: () => G2, consentJsonSchema: () => le3, entityJsonSchema: () => se3, eventJsonSchema: () => ie3, orderedPropertiesJsonSchema: () => ae2, partialEventJsonSchema: () => ne3, propertiesJsonSchema: () => re3, sourceTypeJsonSchema: () => ce3, userJsonSchema: () => oe2 });
|
|
1846
1909
|
B2 = n3.lazy(() => n3.union([n3.boolean(), n3.string(), n3.number(), n3.record(n3.string(), U2)])).meta({ id: "WalkerOSPropertyType", title: "WalkerOS.PropertyType", description: "Base property value types (boolean, string, number, or nested Property record)." });
|
|
1847
1910
|
U2 = n3.lazy(() => n3.union([B2, n3.array(B2)])).meta({ id: "WalkerOSProperty", title: "WalkerOS.Property", description: "PropertyType or an array of PropertyType. Recursive structure for nested objects and arrays." });
|
|
1848
1911
|
V2 = n3.record(n3.string(), U2.optional()).meta({ id: "WalkerOSProperties", title: "WalkerOS.Properties", description: "Flexible property collection with optional values." }).describe("Flexible property collection with optional values");
|
|
1849
1912
|
H = n3.record(n3.string(), n3.tuple([U2, n3.number()]).optional()).meta({ id: "WalkerOSOrderedProperties", title: "WalkerOS.OrderedProperties", description: "Ordered properties with [value, order] tuples for priority control." }).describe("Ordered properties with [value, order] tuples for priority control");
|
|
1850
1913
|
_ = n3.union([n3.enum(["web", "server", "app", "other"]), n3.string()]).meta({ id: "WalkerOSSourceType", title: "WalkerOS.SourceType", description: "Source type identifier. Standard: web, server, app, other. Extensible to custom strings." }).describe("Source type: web, server, app, other, or custom");
|
|
1851
|
-
|
|
1914
|
+
Z2 = n3.record(n3.string(), n3.boolean()).meta({ id: "WalkerOSConsent", title: "WalkerOS.Consent", description: "Consent state mapping. Keys are consent groups (e.g. marketing, functional), values are booleans for granted/denied." }).describe("Consent requirement mapping (group name to state)");
|
|
1852
1915
|
G2 = V2.and(n3.object({ id: n3.string().optional().describe("User identifier"), device: n3.string().optional().describe("Device identifier"), session: n3.string().optional().describe("Session identifier"), hash: n3.string().optional().describe("Hashed identifier"), address: n3.string().optional().describe("User address"), email: n3.string().email().optional().describe("User email address"), phone: n3.string().optional().describe("User phone number"), userAgent: n3.string().optional().describe("Browser user agent string"), browser: n3.string().optional().describe("Browser name"), browserVersion: n3.string().optional().describe("Browser version"), deviceType: n3.string().optional().describe("Device type (mobile, desktop, tablet)"), os: n3.string().optional().describe("Operating system"), osVersion: n3.string().optional().describe("Operating system version"), screenSize: n3.string().optional().describe("Screen dimensions"), language: n3.string().optional().describe("User language"), country: n3.string().optional().describe("User country"), region: n3.string().optional().describe("User region/state"), city: n3.string().optional().describe("User city"), zip: n3.string().optional().describe("User postal code"), timezone: n3.string().optional().describe("User timezone"), ip: n3.string().optional().describe("User IP address"), internal: n3.boolean().optional().describe("Internal user flag (employee, test user)") })).meta({ id: "WalkerOSUser", title: "WalkerOS.User", description: "User identification and attributes." }).describe("User identification and properties");
|
|
1853
1916
|
K2 = V2.and(n3.object({ type: n3.string().describe("Source kind (browser, dataLayer, gtag, ...)"), platform: n3.string().optional().describe("Runtime platform (web, server, app, ios, android, terminal, ...)"), version: n3.string().optional().describe("Deployment version of the source emitter"), schema: n3.string().optional().describe('Event model spec version (collector defaults to "4")'), count: n3.number().int().nonnegative().optional().describe("Emission sequence per run"), trace: n3.string().optional().describe("W3C traceparent full string"), url: n3.string().optional(), referrer: n3.string().optional(), tool: n3.string().optional(), command: n3.string().optional() })).meta({ id: "WalkerOSSource", title: "WalkerOS.Source", description: "Event source information (origin of the event)." }).describe("Event source information");
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
Y2 = n3.object({ name: n3.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: V2.describe("Event-specific properties"), context: H.describe("Ordered context properties with priorities"), globals: V2.describe("Global properties shared across events"), custom: V2.describe("Custom implementation-specific properties"), user: G2.describe("User identification and attributes"), nested:
|
|
1857
|
-
|
|
1858
|
-
|
|
1917
|
+
Q2 = n3.lazy(() => n3.object({ entity: n3.string().describe("Entity name"), data: V2.describe("Entity-specific properties"), nested: n3.array(Q2).optional().describe("Nested child entities"), context: H.optional().describe("Entity context data") })).meta({ id: "WalkerOSEntity", title: "WalkerOS.Entity", description: "Nested entity structure with recursive nesting support." }).describe("Nested entity structure with recursive nesting support");
|
|
1918
|
+
X2 = n3.array(Q2).meta({ id: "WalkerOSEntities", title: "WalkerOS.Entities", description: "Array of nested entities." }).describe("Array of nested entities");
|
|
1919
|
+
Y2 = n3.object({ name: n3.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: V2.describe("Event-specific properties"), context: H.describe("Ordered context properties with priorities"), globals: V2.describe("Global properties shared across events"), custom: V2.describe("Custom implementation-specific properties"), user: G2.describe("User identification and attributes"), nested: X2.describe("Related nested entities"), consent: Z2.describe("Consent states at event time"), id: c.describe("W3C span_id, 16 lowercase hex characters"), trigger: r3.describe("Event trigger identifier"), entity: r3.describe("Parsed entity from event name"), action: r3.describe("Parsed action from event name"), timestamp: l.describe("Unix timestamp in milliseconds since epoch"), timing: a3.describe("Event processing timing information"), source: K2.describe("Event source information") }).meta({ id: "WalkerOSEvent", title: "WalkerOS.Event", description: "Complete walkerOS event structure." }).describe("Complete walkerOS event structure");
|
|
1920
|
+
ee2 = Y2.partial().meta({ id: "WalkerOSPartialEvent", title: "WalkerOS.PartialEvent", description: "Partial event structure with all fields optional." }).describe("Partial event structure with all fields optional");
|
|
1921
|
+
te = Y2.partial().meta({ id: "WalkerOSDeepPartialEvent", title: "WalkerOS.DeepPartialEvent", description: "Partial event structure with all top-level fields optional." }).describe("Partial event structure with all top-level fields optional");
|
|
1859
1922
|
ie3 = o2(Y2);
|
|
1860
|
-
ne3 = o2(
|
|
1923
|
+
ne3 = o2(ee2);
|
|
1861
1924
|
oe2 = o2(G2);
|
|
1862
1925
|
re3 = o2(V2);
|
|
1863
1926
|
ae2 = o2(H);
|
|
1864
|
-
se3 = o2(
|
|
1927
|
+
se3 = o2(Q2);
|
|
1865
1928
|
ce3 = o2(_);
|
|
1866
|
-
le3 = o2(
|
|
1929
|
+
le3 = o2(Z2);
|
|
1867
1930
|
de3 = {};
|
|
1868
|
-
t3(de3, { ConfigSchema: () => we2, LoopSchema: () => me3, MapSchema: () => ge3, PolicySchema: () => be3, ResultSchema: () => ke2, RulePatchSchema: () => ve2, RuleSchema: () => Se2, RulesSchema: () => ye3, SetSchema: () => fe3, ValueConfigSchema: () => he3, ValueSchema: () => pe3, ValuesSchema: () => ue3, configJsonSchema: () =>
|
|
1931
|
+
t3(de3, { ConfigSchema: () => we2, LoopSchema: () => me3, MapSchema: () => ge3, PolicySchema: () => be3, ResultSchema: () => ke2, RulePatchSchema: () => ve2, RuleSchema: () => Se2, RulesSchema: () => ye3, SetSchema: () => fe3, ValueConfigSchema: () => he3, ValueSchema: () => pe3, ValuesSchema: () => ue3, configJsonSchema: () => Je, loopJsonSchema: () => Pe3, mapJsonSchema: () => Ee3, policyJsonSchema: () => De3, ruleJsonSchema: () => Ie3, rulesJsonSchema: () => Oe2, setJsonSchema: () => je3, valueConfigJsonSchema: () => xe3, valueJsonSchema: () => Ce3 });
|
|
1869
1932
|
pe3 = n3.lazy(() => n3.union([n3.string().describe('String value or property path (e.g., "data.id")'), n3.number().describe("Numeric value"), n3.boolean().describe("Boolean value"), n3.lazy(() => W), n3.array(pe3).describe("Array of values")])).meta({ id: "MappingValue", title: "Mapping.Value", description: "Polymorphic transform primitive used in every mapping field. A string path, constant, operator object (map/loop/set/condition/consent), or array of values." });
|
|
1870
1933
|
ue3 = n3.array(pe3).meta({ id: "MappingValues", title: "Mapping.Values", description: "Array of transformation values." }).describe("Array of transformation values");
|
|
1871
1934
|
me3 = n3.lazy(() => n3.tuple([pe3, pe3]).describe("Loop transformation: [source, transform] tuple for array processing")).meta({ id: "MappingLoop", title: "Mapping.Loop", description: "Loop tuple [source, transform] for iterating and transforming arrays." });
|
|
1872
1935
|
fe3 = n3.lazy(() => n3.array(pe3).describe("Set: Array of values for selection or combination")).meta({ id: "MappingSet", title: "Mapping.Set", description: "Set: array of values for selection or combination." });
|
|
1873
1936
|
ge3 = n3.lazy(() => n3.record(n3.string(), pe3).describe("Map: Object mapping keys to transformation values")).meta({ id: "MappingMap", title: "Mapping.Map", description: "Map: object mapping keys to transformation values." });
|
|
1874
|
-
he3 = W = n3.object({ key: n3.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'), value: n3.union([n3.string(), n3.number(), n3.boolean()]).optional().describe("Static primitive value"), fn: n3.string().optional().describe("Custom transformation function as string (serialized)"), map: ge3.optional().describe("Object mapping: transform event data to structured output"), loop: me3.optional().describe("Loop transformation: [source, transform] for array processing"), set: fe3.optional().describe("Set of values: combine or select from multiple values"), consent:
|
|
1937
|
+
he3 = W = n3.object({ key: n3.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'), value: n3.union([n3.string(), n3.number(), n3.boolean()]).optional().describe("Static primitive value"), fn: n3.string().optional().describe("Custom transformation function as string (serialized)"), map: ge3.optional().describe("Object mapping: transform event data to structured output"), loop: me3.optional().describe("Loop transformation: [source, transform] for array processing"), set: fe3.optional().describe("Set of values: combine or select from multiple values"), consent: 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");
|
|
1875
1938
|
be3 = n3.record(n3.string(), pe3).meta({ id: "MappingPolicy", title: "Mapping.Policy", description: "Policy rules for event pre-processing (key \u2192 value transformation)." }).describe("Policy rules for event pre-processing (key \u2192 value mapping)");
|
|
1876
|
-
ve2 = n3.object({ name: n3.string().nullable().optional(), data: n3.union([pe3, ue3]).nullable().optional(), settings: n3.unknown().nullable().optional(), condition: n3.string().nullable().optional(), consent:
|
|
1877
|
-
Se2 = n3.object({ name: n3.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), data: n3.union([pe3, ue3]).optional().describe("Data transformation rules for event"), settings: n3.unknown().optional().describe("Destination-specific settings for this event mapping"), condition: n3.string().optional().describe("Condition function as string: return true to process event"), consent:
|
|
1939
|
+
ve2 = n3.object({ name: n3.string().nullable().optional(), data: n3.union([pe3, ue3]).nullable().optional(), settings: n3.unknown().nullable().optional(), condition: n3.string().nullable().optional(), consent: Z2.nullable().optional(), policy: be3.nullable().optional(), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).nullable().optional(), include: n3.array(n3.string()).nullable().optional(), ignore: n3.boolean().nullable().optional(), silent: n3.boolean().nullable().optional() }).meta({ id: "MappingRulePatch", title: "Mapping.RulePatch", description: "Partial rule deep-merged onto a package-shipped default; a null value clears the inherited field." }).describe("Partial rule for `extend`; null clears an inherited field");
|
|
1940
|
+
Se2 = n3.object({ name: n3.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), data: n3.union([pe3, ue3]).optional().describe("Data transformation rules for event"), settings: n3.unknown().optional().describe("Destination-specific settings for this event mapping"), condition: n3.string().optional().describe("Condition function as string: return true to process event"), consent: Z2.optional().describe("Required consent states to process this event"), policy: be3.optional().describe("Event-level policy overrides (applied after config-level policy)"), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).optional().describe("Batch scheduling: bare number is the debounce wait window (legacy); object form supports wait/size/age."), include: n3.array(n3.string()).optional().describe('Event sections (e.g. ["context", "globals"]) flattened into context.data'), ignore: n3.boolean().optional().describe("Skip the event entirely. No push, no side effects. Use for suppression."), silent: n3.boolean().optional().describe("Run side effects (settings.identify, ...) but suppress the destination default push call."), extend: ve2.optional().describe("Merge mode: a partial rule deep-merged onto the package-shipped default at this key (instead of replacing it). A null value clears an inherited field."), remove: n3.array(n3.string()).optional().describe("Dotted paths stripped from the produced data payload after evaluation (applied last).") }).meta({ id: "MappingRule", title: "Mapping.Rule", description: "Configuration for transforming a single event at one stage of the flow (source or destination)." }).describe("Mapping rule for specific entity-action combination");
|
|
1878
1941
|
ye3 = n3.record(n3.string(), n3.record(n3.string(), n3.union([Se2, n3.array(Se2)])).optional()).meta({ id: "MappingRules", title: "Mapping.Rules", description: 'Event mapping rules tree: entity \u2192 action \u2192 Rule (or Rule[]). Use "*" as wildcard for entity or action.' }).describe('Event mapping rules: entity \u2192 action \u2192 Rule. Keys match event name split by space. Use "*" as wildcard for entity or action. Priority: exact > entity wildcard > action wildcard > global wildcard (*\u2192*).');
|
|
1879
|
-
we2 = n3.object({ consent:
|
|
1942
|
+
we2 = n3.object({ consent: Z2.optional().describe("Required consent states to process any events"), data: n3.union([pe3, ue3]).optional().describe("Global data transformation applied to all events"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), mapping: ye3.optional().describe("Entity-action specific mapping rules"), policy: be3.optional().describe("Pre-processing policy rules applied before mapping") }).meta({ id: "MappingConfig", title: "Mapping.Config", description: "Shared mapping configuration (consent, data, include, mapping, policy)." }).describe("Shared mapping configuration for sources and destinations");
|
|
1880
1943
|
ke2 = n3.object({ eventMapping: Se2.optional().describe("Resolved mapping rule for event"), mappingKey: n3.string().optional().describe('Mapping key used (e.g., "product.view")') }).meta({ id: "MappingResult", title: "Mapping.Result", description: "Mapping resolution result (matched rule + key)." }).describe("Mapping resolution result");
|
|
1881
1944
|
Ce3 = o2(pe3);
|
|
1882
1945
|
xe3 = o2(he3);
|
|
@@ -1886,93 +1949,93 @@ var init_dev = __esm({
|
|
|
1886
1949
|
De3 = o2(be3);
|
|
1887
1950
|
Ie3 = o2(Se2);
|
|
1888
1951
|
Oe2 = o2(ye3);
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
t3(
|
|
1892
|
-
|
|
1893
|
-
t3(
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
$e3 = n3.strictObject({ match:
|
|
1899
|
-
qe2 = n3.strictObject({ match:
|
|
1900
|
-
|
|
1901
|
-
Ae3 = n3.union([
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
Ve2 = n3.union([
|
|
1906
|
-
|
|
1952
|
+
Je = o2(we2);
|
|
1953
|
+
Re2 = {};
|
|
1954
|
+
t3(Re2, { BatchSchema: () => dt, ConfigSchema: () => it2, ContextSchema: () => rt, DLQSchema: () => St, DataSchema: () => pt2, DestinationPolicySchema: () => ot2, DestinationsSchema: () => gt2, InitDestinationsSchema: () => ft2, InitSchema: () => mt2, InstanceSchema: () => ut2, PartialConfigSchema: () => nt2, PushBatchContextSchema: () => st, PushContextSchema: () => at2, PushEventSchema: () => ct3, PushEventsSchema: () => lt3, PushResultSchema: () => bt, RefSchema: () => ht2, ResultSchema: () => vt, batchJsonSchema: () => xt2, configJsonSchema: () => yt2, contextJsonSchema: () => kt2, instanceJsonSchema: () => Pt2, partialConfigJsonSchema: () => wt, pushContextJsonSchema: () => Ct2, resultJsonSchema: () => jt2 });
|
|
1955
|
+
Me3 = {};
|
|
1956
|
+
t3(Me3, { MatchExpressionSchema: () => ze3, RouteSchema: () => We2, RouteWithoutManySchema: () => He2 });
|
|
1957
|
+
Te3 = n3.enum(["eq", "contains", "prefix", "suffix", "regex", "gt", "lt", "exists"]).meta({ id: "MatcherOperator", title: "Matcher.Operator", description: "Supported operators for a match condition." });
|
|
1958
|
+
Fe2 = n3.object({ key: n3.string(), operator: Te3, value: n3.string(), not: n3.boolean().optional() }).meta({ id: "MatcherCondition", title: "Matcher.Condition", description: "Single match condition (key, operator, value, optional not)." });
|
|
1959
|
+
ze3 = n3.union([Fe2, n3.object({ and: n3.array(n3.lazy(() => ze3)) }), n3.object({ or: n3.array(n3.lazy(() => ze3)) })]).meta({ id: "MatcherExpression", title: "Matcher.Expression", description: "Boolean expression tree of match conditions (leaf, and, or)." });
|
|
1960
|
+
Le3 = n3.strictObject({ match: ze3.optional(), next: n3.lazy(() => We2) });
|
|
1961
|
+
$e3 = n3.strictObject({ match: ze3.optional(), one: n3.array(n3.lazy(() => We2)) });
|
|
1962
|
+
qe2 = n3.strictObject({ match: ze3.optional(), many: n3.array(n3.lazy(() => We2)) });
|
|
1963
|
+
Ne2 = n3.strictObject({ match: ze3 });
|
|
1964
|
+
Ae3 = n3.union([Le3, $e3, qe2, Ne2]);
|
|
1965
|
+
We2 = n3.union([n3.string(), n3.array(n3.lazy(() => We2)), Ae3]).meta({ id: "Route", title: "Route", description: "Recursive route: string ID, sequence of routes, or a RouteConfig (next/one/many/gate)." });
|
|
1966
|
+
Be2 = n3.strictObject({ match: ze3.optional(), next: n3.lazy(() => He2) });
|
|
1967
|
+
Ue3 = n3.strictObject({ match: ze3.optional(), one: n3.array(n3.lazy(() => He2)) });
|
|
1968
|
+
Ve2 = n3.union([Be2, Ue3, Ne2]);
|
|
1969
|
+
He2 = n3.union([n3.string(), n3.array(n3.lazy(() => He2)), Ve2]).meta({ id: "RouteWithoutMany", title: "RouteWithoutMany", description: "Route variant for post-collector positions (destination.before). Excludes the many operator \u2014 post-collector fan-out uses the destinations map." });
|
|
1907
1970
|
_e3 = {};
|
|
1908
|
-
t3(_e3, { CacheRuleSchema: () => Xe, CacheSchema: () => Ye, EventCacheRuleSchema: () => Ze2, EventCacheSchema: () =>
|
|
1909
|
-
Ze2 = n3.object({ match:
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
Qe = n3.strictObject({ store: n3.string().optional().describe("Store ID for persistent caching (references a configured store)"), namespace: n3.string().min(1).optional().describe("Optional key prefix. Omit to default to the host store id. Empty string is rejected."), rules: n3.array(
|
|
1971
|
+
t3(_e3, { CacheRuleSchema: () => Xe, CacheSchema: () => Ye, EventCacheRuleSchema: () => Ze2, EventCacheSchema: () => Ge, StoreCacheRuleSchema: () => Ke2, StoreCacheSchema: () => Qe });
|
|
1972
|
+
Ze2 = n3.object({ match: ze3.optional().describe("Optional match expression \u2014 omit for always-match."), key: n3.array(n3.string()).min(1).describe("Dot-path fields used to build the cache key"), ttl: n3.number().positive().describe("Time-to-live in seconds"), update: n3.record(n3.string(), pe3).optional().describe("Response mutations applied on cache hit (key \u2192 Value mapping)") }).meta({ id: "EventCacheRule", title: "EventCache.Rule", description: "Single event-cache rule: when it applies (match), what event fields it keys off, TTL, and optional response mutations on hit." });
|
|
1973
|
+
Ge = n3.object({ stop: n3.boolean().optional().describe("Stop the chain on cache HIT (default: false). When true, skip remaining steps and return cached value."), store: n3.string().optional().describe("Store ID for persistent caching (references a configured store)"), namespace: n3.string().optional().describe("Optional key prefix. Omit to write keys directly to the store. Same store + same key + same namespace = same cache entry."), rules: n3.array(Ze2).min(1).describe("Cache rules \u2014 at least one required") }).meta({ id: "EventCacheConfig", title: "EventCache.Config", description: "Top-level cache configuration for an event-context pipeline step (source / transformer / destination)." });
|
|
1974
|
+
Ke2 = n3.strictObject({ match: ze3.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)." });
|
|
1975
|
+
Qe = n3.strictObject({ store: n3.string().optional().describe("Store ID for persistent caching (references a configured store)"), namespace: n3.string().min(1).optional().describe("Optional key prefix. Omit to default to the host store id. Empty string is rejected."), rules: n3.array(Ke2).min(1).describe("Cache rules \u2014 at least one required") }).meta({ id: "StoreCacheConfig", title: "StoreCache.Config", description: "Top-level cache configuration for a store wrapper. No `stop` (always falls through on miss); namespace defaults to the host store id." });
|
|
1913
1976
|
Xe = Ze2;
|
|
1914
|
-
Ye =
|
|
1977
|
+
Ye = Ge;
|
|
1915
1978
|
et2 = n3.any().meta({ id: "LoggerHandler", title: "Logger.Handler", description: "Custom log handler function (level, ...args) => void" });
|
|
1916
1979
|
tt2 = n3.object({ level: n3.union([n3.number(), n3.enum(["ERROR", "WARN", "INFO", "DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"), handler: et2.optional().describe("Custom log handler function") }).meta({ id: "LoggerConfig", title: "Logger.Config", description: "Logger configuration (level, handler) to override the collector defaults" });
|
|
1917
|
-
|
|
1918
|
-
|
|
1980
|
+
it2 = 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(), data: n3.union([pe3, ue3]).optional().describe("Global data transformation applied to all events for this destination"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), env: n3.any().meta({ id: "DestinationEnv", title: "Destination.Env", description: "Environment dependencies (destination-defined shape) \u2014 platform, SDK, or mock hook." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Destination instance identifier (defaults to destination key)").optional(), init: n3.boolean().describe("Whether to initialize immediately").optional(), loadScript: n3.boolean().describe("Whether to load external script (for web destinations)").optional(), mapping: ye3.optional().describe("Entity-action specific mapping rules for this destination"), policy: be3.optional().describe("Pre-processing policy rules applied before event mapping"), queue: n3.boolean().describe("Whether to queue events when consent is not granted").optional(), require: n3.array(n3.string()).optional().describe('Defer destination initialization until these collector events fire (e.g., ["consent"])'), logger: tt2.optional().describe("Logger configuration (level, handler) to override the collector defaults"), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)"), before: He2.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: He2.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: Ge.optional().describe("Cache configuration for deduplication; skip push on cache HIT"), disabled: n3.boolean().describe("Completely skip this destination (no init, no push, no queue)").optional(), mock: n3.unknown().meta({ id: "DestinationMock", title: "Destination.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Dev/testing only."), queueMax: n3.number().optional().describe("Maximum consent-denied events retained in queuePush for this destination. FIFO drop on overflow. Default 1000."), dlqMax: n3.number().optional().describe("Maximum failed-push entries retained in dlq for this destination. FIFO drop on overflow. Default 100."), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).optional().describe("Batch scheduling: bare number is the debounce wait window (legacy); object form supports wait (debounce ms), size (count cap, default 1000), age (max ms since first entry, default 30000).") }).meta({ id: "DestinationConfig", title: "Destination.Config", description: "Destination configuration: consent, settings, data, env, mapping rules, policy, queue, logger, before/next chains, cache." }).describe("Destination configuration");
|
|
1981
|
+
nt2 = it2.partial().meta({ id: "DestinationPartialConfig", title: "Destination.PartialConfig", description: "Partial destination configuration with all fields optional." }).describe("Partial destination configuration with all fields optional");
|
|
1919
1982
|
ot2 = be3.describe("Destination policy rules for event pre-processing");
|
|
1920
|
-
rt = n3.object({ collector: n3.unknown().meta({ id: "DestinationContextCollector", title: "Collector.Instance", description: "Collector instance handed to the destination (runtime object)." }).describe("Collector instance (runtime object)"), config:
|
|
1921
|
-
|
|
1922
|
-
st =
|
|
1923
|
-
|
|
1924
|
-
|
|
1983
|
+
rt = n3.object({ collector: n3.unknown().meta({ id: "DestinationContextCollector", title: "Collector.Instance", description: "Collector instance handed to the destination (runtime object)." }).describe("Collector instance (runtime object)"), config: it2.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");
|
|
1984
|
+
at2 = rt.extend({ mapping: Se2.optional().describe("Resolved mapping rule for this specific event") }).meta({ id: "DestinationPushContext", title: "Destination.PushContext", description: "Destination context for push() with the resolved event mapping rule." }).describe("Push context with event-specific mapping");
|
|
1985
|
+
st = at2.describe("Batch push context with event-specific mapping");
|
|
1986
|
+
ct3 = n3.object({ event: Y2.describe("The event to process"), mapping: Se2.optional().describe("Mapping rule for this event") }).meta({ id: "DestinationPushEvent", title: "Destination.PushEvent", description: "Single event paired with its resolved mapping rule (batch element)." }).describe("Event with optional mapping for batch processing");
|
|
1987
|
+
lt3 = n3.array(ct3).meta({ id: "DestinationPushEvents", title: "Destination.PushEvents", description: "Array of events with mappings (batch input)." }).describe("Array of events with mappings");
|
|
1925
1988
|
dt = n3.object({ key: n3.string().describe('Batch key (usually mapping key like "product.view")'), events: n3.array(Y2).describe("Array of events in batch"), data: n3.array(n3.union([n3.unknown(), n3.array(n3.unknown())]).optional()).describe("Transformed data for each event"), mapping: Se2.optional().describe("Shared mapping rule for batch") }).meta({ id: "DestinationBatch", title: "Destination.Batch", description: "Batch of events grouped by mapping key for batch delivery." }).describe("Batch of events grouped by mapping key");
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
gt2 = n3.record(n3.string(),
|
|
1989
|
+
pt2 = n3.union([n3.unknown(), n3.array(n3.unknown())]).meta({ id: "DestinationData", title: "Destination.Data", description: "Transformed event data delivered to the destination (Property, undefined, or array)." }).optional().describe("Transformed event data (Property, undefined, or array)");
|
|
1990
|
+
ut2 = n3.object({ config: it2.describe("Destination configuration"), queue: n3.array(Y2).optional().describe("Queued events awaiting consent"), dlq: n3.array(n3.tuple([Y2, n3.unknown()])).optional().describe("Dead letter queue (failed events with errors)"), type: n3.string().optional().describe("Destination type identifier"), env: n3.unknown().optional().describe("Environment dependencies"), init: n3.unknown().optional().describe("Initialization function"), push: n3.unknown().describe("Push function for single events"), pushBatch: n3.unknown().optional().describe("Batch push function"), on: n3.unknown().optional().describe("Event lifecycle hook function") }).meta({ id: "DestinationInstance", title: "Destination.Instance", description: "Destination instance (runtime object with init/push/pushBatch/on)." }).describe("Destination instance (runtime object with functions)");
|
|
1991
|
+
mt2 = n3.object({ code: ut2.describe("Destination instance with implementation"), config: nt2.optional().describe("Partial configuration overrides"), env: n3.unknown().optional().describe("Partial environment overrides") }).meta({ id: "DestinationInit", title: "Destination.Init", description: "Destination initialization bundle (instance code + config + env)." }).describe("Destination initialization configuration");
|
|
1992
|
+
ft2 = n3.record(n3.string(), mt2).meta({ id: "DestinationInitDestinations", title: "Destination.InitDestinations", description: "Map of destination IDs to initialization configurations." }).describe("Map of destination IDs to initialization configurations");
|
|
1993
|
+
gt2 = n3.record(n3.string(), ut2).meta({ id: "DestinationDestinations", title: "Destination.Destinations", description: "Map of destination IDs to runtime destination instances." }).describe("Map of destination IDs to runtime instances");
|
|
1931
1994
|
ht2 = n3.object({ type: n3.string().describe('Destination type ("gtag", "meta", "bigquery")'), data: n3.unknown().optional().describe("Response from push()"), error: n3.unknown().optional().describe("Error if failed") }).meta({ id: "DestinationRef", title: "Destination.Ref", description: "Reference to a destination outcome (type + response data or error)." }).describe("Destination reference with type and response data");
|
|
1932
1995
|
bt = n3.object({ queue: n3.array(Y2).optional().describe("Events queued (awaiting consent)"), error: n3.unknown().optional().describe("Error if push failed") }).meta({ id: "DestinationPushResult", title: "Destination.PushResult", description: "Result of a single destination push (queued events, optional error)." }).describe("Push operation result");
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
yt2 = o2(
|
|
1936
|
-
wt = o2(
|
|
1937
|
-
|
|
1938
|
-
Ct2 = o2(
|
|
1996
|
+
vt = n3.object({ ok: n3.boolean().describe("True if nothing failed"), event: n3.unknown().optional().describe("The processed event"), done: n3.record(n3.string(), ht2).optional().describe("Destinations that processed successfully"), queued: n3.record(n3.string(), ht2).optional().describe("Destinations that queued events"), failed: n3.record(n3.string(), ht2).optional().describe("Destinations that failed to process") }).meta({ id: "DestinationResult", title: "Destination.Result", description: "Overall push result aggregated across all destinations (done/queued/failed maps)." }).describe("Push result with destination outcomes");
|
|
1997
|
+
St = n3.array(n3.tuple([Y2, n3.unknown()])).meta({ id: "DestinationDLQ", title: "Destination.DLQ", description: "Dead-letter queue: list of [event, error] tuples." }).describe("Dead letter queue: [(event, error), ...]");
|
|
1998
|
+
yt2 = o2(it2);
|
|
1999
|
+
wt = o2(nt2);
|
|
2000
|
+
kt2 = o2(rt);
|
|
2001
|
+
Ct2 = o2(at2);
|
|
1939
2002
|
xt2 = o2(dt);
|
|
1940
|
-
Pt2 = o2(
|
|
1941
|
-
jt2 = o2(
|
|
2003
|
+
Pt2 = o2(ut2);
|
|
2004
|
+
jt2 = o2(vt);
|
|
1942
2005
|
Et2 = {};
|
|
1943
|
-
t3(Et2, { CommandTypeSchema: () => Dt2, ConfigSchema: () => It2, DestinationsSchema: () => Tt2, InitConfigSchema: () => Jt, InstanceSchema: () =>
|
|
2006
|
+
t3(Et2, { CommandTypeSchema: () => Dt2, ConfigSchema: () => It2, DestinationsSchema: () => Tt2, InitConfigSchema: () => Jt, InstanceSchema: () => Ft2, PushContextSchema: () => Rt2, SessionDataSchema: () => Ot, SourcesSchema: () => Mt2, commandTypeJsonSchema: () => zt2, configJsonSchema: () => Lt2, initConfigJsonSchema: () => qt, instanceJsonSchema: () => At, pushContextJsonSchema: () => Nt2, sessionDataJsonSchema: () => $t2 });
|
|
1944
2007
|
Dt2 = n3.union([n3.enum(["action", "config", "consent", "context", "destination", "elb", "globals", "hook", "init", "link", "run", "user", "walker"]), n3.string()]).meta({ id: "CollectorCommandType", title: "Collector.CommandType", description: "Collector command type identifier (standard or extension string)." }).describe("Collector command type: standard commands or custom string for extensions");
|
|
1945
2008
|
It2 = n3.object({ run: n3.boolean().describe("Whether to run collector automatically on initialization").optional(), globalsStatic: V2.describe("Static global properties that persist across collector runs"), sessionStatic: n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorSessionStatic", title: "Collector.SessionStatic", description: "Static session data that persists across collector runs." }).describe("Static session data that persists across collector runs"), logger: tt2.optional().describe("Logger configuration (level, handler)"), queueMax: n3.number().optional().describe("Maximum events retained in collector.queue (late-registration replay). FIFO drop on overflow. Default 1000.") }).meta({ id: "CollectorConfig", title: "Collector.Config", description: "Core collector configuration (globals/session statics, logger, buffer bounds)." }).describe("Core collector configuration");
|
|
1946
|
-
|
|
1947
|
-
Jt = It2.partial().extend({ consent:
|
|
2009
|
+
Ot = V2.and(n3.object({ isStart: n3.boolean().describe("Whether this is a new session start"), storage: n3.boolean().describe("Whether storage is available"), id: c.describe("Session identifier").optional(), start: l.describe("Session start timestamp").optional(), marketing: n3.literal(true).optional().describe("Marketing attribution flag"), updated: l.describe("Last update timestamp").optional(), isNew: n3.boolean().describe("Whether this is a new session").optional(), device: c.describe("Device identifier").optional(), count: d.describe("Event count in session").optional(), runs: d.describe("Number of runs").optional() })).meta({ id: "CollectorSessionData", title: "Collector.SessionData", description: "Session state and tracking data." }).describe("Session state and tracking data");
|
|
2010
|
+
Jt = It2.partial().extend({ consent: Z2.optional().describe("Initial consent state"), user: G2.optional().describe("Initial user data"), globals: V2.optional().describe("Initial global properties"), sources: n3.unknown().meta({ id: "CollectorInitSources", title: "Source.InitSources", description: "Source configurations map (id \u2192 InitSource)." }).optional().describe("Source configurations"), destinations: n3.unknown().meta({ id: "CollectorInitDestinations", title: "Destination.InitDestinations", description: "Destination configurations map (id \u2192 Init)." }).optional().describe("Destination configurations"), transformers: n3.unknown().meta({ id: "CollectorInitTransformers", title: "Transformer.Configs", description: "Transformer configurations map (id \u2192 Config)." }).optional().describe("Transformer configurations"), stores: n3.unknown().meta({ id: "CollectorInitStores", title: "Store.Configs", description: "Store configurations map (id \u2192 Config)." }).optional().describe("Store configurations"), custom: V2.optional().describe("Initial custom implementation-specific properties"), hooks: n3.unknown().meta({ id: "CollectorHooks", title: "Collector.Hooks", description: "Pipeline observation hooks." }).optional().describe("Pipeline observation hooks") }).meta({ id: "CollectorInitConfig", title: "Collector.InitConfig", description: "Collector initialization configuration with initial state (consent, user, globals, components, hooks)." }).describe("Collector initialization configuration with initial state");
|
|
1948
2011
|
Rt2 = n3.object({ mapping: we2.optional().describe("Source-level mapping configuration") }).meta({ id: "CollectorPushContext", title: "Collector.PushContext", description: "Push context with optional source-level mapping." }).describe("Push context with optional source mapping");
|
|
1949
2012
|
Mt2 = n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorSources", title: "Collector.Sources", description: "Map of source IDs to runtime source instances." }).describe("Map of source IDs to source instances");
|
|
1950
2013
|
Tt2 = n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorDestinations", title: "Collector.Destinations", description: "Map of destination IDs to runtime destination instances." }).describe("Map of destination IDs to destination instances");
|
|
1951
|
-
|
|
2014
|
+
Ft2 = n3.object({ push: n3.unknown().describe("Push function for processing events"), command: n3.unknown().describe("Command function for walker commands"), allowed: n3.boolean().describe("Whether event processing is allowed"), config: It2.describe("Current collector configuration"), consent: Z2.describe("Current consent state"), custom: V2.describe("Custom implementation-specific properties"), sources: Mt2.describe("Registered source instances"), destinations: Tt2.describe("Registered destination instances"), globals: V2.describe("Current global properties"), hooks: n3.unknown().describe("Lifecycle hook functions"), on: n3.unknown().describe("Event lifecycle configuration"), queue: n3.array(Y2).describe("Queued events awaiting processing"), round: n3.number().describe("Collector run count (increments with each run)"), session: n3.union([Ot]).describe("Current session state"), timing: n3.number().describe("Event processing timing information"), user: G2.describe("Current user data") }).meta({ id: "CollectorInstance", title: "Collector.Instance", description: "Collector instance (runtime object with push/command + full state and component maps)." }).describe("Collector instance with state and methods");
|
|
1952
2015
|
zt2 = o2(Dt2);
|
|
1953
|
-
|
|
1954
|
-
$t2 = o2(
|
|
2016
|
+
Lt2 = o2(It2);
|
|
2017
|
+
$t2 = o2(Ot);
|
|
1955
2018
|
qt = o2(Jt);
|
|
1956
2019
|
Nt2 = o2(Rt2);
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
t3(
|
|
2020
|
+
At = o2(Ft2);
|
|
2021
|
+
Wt2 = {};
|
|
2022
|
+
t3(Wt2, { BaseEnvSchema: () => Bt, ConfigSchema: () => Ut2, InitSchema: () => _t2, InitSourceSchema: () => Zt2, InitSourcesSchema: () => Gt, InstanceSchema: () => Ht2, PartialConfigSchema: () => Vt, baseEnvJsonSchema: () => Kt2, configJsonSchema: () => Qt, initSourceJsonSchema: () => ei, initSourcesJsonSchema: () => ti, instanceJsonSchema: () => Yt, partialConfigJsonSchema: () => Xt });
|
|
1960
2023
|
Bt = n3.object({ push: n3.unknown().meta({ id: "SourcePushFn", title: "Source.PushFn", description: "Collector push function passed to the source via dependency injection." }).describe("Collector push function"), command: n3.unknown().meta({ id: "SourceCommandFn", title: "Source.CommandFn", description: "Collector command function passed to the source." }).describe("Collector command function"), sources: n3.unknown().optional().describe("Map of registered source instances"), elb: n3.unknown().meta({ id: "ElbFn", title: "Elb.Fn", description: "Public `elb(...)` API function alias for collector.push." }).describe("Public API function (alias for collector.push)") }).catchall(n3.unknown()).meta({ id: "SourceBaseEnv", title: "Source.BaseEnv", description: "Base environment for source dependency injection; platform-specific sources extend this." }).describe("Base environment for dependency injection - platform-specific sources extend this");
|
|
1961
|
-
|
|
1962
|
-
Vt =
|
|
1963
|
-
|
|
2024
|
+
Ut2 = we2.extend({ settings: n3.any().meta({ id: "SourceSettings", title: "Source.Settings", description: "Implementation-specific configuration (source-defined shape)." }).describe("Implementation-specific configuration").optional(), env: Bt.optional().describe("Environment dependencies (platform-specific)"), id: c.describe("Source identifier (defaults to source key)").optional(), primary: n3.boolean().describe("Mark as primary (only one can be primary)").optional(), require: n3.array(n3.string()).optional().describe('Defer source initialization until these collector events fire (e.g., ["consent"])'), logger: tt2.optional().describe("Logger configuration (level, handler) to override the collector defaults"), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)"), ingest: n3.union([pe3, ue3]).optional().describe("Ingest metadata extraction mapping. Extracts values from raw request objects (Express req, Lambda event) using mapping syntax."), disabled: n3.boolean().describe("Completely skip this source (no init, no event capture)").optional(), init: n3.boolean().optional().describe("Init lifecycle flag set by collector to true after Instance.init() runs") }).meta({ id: "SourceConfig", title: "Source.Config", description: "Source configuration with mapping, environment, and lifecycle hooks." }).describe("Source configuration with mapping and environment");
|
|
2025
|
+
Vt = Ut2.partial().meta({ id: "SourcePartialConfig", title: "Source.PartialConfig", description: "Partial source configuration with all fields optional." }).describe("Partial source configuration with all fields optional");
|
|
2026
|
+
Ht2 = n3.object({ type: n3.string().describe('Source type identifier (e.g., "browser", "dataLayer")'), config: Ut2.describe("Current source configuration"), push: n3.any().meta({ id: "SourceInstancePushFn", title: "Source.PushFn", description: "Push function \u2014 THE HANDLER (flexible signature for platform compatibility)." }).describe("Push function - THE HANDLER (flexible signature for platform compatibility)"), destroy: n3.any().meta({ id: "SourceDestroyFn", title: "Source.DestroyFn", description: "Cleanup function called when the source is removed." }).optional().describe("Cleanup function called when source is removed"), on: n3.unknown().optional().describe("Lifecycle hook function for event types") }).meta({ id: "SourceInstance", title: "Source.Instance", description: "Source instance (runtime object with push handler and lifecycle methods)." }).describe("Source instance with push handler and lifecycle methods");
|
|
1964
2027
|
_t2 = n3.any().meta({ id: "SourceInit", title: "Source.Init", description: "Source initialization function: (config, env) => Instance | Promise<Instance>." }).describe("Source initialization function: (config, env) => Instance | Promise<Instance>");
|
|
1965
2028
|
Zt2 = n3.object({ code: _t2.describe("Source initialization function"), config: Vt.optional().describe("Partial configuration overrides"), env: Bt.partial().optional().describe("Partial environment overrides"), primary: n3.boolean().optional().describe("Mark as primary source (only one can be primary)") }).meta({ id: "SourceInitSource", title: "Source.InitSource", description: "Source initialization bundle (init function + config + env + primary flag)." }).describe("Source initialization configuration");
|
|
1966
2029
|
Gt = n3.record(n3.string(), Zt2).meta({ id: "SourceInitSources", title: "Source.InitSources", description: "Map of source IDs to initialization configurations." }).describe("Map of source IDs to initialization configurations");
|
|
1967
|
-
|
|
1968
|
-
Qt = o2(
|
|
2030
|
+
Kt2 = o2(Bt);
|
|
2031
|
+
Qt = o2(Ut2);
|
|
1969
2032
|
Xt = o2(Vt);
|
|
1970
|
-
Yt = o2(
|
|
2033
|
+
Yt = o2(Ht2);
|
|
1971
2034
|
ei = o2(Zt2);
|
|
1972
2035
|
ti = o2(Gt);
|
|
1973
2036
|
ii = {};
|
|
1974
2037
|
t3(ii, { ConfigSchema: () => ni, PartialConfigSchema: () => oi, configJsonSchema: () => ri, partialConfigJsonSchema: () => ai });
|
|
1975
|
-
ni = n3.object({ settings: n3.any().meta({ id: "TransformerSettings", title: "Transformer.Settings", description: "Implementation-specific configuration (transformer-defined shape)." }).describe("Implementation-specific configuration").optional(), env: n3.any().meta({ id: "TransformerEnv", title: "Transformer.Env", description: "Environment dependencies (transformer-defined shape)." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Transformer instance identifier (defaults to transformer key)").optional(), logger: tt2.optional().describe("Logger configuration (level, handler) to override the collector defaults"), before:
|
|
2038
|
+
ni = n3.object({ settings: n3.any().meta({ id: "TransformerSettings", title: "Transformer.Settings", description: "Implementation-specific configuration (transformer-defined shape)." }).describe("Implementation-specific configuration").optional(), env: n3.any().meta({ id: "TransformerEnv", title: "Transformer.Env", description: "Environment dependencies (transformer-defined shape)." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Transformer instance identifier (defaults to transformer key)").optional(), logger: tt2.optional().describe("Logger configuration (level, handler) to override the collector defaults"), before: We2.optional().describe("Pre-transformer chain that runs before this transformer pushes"), next: We2.optional().describe("Graph wiring to the next transformer in the chain"), cache: Ge.optional().describe("Step-level cache configuration for this transformer"), init: n3.boolean().describe("Whether to initialize immediately").optional(), disabled: n3.boolean().describe("Completely skip this transformer in chains").optional(), mock: n3.unknown().meta({ id: "TransformerMock", title: "Transformer.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Global mock for all chains. Dev/testing only."), chainMocks: n3.record(n3.string(), n3.unknown().meta({ id: "TransformerChainMock", title: "Transformer.ChainMock", description: "Chain-path-specific mock value. Dev/testing only." })).optional().describe("Path-specific mock values keyed by chain path. Takes precedence over global mock. Dev/testing only."), mapping: we2.optional().describe("Declarative event-to-event mapping applied when this transformer step has no code. At this position, only event-mutating fields apply (policy, mapping[].policy, mapping[].name, mapping[].ignore, mapping[].consent, include); vendor-payload fields are ignored.") }).strict().meta({ id: "TransformerConfig", title: "Transformer.Config", description: "Transformer configuration (settings, env, chain wiring, cache, mocks)." }).describe("Transformer configuration");
|
|
1976
2039
|
oi = ni.partial().meta({ id: "TransformerPartialConfig", title: "Transformer.PartialConfig", description: "Partial transformer configuration with all fields optional." }).describe("Partial transformer configuration with all fields optional");
|
|
1977
2040
|
ri = o2(ni);
|
|
1978
2041
|
ai = o2(oi);
|
|
@@ -1996,9 +2059,9 @@ var init_dev = __esm({
|
|
|
1996
2059
|
ki = n3.record(n3.string(), n3.unknown()).meta({ id: "JsonSchema", title: "JsonSchema", description: "Structural JSON Schema fragment (Record<string, unknown>)" });
|
|
1997
2060
|
Ci = n3.record(n3.string(), n3.record(n3.string(), ki)).meta({ id: "ValidateEvents", title: "ValidateEvents", description: "Entity-action keyed JSON Schemas" }).describe("Entity-action keyed JSON Schemas");
|
|
1998
2061
|
xi = n3.object({ format: n3.boolean().optional().describe("Validate event structure against the standard event format"), events: Ci.optional().describe("Per entity-action JSON Schemas to validate matching events against"), schema: ki.optional().describe("A single JSON Schema applied to every event this step handles") }).meta({ id: "Validate", title: "Validate", description: "Step-level validation: { format?, events?, schema? }" });
|
|
1999
|
-
ji = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-source-browser@2.0.0")'), code: vi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowSourceConfig", title: "Source.Config", description: "Source-specific configuration object (Source.Config)." }).optional().describe("Source-specific configuration object"), env: n3.unknown().meta({ id: "FlowSourceEnv", title: "Source.BaseEnv", description: "Source environment configuration (Source.BaseEnv overrides)." }).optional().describe("Source environment configuration"), primary: n3.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary."), variables: mi.optional().describe("Source-level variables (highest priority in cascade)"), next:
|
|
2000
|
-
Ei = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/transformer-enricher@1.0.0")'), code: vi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.unknown().meta({ id: "FlowTransformerConfig", title: "Transformer.Config", description: "Transformer-specific configuration object." }).optional().describe("Transformer-specific configuration object"), env: n3.unknown().meta({ id: "FlowTransformerEnv", title: "Transformer.Env", description: "Transformer environment configuration." }).optional().describe("Transformer environment configuration"), before:
|
|
2001
|
-
Di = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-destination-gtag@2.0.0")'), code: vi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowDestinationConfig", title: "Destination.Config", description: "Destination-specific configuration object." }).optional().describe("Destination-specific configuration object"), env: n3.unknown().meta({ id: "FlowDestinationEnv", title: "Destination.Env", description: "Destination environment configuration." }).optional().describe("Destination environment configuration"), variables: mi.optional().describe("Destination-level variables (highest priority in cascade)"), before:
|
|
2062
|
+
ji = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-source-browser@2.0.0")'), code: vi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowSourceConfig", title: "Source.Config", description: "Source-specific configuration object (Source.Config)." }).optional().describe("Source-specific configuration object"), env: n3.unknown().meta({ id: "FlowSourceEnv", title: "Source.BaseEnv", description: "Source environment configuration (Source.BaseEnv overrides)." }).optional().describe("Source environment configuration"), primary: n3.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary."), variables: mi.optional().describe("Source-level variables (highest priority in cascade)"), next: We2.optional().describe("Pre-collector transformer chain. String, string[], or Route[] for conditional routing based on ingest data."), before: We2.optional().describe("Pre-source transformer chain (consent-exempt). Handles transport-level preprocessing."), examples: wi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ge.optional().describe("Cache configuration for this source (match \u2192 key \u2192 ttl rules)"), validate: xi.optional() }).meta({ id: "FlowSource", title: "Flow.Source", description: "Source package reference with configuration, env, chains, and examples." }).describe("Source package reference with configuration").superRefine(Pi);
|
|
2063
|
+
Ei = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/transformer-enricher@1.0.0")'), code: vi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.unknown().meta({ id: "FlowTransformerConfig", title: "Transformer.Config", description: "Transformer-specific configuration object." }).optional().describe("Transformer-specific configuration object"), env: n3.unknown().meta({ id: "FlowTransformerEnv", title: "Transformer.Env", description: "Transformer environment configuration." }).optional().describe("Transformer environment configuration"), before: We2.optional().describe("Pre-transformer chain. Runs before this transformer push function."), next: We2.optional().describe("Next transformer in chain. String, string[], or Route[] for conditional routing."), variables: mi.optional().describe("Transformer-level variables (highest priority in cascade)"), examples: wi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ge.optional().describe("Cache configuration for this transformer (match \u2192 key \u2192 ttl rules)"), validate: xi.optional() }).meta({ id: "FlowTransformer", title: "Flow.Transformer", description: "Transformer package reference with configuration, env, chains, and cache." }).describe("Transformer package reference with configuration").superRefine(Pi);
|
|
2064
|
+
Di = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-destination-gtag@2.0.0")'), code: vi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowDestinationConfig", title: "Destination.Config", description: "Destination-specific configuration object." }).optional().describe("Destination-specific configuration object"), env: n3.unknown().meta({ id: "FlowDestinationEnv", title: "Destination.Env", description: "Destination environment configuration." }).optional().describe("Destination environment configuration"), variables: mi.optional().describe("Destination-level variables (highest priority in cascade)"), before: He2.optional().describe("Post-collector transformer chain. String, string[], or Route[] for conditional routing. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), next: He2.optional().describe("Post-push transformer chain. Push response available at context.ingest._response. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), examples: wi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ge.optional().describe("Cache configuration for this destination (match \u2192 key \u2192 ttl rules)"), validate: xi.optional() }).meta({ id: "FlowDestination", title: "Flow.Destination", description: "Destination package reference with configuration, env, chains, and cache." }).describe("Destination package reference with configuration").superRefine(Pi);
|
|
2002
2065
|
Ii = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe("Store package specifier with optional version"), code: vi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during store registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowStoreConfig", title: "Store.Config", description: "Store-specific configuration object." }).optional().describe("Store-specific configuration object"), env: n3.unknown().meta({ id: "FlowStoreEnv", title: "Store.Env", description: "Store environment configuration." }).optional().describe("Store environment configuration"), cache: Qe.optional().describe("Cache configuration for this store (TTL-only rules, optional recursive `cache.store`)"), variables: mi.optional().describe("Store-level variables (highest priority in cascade)"), examples: wi.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).meta({ id: "FlowStore", title: "Flow.Store", description: "Store package reference with configuration, env, cache, and examples." }).describe("Store package reference with configuration").superRefine(Pi);
|
|
2003
2066
|
Oi = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowContractSchemaEntry", title: "Flow.ContractSchemaEntry", description: "JSON Schema object for event validation with description/examples annotations." }).describe("JSON Schema object for event validation with description/examples annotations");
|
|
2004
2067
|
Ji = n3.record(n3.string(), Oi).meta({ id: "FlowContractActions", title: "Flow.ContractActions", description: "Action-level contract entries keyed by action name." }).describe("Action-level contract entries");
|
|
@@ -2021,13 +2084,13 @@ var init_dev = __esm({
|
|
|
2021
2084
|
Xi = o2(Ci);
|
|
2022
2085
|
en = Yi.object({ lang: Yi.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"), code: Yi.string().describe("Code snippet") });
|
|
2023
2086
|
tn = Yi.object({ text: Yi.string().describe("Short actionable hint text focused on walkerOS usage"), code: Yi.array(en).optional().describe("Optional code snippets") });
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
Cn = { source:
|
|
2087
|
+
nn = Yi.record(Yi.string(), tn).describe("Keyed hints for AI consumption \u2014 lightweight context beyond schemas and examples");
|
|
2088
|
+
on = 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).") });
|
|
2089
|
+
an = /\$store\.([a-zA-Z_][a-zA-Z0-9_]*)/g;
|
|
2090
|
+
sn = /\$env\.([A-Za-z_]\w*)(=[^"}\s]*)?/g;
|
|
2091
|
+
cn = /\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?/g;
|
|
2092
|
+
ln = /\$(var|store|flow|secret):([a-zA-Z_][a-zA-Z0-9_]*)/g;
|
|
2093
|
+
Cn = { source: Wt2.configJsonSchema, destination: Re2.configJsonSchema };
|
|
2031
2094
|
}
|
|
2032
2095
|
});
|
|
2033
2096
|
|
|
@@ -3300,7 +3363,7 @@ function hasCodeReference(code) {
|
|
|
3300
3363
|
}
|
|
3301
3364
|
function validateReference(type, name, ref) {
|
|
3302
3365
|
if (type === "Transformer") {
|
|
3303
|
-
const r4 =
|
|
3366
|
+
const r4 = Lt({ ...ref }, "Transformer");
|
|
3304
3367
|
if (!r4.ok) {
|
|
3305
3368
|
throw new Error(`Transformer "${name}": ${r4.reason ?? "invalid entry."}`);
|
|
3306
3369
|
}
|
|
@@ -4153,12 +4216,12 @@ function buildSplitConfigObject(flowSettings, namedImports) {
|
|
|
4153
4216
|
return buildSplitStepEntry("destinations", key, dest);
|
|
4154
4217
|
});
|
|
4155
4218
|
const transformersEntries = Object.entries(transformers).filter(
|
|
4156
|
-
([, transformer]) => transformer.package || hasCodeReference(transformer.code) ||
|
|
4219
|
+
([, transformer]) => transformer.package || hasCodeReference(transformer.code) || Kt({ ...transformer }, "Transformer")
|
|
4157
4220
|
).map(([key, transformer]) => {
|
|
4158
4221
|
if (isInlineCode(transformer.code)) {
|
|
4159
4222
|
return ` ${key}: ${generateInlineCode(transformer.code, transformer.config || {}, transformer.env, { before: transformer.before, next: transformer.next })}`;
|
|
4160
4223
|
}
|
|
4161
|
-
if (
|
|
4224
|
+
if (Kt({ ...transformer }, "Transformer")) {
|
|
4162
4225
|
const chainLines = [];
|
|
4163
4226
|
if (transformer.before !== void 0) {
|
|
4164
4227
|
chainLines.push(`before: ${JSON.stringify(transformer.before)}`);
|
|
@@ -4274,6 +4337,16 @@ export default async function(context = {}) {
|
|
|
4274
4337
|
|
|
4275
4338
|
const result = await startFlow(config);
|
|
4276
4339
|
|
|
4340
|
+
// Telemetry observer installation: the host (pipeline.ts) builds the
|
|
4341
|
+
// observer functions via createTelemetryObserver + createBatchedPoster
|
|
4342
|
+
// and forwards them through context. Added to collector.observers so the
|
|
4343
|
+
// runtime self-emission loop drives them.
|
|
4344
|
+
if (context.observers) {
|
|
4345
|
+
for (const observer of context.observers) {
|
|
4346
|
+
result.collector.observers.add(observer);
|
|
4347
|
+
}
|
|
4348
|
+
}
|
|
4349
|
+
|
|
4277
4350
|
const httpSource = Object.values(result.collector.sources || {})
|
|
4278
4351
|
.find(s => 'httpHandler' in s && typeof s.httpHandler === 'function');
|
|
4279
4352
|
|
|
@@ -4305,13 +4378,29 @@ function generateWebEntry(stage1Path, dataPayload, options = {}) {
|
|
|
4305
4378
|
}
|
|
4306
4379
|
}` : "";
|
|
4307
4380
|
const stage1Specifier = toFileImportSpecifier(stage1Path);
|
|
4308
|
-
|
|
4381
|
+
const telemetryImport = options.telemetry ? `
|
|
4382
|
+
import { createBatchedPoster as __cbp, createTelemetryObserver as __cto } from '@walkeros/core';` : "";
|
|
4383
|
+
const telemetryBlock = options.telemetry ? `
|
|
4384
|
+
// --- Telemetry wiring ---
|
|
4385
|
+
{
|
|
4386
|
+
const __emit = __cbp({
|
|
4387
|
+
url: ${JSON.stringify(options.telemetry.observerUrl)},
|
|
4388
|
+
token: ${JSON.stringify(options.telemetry.ingestToken)},
|
|
4389
|
+
});
|
|
4390
|
+
const __observer = __cto(__emit, {
|
|
4391
|
+
flowId: ${JSON.stringify(options.telemetry.flowId)},
|
|
4392
|
+
level: ${JSON.stringify(options.telemetry.level ?? "standard")},
|
|
4393
|
+
sample: ${JSON.stringify(options.telemetry.sample ?? 1)},
|
|
4394
|
+
});
|
|
4395
|
+
collector.observers.add(__observer);
|
|
4396
|
+
}` : "";
|
|
4397
|
+
return `import { startFlow, wireConfig } from '${stage1Specifier}';${telemetryImport}
|
|
4309
4398
|
|
|
4310
4399
|
const __configData = ${dataPayload};
|
|
4311
4400
|
|
|
4312
4401
|
(async () => {
|
|
4313
4402
|
const config = wireConfig(__configData);${envBlock}
|
|
4314
|
-
const { collector, elb } = await startFlow(config);${assignmentCode}
|
|
4403
|
+
const { collector, elb } = await startFlow(config);${telemetryBlock}${assignmentCode}
|
|
4315
4404
|
})();`;
|
|
4316
4405
|
}
|
|
4317
4406
|
function processConfigValue(value) {
|
|
@@ -4328,7 +4417,7 @@ function serializeWithCode(value, indent) {
|
|
|
4328
4417
|
if (value.startsWith("$code:")) {
|
|
4329
4418
|
return value.slice(6);
|
|
4330
4419
|
}
|
|
4331
|
-
const esc =
|
|
4420
|
+
const esc = V.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4332
4421
|
const markerRe = new RegExp(
|
|
4333
4422
|
esc + "([a-zA-Z_][a-zA-Z0-9_]*)(?::((?:(?!" + esc + `)[^\\s"'])*))?`,
|
|
4334
4423
|
"g"
|
|
@@ -4912,7 +5001,10 @@ async function handleResult(fn2, options) {
|
|
|
4912
5001
|
}
|
|
4913
5002
|
}
|
|
4914
5003
|
async function listProjectsCommand(options) {
|
|
4915
|
-
await handleResult(
|
|
5004
|
+
await handleResult(
|
|
5005
|
+
() => listProjects({ cursor: options.cursor, limit: options.limit }),
|
|
5006
|
+
options
|
|
5007
|
+
);
|
|
4916
5008
|
}
|
|
4917
5009
|
async function getProjectCommand(projectId, options) {
|
|
4918
5010
|
await handleResult(
|
|
@@ -5056,7 +5148,9 @@ async function listFlowsCommand(options) {
|
|
|
5056
5148
|
projectId: options.project,
|
|
5057
5149
|
sort: options.sort,
|
|
5058
5150
|
order: options.order,
|
|
5059
|
-
includeDeleted: options.includeDeleted
|
|
5151
|
+
includeDeleted: options.includeDeleted,
|
|
5152
|
+
cursor: options.cursor,
|
|
5153
|
+
limit: options.limit
|
|
5060
5154
|
}),
|
|
5061
5155
|
options
|
|
5062
5156
|
);
|
|
@@ -5297,1010 +5391,1089 @@ init_dist();
|
|
|
5297
5391
|
init_dist();
|
|
5298
5392
|
init_dist();
|
|
5299
5393
|
init_dist();
|
|
5300
|
-
|
|
5301
|
-
var t2 = {
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5394
|
+
init_dist();
|
|
5395
|
+
var t2 = { Action: "action", Actions: "actions", Config: "config", Consent: "consent", Context: "context", Custom: "custom", Destination: "destination", Elb: "elb", Globals: "globals", Hook: "hook", Init: "init", Link: "link", On: "on", Prefix: "data-elb", Ready: "ready", Run: "run", Session: "session", Shutdown: "shutdown", User: "user", Walker: "walker" };
|
|
5396
|
+
var n = { Commands: t2, Utils: { Storage: { Cookie: "cookie", Local: "local", Session: "session" } } };
|
|
5397
|
+
function s2(e4, t4) {
|
|
5398
|
+
const n4 = {};
|
|
5399
|
+
return Object.entries(t4).forEach(([e5, t5]) => {
|
|
5400
|
+
n4[e5] = !!t5;
|
|
5401
|
+
}), e4.consent = ee(e4.consent, n4), { update: n4 };
|
|
5307
5402
|
}
|
|
5308
|
-
function
|
|
5309
|
-
|
|
5403
|
+
function S(e4, t4) {
|
|
5404
|
+
const n4 = e4.status.startedAt;
|
|
5405
|
+
return { flowId: "default", stepId: t4.stepId, stepType: t4.stepType, phase: t4.phase, eventId: t4.eventId, timestamp: new Date(t4.now).toISOString(), elapsedMs: t4.now - n4 };
|
|
5310
5406
|
}
|
|
5311
|
-
function
|
|
5312
|
-
|
|
5313
|
-
|
|
5407
|
+
function ne2(e4, t4) {
|
|
5408
|
+
return e4.storeId && t4.stores[e4.storeId] ? t4.stores[e4.storeId] : t4.stores.__cache;
|
|
5409
|
+
}
|
|
5410
|
+
function oe(e4) {
|
|
5411
|
+
const t4 = {};
|
|
5412
|
+
for (const [n4, o3] of Object.entries(e4)) {
|
|
5314
5413
|
const e5 = o3.config?.next;
|
|
5315
|
-
"string" == typeof e5 || Array.isArray(e5) && e5.every((e6) => "string" == typeof e6) ? n4
|
|
5414
|
+
"string" == typeof e5 || Array.isArray(e5) && e5.every((e6) => "string" == typeof e6) ? t4[n4] = { next: e5 } : t4[n4] = {};
|
|
5316
5415
|
}
|
|
5317
|
-
return
|
|
5416
|
+
return t4;
|
|
5318
5417
|
}
|
|
5319
|
-
function
|
|
5320
|
-
const
|
|
5321
|
-
return void 0 !== o3 ? { config: { ...
|
|
5418
|
+
function se2(e4, t4) {
|
|
5419
|
+
const n4 = e4.config || {}, o3 = e4[t4];
|
|
5420
|
+
return void 0 !== o3 ? { config: { ...n4, [t4]: o3 }, chainValue: o3 } : { config: n4, chainValue: void 0 };
|
|
5322
5421
|
}
|
|
5323
|
-
function
|
|
5422
|
+
function re2(e4, t4 = {}) {
|
|
5324
5423
|
if (!e4) return [];
|
|
5325
5424
|
if (Array.isArray(e4)) return e4;
|
|
5326
|
-
const
|
|
5425
|
+
const n4 = [], o3 = /* @__PURE__ */ new Set();
|
|
5327
5426
|
let s5 = e4;
|
|
5328
|
-
for (; s5 &&
|
|
5329
|
-
o3.add(s5),
|
|
5330
|
-
const e5 =
|
|
5427
|
+
for (; s5 && t4[s5] && !o3.has(s5); ) {
|
|
5428
|
+
o3.add(s5), n4.push(s5);
|
|
5429
|
+
const e5 = t4[s5].next;
|
|
5331
5430
|
if (Array.isArray(e5)) {
|
|
5332
|
-
|
|
5431
|
+
n4.push(...e5);
|
|
5333
5432
|
break;
|
|
5334
5433
|
}
|
|
5335
5434
|
s5 = e5;
|
|
5336
5435
|
}
|
|
5337
|
-
return
|
|
5436
|
+
return n4;
|
|
5338
5437
|
}
|
|
5339
|
-
async function
|
|
5340
|
-
if (
|
|
5341
|
-
const o3 =
|
|
5438
|
+
async function ae(e4, t4, n4) {
|
|
5439
|
+
if (t4.init && !t4.config.init) {
|
|
5440
|
+
const o3 = t4.type || "unknown", s5 = e4.logger.scope(`transformer:${o3}`), r4 = { collector: e4, logger: s5, id: n4, ingest: E(n4), config: t4.config, env: de2(t4.config.env) };
|
|
5342
5441
|
s5.debug("init");
|
|
5343
|
-
const
|
|
5344
|
-
if (false ===
|
|
5345
|
-
|
|
5442
|
+
const a4 = await ot(t4.init, "TransformerInit", e4.hooks, e4.logger)(r4);
|
|
5443
|
+
if (false === a4) return false;
|
|
5444
|
+
t4.config = { ...a4 || t4.config, env: a4?.env || t4.config.env, init: true }, s5.debug("init done");
|
|
5346
5445
|
}
|
|
5347
5446
|
return true;
|
|
5348
5447
|
}
|
|
5349
|
-
async function
|
|
5350
|
-
const
|
|
5351
|
-
|
|
5352
|
-
const u4 =
|
|
5353
|
-
|
|
5448
|
+
async function ie2(e4, t4, n4, o3, s5, r4) {
|
|
5449
|
+
const a4 = t4.type || "unknown", i2 = e4.logger.scope(`transformer:${a4}`), c2 = { collector: e4, logger: i2, id: n4, ingest: s5, config: t4.config, env: { ...de2(t4.config.env), ...r4 ? { respond: r4 } : {} } };
|
|
5450
|
+
i2.debug("push", { event: o3.name });
|
|
5451
|
+
const u4 = "string" == typeof o3.id ? o3.id : "", d2 = Date.now(), l2 = S(e4, { stepId: o("transformer", n4), stepType: "transformer", phase: "in", eventId: u4, now: d2 });
|
|
5452
|
+
lt(e4, l2);
|
|
5453
|
+
try {
|
|
5454
|
+
const s6 = await ot(t4.push, "TransformerPush", e4.hooks, e4.logger)(o3, c2), r5 = Date.now(), a5 = S(e4, { stepId: o("transformer", n4), stepType: "transformer", phase: "out", eventId: u4, now: r5 });
|
|
5455
|
+
return a5.durationMs = r5 - d2, a5.outEvent = s6, lt(e4, a5), i2.debug("push done"), s6;
|
|
5456
|
+
} catch (t5) {
|
|
5457
|
+
const o4 = Date.now(), s6 = S(e4, { stepId: o("transformer", n4), stepType: "transformer", phase: "error", eventId: u4, now: o4 });
|
|
5458
|
+
throw s6.durationMs = o4 - d2, s6.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, lt(e4, s6), t5;
|
|
5459
|
+
}
|
|
5354
5460
|
}
|
|
5355
|
-
function
|
|
5356
|
-
return e4 ? { ...e4, _meta: { ...e4._meta, path: [...e4._meta.path] } } : E(
|
|
5461
|
+
function ce2(e4, t4) {
|
|
5462
|
+
return e4 ? { ...e4, _meta: { ...e4._meta, path: [...e4._meta.path] } } : E(t4);
|
|
5357
5463
|
}
|
|
5358
|
-
async function
|
|
5359
|
-
s5 || (s5 = E(
|
|
5360
|
-
let
|
|
5361
|
-
for (const o4 of
|
|
5362
|
-
const r5 =
|
|
5464
|
+
async function ue2(e4, t4, n4, o3, s5, r4, a4) {
|
|
5465
|
+
s5 || (s5 = E(n4[0] ?? "chain")), a4 && s5._meta && (s5._meta.chainPath = a4);
|
|
5466
|
+
let i2 = o3, c2 = r4;
|
|
5467
|
+
for (const o4 of n4) {
|
|
5468
|
+
const r5 = t4[o4];
|
|
5363
5469
|
if (!r5) {
|
|
5364
5470
|
e4.logger.warn(`Transformer not found: ${o4}`);
|
|
5365
5471
|
continue;
|
|
5366
5472
|
}
|
|
5367
5473
|
if (s5 && s5._meta && s5._meta.path.length > 256) return e4.logger.error(`Max path length exceeded at ${o4}`), { event: null, respond: c2 };
|
|
5368
5474
|
s5 && s5._meta && (s5._meta.hops++, s5._meta.path.push(o4));
|
|
5369
|
-
if (!await Ue(
|
|
5370
|
-
if (
|
|
5371
|
-
return e4.status.failed++, e4.logger.scope(`transformer:${r5.type || "unknown"}`).error("transformer init failed", { transformer: o4, error:
|
|
5475
|
+
if (!await Ue(ae, (t5) => {
|
|
5476
|
+
if (t5 instanceof Ze) throw t5;
|
|
5477
|
+
return e4.status.failed++, e4.logger.scope(`transformer:${r5.type || "unknown"}`).error("transformer init failed", { transformer: o4, error: t5 }), false;
|
|
5372
5478
|
})(e4, r5, o4)) return { event: null, respond: c2 };
|
|
5373
|
-
if (
|
|
5374
|
-
const
|
|
5375
|
-
e4.logger.scope(`transformer:${r5.type || "unknown"}`).debug("chainMock", { chain:
|
|
5479
|
+
if (a4 && void 0 !== r5.config?.chainMocks?.[a4]) {
|
|
5480
|
+
const t5 = r5.config.chainMocks[a4];
|
|
5481
|
+
e4.logger.scope(`transformer:${r5.type || "unknown"}`).debug("chainMock", { chain: a4 }), i2 = t5;
|
|
5376
5482
|
continue;
|
|
5377
5483
|
}
|
|
5378
5484
|
if (void 0 !== r5.config?.mock) {
|
|
5379
|
-
e4.logger.scope(`transformer:${r5.type || "unknown"}`).debug("mock"),
|
|
5485
|
+
e4.logger.scope(`transformer:${r5.type || "unknown"}`).debug("mock"), i2 = r5.config.mock;
|
|
5380
5486
|
continue;
|
|
5381
5487
|
}
|
|
5382
5488
|
if (r5.config?.disabled) continue;
|
|
5383
|
-
const u4 = r5.config?.cache,
|
|
5384
|
-
let
|
|
5385
|
-
if (
|
|
5386
|
-
const e5 =
|
|
5387
|
-
if ("HIT" ===
|
|
5388
|
-
if (
|
|
5489
|
+
const u4 = r5.config?.cache, d2 = u4 ? Mt(u4) : void 0, l2 = d2 ? ne2(d2, e4) : void 0;
|
|
5490
|
+
let f3;
|
|
5491
|
+
if (d2 && l2) {
|
|
5492
|
+
const e5 = Pt(s5, i2), t5 = await Rt(d2, l2, e5);
|
|
5493
|
+
if ("HIT" === t5?.status && t5.value) {
|
|
5494
|
+
if (i2 = t5.value, d2.stop) return { event: i2, respond: c2, stopped: true };
|
|
5389
5495
|
continue;
|
|
5390
5496
|
}
|
|
5391
|
-
"MISS" ===
|
|
5497
|
+
"MISS" === t5?.status && (f3 = { key: t5.key, ttl: t5.rule.ttl });
|
|
5392
5498
|
}
|
|
5393
|
-
const
|
|
5394
|
-
if (
|
|
5395
|
-
const
|
|
5396
|
-
if (1 ===
|
|
5397
|
-
const o5 =
|
|
5499
|
+
const p2 = r5.config.before;
|
|
5500
|
+
if (p2) {
|
|
5501
|
+
const n5 = It(p2, Pt(s5, i2));
|
|
5502
|
+
if (1 === n5.length) {
|
|
5503
|
+
const o5 = re2(n5[0], oe(t4));
|
|
5398
5504
|
if (o5.length > 0) {
|
|
5399
|
-
const
|
|
5400
|
-
if (null ===
|
|
5401
|
-
if (
|
|
5402
|
-
|
|
5505
|
+
const n6 = await ue2(e4, t4, o5, i2, s5, c2, a4);
|
|
5506
|
+
if (null === n6.event) return { event: null, respond: n6.respond ?? c2 };
|
|
5507
|
+
if (n6.stopped) return { event: Array.isArray(n6.event) ? n6.event[0] : n6.event, respond: n6.respond ?? c2, stopped: true };
|
|
5508
|
+
n6.respond && (c2 = n6.respond), i2 = Array.isArray(n6.event) ? n6.event[0] : n6.event;
|
|
5403
5509
|
}
|
|
5404
|
-
} else
|
|
5405
|
-
}
|
|
5406
|
-
const
|
|
5407
|
-
if (false ===
|
|
5408
|
-
if (Array.isArray(
|
|
5409
|
-
const r6 =
|
|
5410
|
-
const o5 =
|
|
5411
|
-
if (
|
|
5412
|
-
const s6 =
|
|
5510
|
+
} else n5.length > 1 && await Promise.all(n5.map((n6) => Ue(ue2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n6} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, re2(n6, oe(t4)), i2, ce2(s5, n6), void 0, a4)));
|
|
5511
|
+
}
|
|
5512
|
+
const g3 = await Ue(ie2, (t5) => (e4.logger.scope(`transformer:${r5.type || "unknown"}`).error("Push failed", { error: t5 }), false))(e4, r5, o4, i2, s5, c2);
|
|
5513
|
+
if (false === g3) return { event: null, respond: c2 };
|
|
5514
|
+
if (Array.isArray(g3)) {
|
|
5515
|
+
const r6 = n4.slice(n4.indexOf(o4) + 1), u5 = await Promise.all(g3.map(async (n5) => {
|
|
5516
|
+
const o5 = n5.event || i2, u6 = ce2(s5, "unknown");
|
|
5517
|
+
if (n5.next) {
|
|
5518
|
+
const s6 = It(n5.next, Pt(u6, o5));
|
|
5413
5519
|
if (0 === s6.length) return { event: o5, respond: c2 };
|
|
5414
5520
|
if (1 === s6.length) {
|
|
5415
|
-
const
|
|
5416
|
-
return
|
|
5521
|
+
const n6 = re2(s6[0], oe(t4));
|
|
5522
|
+
return n6.length > 0 ? ue2(e4, t4, n6, o5, u6, c2, a4) : { event: o5, respond: c2 };
|
|
5417
5523
|
}
|
|
5418
|
-
return (await Promise.all(s6.map((
|
|
5524
|
+
return (await Promise.all(s6.map((n6) => Ue(ue2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n6} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, re2(n6, oe(t4)), o5, ce2(u6, n6), void 0, a4)))).map((e5) => ({ event: e5.event, respond: void 0 }));
|
|
5419
5525
|
}
|
|
5420
|
-
return r6.length > 0 ?
|
|
5526
|
+
return r6.length > 0 ? ue2(e4, t4, r6, o5, u6, c2, a4) : { event: o5, respond: c2 };
|
|
5421
5527
|
}));
|
|
5422
|
-
let
|
|
5423
|
-
const
|
|
5528
|
+
let d3 = c2;
|
|
5529
|
+
const l3 = [];
|
|
5424
5530
|
for (const e5 of u5.flat()) if (null !== e5) if (e5 && "object" == typeof e5 && "event" in e5) {
|
|
5425
|
-
const
|
|
5426
|
-
if (
|
|
5427
|
-
Array.isArray(
|
|
5428
|
-
} else
|
|
5429
|
-
return 0 ===
|
|
5430
|
-
}
|
|
5431
|
-
if (
|
|
5432
|
-
const { event:
|
|
5531
|
+
const t5 = e5;
|
|
5532
|
+
if (t5.respond && (d3 = t5.respond), null === t5.event) continue;
|
|
5533
|
+
Array.isArray(t5.event) ? l3.push(...t5.event) : l3.push(t5.event);
|
|
5534
|
+
} else l3.push(e5);
|
|
5535
|
+
return 0 === l3.length ? { event: null, respond: d3 } : 1 === l3.length ? { event: l3[0], respond: d3 } : { event: l3, respond: d3 };
|
|
5536
|
+
}
|
|
5537
|
+
if (g3 && "object" == typeof g3) {
|
|
5538
|
+
const { event: n5, respond: o5, next: r6 } = g3;
|
|
5433
5539
|
if (o5 && (c2 = o5), void 0 !== r6) {
|
|
5434
|
-
const o6 =
|
|
5540
|
+
const o6 = It(r6, Pt(s5, i2));
|
|
5435
5541
|
if (0 === o6.length) {
|
|
5436
|
-
|
|
5542
|
+
n5 && (i2 = n5);
|
|
5437
5543
|
continue;
|
|
5438
5544
|
}
|
|
5439
5545
|
if (1 === o6.length) {
|
|
5440
|
-
const u5 =
|
|
5441
|
-
return u5.length > 0 ?
|
|
5546
|
+
const u5 = re2(o6[0], oe(t4));
|
|
5547
|
+
return u5.length > 0 ? ue2(e4, t4, u5, n5 || i2, s5, c2, a4) : (e4.logger.warn(`Branch target not found: ${JSON.stringify(r6)}`), { event: null, respond: c2 });
|
|
5442
5548
|
}
|
|
5443
|
-
return await Promise.all(o6.map((o7) => Ue(
|
|
5549
|
+
return await Promise.all(o6.map((o7) => Ue(ue2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${o7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, re2(o7, oe(t4)), n5 || i2, ce2(s5, o7), void 0, a4))), { event: null, respond: void 0 };
|
|
5444
5550
|
}
|
|
5445
|
-
|
|
5551
|
+
n5 && (i2 = n5);
|
|
5446
5552
|
}
|
|
5447
|
-
|
|
5448
|
-
const
|
|
5449
|
-
if ((!
|
|
5450
|
-
const
|
|
5451
|
-
if (1 ===
|
|
5452
|
-
const o5 =
|
|
5453
|
-
return o5.length > 0 ?
|
|
5553
|
+
f3 && l2 && Dt(l2, f3.key, i2, f3.ttl);
|
|
5554
|
+
const m3 = r5.config.next, h3 = "string" == typeof m3 || Array.isArray(m3) && m3.every((e5) => "string" == typeof e5), y2 = void 0 !== m3 && !h3;
|
|
5555
|
+
if ((!g3 || "object" == typeof g3 && !g3.next) && y2) {
|
|
5556
|
+
const n5 = It(r5.config.next, Pt(s5, i2));
|
|
5557
|
+
if (1 === n5.length) {
|
|
5558
|
+
const o5 = re2(n5[0], oe(t4));
|
|
5559
|
+
return o5.length > 0 ? ue2(e4, t4, o5, i2, s5, c2, a4) : { event: i2, respond: c2 };
|
|
5454
5560
|
}
|
|
5455
|
-
return
|
|
5561
|
+
return n5.length > 1 ? (await Promise.all(n5.map((n6) => Ue(ue2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n6} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, re2(n6, oe(t4)), i2, ce2(s5, n6), void 0, a4))), { event: null, respond: void 0 }) : { event: i2, respond: c2 };
|
|
5456
5562
|
}
|
|
5457
5563
|
}
|
|
5458
|
-
return { event:
|
|
5564
|
+
return { event: i2, respond: c2 };
|
|
5459
5565
|
}
|
|
5460
|
-
function
|
|
5566
|
+
function de2(e4) {
|
|
5461
5567
|
return e4 && le(e4) ? e4 : {};
|
|
5462
5568
|
}
|
|
5463
|
-
function
|
|
5569
|
+
function le2(e4) {
|
|
5464
5570
|
return "string" == typeof e4 || !(!Array.isArray(e4) || !e4.every((e5) => "string" == typeof e5));
|
|
5465
5571
|
}
|
|
5466
|
-
async function
|
|
5467
|
-
if (!
|
|
5468
|
-
const o3 =
|
|
5469
|
-
|
|
5470
|
-
const s5 =
|
|
5471
|
-
for (const { type:
|
|
5472
|
-
if (
|
|
5473
|
-
e4.status.failed++, e4.logger.scope("source").error("source on flush failed", { sourceId: s5, type:
|
|
5474
|
-
})(
|
|
5475
|
-
}
|
|
5476
|
-
function
|
|
5572
|
+
async function fe2(e4, t4, n4) {
|
|
5573
|
+
if (!t4.on || !t4.queueOn?.length) return;
|
|
5574
|
+
const o3 = t4.queueOn;
|
|
5575
|
+
t4.queueOn = [];
|
|
5576
|
+
const s5 = n4 || t4.config?.id || "unknown";
|
|
5577
|
+
for (const { type: n5, data: r4 } of o3) await Ue(t4.on, (t5) => {
|
|
5578
|
+
if (t5 instanceof Ze) throw t5;
|
|
5579
|
+
e4.status.failed++, e4.logger.scope("source").error("source on flush failed", { sourceId: s5, type: n5, error: t5 });
|
|
5580
|
+
})(n5, r4);
|
|
5581
|
+
}
|
|
5582
|
+
function pe2(e4) {
|
|
5477
5583
|
return Boolean(e4.config.init) && !e4.config.require?.length;
|
|
5478
5584
|
}
|
|
5479
|
-
async function
|
|
5480
|
-
const { code: o3, config: s5 = {}, env: r4 = {}, primary:
|
|
5481
|
-
let
|
|
5482
|
-
const u5 =
|
|
5483
|
-
const
|
|
5484
|
-
if (0 ===
|
|
5485
|
-
return
|
|
5585
|
+
async function ge2(e4, t4, n4) {
|
|
5586
|
+
const { code: o3, config: s5 = {}, env: r4 = {}, primary: a4, next: i2, before: c2, cache: u4 } = n4, d2 = u4, l2 = d2 ? Mt({ ...d2, stop: d2.stop ?? true }) : void 0, f3 = le2(i2) ? re2(i2, oe(e4.transformers)) : void 0, p2 = le2(c2) ? re2(c2, oe(e4.transformers)) : void 0, g3 = r4.push, m3 = g3 ?? e4.push, h3 = Boolean(g3), y2 = async (n5, o4, r5) => {
|
|
5587
|
+
let a5;
|
|
5588
|
+
const u5 = p2 ?? (void 0 !== c2 ? (() => {
|
|
5589
|
+
const t5 = It(c2, Pt(r5.ingest));
|
|
5590
|
+
if (0 === t5.length) return [];
|
|
5591
|
+
return re2(1 === t5.length ? t5[0] : t5, oe(e4.transformers));
|
|
5486
5592
|
})() : []);
|
|
5487
|
-
let
|
|
5593
|
+
let d3 = [n5];
|
|
5488
5594
|
if (u5.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
5489
|
-
const o5 = await
|
|
5595
|
+
const o5 = await ue2(e4, e4.transformers, u5, n5, r5.ingest, r5.respond, `source.${t4}.before`);
|
|
5490
5596
|
if (null === o5.event) return { ok: true };
|
|
5491
5597
|
if (o5.stopped) return o5.respond && (r5.respond = o5.respond), { ok: true };
|
|
5492
|
-
o5.respond && (r5.respond = o5.respond),
|
|
5598
|
+
o5.respond && (r5.respond = o5.respond), d3 = Array.isArray(o5.event) ? o5.event : [o5.event];
|
|
5493
5599
|
}
|
|
5494
|
-
if (
|
|
5495
|
-
const
|
|
5496
|
-
if (
|
|
5497
|
-
const
|
|
5600
|
+
if (l2) {
|
|
5601
|
+
const t5 = ne2(l2, e4);
|
|
5602
|
+
if (t5) {
|
|
5603
|
+
const n6 = Pt(r5.ingest), o5 = await Rt(l2, t5, n6);
|
|
5498
5604
|
if (o5) {
|
|
5499
|
-
if ("HIT" === o5.status && void 0 !== o5.value &&
|
|
5500
|
-
let
|
|
5501
|
-
return o5.rule.update && (
|
|
5605
|
+
if ("HIT" === o5.status && void 0 !== o5.value && l2.stop) {
|
|
5606
|
+
let t6 = o5.value;
|
|
5607
|
+
return o5.rule.update && (t6 = await Ft(t6, o5.rule.update, { ...n6, cache: { status: "HIT" } }, e4)), r5.respond?.(t6), { ok: true };
|
|
5502
5608
|
}
|
|
5503
|
-
if ("MISS" === o5.status &&
|
|
5504
|
-
const s6 = r5.respond,
|
|
5505
|
-
|
|
5506
|
-
const
|
|
5507
|
-
s6(
|
|
5508
|
-
})() : s6(
|
|
5609
|
+
if ("MISS" === o5.status && l2.stop && r5.respond) {
|
|
5610
|
+
const s6 = r5.respond, i3 = o5.rule.update, c3 = { ...n6, cache: { status: "MISS" } }, u6 = o5.key, d4 = o5.rule.ttl, l3 = (n7) => {
|
|
5611
|
+
Dt(t5, u6, n7, d4), i3 ? a5 = (async () => {
|
|
5612
|
+
const t6 = await Ft(n7, i3, c3, e4);
|
|
5613
|
+
s6(t6);
|
|
5614
|
+
})() : s6(n7);
|
|
5509
5615
|
};
|
|
5510
|
-
r5.respond =
|
|
5616
|
+
r5.respond = l3;
|
|
5511
5617
|
}
|
|
5512
|
-
"MISS" !== o5.status ||
|
|
5618
|
+
"MISS" !== o5.status || l2.stop || Dt(t5, o5.key, true, o5.rule.ttl);
|
|
5513
5619
|
}
|
|
5514
5620
|
}
|
|
5515
5621
|
}
|
|
5516
|
-
const
|
|
5517
|
-
const
|
|
5518
|
-
return 0 ===
|
|
5622
|
+
const g4 = f3 ? { kind: "single", preChain: f3 } : void 0 !== i2 ? (() => {
|
|
5623
|
+
const t5 = It(i2, Pt(r5.ingest));
|
|
5624
|
+
return 0 === t5.length ? { kind: "single", preChain: [] } : 1 === t5.length ? { kind: "single", preChain: re2(t5[0], oe(e4.transformers)) } : { kind: "many", branches: t5.map((t6) => re2(t6, oe(e4.transformers))) };
|
|
5519
5625
|
})() : { kind: "single", preChain: [] };
|
|
5520
5626
|
let y3 = { ok: true };
|
|
5521
|
-
for (const
|
|
5522
|
-
return
|
|
5523
|
-
},
|
|
5524
|
-
const o4 = E(
|
|
5525
|
-
if (!s5.ingest || void 0 ===
|
|
5526
|
-
const r5 = await He(
|
|
5627
|
+
for (const n6 of d3) "many" === g4.kind ? (await Promise.all(g4.branches.map((a6, i3) => Ue(async () => h3 ? m3(n6) : m3(n6, { ...o4, id: t4, ingest: ce2(r5.ingest, `${t4}.${i3}`), respond: void 0, mapping: s5, preChain: a6 }), (t5) => (e4.logger.scope("source:many").error(`many branch ${i3} failed`, { error: t5 }), { ok: true }))())), y3 = { ok: true }) : y3 = h3 ? await m3(n6) : await m3(n6, { ...o4, id: t4, ingest: r5.ingest, respond: r5.respond, mapping: s5, preChain: g4.preChain });
|
|
5628
|
+
return a5 && await a5, y3;
|
|
5629
|
+
}, w3 = async (n5) => {
|
|
5630
|
+
const o4 = E(t4);
|
|
5631
|
+
if (!s5.ingest || void 0 === n5) return o4;
|
|
5632
|
+
const r5 = await He(n5, s5.ingest, { collector: e4 });
|
|
5527
5633
|
return { ...o4, ...r5, _meta: o4._meta };
|
|
5528
|
-
},
|
|
5529
|
-
const o4 = { ingest: E(
|
|
5530
|
-
return y2(e5,
|
|
5531
|
-
} }, k2 = { collector: e4, logger:
|
|
5532
|
-
const o4 = { ingest: await
|
|
5533
|
-
return
|
|
5534
|
-
} }, C3 = await Ue(o3, (
|
|
5535
|
-
if (
|
|
5536
|
-
e4.status.failed++, e4.logger.scope("source").error("source factory failed", { sourceId:
|
|
5634
|
+
}, v3 = e4.logger.scope("source").scope(t4), b3 = { command: e4.command, sources: e4.sources, elb: e4.sources.elb.push, logger: v3, ...r4, push: async (e5, n5 = {}) => {
|
|
5635
|
+
const o4 = { ingest: E(t4), respond: void 0 };
|
|
5636
|
+
return y2(e5, n5, o4);
|
|
5637
|
+
} }, k2 = { collector: e4, logger: v3, id: t4, config: s5, env: b3, withScope: async (e5, t5, n5) => {
|
|
5638
|
+
const o4 = { ingest: await w3(e5), respond: t5 };
|
|
5639
|
+
return n5({ ...b3, push: (e6, t6 = {}) => y2(e6, t6, o4), ingest: o4.ingest, respond: o4.respond });
|
|
5640
|
+
} }, C3 = await Ue(o3, (n5) => {
|
|
5641
|
+
if (n5 instanceof Ze) throw n5;
|
|
5642
|
+
e4.status.failed++, e4.logger.scope("source").error("source factory failed", { sourceId: t4, error: n5 });
|
|
5537
5643
|
})(k2);
|
|
5538
5644
|
if (!C3) return;
|
|
5539
|
-
const
|
|
5540
|
-
return b3.logger =
|
|
5645
|
+
const I3 = C3.type || "unknown", q3 = e4.logger.scope(I3).scope(t4);
|
|
5646
|
+
return b3.logger = q3, a4 && (C3.config = { ...C3.config, primary: a4 }), C3;
|
|
5541
5647
|
}
|
|
5542
|
-
async function
|
|
5543
|
-
const
|
|
5544
|
-
for (const [o3, s5] of Object.entries(
|
|
5545
|
-
const
|
|
5546
|
-
if (!
|
|
5648
|
+
async function me2(e4, t4 = {}) {
|
|
5649
|
+
const n4 = {};
|
|
5650
|
+
for (const [o3, s5] of Object.entries(t4)) {
|
|
5651
|
+
const t5 = await ge2(e4, o3, s5);
|
|
5652
|
+
if (!t5) continue;
|
|
5547
5653
|
const r4 = s5.config?.require;
|
|
5548
|
-
|
|
5654
|
+
t5.config = { ...t5.config, init: false, ...r4 ? { require: [...r4] } : {} }, n4[o3] = t5;
|
|
5549
5655
|
}
|
|
5550
|
-
Object.assign(e4.sources,
|
|
5551
|
-
for (const
|
|
5552
|
-
const
|
|
5656
|
+
Object.assign(e4.sources, n4);
|
|
5657
|
+
for (const t5 of Object.keys(n4)) {
|
|
5658
|
+
const n5 = e4.sources[t5];
|
|
5553
5659
|
let o3 = false;
|
|
5554
|
-
|
|
5555
|
-
if (
|
|
5556
|
-
o3 = true, e4.status.failed++, e4.logger.scope("source").error("source init failed", { sourceId:
|
|
5557
|
-
})(), o3 || (
|
|
5660
|
+
n5.init && await Ue(n5.init.bind(n5), (n6) => {
|
|
5661
|
+
if (n6 instanceof Ze) throw n6;
|
|
5662
|
+
o3 = true, e4.status.failed++, e4.logger.scope("source").error("source init failed", { sourceId: t5, error: n6 });
|
|
5663
|
+
})(), o3 || (n5.config.init = true, pe2(n5) && await fe2(e4, n5, t5));
|
|
5558
5664
|
}
|
|
5559
|
-
return
|
|
5665
|
+
return n4;
|
|
5560
5666
|
}
|
|
5561
|
-
function
|
|
5562
|
-
if (
|
|
5563
|
-
e4.logger.scope("on").error("on callback failed", { kind:
|
|
5667
|
+
function he2(e4, t4, n4, o3) {
|
|
5668
|
+
if (n4 instanceof Ze) throw n4;
|
|
5669
|
+
e4.logger.scope("on").error("on callback failed", { kind: t4, ...o3, error: n4 });
|
|
5564
5670
|
}
|
|
5565
|
-
function
|
|
5566
|
-
return { collector: e4, logger: e4.logger.scope("on").scope(String(
|
|
5671
|
+
function ye2(e4, t4) {
|
|
5672
|
+
return { collector: e4, logger: e4.logger.scope("on").scope(String(t4)) };
|
|
5567
5673
|
}
|
|
5568
|
-
async function
|
|
5569
|
-
const o3 = e4.on, s5 = o3[
|
|
5674
|
+
async function we(e4, t4, n4) {
|
|
5675
|
+
const o3 = e4.on, s5 = o3[t4] || [], r4 = ne(n4) ? n4 : [n4];
|
|
5570
5676
|
r4.forEach((e5) => {
|
|
5571
5677
|
s5.push(e5);
|
|
5572
|
-
}), o3[
|
|
5678
|
+
}), o3[t4] = s5, be2(e4, t4, r4);
|
|
5573
5679
|
}
|
|
5574
|
-
function
|
|
5575
|
-
if (!
|
|
5576
|
-
const r4 =
|
|
5577
|
-
|
|
5680
|
+
function ve(e4, t4, n4, o3, s5) {
|
|
5681
|
+
if (!t4.on) return;
|
|
5682
|
+
const r4 = t4.type || "unknown", a4 = e4.logger.scope(r4).scope("on").scope(o3), i2 = { collector: e4, logger: a4, id: n4, config: t4.config, data: s5, env: Be(t4.env, t4.config.env) };
|
|
5683
|
+
Fe(t4.on, (t5) => he2(e4, "destination", t5, { destId: n4, type: o3 }))(o3, i2);
|
|
5578
5684
|
}
|
|
5579
|
-
function
|
|
5685
|
+
function be2(e4, t4, o3, s5) {
|
|
5580
5686
|
let r4;
|
|
5581
|
-
switch (
|
|
5582
|
-
case
|
|
5687
|
+
switch (t4) {
|
|
5688
|
+
case n.Commands.Consent:
|
|
5583
5689
|
r4 = s5 || e4.consent;
|
|
5584
5690
|
break;
|
|
5585
|
-
case
|
|
5691
|
+
case n.Commands.Session:
|
|
5586
5692
|
r4 = e4.session;
|
|
5587
5693
|
break;
|
|
5588
|
-
case
|
|
5694
|
+
case n.Commands.User:
|
|
5589
5695
|
r4 = s5 || e4.user;
|
|
5590
5696
|
break;
|
|
5591
|
-
case
|
|
5697
|
+
case n.Commands.Custom:
|
|
5592
5698
|
r4 = s5 || e4.custom;
|
|
5593
5699
|
break;
|
|
5594
|
-
case
|
|
5700
|
+
case n.Commands.Globals:
|
|
5595
5701
|
r4 = s5 || e4.globals;
|
|
5596
5702
|
break;
|
|
5597
|
-
case
|
|
5703
|
+
case n.Commands.Config:
|
|
5598
5704
|
r4 = s5 || e4.config;
|
|
5599
5705
|
break;
|
|
5600
|
-
case
|
|
5601
|
-
case
|
|
5706
|
+
case n.Commands.Ready:
|
|
5707
|
+
case n.Commands.Run:
|
|
5602
5708
|
default:
|
|
5603
5709
|
r4 = void 0;
|
|
5604
5710
|
}
|
|
5605
|
-
if (o3.length) switch (
|
|
5606
|
-
case
|
|
5607
|
-
!(function(e5,
|
|
5608
|
-
const s6 = o4 || e5.consent, r5 =
|
|
5609
|
-
|
|
5610
|
-
Object.keys(s6).filter((e6) => e6 in
|
|
5611
|
-
|
|
5711
|
+
if (o3.length) switch (t4) {
|
|
5712
|
+
case n.Commands.Consent:
|
|
5713
|
+
!(function(e5, t5, o4) {
|
|
5714
|
+
const s6 = o4 || e5.consent, r5 = ye2(e5, n.Commands.Consent);
|
|
5715
|
+
t5.forEach((t6) => {
|
|
5716
|
+
Object.keys(s6).filter((e6) => e6 in t6).forEach((n4) => {
|
|
5717
|
+
Fe(t6[n4], (t7) => he2(e5, "consent", t7, { key: n4 }))(s6, r5);
|
|
5612
5718
|
});
|
|
5613
5719
|
});
|
|
5614
5720
|
})(e4, o3, s5);
|
|
5615
5721
|
break;
|
|
5616
|
-
case
|
|
5617
|
-
!(function(e5,
|
|
5722
|
+
case n.Commands.Ready:
|
|
5723
|
+
!(function(e5, t5) {
|
|
5618
5724
|
if (!e5.allowed) return;
|
|
5619
|
-
const o4 =
|
|
5620
|
-
|
|
5621
|
-
|
|
5725
|
+
const o4 = ye2(e5, n.Commands.Ready);
|
|
5726
|
+
t5.forEach((t6) => {
|
|
5727
|
+
Fe(t6, (t7) => he2(e5, "ready", t7))(void 0, o4);
|
|
5622
5728
|
});
|
|
5623
5729
|
})(e4, o3);
|
|
5624
5730
|
break;
|
|
5625
|
-
case
|
|
5626
|
-
!(function(e5,
|
|
5731
|
+
case n.Commands.Run:
|
|
5732
|
+
!(function(e5, t5) {
|
|
5627
5733
|
if (!e5.allowed) return;
|
|
5628
|
-
const o4 =
|
|
5629
|
-
|
|
5630
|
-
|
|
5734
|
+
const o4 = ye2(e5, n.Commands.Run);
|
|
5735
|
+
t5.forEach((t6) => {
|
|
5736
|
+
Fe(t6, (t7) => he2(e5, "run", t7))(void 0, o4);
|
|
5631
5737
|
});
|
|
5632
5738
|
})(e4, o3);
|
|
5633
5739
|
break;
|
|
5634
|
-
case
|
|
5635
|
-
!(function(e5,
|
|
5740
|
+
case n.Commands.Session:
|
|
5741
|
+
!(function(e5, t5) {
|
|
5636
5742
|
if (!e5.session) return;
|
|
5637
|
-
const o4 =
|
|
5638
|
-
|
|
5639
|
-
|
|
5743
|
+
const o4 = ye2(e5, n.Commands.Session);
|
|
5744
|
+
t5.forEach((t6) => {
|
|
5745
|
+
Fe(t6, (t7) => he2(e5, "session", t7))(e5.session, o4);
|
|
5640
5746
|
});
|
|
5641
5747
|
})(e4, o3);
|
|
5642
5748
|
break;
|
|
5643
5749
|
default: {
|
|
5644
|
-
const
|
|
5750
|
+
const n4 = ye2(e4, t4);
|
|
5645
5751
|
o3.forEach((o4) => {
|
|
5646
|
-
"function" == typeof o4 &&
|
|
5752
|
+
"function" == typeof o4 && Fe(o4, (n5) => he2(e4, "generic", n5, { type: t4 }))(r4, n4);
|
|
5647
5753
|
});
|
|
5648
5754
|
break;
|
|
5649
5755
|
}
|
|
5650
5756
|
}
|
|
5651
5757
|
}
|
|
5652
|
-
async function
|
|
5653
|
-
let r4,
|
|
5654
|
-
switch (o3 || (
|
|
5655
|
-
case
|
|
5758
|
+
async function ke(e4, t4, o3, s5) {
|
|
5759
|
+
let r4, a4 = o3 || [];
|
|
5760
|
+
switch (o3 || (a4 = e4.on[t4] || []), t4) {
|
|
5761
|
+
case n.Commands.Consent:
|
|
5656
5762
|
r4 = s5 || e4.consent;
|
|
5657
5763
|
break;
|
|
5658
|
-
case
|
|
5764
|
+
case n.Commands.Session:
|
|
5659
5765
|
r4 = e4.session;
|
|
5660
5766
|
break;
|
|
5661
|
-
case
|
|
5767
|
+
case n.Commands.User:
|
|
5662
5768
|
r4 = s5 || e4.user;
|
|
5663
5769
|
break;
|
|
5664
|
-
case
|
|
5770
|
+
case n.Commands.Custom:
|
|
5665
5771
|
r4 = s5 || e4.custom;
|
|
5666
5772
|
break;
|
|
5667
|
-
case
|
|
5773
|
+
case n.Commands.Globals:
|
|
5668
5774
|
r4 = s5 || e4.globals;
|
|
5669
5775
|
break;
|
|
5670
|
-
case
|
|
5776
|
+
case n.Commands.Config:
|
|
5671
5777
|
r4 = s5 || e4.config;
|
|
5672
5778
|
break;
|
|
5673
|
-
case
|
|
5674
|
-
case
|
|
5779
|
+
case n.Commands.Ready:
|
|
5780
|
+
case n.Commands.Run:
|
|
5675
5781
|
default:
|
|
5676
5782
|
r4 = void 0;
|
|
5677
5783
|
}
|
|
5678
|
-
let
|
|
5679
|
-
for (const [
|
|
5784
|
+
let i2 = false;
|
|
5785
|
+
for (const [n4, o4] of Object.entries(e4.sources)) {
|
|
5680
5786
|
if (o4.config.require?.length) {
|
|
5681
|
-
const e5 = o4.config.require.indexOf(
|
|
5787
|
+
const e5 = o4.config.require.indexOf(t4);
|
|
5682
5788
|
-1 !== e5 && o4.config.require.splice(e5, 1);
|
|
5683
5789
|
}
|
|
5684
|
-
if (o4.on) if (
|
|
5685
|
-
false === await Ue(o4.on, (o5) =>
|
|
5686
|
-
} else o4.queueOn = o4.queueOn || [], o4.queueOn.push({ type:
|
|
5790
|
+
if (o4.on) if (pe2(o4)) {
|
|
5791
|
+
false === await Ue(o4.on, (o5) => he2(e4, "source", o5, { sourceId: n4, type: t4 }))(t4, r4) && (i2 = true);
|
|
5792
|
+
} else o4.queueOn = o4.queueOn || [], o4.queueOn.push({ type: t4, data: r4 });
|
|
5687
5793
|
}
|
|
5688
|
-
Object.entries(e4.destinations).forEach(([
|
|
5794
|
+
Object.entries(e4.destinations).forEach(([n4, o4]) => {
|
|
5689
5795
|
if (o4.on) {
|
|
5690
|
-
if (!o4.config.init) return o4.queueOn = o4.queueOn || [], void o4.queueOn.push({ type:
|
|
5691
|
-
|
|
5796
|
+
if (!o4.config.init) return o4.queueOn = o4.queueOn || [], void o4.queueOn.push({ type: t4, data: r4 });
|
|
5797
|
+
ve(e4, o4, n4, t4, r4);
|
|
5692
5798
|
}
|
|
5693
5799
|
});
|
|
5694
|
-
for (const [
|
|
5695
|
-
return Object.keys(e4.pending.destinations).length > 0 && await (async function(e5,
|
|
5696
|
-
for (const [
|
|
5697
|
-
if (!e5.pending.destinations[
|
|
5800
|
+
for (const [t5, n4] of Object.entries(e4.sources)) pe2(n4) && n4.queueOn?.length && await fe2(e4, n4, t5);
|
|
5801
|
+
return Object.keys(e4.pending.destinations).length > 0 && await (async function(e5, t5) {
|
|
5802
|
+
for (const [n4, o4] of Object.entries(e5.pending.destinations)) {
|
|
5803
|
+
if (!e5.pending.destinations[n4] || e5.destinations[n4]) continue;
|
|
5698
5804
|
const s6 = o4.config?.require;
|
|
5699
5805
|
if (!s6) continue;
|
|
5700
|
-
const r5 = s6.indexOf(
|
|
5806
|
+
const r5 = s6.indexOf(t5);
|
|
5701
5807
|
if (-1 === r5) continue;
|
|
5702
5808
|
if (s6.splice(r5, 1), s6.length > 0) continue;
|
|
5703
|
-
delete e5.pending.destinations[
|
|
5704
|
-
const
|
|
5705
|
-
false !==
|
|
5809
|
+
delete e5.pending.destinations[n4];
|
|
5810
|
+
const a5 = ze2(o4);
|
|
5811
|
+
false !== a5.config.queue && (a5.queuePush = [...e5.queue]), e5.destinations[n4] = a5;
|
|
5706
5812
|
}
|
|
5707
|
-
})(e4,
|
|
5813
|
+
})(e4, t4), be2(e4, t4, a4, s5), !i2;
|
|
5708
5814
|
}
|
|
5709
|
-
function
|
|
5710
|
-
if (!Number.isFinite(
|
|
5711
|
-
if ("dropNewest" === (
|
|
5815
|
+
function Ce2(e4, t4, n4, o3) {
|
|
5816
|
+
if (!Number.isFinite(n4.max) || n4.max <= 0) throw new Error(`pushBounded: max must be > 0 (got ${n4.max})`);
|
|
5817
|
+
if ("dropNewest" === (n4.onOverflow ?? "dropOldest")) return e4.length >= n4.max ? (o3 && o3([t4]), { appended: false, dropped: 1 }) : (e4.push(t4), { appended: true, dropped: 0 });
|
|
5712
5818
|
const s5 = [];
|
|
5713
|
-
for (; e4.length >=
|
|
5714
|
-
return e4.push(
|
|
5819
|
+
for (; e4.length >= n4.max; ) s5.push(e4.shift());
|
|
5820
|
+
return e4.push(t4), s5.length > 0 && o3 && o3(s5), { appended: true, dropped: s5.length };
|
|
5715
5821
|
}
|
|
5716
|
-
var
|
|
5717
|
-
function
|
|
5718
|
-
|
|
5822
|
+
var Ie2 = /* @__PURE__ */ new WeakMap();
|
|
5823
|
+
function qe(e4, t4, n4, o3) {
|
|
5824
|
+
Ie2.get(e4) || (Ie2.set(e4, true), t4.warn(n4, o3));
|
|
5719
5825
|
}
|
|
5720
|
-
function
|
|
5721
|
-
|
|
5826
|
+
function xe2(e4) {
|
|
5827
|
+
Ie2.delete(e4);
|
|
5722
5828
|
}
|
|
5723
|
-
var
|
|
5724
|
-
function
|
|
5725
|
-
return e4 ===
|
|
5829
|
+
var Oe = Object.freeze({ batched: true });
|
|
5830
|
+
function Se(e4) {
|
|
5831
|
+
return e4 === Oe;
|
|
5726
5832
|
}
|
|
5727
|
-
function
|
|
5833
|
+
function je2(e4) {
|
|
5728
5834
|
return void 0 === e4 ? {} : "number" == typeof e4 ? { wait: e4 } : { wait: e4.wait, size: e4.size, age: e4.age };
|
|
5729
5835
|
}
|
|
5730
|
-
function
|
|
5731
|
-
return e4.status.destinations[
|
|
5836
|
+
function De2(e4, t4) {
|
|
5837
|
+
return e4.status.destinations[t4] || (e4.status.destinations[t4] = { count: 0, failed: 0, duration: 0, queuePushSize: 0, dlqSize: 0 }), e4.status.destinations[t4];
|
|
5732
5838
|
}
|
|
5733
|
-
function
|
|
5734
|
-
e4.dropped[
|
|
5735
|
-
const s5 = e4.dropped[
|
|
5736
|
-
return s5[
|
|
5839
|
+
function Ae2(e4, t4, n4, o3) {
|
|
5840
|
+
e4.dropped[t4] || (e4.dropped[t4] = {});
|
|
5841
|
+
const s5 = e4.dropped[t4];
|
|
5842
|
+
return s5[n4] = (s5[n4] ?? 0) + o3, s5[n4];
|
|
5737
5843
|
}
|
|
5738
|
-
function
|
|
5844
|
+
function $e2(e4, t4, n4) {
|
|
5739
5845
|
if (!e4) return [];
|
|
5740
|
-
if (Array.isArray(e4) && e4.every((e5) => "string" == typeof e5)) return
|
|
5741
|
-
if ("string" == typeof e4) return
|
|
5742
|
-
const o3 =
|
|
5743
|
-
return 0 === o3.length ? [] : 1 === o3.length ?
|
|
5744
|
-
}
|
|
5745
|
-
async function
|
|
5746
|
-
const { code:
|
|
5747
|
-
if (!se(
|
|
5846
|
+
if (Array.isArray(e4) && e4.every((e5) => "string" == typeof e5)) return re2(e4, t4);
|
|
5847
|
+
if ("string" == typeof e4) return re2(e4, t4);
|
|
5848
|
+
const o3 = It(e4, Pt(n4));
|
|
5849
|
+
return 0 === o3.length ? [] : 1 === o3.length ? re2(o3[0], t4) : re2(o3, t4);
|
|
5850
|
+
}
|
|
5851
|
+
async function Ee2(e4, t4) {
|
|
5852
|
+
const { code: n4, config: o3 = {}, env: s5 = {}, before: r4, next: a4, cache: i2 } = t4;
|
|
5853
|
+
if (!se(n4.push)) return Pe2({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
|
|
5748
5854
|
const c2 = o3 || { init: false };
|
|
5749
5855
|
let u4 = r4 ? { ...c2, before: r4 } : { ...c2 };
|
|
5750
|
-
|
|
5751
|
-
const
|
|
5752
|
-
let
|
|
5753
|
-
if (!
|
|
5754
|
-
|
|
5755
|
-
} while (e4.destinations[
|
|
5756
|
-
return e4.destinations[
|
|
5757
|
-
}
|
|
5758
|
-
async function
|
|
5759
|
-
const { allowed: s5, consent: r4, globals:
|
|
5760
|
-
if (!s5) return
|
|
5761
|
-
if (
|
|
5762
|
-
const
|
|
5763
|
-
if (void 0 ===
|
|
5764
|
-
const o4 =
|
|
5856
|
+
a4 && (u4 = { ...u4, next: a4 }), i2 && (u4 = { ...u4, cache: i2 });
|
|
5857
|
+
const d2 = { ...n4, config: u4, env: Be(n4.env, s5) };
|
|
5858
|
+
let l2 = d2.config.id;
|
|
5859
|
+
if (!l2) do {
|
|
5860
|
+
l2 = Ae(5, "abcdefghijklmnopqrstuvwxyz");
|
|
5861
|
+
} while (e4.destinations[l2]);
|
|
5862
|
+
return e4.destinations[l2] = d2, false !== d2.config.queue && (d2.queuePush = [...e4.queue]), Me2(e4, void 0, {}, { [l2]: d2 });
|
|
5863
|
+
}
|
|
5864
|
+
async function Me2(e4, t4, n4 = {}, o3) {
|
|
5865
|
+
const { allowed: s5, consent: r4, globals: a4, user: g3 } = e4;
|
|
5866
|
+
if (!s5) return Pe2({ ok: false });
|
|
5867
|
+
if (t4) {
|
|
5868
|
+
const n5 = e4.config.queueMax;
|
|
5869
|
+
if (void 0 === n5) throw new Error("Collector.Config.queueMax is undefined; defaults must be seeded by collector()");
|
|
5870
|
+
const o4 = Ce2(e4.queue, t4, { max: n5 });
|
|
5765
5871
|
if (o4.dropped > 0) {
|
|
5766
|
-
const
|
|
5767
|
-
|
|
5768
|
-
} else e4.queue.length <
|
|
5872
|
+
const t5 = Ae2(e4.status, o("collector"), "queue", o4.dropped);
|
|
5873
|
+
qe(e4.queue, e4.logger, "collector.queue overflow; oldest events dropped", { buffer: "queue", cap: n5, droppedCount: t5 });
|
|
5874
|
+
} else e4.queue.length < n5 && xe2(e4.queue);
|
|
5769
5875
|
e4.status.in++;
|
|
5770
5876
|
}
|
|
5771
5877
|
o3 || (o3 = e4.destinations);
|
|
5772
|
-
const h3 = e4.transformers ?
|
|
5878
|
+
const h3 = e4.transformers ? oe(e4.transformers) : {}, w3 = await Promise.all(Object.entries(o3 || {}).map(async ([o4, s6]) => {
|
|
5773
5879
|
if (s6.config.disabled) return { id: o4, destination: s6, skipped: true };
|
|
5774
|
-
let
|
|
5775
|
-
s6.queuePush = [],
|
|
5776
|
-
const v4 =
|
|
5777
|
-
if (!
|
|
5778
|
-
if (!
|
|
5779
|
-
let
|
|
5880
|
+
let w4 = (s6.queuePush || []).map((e5) => ({ ...e5, consent: r4 }));
|
|
5881
|
+
s6.queuePush = [], t4 && w4.push(pe(t4));
|
|
5882
|
+
const v4 = n4.ingest ? { ...n4.ingest, _meta: { ...n4.ingest._meta, path: [...n4.ingest._meta.path] } } : E("unknown");
|
|
5883
|
+
if (!w4.length && !s6.queueOn?.length) return { id: o4, destination: s6, skipped: true };
|
|
5884
|
+
if (!w4.length && s6.queueOn?.length) {
|
|
5885
|
+
let t5 = false;
|
|
5780
5886
|
try {
|
|
5781
|
-
|
|
5782
|
-
} catch (
|
|
5887
|
+
t5 = await Te2(e4, s6, o4);
|
|
5888
|
+
} catch (t6) {
|
|
5783
5889
|
e4.status.failed++;
|
|
5784
|
-
const
|
|
5785
|
-
e4.logger.scope(
|
|
5890
|
+
const n5 = s6.type || "unknown";
|
|
5891
|
+
e4.logger.scope(n5).error("destination init failed", { error: t6 instanceof Error ? t6.message : String(t6) });
|
|
5786
5892
|
}
|
|
5787
|
-
return { id: o4, destination: s6, skipped: !
|
|
5893
|
+
return { id: o4, destination: s6, skipped: !t5 };
|
|
5788
5894
|
}
|
|
5789
|
-
const
|
|
5790
|
-
const n5 = be(s6.config.consent, r4,
|
|
5791
|
-
|
|
5895
|
+
const b4 = [], k3 = w4.filter((t5) => {
|
|
5896
|
+
const n5 = be(s6.config.consent, r4, t5.consent);
|
|
5897
|
+
if (n5) return t5.consent = n5, b4.push(t5), false;
|
|
5898
|
+
const a5 = S(e4, { stepId: o("destination", o4), stepType: "destination", phase: "skip", eventId: "string" == typeof t5.id ? t5.id : "", now: Date.now() });
|
|
5899
|
+
return a5.skipReason = "consent", r4 && (a5.consent = { ...r4 }), s6.config.consent && (a5.meta = { required: { ...s6.config.consent } }), lt(e4, a5), true;
|
|
5792
5900
|
});
|
|
5793
|
-
if (
|
|
5794
|
-
const
|
|
5795
|
-
let
|
|
5796
|
-
for (const e5 of
|
|
5797
|
-
|
|
5798
|
-
}
|
|
5799
|
-
if (
|
|
5800
|
-
|
|
5801
|
-
const o5 =
|
|
5802
|
-
|
|
5803
|
-
} else
|
|
5804
|
-
}
|
|
5805
|
-
if (!
|
|
5806
|
-
let
|
|
5901
|
+
if (k3.length > 0) {
|
|
5902
|
+
const t5 = s6.queuePush, n5 = s6.config.id || o4, r5 = { max: s6.config.queueMax ?? 1e3 };
|
|
5903
|
+
let a5 = 0;
|
|
5904
|
+
for (const e5 of k3) {
|
|
5905
|
+
a5 += Ce2(t5, e5, r5).dropped;
|
|
5906
|
+
}
|
|
5907
|
+
if (a5 > 0) {
|
|
5908
|
+
De2(e4, n5);
|
|
5909
|
+
const o5 = Ae2(e4.status, o("destination", n5), "queue", a5);
|
|
5910
|
+
qe(t5, e4.logger.scope(s6.type || "unknown"), "destination.queuePush overflow; oldest events dropped", { buffer: "queuePush", destination: n5, cap: r5.max, droppedCount: o5 });
|
|
5911
|
+
} else t5.length < r5.max && xe2(t5);
|
|
5912
|
+
}
|
|
5913
|
+
if (!b4.length) return { id: o4, destination: s6, queue: w4 };
|
|
5914
|
+
let C3, x2, O2 = false;
|
|
5807
5915
|
try {
|
|
5808
|
-
O2 = await
|
|
5809
|
-
} catch (
|
|
5916
|
+
O2 = await Te2(e4, s6, o4);
|
|
5917
|
+
} catch (t5) {
|
|
5810
5918
|
e4.status.failed++;
|
|
5811
|
-
const
|
|
5812
|
-
e4.logger.scope(
|
|
5919
|
+
const n5 = s6.type || "unknown";
|
|
5920
|
+
e4.logger.scope(n5).error("destination init failed", { error: t5 instanceof Error ? t5.message : String(t5) });
|
|
5813
5921
|
}
|
|
5814
|
-
if (!O2) return { id: o4, destination: s6, queue:
|
|
5922
|
+
if (!O2) return { id: o4, destination: s6, queue: w4 };
|
|
5815
5923
|
s6.dlq || (s6.dlq = []);
|
|
5816
|
-
const j2 =
|
|
5817
|
-
let
|
|
5818
|
-
return await Promise.all(
|
|
5924
|
+
const j2 = $e2(s6.config.before, h3, v4), D3 = s6.config.next, A2 = s6.config?.cache, $2 = A2 ? Mt(A2) : void 0, E3 = $2 ? ne2($2, e4) : void 0;
|
|
5925
|
+
let M3 = 0, T3 = 0;
|
|
5926
|
+
return await Promise.all(b4.map(async (t5) => {
|
|
5819
5927
|
let r5;
|
|
5820
|
-
if (
|
|
5821
|
-
const e5 =
|
|
5822
|
-
if ("HIT" ===
|
|
5823
|
-
"MISS" ===
|
|
5928
|
+
if (t5.globals = ee(a4, t5.globals), t5.user = ee(g3, t5.user), $2?.stop && E3) {
|
|
5929
|
+
const e5 = Pt(v4, t5), n5 = await Rt($2, E3, e5);
|
|
5930
|
+
if ("HIT" === n5?.status) return t5;
|
|
5931
|
+
"MISS" === n5?.status && (r5 = { key: n5.key, ttl: n5.rule.ttl });
|
|
5824
5932
|
}
|
|
5825
|
-
let u4 =
|
|
5933
|
+
let u4 = t5, d2 = n4.respond;
|
|
5826
5934
|
if (j2.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
5827
|
-
const s7 = await
|
|
5828
|
-
if (null === s7.event) return
|
|
5829
|
-
s7.respond && (
|
|
5935
|
+
const s7 = await ue2(e4, e4.transformers, j2, t5, v4, n4.respond, `destination.${o4}.before`);
|
|
5936
|
+
if (null === s7.event) return t5;
|
|
5937
|
+
s7.respond && (d2 = s7.respond), u4 = Array.isArray(s7.event) ? s7.event[0] : s7.event;
|
|
5830
5938
|
}
|
|
5831
|
-
if ($2 && !$2.stop &&
|
|
5832
|
-
const e5 =
|
|
5833
|
-
if ("HIT" ===
|
|
5834
|
-
"MISS" ===
|
|
5939
|
+
if ($2 && !$2.stop && E3) {
|
|
5940
|
+
const e5 = Pt(v4, u4), n5 = await Rt($2, E3, e5);
|
|
5941
|
+
if ("HIT" === n5?.status) return t5;
|
|
5942
|
+
"MISS" === n5?.status && (r5 = { key: n5.key, ttl: n5.rule.ttl });
|
|
5835
5943
|
}
|
|
5836
|
-
const
|
|
5944
|
+
const p2 = Date.now();
|
|
5837
5945
|
let m3 = false;
|
|
5838
|
-
const
|
|
5839
|
-
const
|
|
5840
|
-
e4.logger.scope(
|
|
5841
|
-
const r6 = s6.dlq,
|
|
5946
|
+
const y2 = await Ue(_e2, (t6) => {
|
|
5947
|
+
const n5 = s6.type || "unknown";
|
|
5948
|
+
e4.logger.scope(n5).error("Push failed", { error: t6, event: u4.name }), C3 = t6, m3 = true;
|
|
5949
|
+
const r6 = s6.dlq, a5 = s6.config.id || o4, i2 = { max: s6.config.dlqMax ?? 100 }, c2 = Ce2(r6, [u4, t6], i2);
|
|
5842
5950
|
if (c2.dropped > 0) {
|
|
5843
|
-
|
|
5844
|
-
const
|
|
5845
|
-
|
|
5846
|
-
} else r6.length <
|
|
5847
|
-
})(e4, s6, o4, u4, v4,
|
|
5848
|
-
if (
|
|
5849
|
-
void 0 !==
|
|
5850
|
-
const
|
|
5851
|
-
if (
|
|
5852
|
-
const
|
|
5853
|
-
|
|
5951
|
+
De2(e4, a5);
|
|
5952
|
+
const t7 = Ae2(e4.status, o("destination", a5), "dlq", c2.dropped);
|
|
5953
|
+
qe(r6, e4.logger.scope(s6.type || "unknown"), "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: a5, cap: i2.max, droppedCount: t7 });
|
|
5954
|
+
} else r6.length < i2.max && xe2(r6);
|
|
5955
|
+
})(e4, s6, o4, u4, v4, d2);
|
|
5956
|
+
if (M3 += Date.now() - p2, r5 && E3 && void 0 === s6.config.mock && Dt(E3, r5.key, y2 ?? true, r5.ttl), void 0 === y2 || Se(y2) || (x2 = y2), Se(y2) && T3++, !m3 && D3) {
|
|
5957
|
+
void 0 !== y2 && (v4._response = y2);
|
|
5958
|
+
const t6 = $e2(D3, h3, v4);
|
|
5959
|
+
if (t6.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
5960
|
+
const n5 = await ue2(e4, e4.transformers, t6, u4, v4, d2, `destination.${o4}.next`);
|
|
5961
|
+
n5.respond && (d2 = n5.respond);
|
|
5854
5962
|
}
|
|
5855
5963
|
}
|
|
5856
|
-
return
|
|
5857
|
-
})), { id: o4, destination: s6, error:
|
|
5858
|
-
})), v3 = {},
|
|
5859
|
-
for (const
|
|
5860
|
-
if (
|
|
5861
|
-
const
|
|
5862
|
-
|
|
5863
|
-
const s6 = e4.status.destinations[
|
|
5864
|
-
if (s6.queuePushSize =
|
|
5865
|
-
else if (
|
|
5964
|
+
return t5;
|
|
5965
|
+
})), { id: o4, destination: s6, error: C3, response: x2, totalDuration: M3, batchedCount: T3, allowedCount: b4.length };
|
|
5966
|
+
})), v3 = {}, b3 = {}, k2 = {};
|
|
5967
|
+
for (const t5 of w3) {
|
|
5968
|
+
if (t5.skipped) continue;
|
|
5969
|
+
const n5 = t5.destination, o4 = { type: n5.type || "unknown", data: t5.response };
|
|
5970
|
+
De2(e4, t5.id);
|
|
5971
|
+
const s6 = e4.status.destinations[t5.id], r5 = Date.now();
|
|
5972
|
+
if (s6.queuePushSize = n5.queuePush?.length ?? 0, s6.dlqSize = n5.dlq?.length ?? 0, t5.error) o4.error = t5.error, k2[t5.id] = o4, s6.failed++, s6.lastAt = r5, s6.duration += t5.totalDuration || 0, e4.status.failed++;
|
|
5973
|
+
else if (t5.queue && t5.queue.length) b3[t5.id] = o4;
|
|
5866
5974
|
else {
|
|
5867
|
-
const
|
|
5868
|
-
(Math.max(0,
|
|
5975
|
+
const n6 = t5.batchedCount ?? 0, a5 = t5.allowedCount ?? 0;
|
|
5976
|
+
(Math.max(0, a5 - n6) > 0 || 0 === a5) && (v3[t5.id] = o4, s6.count++, s6.lastAt = r5, s6.duration += t5.totalDuration || 0, e4.status.out++);
|
|
5869
5977
|
}
|
|
5870
5978
|
}
|
|
5871
|
-
return
|
|
5979
|
+
return Pe2({ event: t4, ...Object.keys(v3).length && { done: v3 }, ...Object.keys(b3).length && { queued: b3 }, ...Object.keys(k2).length && { failed: k2 } });
|
|
5872
5980
|
}
|
|
5873
|
-
async function
|
|
5874
|
-
if (
|
|
5875
|
-
const o3 =
|
|
5981
|
+
async function Te2(e4, t4, n4) {
|
|
5982
|
+
if (t4.init && !t4.config.init) {
|
|
5983
|
+
const o3 = t4.type || "unknown", s5 = e4.logger.scope(o3), r4 = { collector: e4, logger: s5, id: n4, config: t4.config, env: Be(t4.env, t4.config.env) };
|
|
5876
5984
|
s5.debug("init");
|
|
5877
|
-
const
|
|
5985
|
+
const a4 = Date.now();
|
|
5986
|
+
let i2;
|
|
5987
|
+
lt(e4, S(e4, { stepId: o("destination", n4), stepType: "destination", phase: "init", eventId: "", now: a4 }));
|
|
5988
|
+
try {
|
|
5989
|
+
i2 = await ot(t4.init, "DestinationInit", e4.hooks, e4.logger)(r4);
|
|
5990
|
+
} catch (t5) {
|
|
5991
|
+
const o4 = Date.now(), s6 = S(e4, { stepId: o("destination", n4), stepType: "destination", phase: "error", eventId: "", now: o4 });
|
|
5992
|
+
throw s6.durationMs = o4 - a4, s6.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, lt(e4, s6), t5;
|
|
5993
|
+
}
|
|
5878
5994
|
if (false === i2) return i2;
|
|
5879
|
-
if (
|
|
5880
|
-
const o4 =
|
|
5881
|
-
|
|
5882
|
-
for (const { type: s6, data: r5 } of o4)
|
|
5995
|
+
if (t4.config = { ...i2 || t4.config, init: true }, t4.queueOn?.length) {
|
|
5996
|
+
const o4 = t4.queueOn;
|
|
5997
|
+
t4.queueOn = [];
|
|
5998
|
+
for (const { type: s6, data: r5 } of o4) ve(e4, t4, n4, s6, r5);
|
|
5883
5999
|
}
|
|
5884
6000
|
s5.debug("init done");
|
|
5885
6001
|
}
|
|
5886
6002
|
return true;
|
|
5887
6003
|
}
|
|
5888
|
-
async function _e2(e4,
|
|
5889
|
-
const { config:
|
|
5890
|
-
if (
|
|
5891
|
-
const c2 =
|
|
5892
|
-
if (void 0 !==
|
|
5893
|
-
const
|
|
5894
|
-
if (
|
|
5895
|
-
if (
|
|
5896
|
-
const o5 = { key:
|
|
5897
|
-
const o6 =
|
|
6004
|
+
async function _e2(e4, t4, n4, o3, s5, r4) {
|
|
6005
|
+
const { config: a4 } = t4, i2 = await Ke(o3, a4, e4);
|
|
6006
|
+
if (i2.ignore) return false;
|
|
6007
|
+
const c2 = t4.type || "unknown", u4 = e4.logger.scope(c2), d2 = { collector: e4, logger: u4, id: n4, config: a4, data: i2.data, rule: i2.mapping, ingest: s5, env: { ...Be(t4.env, a4.env), ...r4 ? { respond: r4 } : {} } };
|
|
6008
|
+
if (void 0 !== a4.mock) return u4.debug("mock", { event: i2.event.name }), a4.mock;
|
|
6009
|
+
const l2 = i2.mapping, f3 = i2.mappingKey || "* *";
|
|
6010
|
+
if (l2?.batch && t4.pushBatch && void 0 === a4.mock) {
|
|
6011
|
+
if (t4.batches = t4.batches || {}, !t4.batches[f3]) {
|
|
6012
|
+
const o5 = { key: f3, entries: [], events: [], data: [] }, s6 = je2(l2.batch), r5 = je2(a4.batch), i3 = s6.wait ?? r5.wait ?? 3e4, c4 = s6.size ?? r5.size ?? 1e3, d4 = s6.age ?? r5.age ?? 3e4, p2 = Be(t4.env, a4.env), h3 = _e(async () => {
|
|
6013
|
+
const o6 = t4.batches[f3].batched;
|
|
5898
6014
|
if (0 === o6.entries.length) return;
|
|
5899
6015
|
const s7 = { key: o6.key, entries: o6.entries, events: o6.events, data: o6.data };
|
|
5900
6016
|
o6.entries = [], o6.events = [], o6.data = [];
|
|
5901
|
-
const r6 = s7.entries[0],
|
|
6017
|
+
const r6 = s7.entries[0], i4 = { collector: e4, logger: u4, id: n4, config: a4, data: void 0, rule: r6.rule, ingest: r6.ingest, env: { ...p2, ...r6.respond ? { respond: r6.respond } : {} } };
|
|
5902
6018
|
u4.debug("push batch", { events: s7.entries.length });
|
|
5903
|
-
const c5 =
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
6019
|
+
const c5 = t4.config.id || n4, d5 = De2(e4, c5), l3 = Date.now(), g3 = S(e4, { stepId: o("destination", n4), stepType: "destination", phase: "flush", eventId: "", now: l3 });
|
|
6020
|
+
g3.batch = { size: s7.entries.length, index: 0 }, lt(e4, g3);
|
|
6021
|
+
let h4 = true;
|
|
6022
|
+
await Ue(ot(t4.pushBatch, "DestinationPushBatch", e4.hooks, e4.logger), (o7) => {
|
|
6023
|
+
h4 = false;
|
|
6024
|
+
const r7 = Date.now(), a5 = S(e4, { stepId: o("destination", n4), stepType: "destination", phase: "error", eventId: "", now: r7 });
|
|
6025
|
+
a5.durationMs = r7 - l3, a5.error = o7 instanceof Error ? { name: o7.name, message: o7.message } : { message: String(o7) }, a5.batch = { size: s7.entries.length, index: 0 }, lt(e4, a5);
|
|
6026
|
+
const i5 = t4.dlq = t4.dlq || [], f4 = { max: t4.config.dlqMax ?? 100 };
|
|
6027
|
+
let p3 = 0;
|
|
5909
6028
|
for (const e5 of s7.entries) {
|
|
5910
|
-
|
|
6029
|
+
p3 += Ce2(i5, [e5.event, o7], f4).dropped;
|
|
5911
6030
|
}
|
|
5912
|
-
if (
|
|
5913
|
-
const
|
|
5914
|
-
|
|
5915
|
-
} else
|
|
5916
|
-
|
|
5917
|
-
})(s7,
|
|
5918
|
-
}, { wait:
|
|
5919
|
-
|
|
6031
|
+
if (p3 > 0) {
|
|
6032
|
+
const t5 = Ae2(e4.status, o("destination", c5), "dlq", p3);
|
|
6033
|
+
qe(i5, u4, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: c5, cap: f4.max, droppedCount: t5 });
|
|
6034
|
+
} else i5.length < f4.max && xe2(i5);
|
|
6035
|
+
d5.failed += s7.entries.length, d5.dlqSize = i5.length, e4.status.failed += s7.entries.length, u4.error("Push batch failed", { error: o7 instanceof Error ? o7.message : String(o7), entries: s7.entries.length });
|
|
6036
|
+
})(s7, i4), u4.debug("push batch done"), d5.inFlightBatch = Math.max(0, (d5.inFlightBatch ?? 0) - s7.entries.length), h4 && (d5.count += s7.entries.length, d5.lastAt = Date.now(), e4.status.out += s7.entries.length);
|
|
6037
|
+
}, { wait: i3, size: c4, age: d4 });
|
|
6038
|
+
t4.batches[f3] = { batched: o5, batchFn: () => {
|
|
5920
6039
|
h3();
|
|
5921
6040
|
}, flush: async () => {
|
|
5922
6041
|
await h3.flush();
|
|
5923
6042
|
} };
|
|
5924
6043
|
}
|
|
5925
|
-
const o4 =
|
|
5926
|
-
o4.batched.entries.push({ event:
|
|
5927
|
-
const c3 =
|
|
5928
|
-
return
|
|
6044
|
+
const o4 = t4.batches[f3];
|
|
6045
|
+
o4.batched.entries.push({ event: i2.event, ingest: s5, respond: r4, rule: l2, data: i2.data }), o4.batched.events.push(i2.event), ie(i2.data) && o4.batched.data.push(i2.data);
|
|
6046
|
+
const c3 = t4.config.id || n4, d3 = De2(e4, c3);
|
|
6047
|
+
return d3.inFlightBatch = (d3.inFlightBatch ?? 0) + 1, o4.batchFn(), Oe;
|
|
5929
6048
|
}
|
|
5930
6049
|
{
|
|
5931
|
-
u4.debug("push", { event:
|
|
5932
|
-
const
|
|
5933
|
-
|
|
6050
|
+
u4.debug("push", { event: i2.event.name });
|
|
6051
|
+
const o4 = "string" == typeof i2.event.id ? i2.event.id : "", s6 = Date.now(), r5 = S(e4, { stepId: o("destination", n4), stepType: "destination", phase: "in", eventId: o4, now: s6 });
|
|
6052
|
+
i2.mappingKey && (r5.mappingKey = i2.mappingKey), i2.event.consent && (r5.consent = { ...i2.event.consent }), lt(e4, r5);
|
|
6053
|
+
try {
|
|
6054
|
+
const r6 = await ot(t4.push, "DestinationPush", e4.hooks, e4.logger)(i2.event, d2), a5 = Date.now(), c3 = S(e4, { stepId: o("destination", n4), stepType: "destination", phase: "out", eventId: o4, now: a5 });
|
|
6055
|
+
return c3.durationMs = a5 - s6, c3.outEvent = r6, i2.mappingKey && (c3.mappingKey = i2.mappingKey), lt(e4, c3), u4.debug("push done"), r6;
|
|
6056
|
+
} catch (t5) {
|
|
6057
|
+
const r6 = Date.now(), a5 = S(e4, { stepId: o("destination", n4), stepType: "destination", phase: "error", eventId: o4, now: r6 });
|
|
6058
|
+
throw a5.durationMs = r6 - s6, a5.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, i2.mappingKey && (a5.mappingKey = i2.mappingKey), lt(e4, a5), t5;
|
|
6059
|
+
}
|
|
5934
6060
|
}
|
|
5935
6061
|
}
|
|
5936
|
-
function
|
|
6062
|
+
function Pe2(e4) {
|
|
5937
6063
|
return { ok: !e4?.failed, ...e4 };
|
|
5938
6064
|
}
|
|
5939
|
-
function
|
|
5940
|
-
const { code:
|
|
5941
|
-
s5 && (
|
|
5942
|
-
const c2 =
|
|
5943
|
-
return { ...
|
|
6065
|
+
function ze2(e4) {
|
|
6066
|
+
const { code: t4, config: n4 = {}, env: o3 = {}, cache: s5 } = e4, { config: r4 } = se2(e4, "before"), { config: a4 } = se2({ ...e4, config: r4 }, "next"), i2 = { ...t4.config, ...n4, ...a4 };
|
|
6067
|
+
s5 && (i2.cache = s5);
|
|
6068
|
+
const c2 = Be(t4.env, o3);
|
|
6069
|
+
return { ...t4, config: i2, env: c2 };
|
|
5944
6070
|
}
|
|
5945
|
-
async function
|
|
5946
|
-
const
|
|
5947
|
-
for (const [o3, s5] of Object.entries(
|
|
5948
|
-
return
|
|
6071
|
+
async function Re(e4, t4 = {}) {
|
|
6072
|
+
const n4 = {};
|
|
6073
|
+
for (const [o3, s5] of Object.entries(t4)) s5.config?.require?.length ? e4.pending.destinations[o3] = s5 : n4[o3] = ze2(s5);
|
|
6074
|
+
return n4;
|
|
5949
6075
|
}
|
|
5950
|
-
function
|
|
5951
|
-
return e4 ||
|
|
6076
|
+
function Be(e4, t4) {
|
|
6077
|
+
return e4 || t4 ? t4 ? e4 && le(e4) && le(t4) ? { ...e4, ...t4 } : t4 : e4 : {};
|
|
5952
6078
|
}
|
|
5953
|
-
async function
|
|
6079
|
+
async function Ne(e4, t4, n4) {
|
|
5954
6080
|
const o3 = Object.entries(e4).map(async ([e5, o4]) => {
|
|
5955
6081
|
const s5 = o4.destroy;
|
|
5956
6082
|
if (!s5) return;
|
|
5957
|
-
const r4 = o4.type || "unknown",
|
|
6083
|
+
const r4 = o4.type || "unknown", a4 = n4.scope(r4), i2 = { id: e5, config: o4.config, env: o4.env ?? {}, logger: a4 };
|
|
5958
6084
|
try {
|
|
5959
|
-
await Promise.race([s5(
|
|
5960
|
-
} catch (
|
|
5961
|
-
|
|
6085
|
+
await Promise.race([s5(i2), new Promise((n5, o5) => setTimeout(() => o5(new Error(`${t4} '${e5}' destroy timed out`)), 5e3))]);
|
|
6086
|
+
} catch (n5) {
|
|
6087
|
+
a4.error(`${t4} '${e5}' destroy failed: ${n5}`);
|
|
5962
6088
|
}
|
|
5963
6089
|
});
|
|
5964
6090
|
await Promise.allSettled(o3);
|
|
5965
6091
|
}
|
|
5966
|
-
async function
|
|
5967
|
-
let r4,
|
|
5968
|
-
switch (
|
|
5969
|
-
case
|
|
5970
|
-
le(o3) && (ee(e4.config, o3, { shallow: false }),
|
|
6092
|
+
async function Ue2(e4, t4, o3) {
|
|
6093
|
+
let r4, a4, i2 = false;
|
|
6094
|
+
switch (t4) {
|
|
6095
|
+
case n.Commands.Config:
|
|
6096
|
+
le(o3) && (ee(e4.config, o3, { shallow: false }), a4 = o3, i2 = true);
|
|
5971
6097
|
break;
|
|
5972
|
-
case
|
|
6098
|
+
case n.Commands.Consent:
|
|
5973
6099
|
if (le(o3)) {
|
|
5974
|
-
const { update:
|
|
5975
|
-
|
|
6100
|
+
const { update: t5 } = s2(e4, o3);
|
|
6101
|
+
a4 = t5, i2 = true;
|
|
5976
6102
|
}
|
|
5977
6103
|
break;
|
|
5978
|
-
case
|
|
5979
|
-
le(o3) && (e4.custom = ee(e4.custom, o3),
|
|
6104
|
+
case n.Commands.Custom:
|
|
6105
|
+
le(o3) && (e4.custom = ee(e4.custom, o3), a4 = o3, i2 = true);
|
|
5980
6106
|
break;
|
|
5981
|
-
case
|
|
5982
|
-
le(o3) && "code" in o3 && le(o3.code) && (r4 = await
|
|
6107
|
+
case n.Commands.Destination:
|
|
6108
|
+
le(o3) && "code" in o3 && le(o3.code) && (r4 = await Ee2(e4, o3));
|
|
5983
6109
|
break;
|
|
5984
|
-
case
|
|
5985
|
-
le(o3) && (e4.globals = ee(e4.globals, o3),
|
|
6110
|
+
case n.Commands.Globals:
|
|
6111
|
+
le(o3) && (e4.globals = ee(e4.globals, o3), a4 = o3, i2 = true);
|
|
5986
6112
|
break;
|
|
5987
|
-
case
|
|
6113
|
+
case n.Commands.Hook:
|
|
5988
6114
|
if (le(o3) && fe(o3.name) && se(o3.fn)) {
|
|
5989
|
-
const { name:
|
|
5990
|
-
e4.hooks[
|
|
6115
|
+
const { name: t5, fn: n4 } = o3;
|
|
6116
|
+
e4.hooks[t5] = n4, a4 = o3, i2 = true;
|
|
5991
6117
|
}
|
|
5992
6118
|
break;
|
|
5993
|
-
case
|
|
6119
|
+
case n.Commands.On:
|
|
5994
6120
|
if (le(o3) && fe(o3.type)) {
|
|
5995
|
-
const { type:
|
|
5996
|
-
await
|
|
6121
|
+
const { type: t5, rules: n4 } = o3;
|
|
6122
|
+
await we(e4, t5, n4);
|
|
5997
6123
|
}
|
|
5998
6124
|
break;
|
|
5999
|
-
case
|
|
6000
|
-
|
|
6125
|
+
case n.Commands.Ready:
|
|
6126
|
+
i2 = true;
|
|
6001
6127
|
break;
|
|
6002
|
-
case
|
|
6003
|
-
r4 = await
|
|
6128
|
+
case n.Commands.Run:
|
|
6129
|
+
r4 = await Ve(e4, o3), i2 = true;
|
|
6004
6130
|
break;
|
|
6005
|
-
case
|
|
6006
|
-
|
|
6131
|
+
case n.Commands.Session:
|
|
6132
|
+
i2 = true;
|
|
6007
6133
|
break;
|
|
6008
|
-
case
|
|
6134
|
+
case n.Commands.Shutdown:
|
|
6009
6135
|
await (async function(e5) {
|
|
6010
|
-
const
|
|
6011
|
-
await
|
|
6136
|
+
const t5 = e5.logger;
|
|
6137
|
+
await Ne(e5.sources, "source", t5), await Ne(e5.destinations, "destination", t5), await Ne(e5.transformers, "transformer", t5), await Ne(e5.stores, "store", t5);
|
|
6012
6138
|
})(e4);
|
|
6013
6139
|
break;
|
|
6014
|
-
case
|
|
6015
|
-
le(o3) && (ee(e4.user, o3, { shallow: false }),
|
|
6140
|
+
case n.Commands.User:
|
|
6141
|
+
le(o3) && (ee(e4.user, o3, { shallow: false }), a4 = o3, i2 = true);
|
|
6016
6142
|
}
|
|
6017
|
-
return
|
|
6143
|
+
return i2 && (await ke(e4, t4, void 0, a4), r4 = await Me2(e4)), r4 || Pe2({ ok: true });
|
|
6018
6144
|
}
|
|
6019
|
-
function
|
|
6020
|
-
if (!
|
|
6021
|
-
const [
|
|
6022
|
-
if (!
|
|
6023
|
-
const { timestamp: s5 = Date.now(), name: r4 = `${
|
|
6024
|
-
return { name: r4, data:
|
|
6145
|
+
function Le2(e4, t4) {
|
|
6146
|
+
if (!t4.name) throw new Error("Event name is required");
|
|
6147
|
+
const [n4, o3] = t4.name.split(" ");
|
|
6148
|
+
if (!n4 || !o3) throw new Error("Event name is invalid");
|
|
6149
|
+
const { timestamp: s5 = Date.now(), name: r4 = `${n4} ${o3}`, data: a4 = {}, context: i2 = {}, globals: c2 = e4.globals, custom: u4 = {}, user: d2 = e4.user, nested: l2 = [], consent: f3 = e4.consent, id: p2 = $e(), trigger: g3 = "", entity: m3 = n4, action: h3 = o3, timing: y2 = 0, source: w3 = { type: "collector", schema: "4" } } = t4;
|
|
6150
|
+
return { name: r4, data: a4, context: i2, globals: c2, custom: u4, user: d2, nested: l2, consent: f3, id: p2, trigger: g3, entity: m3, action: h3, timestamp: s5, timing: y2, source: w3 };
|
|
6025
6151
|
}
|
|
6026
|
-
async function
|
|
6027
|
-
e4.allowed = true, e4.timing = Date.now(),
|
|
6152
|
+
async function Ve(e4, t4) {
|
|
6153
|
+
e4.allowed = true, e4.timing = Date.now(), t4 && (t4.consent && (e4.consent = ee(e4.consent, t4.consent)), t4.user && (e4.user = ee(e4.user, t4.user)), t4.globals && (e4.globals = ee(e4.config.globalsStatic || {}, t4.globals)), t4.custom && (e4.custom = ee(e4.custom, t4.custom))), Object.values(e4.destinations).forEach((e5) => {
|
|
6028
6154
|
e5.queuePush = [];
|
|
6029
6155
|
}), e4.queue = [], e4.round++;
|
|
6030
|
-
return await
|
|
6156
|
+
return await Me2(e4);
|
|
6031
6157
|
}
|
|
6032
|
-
function
|
|
6033
|
-
|
|
6034
|
-
const s5 = Date.now(), { id: r4, ingest:
|
|
6035
|
-
let
|
|
6036
|
-
const
|
|
6158
|
+
function nt(e4, t4) {
|
|
6159
|
+
const n4 = ot(async (n5, o3 = {}) => await Ue(async () => {
|
|
6160
|
+
const s5 = Date.now(), { id: r4, ingest: a4, respond: i2, mapping: c2, preChain: u4, include: d2, exclude: l2 } = o3;
|
|
6161
|
+
let f3 = i2, p2 = n5;
|
|
6162
|
+
const g3 = d2 || l2 ? (function(e5, t5, n6) {
|
|
6037
6163
|
let o4 = e5;
|
|
6038
|
-
return
|
|
6039
|
-
})(e4.destinations,
|
|
6164
|
+
return t5 && (o4 = Object.fromEntries(Object.entries(o4).filter(([e6]) => t5.includes(e6)))), n6 && (o4 = Object.fromEntries(Object.entries(o4).filter(([e6]) => !n6.includes(e6)))), o4;
|
|
6165
|
+
})(e4.destinations, d2, l2) : void 0, m3 = a4 ?? E(r4 || "unknown");
|
|
6040
6166
|
if (c2) {
|
|
6041
|
-
const
|
|
6042
|
-
if (
|
|
6167
|
+
const t5 = await Ke(p2, c2, e4);
|
|
6168
|
+
if (t5.ignore) return Pe2({ ok: true });
|
|
6043
6169
|
if (c2.consent) {
|
|
6044
|
-
if (!be(c2.consent, e4.consent,
|
|
6170
|
+
if (!be(c2.consent, e4.consent, t5.event.consent)) return Pe2({ ok: true });
|
|
6045
6171
|
}
|
|
6046
|
-
|
|
6172
|
+
p2 = t5.event;
|
|
6047
6173
|
}
|
|
6048
6174
|
if (u4?.length && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
6049
|
-
const
|
|
6050
|
-
if (null ===
|
|
6051
|
-
if (
|
|
6052
|
-
if (
|
|
6053
|
-
const o4 = await Promise.all(
|
|
6054
|
-
const o5 =
|
|
6055
|
-
return
|
|
6175
|
+
const n6 = await ue2(e4, e4.transformers, u4, p2, m3, f3, r4 ? `source.${r4}.next` : void 0);
|
|
6176
|
+
if (null === n6.event) return Pe2({ ok: true });
|
|
6177
|
+
if (n6.stopped) return n6.respond && (f3 = n6.respond), Pe2({ ok: true });
|
|
6178
|
+
if (n6.respond && (f3 = n6.respond), Array.isArray(n6.event)) {
|
|
6179
|
+
const o4 = await Promise.all(n6.event.map(async (n7) => {
|
|
6180
|
+
const o5 = t4(n7), s6 = Le2(e4, o5);
|
|
6181
|
+
return Me2(e4, s6, { id: r4, ingest: m3, respond: f3 }, g3);
|
|
6056
6182
|
}));
|
|
6057
6183
|
if (r4) {
|
|
6058
6184
|
e4.status.sources[r4] || (e4.status.sources[r4] = { count: 0, duration: 0 });
|
|
6059
|
-
const
|
|
6060
|
-
|
|
6185
|
+
const t5 = e4.status.sources[r4];
|
|
6186
|
+
t5.count += n6.event.length, t5.lastAt = Date.now(), t5.duration += Date.now() - s5;
|
|
6061
6187
|
}
|
|
6062
|
-
return o4[0] ??
|
|
6188
|
+
return o4[0] ?? Pe2({ ok: true });
|
|
6063
6189
|
}
|
|
6064
|
-
|
|
6190
|
+
p2 = n6.event;
|
|
6065
6191
|
}
|
|
6066
|
-
const
|
|
6192
|
+
const h3 = t4(p2), y2 = Le2(e4, h3), w3 = await Me2(e4, y2, { id: r4, ingest: m3, respond: f3 }, g3);
|
|
6067
6193
|
if (r4) {
|
|
6068
6194
|
e4.status.sources[r4] || (e4.status.sources[r4] = { count: 0, duration: 0 });
|
|
6069
|
-
const
|
|
6070
|
-
|
|
6195
|
+
const t5 = e4.status.sources[r4];
|
|
6196
|
+
t5.count++, t5.lastAt = Date.now(), t5.duration += Date.now() - s5;
|
|
6071
6197
|
}
|
|
6072
|
-
return
|
|
6073
|
-
}, (
|
|
6074
|
-
if (
|
|
6075
|
-
return e4.status.failed++, e4.logger.error("push failed", { event:
|
|
6198
|
+
return w3;
|
|
6199
|
+
}, (t5) => {
|
|
6200
|
+
if (t5 instanceof Ze) throw t5;
|
|
6201
|
+
return e4.status.failed++, e4.logger.error("push failed", { event: n5, ingest: o3.ingest, error: t5 }), Pe2({ ok: false });
|
|
6076
6202
|
})(), "Push", e4.hooks, e4.logger);
|
|
6203
|
+
return async (t5, o3) => {
|
|
6204
|
+
const s5 = "string" == typeof t5.id ? t5.id : "", r4 = Date.now();
|
|
6205
|
+
lt(e4, S(e4, { stepId: "collector.push", stepType: "collector", phase: "in", eventId: s5, now: r4 }));
|
|
6206
|
+
try {
|
|
6207
|
+
const a4 = await n4(t5, o3), i2 = Date.now(), c2 = S(e4, { stepId: "collector.push", stepType: "collector", phase: "out", eventId: s5, now: i2 });
|
|
6208
|
+
return c2.durationMs = i2 - r4, c2.outEvent = a4, lt(e4, c2), a4;
|
|
6209
|
+
} catch (t6) {
|
|
6210
|
+
const n5 = Date.now(), o4 = S(e4, { stepId: "collector.push", stepType: "collector", phase: "error", eventId: s5, now: n5 });
|
|
6211
|
+
throw o4.durationMs = n5 - r4, o4.error = t6 instanceof Error ? { name: t6.name, message: t6.message } : { message: String(t6) }, lt(e4, o4), t6;
|
|
6212
|
+
}
|
|
6213
|
+
};
|
|
6077
6214
|
}
|
|
6078
|
-
function
|
|
6079
|
-
const
|
|
6080
|
-
let
|
|
6081
|
-
o3 > 0 && (
|
|
6215
|
+
function ct2(e4 = {}) {
|
|
6216
|
+
const t4 = e4.maxEntries ?? 1e4, n4 = e4.lowWaterMark ?? 0.8, o3 = e4.sweepIntervalMs ?? 6e4, s5 = Math.floor(t4 * n4), r4 = /* @__PURE__ */ new Map(), a4 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, evictions_entries: 0, evictions_ttl: 0 };
|
|
6217
|
+
let i2;
|
|
6218
|
+
o3 > 0 && (i2 = setInterval(function() {
|
|
6082
6219
|
const e5 = Date.now();
|
|
6083
|
-
let
|
|
6084
|
-
for (const [
|
|
6085
|
-
|
|
6086
|
-
}, o3),
|
|
6220
|
+
let t5 = 0;
|
|
6221
|
+
for (const [n5, o4] of r4) void 0 !== o4.expires && o4.expires <= e5 && (r4.delete(n5), t5++);
|
|
6222
|
+
a4.evictions_ttl += t5;
|
|
6223
|
+
}, o3), i2 && "function" == typeof i2.unref && i2.unref());
|
|
6087
6224
|
return { type: "memory", config: {}, get(e5) {
|
|
6088
|
-
const
|
|
6089
|
-
if (
|
|
6090
|
-
|
|
6091
|
-
}, set(e5,
|
|
6092
|
-
const
|
|
6093
|
-
|
|
6094
|
-
if (r4.size <=
|
|
6225
|
+
const t5 = r4.get(e5);
|
|
6226
|
+
if (t5) return void 0 !== t5.expires && t5.expires <= Date.now() ? (r4.delete(e5), a4.evictions_ttl++, void a4.misses++) : (r4.delete(e5), r4.set(e5, t5), a4.hits++, t5.value);
|
|
6227
|
+
a4.misses++;
|
|
6228
|
+
}, set(e5, n5, o4) {
|
|
6229
|
+
const i3 = !r4.has(e5);
|
|
6230
|
+
i3 || r4.delete(e5), r4.set(e5, { value: n5, expires: void 0 !== o4 ? Date.now() + o4 : void 0 }), a4.writes++, i3 && a4.populates++, r4.size > t4 && (function() {
|
|
6231
|
+
if (r4.size <= t4) return;
|
|
6095
6232
|
const e6 = r4.size - s5;
|
|
6096
|
-
let
|
|
6097
|
-
for (const
|
|
6098
|
-
if (
|
|
6099
|
-
r4.delete(
|
|
6233
|
+
let n6 = 0;
|
|
6234
|
+
for (const t5 of r4.keys()) {
|
|
6235
|
+
if (n6 >= e6) break;
|
|
6236
|
+
r4.delete(t5), n6++;
|
|
6100
6237
|
}
|
|
6101
|
-
|
|
6238
|
+
a4.evictions_entries += n6;
|
|
6102
6239
|
})();
|
|
6103
6240
|
}, delete(e5) {
|
|
6104
|
-
r4.delete(e5) &&
|
|
6241
|
+
r4.delete(e5) && a4.deletes++;
|
|
6105
6242
|
}, get counters() {
|
|
6106
|
-
return { ...
|
|
6243
|
+
return { ...a4 };
|
|
6107
6244
|
}, destroy() {
|
|
6108
|
-
void 0 !==
|
|
6245
|
+
void 0 !== i2 && (clearInterval(i2), i2 = void 0), r4.clear();
|
|
6109
6246
|
} };
|
|
6110
6247
|
}
|
|
6111
|
-
function
|
|
6112
|
-
const { cacheConfig:
|
|
6113
|
-
|
|
6114
|
-
const
|
|
6115
|
-
|
|
6116
|
-
}
|
|
6117
|
-
|
|
6248
|
+
function lt2(e4, t4) {
|
|
6249
|
+
const { cacheConfig: n4, cacheStore: o3, namespace: s5, logger: r4, storeId: a4, collector: i2 } = t4, c2 = (e5, t5) => {
|
|
6250
|
+
if (!i2) return;
|
|
6251
|
+
const n5 = S(i2, { stepId: `store.${a4}`, stepType: "store", phase: "in", eventId: "", now: Date.now() });
|
|
6252
|
+
n5.meta = { op: "cache", cached: "hit" === t5, status: t5, key: e5 }, lt(i2, n5);
|
|
6253
|
+
}, u4 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, inflight_dedups: 0 }, d2 = n4.rules.map((e5) => ({ match: e5.match ? Et(e5.match) : () => true, ttl: e5.ttl })), l2 = (e5) => `${s5}:${e5}`;
|
|
6254
|
+
function f3(e5, t5) {
|
|
6255
|
+
const n5 = void 0 === t5 ? { key: e5 } : { key: e5, value: t5 };
|
|
6256
|
+
return d2.find((e6) => e6.match(n5));
|
|
6257
|
+
}
|
|
6258
|
+
const p2 = /* @__PURE__ */ new Map();
|
|
6118
6259
|
return { type: e4.type, config: e4.config, setup: e4.setup, get counters() {
|
|
6119
|
-
return { ...
|
|
6120
|
-
}, async get(
|
|
6121
|
-
const
|
|
6122
|
-
if (void 0 !== s6) return
|
|
6123
|
-
const r5 =
|
|
6124
|
-
if (r5) return
|
|
6125
|
-
|
|
6126
|
-
const
|
|
6260
|
+
return { ...u4 };
|
|
6261
|
+
}, async get(t5) {
|
|
6262
|
+
const n5 = l2(t5), s6 = await o3.get(n5);
|
|
6263
|
+
if (void 0 !== s6) return u4.hits++, c2(t5, "hit"), s6;
|
|
6264
|
+
const r5 = p2.get(n5);
|
|
6265
|
+
if (r5) return u4.inflight_dedups++, c2(t5, "hit"), r5;
|
|
6266
|
+
u4.misses++, c2(t5, "miss");
|
|
6267
|
+
const a5 = (async () => {
|
|
6127
6268
|
try {
|
|
6128
|
-
const s7 = await e4.get(
|
|
6269
|
+
const s7 = await e4.get(t5);
|
|
6129
6270
|
if (void 0 === s7) return;
|
|
6130
|
-
const r6 =
|
|
6271
|
+
const r6 = f3(t5, s7);
|
|
6131
6272
|
if (r6) try {
|
|
6132
|
-
await o3.set(
|
|
6273
|
+
await o3.set(n5, s7, 1e3 * r6.ttl), u4.populates++;
|
|
6133
6274
|
} catch (e5) {
|
|
6134
|
-
|
|
6275
|
+
g3("set", t5, e5);
|
|
6135
6276
|
}
|
|
6136
6277
|
return s7;
|
|
6137
6278
|
} finally {
|
|
6138
|
-
|
|
6279
|
+
p2.delete(n5);
|
|
6139
6280
|
}
|
|
6140
6281
|
})();
|
|
6141
|
-
return
|
|
6142
|
-
}, async set(
|
|
6143
|
-
|
|
6144
|
-
const r5 =
|
|
6282
|
+
return p2.set(n5, a5), a5;
|
|
6283
|
+
}, async set(t5, n5, s6) {
|
|
6284
|
+
u4.writes++, await e4.set(t5, n5, s6);
|
|
6285
|
+
const r5 = f3(t5, n5);
|
|
6145
6286
|
if (r5) try {
|
|
6146
|
-
await o3.set(
|
|
6287
|
+
await o3.set(l2(t5), n5, 1e3 * r5.ttl);
|
|
6147
6288
|
} catch (e5) {
|
|
6148
|
-
|
|
6289
|
+
g3("set", t5, e5);
|
|
6149
6290
|
}
|
|
6150
|
-
}, async delete(
|
|
6151
|
-
|
|
6291
|
+
}, async delete(t5) {
|
|
6292
|
+
u4.deletes++, await e4.delete(t5);
|
|
6152
6293
|
try {
|
|
6153
|
-
await o3.delete(
|
|
6294
|
+
await o3.delete(l2(t5));
|
|
6154
6295
|
} catch (e5) {
|
|
6155
|
-
|
|
6296
|
+
g3("delete", t5, e5);
|
|
6156
6297
|
}
|
|
6157
6298
|
} };
|
|
6158
|
-
function
|
|
6159
|
-
const o4 = `store-cache(${
|
|
6160
|
-
r4 ? r4.warn(o4, { error:
|
|
6299
|
+
function g3(e5, t5, n5) {
|
|
6300
|
+
const o4 = `store-cache(${a4}): cache ${e5} failed for "${t5}"; backing succeeded, continuing`;
|
|
6301
|
+
r4 ? r4.warn(o4, { error: n5 }) : console.warn(o4, n5);
|
|
6161
6302
|
}
|
|
6162
6303
|
}
|
|
6163
|
-
function
|
|
6164
|
-
const
|
|
6165
|
-
|
|
6304
|
+
function ft(e4, t4, n4) {
|
|
6305
|
+
const o3 = `store.${n4}`, s5 = ot(t4.get, "StoreGet", e4.hooks, e4.logger), r4 = ot(t4.set, "StoreSet", e4.hooks, e4.logger), a4 = ot(t4.delete, "StoreDelete", e4.hooks, e4.logger);
|
|
6306
|
+
t4.get = async (t5) => {
|
|
6307
|
+
const n5 = Date.now(), r5 = S(e4, { stepId: o3, stepType: "store", phase: "in", eventId: "", now: n5 });
|
|
6308
|
+
r5.meta = { op: "get", key: t5 }, lt(e4, r5);
|
|
6309
|
+
try {
|
|
6310
|
+
const r6 = await s5(t5), a5 = Date.now(), i2 = S(e4, { stepId: o3, stepType: "store", phase: "out", eventId: "", now: a5 });
|
|
6311
|
+
return i2.durationMs = a5 - n5, i2.meta = { op: "get", key: t5 }, lt(e4, i2), r6;
|
|
6312
|
+
} catch (s6) {
|
|
6313
|
+
const r6 = Date.now(), a5 = S(e4, { stepId: o3, stepType: "store", phase: "error", eventId: "", now: r6 });
|
|
6314
|
+
throw a5.durationMs = r6 - n5, a5.meta = { op: "get", key: t5 }, a5.error = s6 instanceof Error ? { name: s6.name, message: s6.message } : { message: String(s6) }, lt(e4, a5), s6;
|
|
6315
|
+
}
|
|
6316
|
+
}, t4.set = async (t5, n5, s6) => {
|
|
6317
|
+
const a5 = Date.now(), i2 = S(e4, { stepId: o3, stepType: "store", phase: "in", eventId: "", now: a5 });
|
|
6318
|
+
i2.meta = { op: "set", key: t5 }, lt(e4, i2);
|
|
6319
|
+
try {
|
|
6320
|
+
await r4(t5, n5, s6);
|
|
6321
|
+
const i3 = Date.now(), c2 = S(e4, { stepId: o3, stepType: "store", phase: "out", eventId: "", now: i3 });
|
|
6322
|
+
c2.durationMs = i3 - a5, c2.meta = { op: "set", key: t5 }, lt(e4, c2);
|
|
6323
|
+
} catch (n6) {
|
|
6324
|
+
const s7 = Date.now(), r5 = S(e4, { stepId: o3, stepType: "store", phase: "error", eventId: "", now: s7 });
|
|
6325
|
+
throw r5.durationMs = s7 - a5, r5.meta = { op: "set", key: t5 }, r5.error = n6 instanceof Error ? { name: n6.name, message: n6.message } : { message: String(n6) }, lt(e4, r5), n6;
|
|
6326
|
+
}
|
|
6327
|
+
}, t4.delete = async (t5) => {
|
|
6328
|
+
const n5 = Date.now(), s6 = S(e4, { stepId: o3, stepType: "store", phase: "in", eventId: "", now: n5 });
|
|
6329
|
+
s6.meta = { op: "delete", key: t5 }, lt(e4, s6);
|
|
6330
|
+
try {
|
|
6331
|
+
await a4(t5);
|
|
6332
|
+
const s7 = Date.now(), r5 = S(e4, { stepId: o3, stepType: "store", phase: "out", eventId: "", now: s7 });
|
|
6333
|
+
r5.durationMs = s7 - n5, r5.meta = { op: "delete", key: t5 }, lt(e4, r5);
|
|
6334
|
+
} catch (s7) {
|
|
6335
|
+
const r5 = Date.now(), a5 = S(e4, { stepId: o3, stepType: "store", phase: "error", eventId: "", now: r5 });
|
|
6336
|
+
throw a5.durationMs = r5 - n5, a5.meta = { op: "delete", key: t5 }, a5.error = s7 instanceof Error ? { name: s7.name, message: s7.message } : { message: String(s7) }, lt(e4, a5), s7;
|
|
6337
|
+
}
|
|
6338
|
+
};
|
|
6166
6339
|
}
|
|
6167
|
-
async function
|
|
6168
|
-
const
|
|
6169
|
-
for (const [o4, s6] of Object.entries(
|
|
6170
|
-
const { code:
|
|
6171
|
-
|
|
6340
|
+
async function pt(e4, t4 = {}) {
|
|
6341
|
+
const n4 = {};
|
|
6342
|
+
for (const [o4, s6] of Object.entries(t4)) {
|
|
6343
|
+
const { code: t5, config: r4 = {}, env: a4 = {} } = s6, i2 = e4.logger.scope("store").scope(o4), c2 = { collector: e4, logger: i2, id: o4, config: r4, env: a4 }, u4 = await t5(c2);
|
|
6344
|
+
n4[o4] = u4;
|
|
6172
6345
|
}
|
|
6173
|
-
const o3 =
|
|
6174
|
-
const
|
|
6175
|
-
for (const
|
|
6176
|
-
const
|
|
6346
|
+
const o3 = t4, s5 = (function(e5) {
|
|
6347
|
+
const t5 = {};
|
|
6348
|
+
for (const n6 of Object.keys(e5)) t5[n6] = "WHITE";
|
|
6349
|
+
const n5 = [], o4 = [];
|
|
6177
6350
|
function s6(r4) {
|
|
6178
|
-
const
|
|
6179
|
-
if ("BLACK" ===
|
|
6180
|
-
if ("GRAY" ===
|
|
6181
|
-
const e6 = o4.indexOf(r4),
|
|
6182
|
-
throw new Error(`Cycle in cache.store chain: ${
|
|
6183
|
-
}
|
|
6184
|
-
|
|
6185
|
-
const
|
|
6186
|
-
if (void 0 !==
|
|
6187
|
-
if (!(
|
|
6188
|
-
s6(
|
|
6189
|
-
}
|
|
6190
|
-
o4.pop(),
|
|
6191
|
-
}
|
|
6192
|
-
for (const
|
|
6193
|
-
return
|
|
6351
|
+
const a4 = t5[r4];
|
|
6352
|
+
if ("BLACK" === a4) return;
|
|
6353
|
+
if ("GRAY" === a4) {
|
|
6354
|
+
const e6 = o4.indexOf(r4), t6 = o4.slice(-1 === e6 ? 0 : e6).concat(r4).join(" -> ");
|
|
6355
|
+
throw new Error(`Cycle in cache.store chain: ${t6}`);
|
|
6356
|
+
}
|
|
6357
|
+
t5[r4] = "GRAY", o4.push(r4);
|
|
6358
|
+
const i2 = e5[r4].cache?.store;
|
|
6359
|
+
if (void 0 !== i2) {
|
|
6360
|
+
if (!(i2 in e5)) throw new Error(`Store "${r4}" cache.store references "${i2}", which is not declared in flow.stores`);
|
|
6361
|
+
s6(i2);
|
|
6362
|
+
}
|
|
6363
|
+
o4.pop(), t5[r4] = "BLACK", n5.push(r4);
|
|
6364
|
+
}
|
|
6365
|
+
for (const n6 of Object.keys(e5)) "WHITE" === t5[n6] && s6(n6);
|
|
6366
|
+
return n5;
|
|
6194
6367
|
})(o3);
|
|
6195
|
-
for (const
|
|
6196
|
-
const s6 = o3[
|
|
6368
|
+
for (const t5 of s5) {
|
|
6369
|
+
const s6 = o3[t5].cache;
|
|
6197
6370
|
if (!s6) continue;
|
|
6198
|
-
let r4,
|
|
6199
|
-
void 0 !== s6.store ? (r4 =
|
|
6200
|
-
const
|
|
6201
|
-
e4.logger.scope("store-cache").scope(
|
|
6371
|
+
let r4, a4;
|
|
6372
|
+
void 0 !== s6.store ? (r4 = n4[s6.store], a4 = s6.store) : (n4.__cache || (n4.__cache = ct2()), r4 = n4.__cache, a4 = "__cache");
|
|
6373
|
+
const i2 = s6.namespace ?? t5;
|
|
6374
|
+
e4.logger.scope("store-cache").scope(t5).info(`store "${t5}" caches with namespace "${i2}:" via ${a4}`), n4[t5] = lt2(n4[t5], { storeId: t5, cacheConfig: s6, cacheStore: r4, namespace: i2, logger: e4.logger.scope("store-cache").scope(t5), collector: e4 });
|
|
6202
6375
|
}
|
|
6203
|
-
for (const [
|
|
6204
|
-
return
|
|
6376
|
+
for (const [t5, o4] of Object.entries(n4)) "__cache" !== t5 && ft(e4, o4, t5);
|
|
6377
|
+
return n4;
|
|
6205
6378
|
}
|
|
6206
|
-
async function
|
|
6207
|
-
const
|
|
6208
|
-
|
|
6209
|
-
return ot(async (
|
|
6210
|
-
if (
|
|
6211
|
-
return e5.status.failed++, e5.logger.error("command failed", { command:
|
|
6379
|
+
async function gt(e4) {
|
|
6380
|
+
const t4 = ee({ globalsStatic: {}, sessionStatic: {}, run: true, queueMax: 1e3 }, e4, { merge: false, extend: false }), n4 = { level: e4.logger?.level, handler: e4.logger?.handler }, o3 = ze(n4), s5 = { ...t4.globalsStatic, ...e4.globals }, i2 = { allowed: false, config: t4, consent: e4.consent || {}, custom: e4.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: s5, hooks: e4.hooks || {}, observers: /* @__PURE__ */ new Set(), logger: o3, on: {}, queue: [], round: 0, session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {}, dropped: {} }, timing: Date.now(), user: e4.user || {}, sources: {}, pending: { destinations: {} }, push: void 0, command: void 0 };
|
|
6381
|
+
i2.push = nt(i2, (e5) => ({ timing: Math.round((Date.now() - i2.timing) / 10) / 100, source: { type: "collector", schema: "4", version: "4.1.1" }, ...e5 })), i2.command = (function(e5, t5) {
|
|
6382
|
+
return ot(async (n5, o4, s6) => await Ue(async () => await t5(e5, n5, o4, s6), (t6) => {
|
|
6383
|
+
if (t6 instanceof Ze) throw t6;
|
|
6384
|
+
return e5.status.failed++, e5.logger.error("command failed", { command: n5, data: o4, error: t6 }), Pe2({ ok: false });
|
|
6212
6385
|
})(), "Command", e5.hooks, e5.logger);
|
|
6213
|
-
})(
|
|
6386
|
+
})(i2, Ue2);
|
|
6214
6387
|
const c2 = e4.stores || {};
|
|
6215
|
-
return
|
|
6388
|
+
return i2.stores = await pt(i2, c2), (function(e5, t5, n5) {
|
|
6216
6389
|
const o4 = /* @__PURE__ */ new Map();
|
|
6217
|
-
for (const [
|
|
6390
|
+
for (const [n6, s7] of Object.entries(e5)) t5[n6] && o4.set(s7, t5[n6]);
|
|
6218
6391
|
if (0 !== o4.size) {
|
|
6219
|
-
for (const e6 of [
|
|
6392
|
+
for (const e6 of [n5.transformers, n5.destinations, n5.sources]) if (e6) for (const t6 of Object.values(e6)) s6(t6.env);
|
|
6220
6393
|
}
|
|
6221
6394
|
function s6(e6) {
|
|
6222
6395
|
if (e6) {
|
|
6223
|
-
for (const [
|
|
6224
|
-
const s7 = o4.get(
|
|
6225
|
-
s7 && (e6[
|
|
6396
|
+
for (const [t6, n6] of Object.entries(e6)) if ("object" == typeof n6 && null !== n6) {
|
|
6397
|
+
const s7 = o4.get(n6);
|
|
6398
|
+
s7 && (e6[t6] = s7);
|
|
6226
6399
|
}
|
|
6227
6400
|
}
|
|
6228
6401
|
}
|
|
6229
|
-
})(c2,
|
|
6230
|
-
const
|
|
6231
|
-
for (const [o4, s6] of Object.entries(
|
|
6232
|
-
const { code:
|
|
6233
|
-
if (!
|
|
6234
|
-
e5.logger.warn(`Transformer ${o4} invalid (${
|
|
6402
|
+
})(c2, i2.stores, e4), i2.stores.__cache || (i2.stores.__cache = ct2()), i2.destinations = await Re(i2, e4.destinations || {}), i2.transformers = await (async function(e5, t5 = {}) {
|
|
6403
|
+
const n5 = {};
|
|
6404
|
+
for (const [o4, s6] of Object.entries(t5)) {
|
|
6405
|
+
const { code: t6, env: r4 = {} } = s6, a4 = Lt(s6, "Transformer");
|
|
6406
|
+
if (!a4.ok) {
|
|
6407
|
+
e5.logger.warn(`Transformer ${o4} invalid (${a4.code}): ${a4.reason}. Skipping.`);
|
|
6235
6408
|
continue;
|
|
6236
6409
|
}
|
|
6237
|
-
const { config:
|
|
6238
|
-
const
|
|
6239
|
-
if (
|
|
6240
|
-
const
|
|
6241
|
-
if (void 0 !==
|
|
6242
|
-
for (const [e7, o5] of Object.entries(
|
|
6410
|
+
const { config: i3 } = se2(s6, "before"), { config: c3 } = se2({ ...s6, config: i3 }, "next"), u4 = Object.keys(r4).length > 0 ? { ...c3, env: r4 } : c3, { cache: d2 } = s6, l2 = d2 ? { ...u4, cache: d2 } : u4, f3 = e5.logger.scope("transformer").scope(o4), p2 = { collector: e5, logger: f3, id: o4, ingest: E(o4), config: l2, env: r4 }, g3 = t6 ?? ((e6) => {
|
|
6411
|
+
const t7 = s6.mapping;
|
|
6412
|
+
if (t7) {
|
|
6413
|
+
const n6 = [];
|
|
6414
|
+
if (void 0 !== t7.data && n6.push("data"), t7.mapping) {
|
|
6415
|
+
for (const [e7, o5] of Object.entries(t7.mapping)) if ("object" == typeof o5 && null !== o5) for (const [t8, s7] of Object.entries(o5)) {
|
|
6243
6416
|
if ("object" != typeof s7 || null === s7) continue;
|
|
6244
6417
|
const o6 = s7;
|
|
6245
|
-
void 0 !== o6.data &&
|
|
6418
|
+
void 0 !== o6.data && n6.push(`mapping[${e7}][${t8}].data`), void 0 !== o6.silent && n6.push(`mapping[${e7}][${t8}].silent`);
|
|
6246
6419
|
}
|
|
6247
6420
|
}
|
|
6248
|
-
return
|
|
6249
|
-
const o5 = await
|
|
6421
|
+
return n6.length > 0 && e6.collector.logger.warn(`Transformer ${o4}: \`${n6.join(", ")}\` ignored at transformer position (only event-mutating fields apply).`), { type: "pass", config: e6.config, push: async (n7) => {
|
|
6422
|
+
const o5 = await Ke(n7, t7, e6.collector);
|
|
6250
6423
|
return !o5.ignore && { event: o5.event };
|
|
6251
6424
|
} };
|
|
6252
6425
|
}
|
|
6253
6426
|
return { type: "pass", config: e6.config, push: (e7) => ({ event: e7 }) };
|
|
6254
|
-
}),
|
|
6255
|
-
void 0 !== s6.before && void 0 ===
|
|
6427
|
+
}), m3 = await g3(p2);
|
|
6428
|
+
void 0 !== s6.before && void 0 === m3.config?.before && (m3.config = { ...m3.config ?? {}, before: s6.before }), void 0 !== s6.next && void 0 === m3.config?.next && (m3.config = { ...m3.config ?? {}, next: s6.next }), n5[o4] = m3;
|
|
6256
6429
|
}
|
|
6257
|
-
return
|
|
6258
|
-
})(
|
|
6430
|
+
return n5;
|
|
6431
|
+
})(i2, e4.transformers || {}), i2;
|
|
6259
6432
|
}
|
|
6260
|
-
async function
|
|
6433
|
+
async function mt(e4) {
|
|
6261
6434
|
e4 = e4 || {};
|
|
6262
|
-
const
|
|
6435
|
+
const t4 = await gt(e4), n4 = (o3 = t4, { type: "elb", config: {}, push: async (e5, t5, n5, s6, r5) => {
|
|
6263
6436
|
if ("string" == typeof e5 && e5.startsWith("walker ")) {
|
|
6264
|
-
const
|
|
6265
|
-
return o3.command(
|
|
6437
|
+
const n6 = e5.replace("walker ", "");
|
|
6438
|
+
return o3.command(n6, t5);
|
|
6266
6439
|
}
|
|
6267
|
-
let
|
|
6268
|
-
if ("string" == typeof e5)
|
|
6440
|
+
let a5;
|
|
6441
|
+
if ("string" == typeof e5) a5 = { name: e5 }, t5 && "object" == typeof t5 && !Array.isArray(t5) && (a5.data = t5);
|
|
6269
6442
|
else {
|
|
6270
|
-
if (!e5 || "object" != typeof e5) return
|
|
6271
|
-
|
|
6443
|
+
if (!e5 || "object" != typeof e5) return Pe2({ ok: false });
|
|
6444
|
+
a5 = e5, t5 && "object" == typeof t5 && !Array.isArray(t5) && (a5.data = { ...a5.data || {}, ...t5 });
|
|
6272
6445
|
}
|
|
6273
|
-
return
|
|
6446
|
+
return n5 && "object" == typeof n5 && (a5.context = n5), s6 && Array.isArray(s6) && (a5.nested = s6), r5 && "object" == typeof r5 && (a5.custom = r5), o3.push(a5);
|
|
6274
6447
|
} });
|
|
6275
6448
|
var o3;
|
|
6276
|
-
|
|
6277
|
-
const { consent: s5, user: r4, globals:
|
|
6278
|
-
s5 && await
|
|
6279
|
-
let c2 =
|
|
6280
|
-
const u4 = Object.values(
|
|
6281
|
-
return
|
|
6282
|
-
}
|
|
6283
|
-
function
|
|
6449
|
+
t4.sources.elb = n4, await me2(t4, e4.sources || {});
|
|
6450
|
+
const { consent: s5, user: r4, globals: a4, custom: i2 } = e4;
|
|
6451
|
+
s5 && await t4.command("consent", s5), r4 && await t4.command("user", r4), a4 && Object.assign(t4.globals, a4), i2 && Object.assign(t4.custom, i2), t4.config.run && await t4.command("run");
|
|
6452
|
+
let c2 = n4.push;
|
|
6453
|
+
const u4 = Object.values(t4.sources).filter((e5) => "elb" !== e5.type), d2 = u4.find((e5) => e5.config.primary);
|
|
6454
|
+
return d2 ? c2 = d2.push : u4.length > 0 && (c2 = u4[0].push), { collector: t4, elb: c2 };
|
|
6455
|
+
}
|
|
6456
|
+
function ht(e4) {
|
|
6284
6457
|
if (null === e4 || "object" != typeof e4) return e4;
|
|
6285
|
-
if (Array.isArray(e4)) return e4.map(
|
|
6286
|
-
const
|
|
6287
|
-
for (const [
|
|
6288
|
-
return
|
|
6458
|
+
if (Array.isArray(e4)) return e4.map(ht);
|
|
6459
|
+
const t4 = {};
|
|
6460
|
+
for (const [n4, o3] of Object.entries(e4)) t4[n4] = "function" == typeof o3 ? o3 : ht(o3);
|
|
6461
|
+
return t4;
|
|
6289
6462
|
}
|
|
6290
|
-
function
|
|
6291
|
-
const
|
|
6292
|
-
for (const e5 of
|
|
6293
|
-
const
|
|
6463
|
+
function yt(e4) {
|
|
6464
|
+
const t4 = [], { simulation: n4, ...o3 } = e4, s5 = ht(o3);
|
|
6465
|
+
for (const e5 of n4) {
|
|
6466
|
+
const n5 = e5.startsWith("call:") ? e5.slice(5) : e5, o4 = n5.split(".");
|
|
6294
6467
|
let r4 = s5;
|
|
6295
6468
|
for (let e6 = 0; e6 < o4.length - 1 && null != r4[o4[e6]]; e6++) r4 = r4[o4[e6]];
|
|
6296
|
-
const
|
|
6297
|
-
if (null == r4 || !(
|
|
6298
|
-
const
|
|
6299
|
-
"function" == typeof
|
|
6300
|
-
return
|
|
6469
|
+
const a4 = o4[o4.length - 1];
|
|
6470
|
+
if (null == r4 || !(a4 in r4)) continue;
|
|
6471
|
+
const i2 = r4[a4];
|
|
6472
|
+
"function" == typeof i2 && (r4[a4] = function(...e6) {
|
|
6473
|
+
return t4.push({ fn: n5, args: e6, ts: Date.now() }), i2.apply(this, e6);
|
|
6301
6474
|
});
|
|
6302
6475
|
}
|
|
6303
|
-
return { wrappedEnv: s5, calls:
|
|
6476
|
+
return { wrappedEnv: s5, calls: t4 };
|
|
6304
6477
|
}
|
|
6305
6478
|
|
|
6306
6479
|
// ../server/destinations/api/dist/index.mjs
|
|
@@ -6459,7 +6632,7 @@ async function createEmitter(opts) {
|
|
|
6459
6632
|
}
|
|
6460
6633
|
}
|
|
6461
6634
|
};
|
|
6462
|
-
const { elb } = await
|
|
6635
|
+
const { elb } = await mt(collectorConfig);
|
|
6463
6636
|
elbFn = elb;
|
|
6464
6637
|
return elbFn;
|
|
6465
6638
|
}
|
|
@@ -7276,7 +7449,7 @@ function resolveBeforeChain(before, transformers, ingest, event) {
|
|
|
7276
7449
|
if (Array.isArray(before) && before.every(isString)) {
|
|
7277
7450
|
return before;
|
|
7278
7451
|
}
|
|
7279
|
-
const ids =
|
|
7452
|
+
const ids = It(before, Pt(ingest, event));
|
|
7280
7453
|
if (ids.length === 0) return [];
|
|
7281
7454
|
if (ids.length === 1) return walkStaticChain(ids[0], transformers);
|
|
7282
7455
|
return ids;
|
|
@@ -7700,7 +7873,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
7700
7873
|
`Transformer "${options.transformerId}" not found in collector. Available: ${Object.keys(collector.transformers || {}).join(", ") || "none"}`
|
|
7701
7874
|
);
|
|
7702
7875
|
}
|
|
7703
|
-
const initialized = await
|
|
7876
|
+
const initialized = await ae(
|
|
7704
7877
|
collector,
|
|
7705
7878
|
transformer,
|
|
7706
7879
|
options.transformerId
|
|
@@ -7724,7 +7897,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
7724
7897
|
processedEvent
|
|
7725
7898
|
);
|
|
7726
7899
|
if (beforeChainIds.length > 0) {
|
|
7727
|
-
const beforeResult = await
|
|
7900
|
+
const beforeResult = await ue2(
|
|
7728
7901
|
collector,
|
|
7729
7902
|
collector.transformers,
|
|
7730
7903
|
beforeChainIds,
|
|
@@ -7746,7 +7919,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
7746
7919
|
processedEvent = Array.isArray(beforeResult) ? beforeResult[0] : beforeResult;
|
|
7747
7920
|
}
|
|
7748
7921
|
}
|
|
7749
|
-
const pushResult = await
|
|
7922
|
+
const pushResult = await ie2(
|
|
7750
7923
|
collector,
|
|
7751
7924
|
transformer,
|
|
7752
7925
|
options.transformerId,
|
|
@@ -7868,7 +8041,7 @@ async function simulateDestination(configOrPath, event, options) {
|
|
|
7868
8041
|
...devEnv.push,
|
|
7869
8042
|
simulation: devEnv.simulation
|
|
7870
8043
|
};
|
|
7871
|
-
const { wrappedEnv, calls } =
|
|
8044
|
+
const { wrappedEnv, calls } = yt(combined);
|
|
7872
8045
|
if (destConfig) destConfig.env = wrappedEnv;
|
|
7873
8046
|
trackedCalls = calls;
|
|
7874
8047
|
}
|
|
@@ -8165,6 +8338,7 @@ function validatePort(port) {
|
|
|
8165
8338
|
init_utils3();
|
|
8166
8339
|
|
|
8167
8340
|
// src/commands/run/pipeline.ts
|
|
8341
|
+
init_dist();
|
|
8168
8342
|
init_tmp();
|
|
8169
8343
|
import { writeFileSync as writeFileSync4 } from "fs";
|
|
8170
8344
|
import fs17 from "fs-extra";
|
|
@@ -8243,14 +8417,15 @@ async function loadBundle(file, context2, logger) {
|
|
|
8243
8417
|
}
|
|
8244
8418
|
|
|
8245
8419
|
// src/runtime/runner.ts
|
|
8246
|
-
async function loadFlow(file, config, logger, loggerConfig, healthServer) {
|
|
8420
|
+
async function loadFlow(file, config, logger, loggerConfig, healthServer, observers) {
|
|
8247
8421
|
const absolutePath = resolve3(file);
|
|
8248
8422
|
const flowDir = dirname5(absolutePath);
|
|
8249
8423
|
process.chdir(flowDir);
|
|
8250
8424
|
const flowContext = {
|
|
8251
8425
|
...config,
|
|
8252
8426
|
...loggerConfig ? { logger: loggerConfig } : {},
|
|
8253
|
-
...healthServer ? { sourceSettings: { port: void 0 } } : {}
|
|
8427
|
+
...healthServer ? { sourceSettings: { port: void 0 } } : {},
|
|
8428
|
+
...observers ? { observers } : {}
|
|
8254
8429
|
};
|
|
8255
8430
|
const result = await loadBundle(absolutePath, flowContext, logger);
|
|
8256
8431
|
if (healthServer && typeof result.httpHandler === "function") {
|
|
@@ -8265,7 +8440,7 @@ async function loadFlow(file, config, logger, loggerConfig, healthServer) {
|
|
|
8265
8440
|
httpHandler: result.httpHandler
|
|
8266
8441
|
};
|
|
8267
8442
|
}
|
|
8268
|
-
async function swapFlow(currentHandle, newFile, config, logger, loggerConfig, healthServer) {
|
|
8443
|
+
async function swapFlow(currentHandle, newFile, config, logger, loggerConfig, healthServer, observers) {
|
|
8269
8444
|
logger.info("Shutting down current flow for hot-swap...");
|
|
8270
8445
|
if (healthServer) {
|
|
8271
8446
|
healthServer.setFlowHandler(null);
|
|
@@ -8282,7 +8457,8 @@ async function swapFlow(currentHandle, newFile, config, logger, loggerConfig, he
|
|
|
8282
8457
|
config,
|
|
8283
8458
|
logger,
|
|
8284
8459
|
loggerConfig,
|
|
8285
|
-
healthServer
|
|
8460
|
+
healthServer,
|
|
8461
|
+
observers
|
|
8286
8462
|
);
|
|
8287
8463
|
logger.info("Flow swapped successfully");
|
|
8288
8464
|
return newHandle;
|
|
@@ -8327,6 +8503,24 @@ var instanceId = randomBytes(8).toString("hex");
|
|
|
8327
8503
|
function getInstanceId() {
|
|
8328
8504
|
return instanceId;
|
|
8329
8505
|
}
|
|
8506
|
+
async function applyTraceUntilFromResponse(response, logger) {
|
|
8507
|
+
let parsed;
|
|
8508
|
+
try {
|
|
8509
|
+
parsed = await response.json();
|
|
8510
|
+
} catch (error) {
|
|
8511
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
8512
|
+
logger.debug(`Heartbeat response parse failed: ${message}`);
|
|
8513
|
+
return;
|
|
8514
|
+
}
|
|
8515
|
+
if (typeof parsed !== "object" || parsed === null) return;
|
|
8516
|
+
if (!("traceUntil" in parsed)) return;
|
|
8517
|
+
const value = parsed.traceUntil;
|
|
8518
|
+
if (typeof value === "string" && value.length > 0) {
|
|
8519
|
+
process.env.WALKEROS_TRACE_UNTIL = value;
|
|
8520
|
+
} else if (value === null) {
|
|
8521
|
+
delete process.env.WALKEROS_TRACE_UNTIL;
|
|
8522
|
+
}
|
|
8523
|
+
}
|
|
8330
8524
|
function createHeartbeat(config, logger) {
|
|
8331
8525
|
let timer = null;
|
|
8332
8526
|
const startTime = Date.now();
|
|
@@ -8375,6 +8569,9 @@ function createHeartbeat(config, logger) {
|
|
|
8375
8569
|
if (response.ok && counters && current) {
|
|
8376
8570
|
lastReported = current;
|
|
8377
8571
|
}
|
|
8572
|
+
if (response.ok) {
|
|
8573
|
+
await applyTraceUntilFromResponse(response, logger);
|
|
8574
|
+
}
|
|
8378
8575
|
if (response.status === 401 || response.status === 403) {
|
|
8379
8576
|
logger.error(
|
|
8380
8577
|
`Heartbeat auth failed (${response.status}). Token may have expired \u2014 redeploy to rotate.`
|
|
@@ -8476,6 +8673,7 @@ async function runPipeline(options) {
|
|
|
8476
8673
|
logger.info(`walkeros/flow v${VERSION}`);
|
|
8477
8674
|
logger.info(`Instance: ${getInstanceId()}`);
|
|
8478
8675
|
const healthServer = await createHealthServer(port, logger);
|
|
8676
|
+
const telemetryObservers = buildTelemetryObservers(api?.flowId ?? "flow");
|
|
8479
8677
|
const runtimeConfig = { port };
|
|
8480
8678
|
let handle;
|
|
8481
8679
|
try {
|
|
@@ -8484,7 +8682,8 @@ async function runPipeline(options) {
|
|
|
8484
8682
|
runtimeConfig,
|
|
8485
8683
|
logger,
|
|
8486
8684
|
loggerConfig,
|
|
8487
|
-
healthServer
|
|
8685
|
+
healthServer,
|
|
8686
|
+
telemetryObservers
|
|
8488
8687
|
);
|
|
8489
8688
|
} catch (error) {
|
|
8490
8689
|
await healthServer.close();
|
|
@@ -8550,7 +8749,8 @@ async function runPipeline(options) {
|
|
|
8550
8749
|
runtimeConfig,
|
|
8551
8750
|
logger,
|
|
8552
8751
|
loggerConfig,
|
|
8553
|
-
healthServer
|
|
8752
|
+
healthServer,
|
|
8753
|
+
telemetryObservers
|
|
8554
8754
|
);
|
|
8555
8755
|
writeCache(
|
|
8556
8756
|
api.cacheDir,
|
|
@@ -8609,6 +8809,15 @@ async function runPipeline(options) {
|
|
|
8609
8809
|
await new Promise(() => {
|
|
8610
8810
|
});
|
|
8611
8811
|
}
|
|
8812
|
+
function buildTelemetryObservers(flowId) {
|
|
8813
|
+
const url = process.env.WALKEROS_OBSERVER_URL;
|
|
8814
|
+
const token = process.env.WALKEROS_INGEST_TOKEN;
|
|
8815
|
+
if (!url || !token) return void 0;
|
|
8816
|
+
const emit = ut({ url, token });
|
|
8817
|
+
return [
|
|
8818
|
+
at(emit, () => ct({ flowId }))
|
|
8819
|
+
];
|
|
8820
|
+
}
|
|
8612
8821
|
async function injectSecrets(api, logger) {
|
|
8613
8822
|
try {
|
|
8614
8823
|
const secrets = await fetchSecrets({
|
|
@@ -8932,8 +9141,8 @@ function resolveEnvMarkers(value) {
|
|
|
8932
9141
|
return value;
|
|
8933
9142
|
}
|
|
8934
9143
|
function resolveEnvMarkersInString(input) {
|
|
8935
|
-
if (!input.includes(
|
|
8936
|
-
const esc =
|
|
9144
|
+
if (!input.includes(V)) return input;
|
|
9145
|
+
const esc = V.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
8937
9146
|
const re4 = new RegExp(
|
|
8938
9147
|
esc + "([a-zA-Z_][a-zA-Z0-9_]*)(?::((?:(?!" + esc + `)[^\\s"'])*))?`,
|
|
8939
9148
|
"g"
|
|
@@ -9289,7 +9498,7 @@ function validateFlow(input, options = {}) {
|
|
|
9289
9498
|
transformersValue
|
|
9290
9499
|
)) {
|
|
9291
9500
|
if (!le(transformerValue)) continue;
|
|
9292
|
-
const result =
|
|
9501
|
+
const result = Lt(transformerValue, "Transformer");
|
|
9293
9502
|
if (!result.ok) {
|
|
9294
9503
|
errors.push({
|
|
9295
9504
|
path: `flows.${flowName}.transformers.${name}`,
|
|
@@ -9735,7 +9944,7 @@ function validateMapping(input) {
|
|
|
9735
9944
|
// src/commands/validate/validators/entry.ts
|
|
9736
9945
|
init_dist();
|
|
9737
9946
|
import Ajv from "ajv";
|
|
9738
|
-
var CLIENT_HEADER = "walkeros-cli/4.1.1
|
|
9947
|
+
var CLIENT_HEADER = "walkeros-cli/4.1.1";
|
|
9739
9948
|
var SECTIONS = ["destinations", "sources", "transformers"];
|
|
9740
9949
|
function resolveEntry(path19, flowConfig) {
|
|
9741
9950
|
const flows = flowConfig.flows;
|
|
@@ -9811,7 +10020,7 @@ async function validateEntry(path19, flowConfig) {
|
|
|
9811
10020
|
}
|
|
9812
10021
|
let schemas;
|
|
9813
10022
|
try {
|
|
9814
|
-
const info = await
|
|
10023
|
+
const info = await xt(packageName, {
|
|
9815
10024
|
client: CLIENT_HEADER
|
|
9816
10025
|
});
|
|
9817
10026
|
schemas = info.schemas;
|
|
@@ -10624,7 +10833,9 @@ async function listDeploymentsCommand(options) {
|
|
|
10624
10833
|
() => listDeployments({
|
|
10625
10834
|
projectId: options.project,
|
|
10626
10835
|
type: options.type,
|
|
10627
|
-
status: options.status
|
|
10836
|
+
status: options.status,
|
|
10837
|
+
cursor: options.cursor,
|
|
10838
|
+
limit: options.limit
|
|
10628
10839
|
}),
|
|
10629
10840
|
options
|
|
10630
10841
|
);
|
|
@@ -10978,7 +11189,7 @@ authCmd.command("whoami").description("Show current user identity").option("-o,
|
|
|
10978
11189
|
});
|
|
10979
11190
|
});
|
|
10980
11191
|
var projectsCmd = program.command("projects").description("Manage walkerOS projects");
|
|
10981
|
-
projectsCmd.command("list").description("List all projects").option("-o, --output <path>", "output file path").option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (options) => {
|
|
11192
|
+
projectsCmd.command("list").description("List all projects").option("--cursor <c>", "cursor for next page (from previous response)").option("--limit <n>", "page size", parseInt).option("-o, --output <path>", "output file path").option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (options) => {
|
|
10982
11193
|
await listProjectsCommand(options);
|
|
10983
11194
|
});
|
|
10984
11195
|
projectsCmd.command("get [projectId]").description("Get project details").option("-o, --output <path>", "output file path").option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (projectId, options) => {
|
|
@@ -10994,7 +11205,7 @@ projectsCmd.command("delete [projectId]").description("Delete a project").option
|
|
|
10994
11205
|
await deleteProjectCommand(projectId, options);
|
|
10995
11206
|
});
|
|
10996
11207
|
var flowsCmd = program.command("flows").description("Manage walkerOS flows");
|
|
10997
|
-
flowsCmd.command("list").description("List all flows in a project").option("--project <id>", "project ID (defaults to WALKEROS_PROJECT_ID)").option("--sort <field>", "sort by: name, updated_at, created_at").option("--order <dir>", "sort order: asc, desc").option("--include-deleted", "include soft-deleted flows").option("-o, --output <path>", "output file path").option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (options) => {
|
|
11208
|
+
flowsCmd.command("list").description("List all flows in a project").option("--project <id>", "project ID (defaults to WALKEROS_PROJECT_ID)").option("--sort <field>", "sort by: name, updated_at, created_at").option("--order <dir>", "sort order: asc, desc").option("--include-deleted", "include soft-deleted flows").option("--cursor <c>", "cursor for next page (from previous response)").option("--limit <n>", "page size", parseInt).option("-o, --output <path>", "output file path").option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (options) => {
|
|
10998
11209
|
await listFlowsCommand(options);
|
|
10999
11210
|
});
|
|
11000
11211
|
flowsCmd.command("get <flowId>").description("Get a flow with its full content").option("--project <id>", "project ID (defaults to WALKEROS_PROJECT_ID)").option("-o, --output <path>", "output file path").option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (flowId, options) => {
|
|
@@ -11024,7 +11235,7 @@ deployCmd.command("start <flowId>").description("Deploy a flow to walkerOS cloud
|
|
|
11024
11235
|
).option("-o, --output <path>", "output file path").option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (flowId, options) => {
|
|
11025
11236
|
await deployCommand(flowId, options);
|
|
11026
11237
|
});
|
|
11027
|
-
deployCmd.command("list").description("List all deployments in a project").option("--project <id>", "project ID (defaults to WALKEROS_PROJECT_ID)").option("--type <type>", "filter by type: web, server").option("--status <status>", "filter by status").option("-o, --output <path>", "output file path").option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (options) => {
|
|
11238
|
+
deployCmd.command("list").description("List all deployments in a project").option("--project <id>", "project ID (defaults to WALKEROS_PROJECT_ID)").option("--type <type>", "filter by type: web, server").option("--status <status>", "filter by status").option("--cursor <c>", "cursor for next page (from previous response)").option("--limit <n>", "page size", parseInt).option("-o, --output <path>", "output file path").option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (options) => {
|
|
11028
11239
|
await listDeploymentsCommand(options);
|
|
11029
11240
|
});
|
|
11030
11241
|
deployCmd.command("status <id-or-slug>").description("Get deployment details by ID or slug").option("--project <id>", "project ID").option("-o, --output <path>", "output file path").option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (idOrSlug, options) => {
|