@walkeros/cli 4.1.1 → 4.1.3-next-1779963694449
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 +19 -0
- package/dist/cli.js +479 -478
- package/dist/index.js +1 -1
- package/package.json +7 -7
package/dist/cli.js
CHANGED
|
@@ -199,17 +199,17 @@ function P(e4) {
|
|
|
199
199
|
function M(e4) {
|
|
200
200
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function q(...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 J(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.`;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function G(e4, t4, n4) {
|
|
213
213
|
const r4 = t4.split(".");
|
|
214
214
|
let o3 = e4;
|
|
215
215
|
for (let e5 = 0; e5 < r4.length; e5++) {
|
|
@@ -227,7 +227,7 @@ function B(e4, t4, n4) {
|
|
|
227
227
|
}
|
|
228
228
|
return o3;
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function X(e4, t4, n4, r4, o3, i2) {
|
|
231
231
|
if ("string" == typeof e4) {
|
|
232
232
|
const a4 = e4.match(R);
|
|
233
233
|
if (a4) {
|
|
@@ -240,18 +240,18 @@ function J(e4, t4, n4, r4, o3, i2) {
|
|
|
240
240
|
let u4;
|
|
241
241
|
l3.add(s6);
|
|
242
242
|
try {
|
|
243
|
-
u4 =
|
|
243
|
+
u4 = X(t4[s6], t4, n4, r4, o3, l3);
|
|
244
244
|
} finally {
|
|
245
245
|
l3.delete(s6);
|
|
246
246
|
}
|
|
247
|
-
return c3 && (u4 =
|
|
247
|
+
return c3 && (u4 = G(u4, c3, `$var.${s6}`)), u4;
|
|
248
248
|
}
|
|
249
249
|
const s5 = e4.match(U);
|
|
250
250
|
if (s5 && r4) {
|
|
251
251
|
const e5 = s5[1], t5 = s5[2];
|
|
252
252
|
e5 in r4 || T(`Contract "${e5}" not found`);
|
|
253
253
|
let n5 = r4[e5];
|
|
254
|
-
return t5 && (n5 =
|
|
254
|
+
return t5 && (n5 = G(n5, t5, `$contract.${e5}`)), n5;
|
|
255
255
|
}
|
|
256
256
|
const c2 = e4.match(Z);
|
|
257
257
|
if (c2) {
|
|
@@ -259,18 +259,18 @@ function J(e4, t4, n4, r4, o3, i2) {
|
|
|
259
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?.(
|
|
262
|
+
if (i3) return n4?.onWarning?.(J(t5, r5, "unknown-flow")), e4;
|
|
263
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
|
-
s6 =
|
|
268
|
+
s6 = G(s6, r5, `$flow.${t5}`);
|
|
269
269
|
} catch {
|
|
270
|
-
return n4?.onWarning?.(
|
|
270
|
+
return n4?.onWarning?.(J(t5, r5, "missing-key")), e4;
|
|
271
271
|
}
|
|
272
|
-
if (null == s6 || "" === s6) return n4?.onWarning?.(
|
|
273
|
-
} else s6 =
|
|
272
|
+
if (null == s6 || "" === s6) return n4?.onWarning?.(J(t5, r5, "missing-key")), e4;
|
|
273
|
+
} else s6 = G(s6, r5, `$flow.${t5}`);
|
|
274
274
|
return s6;
|
|
275
275
|
}
|
|
276
276
|
let l2 = e4.replace(D, (e5, a5) => {
|
|
@@ -283,30 +283,30 @@ function J(e4, t4, n4, r4, o3, i2) {
|
|
|
283
283
|
let f3;
|
|
284
284
|
u4.add(c3);
|
|
285
285
|
try {
|
|
286
|
-
f3 =
|
|
286
|
+
f3 = X(t4[c3], t4, n4, r4, o3, u4);
|
|
287
287
|
} finally {
|
|
288
288
|
u4.delete(c3);
|
|
289
289
|
}
|
|
290
|
-
if (l3 && (f3 =
|
|
290
|
+
if (l3 && (f3 = G(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(F, (e5, t5, r5) => n4?.deferred ? void 0 !== r5 ? `${
|
|
295
|
+
return l2 = l2.replace(F, (e5, t5, r5) => n4?.deferred ? void 0 !== r5 ? `${B}${t5}:${r5}` : `${B}${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
|
-
if (Array.isArray(e4)) return e4.map((e5) =>
|
|
297
|
+
if (Array.isArray(e4)) return e4.map((e5) => X(e5, t4, n4, r4, o3, i2));
|
|
298
298
|
if (null !== e4 && "object" == typeof e4) {
|
|
299
299
|
const a4 = {};
|
|
300
|
-
for (const [s5, c2] of Object.entries(e4)) a4[s5] =
|
|
300
|
+
for (const [s5, c2] of Object.entries(e4)) a4[s5] = X(c2, t4, n4, r4, o3, i2);
|
|
301
301
|
return a4;
|
|
302
302
|
}
|
|
303
303
|
return e4;
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function Y(e4) {
|
|
306
306
|
const t4 = e4.startsWith("@"), n4 = e4.replace("@", "").replace(/[/-]/g, "_").split("_").filter((e5) => e5.length > 0).map((e5, t5) => 0 === t5 ? e5 : e5.charAt(0).toUpperCase() + e5.slice(1)).join("");
|
|
307
307
|
return t4 ? "_" + n4 : n4;
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function Q(e4, t4, n4) {
|
|
310
310
|
const r4 = /* @__PURE__ */ new Map(), o3 = /* @__PURE__ */ new Set(), i2 = [], a4 = (t5) => {
|
|
311
311
|
if (r4.has(t5)) return r4.get(t5);
|
|
312
312
|
const s6 = e4.flows[t5];
|
|
@@ -316,7 +316,7 @@ function X(e4, t4, n4) {
|
|
|
316
316
|
}
|
|
317
317
|
o3.add(t5), i2.push(t5);
|
|
318
318
|
try {
|
|
319
|
-
const o4 =
|
|
319
|
+
const o4 = q(e4.variables, s6.variables), i3 = X(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();
|
|
@@ -331,31 +331,31 @@ function X(e4, t4, n4) {
|
|
|
331
331
|
const o4 = JSON.parse(JSON.stringify(t5));
|
|
332
332
|
let i3;
|
|
333
333
|
if (e5.contract) {
|
|
334
|
-
const o5 =
|
|
335
|
-
i3 = I(
|
|
334
|
+
const o5 = q(e5.variables, t5.variables);
|
|
335
|
+
i3 = I(X(e5.contract, o5, n5, void 0, r5));
|
|
336
336
|
}
|
|
337
337
|
if (o4.config) {
|
|
338
|
-
const a5 =
|
|
339
|
-
o4.config =
|
|
338
|
+
const a5 = q(e5.variables, t5.variables);
|
|
339
|
+
o4.config = X(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 = q(e5.variables, t5.variables, s6.variables), l2 = X(s6.config, c3, n5, i3, r5), u4 = X(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 = q(e5.variables, t5.variables, s6.variables), l2 = X(s6.config, c3, n5, i3, r5), u4 = X(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 = q(e5.variables, t5.variables, s6.variables), l2 = X(s6.config, c3, n5, i3, r5), u4 = X(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 = q(e5.variables, t5.variables, s6.variables), l2 = X(s6.config, c3, n5, i3, r5), u4 = X(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 = q(e5.variables, t5.variables), s6 = X(o4.collector, a5, n5, i3, r5);
|
|
359
359
|
o4.collector = s6;
|
|
360
360
|
}
|
|
361
361
|
return o4;
|
|
@@ -364,57 +364,57 @@ function X(e4, t4, n4) {
|
|
|
364
364
|
o3.delete(t4), i2.pop();
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
|
-
function
|
|
367
|
+
function ee(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
|
-
function
|
|
373
|
-
n4 = { ...
|
|
372
|
+
function ne(e4, t4 = {}, n4 = {}) {
|
|
373
|
+
n4 = { ...te, ...n4 };
|
|
374
374
|
const r4 = Object.entries(t4).reduce((t5, [r5, o3]) => {
|
|
375
375
|
const i2 = e4[r5];
|
|
376
376
|
return n4.merge && Array.isArray(i2) && Array.isArray(o3) ? t5[r5] = o3.reduce((e5, t6) => e5.includes(t6) ? e5 : [...e5, t6], [...i2]) : (n4.extend || r5 in e4) && (t5[r5] = o3), t5;
|
|
377
377
|
}, {});
|
|
378
378
|
return n4.shallow ? { ...e4, ...r4 } : (Object.assign(e4, r4), e4);
|
|
379
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function oe(e4) {
|
|
381
381
|
return Array.isArray(e4);
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function ie(e4) {
|
|
384
384
|
return "boolean" == typeof e4;
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function se(e4) {
|
|
387
387
|
return void 0 !== e4;
|
|
388
388
|
}
|
|
389
|
-
function
|
|
389
|
+
function le(e4) {
|
|
390
390
|
return "function" == typeof e4;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function ue(e4) {
|
|
393
393
|
return "number" == typeof e4 && !Number.isNaN(e4);
|
|
394
394
|
}
|
|
395
|
-
function
|
|
396
|
-
return "object" == typeof e4 && null !== e4 && !
|
|
395
|
+
function fe(e4) {
|
|
396
|
+
return "object" == typeof e4 && null !== e4 && !oe(e4) && "[object Object]" === Object.prototype.toString.call(e4);
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function pe(e4, t4) {
|
|
399
399
|
return typeof e4 == typeof t4;
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function de(e4) {
|
|
402
402
|
return "string" == typeof e4;
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function me(e4, t4 = /* @__PURE__ */ new WeakMap()) {
|
|
405
405
|
if ("object" != typeof e4 || null === e4) return e4;
|
|
406
406
|
if (t4.has(e4)) return t4.get(e4);
|
|
407
407
|
const n4 = Object.prototype.toString.call(e4);
|
|
408
408
|
if ("[object Object]" === n4) {
|
|
409
409
|
const n5 = {};
|
|
410
410
|
t4.set(e4, n5);
|
|
411
|
-
for (const r4 in e4) Object.prototype.hasOwnProperty.call(e4, r4) && (n5[r4] =
|
|
411
|
+
for (const r4 in e4) Object.prototype.hasOwnProperty.call(e4, r4) && (n5[r4] = me(e4[r4], t4));
|
|
412
412
|
return n5;
|
|
413
413
|
}
|
|
414
414
|
if ("[object Array]" === n4) {
|
|
415
415
|
const n5 = [];
|
|
416
416
|
return t4.set(e4, n5), e4.forEach((e5) => {
|
|
417
|
-
n5.push(
|
|
417
|
+
n5.push(me(e5, t4));
|
|
418
418
|
}), n5;
|
|
419
419
|
}
|
|
420
420
|
if ("[object Date]" === n4) return new Date(e4.getTime());
|
|
@@ -424,26 +424,26 @@ function pe(e4, t4 = /* @__PURE__ */ new WeakMap()) {
|
|
|
424
424
|
}
|
|
425
425
|
return e4;
|
|
426
426
|
}
|
|
427
|
-
function
|
|
427
|
+
function ge(e4, t4 = "", n4) {
|
|
428
428
|
const r4 = t4.split(".");
|
|
429
429
|
let o3 = e4;
|
|
430
430
|
for (let e5 = 0; e5 < r4.length; e5++) {
|
|
431
431
|
const t5 = r4[e5];
|
|
432
|
-
if ("*" === t5 &&
|
|
432
|
+
if ("*" === t5 && oe(o3)) {
|
|
433
433
|
const t6 = r4.slice(e5 + 1).join("."), i2 = [];
|
|
434
434
|
for (const e6 of o3) {
|
|
435
|
-
const r5 =
|
|
435
|
+
const r5 = ge(e6, t6, n4);
|
|
436
436
|
i2.push(r5);
|
|
437
437
|
}
|
|
438
438
|
return i2;
|
|
439
439
|
}
|
|
440
|
-
if (o3 =
|
|
440
|
+
if (o3 = fe(o3) || oe(o3) ? o3[t5] : void 0, void 0 === o3) break;
|
|
441
441
|
}
|
|
442
|
-
return
|
|
442
|
+
return se(o3) ? o3 : n4;
|
|
443
443
|
}
|
|
444
|
-
function
|
|
445
|
-
if (!
|
|
446
|
-
const r4 =
|
|
444
|
+
function ye(e4, t4, n4) {
|
|
445
|
+
if (!fe(e4)) return e4;
|
|
446
|
+
const r4 = me(e4), o3 = t4.split(".");
|
|
447
447
|
let i2 = r4;
|
|
448
448
|
for (let e5 = 0; e5 < o3.length; e5++) {
|
|
449
449
|
const t5 = o3[e5];
|
|
@@ -451,37 +451,37 @@ function me(e4, t4, n4) {
|
|
|
451
451
|
}
|
|
452
452
|
return r4;
|
|
453
453
|
}
|
|
454
|
-
function
|
|
455
|
-
if (!
|
|
456
|
-
const n4 =
|
|
454
|
+
function he(e4, t4) {
|
|
455
|
+
if (!fe(e4) && !oe(e4)) return e4;
|
|
456
|
+
const n4 = me(e4), r4 = t4.split(".");
|
|
457
457
|
let o3 = n4;
|
|
458
458
|
for (let e5 = 0; e5 < r4.length; e5++) {
|
|
459
459
|
const t5 = r4[e5], i2 = e5 === r4.length - 1;
|
|
460
|
-
if (
|
|
460
|
+
if (oe(o3)) {
|
|
461
461
|
const e6 = Number(t5);
|
|
462
462
|
if (!Number.isInteger(e6) || e6 < 0 || e6 >= o3.length) return n4;
|
|
463
463
|
if (i2) o3.splice(e6, 1);
|
|
464
464
|
else {
|
|
465
465
|
const t6 = o3[e6];
|
|
466
|
-
if (!
|
|
466
|
+
if (!fe(t6) && !oe(t6)) return n4;
|
|
467
467
|
o3 = t6;
|
|
468
468
|
}
|
|
469
469
|
} else if (i2) delete o3[t5];
|
|
470
470
|
else {
|
|
471
471
|
const e6 = o3[t5];
|
|
472
|
-
if (!
|
|
472
|
+
if (!fe(e6) && !oe(e6)) return n4;
|
|
473
473
|
o3 = e6;
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
476
|
return n4;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
479
|
-
const n4 = {}, r4 = t4.includes("all") ? Object.keys(
|
|
478
|
+
function be(e4, t4) {
|
|
479
|
+
const n4 = {}, r4 = t4.includes("all") ? Object.keys(ve) : t4;
|
|
480
480
|
for (const t5 of r4) {
|
|
481
|
-
const r5 =
|
|
481
|
+
const r5 = ve[t5];
|
|
482
482
|
if (!r5) continue;
|
|
483
483
|
const o3 = r5(e4);
|
|
484
|
-
if (
|
|
484
|
+
if (fe(o3)) for (const [e5, r6] of Object.entries(o3)) {
|
|
485
485
|
if (void 0 === r6) continue;
|
|
486
486
|
const o4 = "context" === t5 && Array.isArray(r6) ? r6[0] : r6;
|
|
487
487
|
n4[`${t5}_${e5}`] = o4;
|
|
@@ -489,31 +489,31 @@ function he(e4, t4) {
|
|
|
489
489
|
}
|
|
490
490
|
return n4;
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function ke(e4, t4 = {}, n4 = {}) {
|
|
493
493
|
const r4 = { ...t4, ...n4 }, o3 = {};
|
|
494
494
|
let i2 = !e4 || 0 === Object.keys(e4).length;
|
|
495
495
|
return Object.keys(r4).forEach((t5) => {
|
|
496
496
|
r4[t5] && (o3[t5] = true, e4 && e4[t5] && (i2 = true));
|
|
497
497
|
}), !!i2 && o3;
|
|
498
498
|
}
|
|
499
|
-
function
|
|
499
|
+
function xe() {
|
|
500
500
|
let e4 = "";
|
|
501
501
|
for (let t4 = 0; t4 < 16; t4++) e4 += (16 * Math.random() | 0).toString(16);
|
|
502
502
|
return e4;
|
|
503
503
|
}
|
|
504
|
-
function
|
|
505
|
-
const t4 = e4.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n4 =
|
|
504
|
+
function Ae(e4 = {}) {
|
|
505
|
+
const t4 = e4.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n4 = ne({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" } }], consent: { functional: true }, id: e4.id || xe(), trigger: "test", entity: "entity", action: "action", timestamp: t4, timing: 3.14, source: { type: "collector", schema: "4" } }, e4, { merge: false });
|
|
506
506
|
if (e4.name) {
|
|
507
507
|
const [t5, r4] = e4.name.split(" ") ?? [];
|
|
508
508
|
t5 && r4 && (n4.entity = t5, n4.action = r4);
|
|
509
509
|
}
|
|
510
510
|
return n4;
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function Oe(e4 = "entity action", t4 = {}) {
|
|
513
513
|
const n4 = t4.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), r4 = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, o3 = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
|
|
514
|
-
return
|
|
514
|
+
return Ae({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r4.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...r4.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: r4.data.price + o3.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r4, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...o3, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r4, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...o3, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...r4, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...r4, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...r4.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n4, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e4], ...t4, name: e4 });
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function Se(e4 = 6, t4) {
|
|
517
517
|
if (t4) {
|
|
518
518
|
const n5 = t4.length;
|
|
519
519
|
let r4 = "";
|
|
@@ -524,11 +524,11 @@ function Ae(e4 = 6, t4) {
|
|
|
524
524
|
for (let t5 = 36; n4.length < e4; ) n4 += (Math.random() * t5 | 0).toString(t5);
|
|
525
525
|
return n4;
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function Ne(e4, t4) {
|
|
528
528
|
return "number" == typeof e4 ? { wait: e4 } : e4 ? { wait: e4.wait ?? t4, size: e4.size, age: e4.age } : { wait: t4 };
|
|
529
529
|
}
|
|
530
|
-
function
|
|
531
|
-
const { wait: r4, size: o3, age: i2 } =
|
|
530
|
+
function Te(e4, t4 = 1e3, n4 = false) {
|
|
531
|
+
const { wait: r4, size: o3, age: i2 } = Ne(t4, 1e3);
|
|
532
532
|
let a4, s5, c2 = null, l2 = null, u4 = false, f3 = [], p2 = 0;
|
|
533
533
|
const d2 = () => {
|
|
534
534
|
c2 && (clearTimeout(c2), c2 = null), l2 && (clearTimeout(l2), l2 = null), p2 = 0, s5 = void 0;
|
|
@@ -556,39 +556,39 @@ 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 Ie(e4) {
|
|
560
560
|
return { message: e4.message, name: e4.name, stack: e4.stack, cause: e4.cause };
|
|
561
561
|
}
|
|
562
|
-
function
|
|
562
|
+
function ze(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 = Ie(e4)) : n4 = e4, void 0 !== t4 && (t4 instanceof Error ? r4.error = Ie(t4) : "object" == typeof t4 && null !== t4 ? (r4 = { ...r4, ...t4 }, "error" in r4 && r4.error instanceof Error && (r4.error = Ie(r4.error))) : r4.value = t4), { message: n4, context: r4 };
|
|
565
565
|
}
|
|
566
|
-
function
|
|
567
|
-
return
|
|
566
|
+
function Me(e4 = {}) {
|
|
567
|
+
return Re({ level: void 0 !== e4.level ? (function(e5) {
|
|
568
568
|
return "string" == typeof e5 ? f[e5] : e5;
|
|
569
569
|
})(e4.level) : 0, handler: e4.handler, jsonHandler: e4.jsonHandler, scope: [] });
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function Re(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 =
|
|
575
|
-
n4 ? n4(e5, t5.message, t5.context, o3,
|
|
574
|
+
const t5 = ze(r5, i3);
|
|
575
|
+
n4 ? n4(e5, t5.message, t5.context, o3, Pe) : Pe(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 =
|
|
580
|
-
throw n4 ? n4(0, r5.message, r5.context, o3,
|
|
579
|
+
const r5 = ze(e5, t5);
|
|
580
|
+
throw n4 ? n4(0, r5.message, r5.context, o3, Pe) : Pe(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));
|
|
583
|
-
}, scope: (e5) =>
|
|
584
|
-
}
|
|
585
|
-
function Me(e4) {
|
|
586
|
-
return re(e4) || fe(e4) || ce(e4) || !ie(e4) || ne(e4) && e4.every(Me) || le(e4) && Object.values(e4).every(Me);
|
|
583
|
+
}, scope: (e5) => Re({ level: t4, handler: n4, jsonHandler: r4, scope: [...o3, e5] }) };
|
|
587
584
|
}
|
|
588
585
|
function De(e4) {
|
|
589
|
-
return
|
|
586
|
+
return ie(e4) || de(e4) || ue(e4) || !se(e4) || oe(e4) && e4.every(De) || fe(e4) && Object.values(e4).every(De);
|
|
587
|
+
}
|
|
588
|
+
function Ue(e4) {
|
|
589
|
+
return De(e4) ? e4 : void 0;
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function Ze(e4, t4, n4) {
|
|
592
592
|
return function(...r4) {
|
|
593
593
|
try {
|
|
594
594
|
return e4(...r4);
|
|
@@ -600,7 +600,7 @@ function Fe(e4, t4, n4) {
|
|
|
600
600
|
}
|
|
601
601
|
};
|
|
602
602
|
}
|
|
603
|
-
function
|
|
603
|
+
function We(e4, t4, n4) {
|
|
604
604
|
return async function(...r4) {
|
|
605
605
|
try {
|
|
606
606
|
return await e4(...r4);
|
|
@@ -612,16 +612,16 @@ function Ue(e4, t4, n4) {
|
|
|
612
612
|
}
|
|
613
613
|
};
|
|
614
614
|
}
|
|
615
|
-
async function
|
|
615
|
+
async function Le(e4, t4, n4) {
|
|
616
616
|
const [r4, o3] = (e4.name || "").split(" ");
|
|
617
617
|
if (!t4 || !r4 || !o3) return {};
|
|
618
618
|
let i2, a4 = "", s5 = r4, c2 = o3;
|
|
619
619
|
const l2 = (t5) => {
|
|
620
620
|
if (!t5) return;
|
|
621
|
-
return (
|
|
621
|
+
return (oe(t5) ? t5 : [t5]).find((t6) => {
|
|
622
622
|
if (!t6.condition) return true;
|
|
623
623
|
if (!n4) return Boolean(t6.condition(e4, void 0));
|
|
624
|
-
const r5 = { event: e4, mapping: t6, collector: n4, logger: n4.logger, consent:
|
|
624
|
+
const r5 = { event: e4, mapping: t6, collector: n4, logger: n4.logger, consent: fe(e4) && e4.consent || n4.consent };
|
|
625
625
|
return Boolean(t6.condition(e4, r5));
|
|
626
626
|
});
|
|
627
627
|
};
|
|
@@ -629,84 +629,84 @@ async function We(e4, t4, n4) {
|
|
|
629
629
|
const u4 = t4[s5];
|
|
630
630
|
return u4 && (u4[c2] || (c2 = "*"), i2 = l2(u4[c2])), i2 || (s5 = "*", c2 = "*", i2 = l2(t4[s5]?.[c2])), i2 && (a4 = `${s5} ${c2}`), { eventMapping: i2, mappingKey: a4 };
|
|
631
631
|
}
|
|
632
|
-
async function
|
|
633
|
-
if (!
|
|
634
|
-
const r4 =
|
|
632
|
+
async function Ke(e4, t4 = {}, n4 = {}) {
|
|
633
|
+
if (!se(e4)) return;
|
|
634
|
+
const r4 = fe(e4) && e4.consent || n4.consent || n4.collector?.consent, o3 = n4.event ?? (fe(e4) ? e4 : {});
|
|
635
635
|
if (!n4.collector) throw new Error("getMappingValue: context.collector is required");
|
|
636
|
-
const i2 = { event: o3, mapping: t4, collector: n4.collector, logger: n4.collector.logger, consent: r4 }, a4 =
|
|
636
|
+
const i2 = { event: o3, mapping: t4, collector: n4.collector, logger: n4.collector.logger, consent: r4 }, a4 = oe(t4) ? t4 : [t4];
|
|
637
637
|
for (const t5 of a4) {
|
|
638
|
-
const r5 = await
|
|
639
|
-
if (e5 instanceof
|
|
638
|
+
const r5 = await We(Ve, (e5) => {
|
|
639
|
+
if (e5 instanceof He) 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
|
-
if (
|
|
642
|
+
if (se(r5)) return r5;
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
|
-
async function
|
|
646
|
-
return (
|
|
645
|
+
async function Ve(e4, t4, n4) {
|
|
646
|
+
return (oe(t4) ? t4 : [t4]).reduce(async (t5, r4) => {
|
|
647
647
|
const o3 = await t5;
|
|
648
648
|
if (o3) return o3;
|
|
649
|
-
const i2 =
|
|
649
|
+
const i2 = de(r4) ? { key: r4 } : r4;
|
|
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
|
-
if (a4 && !await
|
|
653
|
-
if (e5 instanceof
|
|
652
|
+
if (a4 && !await We(a4, (e5) => {
|
|
653
|
+
if (e5 instanceof He) throw e5;
|
|
654
654
|
return g3.logger.error("mapping condition failed", { event: g3.event, error: e5 }), false;
|
|
655
655
|
})(e4, g3)) return;
|
|
656
|
-
if (s5 && !
|
|
657
|
-
let y2 =
|
|
658
|
-
if (c2 && (y2 = await
|
|
659
|
-
if (e5 instanceof
|
|
656
|
+
if (s5 && !ke(s5, g3.consent)) return m3;
|
|
657
|
+
let y2 = se(m3) ? m3 : e4;
|
|
658
|
+
if (c2 && (y2 = await We(c2, (e5) => {
|
|
659
|
+
if (e5 instanceof He) throw e5;
|
|
660
660
|
g3.logger.error("mapping fn failed", { event: g3.event, error: e5 });
|
|
661
|
-
})(e4, g3)), l2 && (y2 =
|
|
662
|
-
const [t6, n5] = u4, r5 = "this" === t6 ? [e4] : await
|
|
663
|
-
|
|
661
|
+
})(e4, g3)), l2 && (y2 = ge(e4, l2, m3)), u4) {
|
|
662
|
+
const [t6, n5] = u4, r5 = "this" === t6 ? [e4] : await Ke(e4, t6, g3);
|
|
663
|
+
oe(r5) && (y2 = (await Promise.all(r5.map((e5) => Ke(e5, n5, g3)))).filter(se));
|
|
664
664
|
} else f3 ? y2 = await Object.entries(f3).reduce(async (t6, [n5, r5]) => {
|
|
665
|
-
const o4 = await t6, i3 = await
|
|
666
|
-
return
|
|
667
|
-
}, Promise.resolve({})) : p2 && (y2 = await Promise.all(p2.map((t6) =>
|
|
668
|
-
d2 && !await
|
|
669
|
-
if (e5 instanceof
|
|
665
|
+
const o4 = await t6, i3 = await Ke(e4, r5, g3);
|
|
666
|
+
return se(i3) && (o4[n5] = i3), o4;
|
|
667
|
+
}, Promise.resolve({})) : p2 && (y2 = await Promise.all(p2.map((t6) => Ve(e4, t6, g3))));
|
|
668
|
+
d2 && !await We(d2, (e5) => {
|
|
669
|
+
if (e5 instanceof He) 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
|
|
672
|
+
const h3 = Ue(y2);
|
|
673
|
+
return se(h3) ? h3 : Ue(m3);
|
|
674
674
|
}, Promise.resolve(void 0));
|
|
675
675
|
}
|
|
676
|
-
async function
|
|
676
|
+
async function qe(e4, t4, n4) {
|
|
677
677
|
t4.policy && await Promise.all(Object.entries(t4.policy).map(async ([t5, r5]) => {
|
|
678
|
-
const o4 = await
|
|
679
|
-
e4 =
|
|
678
|
+
const o4 = await Ke(e4, r5, { collector: n4, event: e4 });
|
|
679
|
+
e4 = ye(e4, t5, o4);
|
|
680
680
|
}));
|
|
681
|
-
const { eventMapping: r4, mappingKey: o3 } = await
|
|
681
|
+
const { eventMapping: r4, mappingKey: o3 } = await Le(e4, t4.mapping, n4);
|
|
682
682
|
r4?.policy && await Promise.all(Object.entries(r4.policy).map(async ([t5, r5]) => {
|
|
683
|
-
const o4 = await
|
|
684
|
-
e4 =
|
|
683
|
+
const o4 = await Ke(e4, r5, { collector: n4, event: e4 });
|
|
684
|
+
e4 = ye(e4, t5, o4);
|
|
685
685
|
}));
|
|
686
|
-
let i2 = t4.data && await
|
|
686
|
+
let i2 = t4.data && await Ke(e4, t4.data, { collector: n4, event: e4 });
|
|
687
687
|
const a4 = Boolean(r4?.silent);
|
|
688
688
|
if (r4) {
|
|
689
689
|
if (r4.ignore) return { event: e4, data: i2, mapping: r4, mappingKey: o3, ignore: true, silent: a4 };
|
|
690
690
|
if (r4.name && (e4.name = r4.name), r4.data) {
|
|
691
|
-
const t5 = r4.data && await
|
|
692
|
-
i2 =
|
|
691
|
+
const t5 = r4.data && await Ke(e4, r4.data, { collector: n4, event: e4 });
|
|
692
|
+
i2 = fe(i2) && fe(t5) ? ne(i2, t5) : t5;
|
|
693
693
|
}
|
|
694
694
|
}
|
|
695
695
|
const s5 = r4?.include ?? t4.include;
|
|
696
696
|
if (s5 && s5.length > 0) {
|
|
697
|
-
const t5 =
|
|
698
|
-
Object.keys(t5).length > 0 && (i2 =
|
|
697
|
+
const t5 = be(e4, s5);
|
|
698
|
+
Object.keys(t5).length > 0 && (i2 = fe(i2) ? ne(t5, i2) : i2 ?? t5);
|
|
699
699
|
}
|
|
700
|
-
if (r4?.remove &&
|
|
700
|
+
if (r4?.remove && fe(i2)) for (const e5 of r4.remove) i2 = he(i2, e5);
|
|
701
701
|
return { event: e4, data: i2, mapping: r4, mappingKey: o3, ignore: false, silent: a4 };
|
|
702
702
|
}
|
|
703
|
-
function
|
|
704
|
-
return void 0 === e4 ||
|
|
703
|
+
function nt(e4) {
|
|
704
|
+
return void 0 === e4 || pe(e4, "") ? e4 : JSON.stringify(e4);
|
|
705
705
|
}
|
|
706
|
-
function
|
|
707
|
-
return
|
|
706
|
+
function rt(e4 = {}) {
|
|
707
|
+
return ne({ "Content-Type": "application/json; charset=utf-8" }, e4);
|
|
708
708
|
}
|
|
709
|
-
function
|
|
709
|
+
function at(e4, t4, n4, r4) {
|
|
710
710
|
const o3 = e4;
|
|
711
711
|
return function(...e5) {
|
|
712
712
|
let i2;
|
|
@@ -727,7 +727,7 @@ function ot(e4, t4, n4, r4) {
|
|
|
727
727
|
return i2;
|
|
728
728
|
};
|
|
729
729
|
}
|
|
730
|
-
function
|
|
730
|
+
function st(e4, t4) {
|
|
731
731
|
if (t4 >= 1) return true;
|
|
732
732
|
if (t4 <= 0) return false;
|
|
733
733
|
return (function(e5) {
|
|
@@ -736,7 +736,7 @@ function it(e4, t4) {
|
|
|
736
736
|
return t5 >>> 0;
|
|
737
737
|
})(e4) / 4294967295 < t4;
|
|
738
738
|
}
|
|
739
|
-
function
|
|
739
|
+
function ct(e4, t4) {
|
|
740
740
|
const n4 = "function" == typeof t4 ? t4 : () => t4;
|
|
741
741
|
return function(t5) {
|
|
742
742
|
const r4 = n4();
|
|
@@ -744,7 +744,7 @@ function at(e4, t4) {
|
|
|
744
744
|
const o3 = r4.level ?? "standard";
|
|
745
745
|
if ("off" === o3) return;
|
|
746
746
|
const i2 = r4.sample, a4 = "number" == typeof i2 && Number.isFinite(i2) ? i2 : 1;
|
|
747
|
-
if (t5.eventId && !
|
|
747
|
+
if (t5.eventId && !st(t5.eventId, a4)) return;
|
|
748
748
|
const s5 = r4.includeIn ?? "trace" === o3, c2 = r4.includeOut ?? "trace" === o3, l2 = r4.includeMappingKey ?? "trace" === o3, u4 = { ...t5 };
|
|
749
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
750
|
try {
|
|
@@ -753,7 +753,7 @@ function at(e4, t4) {
|
|
|
753
753
|
}
|
|
754
754
|
};
|
|
755
755
|
}
|
|
756
|
-
function
|
|
756
|
+
function ut(e4) {
|
|
757
757
|
const t4 = e4.env ?? ("undefined" != typeof process ? process.env : {}), n4 = e4.now ?? (() => Date.now()), r4 = t4.WALKEROS_TRACE_UNTIL;
|
|
758
758
|
if ("string" == typeof r4 && r4.length > 0) {
|
|
759
759
|
const t5 = Date.parse(r4);
|
|
@@ -764,7 +764,7 @@ function ct(e4) {
|
|
|
764
764
|
const i2 = e4.observe?.sample ?? 1;
|
|
765
765
|
return { flowId: e4.flowId, level: o3, sample: i2 };
|
|
766
766
|
}
|
|
767
|
-
function
|
|
767
|
+
function ft(e4, t4) {
|
|
768
768
|
if (0 === e4.observers.size) return;
|
|
769
769
|
const n4 = Array.from(e4.observers);
|
|
770
770
|
for (const e5 of n4) try {
|
|
@@ -772,7 +772,7 @@ function lt(e4, t4) {
|
|
|
772
772
|
} catch {
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
|
-
function
|
|
775
|
+
function pt(e4) {
|
|
776
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
777
|
});
|
|
778
778
|
let s5 = [], c2 = null;
|
|
@@ -789,10 +789,10 @@ function ut(e4) {
|
|
|
789
789
|
s5.push(e5), s5.length >= o3 ? l2() : null === c2 && (c2 = setTimeout(l2, n4));
|
|
790
790
|
};
|
|
791
791
|
}
|
|
792
|
-
function
|
|
792
|
+
function jt(e4) {
|
|
793
793
|
return "string" == typeof e4 || Array.isArray(e4) && e4.every((e5) => "string" == typeof e5) ? e4 : void 0;
|
|
794
794
|
}
|
|
795
|
-
async function
|
|
795
|
+
async function xt(e4, t4) {
|
|
796
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;
|
|
797
797
|
try {
|
|
798
798
|
if (t4?.baseUrl) {
|
|
@@ -803,7 +803,7 @@ async function $t(e4, t4) {
|
|
|
803
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 };
|
|
804
804
|
})(e4, n4, await o5.json());
|
|
805
805
|
}
|
|
806
|
-
const r5 = `https://cdn.jsdelivr.net/npm/${e4}@${n4}`, o4 = await
|
|
806
|
+
const r5 = `https://cdn.jsdelivr.net/npm/${e4}@${n4}`, o4 = await At(`${r5}/package.json`, a4, s5);
|
|
807
807
|
return (function(e5, t5, n5, r6) {
|
|
808
808
|
const o5 = r6.$meta || {}, i3 = r6.schemas || {}, a5 = r6.examples || {}, s6 = r6.hints, c2 = s6 ? Object.keys(s6) : [], l2 = [], u4 = a5.step || {};
|
|
809
809
|
for (const [e6, t6] of Object.entries(u4)) {
|
|
@@ -811,29 +811,29 @@ async function $t(e4, t4) {
|
|
|
811
811
|
"string" == typeof n6?.description && (r7.description = n6.description), l2.push(r7);
|
|
812
812
|
}
|
|
813
813
|
const f3 = "string" == typeof o5.docs ? o5.docs : void 0, p2 = "string" == typeof o5.source ? o5.source : void 0;
|
|
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:
|
|
815
|
-
})(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: jt(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 At(`${r5}/dist/walkerOS.json`, a4, s5));
|
|
816
816
|
} finally {
|
|
817
817
|
clearTimeout(i2);
|
|
818
818
|
}
|
|
819
819
|
}
|
|
820
|
-
async function
|
|
820
|
+
async function At(e4, t4, n4) {
|
|
821
821
|
const r4 = await fetch(e4, { signal: t4, ...n4 && { headers: n4 } });
|
|
822
822
|
if (!r4.ok) throw new Error(`Failed to fetch ${e4} (HTTP ${r4.status})`);
|
|
823
823
|
return await r4.json();
|
|
824
824
|
}
|
|
825
|
-
async function
|
|
826
|
-
const n4 = await
|
|
825
|
+
async function Ot(e4, t4) {
|
|
826
|
+
const n4 = await xt(e4, t4);
|
|
827
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 } : {} };
|
|
828
828
|
}
|
|
829
|
-
function
|
|
829
|
+
function Nt(e4) {
|
|
830
830
|
if (void 0 === e4 || "*" === e4) return () => true;
|
|
831
831
|
if ("and" in e4) {
|
|
832
|
-
const t4 = e4.and.map(
|
|
832
|
+
const t4 = e4.and.map(Nt);
|
|
833
833
|
return (e5) => t4.every((t5) => t5(e5));
|
|
834
834
|
}
|
|
835
835
|
if ("or" in e4) {
|
|
836
|
-
const t4 = e4.or.map(
|
|
836
|
+
const t4 = e4.or.map(Nt);
|
|
837
837
|
return (e5) => t4.some((t5) => t5(e5));
|
|
838
838
|
}
|
|
839
839
|
return (function(e5) {
|
|
@@ -864,74 +864,75 @@ function Et(e4) {
|
|
|
864
864
|
}
|
|
865
865
|
})(n4, r4);
|
|
866
866
|
return (e6) => {
|
|
867
|
-
const n5 =
|
|
867
|
+
const n5 = ge(e6, t4), r5 = i2(n5);
|
|
868
868
|
return o3 ? !r5 : r5;
|
|
869
869
|
};
|
|
870
870
|
})(e4);
|
|
871
871
|
}
|
|
872
|
-
function
|
|
873
|
-
return Array.isArray(e4) && e4
|
|
874
|
-
|
|
875
|
-
|
|
872
|
+
function Tt(e4) {
|
|
873
|
+
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4) && ("match" in e4 || "next" in e4 || "one" in e4 || "many" in e4);
|
|
874
|
+
}
|
|
875
|
+
function Ct(e4) {
|
|
876
|
+
return Array.isArray(e4) && e4.length > 0 && e4.every((e5) => Tt(e5));
|
|
876
877
|
}
|
|
877
|
-
function
|
|
878
|
+
function It(e4) {
|
|
878
879
|
return e4.map((e5) => {
|
|
879
880
|
if ("string" == typeof e5) return { match: () => true, next: { type: "static", value: e5 } };
|
|
880
|
-
if (Array.isArray(e5)) return { match: () => true, next:
|
|
881
|
+
if (Array.isArray(e5)) return { match: () => true, next: zt(e5) ?? { type: "chain", value: [] } };
|
|
881
882
|
const t4 = e5;
|
|
882
|
-
return { match: t4.match ?
|
|
883
|
+
return { match: t4.match ? Nt(t4.match) : () => true, next: zt(t4) ?? { type: "chain", value: [] } };
|
|
883
884
|
});
|
|
884
885
|
}
|
|
885
|
-
function
|
|
886
|
+
function zt(e4) {
|
|
886
887
|
if (null == e4) return;
|
|
887
888
|
if ("string" == typeof e4) return { type: "static", value: e4 };
|
|
888
889
|
if (Array.isArray(e4)) {
|
|
889
890
|
if (0 === e4.length) return;
|
|
890
|
-
if (
|
|
891
|
+
if (Ct(e4)) return zt({ one: e4 });
|
|
891
892
|
if (e4.every((e5) => "string" == typeof e5)) return { type: "chain", value: e4 };
|
|
892
893
|
const t5 = [];
|
|
893
894
|
for (const n4 of e4) {
|
|
894
|
-
const e5 =
|
|
895
|
+
const e5 = zt(n4);
|
|
895
896
|
void 0 !== e5 && t5.push(e5);
|
|
896
897
|
}
|
|
897
898
|
if (0 === t5.length) return;
|
|
898
899
|
return { type: "sequence", value: t5 };
|
|
899
900
|
}
|
|
900
901
|
const t4 = e4;
|
|
901
|
-
if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match:
|
|
902
|
+
if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match: Nt(t4.match), next: zt(t4.next) } : zt(t4.next);
|
|
902
903
|
if ("one" in t4 && t4.one) {
|
|
903
|
-
const e5 =
|
|
904
|
-
return t4.match ? { type: "gate", match:
|
|
904
|
+
const e5 = It(t4.one);
|
|
905
|
+
return t4.match ? { type: "gate", match: Nt(t4.match), next: { type: "one", routes: e5 } } : { type: "one", routes: e5 };
|
|
905
906
|
}
|
|
906
907
|
if ("many" in t4 && t4.many) {
|
|
907
|
-
const e5 =
|
|
908
|
-
return t4.match ? { type: "gate", match:
|
|
908
|
+
const e5 = It(t4.many);
|
|
909
|
+
return t4.match ? { type: "gate", match: Nt(t4.match), next: { type: "many", routes: e5 } } : { type: "many", routes: e5 };
|
|
909
910
|
}
|
|
910
|
-
return t4.match ? { type: "gate", match:
|
|
911
|
+
return t4.match ? { type: "gate", match: Nt(t4.match) } : void 0;
|
|
911
912
|
}
|
|
912
|
-
function
|
|
913
|
+
function Mt(e4, t4 = {}) {
|
|
913
914
|
if (null == e4) return [];
|
|
914
915
|
let n4;
|
|
915
916
|
if ("object" == typeof e4) {
|
|
916
|
-
const t5 =
|
|
917
|
-
t5 ? n4 = t5 : (n4 =
|
|
918
|
-
} else n4 =
|
|
917
|
+
const t5 = Pt.get(e4);
|
|
918
|
+
t5 ? n4 = t5 : (n4 = zt(e4), n4 && Pt.set(e4, n4));
|
|
919
|
+
} else n4 = zt(e4);
|
|
919
920
|
if (!n4) return [];
|
|
920
|
-
const r4 =
|
|
921
|
+
const r4 = Rt(n4, t4);
|
|
921
922
|
return void 0 === r4 ? [] : Array.isArray(r4) ? r4 : [r4];
|
|
922
923
|
}
|
|
923
|
-
function
|
|
924
|
+
function Rt(e4, t4 = {}) {
|
|
924
925
|
if (e4) {
|
|
925
926
|
if ("static" === e4.type) return e4.value;
|
|
926
927
|
if ("chain" === e4.type) return e4.value;
|
|
927
928
|
if ("gate" === e4.type) {
|
|
928
929
|
if (!e4.match(t4)) return;
|
|
929
|
-
return
|
|
930
|
+
return Rt(e4.next, t4);
|
|
930
931
|
}
|
|
931
932
|
if ("sequence" === e4.type) {
|
|
932
933
|
const n4 = [];
|
|
933
934
|
for (const r4 of e4.value) {
|
|
934
|
-
const e5 =
|
|
935
|
+
const e5 = Rt(r4, t4);
|
|
935
936
|
void 0 !== e5 && (Array.isArray(e5) ? n4.push(...e5) : n4.push(e5));
|
|
936
937
|
}
|
|
937
938
|
return n4.length > 0 ? n4 : void 0;
|
|
@@ -940,52 +941,52 @@ function zt(e4, t4 = {}) {
|
|
|
940
941
|
const n4 = [];
|
|
941
942
|
for (const r4 of e4.routes) {
|
|
942
943
|
if (!r4.match(t4)) continue;
|
|
943
|
-
const e5 =
|
|
944
|
+
const e5 = Rt(r4.next, t4);
|
|
944
945
|
void 0 !== e5 && (Array.isArray(e5) ? n4.push(...e5) : n4.push(e5));
|
|
945
946
|
}
|
|
946
947
|
return n4.length > 0 ? n4 : void 0;
|
|
947
948
|
}
|
|
948
|
-
for (const n4 of e4.routes) if (n4.match(t4)) return
|
|
949
|
+
for (const n4 of e4.routes) if (n4.match(t4)) return Rt(n4.next, t4);
|
|
949
950
|
}
|
|
950
951
|
}
|
|
951
|
-
function
|
|
952
|
+
function Dt(e4, t4) {
|
|
952
953
|
const n4 = { ingest: e4 ?? {} };
|
|
953
954
|
return void 0 !== t4 && (n4.event = t4), n4;
|
|
954
955
|
}
|
|
955
|
-
function
|
|
956
|
-
return { stop: e4.stop ?? false, storeId: e4.store, namespace: e4.namespace, rules: e4.rules.map((e5) => ({ match: e5.match ?
|
|
956
|
+
function Ft(e4) {
|
|
957
|
+
return { stop: e4.stop ?? false, storeId: e4.store, namespace: e4.namespace, rules: e4.rules.map((e5) => ({ match: e5.match ? Nt(e5.match) : () => true, key: e5.key, ttl: e5.ttl, update: e5.update })) };
|
|
957
958
|
}
|
|
958
|
-
async function
|
|
959
|
+
async function Ut(e4, t4, n4, r4) {
|
|
959
960
|
const o3 = e4.rules.find((e5) => e5.match(n4));
|
|
960
961
|
if (!o3) return null;
|
|
961
|
-
const i2 = o3.key.map((e5) => String(
|
|
962
|
+
const i2 = o3.key.map((e5) => String(ge(n4, e5) ?? ""));
|
|
962
963
|
if (i2.every((e5) => "" === e5)) return null;
|
|
963
964
|
const a4 = i2.join(":"), s5 = r4 ?? e4.namespace, c2 = s5 ? `${s5}:${a4}` : a4, l2 = await t4.get(c2);
|
|
964
965
|
return void 0 !== l2 ? { status: "HIT", key: c2, value: l2, rule: o3 } : { status: "MISS", key: c2, rule: o3 };
|
|
965
966
|
}
|
|
966
|
-
function
|
|
967
|
+
function Zt(e4, t4, n4, r4) {
|
|
967
968
|
e4.set(t4, n4, 1e3 * r4);
|
|
968
969
|
}
|
|
969
|
-
async function
|
|
970
|
+
async function Wt(e4, t4, n4, r4) {
|
|
970
971
|
if (!t4) return e4;
|
|
971
972
|
let o3 = e4;
|
|
972
973
|
for (const [e5, i2] of Object.entries(t4)) {
|
|
973
|
-
o3 =
|
|
974
|
+
o3 = ye(o3, e5, await Ke(n4, i2, { collector: r4 }));
|
|
974
975
|
}
|
|
975
976
|
return o3;
|
|
976
977
|
}
|
|
977
|
-
function
|
|
978
|
+
function qt(e4, t4) {
|
|
978
979
|
const n4 = (function(e5) {
|
|
979
|
-
return /* @__PURE__ */ new Set([...
|
|
980
|
+
return /* @__PURE__ */ new Set([...Ht[e5], ...Lt, ...Kt[e5]]);
|
|
980
981
|
})(t4);
|
|
981
982
|
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(", ")}.` };
|
|
982
983
|
const r4 = void 0 !== e4.package, o3 = void 0 !== e4.import, i2 = void 0 !== e4.code;
|
|
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 &&
|
|
984
|
+
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 && Vt.test(e4.import) ? { ok: true } : { ok: false, code: "INVALID_IMPORT", key: "import", reason: `import must match ${Vt.source}. Got: ${JSON.stringify(e4.import)}.` };
|
|
984
985
|
}
|
|
985
|
-
function
|
|
986
|
+
function Bt(e4, t4) {
|
|
986
987
|
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));
|
|
987
988
|
}
|
|
988
|
-
var e, t, r, a, u, f, m, h, b, C, R, D, F, U, Z,
|
|
989
|
+
var e, t, r, a, u, f, m, h, b, C, R, D, F, U, Z, B, te, ve, Pe, He, Pt, Ht, Lt, Kt, Vt;
|
|
989
990
|
var init_dist = __esm({
|
|
990
991
|
"../core/dist/index.mjs"() {
|
|
991
992
|
"use strict";
|
|
@@ -1012,23 +1013,23 @@ var init_dist = __esm({
|
|
|
1012
1013
|
F = /\$env\.([a-zA-Z_][a-zA-Z0-9_]*)(?::([^"}\s]*))?/g;
|
|
1013
1014
|
U = /^\$contract\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.(.+))?$/;
|
|
1014
1015
|
Z = /^\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?$/;
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1016
|
+
B = "__WALKEROS_ENV:";
|
|
1017
|
+
te = { merge: true, shallow: true, extend: true };
|
|
1018
|
+
ve = { 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 }) };
|
|
1019
|
+
Pe = (e4, t4, n4, r4) => {
|
|
1019
1020
|
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;
|
|
1020
1021
|
i2 ? a4(o3, t4, n4) : a4(o3, t4);
|
|
1021
1022
|
};
|
|
1022
|
-
|
|
1023
|
+
He = class e2 extends Error {
|
|
1023
1024
|
constructor(t4, n4) {
|
|
1024
1025
|
super(t4, n4), this.name = "FatalError", Object.setPrototypeOf(this, e2.prototype);
|
|
1025
1026
|
}
|
|
1026
1027
|
};
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1028
|
+
Pt = /* @__PURE__ */ new WeakMap();
|
|
1029
|
+
Ht = { 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"] };
|
|
1030
|
+
Lt = ["config", "env", "validate", "variables", "examples", "disabled", "id", "logger", "mock", "chainMocks"];
|
|
1031
|
+
Kt = { Source: ["primary"], Transformer: [], Destination: [], Store: [] };
|
|
1032
|
+
Vt = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
1032
1033
|
}
|
|
1033
1034
|
});
|
|
1034
1035
|
|
|
@@ -1037,14 +1038,14 @@ import * as r2 from "http";
|
|
|
1037
1038
|
import * as s3 from "https";
|
|
1038
1039
|
import { createHash as n2 } from "crypto";
|
|
1039
1040
|
function a2(a4, n4, u4 = {}) {
|
|
1040
|
-
const i2 =
|
|
1041
|
+
const i2 = rt(u4.headers), c2 = nt(n4), d2 = u4.method || "POST", m3 = u4.timeout || 5e3;
|
|
1041
1042
|
return new Promise((t4) => {
|
|
1042
1043
|
const e4 = new URL(a4), n5 = "https:" === e4.protocol ? s3 : r2, u5 = { method: d2, headers: i2 }, p2 = n5.request(e4, u5, (e5) => {
|
|
1043
1044
|
const r4 = [];
|
|
1044
1045
|
e5.on("data", (t5) => {
|
|
1045
1046
|
r4.push(t5);
|
|
1046
1047
|
}), e5.on("end", () => {
|
|
1047
|
-
const s5 = !!(e5.statusCode && e5.statusCode >= 200 && e5.statusCode < 300), a5 = Buffer.concat(r4).toString(), n6 =
|
|
1048
|
+
const s5 = !!(e5.statusCode && e5.statusCode >= 200 && e5.statusCode < 300), a5 = Buffer.concat(r4).toString(), n6 = Ze(JSON.parse, () => a5)(a5);
|
|
1048
1049
|
t4({ ok: s5, data: n6, error: s5 ? void 0 : `${e5.statusCode} ${e5.statusMessage}` });
|
|
1049
1050
|
});
|
|
1050
1051
|
});
|
|
@@ -1150,7 +1151,7 @@ function createCLILogger(options = {}) {
|
|
|
1150
1151
|
stderr = false
|
|
1151
1152
|
} = options;
|
|
1152
1153
|
const out = stderr ? console.error : console.log;
|
|
1153
|
-
return
|
|
1154
|
+
return Me({
|
|
1154
1155
|
// Let handler control visibility — pass everything through
|
|
1155
1156
|
level: f.DEBUG,
|
|
1156
1157
|
handler: (level, message, _context, scope) => {
|
|
@@ -1861,7 +1862,7 @@ function wn(e4) {
|
|
|
1861
1862
|
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));
|
|
1862
1863
|
}
|
|
1863
1864
|
}
|
|
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,
|
|
1865
|
+
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, V, H, _, Z2, G2, K, Q2, X2, Y2, ee2, te2, ie3, ne3, oe3, re2, ae2, se3, ce2, le3, de3, pe3, ue3, me3, fe3, ge3, he3, be3, ve3, Se3, ye3, we2, ke3, Ce2, xe3, Pe3, je2, Ee2, De3, Ie3, Oe3, Je, Re3, Me3, Te3, Fe, ze3, Le3, $e2, qe3, Ne3, Ae3, We2, Be2, Ue3, Ve3, He2, _e2, Ze2, Ge, Ke2, Qe, Xe, Ye, et, tt, it, nt3, ot, rt2, at2, st2, ct3, lt2, dt, pt3, ut2, mt2, ft3, gt2, ht2, bt, vt, St, yt2, wt, kt, Ct2, xt2, Pt2, jt2, Et, Dt2, It2, Ot2, Jt, Rt2, Mt2, Tt2, Ft2, zt2, Lt2, $t, qt2, Nt2, At2, Wt2, Bt2, Ut2, Vt2, Ht2, _t, 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;
|
|
1865
1866
|
var init_dev = __esm({
|
|
1866
1867
|
"../core/dist/dev.mjs"() {
|
|
1867
1868
|
"use strict";
|
|
@@ -1870,7 +1871,7 @@ var init_dev = __esm({
|
|
|
1870
1871
|
for (var n4 in i2) e3(t4, n4, { get: i2[n4], enumerable: true });
|
|
1871
1872
|
};
|
|
1872
1873
|
i = {};
|
|
1873
|
-
t3(i, { BaseContextConfig: () => L, CacheRuleSchema: () => Xe, CacheSchema: () => Ye, CacheSchemas: () =>
|
|
1874
|
+
t3(i, { BaseContextConfig: () => L, CacheRuleSchema: () => Xe, CacheSchema: () => Ye, CacheSchemas: () => _e2, ClickIdEntrySchema: () => on, CodeSchema: () => en, CollectorSchemas: () => Et, ConsentSchema: () => Z2, ContractActionsSchema: () => Ji, ContractRuleSchema: () => Mi, ContractSchema: () => Ti, ContractSchemaEntry: () => Oi, Counter: () => d, DeepPartialEventSchema: () => te2, DestinationSchemas: () => Re3, 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: () => tt, LoggerHandlerSchema: () => et, LoopSchema: () => me3, MapSchema: () => ge3, MappingResultSchema: () => ke3, MappingSchemas: () => de3, MatchExpressionSchema: () => ze3, MatcherSchemas: () => Me3, OptionalPrimitiveValue: () => u3, OrderedPropertiesSchema: () => H, PartialEventSchema: () => ee2, PolicySchema: () => be3, PrimaryConfig: () => I2, PrimitiveValue: () => p, ProcessingControlConfig: () => $, PropertiesSchema: () => V, PropertySchema: () => U2, PropertyTypeSchema: () => B2, QueueConfig: () => j, RequiredBoolean: () => s4, RequiredNumber: () => a3, RequiredString: () => r3, RouteSchema: () => We2, RouteWithoutManySchema: () => He2, RuleSchema: () => Se3, RulesSchema: () => ye3, RuntimeInstanceConfig: () => z2, SetSchema: () => fe3, SourceSchema: () => K, 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: () => Ee2, orderedPropertiesJsonSchema: () => ae2, parseConfig: () => $i, parseFlow: () => Ni, partialEventJsonSchema: () => ne3, policyJsonSchema: () => De3, propertiesJsonSchema: () => re2, ruleJsonSchema: () => Ie3, rulesJsonSchema: () => Oe3, safeParseConfig: () => qi, safeParseFlow: () => Ai, setJsonSchema: () => je2, sourceJsonSchema: () => Vi, sourceTypeJsonSchema: () => ce2, storeJsonSchema: () => Zi, transformerJsonSchema: () => _i, userJsonSchema: () => oe3, validateEventsJsonSchema: () => Xi, validateFlowConfig: () => rn, validateJsonSchema: () => Qi, valueConfigJsonSchema: () => xe3, valueJsonSchema: () => Ce2, z: () => n3, zodToSchema: () => yn });
|
|
1874
1875
|
r3 = n3.string();
|
|
1875
1876
|
a3 = n3.number();
|
|
1876
1877
|
s4 = n3.boolean();
|
|
@@ -1905,30 +1906,30 @@ var init_dev = __esm({
|
|
|
1905
1906
|
q2 = n3.object({ sources: n3.record(n3.string(), n3.unknown()).describe("Map of source instances") }).partial();
|
|
1906
1907
|
N = n3.object({ destinations: n3.record(n3.string(), n3.unknown()).describe("Map of destination instances") }).partial();
|
|
1907
1908
|
A = {};
|
|
1908
|
-
t3(A, { ConsentSchema: () => Z2, DeepPartialEventSchema: () =>
|
|
1909
|
+
t3(A, { ConsentSchema: () => Z2, DeepPartialEventSchema: () => te2, EntitiesSchema: () => X2, EntitySchema: () => Q2, EventSchema: () => Y2, OrderedPropertiesSchema: () => H, PartialEventSchema: () => ee2, PropertiesSchema: () => V, PropertySchema: () => U2, PropertyTypeSchema: () => B2, SourceSchema: () => K, SourceTypeSchema: () => _, UserSchema: () => G2, consentJsonSchema: () => le3, entityJsonSchema: () => se3, eventJsonSchema: () => ie3, orderedPropertiesJsonSchema: () => ae2, partialEventJsonSchema: () => ne3, propertiesJsonSchema: () => re2, sourceTypeJsonSchema: () => ce2, userJsonSchema: () => oe3 });
|
|
1909
1910
|
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)." });
|
|
1910
1911
|
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." });
|
|
1911
|
-
|
|
1912
|
+
V = 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");
|
|
1912
1913
|
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");
|
|
1913
1914
|
_ = 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");
|
|
1914
1915
|
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)");
|
|
1915
|
-
G2 =
|
|
1916
|
-
|
|
1917
|
-
Q2 = n3.lazy(() => n3.object({ entity: n3.string().describe("Entity name"), data:
|
|
1916
|
+
G2 = V.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");
|
|
1917
|
+
K = V.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");
|
|
1918
|
+
Q2 = n3.lazy(() => n3.object({ entity: n3.string().describe("Entity name"), data: V.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
1919
|
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:
|
|
1920
|
+
Y2 = n3.object({ name: n3.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: V.describe("Event-specific properties"), context: H.describe("Ordered context properties with priorities"), globals: V.describe("Global properties shared across events"), custom: V.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: K.describe("Event source information") }).meta({ id: "WalkerOSEvent", title: "WalkerOS.Event", description: "Complete walkerOS event structure." }).describe("Complete walkerOS event structure");
|
|
1920
1921
|
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
|
-
|
|
1922
|
+
te2 = 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");
|
|
1922
1923
|
ie3 = o2(Y2);
|
|
1923
1924
|
ne3 = o2(ee2);
|
|
1924
|
-
|
|
1925
|
-
|
|
1925
|
+
oe3 = o2(G2);
|
|
1926
|
+
re2 = o2(V);
|
|
1926
1927
|
ae2 = o2(H);
|
|
1927
1928
|
se3 = o2(Q2);
|
|
1928
|
-
|
|
1929
|
+
ce2 = o2(_);
|
|
1929
1930
|
le3 = o2(Z2);
|
|
1930
1931
|
de3 = {};
|
|
1931
|
-
t3(de3, { ConfigSchema: () => we2, LoopSchema: () => me3, MapSchema: () => ge3, PolicySchema: () => be3, ResultSchema: () =>
|
|
1932
|
+
t3(de3, { ConfigSchema: () => we2, LoopSchema: () => me3, MapSchema: () => ge3, PolicySchema: () => be3, ResultSchema: () => ke3, RulePatchSchema: () => ve3, RuleSchema: () => Se3, RulesSchema: () => ye3, SetSchema: () => fe3, ValueConfigSchema: () => he3, ValueSchema: () => pe3, ValuesSchema: () => ue3, configJsonSchema: () => Je, loopJsonSchema: () => Pe3, mapJsonSchema: () => Ee2, policyJsonSchema: () => De3, ruleJsonSchema: () => Ie3, rulesJsonSchema: () => Oe3, setJsonSchema: () => je2, valueConfigJsonSchema: () => xe3, valueJsonSchema: () => Ce2 });
|
|
1932
1933
|
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." });
|
|
1933
1934
|
ue3 = n3.array(pe3).meta({ id: "MappingValues", title: "Mapping.Values", description: "Array of transformation values." }).describe("Array of transformation values");
|
|
1934
1935
|
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." });
|
|
@@ -1936,112 +1937,112 @@ var init_dev = __esm({
|
|
|
1936
1937
|
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." });
|
|
1937
1938
|
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");
|
|
1938
1939
|
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)");
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
ye3 = n3.record(n3.string(), n3.record(n3.string(), n3.union([
|
|
1940
|
+
ve3 = 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");
|
|
1941
|
+
Se3 = 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: ve3.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");
|
|
1942
|
+
ye3 = n3.record(n3.string(), n3.record(n3.string(), n3.union([Se3, n3.array(Se3)])).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*).');
|
|
1942
1943
|
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");
|
|
1943
|
-
|
|
1944
|
-
|
|
1944
|
+
ke3 = n3.object({ eventMapping: Se3.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");
|
|
1945
|
+
Ce2 = o2(pe3);
|
|
1945
1946
|
xe3 = o2(he3);
|
|
1946
1947
|
Pe3 = o2(me3);
|
|
1947
|
-
|
|
1948
|
-
|
|
1948
|
+
je2 = o2(fe3);
|
|
1949
|
+
Ee2 = o2(ge3);
|
|
1949
1950
|
De3 = o2(be3);
|
|
1950
|
-
Ie3 = o2(
|
|
1951
|
-
|
|
1951
|
+
Ie3 = o2(Se3);
|
|
1952
|
+
Oe3 = o2(ye3);
|
|
1952
1953
|
Je = o2(we2);
|
|
1953
|
-
|
|
1954
|
-
t3(
|
|
1954
|
+
Re3 = {};
|
|
1955
|
+
t3(Re3, { BatchSchema: () => dt, ConfigSchema: () => it, ContextSchema: () => rt2, DLQSchema: () => St, DataSchema: () => pt3, DestinationPolicySchema: () => ot, DestinationsSchema: () => gt2, InitDestinationsSchema: () => ft3, InitSchema: () => mt2, InstanceSchema: () => ut2, PartialConfigSchema: () => nt3, PushBatchContextSchema: () => st2, PushContextSchema: () => at2, PushEventSchema: () => ct3, PushEventsSchema: () => lt2, PushResultSchema: () => bt, RefSchema: () => ht2, ResultSchema: () => vt, batchJsonSchema: () => xt2, configJsonSchema: () => yt2, contextJsonSchema: () => kt, instanceJsonSchema: () => Pt2, partialConfigJsonSchema: () => wt, pushContextJsonSchema: () => Ct2, resultJsonSchema: () => jt2 });
|
|
1955
1956
|
Me3 = {};
|
|
1956
1957
|
t3(Me3, { MatchExpressionSchema: () => ze3, RouteSchema: () => We2, RouteWithoutManySchema: () => He2 });
|
|
1957
1958
|
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
|
-
|
|
1959
|
-
ze3 = n3.union([
|
|
1959
|
+
Fe = 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)." });
|
|
1960
|
+
ze3 = n3.union([Fe, 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
1961
|
Le3 = n3.strictObject({ match: ze3.optional(), next: n3.lazy(() => We2) });
|
|
1961
|
-
$
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
Ae3 = n3.union([Le3, $
|
|
1962
|
+
$e2 = n3.strictObject({ match: ze3.optional(), one: n3.array(n3.lazy(() => We2)) });
|
|
1963
|
+
qe3 = n3.strictObject({ match: ze3.optional(), many: n3.array(n3.lazy(() => We2)) });
|
|
1964
|
+
Ne3 = n3.strictObject({ match: ze3 });
|
|
1965
|
+
Ae3 = n3.union([Le3, $e2, qe3, Ne3]);
|
|
1965
1966
|
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
1967
|
Be2 = n3.strictObject({ match: ze3.optional(), next: n3.lazy(() => He2) });
|
|
1967
1968
|
Ue3 = n3.strictObject({ match: ze3.optional(), one: n3.array(n3.lazy(() => He2)) });
|
|
1968
|
-
|
|
1969
|
-
He2 = n3.union([n3.string(), n3.array(n3.lazy(() => He2)),
|
|
1970
|
-
|
|
1971
|
-
t3(
|
|
1969
|
+
Ve3 = n3.union([Be2, Ue3, Ne3]);
|
|
1970
|
+
He2 = n3.union([n3.string(), n3.array(n3.lazy(() => He2)), Ve3]).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." });
|
|
1971
|
+
_e2 = {};
|
|
1972
|
+
t3(_e2, { CacheRuleSchema: () => Xe, CacheSchema: () => Ye, EventCacheRuleSchema: () => Ze2, EventCacheSchema: () => Ge, StoreCacheRuleSchema: () => Ke2, StoreCacheSchema: () => Qe });
|
|
1972
1973
|
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
1974
|
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
1975
|
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
1976
|
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." });
|
|
1976
1977
|
Xe = Ze2;
|
|
1977
1978
|
Ye = Ge;
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
at2 =
|
|
1985
|
-
|
|
1986
|
-
ct3 = n3.object({ event: Y2.describe("The event to process"), mapping:
|
|
1987
|
-
|
|
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:
|
|
1989
|
-
|
|
1990
|
-
ut2 = n3.object({ config:
|
|
1991
|
-
mt2 = n3.object({ code: ut2.describe("Destination instance with implementation"), config:
|
|
1992
|
-
|
|
1979
|
+
et = n3.any().meta({ id: "LoggerHandler", title: "Logger.Handler", description: "Custom log handler function (level, ...args) => void" });
|
|
1980
|
+
tt = n3.object({ level: n3.union([n3.number(), n3.enum(["ERROR", "WARN", "INFO", "DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"), handler: et.optional().describe("Custom log handler function") }).meta({ id: "LoggerConfig", title: "Logger.Config", description: "Logger configuration (level, handler) to override the collector defaults" });
|
|
1981
|
+
it = 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: tt.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");
|
|
1982
|
+
nt3 = it.partial().meta({ id: "DestinationPartialConfig", title: "Destination.PartialConfig", description: "Partial destination configuration with all fields optional." }).describe("Partial destination configuration with all fields optional");
|
|
1983
|
+
ot = be3.describe("Destination policy rules for event pre-processing");
|
|
1984
|
+
rt2 = 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: it.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");
|
|
1985
|
+
at2 = rt2.extend({ mapping: Se3.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");
|
|
1986
|
+
st2 = at2.describe("Batch push context with event-specific mapping");
|
|
1987
|
+
ct3 = n3.object({ event: Y2.describe("The event to process"), mapping: Se3.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");
|
|
1988
|
+
lt2 = n3.array(ct3).meta({ id: "DestinationPushEvents", title: "Destination.PushEvents", description: "Array of events with mappings (batch input)." }).describe("Array of events with mappings");
|
|
1989
|
+
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: Se3.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");
|
|
1990
|
+
pt3 = 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)");
|
|
1991
|
+
ut2 = n3.object({ config: it.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)");
|
|
1992
|
+
mt2 = n3.object({ code: ut2.describe("Destination instance with implementation"), config: nt3.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");
|
|
1993
|
+
ft3 = 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
1994
|
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");
|
|
1994
1995
|
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");
|
|
1995
1996
|
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");
|
|
1996
1997
|
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
1998
|
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(
|
|
1999
|
-
wt = o2(
|
|
2000
|
-
|
|
1999
|
+
yt2 = o2(it);
|
|
2000
|
+
wt = o2(nt3);
|
|
2001
|
+
kt = o2(rt2);
|
|
2001
2002
|
Ct2 = o2(at2);
|
|
2002
2003
|
xt2 = o2(dt);
|
|
2003
2004
|
Pt2 = o2(ut2);
|
|
2004
2005
|
jt2 = o2(vt);
|
|
2005
|
-
|
|
2006
|
-
t3(
|
|
2006
|
+
Et = {};
|
|
2007
|
+
t3(Et, { CommandTypeSchema: () => Dt2, ConfigSchema: () => It2, DestinationsSchema: () => Tt2, InitConfigSchema: () => Jt, InstanceSchema: () => Ft2, PushContextSchema: () => Rt2, SessionDataSchema: () => Ot2, SourcesSchema: () => Mt2, commandTypeJsonSchema: () => zt2, configJsonSchema: () => Lt2, initConfigJsonSchema: () => qt2, instanceJsonSchema: () => At2, pushContextJsonSchema: () => Nt2, sessionDataJsonSchema: () => $t });
|
|
2007
2008
|
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");
|
|
2008
|
-
It2 = n3.object({ run: n3.boolean().describe("Whether to run collector automatically on initialization").optional(), globalsStatic:
|
|
2009
|
-
|
|
2010
|
-
Jt = It2.partial().extend({ consent: Z2.optional().describe("Initial consent state"), user: G2.optional().describe("Initial user data"), globals:
|
|
2009
|
+
It2 = n3.object({ run: n3.boolean().describe("Whether to run collector automatically on initialization").optional(), globalsStatic: V.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: tt.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");
|
|
2010
|
+
Ot2 = V.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");
|
|
2011
|
+
Jt = It2.partial().extend({ consent: Z2.optional().describe("Initial consent state"), user: G2.optional().describe("Initial user data"), globals: V.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: V.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");
|
|
2011
2012
|
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");
|
|
2012
2013
|
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");
|
|
2013
2014
|
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");
|
|
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:
|
|
2015
|
+
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: V.describe("Custom implementation-specific properties"), sources: Mt2.describe("Registered source instances"), destinations: Tt2.describe("Registered destination instances"), globals: V.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([Ot2]).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");
|
|
2015
2016
|
zt2 = o2(Dt2);
|
|
2016
2017
|
Lt2 = o2(It2);
|
|
2017
|
-
$
|
|
2018
|
-
|
|
2018
|
+
$t = o2(Ot2);
|
|
2019
|
+
qt2 = o2(Jt);
|
|
2019
2020
|
Nt2 = o2(Rt2);
|
|
2020
|
-
|
|
2021
|
+
At2 = o2(Ft2);
|
|
2021
2022
|
Wt2 = {};
|
|
2022
|
-
t3(Wt2, { BaseEnvSchema: () =>
|
|
2023
|
-
|
|
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:
|
|
2025
|
-
|
|
2023
|
+
t3(Wt2, { BaseEnvSchema: () => Bt2, ConfigSchema: () => Ut2, InitSchema: () => _t, InitSourceSchema: () => Zt2, InitSourcesSchema: () => Gt, InstanceSchema: () => Ht2, PartialConfigSchema: () => Vt2, baseEnvJsonSchema: () => Kt2, configJsonSchema: () => Qt, initSourceJsonSchema: () => ei, initSourcesJsonSchema: () => ti, instanceJsonSchema: () => Yt, partialConfigJsonSchema: () => Xt });
|
|
2024
|
+
Bt2 = 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");
|
|
2025
|
+
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: Bt2.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: tt.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");
|
|
2026
|
+
Vt2 = 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
2027
|
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");
|
|
2027
|
-
|
|
2028
|
-
Zt2 = n3.object({ code:
|
|
2028
|
+
_t = 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>");
|
|
2029
|
+
Zt2 = n3.object({ code: _t.describe("Source initialization function"), config: Vt2.optional().describe("Partial configuration overrides"), env: Bt2.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");
|
|
2029
2030
|
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");
|
|
2030
|
-
Kt2 = o2(
|
|
2031
|
+
Kt2 = o2(Bt2);
|
|
2031
2032
|
Qt = o2(Ut2);
|
|
2032
|
-
Xt = o2(
|
|
2033
|
+
Xt = o2(Vt2);
|
|
2033
2034
|
Yt = o2(Ht2);
|
|
2034
2035
|
ei = o2(Zt2);
|
|
2035
2036
|
ti = o2(Gt);
|
|
2036
2037
|
ii = {};
|
|
2037
2038
|
t3(ii, { ConfigSchema: () => ni, PartialConfigSchema: () => oi, configJsonSchema: () => ri, partialConfigJsonSchema: () => ai });
|
|
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:
|
|
2039
|
+
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: tt.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");
|
|
2039
2040
|
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");
|
|
2040
2041
|
ri = o2(ni);
|
|
2041
2042
|
ai = o2(oi);
|
|
2042
2043
|
si = {};
|
|
2043
2044
|
t3(si, { ConfigSchema: () => ci, PartialConfigSchema: () => li, configJsonSchema: () => di, partialConfigJsonSchema: () => pi });
|
|
2044
|
-
ci = n3.object({ settings: n3.unknown().meta({ id: "StoreSettings", title: "Store.Settings", description: "Implementation-specific configuration (store-defined shape)." }).describe("Implementation-specific configuration").optional(), env: n3.unknown().meta({ id: "StoreEnv", title: "Store.Env", description: "Environment dependencies (store-defined shape)." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Store instance identifier (defaults to store key)").optional(), logger:
|
|
2045
|
+
ci = n3.object({ settings: n3.unknown().meta({ id: "StoreSettings", title: "Store.Settings", description: "Implementation-specific configuration (store-defined shape)." }).describe("Implementation-specific configuration").optional(), env: n3.unknown().meta({ id: "StoreEnv", title: "Store.Env", description: "Environment dependencies (store-defined shape)." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Store instance identifier (defaults to store key)").optional(), logger: tt.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 store registration (boolean enables defaults, object configures specifics)") }).meta({ id: "StoreConfig", title: "Store.Config", description: "Store configuration (settings, env, logger) \u2014 key-value infrastructure component." }).describe("Store configuration");
|
|
2045
2046
|
li = ci.partial().meta({ id: "StorePartialConfig", title: "Store.PartialConfig", description: "Partial store configuration with all fields optional." }).describe("Partial store configuration with all fields optional");
|
|
2046
2047
|
di = o2(ci);
|
|
2047
2048
|
pi = o2(li);
|
|
@@ -2090,7 +2091,7 @@ var init_dev = __esm({
|
|
|
2090
2091
|
sn = /\$env\.([A-Za-z_]\w*)(=[^"}\s]*)?/g;
|
|
2091
2092
|
cn = /\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?/g;
|
|
2092
2093
|
ln = /\$(var|store|flow|secret):([a-zA-Z_][a-zA-Z0-9_]*)/g;
|
|
2093
|
-
Cn = { source: Wt2.configJsonSchema, destination:
|
|
2094
|
+
Cn = { source: Wt2.configJsonSchema, destination: Re3.configJsonSchema };
|
|
2094
2095
|
}
|
|
2095
2096
|
});
|
|
2096
2097
|
|
|
@@ -2335,15 +2336,15 @@ function loadBundleConfig(rawConfig, options) {
|
|
|
2335
2336
|
const config = validateFlowConfig(sanitized);
|
|
2336
2337
|
const availableFlows = getAvailableFlows(config);
|
|
2337
2338
|
const flowName = resolveFlow(config, options.flowName, availableFlows);
|
|
2338
|
-
let flowSettings =
|
|
2339
|
-
const platform =
|
|
2339
|
+
let flowSettings = Q(config, flowName, { deferred: true });
|
|
2340
|
+
const platform = ee(flowSettings);
|
|
2340
2341
|
if (!platform) {
|
|
2341
2342
|
throw new Error(
|
|
2342
2343
|
`Invalid configuration: flow "${flowName}" must have config.platform set to "web" or "server".`
|
|
2343
2344
|
);
|
|
2344
2345
|
}
|
|
2345
2346
|
if (platform === "web") {
|
|
2346
|
-
flowSettings =
|
|
2347
|
+
flowSettings = Q(config, flowName);
|
|
2347
2348
|
}
|
|
2348
2349
|
const buildDefaults = getBuildDefaults(platform);
|
|
2349
2350
|
const bundle2 = flowSettings.config?.bundle;
|
|
@@ -3363,7 +3364,7 @@ function hasCodeReference(code) {
|
|
|
3363
3364
|
}
|
|
3364
3365
|
function validateReference(type, name, ref) {
|
|
3365
3366
|
if (type === "Transformer") {
|
|
3366
|
-
const r4 =
|
|
3367
|
+
const r4 = qt({ ...ref }, "Transformer");
|
|
3367
3368
|
if (!r4.ok) {
|
|
3368
3369
|
throw new Error(`Transformer "${name}": ${r4.reason ?? "invalid entry."}`);
|
|
3369
3370
|
}
|
|
@@ -3473,7 +3474,7 @@ async function bundleCore(flowSettings, buildOptions, logger, showStats = false)
|
|
|
3473
3474
|
for (const pkg of stepPackages) {
|
|
3474
3475
|
const isLocalPath = pkg.startsWith(".") || pkg.startsWith("/");
|
|
3475
3476
|
if (isLocalPath) {
|
|
3476
|
-
const varName =
|
|
3477
|
+
const varName = Y(pkg);
|
|
3477
3478
|
if (!buildOptions.packages[varName]) {
|
|
3478
3479
|
buildOptions.packages[varName] = {
|
|
3479
3480
|
path: pkg
|
|
@@ -3975,7 +3976,7 @@ async function generateImportStatements(packages, destinationPackages, sourcePac
|
|
|
3975
3976
|
const hasNamed = namedImports.has(packageName);
|
|
3976
3977
|
const namedImportsToGenerate = [];
|
|
3977
3978
|
if (isUsedByDestOrSource && !hasNamed) {
|
|
3978
|
-
const varName =
|
|
3979
|
+
const varName = Y(packageName);
|
|
3979
3980
|
importStatements.push(`import ${varName} from '${packageName}';`);
|
|
3980
3981
|
}
|
|
3981
3982
|
if (hasNamed) {
|
|
@@ -4017,7 +4018,7 @@ async function generateImportStatements(packages, destinationPackages, sourcePac
|
|
|
4017
4018
|
const pkgJson = await fs11.readJSON(pkgJsonPath);
|
|
4018
4019
|
const exports = pkgJson.exports;
|
|
4019
4020
|
if (exports && typeof exports === "object" && "./dev" in exports) {
|
|
4020
|
-
const varName = `__dev_${
|
|
4021
|
+
const varName = `__dev_${Y(packageName)}`;
|
|
4021
4022
|
importStatements.push(
|
|
4022
4023
|
`import * as ${varName} from '${packageName}/dev';`
|
|
4023
4024
|
);
|
|
@@ -4161,7 +4162,7 @@ function buildSplitConfigObject(flowSettings, namedImports) {
|
|
|
4161
4162
|
if (typeof step.import === "string" && step.package) {
|
|
4162
4163
|
return step.import;
|
|
4163
4164
|
}
|
|
4164
|
-
return
|
|
4165
|
+
return Y(step.package);
|
|
4165
4166
|
}
|
|
4166
4167
|
function getStepProps(step) {
|
|
4167
4168
|
const props = {};
|
|
@@ -4216,12 +4217,12 @@ function buildSplitConfigObject(flowSettings, namedImports) {
|
|
|
4216
4217
|
return buildSplitStepEntry("destinations", key, dest);
|
|
4217
4218
|
});
|
|
4218
4219
|
const transformersEntries = Object.entries(transformers).filter(
|
|
4219
|
-
([, transformer]) => transformer.package || hasCodeReference(transformer.code) ||
|
|
4220
|
+
([, transformer]) => transformer.package || hasCodeReference(transformer.code) || Bt({ ...transformer }, "Transformer")
|
|
4220
4221
|
).map(([key, transformer]) => {
|
|
4221
4222
|
if (isInlineCode(transformer.code)) {
|
|
4222
4223
|
return ` ${key}: ${generateInlineCode(transformer.code, transformer.config || {}, transformer.env, { before: transformer.before, next: transformer.next })}`;
|
|
4223
4224
|
}
|
|
4224
|
-
if (
|
|
4225
|
+
if (Bt({ ...transformer }, "Transformer")) {
|
|
4225
4226
|
const chainLines = [];
|
|
4226
4227
|
if (transformer.before !== void 0) {
|
|
4227
4228
|
chainLines.push(`before: ${JSON.stringify(transformer.before)}`);
|
|
@@ -4417,7 +4418,7 @@ function serializeWithCode(value, indent) {
|
|
|
4417
4418
|
if (value.startsWith("$code:")) {
|
|
4418
4419
|
return value.slice(6);
|
|
4419
4420
|
}
|
|
4420
|
-
const esc =
|
|
4421
|
+
const esc = B.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4421
4422
|
const markerRe = new RegExp(
|
|
4422
4423
|
esc + "([a-zA-Z_][a-zA-Z0-9_]*)(?::((?:(?!" + esc + `)[^\\s"'])*))?`,
|
|
4423
4424
|
"g"
|
|
@@ -5398,7 +5399,7 @@ function s2(e4, t4) {
|
|
|
5398
5399
|
const n4 = {};
|
|
5399
5400
|
return Object.entries(t4).forEach(([e5, t5]) => {
|
|
5400
5401
|
n4[e5] = !!t5;
|
|
5401
|
-
}), e4.consent =
|
|
5402
|
+
}), e4.consent = ne(e4.consent, n4), { update: n4 };
|
|
5402
5403
|
}
|
|
5403
5404
|
function S(e4, t4) {
|
|
5404
5405
|
const n4 = e4.status.startedAt;
|
|
@@ -5407,7 +5408,7 @@ function S(e4, t4) {
|
|
|
5407
5408
|
function ne2(e4, t4) {
|
|
5408
5409
|
return e4.storeId && t4.stores[e4.storeId] ? t4.stores[e4.storeId] : t4.stores.__cache;
|
|
5409
5410
|
}
|
|
5410
|
-
function
|
|
5411
|
+
function oe2(e4) {
|
|
5411
5412
|
const t4 = {};
|
|
5412
5413
|
for (const [n4, o3] of Object.entries(e4)) {
|
|
5413
5414
|
const e5 = o3.config?.next;
|
|
@@ -5419,7 +5420,7 @@ function se2(e4, t4) {
|
|
|
5419
5420
|
const n4 = e4.config || {}, o3 = e4[t4];
|
|
5420
5421
|
return void 0 !== o3 ? { config: { ...n4, [t4]: o3 }, chainValue: o3 } : { config: n4, chainValue: void 0 };
|
|
5421
5422
|
}
|
|
5422
|
-
function
|
|
5423
|
+
function re(e4, t4 = {}) {
|
|
5423
5424
|
if (!e4) return [];
|
|
5424
5425
|
if (Array.isArray(e4)) return e4;
|
|
5425
5426
|
const n4 = [], o3 = /* @__PURE__ */ new Set();
|
|
@@ -5439,7 +5440,7 @@ async function ae(e4, t4, n4) {
|
|
|
5439
5440
|
if (t4.init && !t4.config.init) {
|
|
5440
5441
|
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) };
|
|
5441
5442
|
s5.debug("init");
|
|
5442
|
-
const a4 = await
|
|
5443
|
+
const a4 = await at(t4.init, "TransformerInit", e4.hooks, e4.logger)(r4);
|
|
5443
5444
|
if (false === a4) return false;
|
|
5444
5445
|
t4.config = { ...a4 || t4.config, env: a4?.env || t4.config.env, init: true }, s5.debug("init done");
|
|
5445
5446
|
}
|
|
@@ -5449,16 +5450,16 @@ async function ie2(e4, t4, n4, o3, s5, r4) {
|
|
|
5449
5450
|
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
5451
|
i2.debug("push", { event: o3.name });
|
|
5451
5452
|
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
|
-
|
|
5453
|
+
ft(e4, l2);
|
|
5453
5454
|
try {
|
|
5454
|
-
const s6 = await
|
|
5455
|
-
return a5.durationMs = r5 - d2, a5.outEvent = s6,
|
|
5455
|
+
const s6 = await at(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 });
|
|
5456
|
+
return a5.durationMs = r5 - d2, a5.outEvent = s6, ft(e4, a5), i2.debug("push done"), s6;
|
|
5456
5457
|
} catch (t5) {
|
|
5457
5458
|
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) },
|
|
5459
|
+
throw s6.durationMs = o4 - d2, s6.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, ft(e4, s6), t5;
|
|
5459
5460
|
}
|
|
5460
5461
|
}
|
|
5461
|
-
function
|
|
5462
|
+
function ce(e4, t4) {
|
|
5462
5463
|
return e4 ? { ...e4, _meta: { ...e4._meta, path: [...e4._meta.path] } } : E(t4);
|
|
5463
5464
|
}
|
|
5464
5465
|
async function ue2(e4, t4, n4, o3, s5, r4, a4) {
|
|
@@ -5472,8 +5473,8 @@ async function ue2(e4, t4, n4, o3, s5, r4, a4) {
|
|
|
5472
5473
|
}
|
|
5473
5474
|
if (s5 && s5._meta && s5._meta.path.length > 256) return e4.logger.error(`Max path length exceeded at ${o4}`), { event: null, respond: c2 };
|
|
5474
5475
|
s5 && s5._meta && (s5._meta.hops++, s5._meta.path.push(o4));
|
|
5475
|
-
if (!await
|
|
5476
|
-
if (t5 instanceof
|
|
5476
|
+
if (!await We(ae, (t5) => {
|
|
5477
|
+
if (t5 instanceof He) throw t5;
|
|
5477
5478
|
return e4.status.failed++, e4.logger.scope(`transformer:${r5.type || "unknown"}`).error("transformer init failed", { transformer: o4, error: t5 }), false;
|
|
5478
5479
|
})(e4, r5, o4)) return { event: null, respond: c2 };
|
|
5479
5480
|
if (a4 && void 0 !== r5.config?.chainMocks?.[a4]) {
|
|
@@ -5486,10 +5487,10 @@ async function ue2(e4, t4, n4, o3, s5, r4, a4) {
|
|
|
5486
5487
|
continue;
|
|
5487
5488
|
}
|
|
5488
5489
|
if (r5.config?.disabled) continue;
|
|
5489
|
-
const u4 = r5.config?.cache, d2 = u4 ?
|
|
5490
|
+
const u4 = r5.config?.cache, d2 = u4 ? Ft(u4) : void 0, l2 = d2 ? ne2(d2, e4) : void 0;
|
|
5490
5491
|
let f3;
|
|
5491
5492
|
if (d2 && l2) {
|
|
5492
|
-
const e5 =
|
|
5493
|
+
const e5 = Dt(s5, i2), t5 = await Ut(d2, l2, e5);
|
|
5493
5494
|
if ("HIT" === t5?.status && t5.value) {
|
|
5494
5495
|
if (i2 = t5.value, d2.stop) return { event: i2, respond: c2, stopped: true };
|
|
5495
5496
|
continue;
|
|
@@ -5498,30 +5499,30 @@ async function ue2(e4, t4, n4, o3, s5, r4, a4) {
|
|
|
5498
5499
|
}
|
|
5499
5500
|
const p2 = r5.config.before;
|
|
5500
5501
|
if (p2) {
|
|
5501
|
-
const n5 =
|
|
5502
|
+
const n5 = Mt(p2, Dt(s5, i2));
|
|
5502
5503
|
if (1 === n5.length) {
|
|
5503
|
-
const o5 =
|
|
5504
|
+
const o5 = re(n5[0], oe2(t4));
|
|
5504
5505
|
if (o5.length > 0) {
|
|
5505
5506
|
const n6 = await ue2(e4, t4, o5, i2, s5, c2, a4);
|
|
5506
5507
|
if (null === n6.event) return { event: null, respond: n6.respond ?? c2 };
|
|
5507
5508
|
if (n6.stopped) return { event: Array.isArray(n6.event) ? n6.event[0] : n6.event, respond: n6.respond ?? c2, stopped: true };
|
|
5508
5509
|
n6.respond && (c2 = n6.respond), i2 = Array.isArray(n6.event) ? n6.event[0] : n6.event;
|
|
5509
5510
|
}
|
|
5510
|
-
} else n5.length > 1 && await Promise.all(n5.map((n6) =>
|
|
5511
|
+
} else n5.length > 1 && await Promise.all(n5.map((n6) => We(ue2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n6} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, re(n6, oe2(t4)), i2, ce(s5, n6), void 0, a4)));
|
|
5511
5512
|
}
|
|
5512
|
-
const g3 = await
|
|
5513
|
+
const g3 = await We(ie2, (t5) => (e4.logger.scope(`transformer:${r5.type || "unknown"}`).error("Push failed", { error: t5 }), false))(e4, r5, o4, i2, s5, c2);
|
|
5513
5514
|
if (false === g3) return { event: null, respond: c2 };
|
|
5514
5515
|
if (Array.isArray(g3)) {
|
|
5515
5516
|
const r6 = n4.slice(n4.indexOf(o4) + 1), u5 = await Promise.all(g3.map(async (n5) => {
|
|
5516
|
-
const o5 = n5.event || i2, u6 =
|
|
5517
|
+
const o5 = n5.event || i2, u6 = ce(s5, "unknown");
|
|
5517
5518
|
if (n5.next) {
|
|
5518
|
-
const s6 =
|
|
5519
|
+
const s6 = Mt(n5.next, Dt(u6, o5));
|
|
5519
5520
|
if (0 === s6.length) return { event: o5, respond: c2 };
|
|
5520
5521
|
if (1 === s6.length) {
|
|
5521
|
-
const n6 =
|
|
5522
|
+
const n6 = re(s6[0], oe2(t4));
|
|
5522
5523
|
return n6.length > 0 ? ue2(e4, t4, n6, o5, u6, c2, a4) : { event: o5, respond: c2 };
|
|
5523
5524
|
}
|
|
5524
|
-
return (await Promise.all(s6.map((n6) =>
|
|
5525
|
+
return (await Promise.all(s6.map((n6) => We(ue2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n6} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, re(n6, oe2(t4)), o5, ce(u6, n6), void 0, a4)))).map((e5) => ({ event: e5.event, respond: void 0 }));
|
|
5525
5526
|
}
|
|
5526
5527
|
return r6.length > 0 ? ue2(e4, t4, r6, o5, u6, c2, a4) : { event: o5, respond: c2 };
|
|
5527
5528
|
}));
|
|
@@ -5537,34 +5538,34 @@ async function ue2(e4, t4, n4, o3, s5, r4, a4) {
|
|
|
5537
5538
|
if (g3 && "object" == typeof g3) {
|
|
5538
5539
|
const { event: n5, respond: o5, next: r6 } = g3;
|
|
5539
5540
|
if (o5 && (c2 = o5), void 0 !== r6) {
|
|
5540
|
-
const o6 =
|
|
5541
|
+
const o6 = Mt(r6, Dt(s5, i2));
|
|
5541
5542
|
if (0 === o6.length) {
|
|
5542
5543
|
n5 && (i2 = n5);
|
|
5543
5544
|
continue;
|
|
5544
5545
|
}
|
|
5545
5546
|
if (1 === o6.length) {
|
|
5546
|
-
const u5 =
|
|
5547
|
+
const u5 = re(o6[0], oe2(t4));
|
|
5547
5548
|
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 });
|
|
5548
5549
|
}
|
|
5549
|
-
return await Promise.all(o6.map((o7) =>
|
|
5550
|
+
return await Promise.all(o6.map((o7) => We(ue2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${o7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, re(o7, oe2(t4)), n5 || i2, ce(s5, o7), void 0, a4))), { event: null, respond: void 0 };
|
|
5550
5551
|
}
|
|
5551
5552
|
n5 && (i2 = n5);
|
|
5552
5553
|
}
|
|
5553
|
-
f3 && l2 &&
|
|
5554
|
+
f3 && l2 && Zt(l2, f3.key, i2, f3.ttl);
|
|
5554
5555
|
const m3 = r5.config.next, h3 = "string" == typeof m3 || Array.isArray(m3) && m3.every((e5) => "string" == typeof e5), y2 = void 0 !== m3 && !h3;
|
|
5555
5556
|
if ((!g3 || "object" == typeof g3 && !g3.next) && y2) {
|
|
5556
|
-
const n5 =
|
|
5557
|
+
const n5 = Mt(r5.config.next, Dt(s5, i2));
|
|
5557
5558
|
if (1 === n5.length) {
|
|
5558
|
-
const o5 =
|
|
5559
|
+
const o5 = re(n5[0], oe2(t4));
|
|
5559
5560
|
return o5.length > 0 ? ue2(e4, t4, o5, i2, s5, c2, a4) : { event: i2, respond: c2 };
|
|
5560
5561
|
}
|
|
5561
|
-
return n5.length > 1 ? (await Promise.all(n5.map((n6) =>
|
|
5562
|
+
return n5.length > 1 ? (await Promise.all(n5.map((n6) => We(ue2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n6} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, re(n6, oe2(t4)), i2, ce(s5, n6), void 0, a4))), { event: null, respond: void 0 }) : { event: i2, respond: c2 };
|
|
5562
5563
|
}
|
|
5563
5564
|
}
|
|
5564
5565
|
return { event: i2, respond: c2 };
|
|
5565
5566
|
}
|
|
5566
5567
|
function de2(e4) {
|
|
5567
|
-
return e4 &&
|
|
5568
|
+
return e4 && fe(e4) ? e4 : {};
|
|
5568
5569
|
}
|
|
5569
5570
|
function le2(e4) {
|
|
5570
5571
|
return "string" == typeof e4 || !(!Array.isArray(e4) || !e4.every((e5) => "string" == typeof e5));
|
|
@@ -5574,8 +5575,8 @@ async function fe2(e4, t4, n4) {
|
|
|
5574
5575
|
const o3 = t4.queueOn;
|
|
5575
5576
|
t4.queueOn = [];
|
|
5576
5577
|
const s5 = n4 || t4.config?.id || "unknown";
|
|
5577
|
-
for (const { type: n5, data: r4 } of o3) await
|
|
5578
|
-
if (t5 instanceof
|
|
5578
|
+
for (const { type: n5, data: r4 } of o3) await We(t4.on, (t5) => {
|
|
5579
|
+
if (t5 instanceof He) throw t5;
|
|
5579
5580
|
e4.status.failed++, e4.logger.scope("source").error("source on flush failed", { sourceId: s5, type: n5, error: t5 });
|
|
5580
5581
|
})(n5, r4);
|
|
5581
5582
|
}
|
|
@@ -5583,12 +5584,12 @@ function pe2(e4) {
|
|
|
5583
5584
|
return Boolean(e4.config.init) && !e4.config.require?.length;
|
|
5584
5585
|
}
|
|
5585
5586
|
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 ?
|
|
5587
|
+
const { code: o3, config: s5 = {}, env: r4 = {}, primary: a4, next: i2, before: c2, cache: u4 } = n4, d2 = u4, l2 = d2 ? Ft({ ...d2, stop: d2.stop ?? true }) : void 0, f3 = le2(i2) ? re(i2, oe2(e4.transformers)) : void 0, p2 = le2(c2) ? re(c2, oe2(e4.transformers)) : void 0, g3 = r4.push, m3 = g3 ?? e4.push, h3 = Boolean(g3), y2 = async (n5, o4, r5) => {
|
|
5587
5588
|
let a5;
|
|
5588
5589
|
const u5 = p2 ?? (void 0 !== c2 ? (() => {
|
|
5589
|
-
const t5 =
|
|
5590
|
+
const t5 = Mt(c2, Dt(r5.ingest));
|
|
5590
5591
|
if (0 === t5.length) return [];
|
|
5591
|
-
return
|
|
5592
|
+
return re(1 === t5.length ? t5[0] : t5, oe2(e4.transformers));
|
|
5592
5593
|
})() : []);
|
|
5593
5594
|
let d3 = [n5];
|
|
5594
5595
|
if (u5.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
@@ -5600,36 +5601,36 @@ async function ge2(e4, t4, n4) {
|
|
|
5600
5601
|
if (l2) {
|
|
5601
5602
|
const t5 = ne2(l2, e4);
|
|
5602
5603
|
if (t5) {
|
|
5603
|
-
const n6 =
|
|
5604
|
+
const n6 = Dt(r5.ingest), o5 = await Ut(l2, t5, n6);
|
|
5604
5605
|
if (o5) {
|
|
5605
5606
|
if ("HIT" === o5.status && void 0 !== o5.value && l2.stop) {
|
|
5606
5607
|
let t6 = o5.value;
|
|
5607
|
-
return o5.rule.update && (t6 = await
|
|
5608
|
+
return o5.rule.update && (t6 = await Wt(t6, o5.rule.update, { ...n6, cache: { status: "HIT" } }, e4)), r5.respond?.(t6), { ok: true };
|
|
5608
5609
|
}
|
|
5609
5610
|
if ("MISS" === o5.status && l2.stop && r5.respond) {
|
|
5610
5611
|
const s6 = r5.respond, i3 = o5.rule.update, c3 = { ...n6, cache: { status: "MISS" } }, u6 = o5.key, d4 = o5.rule.ttl, l3 = (n7) => {
|
|
5611
|
-
|
|
5612
|
-
const t6 = await
|
|
5612
|
+
Zt(t5, u6, n7, d4), i3 ? a5 = (async () => {
|
|
5613
|
+
const t6 = await Wt(n7, i3, c3, e4);
|
|
5613
5614
|
s6(t6);
|
|
5614
5615
|
})() : s6(n7);
|
|
5615
5616
|
};
|
|
5616
5617
|
r5.respond = l3;
|
|
5617
5618
|
}
|
|
5618
|
-
"MISS" !== o5.status || l2.stop ||
|
|
5619
|
+
"MISS" !== o5.status || l2.stop || Zt(t5, o5.key, true, o5.rule.ttl);
|
|
5619
5620
|
}
|
|
5620
5621
|
}
|
|
5621
5622
|
}
|
|
5622
5623
|
const g4 = f3 ? { kind: "single", preChain: f3 } : void 0 !== i2 ? (() => {
|
|
5623
|
-
const t5 =
|
|
5624
|
-
return 0 === t5.length ? { kind: "single", preChain: [] } : 1 === t5.length ? { kind: "single", preChain:
|
|
5624
|
+
const t5 = Mt(i2, Dt(r5.ingest));
|
|
5625
|
+
return 0 === t5.length ? { kind: "single", preChain: [] } : 1 === t5.length ? { kind: "single", preChain: re(t5[0], oe2(e4.transformers)) } : { kind: "many", branches: t5.map((t6) => re(t6, oe2(e4.transformers))) };
|
|
5625
5626
|
})() : { kind: "single", preChain: [] };
|
|
5626
5627
|
let y3 = { ok: true };
|
|
5627
|
-
for (const n6 of d3) "many" === g4.kind ? (await Promise.all(g4.branches.map((a6, i3) =>
|
|
5628
|
+
for (const n6 of d3) "many" === g4.kind ? (await Promise.all(g4.branches.map((a6, i3) => We(async () => h3 ? m3(n6) : m3(n6, { ...o4, id: t4, ingest: ce(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
5629
|
return a5 && await a5, y3;
|
|
5629
5630
|
}, w3 = async (n5) => {
|
|
5630
5631
|
const o4 = E(t4);
|
|
5631
5632
|
if (!s5.ingest || void 0 === n5) return o4;
|
|
5632
|
-
const r5 = await
|
|
5633
|
+
const r5 = await Ke(n5, s5.ingest, { collector: e4 });
|
|
5633
5634
|
return { ...o4, ...r5, _meta: o4._meta };
|
|
5634
5635
|
}, 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
5636
|
const o4 = { ingest: E(t4), respond: void 0 };
|
|
@@ -5637,8 +5638,8 @@ async function ge2(e4, t4, n4) {
|
|
|
5637
5638
|
} }, k2 = { collector: e4, logger: v3, id: t4, config: s5, env: b3, withScope: async (e5, t5, n5) => {
|
|
5638
5639
|
const o4 = { ingest: await w3(e5), respond: t5 };
|
|
5639
5640
|
return n5({ ...b3, push: (e6, t6 = {}) => y2(e6, t6, o4), ingest: o4.ingest, respond: o4.respond });
|
|
5640
|
-
} }, C3 = await
|
|
5641
|
-
if (n5 instanceof
|
|
5641
|
+
} }, C3 = await We(o3, (n5) => {
|
|
5642
|
+
if (n5 instanceof He) throw n5;
|
|
5642
5643
|
e4.status.failed++, e4.logger.scope("source").error("source factory failed", { sourceId: t4, error: n5 });
|
|
5643
5644
|
})(k2);
|
|
5644
5645
|
if (!C3) return;
|
|
@@ -5657,30 +5658,30 @@ async function me2(e4, t4 = {}) {
|
|
|
5657
5658
|
for (const t5 of Object.keys(n4)) {
|
|
5658
5659
|
const n5 = e4.sources[t5];
|
|
5659
5660
|
let o3 = false;
|
|
5660
|
-
n5.init && await
|
|
5661
|
-
if (n6 instanceof
|
|
5661
|
+
n5.init && await We(n5.init.bind(n5), (n6) => {
|
|
5662
|
+
if (n6 instanceof He) throw n6;
|
|
5662
5663
|
o3 = true, e4.status.failed++, e4.logger.scope("source").error("source init failed", { sourceId: t5, error: n6 });
|
|
5663
5664
|
})(), o3 || (n5.config.init = true, pe2(n5) && await fe2(e4, n5, t5));
|
|
5664
5665
|
}
|
|
5665
5666
|
return n4;
|
|
5666
5667
|
}
|
|
5667
5668
|
function he2(e4, t4, n4, o3) {
|
|
5668
|
-
if (n4 instanceof
|
|
5669
|
+
if (n4 instanceof He) throw n4;
|
|
5669
5670
|
e4.logger.scope("on").error("on callback failed", { kind: t4, ...o3, error: n4 });
|
|
5670
5671
|
}
|
|
5671
5672
|
function ye2(e4, t4) {
|
|
5672
5673
|
return { collector: e4, logger: e4.logger.scope("on").scope(String(t4)) };
|
|
5673
5674
|
}
|
|
5674
5675
|
async function we(e4, t4, n4) {
|
|
5675
|
-
const o3 = e4.on, s5 = o3[t4] || [], r4 =
|
|
5676
|
+
const o3 = e4.on, s5 = o3[t4] || [], r4 = oe(n4) ? n4 : [n4];
|
|
5676
5677
|
r4.forEach((e5) => {
|
|
5677
5678
|
s5.push(e5);
|
|
5678
5679
|
}), o3[t4] = s5, be2(e4, t4, r4);
|
|
5679
5680
|
}
|
|
5680
|
-
function
|
|
5681
|
+
function ve2(e4, t4, n4, o3, s5) {
|
|
5681
5682
|
if (!t4.on) return;
|
|
5682
5683
|
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
|
-
|
|
5684
|
+
Ze(t4.on, (t5) => he2(e4, "destination", t5, { destId: n4, type: o3 }))(o3, i2);
|
|
5684
5685
|
}
|
|
5685
5686
|
function be2(e4, t4, o3, s5) {
|
|
5686
5687
|
let r4;
|
|
@@ -5714,7 +5715,7 @@ function be2(e4, t4, o3, s5) {
|
|
|
5714
5715
|
const s6 = o4 || e5.consent, r5 = ye2(e5, n.Commands.Consent);
|
|
5715
5716
|
t5.forEach((t6) => {
|
|
5716
5717
|
Object.keys(s6).filter((e6) => e6 in t6).forEach((n4) => {
|
|
5717
|
-
|
|
5718
|
+
Ze(t6[n4], (t7) => he2(e5, "consent", t7, { key: n4 }))(s6, r5);
|
|
5718
5719
|
});
|
|
5719
5720
|
});
|
|
5720
5721
|
})(e4, o3, s5);
|
|
@@ -5724,7 +5725,7 @@ function be2(e4, t4, o3, s5) {
|
|
|
5724
5725
|
if (!e5.allowed) return;
|
|
5725
5726
|
const o4 = ye2(e5, n.Commands.Ready);
|
|
5726
5727
|
t5.forEach((t6) => {
|
|
5727
|
-
|
|
5728
|
+
Ze(t6, (t7) => he2(e5, "ready", t7))(void 0, o4);
|
|
5728
5729
|
});
|
|
5729
5730
|
})(e4, o3);
|
|
5730
5731
|
break;
|
|
@@ -5733,7 +5734,7 @@ function be2(e4, t4, o3, s5) {
|
|
|
5733
5734
|
if (!e5.allowed) return;
|
|
5734
5735
|
const o4 = ye2(e5, n.Commands.Run);
|
|
5735
5736
|
t5.forEach((t6) => {
|
|
5736
|
-
|
|
5737
|
+
Ze(t6, (t7) => he2(e5, "run", t7))(void 0, o4);
|
|
5737
5738
|
});
|
|
5738
5739
|
})(e4, o3);
|
|
5739
5740
|
break;
|
|
@@ -5742,20 +5743,20 @@ function be2(e4, t4, o3, s5) {
|
|
|
5742
5743
|
if (!e5.session) return;
|
|
5743
5744
|
const o4 = ye2(e5, n.Commands.Session);
|
|
5744
5745
|
t5.forEach((t6) => {
|
|
5745
|
-
|
|
5746
|
+
Ze(t6, (t7) => he2(e5, "session", t7))(e5.session, o4);
|
|
5746
5747
|
});
|
|
5747
5748
|
})(e4, o3);
|
|
5748
5749
|
break;
|
|
5749
5750
|
default: {
|
|
5750
5751
|
const n4 = ye2(e4, t4);
|
|
5751
5752
|
o3.forEach((o4) => {
|
|
5752
|
-
"function" == typeof o4 &&
|
|
5753
|
+
"function" == typeof o4 && Ze(o4, (n5) => he2(e4, "generic", n5, { type: t4 }))(r4, n4);
|
|
5753
5754
|
});
|
|
5754
5755
|
break;
|
|
5755
5756
|
}
|
|
5756
5757
|
}
|
|
5757
5758
|
}
|
|
5758
|
-
async function
|
|
5759
|
+
async function ke2(e4, t4, o3, s5) {
|
|
5759
5760
|
let r4, a4 = o3 || [];
|
|
5760
5761
|
switch (o3 || (a4 = e4.on[t4] || []), t4) {
|
|
5761
5762
|
case n.Commands.Consent:
|
|
@@ -5788,13 +5789,13 @@ async function ke(e4, t4, o3, s5) {
|
|
|
5788
5789
|
-1 !== e5 && o4.config.require.splice(e5, 1);
|
|
5789
5790
|
}
|
|
5790
5791
|
if (o4.on) if (pe2(o4)) {
|
|
5791
|
-
false === await
|
|
5792
|
+
false === await We(o4.on, (o5) => he2(e4, "source", o5, { sourceId: n4, type: t4 }))(t4, r4) && (i2 = true);
|
|
5792
5793
|
} else o4.queueOn = o4.queueOn || [], o4.queueOn.push({ type: t4, data: r4 });
|
|
5793
5794
|
}
|
|
5794
5795
|
Object.entries(e4.destinations).forEach(([n4, o4]) => {
|
|
5795
5796
|
if (o4.on) {
|
|
5796
5797
|
if (!o4.config.init) return o4.queueOn = o4.queueOn || [], void o4.queueOn.push({ type: t4, data: r4 });
|
|
5797
|
-
|
|
5798
|
+
ve2(e4, o4, n4, t4, r4);
|
|
5798
5799
|
}
|
|
5799
5800
|
});
|
|
5800
5801
|
for (const [t5, n4] of Object.entries(e4.sources)) pe2(n4) && n4.queueOn?.length && await fe2(e4, n4, t5);
|
|
@@ -5812,7 +5813,7 @@ async function ke(e4, t4, o3, s5) {
|
|
|
5812
5813
|
}
|
|
5813
5814
|
})(e4, t4), be2(e4, t4, a4, s5), !i2;
|
|
5814
5815
|
}
|
|
5815
|
-
function
|
|
5816
|
+
function Ce(e4, t4, n4, o3) {
|
|
5816
5817
|
if (!Number.isFinite(n4.max) || n4.max <= 0) throw new Error(`pushBounded: max must be > 0 (got ${n4.max})`);
|
|
5817
5818
|
if ("dropNewest" === (n4.onOverflow ?? "dropOldest")) return e4.length >= n4.max ? (o3 && o3([t4]), { appended: false, dropped: 1 }) : (e4.push(t4), { appended: true, dropped: 0 });
|
|
5818
5819
|
const s5 = [];
|
|
@@ -5820,17 +5821,17 @@ function Ce2(e4, t4, n4, o3) {
|
|
|
5820
5821
|
return e4.push(t4), s5.length > 0 && o3 && o3(s5), { appended: true, dropped: s5.length };
|
|
5821
5822
|
}
|
|
5822
5823
|
var Ie2 = /* @__PURE__ */ new WeakMap();
|
|
5823
|
-
function
|
|
5824
|
+
function qe2(e4, t4, n4, o3) {
|
|
5824
5825
|
Ie2.get(e4) || (Ie2.set(e4, true), t4.warn(n4, o3));
|
|
5825
5826
|
}
|
|
5826
5827
|
function xe2(e4) {
|
|
5827
5828
|
Ie2.delete(e4);
|
|
5828
5829
|
}
|
|
5829
|
-
var
|
|
5830
|
-
function
|
|
5831
|
-
return e4 ===
|
|
5830
|
+
var Oe2 = Object.freeze({ batched: true });
|
|
5831
|
+
function Se2(e4) {
|
|
5832
|
+
return e4 === Oe2;
|
|
5832
5833
|
}
|
|
5833
|
-
function
|
|
5834
|
+
function je(e4) {
|
|
5834
5835
|
return void 0 === e4 ? {} : "number" == typeof e4 ? { wait: e4 } : { wait: e4.wait, size: e4.size, age: e4.age };
|
|
5835
5836
|
}
|
|
5836
5837
|
function De2(e4, t4) {
|
|
@@ -5841,23 +5842,23 @@ function Ae2(e4, t4, n4, o3) {
|
|
|
5841
5842
|
const s5 = e4.dropped[t4];
|
|
5842
5843
|
return s5[n4] = (s5[n4] ?? 0) + o3, s5[n4];
|
|
5843
5844
|
}
|
|
5844
|
-
function $
|
|
5845
|
+
function $e(e4, t4, n4) {
|
|
5845
5846
|
if (!e4) return [];
|
|
5846
|
-
if (Array.isArray(e4) && e4.every((e5) => "string" == typeof e5)) return
|
|
5847
|
-
if ("string" == typeof e4) return
|
|
5848
|
-
const o3 =
|
|
5849
|
-
return 0 === o3.length ? [] : 1 === o3.length ?
|
|
5847
|
+
if (Array.isArray(e4) && e4.every((e5) => "string" == typeof e5)) return re(e4, t4);
|
|
5848
|
+
if ("string" == typeof e4) return re(e4, t4);
|
|
5849
|
+
const o3 = Mt(e4, Dt(n4));
|
|
5850
|
+
return 0 === o3.length ? [] : 1 === o3.length ? re(o3[0], t4) : re(o3, t4);
|
|
5850
5851
|
}
|
|
5851
|
-
async function
|
|
5852
|
+
async function Ee(e4, t4) {
|
|
5852
5853
|
const { code: n4, config: o3 = {}, env: s5 = {}, before: r4, next: a4, cache: i2 } = t4;
|
|
5853
|
-
if (!
|
|
5854
|
+
if (!le(n4.push)) return Pe2({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
|
|
5854
5855
|
const c2 = o3 || { init: false };
|
|
5855
5856
|
let u4 = r4 ? { ...c2, before: r4 } : { ...c2 };
|
|
5856
5857
|
a4 && (u4 = { ...u4, next: a4 }), i2 && (u4 = { ...u4, cache: i2 });
|
|
5857
5858
|
const d2 = { ...n4, config: u4, env: Be(n4.env, s5) };
|
|
5858
5859
|
let l2 = d2.config.id;
|
|
5859
5860
|
if (!l2) do {
|
|
5860
|
-
l2 =
|
|
5861
|
+
l2 = Se(5, "abcdefghijklmnopqrstuvwxyz");
|
|
5861
5862
|
} while (e4.destinations[l2]);
|
|
5862
5863
|
return e4.destinations[l2] = d2, false !== d2.config.queue && (d2.queuePush = [...e4.queue]), Me2(e4, void 0, {}, { [l2]: d2 });
|
|
5863
5864
|
}
|
|
@@ -5867,18 +5868,18 @@ async function Me2(e4, t4, n4 = {}, o3) {
|
|
|
5867
5868
|
if (t4) {
|
|
5868
5869
|
const n5 = e4.config.queueMax;
|
|
5869
5870
|
if (void 0 === n5) throw new Error("Collector.Config.queueMax is undefined; defaults must be seeded by collector()");
|
|
5870
|
-
const o4 =
|
|
5871
|
+
const o4 = Ce(e4.queue, t4, { max: n5 });
|
|
5871
5872
|
if (o4.dropped > 0) {
|
|
5872
5873
|
const t5 = Ae2(e4.status, o("collector"), "queue", o4.dropped);
|
|
5873
|
-
|
|
5874
|
+
qe2(e4.queue, e4.logger, "collector.queue overflow; oldest events dropped", { buffer: "queue", cap: n5, droppedCount: t5 });
|
|
5874
5875
|
} else e4.queue.length < n5 && xe2(e4.queue);
|
|
5875
5876
|
e4.status.in++;
|
|
5876
5877
|
}
|
|
5877
5878
|
o3 || (o3 = e4.destinations);
|
|
5878
|
-
const h3 = e4.transformers ?
|
|
5879
|
+
const h3 = e4.transformers ? oe2(e4.transformers) : {}, w3 = await Promise.all(Object.entries(o3 || {}).map(async ([o4, s6]) => {
|
|
5879
5880
|
if (s6.config.disabled) return { id: o4, destination: s6, skipped: true };
|
|
5880
5881
|
let w4 = (s6.queuePush || []).map((e5) => ({ ...e5, consent: r4 }));
|
|
5881
|
-
s6.queuePush = [], t4 && w4.push(
|
|
5882
|
+
s6.queuePush = [], t4 && w4.push(me(t4));
|
|
5882
5883
|
const v4 = n4.ingest ? { ...n4.ingest, _meta: { ...n4.ingest._meta, path: [...n4.ingest._meta.path] } } : E("unknown");
|
|
5883
5884
|
if (!w4.length && !s6.queueOn?.length) return { id: o4, destination: s6, skipped: true };
|
|
5884
5885
|
if (!w4.length && s6.queueOn?.length) {
|
|
@@ -5893,21 +5894,21 @@ async function Me2(e4, t4, n4 = {}, o3) {
|
|
|
5893
5894
|
return { id: o4, destination: s6, skipped: !t5 };
|
|
5894
5895
|
}
|
|
5895
5896
|
const b4 = [], k3 = w4.filter((t5) => {
|
|
5896
|
-
const n5 =
|
|
5897
|
+
const n5 = ke(s6.config.consent, r4, t5.consent);
|
|
5897
5898
|
if (n5) return t5.consent = n5, b4.push(t5), false;
|
|
5898
5899
|
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 } }),
|
|
5900
|
+
return a5.skipReason = "consent", r4 && (a5.consent = { ...r4 }), s6.config.consent && (a5.meta = { required: { ...s6.config.consent } }), ft(e4, a5), true;
|
|
5900
5901
|
});
|
|
5901
5902
|
if (k3.length > 0) {
|
|
5902
5903
|
const t5 = s6.queuePush, n5 = s6.config.id || o4, r5 = { max: s6.config.queueMax ?? 1e3 };
|
|
5903
5904
|
let a5 = 0;
|
|
5904
5905
|
for (const e5 of k3) {
|
|
5905
|
-
a5 +=
|
|
5906
|
+
a5 += Ce(t5, e5, r5).dropped;
|
|
5906
5907
|
}
|
|
5907
5908
|
if (a5 > 0) {
|
|
5908
5909
|
De2(e4, n5);
|
|
5909
5910
|
const o5 = Ae2(e4.status, o("destination", n5), "queue", a5);
|
|
5910
|
-
|
|
5911
|
+
qe2(t5, e4.logger.scope(s6.type || "unknown"), "destination.queuePush overflow; oldest events dropped", { buffer: "queuePush", destination: n5, cap: r5.max, droppedCount: o5 });
|
|
5911
5912
|
} else t5.length < r5.max && xe2(t5);
|
|
5912
5913
|
}
|
|
5913
5914
|
if (!b4.length) return { id: o4, destination: s6, queue: w4 };
|
|
@@ -5921,12 +5922,12 @@ async function Me2(e4, t4, n4 = {}, o3) {
|
|
|
5921
5922
|
}
|
|
5922
5923
|
if (!O2) return { id: o4, destination: s6, queue: w4 };
|
|
5923
5924
|
s6.dlq || (s6.dlq = []);
|
|
5924
|
-
const j2 = $
|
|
5925
|
+
const j2 = $e(s6.config.before, h3, v4), D3 = s6.config.next, A2 = s6.config?.cache, $2 = A2 ? Ft(A2) : void 0, E3 = $2 ? ne2($2, e4) : void 0;
|
|
5925
5926
|
let M3 = 0, T3 = 0;
|
|
5926
5927
|
return await Promise.all(b4.map(async (t5) => {
|
|
5927
5928
|
let r5;
|
|
5928
|
-
if (t5.globals =
|
|
5929
|
-
const e5 =
|
|
5929
|
+
if (t5.globals = ne(a4, t5.globals), t5.user = ne(g3, t5.user), $2?.stop && E3) {
|
|
5930
|
+
const e5 = Dt(v4, t5), n5 = await Ut($2, E3, e5);
|
|
5930
5931
|
if ("HIT" === n5?.status) return t5;
|
|
5931
5932
|
"MISS" === n5?.status && (r5 = { key: n5.key, ttl: n5.rule.ttl });
|
|
5932
5933
|
}
|
|
@@ -5937,25 +5938,25 @@ async function Me2(e4, t4, n4 = {}, o3) {
|
|
|
5937
5938
|
s7.respond && (d2 = s7.respond), u4 = Array.isArray(s7.event) ? s7.event[0] : s7.event;
|
|
5938
5939
|
}
|
|
5939
5940
|
if ($2 && !$2.stop && E3) {
|
|
5940
|
-
const e5 =
|
|
5941
|
+
const e5 = Dt(v4, u4), n5 = await Ut($2, E3, e5);
|
|
5941
5942
|
if ("HIT" === n5?.status) return t5;
|
|
5942
5943
|
"MISS" === n5?.status && (r5 = { key: n5.key, ttl: n5.rule.ttl });
|
|
5943
5944
|
}
|
|
5944
5945
|
const p2 = Date.now();
|
|
5945
5946
|
let m3 = false;
|
|
5946
|
-
const y2 = await
|
|
5947
|
+
const y2 = await We(_e, (t6) => {
|
|
5947
5948
|
const n5 = s6.type || "unknown";
|
|
5948
5949
|
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 =
|
|
5950
|
+
const r6 = s6.dlq, a5 = s6.config.id || o4, i2 = { max: s6.config.dlqMax ?? 100 }, c2 = Ce(r6, [u4, t6], i2);
|
|
5950
5951
|
if (c2.dropped > 0) {
|
|
5951
5952
|
De2(e4, a5);
|
|
5952
5953
|
const t7 = Ae2(e4.status, o("destination", a5), "dlq", c2.dropped);
|
|
5953
|
-
|
|
5954
|
+
qe2(r6, e4.logger.scope(s6.type || "unknown"), "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: a5, cap: i2.max, droppedCount: t7 });
|
|
5954
5955
|
} else r6.length < i2.max && xe2(r6);
|
|
5955
5956
|
})(e4, s6, o4, u4, v4, d2);
|
|
5956
|
-
if (M3 += Date.now() - p2, r5 && E3 && void 0 === s6.config.mock &&
|
|
5957
|
+
if (M3 += Date.now() - p2, r5 && E3 && void 0 === s6.config.mock && Zt(E3, r5.key, y2 ?? true, r5.ttl), void 0 === y2 || Se2(y2) || (x2 = y2), Se2(y2) && T3++, !m3 && D3) {
|
|
5957
5958
|
void 0 !== y2 && (v4._response = y2);
|
|
5958
|
-
const t6 = $
|
|
5959
|
+
const t6 = $e(D3, h3, v4);
|
|
5959
5960
|
if (t6.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
5960
5961
|
const n5 = await ue2(e4, e4.transformers, t6, u4, v4, d2, `destination.${o4}.next`);
|
|
5961
5962
|
n5.respond && (d2 = n5.respond);
|
|
@@ -5984,32 +5985,32 @@ async function Te2(e4, t4, n4) {
|
|
|
5984
5985
|
s5.debug("init");
|
|
5985
5986
|
const a4 = Date.now();
|
|
5986
5987
|
let i2;
|
|
5987
|
-
|
|
5988
|
+
ft(e4, S(e4, { stepId: o("destination", n4), stepType: "destination", phase: "init", eventId: "", now: a4 }));
|
|
5988
5989
|
try {
|
|
5989
|
-
i2 = await
|
|
5990
|
+
i2 = await at(t4.init, "DestinationInit", e4.hooks, e4.logger)(r4);
|
|
5990
5991
|
} catch (t5) {
|
|
5991
5992
|
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) },
|
|
5993
|
+
throw s6.durationMs = o4 - a4, s6.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, ft(e4, s6), t5;
|
|
5993
5994
|
}
|
|
5994
5995
|
if (false === i2) return i2;
|
|
5995
5996
|
if (t4.config = { ...i2 || t4.config, init: true }, t4.queueOn?.length) {
|
|
5996
5997
|
const o4 = t4.queueOn;
|
|
5997
5998
|
t4.queueOn = [];
|
|
5998
|
-
for (const { type: s6, data: r5 } of o4)
|
|
5999
|
+
for (const { type: s6, data: r5 } of o4) ve2(e4, t4, n4, s6, r5);
|
|
5999
6000
|
}
|
|
6000
6001
|
s5.debug("init done");
|
|
6001
6002
|
}
|
|
6002
6003
|
return true;
|
|
6003
6004
|
}
|
|
6004
|
-
async function
|
|
6005
|
-
const { config: a4 } = t4, i2 = await
|
|
6005
|
+
async function _e(e4, t4, n4, o3, s5, r4) {
|
|
6006
|
+
const { config: a4 } = t4, i2 = await qe(o3, a4, e4);
|
|
6006
6007
|
if (i2.ignore) return false;
|
|
6007
6008
|
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
6009
|
if (void 0 !== a4.mock) return u4.debug("mock", { event: i2.event.name }), a4.mock;
|
|
6009
6010
|
const l2 = i2.mapping, f3 = i2.mappingKey || "* *";
|
|
6010
6011
|
if (l2?.batch && t4.pushBatch && void 0 === a4.mock) {
|
|
6011
6012
|
if (t4.batches = t4.batches || {}, !t4.batches[f3]) {
|
|
6012
|
-
const o5 = { key: f3, entries: [], events: [], data: [] }, s6 =
|
|
6013
|
+
const o5 = { key: f3, entries: [], events: [], data: [] }, s6 = je(l2.batch), r5 = je(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 = Te(async () => {
|
|
6013
6014
|
const o6 = t4.batches[f3].batched;
|
|
6014
6015
|
if (0 === o6.entries.length) return;
|
|
6015
6016
|
const s7 = { key: o6.key, entries: o6.entries, events: o6.events, data: o6.data };
|
|
@@ -6017,20 +6018,20 @@ async function _e2(e4, t4, n4, o3, s5, r4) {
|
|
|
6017
6018
|
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 } : {} } };
|
|
6018
6019
|
u4.debug("push batch", { events: s7.entries.length });
|
|
6019
6020
|
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 },
|
|
6021
|
+
g3.batch = { size: s7.entries.length, index: 0 }, ft(e4, g3);
|
|
6021
6022
|
let h4 = true;
|
|
6022
|
-
await
|
|
6023
|
+
await We(at(t4.pushBatch, "DestinationPushBatch", e4.hooks, e4.logger), (o7) => {
|
|
6023
6024
|
h4 = false;
|
|
6024
6025
|
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 },
|
|
6026
|
+
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 }, ft(e4, a5);
|
|
6026
6027
|
const i5 = t4.dlq = t4.dlq || [], f4 = { max: t4.config.dlqMax ?? 100 };
|
|
6027
6028
|
let p3 = 0;
|
|
6028
6029
|
for (const e5 of s7.entries) {
|
|
6029
|
-
p3 +=
|
|
6030
|
+
p3 += Ce(i5, [e5.event, o7], f4).dropped;
|
|
6030
6031
|
}
|
|
6031
6032
|
if (p3 > 0) {
|
|
6032
6033
|
const t5 = Ae2(e4.status, o("destination", c5), "dlq", p3);
|
|
6033
|
-
|
|
6034
|
+
qe2(i5, u4, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: c5, cap: f4.max, droppedCount: t5 });
|
|
6034
6035
|
} else i5.length < f4.max && xe2(i5);
|
|
6035
6036
|
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
6037
|
})(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);
|
|
@@ -6042,20 +6043,20 @@ async function _e2(e4, t4, n4, o3, s5, r4) {
|
|
|
6042
6043
|
} };
|
|
6043
6044
|
}
|
|
6044
6045
|
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),
|
|
6046
|
+
o4.batched.entries.push({ event: i2.event, ingest: s5, respond: r4, rule: l2, data: i2.data }), o4.batched.events.push(i2.event), se(i2.data) && o4.batched.data.push(i2.data);
|
|
6046
6047
|
const c3 = t4.config.id || n4, d3 = De2(e4, c3);
|
|
6047
|
-
return d3.inFlightBatch = (d3.inFlightBatch ?? 0) + 1, o4.batchFn(),
|
|
6048
|
+
return d3.inFlightBatch = (d3.inFlightBatch ?? 0) + 1, o4.batchFn(), Oe2;
|
|
6048
6049
|
}
|
|
6049
6050
|
{
|
|
6050
6051
|
u4.debug("push", { event: i2.event.name });
|
|
6051
6052
|
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 }),
|
|
6053
|
+
i2.mappingKey && (r5.mappingKey = i2.mappingKey), i2.event.consent && (r5.consent = { ...i2.event.consent }), ft(e4, r5);
|
|
6053
6054
|
try {
|
|
6054
|
-
const r6 = await
|
|
6055
|
-
return c3.durationMs = a5 - s6, c3.outEvent = r6, i2.mappingKey && (c3.mappingKey = i2.mappingKey),
|
|
6055
|
+
const r6 = await at(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 });
|
|
6056
|
+
return c3.durationMs = a5 - s6, c3.outEvent = r6, i2.mappingKey && (c3.mappingKey = i2.mappingKey), ft(e4, c3), u4.debug("push done"), r6;
|
|
6056
6057
|
} catch (t5) {
|
|
6057
6058
|
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),
|
|
6059
|
+
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), ft(e4, a5), t5;
|
|
6059
6060
|
}
|
|
6060
6061
|
}
|
|
6061
6062
|
}
|
|
@@ -6068,15 +6069,15 @@ function ze2(e4) {
|
|
|
6068
6069
|
const c2 = Be(t4.env, o3);
|
|
6069
6070
|
return { ...t4, config: i2, env: c2 };
|
|
6070
6071
|
}
|
|
6071
|
-
async function
|
|
6072
|
+
async function Re2(e4, t4 = {}) {
|
|
6072
6073
|
const n4 = {};
|
|
6073
6074
|
for (const [o3, s5] of Object.entries(t4)) s5.config?.require?.length ? e4.pending.destinations[o3] = s5 : n4[o3] = ze2(s5);
|
|
6074
6075
|
return n4;
|
|
6075
6076
|
}
|
|
6076
6077
|
function Be(e4, t4) {
|
|
6077
|
-
return e4 || t4 ? t4 ? e4 &&
|
|
6078
|
+
return e4 || t4 ? t4 ? e4 && fe(e4) && fe(t4) ? { ...e4, ...t4 } : t4 : e4 : {};
|
|
6078
6079
|
}
|
|
6079
|
-
async function
|
|
6080
|
+
async function Ne2(e4, t4, n4) {
|
|
6080
6081
|
const o3 = Object.entries(e4).map(async ([e5, o4]) => {
|
|
6081
6082
|
const s5 = o4.destroy;
|
|
6082
6083
|
if (!s5) return;
|
|
@@ -6093,31 +6094,31 @@ async function Ue2(e4, t4, o3) {
|
|
|
6093
6094
|
let r4, a4, i2 = false;
|
|
6094
6095
|
switch (t4) {
|
|
6095
6096
|
case n.Commands.Config:
|
|
6096
|
-
|
|
6097
|
+
fe(o3) && (ne(e4.config, o3, { shallow: false }), a4 = o3, i2 = true);
|
|
6097
6098
|
break;
|
|
6098
6099
|
case n.Commands.Consent:
|
|
6099
|
-
if (
|
|
6100
|
+
if (fe(o3)) {
|
|
6100
6101
|
const { update: t5 } = s2(e4, o3);
|
|
6101
6102
|
a4 = t5, i2 = true;
|
|
6102
6103
|
}
|
|
6103
6104
|
break;
|
|
6104
6105
|
case n.Commands.Custom:
|
|
6105
|
-
|
|
6106
|
+
fe(o3) && (e4.custom = ne(e4.custom, o3), a4 = o3, i2 = true);
|
|
6106
6107
|
break;
|
|
6107
6108
|
case n.Commands.Destination:
|
|
6108
|
-
|
|
6109
|
+
fe(o3) && "code" in o3 && fe(o3.code) && (r4 = await Ee(e4, o3));
|
|
6109
6110
|
break;
|
|
6110
6111
|
case n.Commands.Globals:
|
|
6111
|
-
|
|
6112
|
+
fe(o3) && (e4.globals = ne(e4.globals, o3), a4 = o3, i2 = true);
|
|
6112
6113
|
break;
|
|
6113
6114
|
case n.Commands.Hook:
|
|
6114
|
-
if (
|
|
6115
|
+
if (fe(o3) && de(o3.name) && le(o3.fn)) {
|
|
6115
6116
|
const { name: t5, fn: n4 } = o3;
|
|
6116
6117
|
e4.hooks[t5] = n4, a4 = o3, i2 = true;
|
|
6117
6118
|
}
|
|
6118
6119
|
break;
|
|
6119
6120
|
case n.Commands.On:
|
|
6120
|
-
if (
|
|
6121
|
+
if (fe(o3) && de(o3.type)) {
|
|
6121
6122
|
const { type: t5, rules: n4 } = o3;
|
|
6122
6123
|
await we(e4, t5, n4);
|
|
6123
6124
|
}
|
|
@@ -6126,7 +6127,7 @@ async function Ue2(e4, t4, o3) {
|
|
|
6126
6127
|
i2 = true;
|
|
6127
6128
|
break;
|
|
6128
6129
|
case n.Commands.Run:
|
|
6129
|
-
r4 = await
|
|
6130
|
+
r4 = await Ve2(e4, o3), i2 = true;
|
|
6130
6131
|
break;
|
|
6131
6132
|
case n.Commands.Session:
|
|
6132
6133
|
i2 = true;
|
|
@@ -6134,29 +6135,29 @@ async function Ue2(e4, t4, o3) {
|
|
|
6134
6135
|
case n.Commands.Shutdown:
|
|
6135
6136
|
await (async function(e5) {
|
|
6136
6137
|
const t5 = e5.logger;
|
|
6137
|
-
await
|
|
6138
|
+
await Ne2(e5.sources, "source", t5), await Ne2(e5.destinations, "destination", t5), await Ne2(e5.transformers, "transformer", t5), await Ne2(e5.stores, "store", t5);
|
|
6138
6139
|
})(e4);
|
|
6139
6140
|
break;
|
|
6140
6141
|
case n.Commands.User:
|
|
6141
|
-
|
|
6142
|
+
fe(o3) && (ne(e4.user, o3, { shallow: false }), a4 = o3, i2 = true);
|
|
6142
6143
|
}
|
|
6143
|
-
return i2 && (await
|
|
6144
|
+
return i2 && (await ke2(e4, t4, void 0, a4), r4 = await Me2(e4)), r4 || Pe2({ ok: true });
|
|
6144
6145
|
}
|
|
6145
6146
|
function Le2(e4, t4) {
|
|
6146
6147
|
if (!t4.name) throw new Error("Event name is required");
|
|
6147
6148
|
const [n4, o3] = t4.name.split(" ");
|
|
6148
6149
|
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 =
|
|
6150
|
+
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 = xe(), trigger: g3 = "", entity: m3 = n4, action: h3 = o3, timing: y2 = 0, source: w3 = { type: "collector", schema: "4" } } = t4;
|
|
6150
6151
|
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 };
|
|
6151
6152
|
}
|
|
6152
|
-
async function
|
|
6153
|
-
e4.allowed = true, e4.timing = Date.now(), t4 && (t4.consent && (e4.consent =
|
|
6153
|
+
async function Ve2(e4, t4) {
|
|
6154
|
+
e4.allowed = true, e4.timing = Date.now(), t4 && (t4.consent && (e4.consent = ne(e4.consent, t4.consent)), t4.user && (e4.user = ne(e4.user, t4.user)), t4.globals && (e4.globals = ne(e4.config.globalsStatic || {}, t4.globals)), t4.custom && (e4.custom = ne(e4.custom, t4.custom))), Object.values(e4.destinations).forEach((e5) => {
|
|
6154
6155
|
e5.queuePush = [];
|
|
6155
6156
|
}), e4.queue = [], e4.round++;
|
|
6156
6157
|
return await Me2(e4);
|
|
6157
6158
|
}
|
|
6158
|
-
function
|
|
6159
|
-
const n4 =
|
|
6159
|
+
function nt2(e4, t4) {
|
|
6160
|
+
const n4 = at(async (n5, o3 = {}) => await We(async () => {
|
|
6160
6161
|
const s5 = Date.now(), { id: r4, ingest: a4, respond: i2, mapping: c2, preChain: u4, include: d2, exclude: l2 } = o3;
|
|
6161
6162
|
let f3 = i2, p2 = n5;
|
|
6162
6163
|
const g3 = d2 || l2 ? (function(e5, t5, n6) {
|
|
@@ -6164,10 +6165,10 @@ function nt(e4, t4) {
|
|
|
6164
6165
|
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
6166
|
})(e4.destinations, d2, l2) : void 0, m3 = a4 ?? E(r4 || "unknown");
|
|
6166
6167
|
if (c2) {
|
|
6167
|
-
const t5 = await
|
|
6168
|
+
const t5 = await qe(p2, c2, e4);
|
|
6168
6169
|
if (t5.ignore) return Pe2({ ok: true });
|
|
6169
6170
|
if (c2.consent) {
|
|
6170
|
-
if (!
|
|
6171
|
+
if (!ke(c2.consent, e4.consent, t5.event.consent)) return Pe2({ ok: true });
|
|
6171
6172
|
}
|
|
6172
6173
|
p2 = t5.event;
|
|
6173
6174
|
}
|
|
@@ -6197,18 +6198,18 @@ function nt(e4, t4) {
|
|
|
6197
6198
|
}
|
|
6198
6199
|
return w3;
|
|
6199
6200
|
}, (t5) => {
|
|
6200
|
-
if (t5 instanceof
|
|
6201
|
+
if (t5 instanceof He) throw t5;
|
|
6201
6202
|
return e4.status.failed++, e4.logger.error("push failed", { event: n5, ingest: o3.ingest, error: t5 }), Pe2({ ok: false });
|
|
6202
6203
|
})(), "Push", e4.hooks, e4.logger);
|
|
6203
6204
|
return async (t5, o3) => {
|
|
6204
6205
|
const s5 = "string" == typeof t5.id ? t5.id : "", r4 = Date.now();
|
|
6205
|
-
|
|
6206
|
+
ft(e4, S(e4, { stepId: "collector.push", stepType: "collector", phase: "in", eventId: s5, now: r4 }));
|
|
6206
6207
|
try {
|
|
6207
6208
|
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,
|
|
6209
|
+
return c2.durationMs = i2 - r4, c2.outEvent = a4, ft(e4, c2), a4;
|
|
6209
6210
|
} catch (t6) {
|
|
6210
6211
|
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) },
|
|
6212
|
+
throw o4.durationMs = n5 - r4, o4.error = t6 instanceof Error ? { name: t6.name, message: t6.message } : { message: String(t6) }, ft(e4, o4), t6;
|
|
6212
6213
|
}
|
|
6213
6214
|
};
|
|
6214
6215
|
}
|
|
@@ -6245,12 +6246,12 @@ function ct2(e4 = {}) {
|
|
|
6245
6246
|
void 0 !== i2 && (clearInterval(i2), i2 = void 0), r4.clear();
|
|
6246
6247
|
} };
|
|
6247
6248
|
}
|
|
6248
|
-
function
|
|
6249
|
+
function lt(e4, t4) {
|
|
6249
6250
|
const { cacheConfig: n4, cacheStore: o3, namespace: s5, logger: r4, storeId: a4, collector: i2 } = t4, c2 = (e5, t5) => {
|
|
6250
6251
|
if (!i2) return;
|
|
6251
6252
|
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 },
|
|
6253
|
-
}, u4 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, inflight_dedups: 0 }, d2 = n4.rules.map((e5) => ({ match: e5.match ?
|
|
6253
|
+
n5.meta = { op: "cache", cached: "hit" === t5, status: t5, key: e5 }, ft(i2, n5);
|
|
6254
|
+
}, u4 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, inflight_dedups: 0 }, d2 = n4.rules.map((e5) => ({ match: e5.match ? Nt(e5.match) : () => true, ttl: e5.ttl })), l2 = (e5) => `${s5}:${e5}`;
|
|
6254
6255
|
function f3(e5, t5) {
|
|
6255
6256
|
const n5 = void 0 === t5 ? { key: e5 } : { key: e5, value: t5 };
|
|
6256
6257
|
return d2.find((e6) => e6.match(n5));
|
|
@@ -6301,43 +6302,43 @@ function lt2(e4, t4) {
|
|
|
6301
6302
|
r4 ? r4.warn(o4, { error: n5 }) : console.warn(o4, n5);
|
|
6302
6303
|
}
|
|
6303
6304
|
}
|
|
6304
|
-
function
|
|
6305
|
-
const o3 = `store.${n4}`, s5 =
|
|
6305
|
+
function ft2(e4, t4, n4) {
|
|
6306
|
+
const o3 = `store.${n4}`, s5 = at(t4.get, "StoreGet", e4.hooks, e4.logger), r4 = at(t4.set, "StoreSet", e4.hooks, e4.logger), a4 = at(t4.delete, "StoreDelete", e4.hooks, e4.logger);
|
|
6306
6307
|
t4.get = async (t5) => {
|
|
6307
6308
|
const n5 = Date.now(), r5 = S(e4, { stepId: o3, stepType: "store", phase: "in", eventId: "", now: n5 });
|
|
6308
|
-
r5.meta = { op: "get", key: t5 },
|
|
6309
|
+
r5.meta = { op: "get", key: t5 }, ft(e4, r5);
|
|
6309
6310
|
try {
|
|
6310
6311
|
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 },
|
|
6312
|
+
return i2.durationMs = a5 - n5, i2.meta = { op: "get", key: t5 }, ft(e4, i2), r6;
|
|
6312
6313
|
} catch (s6) {
|
|
6313
6314
|
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) },
|
|
6315
|
+
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) }, ft(e4, a5), s6;
|
|
6315
6316
|
}
|
|
6316
6317
|
}, t4.set = async (t5, n5, s6) => {
|
|
6317
6318
|
const a5 = Date.now(), i2 = S(e4, { stepId: o3, stepType: "store", phase: "in", eventId: "", now: a5 });
|
|
6318
|
-
i2.meta = { op: "set", key: t5 },
|
|
6319
|
+
i2.meta = { op: "set", key: t5 }, ft(e4, i2);
|
|
6319
6320
|
try {
|
|
6320
6321
|
await r4(t5, n5, s6);
|
|
6321
6322
|
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 },
|
|
6323
|
+
c2.durationMs = i3 - a5, c2.meta = { op: "set", key: t5 }, ft(e4, c2);
|
|
6323
6324
|
} catch (n6) {
|
|
6324
6325
|
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) },
|
|
6326
|
+
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) }, ft(e4, r5), n6;
|
|
6326
6327
|
}
|
|
6327
6328
|
}, t4.delete = async (t5) => {
|
|
6328
6329
|
const n5 = Date.now(), s6 = S(e4, { stepId: o3, stepType: "store", phase: "in", eventId: "", now: n5 });
|
|
6329
|
-
s6.meta = { op: "delete", key: t5 },
|
|
6330
|
+
s6.meta = { op: "delete", key: t5 }, ft(e4, s6);
|
|
6330
6331
|
try {
|
|
6331
6332
|
await a4(t5);
|
|
6332
6333
|
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 },
|
|
6334
|
+
r5.durationMs = s7 - n5, r5.meta = { op: "delete", key: t5 }, ft(e4, r5);
|
|
6334
6335
|
} catch (s7) {
|
|
6335
6336
|
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) },
|
|
6337
|
+
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) }, ft(e4, a5), s7;
|
|
6337
6338
|
}
|
|
6338
6339
|
};
|
|
6339
6340
|
}
|
|
6340
|
-
async function
|
|
6341
|
+
async function pt2(e4, t4 = {}) {
|
|
6341
6342
|
const n4 = {};
|
|
6342
6343
|
for (const [o4, s6] of Object.entries(t4)) {
|
|
6343
6344
|
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);
|
|
@@ -6371,21 +6372,21 @@ async function pt(e4, t4 = {}) {
|
|
|
6371
6372
|
let r4, a4;
|
|
6372
6373
|
void 0 !== s6.store ? (r4 = n4[s6.store], a4 = s6.store) : (n4.__cache || (n4.__cache = ct2()), r4 = n4.__cache, a4 = "__cache");
|
|
6373
6374
|
const i2 = s6.namespace ?? t5;
|
|
6374
|
-
e4.logger.scope("store-cache").scope(t5).info(`store "${t5}" caches with namespace "${i2}:" via ${a4}`), n4[t5] =
|
|
6375
|
+
e4.logger.scope("store-cache").scope(t5).info(`store "${t5}" caches with namespace "${i2}:" via ${a4}`), n4[t5] = lt(n4[t5], { storeId: t5, cacheConfig: s6, cacheStore: r4, namespace: i2, logger: e4.logger.scope("store-cache").scope(t5), collector: e4 });
|
|
6375
6376
|
}
|
|
6376
|
-
for (const [t5, o4] of Object.entries(n4)) "__cache" !== t5 &&
|
|
6377
|
+
for (const [t5, o4] of Object.entries(n4)) "__cache" !== t5 && ft2(e4, o4, t5);
|
|
6377
6378
|
return n4;
|
|
6378
6379
|
}
|
|
6379
6380
|
async function gt(e4) {
|
|
6380
|
-
const t4 =
|
|
6381
|
-
i2.push =
|
|
6382
|
-
return
|
|
6383
|
-
if (t6 instanceof
|
|
6381
|
+
const t4 = ne({ globalsStatic: {}, sessionStatic: {}, run: true, queueMax: 1e3 }, e4, { merge: false, extend: false }), n4 = { level: e4.logger?.level, handler: e4.logger?.handler }, o3 = Me(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 };
|
|
6382
|
+
i2.push = nt2(i2, (e5) => ({ timing: Math.round((Date.now() - i2.timing) / 10) / 100, source: { type: "collector", schema: "4", version: "4.1.3-next-1779963694449" }, ...e5 })), i2.command = (function(e5, t5) {
|
|
6383
|
+
return at(async (n5, o4, s6) => await We(async () => await t5(e5, n5, o4, s6), (t6) => {
|
|
6384
|
+
if (t6 instanceof He) throw t6;
|
|
6384
6385
|
return e5.status.failed++, e5.logger.error("command failed", { command: n5, data: o4, error: t6 }), Pe2({ ok: false });
|
|
6385
6386
|
})(), "Command", e5.hooks, e5.logger);
|
|
6386
6387
|
})(i2, Ue2);
|
|
6387
6388
|
const c2 = e4.stores || {};
|
|
6388
|
-
return i2.stores = await
|
|
6389
|
+
return i2.stores = await pt2(i2, c2), (function(e5, t5, n5) {
|
|
6389
6390
|
const o4 = /* @__PURE__ */ new Map();
|
|
6390
6391
|
for (const [n6, s7] of Object.entries(e5)) t5[n6] && o4.set(s7, t5[n6]);
|
|
6391
6392
|
if (0 !== o4.size) {
|
|
@@ -6399,10 +6400,10 @@ async function gt(e4) {
|
|
|
6399
6400
|
}
|
|
6400
6401
|
}
|
|
6401
6402
|
}
|
|
6402
|
-
})(c2, i2.stores, e4), i2.stores.__cache || (i2.stores.__cache = ct2()), i2.destinations = await
|
|
6403
|
+
})(c2, i2.stores, e4), i2.stores.__cache || (i2.stores.__cache = ct2()), i2.destinations = await Re2(i2, e4.destinations || {}), i2.transformers = await (async function(e5, t5 = {}) {
|
|
6403
6404
|
const n5 = {};
|
|
6404
6405
|
for (const [o4, s6] of Object.entries(t5)) {
|
|
6405
|
-
const { code: t6, env: r4 = {} } = s6, a4 =
|
|
6406
|
+
const { code: t6, env: r4 = {} } = s6, a4 = qt(s6, "Transformer");
|
|
6406
6407
|
if (!a4.ok) {
|
|
6407
6408
|
e5.logger.warn(`Transformer ${o4} invalid (${a4.code}): ${a4.reason}. Skipping.`);
|
|
6408
6409
|
continue;
|
|
@@ -6419,7 +6420,7 @@ async function gt(e4) {
|
|
|
6419
6420
|
}
|
|
6420
6421
|
}
|
|
6421
6422
|
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
|
|
6423
|
+
const o5 = await qe(n7, t7, e6.collector);
|
|
6423
6424
|
return !o5.ignore && { event: o5.event };
|
|
6424
6425
|
} };
|
|
6425
6426
|
}
|
|
@@ -6494,13 +6495,13 @@ var simulation = ["sendServer"];
|
|
|
6494
6495
|
var step_exports = {};
|
|
6495
6496
|
__export2(step_exports, { customHeaders: () => customHeaders, customTransform: () => customTransform, fullEvent: () => fullEvent });
|
|
6496
6497
|
var URL2 = "https://api.example.com/events";
|
|
6497
|
-
var fullEvent = { title: "Forward event data", description: "A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.", in:
|
|
6498
|
-
var customHeaders = { title: "Custom headers", description: "A form submission is sent to the API with custom request headers such as an API key for authentication.", in:
|
|
6499
|
-
var customTransform = { title: "Custom payload", description: "An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.", in:
|
|
6498
|
+
var fullEvent = { title: "Forward event data", description: "A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.", in: Oe("page view", { timestamp: 1700000800, data: { title: "Docs", url: "https://example.com/docs" }, source: { type: "express", platform: "server" } }), mapping: { data: "data" }, out: [["sendServer", URL2, JSON.stringify({ title: "Docs", url: "https://example.com/docs" }), { headers: void 0, method: void 0, timeout: void 0 }]] };
|
|
6499
|
+
var customHeaders = { title: "Custom headers", description: "A form submission is sent to the API with custom request headers such as an API key for authentication.", in: Oe("form submit", { timestamp: 1700000801, data: { type: "contact", email: "user@example.com" }, source: { type: "express", platform: "server" } }), mapping: { data: "data" }, out: [["sendServer", URL2, JSON.stringify({ type: "contact", email: "user@example.com" }), { headers: { "X-API-Key": "YOUR_API_KEY" }, method: void 0, timeout: void 0 }]] };
|
|
6500
|
+
var customTransform = { title: "Custom payload", description: "An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.", in: Oe("order complete", { timestamp: 1700000802, data: { id: "ORD-500", total: 199.99, currency: "USD" }, user: { id: "buyer-42" }, source: { type: "express", platform: "server" } }), mapping: { data: { map: { order_id: "data.id", amount: "data.total", currency: "data.currency", customer_id: "user.id", event_type: "name" } } }, out: [["sendServer", URL2, JSON.stringify({ order_id: "ORD-500", amount: 199.99, currency: "USD", customer_id: "buyer-42", event_type: "order complete" }), { headers: void 0, method: void 0, timeout: void 0 }]] };
|
|
6500
6501
|
var destinationAPI = { type: "api", config: {}, env: { sendServer: a2 }, async push(event, { config, rule, data, env, logger }) {
|
|
6501
6502
|
const { settings } = config, { url, headers, method, transform, timeout } = settings || {};
|
|
6502
6503
|
if (!url) return;
|
|
6503
|
-
const eventData =
|
|
6504
|
+
const eventData = se(data) ? data : event, body = transform ? transform(eventData, config, rule) : JSON.stringify(eventData);
|
|
6504
6505
|
logger?.debug("API destination sending request", { url, method: method || "POST", eventName: event.name });
|
|
6505
6506
|
const sendServerFn = env?.sendServer || a2, response = await sendServerFn(url, body, { headers, method, timeout });
|
|
6506
6507
|
logger?.debug("API destination response", { ok: response?.ok });
|
|
@@ -7225,7 +7226,7 @@ async function prepareFlow(input) {
|
|
|
7225
7226
|
configPath: process.cwd(),
|
|
7226
7227
|
flowName: input.flow
|
|
7227
7228
|
});
|
|
7228
|
-
const platform =
|
|
7229
|
+
const platform = ee(flowSettings);
|
|
7229
7230
|
const overrides = buildOverrides(
|
|
7230
7231
|
{ simulate: input.simulate, mock: input.mock },
|
|
7231
7232
|
flowSettings
|
|
@@ -7449,7 +7450,7 @@ function resolveBeforeChain(before, transformers, ingest, event) {
|
|
|
7449
7450
|
if (Array.isArray(before) && before.every(isString)) {
|
|
7450
7451
|
return before;
|
|
7451
7452
|
}
|
|
7452
|
-
const ids =
|
|
7453
|
+
const ids = Mt(before, Dt(ingest, event));
|
|
7453
7454
|
if (ids.length === 0) return [];
|
|
7454
7455
|
if (ids.length === 1) return walkStaticChain(ids[0], transformers);
|
|
7455
7456
|
return ids;
|
|
@@ -7575,7 +7576,7 @@ async function executeConfigPush(options, validatedEvent, logger, setTempDir, sn
|
|
|
7575
7576
|
flowName: options.flow,
|
|
7576
7577
|
logger
|
|
7577
7578
|
});
|
|
7578
|
-
const platform =
|
|
7579
|
+
const platform = ee(flowSettings);
|
|
7579
7580
|
const overrides = buildOverrides({ mock: options.mock }, flowSettings);
|
|
7580
7581
|
logger.debug("Bundling flow configuration");
|
|
7581
7582
|
const tempDir = getTmpPath(
|
|
@@ -8813,9 +8814,9 @@ function buildTelemetryObservers(flowId) {
|
|
|
8813
8814
|
const url = process.env.WALKEROS_OBSERVER_URL;
|
|
8814
8815
|
const token = process.env.WALKEROS_INGEST_TOKEN;
|
|
8815
8816
|
if (!url || !token) return void 0;
|
|
8816
|
-
const emit =
|
|
8817
|
+
const emit = pt({ url, token });
|
|
8817
8818
|
return [
|
|
8818
|
-
|
|
8819
|
+
ct(emit, () => ut({ flowId }))
|
|
8819
8820
|
];
|
|
8820
8821
|
}
|
|
8821
8822
|
async function injectSecrets(api, logger) {
|
|
@@ -9141,13 +9142,13 @@ function resolveEnvMarkers(value) {
|
|
|
9141
9142
|
return value;
|
|
9142
9143
|
}
|
|
9143
9144
|
function resolveEnvMarkersInString(input) {
|
|
9144
|
-
if (!input.includes(
|
|
9145
|
-
const esc =
|
|
9146
|
-
const
|
|
9145
|
+
if (!input.includes(B)) return input;
|
|
9146
|
+
const esc = B.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
9147
|
+
const re3 = new RegExp(
|
|
9147
9148
|
esc + "([a-zA-Z_][a-zA-Z0-9_]*)(?::((?:(?!" + esc + `)[^\\s"'])*))?`,
|
|
9148
9149
|
"g"
|
|
9149
9150
|
);
|
|
9150
|
-
return input.replace(
|
|
9151
|
+
return input.replace(re3, (match, name, defaultValue) => {
|
|
9151
9152
|
if (typeof process !== "undefined" && process.env?.[name] !== void 0) {
|
|
9152
9153
|
return process.env[name];
|
|
9153
9154
|
}
|
|
@@ -9446,9 +9447,9 @@ init_dist();
|
|
|
9446
9447
|
init_dev();
|
|
9447
9448
|
var { validateFlowConfig: validateFlowConfig2 } = i;
|
|
9448
9449
|
function isFlowJson(value) {
|
|
9449
|
-
if (!
|
|
9450
|
+
if (!fe(value)) return false;
|
|
9450
9451
|
if (!("version" in value) || !("flows" in value)) return false;
|
|
9451
|
-
return
|
|
9452
|
+
return fe(value.flows);
|
|
9452
9453
|
}
|
|
9453
9454
|
function validateFlow(input, options = {}) {
|
|
9454
9455
|
const errors = [];
|
|
@@ -9479,9 +9480,9 @@ function validateFlow(input, options = {}) {
|
|
|
9479
9480
|
message: issue.message
|
|
9480
9481
|
});
|
|
9481
9482
|
}
|
|
9482
|
-
const config =
|
|
9483
|
+
const config = fe(input) ? input : {};
|
|
9483
9484
|
const flowsValue = config.flows;
|
|
9484
|
-
const flows =
|
|
9485
|
+
const flows = fe(flowsValue) ? flowsValue : void 0;
|
|
9485
9486
|
if (flows && Object.keys(flows).length === 0) {
|
|
9486
9487
|
errors.push({
|
|
9487
9488
|
path: "flows",
|
|
@@ -9491,14 +9492,14 @@ function validateFlow(input, options = {}) {
|
|
|
9491
9492
|
}
|
|
9492
9493
|
if (flows) {
|
|
9493
9494
|
for (const [flowName, flowValue] of Object.entries(flows)) {
|
|
9494
|
-
if (!
|
|
9495
|
+
if (!fe(flowValue)) continue;
|
|
9495
9496
|
const transformersValue = flowValue.transformers;
|
|
9496
|
-
if (!
|
|
9497
|
+
if (!fe(transformersValue)) continue;
|
|
9497
9498
|
for (const [name, transformerValue] of Object.entries(
|
|
9498
9499
|
transformersValue
|
|
9499
9500
|
)) {
|
|
9500
|
-
if (!
|
|
9501
|
-
const result =
|
|
9501
|
+
if (!fe(transformerValue)) continue;
|
|
9502
|
+
const result = qt(transformerValue, "Transformer");
|
|
9502
9503
|
if (!result.ok) {
|
|
9503
9504
|
errors.push({
|
|
9504
9505
|
path: `flows.${flowName}.transformers.${name}`,
|
|
@@ -9528,15 +9529,15 @@ function validateFlow(input, options = {}) {
|
|
|
9528
9529
|
let totalPackageCount = 0;
|
|
9529
9530
|
if (flows) {
|
|
9530
9531
|
for (const [flowName, flowValue] of Object.entries(flows)) {
|
|
9531
|
-
if (!
|
|
9532
|
+
if (!fe(flowValue)) continue;
|
|
9532
9533
|
const flowConfig = flowValue.config;
|
|
9533
|
-
if (!
|
|
9534
|
+
if (!fe(flowConfig)) continue;
|
|
9534
9535
|
const bundle2 = flowConfig.bundle;
|
|
9535
|
-
if (!
|
|
9536
|
+
if (!fe(bundle2)) continue;
|
|
9536
9537
|
const packages = bundle2.packages;
|
|
9537
|
-
if (!
|
|
9538
|
+
if (!fe(packages)) continue;
|
|
9538
9539
|
for (const [pkgName, pkgConfigValue] of Object.entries(packages)) {
|
|
9539
|
-
if (!
|
|
9540
|
+
if (!fe(pkgConfigValue)) continue;
|
|
9540
9541
|
if (!pkgConfigValue.version && !pkgConfigValue.path) {
|
|
9541
9542
|
warnings.push({
|
|
9542
9543
|
path: `flows.${flowName}.config.bundle.packages.${pkgName}`,
|
|
@@ -9579,9 +9580,9 @@ function validateFlow(input, options = {}) {
|
|
|
9579
9580
|
for (const [destName, dest] of Object.entries(
|
|
9580
9581
|
flowSettings.destinations || {}
|
|
9581
9582
|
)) {
|
|
9582
|
-
if (!
|
|
9583
|
+
if (!fe(dest.config)) continue;
|
|
9583
9584
|
const mapping = dest.config.mapping;
|
|
9584
|
-
if (!
|
|
9585
|
+
if (!fe(mapping)) continue;
|
|
9585
9586
|
for (const key of Object.keys(mapping)) {
|
|
9586
9587
|
if (key.includes(".") && !key.includes(" ")) {
|
|
9587
9588
|
const parts = key.split(".");
|
|
@@ -9609,7 +9610,7 @@ function validateFlow(input, options = {}) {
|
|
|
9609
9610
|
const flowsToResolve = options.flow ? options.flow in flowsMap ? [options.flow] : [] : Object.keys(flowsMap);
|
|
9610
9611
|
for (const name of flowsToResolve) {
|
|
9611
9612
|
try {
|
|
9612
|
-
|
|
9613
|
+
Q(input, name, {
|
|
9613
9614
|
deferred: true,
|
|
9614
9615
|
// don't fail on missing $env when validating
|
|
9615
9616
|
strictFlowRefs: false,
|
|
@@ -9944,7 +9945,7 @@ function validateMapping(input) {
|
|
|
9944
9945
|
// src/commands/validate/validators/entry.ts
|
|
9945
9946
|
init_dist();
|
|
9946
9947
|
import Ajv from "ajv";
|
|
9947
|
-
var CLIENT_HEADER = "walkeros-cli/4.1.
|
|
9948
|
+
var CLIENT_HEADER = "walkeros-cli/4.1.3-next-1779963694449";
|
|
9948
9949
|
var SECTIONS = ["destinations", "sources", "transformers"];
|
|
9949
9950
|
function resolveEntry(path19, flowConfig) {
|
|
9950
9951
|
const flows = flowConfig.flows;
|
|
@@ -10020,7 +10021,7 @@ async function validateEntry(path19, flowConfig) {
|
|
|
10020
10021
|
}
|
|
10021
10022
|
let schemas;
|
|
10022
10023
|
try {
|
|
10023
|
-
const info = await
|
|
10024
|
+
const info = await Ot(packageName, {
|
|
10024
10025
|
client: CLIENT_HEADER
|
|
10025
10026
|
});
|
|
10026
10027
|
schemas = info.schemas;
|
|
@@ -10887,7 +10888,7 @@ async function createDeployCommand(config, options) {
|
|
|
10887
10888
|
const result2 = await loadFlowConfig(config, {
|
|
10888
10889
|
flowName: options.flow
|
|
10889
10890
|
});
|
|
10890
|
-
type =
|
|
10891
|
+
type = ee(result2.flowSettings);
|
|
10891
10892
|
}
|
|
10892
10893
|
const deployment = await createDeployment({
|
|
10893
10894
|
type,
|