@walkeros/cli 4.4.0-next-1785285516008 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -6
- package/dist/cli.js +1008 -961
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -3
- package/openapi/spec.json +4 -1
- package/package.json +8 -8
package/dist/cli.js
CHANGED
|
@@ -168,13 +168,13 @@ function w(e4, t4) {
|
|
|
168
168
|
async function k(e4, t4) {
|
|
169
169
|
return await e4.get(t4);
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function E(e4) {
|
|
172
172
|
return { _meta: { hops: 0, path: [e4] } };
|
|
173
173
|
}
|
|
174
174
|
function N(e4) {
|
|
175
175
|
throw new Error(String(e4));
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function z(e4, t4) {
|
|
178
178
|
const n5 = false !== t4?.stripAnnotations, r6 = {}, o4 = /* @__PURE__ */ new Set();
|
|
179
179
|
function s4(t5) {
|
|
180
180
|
if (r6[t5]) return r6[t5];
|
|
@@ -187,7 +187,7 @@ function C(e4, t4) {
|
|
|
187
187
|
const n6 = {};
|
|
188
188
|
void 0 === e5.tagging && void 0 === t6.tagging || (n6.tagging = t6.tagging ?? e5.tagging);
|
|
189
189
|
void 0 === e5.description && void 0 === t6.description || (n6.description = t6.description ?? e5.description);
|
|
190
|
-
e5.schema && t6.schema ? n6.schema =
|
|
190
|
+
e5.schema && t6.schema ? n6.schema = D(e5.schema, t6.schema) : (e5.schema || t6.schema) && (n6.schema = { ...e5.schema || t6.schema });
|
|
191
191
|
if (e5.events || t6.events) {
|
|
192
192
|
const r7 = {}, o5 = /* @__PURE__ */ new Set([...Object.keys(e5.events || {}), ...Object.keys(t6.events || {})]);
|
|
193
193
|
for (const n7 of o5) {
|
|
@@ -195,7 +195,7 @@ function C(e4, t4) {
|
|
|
195
195
|
r7[n7] = {};
|
|
196
196
|
for (const e6 of i6) {
|
|
197
197
|
const t7 = o6[e6], i7 = s5[e6];
|
|
198
|
-
r7[n7][e6] = t7 && i7 ?
|
|
198
|
+
r7[n7][e6] = t7 && i7 ? D(t7, i7) : { ...t7 || i7 };
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
n6.events = r7;
|
|
@@ -210,13 +210,13 @@ function C(e4, t4) {
|
|
|
210
210
|
for (const r7 of Object.keys(e5[n6] || {})) {
|
|
211
211
|
let o5 = {};
|
|
212
212
|
const s5 = e5["*"]?.["*"];
|
|
213
|
-
s5 && (o5 =
|
|
213
|
+
s5 && (o5 = D(o5, s5));
|
|
214
214
|
const i6 = e5["*"]?.[r7];
|
|
215
|
-
i6 && "*" !== r7 && (o5 =
|
|
215
|
+
i6 && "*" !== r7 && (o5 = D(o5, i6));
|
|
216
216
|
const a5 = e5[n6]?.["*"];
|
|
217
|
-
a5 && "*" !== r7 && (o5 =
|
|
217
|
+
a5 && "*" !== r7 && (o5 = D(o5, a5));
|
|
218
218
|
const c2 = e5[n6]?.[r7];
|
|
219
|
-
c2 && (o5 =
|
|
219
|
+
c2 && (o5 = D(o5, c2)), t6[n6][r7] = o5;
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
e5["*"] && (t6["*"] = { ...e5["*"] });
|
|
@@ -225,7 +225,7 @@ function C(e4, t4) {
|
|
|
225
225
|
const e5 = {};
|
|
226
226
|
for (const [t6, n6] of Object.entries(a4.events)) {
|
|
227
227
|
e5[t6] = {};
|
|
228
|
-
for (const [r7, o5] of Object.entries(n6)) e5[t6][r7] =
|
|
228
|
+
for (const [r7, o5] of Object.entries(n6)) e5[t6][r7] = F(o5);
|
|
229
229
|
}
|
|
230
230
|
a4.events = e5;
|
|
231
231
|
}
|
|
@@ -234,33 +234,38 @@ function C(e4, t4) {
|
|
|
234
234
|
for (const t5 of Object.keys(e4)) s4(t5);
|
|
235
235
|
return r6;
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function D(e4, t4) {
|
|
238
238
|
const n5 = { ...e4 };
|
|
239
239
|
for (const r6 of Object.keys(t4)) {
|
|
240
240
|
const o4 = e4[r6], s4 = t4[r6];
|
|
241
|
-
"required" === r6 && Array.isArray(o4) && Array.isArray(s4) ? n5[r6] = [.../* @__PURE__ */ new Set([...o4, ...s4])] :
|
|
241
|
+
"required" === r6 && Array.isArray(o4) && Array.isArray(s4) ? n5[r6] = [.../* @__PURE__ */ new Set([...o4, ...s4])] : L(o4) && L(s4) ? n5[r6] = D(o4, s4) : n5[r6] = s4;
|
|
242
242
|
}
|
|
243
243
|
return n5;
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function F(e4) {
|
|
246
246
|
const t4 = {};
|
|
247
|
-
for (const [n5, r6] of Object.entries(e4)) T.has(n5) || (
|
|
247
|
+
for (const [n5, r6] of Object.entries(e4)) T.has(n5) || (R.has(n5) && L(r6) ? t4[n5] = U(r6) : P.has(n5) && Array.isArray(r6) ? t4[n5] = r6.map((e5) => L(e5) ? F(e5) : e5) : C.has(n5) && L(r6) ? t4[n5] = F(r6) : t4[n5] = r6);
|
|
248
248
|
return t4;
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function U(e4) {
|
|
251
|
+
const t4 = {};
|
|
252
|
+
for (const [n5, r6] of Object.entries(e4)) t4[n5] = L(r6) ? F(r6) : r6;
|
|
253
|
+
return t4;
|
|
254
|
+
}
|
|
255
|
+
function L(e4) {
|
|
251
256
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
|
|
252
257
|
}
|
|
253
|
-
function
|
|
258
|
+
function X(...e4) {
|
|
254
259
|
const t4 = {};
|
|
255
260
|
for (const n5 of e4) n5 && Object.assign(t4, n5);
|
|
256
261
|
return t4;
|
|
257
262
|
}
|
|
258
|
-
function
|
|
263
|
+
function te(e4, t4, n5) {
|
|
259
264
|
const r6 = `$flow.${e4}${t4 ? `.${t4}` : ""}`;
|
|
260
265
|
if ("unknown-flow" === n5) return `${r6} cannot resolve: flow "${e4}" does not exist in this config.`;
|
|
261
266
|
return `${r6} is empty. Set ${t4 ? `flows.${e4}.config.${t4}` : `flows.${e4}.config`}, or run \`walkeros deploy ${e4}\` first.`;
|
|
262
267
|
}
|
|
263
|
-
function
|
|
268
|
+
function ne(e4, t4, n5) {
|
|
264
269
|
const r6 = t4.split(".");
|
|
265
270
|
let o4 = e4;
|
|
266
271
|
for (let e5 = 0; e5 < r6.length; e5++) {
|
|
@@ -278,9 +283,9 @@ function X(e4, t4, n5) {
|
|
|
278
283
|
}
|
|
279
284
|
return o4;
|
|
280
285
|
}
|
|
281
|
-
function
|
|
286
|
+
function re(e4, t4, n5, r6, o4, s4) {
|
|
282
287
|
if ("string" == typeof e4) {
|
|
283
|
-
const i5 = e4.match(
|
|
288
|
+
const i5 = e4.match(q);
|
|
284
289
|
if (i5) {
|
|
285
290
|
const e5 = i5[1].split("."), a5 = e5[0], c3 = e5.slice(1).join(".");
|
|
286
291
|
void 0 === t4[a5] && N(`Variable "${a5}" not found`);
|
|
@@ -291,46 +296,46 @@ function Q(e4, t4, n5, r6, o4, s4) {
|
|
|
291
296
|
let u4;
|
|
292
297
|
f3.add(a5);
|
|
293
298
|
try {
|
|
294
|
-
u4 =
|
|
299
|
+
u4 = re(t4[a5], t4, n5, r6, o4, f3);
|
|
295
300
|
} finally {
|
|
296
301
|
f3.delete(a5);
|
|
297
302
|
}
|
|
298
|
-
return c3 && (u4 =
|
|
303
|
+
return c3 && (u4 = ne(u4, c3, `$var.${a5}`)), u4;
|
|
299
304
|
}
|
|
300
|
-
const a4 = e4.match(
|
|
305
|
+
const a4 = e4.match(B);
|
|
301
306
|
if (a4 && r6) {
|
|
302
307
|
const e5 = a4[1], t5 = a4[2];
|
|
303
308
|
e5 in r6 || N(`Contract "${e5}" not found`);
|
|
304
309
|
let n6 = r6[e5];
|
|
305
|
-
return t5 && (n6 =
|
|
310
|
+
return t5 && (n6 = ne(n6, t5, `$contract.${e5}`)), n6;
|
|
306
311
|
}
|
|
307
|
-
const c2 = e4.match(
|
|
312
|
+
const c2 = e4.match(Z);
|
|
308
313
|
if (c2) {
|
|
309
314
|
const t5 = c2[1], r7 = c2[2], s5 = false === n5?.strictFlowRefs;
|
|
310
315
|
o4 || N(`$flow.${t5}${r7 ? `.${r7}` : ""} cannot be resolved without a flow resolver`);
|
|
311
316
|
const i6 = o4(t5);
|
|
312
317
|
if (!i6) {
|
|
313
|
-
if (s5) return n5?.onWarning?.(
|
|
318
|
+
if (s5) return n5?.onWarning?.(te(t5, r7, "unknown-flow")), e4;
|
|
314
319
|
N(`Flow "${t5}" not found in $flow.${t5}`);
|
|
315
320
|
}
|
|
316
321
|
let a5 = i6;
|
|
317
322
|
if (r7) if (s5) {
|
|
318
323
|
try {
|
|
319
|
-
a5 =
|
|
324
|
+
a5 = ne(a5, r7, `$flow.${t5}`);
|
|
320
325
|
} catch {
|
|
321
|
-
return n5?.onWarning?.(
|
|
326
|
+
return n5?.onWarning?.(te(t5, r7, "missing-key")), e4;
|
|
322
327
|
}
|
|
323
|
-
if (null == a5 || "" === a5) return n5?.onWarning?.(
|
|
324
|
-
} else a5 =
|
|
328
|
+
if (null == a5 || "" === a5) return n5?.onWarning?.(te(t5, r7, "missing-key")), e4;
|
|
329
|
+
} else a5 = ne(a5, r7, `$flow.${t5}`);
|
|
325
330
|
return a5;
|
|
326
331
|
}
|
|
327
|
-
const f2 = e4.match(
|
|
332
|
+
const f2 = e4.match(H);
|
|
328
333
|
if (f2) {
|
|
329
334
|
const e5 = f2[1];
|
|
330
|
-
if (n5?.deferred) return `${
|
|
335
|
+
if (n5?.deferred) return `${ee}${e5}`;
|
|
331
336
|
N(`Secret "$secret.${e5}" cannot be used in a web flow \u2014 secrets are never sent to the browser. Use a server flow.`);
|
|
332
337
|
}
|
|
333
|
-
let u3 = e4.replace(
|
|
338
|
+
let u3 = e4.replace(K, (e5, i6) => {
|
|
334
339
|
const a5 = i6.split("."), c3 = a5[0], f3 = a5.slice(1).join(".");
|
|
335
340
|
void 0 === t4[c3] && N(`Variable "${c3}" not found`);
|
|
336
341
|
const u4 = s4 ?? /* @__PURE__ */ new Set();
|
|
@@ -340,30 +345,30 @@ function Q(e4, t4, n5, r6, o4, s4) {
|
|
|
340
345
|
let l3;
|
|
341
346
|
u4.add(c3);
|
|
342
347
|
try {
|
|
343
|
-
l3 =
|
|
348
|
+
l3 = re(t4[c3], t4, n5, r6, o4, u4);
|
|
344
349
|
} finally {
|
|
345
350
|
u4.delete(c3);
|
|
346
351
|
}
|
|
347
|
-
if (f3 && (l3 =
|
|
352
|
+
if (f3 && (l3 = ne(l3, f3, `$var.${c3}`)), null === l3 || "string" != typeof l3 && "number" != typeof l3 && "boolean" != typeof l3) {
|
|
348
353
|
N(`Variable "${i6}" resolves to non-scalar (${Array.isArray(l3) ? "array" : typeof l3}) and cannot be inlined into a string. Use it as a whole-string reference: "$var.${i6}"`);
|
|
349
354
|
}
|
|
350
355
|
return String(l3);
|
|
351
356
|
});
|
|
352
|
-
return u3 = u3.replace(
|
|
357
|
+
return u3 = u3.replace(W, (e5, t5, r7) => n5?.deferred ? void 0 !== r7 ? `${Q}${t5}:${r7}` : `${Q}${t5}` : "undefined" != typeof process && void 0 !== process.env?.[t5] ? process.env[t5] : void 0 !== r7 ? r7 : void N(`Environment variable "${t5}" not found and no default provided`)), u3;
|
|
353
358
|
}
|
|
354
|
-
if (Array.isArray(e4)) return e4.map((e5) =>
|
|
359
|
+
if (Array.isArray(e4)) return e4.map((e5) => re(e5, t4, n5, r6, o4, s4));
|
|
355
360
|
if (null !== e4 && "object" == typeof e4) {
|
|
356
361
|
const i5 = {};
|
|
357
|
-
for (const [a4, c2] of Object.entries(e4)) i5[a4] =
|
|
362
|
+
for (const [a4, c2] of Object.entries(e4)) i5[a4] = re(c2, t4, n5, r6, o4, s4);
|
|
358
363
|
return i5;
|
|
359
364
|
}
|
|
360
365
|
return e4;
|
|
361
366
|
}
|
|
362
|
-
function
|
|
367
|
+
function oe(e4) {
|
|
363
368
|
const t4 = e4.startsWith("@"), n5 = e4.replace("@", "").replace(/[/-]/g, "_").split("_").filter((e5) => e5.length > 0).map((e5, t5) => 0 === t5 ? e5 : e5.charAt(0).toUpperCase() + e5.slice(1)).join("");
|
|
364
369
|
return t4 ? "_" + n5 : n5;
|
|
365
370
|
}
|
|
366
|
-
function
|
|
371
|
+
function se(e4, t4, n5) {
|
|
367
372
|
const r6 = /* @__PURE__ */ new Map(), o4 = /* @__PURE__ */ new Set(), s4 = [], i5 = (t5) => {
|
|
368
373
|
if (r6.has(t5)) return r6.get(t5);
|
|
369
374
|
const a5 = e4.flows[t5];
|
|
@@ -373,7 +378,7 @@ function te(e4, t4, n5) {
|
|
|
373
378
|
}
|
|
374
379
|
o4.add(t5), s4.push(t5);
|
|
375
380
|
try {
|
|
376
|
-
const o5 =
|
|
381
|
+
const o5 = X(e4.variables, a5.variables), s5 = re(a5.config ?? {}, o5, n5, void 0, i5);
|
|
377
382
|
return r6.set(t5, s5), s5;
|
|
378
383
|
} finally {
|
|
379
384
|
o4.delete(t5), s4.pop();
|
|
@@ -388,31 +393,31 @@ function te(e4, t4, n5) {
|
|
|
388
393
|
const o5 = JSON.parse(JSON.stringify(t5));
|
|
389
394
|
let s5;
|
|
390
395
|
if (e5.contract) {
|
|
391
|
-
const o6 =
|
|
392
|
-
s5 =
|
|
396
|
+
const o6 = X(e5.variables, t5.variables);
|
|
397
|
+
s5 = z(re(e5.contract, o6, n6, void 0, r7));
|
|
393
398
|
}
|
|
394
399
|
if (o5.config) {
|
|
395
|
-
const i6 =
|
|
396
|
-
o5.config =
|
|
400
|
+
const i6 = X(e5.variables, t5.variables);
|
|
401
|
+
o5.config = re(o5.config, i6, n6, s5, r7);
|
|
397
402
|
}
|
|
398
403
|
if (o5.sources) for (const [i6, a5] of Object.entries(o5.sources)) {
|
|
399
|
-
const c3 =
|
|
404
|
+
const c3 = X(e5.variables, t5.variables, a5.variables), f2 = re(a5.config, c3, n6, s5, r7), u3 = re(a5.env, c3, n6, s5, r7);
|
|
400
405
|
o5.sources[i6] = { package: a5.package, import: a5.import, config: f2, env: u3, primary: a5.primary, variables: a5.variables, before: a5.before, next: a5.next, cache: a5.cache, code: a5.code };
|
|
401
406
|
}
|
|
402
407
|
if (o5.destinations) for (const [i6, a5] of Object.entries(o5.destinations)) {
|
|
403
|
-
const c3 =
|
|
408
|
+
const c3 = X(e5.variables, t5.variables, a5.variables), f2 = re(a5.config, c3, n6, s5, r7), u3 = re(a5.env, c3, n6, s5, r7);
|
|
404
409
|
o5.destinations[i6] = { package: a5.package, import: a5.import, config: f2, env: u3, variables: a5.variables, before: a5.before, next: a5.next, cache: a5.cache, code: a5.code };
|
|
405
410
|
}
|
|
406
411
|
if (o5.stores) for (const [i6, a5] of Object.entries(o5.stores)) {
|
|
407
|
-
const c3 =
|
|
412
|
+
const c3 = X(e5.variables, t5.variables, a5.variables), f2 = re(a5.config, c3, n6, s5, r7), u3 = re(a5.env, c3, n6, s5, r7);
|
|
408
413
|
o5.stores[i6] = { package: a5.package, import: a5.import, config: f2, env: u3, cache: a5.cache, variables: a5.variables, code: a5.code };
|
|
409
414
|
}
|
|
410
415
|
if (o5.transformers) for (const [i6, a5] of Object.entries(o5.transformers)) {
|
|
411
|
-
const c3 =
|
|
416
|
+
const c3 = X(e5.variables, t5.variables, a5.variables), f2 = re(a5.config, c3, n6, s5, r7), u3 = re(a5.env, c3, n6, s5, r7);
|
|
412
417
|
o5.transformers[i6] = { package: a5.package, import: a5.import, config: f2, env: u3, variables: a5.variables, before: a5.before, next: a5.next, cache: a5.cache, code: a5.code };
|
|
413
418
|
}
|
|
414
419
|
if (o5.collector) {
|
|
415
|
-
const i6 =
|
|
420
|
+
const i6 = X(e5.variables, t5.variables), a5 = re(o5.collector, i6, n6, s5, r7);
|
|
416
421
|
o5.collector = a5;
|
|
417
422
|
}
|
|
418
423
|
return o5;
|
|
@@ -421,57 +426,57 @@ function te(e4, t4, n5) {
|
|
|
421
426
|
o4.delete(t4), s4.pop();
|
|
422
427
|
}
|
|
423
428
|
}
|
|
424
|
-
function
|
|
429
|
+
function ie(e4) {
|
|
425
430
|
const t4 = e4.config?.platform;
|
|
426
431
|
if ("web" === t4 || "server" === t4) return t4;
|
|
427
432
|
N('Flow must have config.platform set to "web" or "server"');
|
|
428
433
|
}
|
|
429
|
-
function
|
|
430
|
-
n5 = { ...
|
|
434
|
+
function ce(e4, t4 = {}, n5 = {}) {
|
|
435
|
+
n5 = { ...ae, ...n5 };
|
|
431
436
|
const r6 = Object.entries(t4).reduce((t5, [r7, o4]) => {
|
|
432
437
|
const s4 = e4[r7];
|
|
433
438
|
return n5.merge && Array.isArray(s4) && Array.isArray(o4) ? t5[r7] = o4.reduce((e5, t6) => e5.includes(t6) ? e5 : [...e5, t6], [...s4]) : (n5.extend || r7 in e4) && (t5[r7] = o4), t5;
|
|
434
439
|
}, {});
|
|
435
440
|
return n5.shallow ? { ...e4, ...r6 } : (Object.assign(e4, r6), e4);
|
|
436
441
|
}
|
|
437
|
-
function
|
|
442
|
+
function ue(e4) {
|
|
438
443
|
return Array.isArray(e4);
|
|
439
444
|
}
|
|
440
|
-
function
|
|
445
|
+
function le(e4) {
|
|
441
446
|
return "boolean" == typeof e4;
|
|
442
447
|
}
|
|
443
|
-
function
|
|
448
|
+
function de(e4) {
|
|
444
449
|
return void 0 !== e4;
|
|
445
450
|
}
|
|
446
|
-
function
|
|
451
|
+
function ge(e4) {
|
|
447
452
|
return "function" == typeof e4;
|
|
448
453
|
}
|
|
449
|
-
function
|
|
454
|
+
function ve(e4) {
|
|
450
455
|
return "number" == typeof e4 && !Number.isNaN(e4);
|
|
451
456
|
}
|
|
452
|
-
function
|
|
453
|
-
return "object" == typeof e4 && null !== e4 && !
|
|
457
|
+
function he(e4) {
|
|
458
|
+
return "object" == typeof e4 && null !== e4 && !ue(e4) && "[object Object]" === Object.prototype.toString.call(e4);
|
|
454
459
|
}
|
|
455
|
-
function
|
|
460
|
+
function ye(e4, t4) {
|
|
456
461
|
return typeof e4 == typeof t4;
|
|
457
462
|
}
|
|
458
|
-
function
|
|
463
|
+
function be(e4) {
|
|
459
464
|
return "string" == typeof e4;
|
|
460
465
|
}
|
|
461
|
-
function
|
|
466
|
+
function we(e4, t4 = /* @__PURE__ */ new WeakMap()) {
|
|
462
467
|
if ("object" != typeof e4 || null === e4) return e4;
|
|
463
468
|
if (t4.has(e4)) return t4.get(e4);
|
|
464
469
|
const n5 = Object.prototype.toString.call(e4);
|
|
465
470
|
if ("[object Object]" === n5) {
|
|
466
471
|
const n6 = {};
|
|
467
472
|
t4.set(e4, n6);
|
|
468
|
-
for (const r6 in e4) Object.prototype.hasOwnProperty.call(e4, r6) && (n6[r6] =
|
|
473
|
+
for (const r6 in e4) Object.prototype.hasOwnProperty.call(e4, r6) && (n6[r6] = we(e4[r6], t4));
|
|
469
474
|
return n6;
|
|
470
475
|
}
|
|
471
476
|
if ("[object Array]" === n5) {
|
|
472
477
|
const n6 = [];
|
|
473
478
|
return t4.set(e4, n6), e4.forEach((e5) => {
|
|
474
|
-
n6.push(
|
|
479
|
+
n6.push(we(e5, t4));
|
|
475
480
|
}), n6;
|
|
476
481
|
}
|
|
477
482
|
if ("[object Date]" === n5) return new Date(e4.getTime());
|
|
@@ -481,26 +486,26 @@ function ve(e4, t4 = /* @__PURE__ */ new WeakMap()) {
|
|
|
481
486
|
}
|
|
482
487
|
return e4;
|
|
483
488
|
}
|
|
484
|
-
function
|
|
489
|
+
function ke(e4, t4 = "", n5) {
|
|
485
490
|
const r6 = t4.split(".");
|
|
486
491
|
let o4 = e4;
|
|
487
492
|
for (let e5 = 0; e5 < r6.length; e5++) {
|
|
488
493
|
const t5 = r6[e5];
|
|
489
|
-
if ("*" === t5 &&
|
|
494
|
+
if ("*" === t5 && ue(o4)) {
|
|
490
495
|
const t6 = r6.slice(e5 + 1).join("."), s4 = [];
|
|
491
496
|
for (const e6 of o4) {
|
|
492
|
-
const r7 =
|
|
497
|
+
const r7 = ke(e6, t6, n5);
|
|
493
498
|
s4.push(r7);
|
|
494
499
|
}
|
|
495
500
|
return s4;
|
|
496
501
|
}
|
|
497
|
-
if (o4 =
|
|
502
|
+
if (o4 = he(o4) || ue(o4) ? o4[t5] : void 0, void 0 === o4) break;
|
|
498
503
|
}
|
|
499
|
-
return
|
|
504
|
+
return de(o4) ? o4 : n5;
|
|
500
505
|
}
|
|
501
|
-
function
|
|
502
|
-
if (!
|
|
503
|
-
const r6 =
|
|
506
|
+
function $e(e4, t4, n5) {
|
|
507
|
+
if (!he(e4)) return e4;
|
|
508
|
+
const r6 = we(e4), o4 = t4.split(".");
|
|
504
509
|
let s4 = r6;
|
|
505
510
|
for (let e5 = 0; e5 < o4.length; e5++) {
|
|
506
511
|
const t5 = o4[e5];
|
|
@@ -508,55 +513,55 @@ function ye(e4, t4, n5) {
|
|
|
508
513
|
}
|
|
509
514
|
return r6;
|
|
510
515
|
}
|
|
511
|
-
function
|
|
512
|
-
if (!
|
|
513
|
-
const n5 =
|
|
516
|
+
function Ae(e4, t4) {
|
|
517
|
+
if (!he(e4) && !ue(e4)) return e4;
|
|
518
|
+
const n5 = we(e4), r6 = t4.split(".");
|
|
514
519
|
let o4 = n5;
|
|
515
520
|
for (let e5 = 0; e5 < r6.length; e5++) {
|
|
516
521
|
const t5 = r6[e5], s4 = e5 === r6.length - 1;
|
|
517
|
-
if (
|
|
522
|
+
if (ue(o4)) {
|
|
518
523
|
const e6 = Number(t5);
|
|
519
524
|
if (!Number.isInteger(e6) || e6 < 0 || e6 >= o4.length) return n5;
|
|
520
525
|
if (s4) o4.splice(e6, 1);
|
|
521
526
|
else {
|
|
522
527
|
const t6 = o4[e6];
|
|
523
|
-
if (!
|
|
528
|
+
if (!he(t6) && !ue(t6)) return n5;
|
|
524
529
|
o4 = t6;
|
|
525
530
|
}
|
|
526
531
|
} else if (s4) delete o4[t5];
|
|
527
532
|
else {
|
|
528
533
|
const e6 = o4[t5];
|
|
529
|
-
if (!
|
|
534
|
+
if (!he(e6) && !ue(e6)) return n5;
|
|
530
535
|
o4 = e6;
|
|
531
536
|
}
|
|
532
537
|
}
|
|
533
538
|
return n5;
|
|
534
539
|
}
|
|
535
|
-
function
|
|
536
|
-
if (
|
|
540
|
+
function Ie(e4, t4, n5) {
|
|
541
|
+
if (he(n5)) for (const [r6, o4] of Object.entries(n5)) void 0 !== o4 && Ie(e4, `${t4}_${r6}`, o4);
|
|
537
542
|
else e4[t4] = n5;
|
|
538
543
|
}
|
|
539
|
-
function
|
|
540
|
-
const n5 = {}, r6 = t4.includes("all") ? Object.keys(
|
|
544
|
+
function je(e4, t4) {
|
|
545
|
+
const n5 = {}, r6 = t4.includes("all") ? Object.keys(Se) : t4;
|
|
541
546
|
for (const t5 of r6) {
|
|
542
|
-
const r7 =
|
|
547
|
+
const r7 = Se[t5];
|
|
543
548
|
if (!r7) continue;
|
|
544
549
|
const o4 = r7(e4);
|
|
545
|
-
if (
|
|
550
|
+
if (he(o4)) for (const [e5, r8] of Object.entries(o4)) {
|
|
546
551
|
if (void 0 === r8) continue;
|
|
547
|
-
|
|
552
|
+
Ie(n5, `${t5}_${e5}`, "context" === t5 && Array.isArray(r8) ? r8[0] : r8);
|
|
548
553
|
}
|
|
549
554
|
}
|
|
550
555
|
return n5;
|
|
551
556
|
}
|
|
552
|
-
function
|
|
557
|
+
function Oe(e4, t4 = {}, n5 = {}) {
|
|
553
558
|
const r6 = { ...t4, ...n5 }, o4 = {};
|
|
554
559
|
let s4 = !e4 || 0 === Object.keys(e4).length;
|
|
555
560
|
return Object.keys(r6).forEach((t5) => {
|
|
556
561
|
r6[t5] && (o4[t5] = true, e4 && e4[t5] && (s4 = true));
|
|
557
562
|
}), !!s4 && o4;
|
|
558
563
|
}
|
|
559
|
-
function
|
|
564
|
+
function Me(e4 = 6, t4 = "0123456789abcdefghijklmnopqrstuvwxyz") {
|
|
560
565
|
const n5 = t4.length;
|
|
561
566
|
if (e4 <= 0 || 0 === n5) return "";
|
|
562
567
|
let r6 = "";
|
|
@@ -564,14 +569,14 @@ function xe(e4 = 6, t4 = "0123456789abcdefghijklmnopqrstuvwxyz") {
|
|
|
564
569
|
const o4 = 256 - 256 % n5;
|
|
565
570
|
for (; r6.length < e4; ) {
|
|
566
571
|
const s4 = e4 - r6.length, i5 = new Uint8Array(Math.ceil(1.3 * s4) + 4);
|
|
567
|
-
if (!
|
|
572
|
+
if (!Ne(i5)) break;
|
|
568
573
|
for (let s5 = 0; s5 < i5.length && r6.length < e4; s5++) i5[s5] < o4 && (r6 += t4[i5[s5] % n5]);
|
|
569
574
|
}
|
|
570
575
|
}
|
|
571
576
|
for (; r6.length < e4; ) r6 += t4[Math.random() * n5 | 0];
|
|
572
577
|
return r6;
|
|
573
578
|
}
|
|
574
|
-
function
|
|
579
|
+
function Ne(e4) {
|
|
575
580
|
try {
|
|
576
581
|
const t4 = globalThis.crypto;
|
|
577
582
|
if (t4 && "function" == typeof t4.getRandomValues) return t4.getRandomValues(e4), true;
|
|
@@ -579,29 +584,29 @@ function Ee(e4) {
|
|
|
579
584
|
}
|
|
580
585
|
return false;
|
|
581
586
|
}
|
|
582
|
-
function
|
|
583
|
-
let t4 =
|
|
584
|
-
for (; /^0+$/.test(t4); ) t4 =
|
|
587
|
+
function Ce(e4) {
|
|
588
|
+
let t4 = Me(e4, Te);
|
|
589
|
+
for (; /^0+$/.test(t4); ) t4 = Me(e4, Te);
|
|
585
590
|
return t4;
|
|
586
591
|
}
|
|
587
|
-
function
|
|
588
|
-
return
|
|
592
|
+
function Pe() {
|
|
593
|
+
return Ce(16);
|
|
589
594
|
}
|
|
590
|
-
function
|
|
591
|
-
return
|
|
595
|
+
function De() {
|
|
596
|
+
return Ce(32);
|
|
592
597
|
}
|
|
593
|
-
function
|
|
598
|
+
function Ue(e4) {
|
|
594
599
|
if ("string" != typeof e4) return;
|
|
595
|
-
const t4 =
|
|
600
|
+
const t4 = Fe.exec(e4)?.groups;
|
|
596
601
|
if (!t4) return;
|
|
597
602
|
const { version: n5, trace: r6, span: o4 } = t4;
|
|
598
603
|
return void 0 === n5 || void 0 === r6 || void 0 === o4 || "ff" === n5 || /^0+$/.test(r6) || /^0+$/.test(o4) ? void 0 : { trace: r6, parentSpan: o4 };
|
|
599
604
|
}
|
|
600
|
-
function
|
|
605
|
+
function Ke(e4, t4) {
|
|
601
606
|
return "number" == typeof e4 ? { wait: e4 } : e4 ? { wait: e4.wait ?? t4, size: e4.size, age: e4.age } : { wait: t4 };
|
|
602
607
|
}
|
|
603
|
-
function
|
|
604
|
-
const { wait: r6, size: o4, age: s4 } =
|
|
608
|
+
function We(e4, t4 = 1e3, n5 = false) {
|
|
609
|
+
const { wait: r6, size: o4, age: s4 } = Ke(t4, 1e3);
|
|
605
610
|
let i5, a4, c2 = null, f2 = null, u3 = false, l3 = [], p3 = 0;
|
|
606
611
|
const d2 = () => {
|
|
607
612
|
c2 && (clearTimeout(c2), c2 = null), f2 && (clearTimeout(f2), f2 = null), p3 = 0, a4 = void 0;
|
|
@@ -629,39 +634,39 @@ function Ue(e4, t4 = 1e3, n5 = false) {
|
|
|
629
634
|
l3 = [], d2(), i5 = void 0, e5.forEach((e6) => e6(void 0));
|
|
630
635
|
}, g3.size = () => p3, g3;
|
|
631
636
|
}
|
|
632
|
-
function
|
|
637
|
+
function Ze(e4) {
|
|
633
638
|
return { message: e4.message, name: e4.name, stack: e4.stack, cause: e4.cause };
|
|
634
639
|
}
|
|
635
|
-
function
|
|
640
|
+
function Ve(e4, t4) {
|
|
636
641
|
let n5, r6 = {};
|
|
637
|
-
return e4 instanceof Error ? (n5 = e4.message, r6.error =
|
|
642
|
+
return e4 instanceof Error ? (n5 = e4.message, r6.error = Ze(e4)) : n5 = e4, void 0 !== t4 && (t4 instanceof Error ? r6.error = Ze(t4) : "object" == typeof t4 && null !== t4 ? (r6 = { ...r6, ...t4 }, "error" in r6 && r6.error instanceof Error && (r6.error = Ze(r6.error))) : r6.value = t4), { message: n5, context: r6 };
|
|
638
643
|
}
|
|
639
|
-
function
|
|
640
|
-
return
|
|
644
|
+
function Je(e4 = {}) {
|
|
645
|
+
return Ge({ level: void 0 !== e4.level ? (function(e5) {
|
|
641
646
|
return "string" == typeof e5 ? l[e5] : e5;
|
|
642
647
|
})(e4.level) : 0, handler: e4.handler, jsonHandler: e4.jsonHandler, scope: [] });
|
|
643
648
|
}
|
|
644
|
-
function
|
|
649
|
+
function Ge(e4) {
|
|
645
650
|
const { level: t4, handler: n5, jsonHandler: r6, scope: o4 } = e4, s4 = (e5, r7, s5) => {
|
|
646
651
|
if (e5 <= t4) {
|
|
647
|
-
const t5 =
|
|
648
|
-
n5 ? n5(e5, t5.message, t5.context, o4,
|
|
652
|
+
const t5 = Ve(r7, s5);
|
|
653
|
+
n5 ? n5(e5, t5.message, t5.context, o4, He) : He(e5, t5.message, t5.context, o4);
|
|
649
654
|
}
|
|
650
655
|
};
|
|
651
656
|
return { error: (e5, t5) => s4(0, e5, t5), warn: (e5, t5) => s4(1, e5, t5), info: (e5, t5) => s4(2, e5, t5), debug: (e5, t5) => s4(3, e5, t5), throw: (e5, t5) => {
|
|
652
|
-
const r7 =
|
|
653
|
-
throw n5 ? n5(0, r7.message, r7.context, o4,
|
|
657
|
+
const r7 = Ve(e5, t5);
|
|
658
|
+
throw n5 ? n5(0, r7.message, r7.context, o4, He) : He(0, r7.message, r7.context, o4), new Error(r7.message);
|
|
654
659
|
}, json: (e5) => {
|
|
655
660
|
r6 ? r6(e5) : console.log(JSON.stringify(e5, null, 2));
|
|
656
|
-
}, scope: (e5) =>
|
|
661
|
+
}, scope: (e5) => Ge({ level: t4, handler: n5, jsonHandler: r6, scope: [...o4, e5] }) };
|
|
657
662
|
}
|
|
658
|
-
function
|
|
659
|
-
return
|
|
663
|
+
function Ye(e4) {
|
|
664
|
+
return le(e4) || be(e4) || ve(e4) || !de(e4) || ue(e4) && e4.every(Ye) || he(e4) && Object.values(e4).every(Ye);
|
|
660
665
|
}
|
|
661
|
-
function
|
|
662
|
-
return
|
|
666
|
+
function Qe(e4) {
|
|
667
|
+
return Ye(e4) ? e4 : void 0;
|
|
663
668
|
}
|
|
664
|
-
function
|
|
669
|
+
function et(e4, t4, n5) {
|
|
665
670
|
return function(...r6) {
|
|
666
671
|
try {
|
|
667
672
|
return e4(...r6);
|
|
@@ -673,7 +678,7 @@ function Ge(e4, t4, n5) {
|
|
|
673
678
|
}
|
|
674
679
|
};
|
|
675
680
|
}
|
|
676
|
-
function
|
|
681
|
+
function tt(e4, t4, n5) {
|
|
677
682
|
return async function(...r6) {
|
|
678
683
|
try {
|
|
679
684
|
return await e4(...r6);
|
|
@@ -685,16 +690,16 @@ function Ye(e4, t4, n5) {
|
|
|
685
690
|
}
|
|
686
691
|
};
|
|
687
692
|
}
|
|
688
|
-
async function
|
|
693
|
+
async function rt(e4, t4, n5) {
|
|
689
694
|
const [r6, o4] = (e4.name || "").split(" ");
|
|
690
695
|
if (!t4 || !r6 || !o4) return {};
|
|
691
696
|
let s4, i5 = "", a4 = r6, c2 = o4;
|
|
692
697
|
const f2 = (t5) => {
|
|
693
698
|
if (!t5) return;
|
|
694
|
-
return (
|
|
699
|
+
return (ue(t5) ? t5 : [t5]).find((t6) => {
|
|
695
700
|
if (!t6.condition) return true;
|
|
696
701
|
if (!n5) return Boolean(t6.condition(e4, void 0));
|
|
697
|
-
const r7 = { event: e4, mapping: t6, collector: n5, logger: n5.logger, consent:
|
|
702
|
+
const r7 = { event: e4, mapping: t6, collector: n5, logger: n5.logger, consent: he(e4) && e4.consent || n5.consent };
|
|
698
703
|
return Boolean(t6.condition(e4, r7));
|
|
699
704
|
});
|
|
700
705
|
};
|
|
@@ -702,84 +707,84 @@ async function Qe(e4, t4, n5) {
|
|
|
702
707
|
const u3 = t4[a4];
|
|
703
708
|
return u3 && (u3[c2] || (c2 = "*"), s4 = f2(u3[c2])), s4 || (a4 = "*", c2 = "*", s4 = f2(t4[a4]?.[c2])), s4 && (i5 = `${a4} ${c2}`), { eventMapping: s4, mappingKey: i5 };
|
|
704
709
|
}
|
|
705
|
-
async function
|
|
706
|
-
if (!
|
|
707
|
-
const r6 =
|
|
710
|
+
async function ot(e4, t4 = {}, n5 = {}) {
|
|
711
|
+
if (!de(e4)) return;
|
|
712
|
+
const r6 = he(e4) && e4.consent || n5.consent || n5.collector?.consent, o4 = n5.event ?? (he(e4) ? e4 : {});
|
|
708
713
|
if (!n5.collector) throw new Error("getMappingValue: context.collector is required");
|
|
709
|
-
const s4 = { event: o4, mapping: t4, collector: n5.collector, logger: n5.collector.logger, consent: r6 }, i5 =
|
|
714
|
+
const s4 = { event: o4, mapping: t4, collector: n5.collector, logger: n5.collector.logger, consent: r6 }, i5 = ue(t4) ? t4 : [t4];
|
|
710
715
|
for (const t5 of i5) {
|
|
711
|
-
const r7 = await
|
|
712
|
-
if (e5 instanceof
|
|
716
|
+
const r7 = await tt(st, (e5) => {
|
|
717
|
+
if (e5 instanceof nt) throw e5;
|
|
713
718
|
n5.collector && n5.collector.status.failed++, s4.logger.error("mapping processing failed", { event: o4, error: e5 });
|
|
714
719
|
})(e4, t5, { ...s4, mapping: t5 });
|
|
715
|
-
if (
|
|
720
|
+
if (de(r7)) return r7;
|
|
716
721
|
}
|
|
717
722
|
}
|
|
718
|
-
async function
|
|
719
|
-
return (
|
|
723
|
+
async function st(e4, t4, n5) {
|
|
724
|
+
return (ue(t4) ? t4 : [t4]).reduce(async (t5, r6) => {
|
|
720
725
|
const o4 = await t5;
|
|
721
726
|
if (o4) return o4;
|
|
722
|
-
const s4 =
|
|
727
|
+
const s4 = be(r6) ? { key: r6 } : r6;
|
|
723
728
|
if (!Object.keys(s4).length) return;
|
|
724
729
|
const { condition: i5, consent: a4, fn: c2, key: f2, loop: u3, map: l3, set: p3, validate: d2, value: m3 } = s4, g3 = { ...n5, mapping: r6 };
|
|
725
|
-
if (i5 && !await
|
|
726
|
-
if (e5 instanceof
|
|
730
|
+
if (i5 && !await tt(i5, (e5) => {
|
|
731
|
+
if (e5 instanceof nt) throw e5;
|
|
727
732
|
return g3.logger.error("mapping condition failed", { event: g3.event, error: e5 }), false;
|
|
728
733
|
})(e4, g3)) return;
|
|
729
|
-
if (a4 && !
|
|
730
|
-
let v2 =
|
|
731
|
-
if (c2 && (v2 = await
|
|
732
|
-
if (e5 instanceof
|
|
734
|
+
if (a4 && !Oe(a4, g3.consent)) return m3;
|
|
735
|
+
let v2 = de(m3) ? m3 : e4;
|
|
736
|
+
if (c2 && (v2 = await tt(c2, (e5) => {
|
|
737
|
+
if (e5 instanceof nt) throw e5;
|
|
733
738
|
g3.logger.error("mapping fn failed", { event: g3.event, error: e5 });
|
|
734
|
-
})(e4, g3)), f2 && (v2 =
|
|
735
|
-
const [t6, n6] = u3, r7 = "this" === t6 ? [e4] : await
|
|
736
|
-
|
|
739
|
+
})(e4, g3)), f2 && (v2 = ke(e4, f2, m3)), u3) {
|
|
740
|
+
const [t6, n6] = u3, r7 = "this" === t6 ? [e4] : await ot(e4, t6, g3);
|
|
741
|
+
ue(r7) && (v2 = (await Promise.all(r7.map((e5) => ot(e5, n6, g3)))).filter(de));
|
|
737
742
|
} else l3 ? v2 = await Object.entries(l3).reduce(async (t6, [n6, r7]) => {
|
|
738
|
-
const o5 = await t6, s5 = await
|
|
739
|
-
return
|
|
740
|
-
}, Promise.resolve({})) : p3 && (v2 = await Promise.all(p3.map((t6) =>
|
|
741
|
-
d2 && !await
|
|
742
|
-
if (e5 instanceof
|
|
743
|
+
const o5 = await t6, s5 = await ot(e4, r7, g3);
|
|
744
|
+
return de(s5) && (o5[n6] = s5), o5;
|
|
745
|
+
}, Promise.resolve({})) : p3 && (v2 = await Promise.all(p3.map((t6) => st(e4, t6, g3))));
|
|
746
|
+
d2 && !await tt(d2, (e5) => {
|
|
747
|
+
if (e5 instanceof nt) throw e5;
|
|
743
748
|
return g3.logger.error("mapping validate failed", { event: g3.event, error: e5 }), false;
|
|
744
749
|
})(v2, g3) && (v2 = void 0);
|
|
745
|
-
const h3 =
|
|
746
|
-
return
|
|
750
|
+
const h3 = Qe(v2);
|
|
751
|
+
return de(h3) ? h3 : Qe(m3);
|
|
747
752
|
}, Promise.resolve(void 0));
|
|
748
753
|
}
|
|
749
|
-
async function
|
|
754
|
+
async function it(e4, t4, n5) {
|
|
750
755
|
t4.policy && await Promise.all(Object.entries(t4.policy).map(async ([t5, r7]) => {
|
|
751
|
-
const o5 = await
|
|
752
|
-
e4 =
|
|
756
|
+
const o5 = await ot(e4, r7, { collector: n5, event: e4 });
|
|
757
|
+
e4 = $e(e4, t5, o5);
|
|
753
758
|
}));
|
|
754
|
-
const { eventMapping: r6, mappingKey: o4 } = await
|
|
759
|
+
const { eventMapping: r6, mappingKey: o4 } = await rt(e4, t4.mapping, n5);
|
|
755
760
|
r6?.policy && await Promise.all(Object.entries(r6.policy).map(async ([t5, r7]) => {
|
|
756
|
-
const o5 = await
|
|
757
|
-
e4 =
|
|
761
|
+
const o5 = await ot(e4, r7, { collector: n5, event: e4 });
|
|
762
|
+
e4 = $e(e4, t5, o5);
|
|
758
763
|
}));
|
|
759
|
-
let s4 = t4.data && await
|
|
764
|
+
let s4 = t4.data && await ot(e4, t4.data, { collector: n5, event: e4 });
|
|
760
765
|
const i5 = Boolean(r6?.silent);
|
|
761
766
|
if (r6) {
|
|
762
767
|
if (r6.ignore) return { event: e4, data: s4, mapping: r6, mappingKey: o4, ignore: true, silent: i5 };
|
|
763
768
|
if (r6.name && (e4.name = r6.name), r6.data) {
|
|
764
|
-
const t5 = r6.data && await
|
|
765
|
-
s4 =
|
|
769
|
+
const t5 = r6.data && await ot(e4, r6.data, { collector: n5, event: e4 });
|
|
770
|
+
s4 = he(s4) && he(t5) ? ce(s4, t5) : t5;
|
|
766
771
|
}
|
|
767
772
|
}
|
|
768
773
|
const a4 = r6?.include ?? t4.include;
|
|
769
774
|
if (a4 && a4.length > 0) {
|
|
770
|
-
const t5 =
|
|
771
|
-
Object.keys(t5).length > 0 && (s4 =
|
|
775
|
+
const t5 = je(e4, a4);
|
|
776
|
+
Object.keys(t5).length > 0 && (s4 = he(s4) ? ce(t5, s4) : s4 ?? t5);
|
|
772
777
|
}
|
|
773
|
-
if (r6?.remove &&
|
|
778
|
+
if (r6?.remove && he(s4)) for (const e5 of r6.remove) s4 = Ae(s4, e5);
|
|
774
779
|
return { event: e4, data: s4, mapping: r6, mappingKey: o4, ignore: false, silent: i5 };
|
|
775
780
|
}
|
|
776
|
-
function
|
|
777
|
-
return void 0 === e4 ||
|
|
781
|
+
function gt(e4) {
|
|
782
|
+
return void 0 === e4 || ye(e4, "") ? e4 : JSON.stringify(e4);
|
|
778
783
|
}
|
|
779
|
-
function
|
|
780
|
-
return
|
|
784
|
+
function vt(e4 = {}) {
|
|
785
|
+
return ce({ "Content-Type": "application/json; charset=utf-8" }, e4);
|
|
781
786
|
}
|
|
782
|
-
function
|
|
787
|
+
function bt(e4, t4, n5, r6) {
|
|
783
788
|
const o4 = e4;
|
|
784
789
|
return function(...e5) {
|
|
785
790
|
let s4;
|
|
@@ -800,7 +805,7 @@ function gt(e4, t4, n5, r6) {
|
|
|
800
805
|
return s4;
|
|
801
806
|
};
|
|
802
807
|
}
|
|
803
|
-
function
|
|
808
|
+
function wt(e4, t4) {
|
|
804
809
|
if (t4 >= 1) return true;
|
|
805
810
|
if (t4 <= 0) return false;
|
|
806
811
|
return (function(e5) {
|
|
@@ -809,7 +814,7 @@ function vt(e4, t4) {
|
|
|
809
814
|
return t5 >>> 0;
|
|
810
815
|
})(e4) / 4294967295 < t4;
|
|
811
816
|
}
|
|
812
|
-
function
|
|
817
|
+
function kt(e4, t4) {
|
|
813
818
|
const n5 = "function" == typeof t4 ? t4 : () => t4;
|
|
814
819
|
return function(t5) {
|
|
815
820
|
const r6 = n5();
|
|
@@ -817,7 +822,7 @@ function ht(e4, t4) {
|
|
|
817
822
|
const o4 = r6.level ?? "standard";
|
|
818
823
|
if ("off" === o4) return;
|
|
819
824
|
const s4 = r6.sample, i5 = "number" == typeof s4 && Number.isFinite(s4) ? s4 : 1;
|
|
820
|
-
if (t5.eventId && !
|
|
825
|
+
if (t5.eventId && !wt(t5.eventId, i5)) return;
|
|
821
826
|
const a4 = r6.includeIn ?? "trace" === o4, c2 = r6.includeOut ?? "trace" === o4, f2 = r6.includeMappingKey ?? "trace" === o4, u3 = { ...t5 };
|
|
822
827
|
a4 || delete u3.inEvent, c2 || (delete u3.outEvent, delete u3.calls), f2 || delete u3.mappingKey, "trace" !== o4 && u3.error?.message && u3.error.message.length > 256 && (u3.error = { ...u3.error, message: u3.error.message.slice(0, 256) + "\u2026" });
|
|
823
828
|
try {
|
|
@@ -826,7 +831,7 @@ function ht(e4, t4) {
|
|
|
826
831
|
}
|
|
827
832
|
};
|
|
828
833
|
}
|
|
829
|
-
function
|
|
834
|
+
function At(e4) {
|
|
830
835
|
const t4 = e4.now ?? (() => Date.now()), { traceUntil: n5 } = e4;
|
|
831
836
|
if ("string" == typeof n5 && n5.length > 0) {
|
|
832
837
|
const r7 = Date.parse(n5);
|
|
@@ -837,8 +842,8 @@ function bt(e4) {
|
|
|
837
842
|
const o4 = e4.observe?.sample ?? 1;
|
|
838
843
|
return { flowId: e4.flowId, level: r6, sample: o4 };
|
|
839
844
|
}
|
|
840
|
-
function
|
|
841
|
-
if (!
|
|
845
|
+
function It(e4) {
|
|
846
|
+
if (!St.test(e4)) return null;
|
|
842
847
|
const t4 = e4.length % 4 == 0 ? "" : "=".repeat(4 - e4.length % 4), n5 = e4.replace(/-/g, "+").replace(/_/g, "/") + t4, r6 = globalThis.atob;
|
|
843
848
|
if (!r6) return null;
|
|
844
849
|
try {
|
|
@@ -849,13 +854,13 @@ function kt(e4) {
|
|
|
849
854
|
return null;
|
|
850
855
|
}
|
|
851
856
|
}
|
|
852
|
-
function
|
|
857
|
+
function jt(e4) {
|
|
853
858
|
const t4 = new Uint8Array(e4.length);
|
|
854
859
|
for (let n5 = 0; n5 < e4.length; n5++) t4[n5] = e4.charCodeAt(n5);
|
|
855
860
|
return t4;
|
|
856
861
|
}
|
|
857
|
-
function
|
|
858
|
-
const t4 =
|
|
862
|
+
function xt(e4) {
|
|
863
|
+
const t4 = It(e4);
|
|
859
864
|
if (!t4) return null;
|
|
860
865
|
const n5 = (function(e5) {
|
|
861
866
|
let t5 = "";
|
|
@@ -873,35 +878,35 @@ function At(e4) {
|
|
|
873
878
|
return null;
|
|
874
879
|
}
|
|
875
880
|
}
|
|
876
|
-
function
|
|
881
|
+
function Ot(e4) {
|
|
877
882
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
|
|
878
883
|
}
|
|
879
|
-
function
|
|
884
|
+
function Et(e4) {
|
|
880
885
|
if (!e4) return null;
|
|
881
886
|
const t4 = e4.split("."), [n5, r6, o4] = t4;
|
|
882
887
|
if (3 !== t4.length || !n5 || !r6 || !o4) return null;
|
|
883
|
-
const s4 =
|
|
884
|
-
if (!
|
|
888
|
+
const s4 = xt(n5);
|
|
889
|
+
if (!Ot(s4)) return null;
|
|
885
890
|
const i5 = s4.kid, a4 = s4.alg;
|
|
886
891
|
if ("string" != typeof i5 || "ES256" !== a4) return null;
|
|
887
|
-
const c2 =
|
|
892
|
+
const c2 = xt(r6);
|
|
888
893
|
if (!(function(e5) {
|
|
889
|
-
if (!
|
|
894
|
+
if (!Ot(e5)) return false;
|
|
890
895
|
const t5 = e5;
|
|
891
|
-
return "string" == typeof t5.iss && Array.isArray(t5.aud) && t5.aud.every((e6) => "string" == typeof e6) && "number" == typeof t5.iat && "number" == typeof t5.sxp && "string" == typeof t5.art &&
|
|
896
|
+
return "string" == typeof t5.iss && Array.isArray(t5.aud) && t5.aud.every((e6) => "string" == typeof e6) && "number" == typeof t5.iat && "number" == typeof t5.sxp && "string" == typeof t5.art && St.test(t5.art) && "string" == typeof t5.sri && "string" == typeof t5.pb && "activate" === t5.cap && "string" == typeof t5.jti && "string" == typeof t5.pid && (void 0 === t5.ses || "string" == typeof t5.ses) && (void 0 === t5.sb || "string" == typeof t5.sb);
|
|
892
897
|
})(c2)) return null;
|
|
893
|
-
const f2 =
|
|
894
|
-
return f2 && 64 === f2.byteLength ? { grant: c2, kid: i5, signed:
|
|
898
|
+
const f2 = It(o4);
|
|
899
|
+
return f2 && 64 === f2.byteLength ? { grant: c2, kid: i5, signed: jt(`${n5}.${r6}`), signature: f2 } : null;
|
|
895
900
|
}
|
|
896
|
-
async function
|
|
897
|
-
const n5 =
|
|
901
|
+
async function Tt(e4, t4) {
|
|
902
|
+
const n5 = Et(e4);
|
|
898
903
|
if (!n5) return { ok: false, reason: "malformed" };
|
|
899
904
|
const { grant: r6, kid: o4, signed: s4, signature: i5 } = n5;
|
|
900
905
|
if (r6.iss !== t4.iss) return { ok: false, reason: "foreign-issuer" };
|
|
901
906
|
if ("activate" !== r6.cap) return { ok: false, reason: "cap-mismatch" };
|
|
902
907
|
if (1e3 * r6.iat > t4.now + 6e4) return { ok: false, reason: "expired" };
|
|
903
|
-
if (1e3 * r6.sxp - 1e3 * r6.iat >
|
|
904
|
-
const a4 = "url" === t4.source ? Math.min(1e3 * r6.iat +
|
|
908
|
+
if (1e3 * r6.sxp - 1e3 * r6.iat > Nt) return { ok: false, reason: "expired" };
|
|
909
|
+
const a4 = "url" === t4.source ? Math.min(1e3 * r6.iat + _t, 1e3 * r6.sxp) : 1e3 * r6.sxp;
|
|
905
910
|
if (t4.now >= a4) return { ok: false, reason: "expired" };
|
|
906
911
|
if (void 0 !== t4.origin && !r6.aud.includes(t4.origin)) return { ok: false, reason: "aud-mismatch" };
|
|
907
912
|
if (t4.acceptForeign) {
|
|
@@ -919,7 +924,7 @@ async function Ot(e4, t4) {
|
|
|
919
924
|
const u3 = t4.crypto ?? globalThis.crypto, l3 = u3?.subtle;
|
|
920
925
|
if (!l3) return { ok: false, reason: "no-subtle" };
|
|
921
926
|
const p3 = (function(e5) {
|
|
922
|
-
return
|
|
927
|
+
return It(e5);
|
|
923
928
|
})(f2.spki);
|
|
924
929
|
if (!p3) return { ok: false, reason: "kid-mismatch" };
|
|
925
930
|
try {
|
|
@@ -930,13 +935,13 @@ async function Ot(e4, t4) {
|
|
|
930
935
|
}
|
|
931
936
|
return { ok: true, grant: r6 };
|
|
932
937
|
}
|
|
933
|
-
function
|
|
934
|
-
return
|
|
938
|
+
function un() {
|
|
939
|
+
return fn;
|
|
935
940
|
}
|
|
936
|
-
function
|
|
937
|
-
|
|
941
|
+
function ln(e4) {
|
|
942
|
+
fn = e4;
|
|
938
943
|
}
|
|
939
|
-
function
|
|
944
|
+
function pn(e4, t4) {
|
|
940
945
|
if (0 === e4.observers.size) return;
|
|
941
946
|
const n5 = Array.from(e4.observers);
|
|
942
947
|
for (const e5 of n5) try {
|
|
@@ -944,7 +949,7 @@ function cn(e4, t4) {
|
|
|
944
949
|
} catch {
|
|
945
950
|
}
|
|
946
951
|
}
|
|
947
|
-
function
|
|
952
|
+
function dn(e4) {
|
|
948
953
|
const t4 = e4.batchMs, n5 = "number" == typeof t4 && Number.isFinite(t4) && t4 > 0 ? Math.floor(t4) : 50, r6 = e4.batchSize, o4 = "number" == typeof r6 && Number.isFinite(r6) && r6 >= 1 ? Math.floor(r6) : 50, s4 = e4.maxBodyBytes, i5 = "number" == typeof s4 && Number.isFinite(s4) && s4 >= 1 ? Math.floor(s4) : 6e4, a4 = e4.fetch ?? ((e5, t5) => globalThis.fetch(e5, t5)), c2 = e4.onError ?? (() => {
|
|
949
954
|
}), f2 = {};
|
|
950
955
|
for (const [t5, n6] of Object.entries(e4.headers ?? {})) {
|
|
@@ -991,10 +996,10 @@ function fn(e4) {
|
|
|
991
996
|
u3.push({ ...e5, seq: ++p3 }), u3.length >= o4 ? g3() : null === l3 && (l3 = setTimeout(g3, n5));
|
|
992
997
|
};
|
|
993
998
|
}
|
|
994
|
-
function
|
|
999
|
+
function Sn(e4) {
|
|
995
1000
|
return "string" == typeof e4 || Array.isArray(e4) && e4.every((e5) => "string" == typeof e5) ? e4 : void 0;
|
|
996
1001
|
}
|
|
997
|
-
async function
|
|
1002
|
+
async function In(e4, t4) {
|
|
998
1003
|
const n5 = t4?.version || "latest", r6 = t4?.timeout || 1e4, o4 = new AbortController(), s4 = setTimeout(() => o4.abort(), r6), i5 = o4.signal, a4 = t4?.client ? { "X-Walkeros-Client": t4.client } : void 0;
|
|
999
1004
|
try {
|
|
1000
1005
|
if (t4?.baseUrl) {
|
|
@@ -1005,7 +1010,7 @@ async function kn(e4, t4) {
|
|
|
1005
1010
|
return { packageName: n6.package || e5, version: "string" == typeof n6.version ? n6.version : t5, ...void 0 !== n6.description && { description: n6.description }, ...void 0 !== n6.type && { type: n6.type }, ...void 0 !== c2 && { platform: c2 }, schemas: r9, examples: o7, ...void 0 !== n6.docs && { docs: n6.docs }, ...void 0 !== n6.source && { source: n6.source }, ...s5 && Object.keys(s5).length > 0 ? { hints: s5 } : {}, hintKeys: i6, exampleSummaries: a5 };
|
|
1006
1011
|
})(e4, n5, await o6.json());
|
|
1007
1012
|
}
|
|
1008
|
-
const r7 = `https://cdn.jsdelivr.net/npm/${e4}@${n5}`, o5 = await
|
|
1013
|
+
const r7 = `https://cdn.jsdelivr.net/npm/${e4}@${n5}`, o5 = await jn(`${r7}/package.json`, i5, a4);
|
|
1009
1014
|
return (function(e5, t5, n6, r8) {
|
|
1010
1015
|
const o6 = r8.$meta || {}, s5 = r8.schemas || {}, i6 = r8.examples || {}, a5 = r8.hints, c2 = a5 ? Object.keys(a5) : [], f2 = [], u3 = i6.step || {};
|
|
1011
1016
|
for (const [e6, t6] of Object.entries(u3)) {
|
|
@@ -1013,38 +1018,38 @@ async function kn(e4, t4) {
|
|
|
1013
1018
|
"string" == typeof n7?.description && (r9.description = n7.description), f2.push(r9);
|
|
1014
1019
|
}
|
|
1015
1020
|
const l3 = "string" == typeof o6.docs ? o6.docs : void 0, p3 = "string" == typeof o6.source ? o6.source : void 0;
|
|
1016
|
-
return { packageName: e5, version: "string" == typeof n6.version ? n6.version : t5, description: "string" == typeof n6.description ? n6.description : void 0, type: "string" == typeof o6.type ? o6.type : void 0, platform:
|
|
1017
|
-
})(e4, n5, o5, await
|
|
1021
|
+
return { packageName: e5, version: "string" == typeof n6.version ? n6.version : t5, description: "string" == typeof n6.description ? n6.description : void 0, type: "string" == typeof o6.type ? o6.type : void 0, platform: Sn(o6.platform), schemas: s5, examples: i6, ...l3 ? { docs: l3 } : {}, ...p3 ? { source: p3 } : {}, ...a5 && Object.keys(a5).length > 0 ? { hints: a5 } : {}, hintKeys: c2, exampleSummaries: f2 };
|
|
1022
|
+
})(e4, n5, o5, await jn(`${r7}/dist/walkerOS.json`, i5, a4));
|
|
1018
1023
|
} finally {
|
|
1019
1024
|
clearTimeout(s4);
|
|
1020
1025
|
}
|
|
1021
1026
|
}
|
|
1022
|
-
async function
|
|
1027
|
+
async function jn(e4, t4, n5) {
|
|
1023
1028
|
const r6 = await fetch(e4, { signal: t4, ...n5 && { headers: n5 } });
|
|
1024
1029
|
if (!r6.ok) throw new Error(`Failed to fetch ${e4} (HTTP ${r6.status})`);
|
|
1025
1030
|
return await r6.json();
|
|
1026
1031
|
}
|
|
1027
|
-
async function
|
|
1028
|
-
const n5 = await
|
|
1032
|
+
async function xn(e4, t4) {
|
|
1033
|
+
const n5 = await In(e4, t4);
|
|
1029
1034
|
return { packageName: n5.packageName, version: n5.version, type: n5.type, platform: n5.platform, schemas: n5.schemas, examples: n5.examples, ...n5.hints ? { hints: n5.hints } : {} };
|
|
1030
1035
|
}
|
|
1031
|
-
function
|
|
1032
|
-
const t4 = (e4.startsWith(
|
|
1036
|
+
function Mn(e4) {
|
|
1037
|
+
const t4 = (e4.startsWith(_n) ? e4.slice(5) : e4).split(".");
|
|
1033
1038
|
return t4.some((e5) => "" === e5) ? [] : t4;
|
|
1034
1039
|
}
|
|
1035
|
-
function
|
|
1036
|
-
if (!e4.startsWith(
|
|
1040
|
+
function Tn(e4) {
|
|
1041
|
+
if (!e4.startsWith(Nn)) return null;
|
|
1037
1042
|
const t4 = e4.slice(5).split("."), [n5, r6, o4] = t4;
|
|
1038
1043
|
return 3 === t4.length && n5 && r6 && o4 ? { pb: n5, ses: r6, secret: o4 } : null;
|
|
1039
1044
|
}
|
|
1040
|
-
function
|
|
1045
|
+
function Dn(e4) {
|
|
1041
1046
|
if (void 0 === e4 || "*" === e4) return () => true;
|
|
1042
1047
|
if ("and" in e4) {
|
|
1043
|
-
const t4 = e4.and.map(
|
|
1048
|
+
const t4 = e4.and.map(Dn);
|
|
1044
1049
|
return (e5) => t4.every((t5) => t5(e5));
|
|
1045
1050
|
}
|
|
1046
1051
|
if ("or" in e4) {
|
|
1047
|
-
const t4 = e4.or.map(
|
|
1052
|
+
const t4 = e4.or.map(Dn);
|
|
1048
1053
|
return (e5) => t4.some((t5) => t5(e5));
|
|
1049
1054
|
}
|
|
1050
1055
|
return (function(e5) {
|
|
@@ -1075,75 +1080,75 @@ function Cn(e4) {
|
|
|
1075
1080
|
}
|
|
1076
1081
|
})(n5, r6);
|
|
1077
1082
|
return (e6) => {
|
|
1078
|
-
const n6 =
|
|
1083
|
+
const n6 = ke(e6, t4), r7 = s4(n6);
|
|
1079
1084
|
return o4 ? !r7 : r7;
|
|
1080
1085
|
};
|
|
1081
1086
|
})(e4);
|
|
1082
1087
|
}
|
|
1083
|
-
function
|
|
1088
|
+
function Fn(e4) {
|
|
1084
1089
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4) && ("match" in e4 || "next" in e4 || "one" in e4 || "many" in e4);
|
|
1085
1090
|
}
|
|
1086
|
-
function
|
|
1087
|
-
return Array.isArray(e4) && e4.length > 0 && e4.every((e5) =>
|
|
1091
|
+
function Un(e4) {
|
|
1092
|
+
return Array.isArray(e4) && e4.length > 0 && e4.every((e5) => Fn(e5));
|
|
1088
1093
|
}
|
|
1089
|
-
function
|
|
1094
|
+
function Ln(e4) {
|
|
1090
1095
|
return e4.map((e5) => {
|
|
1091
1096
|
if ("string" == typeof e5) return { match: () => true, next: { type: "static", value: e5 } };
|
|
1092
|
-
if (Array.isArray(e5)) return { match: () => true, next:
|
|
1097
|
+
if (Array.isArray(e5)) return { match: () => true, next: qn(e5) ?? { type: "chain", value: [] } };
|
|
1093
1098
|
const t4 = e5;
|
|
1094
|
-
return { match: t4.match ?
|
|
1099
|
+
return { match: t4.match ? Dn(t4.match) : () => true, next: qn(t4) ?? { type: "chain", value: [] } };
|
|
1095
1100
|
});
|
|
1096
1101
|
}
|
|
1097
|
-
function
|
|
1102
|
+
function qn(e4) {
|
|
1098
1103
|
if (null == e4) return;
|
|
1099
1104
|
if ("string" == typeof e4) return { type: "static", value: e4 };
|
|
1100
1105
|
if (Array.isArray(e4)) {
|
|
1101
1106
|
if (0 === e4.length) return;
|
|
1102
|
-
if (
|
|
1107
|
+
if (Un(e4)) return qn({ one: e4 });
|
|
1103
1108
|
if (e4.every((e5) => "string" == typeof e5)) return { type: "chain", value: e4 };
|
|
1104
1109
|
const t5 = [];
|
|
1105
1110
|
for (const n5 of e4) {
|
|
1106
|
-
const e5 =
|
|
1111
|
+
const e5 = qn(n5);
|
|
1107
1112
|
void 0 !== e5 && t5.push(e5);
|
|
1108
1113
|
}
|
|
1109
1114
|
if (0 === t5.length) return;
|
|
1110
1115
|
return { type: "sequence", value: t5 };
|
|
1111
1116
|
}
|
|
1112
1117
|
const t4 = e4;
|
|
1113
|
-
if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match:
|
|
1118
|
+
if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match: Dn(t4.match), next: qn(t4.next) } : qn(t4.next);
|
|
1114
1119
|
if ("one" in t4 && t4.one) {
|
|
1115
|
-
const e5 =
|
|
1116
|
-
return t4.match ? { type: "gate", match:
|
|
1120
|
+
const e5 = Ln(t4.one);
|
|
1121
|
+
return t4.match ? { type: "gate", match: Dn(t4.match), next: { type: "one", routes: e5 } } : { type: "one", routes: e5 };
|
|
1117
1122
|
}
|
|
1118
1123
|
if ("many" in t4 && t4.many) {
|
|
1119
|
-
const e5 =
|
|
1120
|
-
return t4.match ? { type: "gate", match:
|
|
1124
|
+
const e5 = Ln(t4.many);
|
|
1125
|
+
return t4.match ? { type: "gate", match: Dn(t4.match), next: { type: "many", routes: e5 } } : { type: "many", routes: e5 };
|
|
1121
1126
|
}
|
|
1122
|
-
return t4.match ? { type: "gate", match:
|
|
1127
|
+
return t4.match ? { type: "gate", match: Dn(t4.match) } : void 0;
|
|
1123
1128
|
}
|
|
1124
|
-
function
|
|
1129
|
+
function Wn(e4, t4 = {}) {
|
|
1125
1130
|
if (null == e4) return [];
|
|
1126
1131
|
let n5;
|
|
1127
1132
|
if ("object" == typeof e4) {
|
|
1128
|
-
const t5 =
|
|
1129
|
-
t5 ? n5 = t5 : (n5 =
|
|
1130
|
-
} else n5 =
|
|
1133
|
+
const t5 = Kn.get(e4);
|
|
1134
|
+
t5 ? n5 = t5 : (n5 = qn(e4), n5 && Kn.set(e4, n5));
|
|
1135
|
+
} else n5 = qn(e4);
|
|
1131
1136
|
if (!n5) return [];
|
|
1132
|
-
const r6 =
|
|
1137
|
+
const r6 = Bn(n5, t4);
|
|
1133
1138
|
return void 0 === r6 ? [] : Array.isArray(r6) ? r6 : [r6];
|
|
1134
1139
|
}
|
|
1135
|
-
function
|
|
1140
|
+
function Bn(e4, t4 = {}) {
|
|
1136
1141
|
if (e4) {
|
|
1137
1142
|
if ("static" === e4.type) return e4.value;
|
|
1138
1143
|
if ("chain" === e4.type) return e4.value;
|
|
1139
1144
|
if ("gate" === e4.type) {
|
|
1140
1145
|
if (!e4.match(t4)) return;
|
|
1141
|
-
return
|
|
1146
|
+
return Bn(e4.next, t4);
|
|
1142
1147
|
}
|
|
1143
1148
|
if ("sequence" === e4.type) {
|
|
1144
1149
|
const n5 = [];
|
|
1145
1150
|
for (const r6 of e4.value) {
|
|
1146
|
-
const e5 =
|
|
1151
|
+
const e5 = Bn(r6, t4);
|
|
1147
1152
|
void 0 !== e5 && (Array.isArray(e5) ? n5.push(...e5) : n5.push(e5));
|
|
1148
1153
|
}
|
|
1149
1154
|
return n5.length > 0 ? n5 : void 0;
|
|
@@ -1152,44 +1157,44 @@ function Ln(e4, t4 = {}) {
|
|
|
1152
1157
|
const n5 = [];
|
|
1153
1158
|
for (const r6 of e4.routes) {
|
|
1154
1159
|
if (!r6.match(t4)) continue;
|
|
1155
|
-
const e5 =
|
|
1160
|
+
const e5 = Bn(r6.next, t4);
|
|
1156
1161
|
void 0 !== e5 && (Array.isArray(e5) ? n5.push(...e5) : n5.push(e5));
|
|
1157
1162
|
}
|
|
1158
1163
|
return n5.length > 0 ? n5 : void 0;
|
|
1159
1164
|
}
|
|
1160
|
-
for (const n5 of e4.routes) if (n5.match(t4)) return
|
|
1165
|
+
for (const n5 of e4.routes) if (n5.match(t4)) return Bn(n5.next, t4);
|
|
1161
1166
|
}
|
|
1162
1167
|
}
|
|
1163
|
-
function
|
|
1164
|
-
const r6 = { [
|
|
1165
|
-
return void 0 !== t4 && (r6[
|
|
1168
|
+
function Hn(e4, t4, n5 = Date.now) {
|
|
1169
|
+
const r6 = { [Zn]: e4 };
|
|
1170
|
+
return void 0 !== t4 && (r6[Vn] = n5() + t4), r6;
|
|
1166
1171
|
}
|
|
1167
|
-
function
|
|
1172
|
+
function Jn(e4, t4 = Date.now) {
|
|
1168
1173
|
if (void 0 === e4) return;
|
|
1169
|
-
if (null === (n5 = e4) || "object" != typeof n5 || Array.isArray(n5) || !(
|
|
1174
|
+
if (null === (n5 = e4) || "object" != typeof n5 || Array.isArray(n5) || !(Zn in e4)) return { value: e4 };
|
|
1170
1175
|
var n5;
|
|
1171
|
-
const r6 = e4[
|
|
1172
|
-
return "number" == typeof r6 && t4() > r6 ? { expired: true } : { value: e4[
|
|
1176
|
+
const r6 = e4[Vn];
|
|
1177
|
+
return "number" == typeof r6 && t4() > r6 ? { expired: true } : { value: e4[Zn] };
|
|
1173
1178
|
}
|
|
1174
|
-
function
|
|
1179
|
+
function Xn(e4) {
|
|
1175
1180
|
return null !== e4 && "object" == typeof e4 && !Array.isArray(e4);
|
|
1176
1181
|
}
|
|
1177
|
-
function
|
|
1178
|
-
return null === e4 || "string" == typeof e4 || "number" == typeof e4 || "boolean" == typeof e4 || e4 instanceof Uint8Array || (Array.isArray(e4) ? e4.every((e5) => void 0 === e5 ||
|
|
1182
|
+
function nr(e4) {
|
|
1183
|
+
return null === e4 || "string" == typeof e4 || "number" == typeof e4 || "boolean" == typeof e4 || e4 instanceof Uint8Array || (Array.isArray(e4) ? e4.every((e5) => void 0 === e5 || nr(e5)) : !!Xn(e4) && Object.values(e4).every((e5) => void 0 === e5 || nr(e5)));
|
|
1179
1184
|
}
|
|
1180
|
-
function
|
|
1185
|
+
function sr(e4, t4) {
|
|
1181
1186
|
const n5 = { ingest: e4 ?? {} };
|
|
1182
1187
|
return void 0 !== t4 && (n5.event = t4), n5;
|
|
1183
1188
|
}
|
|
1184
|
-
function
|
|
1185
|
-
return { stop: e4.stop ?? false, storeId: e4.store, namespace: e4.namespace, rules: e4.rules.map((e5) => ({ match: e5.match ?
|
|
1189
|
+
function ir(e4) {
|
|
1190
|
+
return { stop: e4.stop ?? false, storeId: e4.store, namespace: e4.namespace, rules: e4.rules.map((e5) => ({ match: e5.match ? Dn(e5.match) : () => true, key: e5.key, ttl: e5.ttl, update: e5.update })) };
|
|
1186
1191
|
}
|
|
1187
|
-
async function
|
|
1192
|
+
async function ar(e4, t4, n5, r6) {
|
|
1188
1193
|
const o4 = e4.rules.find((e5) => e5.match(n5));
|
|
1189
1194
|
if (!o4) return null;
|
|
1190
|
-
const s4 = o4.key.map((e5) => String(
|
|
1195
|
+
const s4 = o4.key.map((e5) => String(ke(n5, e5) ?? ""));
|
|
1191
1196
|
if (s4.every((e5) => "" === e5)) return null;
|
|
1192
|
-
const i5 = s4.join(":"), a4 = r6 ?? e4.namespace, c2 = a4 ? `${a4}:${i5}` : i5, f2 =
|
|
1197
|
+
const i5 = s4.join(":"), a4 = r6 ?? e4.namespace, c2 = a4 ? `${a4}:${i5}` : i5, f2 = Jn(await t4.get(c2));
|
|
1193
1198
|
if (void 0 === f2) return { status: "MISS", key: c2, rule: o4 };
|
|
1194
1199
|
if ("expired" in f2) {
|
|
1195
1200
|
try {
|
|
@@ -1200,61 +1205,61 @@ async function rr(e4, t4, n5, r6) {
|
|
|
1200
1205
|
}
|
|
1201
1206
|
return { status: "HIT", key: c2, value: f2.value, rule: o4 };
|
|
1202
1207
|
}
|
|
1203
|
-
function
|
|
1204
|
-
if (!
|
|
1205
|
-
const o4 = 1e3 * r6, s4 = e4.set(t4,
|
|
1208
|
+
function cr(e4, t4, n5, r6) {
|
|
1209
|
+
if (!nr(n5)) return;
|
|
1210
|
+
const o4 = 1e3 * r6, s4 = e4.set(t4, Hn(n5, o4), o4);
|
|
1206
1211
|
s4 instanceof Promise && s4.catch(() => {
|
|
1207
1212
|
});
|
|
1208
1213
|
}
|
|
1209
|
-
async function
|
|
1214
|
+
async function fr(e4, t4, n5, r6) {
|
|
1210
1215
|
if (!t4) return e4;
|
|
1211
1216
|
let o4 = e4;
|
|
1212
1217
|
for (const [e5, s4] of Object.entries(t4)) {
|
|
1213
|
-
o4 =
|
|
1218
|
+
o4 = $e(o4, e5, await ot(n5, s4, { collector: r6 }));
|
|
1214
1219
|
}
|
|
1215
1220
|
return o4;
|
|
1216
1221
|
}
|
|
1217
|
-
function
|
|
1218
|
-
return
|
|
1222
|
+
function ur(e4) {
|
|
1223
|
+
return ue(e4) ? e4 : [e4];
|
|
1219
1224
|
}
|
|
1220
|
-
async function
|
|
1225
|
+
async function lr(e4, t4, n5, r6) {
|
|
1221
1226
|
let o4 = n5;
|
|
1222
|
-
for (const n6 of e4) await
|
|
1227
|
+
for (const n6 of e4) await tt(async () => {
|
|
1223
1228
|
const e5 = t4(n6.store);
|
|
1224
1229
|
if (!e5) return;
|
|
1225
|
-
const s4 = await
|
|
1226
|
-
if (!
|
|
1230
|
+
const s4 = await ot(o4, n6.key, { collector: r6, event: o4 });
|
|
1231
|
+
if (!be(s4)) return;
|
|
1227
1232
|
const i5 = n6.store ? s4 : `state:${s4}`;
|
|
1228
1233
|
if ("set" === n6.mode) {
|
|
1229
|
-
const t5 = await
|
|
1230
|
-
if (!
|
|
1234
|
+
const t5 = await ot(o4, n6.value, { collector: r6, event: o4 });
|
|
1235
|
+
if (!de(t5)) return;
|
|
1231
1236
|
await e5.set(i5, t5);
|
|
1232
1237
|
} else {
|
|
1233
|
-
const t5 =
|
|
1238
|
+
const t5 = be(a4 = n6.value) ? a4 : he(a4) && be(a4.key) ? a4.key : void 0;
|
|
1234
1239
|
if (!t5) return;
|
|
1235
1240
|
const r7 = await e5.get(i5);
|
|
1236
|
-
if (!
|
|
1237
|
-
o4 =
|
|
1241
|
+
if (!de(r7)) return;
|
|
1242
|
+
o4 = $e(o4, t5, r7);
|
|
1238
1243
|
}
|
|
1239
1244
|
var a4;
|
|
1240
1245
|
}, (e5) => {
|
|
1241
|
-
if (e5 instanceof
|
|
1246
|
+
if (e5 instanceof nt) throw e5;
|
|
1242
1247
|
r6.logger?.error?.("[state] operation failed", e5);
|
|
1243
1248
|
})();
|
|
1244
1249
|
return o4;
|
|
1245
1250
|
}
|
|
1246
|
-
function
|
|
1251
|
+
function vr(e4, t4) {
|
|
1247
1252
|
const n5 = (function(e5) {
|
|
1248
|
-
return /* @__PURE__ */ new Set([...
|
|
1253
|
+
return /* @__PURE__ */ new Set([...pr[e5], ...dr, ...mr[e5]]);
|
|
1249
1254
|
})(t4);
|
|
1250
1255
|
for (const r7 of Object.keys(e4)) if (!n5.has(r7)) return { ok: false, code: "UNKNOWN_KEY", key: r7, reason: `Unknown key "${r7}" on ${t4}. Allowed: ${[...n5].sort().join(", ")}.` };
|
|
1251
1256
|
const r6 = void 0 !== e4.package, o4 = void 0 !== e4.import, s4 = void 0 !== e4.code;
|
|
1252
|
-
return s4 && "string" == typeof e4.code ? { ok: false, code: "OBSOLETE_CODE_STRING", key: "code", reason: `code: "<name>" is no longer supported. Use import: "${e4.code}" with the package field instead.` } : s4 && ("object" != typeof e4.code && "function" != typeof e4.code || null === e4.code || Array.isArray(e4.code)) ? { ok: false, code: "INVALID_CODE_SHAPE", key: "code", reason: "code must be an object ({ push, type?, init? }) or a resolved function value." } : s4 && r6 ? { ok: false, code: "CONFLICT", key: "package", reason: "Cannot specify both `code` and `package`. Use one or the other." } : s4 && o4 ? { ok: false, code: "CONFLICT", key: "import", reason: "Cannot specify both `code` and `import`." } : o4 && !r6 ? { ok: false, code: "MISSING_PACKAGE", key: "import", reason: "`import` requires `package` to be set." } : !o4 || "string" == typeof e4.import &&
|
|
1257
|
+
return s4 && "string" == typeof e4.code ? { ok: false, code: "OBSOLETE_CODE_STRING", key: "code", reason: `code: "<name>" is no longer supported. Use import: "${e4.code}" with the package field instead.` } : s4 && ("object" != typeof e4.code && "function" != typeof e4.code || null === e4.code || Array.isArray(e4.code)) ? { ok: false, code: "INVALID_CODE_SHAPE", key: "code", reason: "code must be an object ({ push, type?, init? }) or a resolved function value." } : s4 && r6 ? { ok: false, code: "CONFLICT", key: "package", reason: "Cannot specify both `code` and `package`. Use one or the other." } : s4 && o4 ? { ok: false, code: "CONFLICT", key: "import", reason: "Cannot specify both `code` and `import`." } : o4 && !r6 ? { ok: false, code: "MISSING_PACKAGE", key: "import", reason: "`import` requires `package` to be set." } : !o4 || "string" == typeof e4.import && gr.test(e4.import) ? { ok: true } : { ok: false, code: "INVALID_IMPORT", key: "import", reason: `import must match ${gr.source}. Got: ${JSON.stringify(e4.import)}.` };
|
|
1253
1258
|
}
|
|
1254
|
-
function
|
|
1259
|
+
function hr(e4, t4) {
|
|
1255
1260
|
return "Transformer" === t4 && (void 0 === e4.code && void 0 === e4.package && void 0 === e4.import && (void 0 !== e4.before || void 0 !== e4.next || void 0 !== e4.cache || void 0 !== e4.state || void 0 !== e4.mapping));
|
|
1256
1261
|
}
|
|
1257
|
-
var e, t, r, i, u, l, m, h, b, T,
|
|
1262
|
+
var e, t, r, i, u, l, m, h, b, T, C, P, R, q, K, W, B, Z, H, Q, ee, ae, Se, Te, Fe, He, nt, St, _t, Nt, Pt, fn, On, _n, Nn, Kn, Zn, Vn, pr, dr, mr, gr;
|
|
1258
1263
|
var init_dist = __esm({
|
|
1259
1264
|
"../core/dist/index.mjs"() {
|
|
1260
1265
|
"use strict";
|
|
@@ -1276,42 +1281,45 @@ var init_dist = __esm({
|
|
|
1276
1281
|
b = {};
|
|
1277
1282
|
t(b, { getStore: () => w, getStoreValue: () => k });
|
|
1278
1283
|
T = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
W =
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1284
|
+
C = /* @__PURE__ */ new Set(["additionalItems", "additionalProperties", "contains", "contentSchema", "else", "if", "items", "not", "propertyNames", "then", "unevaluatedItems", "unevaluatedProperties"]);
|
|
1285
|
+
P = /* @__PURE__ */ new Set(["allOf", "anyOf", "items", "oneOf", "prefixItems"]);
|
|
1286
|
+
R = /* @__PURE__ */ new Set(["properties", "patternProperties", "dependentSchemas", "dependentRequired", "dependencies", "$defs", "definitions"]);
|
|
1287
|
+
q = /^\$var\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)$/;
|
|
1288
|
+
K = /\$var\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)/g;
|
|
1289
|
+
W = /\$env\.([a-zA-Z_][a-zA-Z0-9_]*)(?::([^"}\s]*))?/g;
|
|
1290
|
+
B = /^\$contract\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.(.+))?$/;
|
|
1291
|
+
Z = /^\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?$/;
|
|
1292
|
+
H = /^\$secret\.([A-Z0-9_]+)$/;
|
|
1293
|
+
Q = "__WALKEROS_ENV:";
|
|
1294
|
+
ee = "__WALKEROS_SECRET:";
|
|
1295
|
+
ae = { merge: true, shallow: true, extend: true };
|
|
1296
|
+
Se = { 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 }) };
|
|
1297
|
+
Te = "0123456789abcdef";
|
|
1298
|
+
Fe = /^(?<version>[0-9a-f]{2})-(?<trace>[0-9a-f]{32})-(?<span>[0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
1299
|
+
He = (e4, t4, n5, r6) => {
|
|
1292
1300
|
const o4 = `${l[e4]}${r6.length > 0 ? ` [${r6.join(":")}]` : ""}`, s4 = Object.keys(n5).length > 0, i5 = 0 === e4 ? console.error : 1 === e4 ? console.warn : console.log;
|
|
1293
1301
|
s4 ? i5(o4, t4, n5) : i5(o4, t4);
|
|
1294
1302
|
};
|
|
1295
|
-
|
|
1303
|
+
nt = class e2 extends Error {
|
|
1296
1304
|
constructor(t4, n5) {
|
|
1297
1305
|
super(t4, n5), this.name = "FatalError", Object.setPrototypeOf(this, e2.prototype);
|
|
1298
1306
|
}
|
|
1299
1307
|
};
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1308
|
+
St = /^[A-Za-z0-9_-]+$/;
|
|
1309
|
+
_t = 9e5;
|
|
1310
|
+
Nt = 39e5;
|
|
1311
|
+
Pt = "elbObserve";
|
|
1312
|
+
fn = null;
|
|
1313
|
+
On = "observe";
|
|
1314
|
+
_n = "call:";
|
|
1315
|
+
Nn = "obsw_";
|
|
1316
|
+
Kn = /* @__PURE__ */ new WeakMap();
|
|
1317
|
+
Zn = "__walkeros_cache_v__";
|
|
1318
|
+
Vn = "__walkeros_cache_exp__";
|
|
1319
|
+
pr = { Source: ["code", "package", "import", "before", "next", "cache", "state"], Transformer: ["code", "package", "import", "before", "next", "cache", "state", "mapping"], Destination: ["code", "package", "import", "before", "next", "cache", "state"], Store: ["code", "package", "import", "cache"] };
|
|
1320
|
+
dr = ["config", "env", "variables", "examples", "disabled", "id", "logger", "mock", "chainMocks"];
|
|
1321
|
+
mr = { Source: ["primary"], Transformer: [], Destination: [], Store: [] };
|
|
1322
|
+
gr = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
1315
1323
|
}
|
|
1316
1324
|
});
|
|
1317
1325
|
|
|
@@ -1320,14 +1328,14 @@ import * as r3 from "http";
|
|
|
1320
1328
|
import * as s from "https";
|
|
1321
1329
|
import { createHash as n2 } from "crypto";
|
|
1322
1330
|
function a2(a4, n5, i5 = {}) {
|
|
1323
|
-
const u3 =
|
|
1331
|
+
const u3 = vt(i5.headers), c2 = gt(n5), m3 = i5.method || "POST", d2 = i5.timeout || 5e3;
|
|
1324
1332
|
return new Promise((t4) => {
|
|
1325
1333
|
const e4 = new URL(a4), n6 = "https:" === e4.protocol ? s : r3, i6 = { method: m3, headers: u3 }, p3 = n6.request(e4, i6, (e5) => {
|
|
1326
1334
|
const r6 = [];
|
|
1327
1335
|
e5.on("data", (t5) => {
|
|
1328
1336
|
r6.push(t5);
|
|
1329
1337
|
}), e5.on("end", () => {
|
|
1330
|
-
const s4 = !!(e5.statusCode && e5.statusCode >= 200 && e5.statusCode < 300), a5 = Buffer.concat(r6).toString(), n7 =
|
|
1338
|
+
const s4 = !!(e5.statusCode && e5.statusCode >= 200 && e5.statusCode < 300), a5 = Buffer.concat(r6).toString(), n7 = et(JSON.parse, () => a5)(a5);
|
|
1331
1339
|
t4({ ok: s4, data: n7, error: s4 ? void 0 : `${e5.statusCode} ${e5.statusMessage}` });
|
|
1332
1340
|
});
|
|
1333
1341
|
});
|
|
@@ -1585,7 +1593,7 @@ function createCLILoggerConfig(options = {}) {
|
|
|
1585
1593
|
};
|
|
1586
1594
|
}
|
|
1587
1595
|
function createCLILogger(options = {}) {
|
|
1588
|
-
return
|
|
1596
|
+
return Je(createCLILoggerConfig(options));
|
|
1589
1597
|
}
|
|
1590
1598
|
var init_cli_logger = __esm({
|
|
1591
1599
|
"src/core/cli-logger.ts"() {
|
|
@@ -2066,7 +2074,7 @@ import { z as en } from "zod";
|
|
|
2066
2074
|
function o2(e4, t4, i5 = "draft-7") {
|
|
2067
2075
|
return n3.toJSONSchema(e4, { target: i5 });
|
|
2068
2076
|
}
|
|
2069
|
-
function
|
|
2077
|
+
function J2(e4, t4) {
|
|
2070
2078
|
return n3.object({ data: n3.union([e4, t4]).optional().describe("Data transformation rules") }).partial();
|
|
2071
2079
|
}
|
|
2072
2080
|
function M(e4) {
|
|
@@ -2093,23 +2101,23 @@ function Wi(e4) {
|
|
|
2093
2101
|
function Bi(e4) {
|
|
2094
2102
|
return zi.safeParse(e4);
|
|
2095
2103
|
}
|
|
2096
|
-
function
|
|
2104
|
+
function ln2(e4) {
|
|
2097
2105
|
throw new Error(String(e4));
|
|
2098
2106
|
}
|
|
2099
|
-
function
|
|
2107
|
+
function fn2(e4, t4) {
|
|
2100
2108
|
const i5 = false !== t4?.stripAnnotations, n5 = {}, o4 = /* @__PURE__ */ new Set();
|
|
2101
2109
|
function r6(t5) {
|
|
2102
2110
|
if (n5[t5]) return n5[t5];
|
|
2103
|
-
o4.has(t5) &&
|
|
2111
|
+
o4.has(t5) && ln2(`Circular extend chain detected: ${[...o4, t5].join(" \u2192 ")}`);
|
|
2104
2112
|
const a4 = e4[t5];
|
|
2105
|
-
a4 ||
|
|
2113
|
+
a4 || ln2(`Contract "${t5}" not found`), o4.add(t5);
|
|
2106
2114
|
let s4 = {};
|
|
2107
2115
|
if (a4.extend) {
|
|
2108
2116
|
s4 = (function(e5, t6) {
|
|
2109
2117
|
const i6 = {};
|
|
2110
2118
|
void 0 === e5.tagging && void 0 === t6.tagging || (i6.tagging = t6.tagging ?? e5.tagging);
|
|
2111
2119
|
void 0 === e5.description && void 0 === t6.description || (i6.description = t6.description ?? e5.description);
|
|
2112
|
-
e5.schema && t6.schema ? i6.schema =
|
|
2120
|
+
e5.schema && t6.schema ? i6.schema = gn(e5.schema, t6.schema) : (e5.schema || t6.schema) && (i6.schema = { ...e5.schema || t6.schema });
|
|
2113
2121
|
if (e5.events || t6.events) {
|
|
2114
2122
|
const n6 = {}, o5 = /* @__PURE__ */ new Set([...Object.keys(e5.events || {}), ...Object.keys(t6.events || {})]);
|
|
2115
2123
|
for (const i7 of o5) {
|
|
@@ -2117,7 +2125,7 @@ function pn2(e4, t4) {
|
|
|
2117
2125
|
n6[i7] = {};
|
|
2118
2126
|
for (const e6 of a5) {
|
|
2119
2127
|
const t7 = o6[e6], a6 = r7[e6];
|
|
2120
|
-
n6[i7][e6] = t7 && a6 ?
|
|
2128
|
+
n6[i7][e6] = t7 && a6 ? gn(t7, a6) : { ...t7 || a6 };
|
|
2121
2129
|
}
|
|
2122
2130
|
}
|
|
2123
2131
|
i6.events = n6;
|
|
@@ -2132,13 +2140,13 @@ function pn2(e4, t4) {
|
|
|
2132
2140
|
for (const n6 of Object.keys(e5[i6] || {})) {
|
|
2133
2141
|
let o5 = {};
|
|
2134
2142
|
const r7 = e5["*"]?.["*"];
|
|
2135
|
-
r7 && (o5 =
|
|
2143
|
+
r7 && (o5 = gn(o5, r7));
|
|
2136
2144
|
const a5 = e5["*"]?.[n6];
|
|
2137
|
-
a5 && "*" !== n6 && (o5 =
|
|
2145
|
+
a5 && "*" !== n6 && (o5 = gn(o5, a5));
|
|
2138
2146
|
const s5 = e5[i6]?.["*"];
|
|
2139
|
-
s5 && "*" !== n6 && (o5 =
|
|
2147
|
+
s5 && "*" !== n6 && (o5 = gn(o5, s5));
|
|
2140
2148
|
const c2 = e5[i6]?.[n6];
|
|
2141
|
-
c2 && (o5 =
|
|
2149
|
+
c2 && (o5 = gn(o5, c2)), t6[i6][n6] = o5;
|
|
2142
2150
|
}
|
|
2143
2151
|
}
|
|
2144
2152
|
e5["*"] && (t6["*"] = { ...e5["*"] });
|
|
@@ -2147,7 +2155,7 @@ function pn2(e4, t4) {
|
|
|
2147
2155
|
const e5 = {};
|
|
2148
2156
|
for (const [t6, i6] of Object.entries(s4.events)) {
|
|
2149
2157
|
e5[t6] = {};
|
|
2150
|
-
for (const [n6, o5] of Object.entries(i6)) e5[t6][n6] =
|
|
2158
|
+
for (const [n6, o5] of Object.entries(i6)) e5[t6][n6] = bn2(o5);
|
|
2151
2159
|
}
|
|
2152
2160
|
s4.events = e5;
|
|
2153
2161
|
}
|
|
@@ -2156,23 +2164,28 @@ function pn2(e4, t4) {
|
|
|
2156
2164
|
for (const t5 of Object.keys(e4)) r6(t5);
|
|
2157
2165
|
return n5;
|
|
2158
2166
|
}
|
|
2159
|
-
function
|
|
2167
|
+
function gn(e4, t4) {
|
|
2160
2168
|
const i5 = { ...e4 };
|
|
2161
2169
|
for (const n5 of Object.keys(t4)) {
|
|
2162
2170
|
const o4 = e4[n5], r6 = t4[n5];
|
|
2163
|
-
"required" === n5 && Array.isArray(o4) && Array.isArray(r6) ? i5[n5] = [.../* @__PURE__ */ new Set([...o4, ...r6])] :
|
|
2171
|
+
"required" === n5 && Array.isArray(o4) && Array.isArray(r6) ? i5[n5] = [.../* @__PURE__ */ new Set([...o4, ...r6])] : vn(o4) && vn(r6) ? i5[n5] = gn(o4, r6) : i5[n5] = r6;
|
|
2164
2172
|
}
|
|
2165
2173
|
return i5;
|
|
2166
2174
|
}
|
|
2167
|
-
function
|
|
2175
|
+
function bn2(e4) {
|
|
2168
2176
|
const t4 = {};
|
|
2169
|
-
for (const [i5, n5] of Object.entries(e4))
|
|
2177
|
+
for (const [i5, n5] of Object.entries(e4)) dn2.has(i5) || (mn.has(i5) && vn(n5) ? t4[i5] = hn(n5) : un2.has(i5) && Array.isArray(n5) ? t4[i5] = n5.map((e5) => vn(e5) ? bn2(e5) : e5) : pn3.has(i5) && vn(n5) ? t4[i5] = bn2(n5) : t4[i5] = n5);
|
|
2170
2178
|
return t4;
|
|
2171
2179
|
}
|
|
2172
|
-
function
|
|
2180
|
+
function hn(e4) {
|
|
2181
|
+
const t4 = {};
|
|
2182
|
+
for (const [i5, n5] of Object.entries(e4)) t4[i5] = vn(n5) ? bn2(n5) : n5;
|
|
2183
|
+
return t4;
|
|
2184
|
+
}
|
|
2185
|
+
function vn(e4) {
|
|
2173
2186
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
|
|
2174
2187
|
}
|
|
2175
|
-
function
|
|
2188
|
+
function Sn3(e4, t4) {
|
|
2176
2189
|
let i5;
|
|
2177
2190
|
try {
|
|
2178
2191
|
i5 = JSON.parse(e4);
|
|
@@ -2181,7 +2194,7 @@ function gn(e4, t4) {
|
|
|
2181
2194
|
if (e5 instanceof SyntaxError) {
|
|
2182
2195
|
const i7 = e5.message.match(/position\s+(\d+)/);
|
|
2183
2196
|
if (i7) {
|
|
2184
|
-
return
|
|
2197
|
+
return Jn2(t6, parseInt(i7[1], 10));
|
|
2185
2198
|
}
|
|
2186
2199
|
const n7 = e5.message.match(/line\s+(\d+)\s+column\s+(\d+)/);
|
|
2187
2200
|
if (n7) return { line: parseInt(n7[1], 10), column: parseInt(n7[2], 10) };
|
|
@@ -2192,43 +2205,43 @@ function gn(e4, t4) {
|
|
|
2192
2205
|
}
|
|
2193
2206
|
const n5 = [], o4 = [], r6 = Li.safeParse(i5);
|
|
2194
2207
|
if (!r6.success) for (const t5 of r6.error.issues) {
|
|
2195
|
-
const i6 = t5.path.join("."), o5 =
|
|
2208
|
+
const i6 = t5.path.join("."), o5 = Tn2(e4, t5.path);
|
|
2196
2209
|
n5.push({ message: t5.message, severity: "error", path: i6 || "root", ...o5 });
|
|
2197
2210
|
}
|
|
2198
2211
|
const a4 = (function(e5) {
|
|
2199
|
-
if (!(
|
|
2212
|
+
if (!(Fn2(e5) && "version" in e5 && "flows" in e5 && Fn2(e5.flows))) return;
|
|
2200
2213
|
const t5 = {}, i6 = [], n6 = [], o5 = [], r7 = [], a5 = [], s4 = [];
|
|
2201
2214
|
let c2;
|
|
2202
2215
|
const l3 = Object.keys(e5.flows);
|
|
2203
|
-
|
|
2204
|
-
if (!
|
|
2216
|
+
$n(t5, e5.variables), (function(e6, t6) {
|
|
2217
|
+
if (!Fn2(t6)) return;
|
|
2205
2218
|
let i7;
|
|
2206
2219
|
try {
|
|
2207
|
-
i7 =
|
|
2220
|
+
i7 = fn2(t6, { stripAnnotations: false });
|
|
2208
2221
|
} catch {
|
|
2209
2222
|
return;
|
|
2210
2223
|
}
|
|
2211
2224
|
for (const t7 of Object.values(i7)) {
|
|
2212
2225
|
const i8 = t7.events;
|
|
2213
|
-
if (
|
|
2214
|
-
if (!
|
|
2226
|
+
if (Fn2(i8)) for (const [t8, n7] of Object.entries(i8)) {
|
|
2227
|
+
if (!Fn2(n7)) continue;
|
|
2215
2228
|
let i9 = e6.find((e7) => e7.entity === t8);
|
|
2216
2229
|
i9 || (i9 = { entity: t8, actions: [], properties: {} }, e6.push(i9)), i9.properties || (i9.properties = {});
|
|
2217
|
-
for (const [e7, t9] of Object.entries(n7)) i9.actions.includes(e7) || i9.actions.push(e7), i9.properties[e7] =
|
|
2230
|
+
for (const [e7, t9] of Object.entries(n7)) i9.actions.includes(e7) || i9.actions.push(e7), i9.properties[e7] = An(t9);
|
|
2218
2231
|
}
|
|
2219
2232
|
}
|
|
2220
2233
|
})(s4, e5.contract);
|
|
2221
|
-
for (const s5 of Object.values(e5.flows)) if (
|
|
2234
|
+
for (const s5 of Object.values(e5.flows)) if (Fn2(s5)) {
|
|
2222
2235
|
if (!c2) {
|
|
2223
2236
|
const e6 = s5.config;
|
|
2224
|
-
!
|
|
2237
|
+
!Fn2(e6) || "web" !== e6.platform && "server" !== e6.platform || (c2 = e6.platform);
|
|
2225
2238
|
}
|
|
2226
|
-
|
|
2239
|
+
$n(t5, s5.variables);
|
|
2227
2240
|
for (const e6 of ["sources", "destinations", "transformers"]) {
|
|
2228
2241
|
const r8 = "sources" === e6 ? "source" : "destinations" === e6 ? "destination" : "transformer", l4 = "sources" === e6 ? i6 : "destinations" === e6 ? n6 : o5;
|
|
2229
|
-
if (
|
|
2242
|
+
if (Fn2(s5[e6])) for (const [i7, n7] of Object.entries(s5[e6])) l4.push(i7), Fn2(n7) && ($n(t5, n7.variables), "string" == typeof n7.package && a5.push({ package: n7.package, shortName: i7, type: r8, platform: c2 || "web" }));
|
|
2230
2243
|
}
|
|
2231
|
-
if (
|
|
2244
|
+
if (Fn2(s5.stores)) for (const [e6, i7] of Object.entries(s5.stores)) r7.push(e6), Fn2(i7) && $n(t5, i7.variables);
|
|
2232
2245
|
}
|
|
2233
2246
|
const d2 = { variables: t5, stepNames: { sources: i6, destinations: n6, transformers: o5, stores: r7 }, flowNames: l3 };
|
|
2234
2247
|
c2 && (d2.platform = c2);
|
|
@@ -2239,9 +2252,9 @@ function gn(e4, t4) {
|
|
|
2239
2252
|
return a4 && (t4?.secrets && (a4.secrets = t4.secrets), (function(e5, t5, i6, n6, o5) {
|
|
2240
2253
|
(function(e6, t6, i7) {
|
|
2241
2254
|
let n7;
|
|
2242
|
-
|
|
2243
|
-
for (; null !== (n7 =
|
|
2244
|
-
const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 =
|
|
2255
|
+
Cn2.lastIndex = 0;
|
|
2256
|
+
for (; null !== (n7 = Cn2.exec(e6)); ) {
|
|
2257
|
+
const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 = Mn2(e6, n7.index, t7.length);
|
|
2245
2258
|
i7.push({ message: `Malformed reference "${t7}", use a dot, not a colon: "$${o6}.${r7}".`, severity: "warning", path: t7, ...a5 });
|
|
2246
2259
|
}
|
|
2247
2260
|
})(e5, 0, o5), (function(e6, t6, i7) {
|
|
@@ -2249,170 +2262,170 @@ function gn(e4, t4) {
|
|
|
2249
2262
|
const n7 = /\$var\.(\w+)/g;
|
|
2250
2263
|
let o6;
|
|
2251
2264
|
for (; null !== (o6 = n7.exec(e6)); ) if (!(o6[1] in t6.variables)) {
|
|
2252
|
-
const n8 =
|
|
2265
|
+
const n8 = Mn2(e6, o6.index, o6[0].length);
|
|
2253
2266
|
i7.push({ message: `Unknown variable "$var.${o6[1]}". Defined: ${Object.keys(t6.variables).join(", ") || "none"}`, severity: "warning", path: `$var.${o6[1]}`, ...n8 });
|
|
2254
2267
|
}
|
|
2255
2268
|
})(e5, i6, o5), (function(e6, t6, i7) {
|
|
2256
2269
|
const n7 = t6.stepNames?.stores ?? [];
|
|
2257
2270
|
let o6;
|
|
2258
|
-
|
|
2259
|
-
for (; null !== (o6 =
|
|
2260
|
-
const t7 =
|
|
2271
|
+
yn2.lastIndex = 0;
|
|
2272
|
+
for (; null !== (o6 = yn2.exec(e6)); ) if (!n7.includes(o6[1])) {
|
|
2273
|
+
const t7 = Mn2(e6, o6.index, o6[0].length);
|
|
2261
2274
|
i7.push({ message: `Unknown store "$store.${o6[1]}". Defined: ${n7.join(", ") || "none"}`, severity: "warning", path: `$store.${o6[1]}`, ...t7 });
|
|
2262
2275
|
}
|
|
2263
2276
|
})(e5, i6, o5), (function(e6, t6, i7) {
|
|
2264
2277
|
let n7;
|
|
2265
|
-
|
|
2266
|
-
for (; null !== (n7 =
|
|
2267
|
-
const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 =
|
|
2278
|
+
wn2.lastIndex = 0;
|
|
2279
|
+
for (; null !== (n7 = wn2.exec(e6)); ) {
|
|
2280
|
+
const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 = Mn2(e6, n7.index, t7.length);
|
|
2268
2281
|
r7 ? i7.push({ message: `Malformed $env reference "${t7}". Use ":" for default values, not "=" (e.g., "$env.${o6}:fallback").`, severity: "warning", path: t7, ...a5 }) : /^[A-Z][A-Z0-9_]*$/.test(o6) || i7.push({ message: `$env.${o6} should use UPPER_SNAKE_CASE by convention (e.g., $env.${o6.toUpperCase()}).`, severity: "warning", path: t7, ...a5 });
|
|
2269
2282
|
}
|
|
2270
2283
|
})(e5, 0, o5), (function(e6, t6, i7) {
|
|
2271
2284
|
const n7 = t6.flowNames ?? [];
|
|
2272
2285
|
if (0 === n7.length) return;
|
|
2273
2286
|
let o6;
|
|
2274
|
-
|
|
2275
|
-
for (; null !== (o6 =
|
|
2287
|
+
kn2.lastIndex = 0;
|
|
2288
|
+
for (; null !== (o6 = kn2.exec(e6)); ) {
|
|
2276
2289
|
const t7 = o6[0], r7 = o6[1];
|
|
2277
2290
|
if (!n7.includes(r7)) {
|
|
2278
|
-
const a5 =
|
|
2291
|
+
const a5 = Mn2(e6, o6.index, t7.length);
|
|
2279
2292
|
i7.push({ message: `Unknown flow "$flow.${r7}". Defined: ${n7.join(", ")}`, severity: "warning", path: t7, ...a5 });
|
|
2280
2293
|
}
|
|
2281
2294
|
}
|
|
2282
2295
|
})(e5, i6, o5), (function(e6, t6, i7, n7, o6) {
|
|
2283
2296
|
const r7 = i7.secrets;
|
|
2284
|
-
if (!
|
|
2297
|
+
if (!Fn2(t6) || !Fn2(t6.flows)) return;
|
|
2285
2298
|
for (const i8 of Object.values(t6.flows)) {
|
|
2286
|
-
if (!
|
|
2287
|
-
const t7 = i8.config, a5 = !
|
|
2299
|
+
if (!Fn2(i8)) continue;
|
|
2300
|
+
const t7 = i8.config, a5 = !Fn2(t7) || "web" !== t7.platform && "server" !== t7.platform ? void 0 : t7.platform, s4 = JSON.stringify(i8);
|
|
2288
2301
|
let c2;
|
|
2289
|
-
for (
|
|
2290
|
-
const t8 = c2[0], i9 = c2[1], s5 = e6.indexOf(t8), l3 = -1 === s5 ? { line: 1, column: 1 } :
|
|
2302
|
+
for (xn2.lastIndex = 0; null !== (c2 = xn2.exec(s4)); ) {
|
|
2303
|
+
const t8 = c2[0], i9 = c2[1], s5 = e6.indexOf(t8), l3 = -1 === s5 ? { line: 1, column: 1 } : Mn2(e6, s5, t8.length);
|
|
2291
2304
|
"web" !== a5 ? r7 && !r7.includes(i9) && o6.push({ message: `Unknown secret "$secret.${i9}"; not in the project's registered secrets.`, severity: "warning", path: t8, ...l3 }) : n7.push({ message: `Secret "$secret.${i9}" cannot be used in a web flow \u2014 secrets are never sent to the browser; use a server flow.`, severity: "error", path: t8, ...l3 });
|
|
2292
2305
|
}
|
|
2293
2306
|
}
|
|
2294
2307
|
})(e5, t5, i6, n6, o5);
|
|
2295
2308
|
})(e4, i5, a4, n5, o4)), (function(e5, t5, i6) {
|
|
2296
|
-
if (!
|
|
2309
|
+
if (!Fn2(t5) || !Fn2(t5.flows)) return;
|
|
2297
2310
|
for (const n6 of Object.values(t5.flows)) {
|
|
2298
|
-
if (!
|
|
2299
|
-
const t6 =
|
|
2300
|
-
t6 &&
|
|
2311
|
+
if (!Fn2(n6)) continue;
|
|
2312
|
+
const t6 = Fn2(n6.stores) ? n6.stores : void 0;
|
|
2313
|
+
t6 && On2(e5, t6, i6), t6 && Fn2(n6.transformers) && In3(e5, n6.transformers, t6, i6);
|
|
2301
2314
|
}
|
|
2302
2315
|
})(e4, i5, o4), { valid: 0 === n5.length, errors: n5, warnings: o4, context: a4 };
|
|
2303
2316
|
}
|
|
2304
|
-
function
|
|
2305
|
-
return
|
|
2317
|
+
function En2(e4) {
|
|
2318
|
+
return Fn2(e4.config) && true === e4.config.file;
|
|
2306
2319
|
}
|
|
2307
|
-
function
|
|
2308
|
-
for (const [n5, o4] of Object.entries(t4))
|
|
2320
|
+
function On2(e4, t4, i5) {
|
|
2321
|
+
for (const [n5, o4] of Object.entries(t4)) Fn2(o4) && En2(o4) && void 0 !== o4.cache && i5.push({ message: `Store "${n5}" sets file: true and cache. The cache holds structured values; caching a byte-serving store offers no benefit. Remove cache or unset file.`, severity: "warning", path: `stores.${n5}`, ...Rn(e4, n5) });
|
|
2309
2322
|
}
|
|
2310
|
-
function
|
|
2323
|
+
function In3(e4, t4, i5, n5) {
|
|
2311
2324
|
for (const o4 of Object.values(t4)) {
|
|
2312
|
-
if (!
|
|
2313
|
-
if (o4.package !==
|
|
2314
|
-
if (!
|
|
2325
|
+
if (!Fn2(o4)) continue;
|
|
2326
|
+
if (o4.package !== Pn) continue;
|
|
2327
|
+
if (!Fn2(o4.env)) continue;
|
|
2315
2328
|
const t5 = o4.env.store;
|
|
2316
2329
|
if ("string" != typeof t5) continue;
|
|
2317
|
-
const r6 =
|
|
2330
|
+
const r6 = Dn2.exec(t5);
|
|
2318
2331
|
if (!r6) continue;
|
|
2319
2332
|
const a4 = r6[1], s4 = i5[a4];
|
|
2320
|
-
if (!
|
|
2333
|
+
if (!Fn2(s4)) continue;
|
|
2321
2334
|
const c2 = s4.package;
|
|
2322
|
-
"string" == typeof c2 &&
|
|
2335
|
+
"string" == typeof c2 && jn2.includes(c2) && (En2(s4) || n5.push({ message: `transformer-file serves byte-exact assets; set config.file: true on store "${a4}".`, severity: "warning", path: `stores.${a4}`, ...Rn(e4, a4) }));
|
|
2323
2336
|
}
|
|
2324
2337
|
}
|
|
2325
|
-
function
|
|
2338
|
+
function Rn(e4, t4) {
|
|
2326
2339
|
const i5 = e4.indexOf(`"${t4}"`);
|
|
2327
|
-
return -1 === i5 ? { line: 1, column: 1 } :
|
|
2340
|
+
return -1 === i5 ? { line: 1, column: 1 } : Jn2(e4, i5);
|
|
2328
2341
|
}
|
|
2329
|
-
function
|
|
2342
|
+
function Jn2(e4, t4) {
|
|
2330
2343
|
let i5 = 1, n5 = 1;
|
|
2331
2344
|
for (let o4 = 0; o4 < t4 && o4 < e4.length; o4++) "\n" === e4[o4] ? (i5++, n5 = 1) : n5++;
|
|
2332
2345
|
return { line: i5, column: n5 };
|
|
2333
2346
|
}
|
|
2334
|
-
function
|
|
2335
|
-
const n5 =
|
|
2347
|
+
function Mn2(e4, t4, i5) {
|
|
2348
|
+
const n5 = Jn2(e4, t4), o4 = Jn2(e4, t4 + i5);
|
|
2336
2349
|
return { line: n5.line, column: n5.column, endLine: o4.line, endColumn: o4.column };
|
|
2337
2350
|
}
|
|
2338
|
-
function
|
|
2351
|
+
function Tn2(e4, t4) {
|
|
2339
2352
|
if (0 === t4.length) return { line: 1, column: 1 };
|
|
2340
2353
|
const i5 = t4[t4.length - 1];
|
|
2341
2354
|
if ("string" == typeof i5) {
|
|
2342
2355
|
const t5 = `"${i5}"`, n5 = e4.lastIndexOf(t5);
|
|
2343
|
-
if (-1 !== n5) return
|
|
2356
|
+
if (-1 !== n5) return Jn2(e4, n5);
|
|
2344
2357
|
}
|
|
2345
2358
|
return { line: 1, column: 1 };
|
|
2346
2359
|
}
|
|
2347
|
-
function
|
|
2360
|
+
function Fn2(e4) {
|
|
2348
2361
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
|
|
2349
2362
|
}
|
|
2350
|
-
function
|
|
2351
|
-
if (
|
|
2363
|
+
function $n(e4, t4) {
|
|
2364
|
+
if (Fn2(t4)) for (const [i5, n5] of Object.entries(t4)) e4[i5] = n5;
|
|
2352
2365
|
}
|
|
2353
|
-
function
|
|
2366
|
+
function An(e4) {
|
|
2354
2367
|
const t4 = {};
|
|
2355
|
-
if (!
|
|
2356
|
-
const i5 =
|
|
2357
|
-
if (!
|
|
2368
|
+
if (!Fn2(e4)) return t4;
|
|
2369
|
+
const i5 = Fn2(e4.properties) ? e4.properties.data : void 0;
|
|
2370
|
+
if (!Fn2(i5)) return t4;
|
|
2358
2371
|
const n5 = Array.isArray(i5.required) ? i5.required.filter((e5) => "string" == typeof e5) : [], o4 = i5.properties;
|
|
2359
|
-
if (!
|
|
2372
|
+
if (!Fn2(o4)) return t4;
|
|
2360
2373
|
for (const [e5, i6] of Object.entries(o4)) {
|
|
2361
2374
|
const o5 = {};
|
|
2362
|
-
|
|
2375
|
+
Fn2(i6) && ("string" == typeof i6.type && (o5.type = i6.type), "string" == typeof i6.description && (o5.description = i6.description)), n5.includes(e5) && (o5.required = true), t4[e5] = o5;
|
|
2363
2376
|
}
|
|
2364
2377
|
return t4;
|
|
2365
2378
|
}
|
|
2366
|
-
function
|
|
2379
|
+
function zn(e4, t4) {
|
|
2367
2380
|
const i5 = [], n5 = {};
|
|
2368
2381
|
for (const [t5, o5] of Object.entries(e4)) {
|
|
2369
2382
|
o5.required && i5.push(t5);
|
|
2370
2383
|
const e5 = { type: o5.type };
|
|
2371
2384
|
if (o5.description && (e5.description = o5.description), o5.pattern && (e5.pattern = o5.pattern), void 0 !== o5.minLength && (e5.minLength = o5.minLength), void 0 !== o5.maxLength && (e5.maxLength = o5.maxLength), void 0 !== o5.minimum && (e5.minimum = o5.minimum), void 0 !== o5.maximum && (e5.maximum = o5.maximum), o5.enum && (e5.enum = [...o5.enum]), void 0 !== o5.default && (e5.default = o5.default), "object" === o5.type && o5.properties) {
|
|
2372
2385
|
const t6 = {};
|
|
2373
|
-
for (const [e6, i6] of Object.entries(o5.properties)) t6[e6] =
|
|
2386
|
+
for (const [e6, i6] of Object.entries(o5.properties)) t6[e6] = Ln2(i6);
|
|
2374
2387
|
e5.properties = t6;
|
|
2375
2388
|
}
|
|
2376
|
-
"array" === o5.type && o5.items && (e5.items =
|
|
2389
|
+
"array" === o5.type && o5.items && (e5.items = Ln2(o5.items)), n5[t5] = e5;
|
|
2377
2390
|
}
|
|
2378
2391
|
const o4 = { type: "object", properties: n5 };
|
|
2379
2392
|
return t4 && (o4.title = t4), i5.length > 0 && (o4.required = i5), o4;
|
|
2380
2393
|
}
|
|
2381
|
-
function
|
|
2394
|
+
function Ln2(e4) {
|
|
2382
2395
|
const t4 = { type: e4.type };
|
|
2383
2396
|
if (e4.description && (t4.description = e4.description), e4.pattern && (t4.pattern = e4.pattern), void 0 !== e4.minLength && (t4.minLength = e4.minLength), void 0 !== e4.maxLength && (t4.maxLength = e4.maxLength), void 0 !== e4.minimum && (t4.minimum = e4.minimum), void 0 !== e4.maximum && (t4.maximum = e4.maximum), e4.enum && (t4.enum = [...e4.enum]), void 0 !== e4.default && (t4.default = e4.default), "object" === e4.type && e4.properties) {
|
|
2384
2397
|
const i5 = {};
|
|
2385
|
-
for (const [t5, n5] of Object.entries(e4.properties)) i5[t5] =
|
|
2398
|
+
for (const [t5, n5] of Object.entries(e4.properties)) i5[t5] = Ln2(n5);
|
|
2386
2399
|
t4.properties = i5;
|
|
2387
2400
|
}
|
|
2388
|
-
return "array" === e4.type && e4.items && (t4.items =
|
|
2401
|
+
return "array" === e4.type && e4.items && (t4.items = Ln2(e4.items)), t4;
|
|
2389
2402
|
}
|
|
2390
|
-
function
|
|
2391
|
-
const i5 = { type: "array", items:
|
|
2403
|
+
function qn3(e4, t4) {
|
|
2404
|
+
const i5 = { type: "array", items: Ln2(e4) };
|
|
2392
2405
|
return void 0 !== t4?.minItems && (i5.minItems = t4.minItems), void 0 !== t4?.maxItems && (i5.maxItems = t4.maxItems), t4?.description && (i5.description = t4.description), t4?.title && (i5.title = t4.title), i5;
|
|
2393
2406
|
}
|
|
2394
|
-
function
|
|
2407
|
+
function Nn2(e4, t4 = "string", i5) {
|
|
2395
2408
|
const n5 = { type: t4, enum: [...e4] };
|
|
2396
2409
|
return i5?.description && (n5.description = i5.description), i5?.title && (n5.title = i5.title), n5;
|
|
2397
2410
|
}
|
|
2398
|
-
function
|
|
2399
|
-
return
|
|
2411
|
+
function Wn2(e4, t4, i5) {
|
|
2412
|
+
return qn3({ type: "object" }, { minItems: 2, maxItems: 2, description: i5 || "Tuple with exactly 2 elements [source, transform]" });
|
|
2400
2413
|
}
|
|
2401
|
-
function
|
|
2414
|
+
function Bn2(e4) {
|
|
2402
2415
|
const t4 = n3.toJSONSchema(e4, { target: "draft-7" });
|
|
2403
|
-
return
|
|
2416
|
+
return Un2(t4), t4;
|
|
2404
2417
|
}
|
|
2405
|
-
function
|
|
2418
|
+
function Un2(e4) {
|
|
2406
2419
|
const t4 = e4.properties;
|
|
2407
2420
|
if (t4 && "object" == typeof t4) {
|
|
2408
2421
|
Array.isArray(e4.required) && (e4.required = e4.required.filter((e5) => {
|
|
2409
2422
|
const i5 = t4[e5];
|
|
2410
2423
|
return !(i5 && "object" == typeof i5 && "default" in i5);
|
|
2411
2424
|
}));
|
|
2412
|
-
for (const [e5, i5] of Object.entries(t4)) i5 && "object" == typeof i5 && ("object" === i5.type && i5.properties && "string" != typeof i5.title && (i5.title = e5),
|
|
2425
|
+
for (const [e5, i5] of Object.entries(t4)) i5 && "object" == typeof i5 && ("object" === i5.type && i5.properties && "string" != typeof i5.title && (i5.title = e5), Un2(i5));
|
|
2413
2426
|
}
|
|
2414
2427
|
}
|
|
2415
|
-
var e3, t3, i3, r4, a3, s2, c, l2, d, p, u2, m2, f, g2, b2, h2, v, S, y2, w2, k2, C2, x, j, P2, D2,
|
|
2428
|
+
var e3, t3, i3, r4, a3, s2, c, l2, d, p, u2, m2, f, g2, b2, h2, v, S, y2, w2, k2, C2, x, j, P2, D2, E2, O, I, R3, $, A, z3, L2, q2, N3, W2, B3, U3, _2, H2, V2, Z3, G, K3, Q2, X2, Y2, ee3, te3, ie3, ne3, oe2, re3, ae3, se3, ce2, le2, de2, pe, ue2, me, fe, ge2, be2, he2, ve2, Se2, ye2, we2, ke2, Ce2, xe, je2, Pe2, De2, Ee, Oe2, Ie2, Re, Je3, Me2, Te2, Fe3, $e2, Ae2, ze2, Le2, qe, Ne3, We3, Be2, Ue3, _e, He3, Ve3, Ze3, Ge3, Ke3, Qe3, Xe2, Ye3, et3, tt3, it3, nt3, ot3, rt3, at2, st3, ct2, lt2, dt2, pt2, ut2, mt2, ft2, gt3, bt3, ht2, vt3, St3, yt2, wt3, kt3, Ct2, xt3, jt3, Pt3, Dt2, Et3, Ot3, It3, Rt, Jt2, Mt2, Tt3, Ft, $t2, At3, zt, Lt2, qt2, Nt3, Wt2, Bt, Ut, _t3, Ht2, Vt2, Zt, Gt2, Kt, Qt2, Xt, Yt2, ei, ti, ii, ni, oi, ri, ai, si, ci, li, di, pi, ui, mi, fi, gi, bi, hi, vi, Si, yi, wi, ki, Ci, xi, ji, Di, Ei, Oi, Ii, Ri, Ji, Mi, Ti, Fi, $i, Ai, zi, Li, Ui, _i, Hi, Vi, Zi, Gi, Ki, Qi, Xi, Yi, tn, nn, on, rn, an2, sn, cn, dn2, pn3, un2, mn, yn2, wn2, kn2, Cn2, xn2, jn2, Pn, Dn2, Hn2;
|
|
2416
2429
|
var init_dev = __esm({
|
|
2417
2430
|
"../core/dist/dev.mjs"() {
|
|
2418
2431
|
"use strict";
|
|
@@ -2421,7 +2434,7 @@ var init_dev = __esm({
|
|
|
2421
2434
|
for (var n5 in i5) e3(t4, n5, { get: i5[n5], enumerable: true });
|
|
2422
2435
|
};
|
|
2423
2436
|
i3 = {};
|
|
2424
|
-
t3(i3, { BaseContextConfig: () => A, CacheRuleSchema: () => Ye3, CacheSchema: () => et3, CacheSchemas: () => Ze3, ClickIdEntrySchema: () => rn, CodeSchema: () => tn, CollectorSchemas: () => Ot3, ConsentSchema: () =>
|
|
2437
|
+
t3(i3, { BaseContextConfig: () => A, CacheRuleSchema: () => Ye3, CacheSchema: () => et3, CacheSchemas: () => Ze3, ClickIdEntrySchema: () => rn, CodeSchema: () => tn, CollectorSchemas: () => Ot3, ConsentSchema: () => Z3, ContractActionsSchema: () => Ji, ContractRuleSchema: () => Ti, ContractSchema: () => Fi, ContractSchemaEntry: () => Ri, Counter: () => d, CredentialsSchema: () => sn, DeepPartialEventSchema: () => ie3, DestinationSchemas: () => Me2, DestinationsMapConfig: () => q2, EntitiesSchema: () => Y2, EntitySchema: () => X2, EventCacheRuleSchema: () => Ge3, EventCacheSchema: () => Ke3, EventSchema: () => ee3, FlowBundlePackageSchema: () => vi, FlowBundleSchema: () => Si, FlowCodeSchema: () => yi, FlowConfigSchema: () => Ai, FlowDestinationSchema: () => Oi, FlowJsonSchema: () => Li, FlowSchema: () => zi, FlowSchemas: () => fi, FlowSourceSchema: () => Di, FlowStoreSchema: () => Ii, FlowTransformerSchema: () => Ei, GenericEnvConfig: () => R3, GenericSettingsConfig: () => I, HandlersConfig: () => x, HintSchema: () => nn, HintsSchema: () => on, IdConfig: () => D2, Identifier: () => c, InitConfig: () => E2, LoggerConfigSchema: () => nt3, LoggerHandlerSchema: () => it3, LoopSchema: () => fe, MapSchema: () => be2, MappingResultSchema: () => Ce2, MappingSchemas: () => pe, MatchExpressionSchema: () => Ae2, MatcherSchemas: () => Te2, OptionalPrimitiveValue: () => u2, OrderedPropertiesSchema: () => H2, PartialEventSchema: () => te3, PolicySchema: () => ve2, PrimaryConfig: () => O, PrimitiveValue: () => p, ProcessingControlConfig: () => z3, PropertiesSchema: () => _2, PropertySchema: () => U3, PropertyTypeSchema: () => B3, QueueConfig: () => P2, RequiredBoolean: () => s2, RequiredNumber: () => a3, RequiredString: () => r4, RouteSchema: () => Be2, RouteWithoutManySchema: () => Ve3, RuleSchema: () => ye2, RulesSchema: () => we2, RuntimeInstanceConfig: () => $, ServiceAccountSchema: () => an2, SetSchema: () => ge2, SourceSchema: () => Q2, SourceSchemas: () => Ut, SourceTypeSchema: () => V2, SourcesMapConfig: () => L2, StateSchema: () => tt3, StoreCacheRuleSchema: () => Qe3, StoreCacheSchema: () => Xe2, StoreSchemas: () => li, Timestamp: () => l2, TransformerSchemas: () => oi, UserSchema: () => G, UtilitySchemas: () => m2, ValidateEventsSchema: () => ji, ValueConfigSchema: () => he2, ValueSchema: () => ue2, ValuesSchema: () => me, VerboseConfig: () => j, WalkerOSSchemas: () => N3, configJsonSchema: () => Ui, consentJsonSchema: () => de2, contractJsonSchema: () => Xi, contractRuleJsonSchema: () => Qi, createArraySchema: () => qn3, createConsentConfig: () => F3, createDataTransformationConfig: () => J2, createEnumSchema: () => Nn2, createMappingRulesConfig: () => M, createObjectSchema: () => zn, createPolicyConfig: () => T3, createTupleSchema: () => Wn2, credentialsJsonSchema: () => cn, destinationJsonSchema: () => Zi, entityJsonSchema: () => ce2, eventJsonSchema: () => ne3, flowConfigJsonSchema: () => Hi, flowJsonSchema: () => _i, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee, orderedPropertiesJsonSchema: () => se3, parseConfig: () => qi, parseFlow: () => Wi, partialEventJsonSchema: () => oe2, policyJsonSchema: () => Oe2, propertiesJsonSchema: () => ae3, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Re, safeParseConfig: () => Ni, safeParseFlow: () => Bi, setJsonSchema: () => De2, sourceJsonSchema: () => Vi, sourceTypeJsonSchema: () => le2, storeJsonSchema: () => Ki, transformerJsonSchema: () => Gi, userJsonSchema: () => re3, validateEventsJsonSchema: () => Yi, validateFlowConfig: () => Sn3, valueConfigJsonSchema: () => je2, valueJsonSchema: () => xe, z: () => n3, zodToSchema: () => Bn2 });
|
|
2425
2438
|
r4 = n3.string();
|
|
2426
2439
|
a3 = n3.number();
|
|
2427
2440
|
s2 = n3.boolean();
|
|
@@ -2446,8 +2459,8 @@ var init_dev = __esm({
|
|
|
2446
2459
|
j = n3.object({ verbose: n3.boolean().describe("Enable verbose logging for debugging").optional() }).partial();
|
|
2447
2460
|
P2 = n3.object({ queue: n3.boolean().describe("Whether to queue events when consent is not granted").optional() }).partial();
|
|
2448
2461
|
D2 = n3.object({}).partial();
|
|
2449
|
-
|
|
2450
|
-
|
|
2462
|
+
E2 = n3.object({ init: n3.boolean().describe("Whether to initialize immediately").optional(), loadScript: n3.boolean().describe("Whether to load external script (for web destinations)").optional() }).partial();
|
|
2463
|
+
O = n3.object({ primary: n3.boolean().describe("Mark as primary (only one can be primary)").optional() }).partial();
|
|
2451
2464
|
I = n3.object({ settings: n3.any().optional().describe("Implementation-specific configuration") }).partial();
|
|
2452
2465
|
R3 = n3.object({ env: n3.any().optional().describe("Environment dependencies (platform-specific)") }).partial();
|
|
2453
2466
|
$ = n3.object({ type: n3.string().optional().describe("Instance type identifier"), config: n3.unknown().describe("Instance configuration") }).partial();
|
|
@@ -2456,78 +2469,78 @@ var init_dev = __esm({
|
|
|
2456
2469
|
L2 = n3.object({ sources: n3.record(n3.string(), n3.unknown()).describe("Map of source instances") }).partial();
|
|
2457
2470
|
q2 = n3.object({ destinations: n3.record(n3.string(), n3.unknown()).describe("Map of destination instances") }).partial();
|
|
2458
2471
|
N3 = {};
|
|
2459
|
-
t3(N3, { ConsentSchema: () =>
|
|
2460
|
-
|
|
2461
|
-
U3 = n3.lazy(() => n3.union([
|
|
2472
|
+
t3(N3, { ConsentSchema: () => Z3, DeepPartialEventSchema: () => ie3, EntitiesSchema: () => Y2, EntitySchema: () => X2, EventSchema: () => ee3, OrderedPropertiesSchema: () => H2, PartialEventSchema: () => te3, PropertiesSchema: () => _2, PropertySchema: () => U3, PropertyTypeSchema: () => B3, SourceFieldsSchema: () => K3, SourceSchema: () => Q2, SourceTypeSchema: () => V2, UserSchema: () => G, consentJsonSchema: () => de2, entityJsonSchema: () => ce2, eventJsonSchema: () => ne3, orderedPropertiesJsonSchema: () => se3, partialEventJsonSchema: () => oe2, propertiesJsonSchema: () => ae3, sourceTypeJsonSchema: () => le2, userJsonSchema: () => re3 });
|
|
2473
|
+
B3 = n3.lazy(() => n3.union([n3.boolean(), n3.string(), n3.number(), n3.record(n3.string(), U3)])).meta({ id: "WalkerOSPropertyType", title: "WalkerOS.PropertyType", description: "Base property value types (boolean, string, number, or nested Property record)." });
|
|
2474
|
+
U3 = n3.lazy(() => n3.union([B3, n3.array(B3)])).meta({ id: "WalkerOSProperty", title: "WalkerOS.Property", description: "PropertyType or an array of PropertyType. Recursive structure for nested objects and arrays." });
|
|
2462
2475
|
_2 = n3.record(n3.string(), U3.optional()).meta({ id: "WalkerOSProperties", title: "WalkerOS.Properties", description: "Flexible property collection with optional values." }).describe("Flexible property collection with optional values");
|
|
2463
2476
|
H2 = n3.record(n3.string(), n3.tuple([U3, n3.number()]).optional()).meta({ id: "WalkerOSOrderedProperties", title: "WalkerOS.OrderedProperties", description: "Ordered properties with [value, order] tuples for priority control." }).describe("Ordered properties with [value, order] tuples for priority control");
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
Q2 = _2.and(
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
ee3 = n3.object({ name: n3.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: _2.describe("Event-specific properties"), context: H2.describe("Ordered context properties with priorities"), globals: _2.describe("Global properties shared across events"), custom: _2.describe("Custom implementation-specific properties"), user:
|
|
2477
|
+
V2 = 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");
|
|
2478
|
+
Z3 = 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)");
|
|
2479
|
+
G = _2.and(n3.object({ id: n3.string().optional().describe("User identifier"), device: n3.string().optional().describe("Device identifier"), session: n3.string().optional().describe("Session identifier"), hash: n3.string().optional().describe("Hashed identifier"), address: n3.string().optional().describe("User address"), email: n3.string().email().optional().describe("User email address"), phone: n3.string().optional().describe("User phone number"), userAgent: n3.string().optional().describe("Browser user agent string"), browser: n3.string().optional().describe("Browser name"), browserVersion: n3.string().optional().describe("Browser version"), deviceType: n3.string().optional().describe("Device type (mobile, desktop, tablet)"), os: n3.string().optional().describe("Operating system"), osVersion: n3.string().optional().describe("Operating system version"), screenSize: n3.string().optional().describe("Screen dimensions"), language: n3.string().optional().describe("User language"), country: n3.string().optional().describe("User country"), region: n3.string().optional().describe("User region/state"), city: n3.string().optional().describe("User city"), zip: n3.string().optional().describe("User postal code"), timezone: n3.string().optional().describe("User timezone"), ip: n3.string().optional().describe("User IP address"), internal: n3.boolean().optional().describe("Internal user flag (employee, test user)") })).meta({ id: "WalkerOSUser", title: "WalkerOS.User", description: "User identification and attributes." }).describe("User identification and properties");
|
|
2480
|
+
K3 = n3.object({ type: n3.string().describe("Source kind (browser, dataLayer, gtag, ...)"), platform: n3.string().optional().describe("Runtime platform (web, server, app, ios, android, terminal, ...)"), version: n3.string().optional().describe("Deployment version of the source emitter"), schema: n3.string().optional().describe('Event model spec version (collector defaults to "4")'), count: n3.number().int().nonnegative().optional().describe("Emission sequence per run"), trace: n3.string().optional().describe("Trace id shared by every event of a run (W3C trace-id shape)"), release: n3.record(n3.string(), n3.string()).optional().describe("Per-flow config release map, keyed by flow name; accumulates across walkerOS crossings"), url: n3.string().optional(), referrer: n3.string().optional(), tool: n3.string().optional(), command: n3.string().optional() });
|
|
2481
|
+
Q2 = _2.and(K3).meta({ id: "WalkerOSSource", title: "WalkerOS.Source", description: "Event source information (origin of the event)." }).describe("Event source information");
|
|
2482
|
+
X2 = n3.lazy(() => n3.object({ entity: n3.string().describe("Entity name"), data: _2.describe("Entity-specific properties"), nested: n3.array(X2).optional().describe("Nested child entities"), context: H2.optional().describe("Entity context data") })).meta({ id: "WalkerOSEntity", title: "WalkerOS.Entity", description: "Nested entity structure with recursive nesting support." }).describe("Nested entity structure with recursive nesting support");
|
|
2483
|
+
Y2 = n3.array(X2).meta({ id: "WalkerOSEntities", title: "WalkerOS.Entities", description: "Array of nested entities." }).describe("Array of nested entities");
|
|
2484
|
+
ee3 = n3.object({ name: n3.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: _2.describe("Event-specific properties"), context: H2.describe("Ordered context properties with priorities"), globals: _2.describe("Global properties shared across events"), custom: _2.describe("Custom implementation-specific properties"), user: G.describe("User identification and attributes"), nested: Y2.describe("Related nested entities"), consent: Z3.describe("Consent states at event time"), id: c.describe("W3C span_id, 16 lowercase hex characters"), trigger: r4.describe("Event trigger identifier"), entity: r4.describe("Parsed entity from event name"), action: r4.describe("Parsed action from event name"), timestamp: l2.describe("Unix timestamp in milliseconds since epoch"), timing: a3.describe("Event processing timing information"), source: Q2.describe("Event source information") }).meta({ id: "WalkerOSEvent", title: "WalkerOS.Event", description: "Complete walkerOS event structure." }).describe("Complete walkerOS event structure");
|
|
2472
2485
|
te3 = ee3.partial().meta({ id: "WalkerOSPartialEvent", title: "WalkerOS.PartialEvent", description: "Partial event structure with all fields optional." }).describe("Partial event structure with all fields optional");
|
|
2473
2486
|
ie3 = ee3.partial().meta({ id: "WalkerOSDeepPartialEvent", title: "WalkerOS.DeepPartialEvent", description: "Partial event structure with all top-level fields optional." }).describe("Partial event structure with all top-level fields optional");
|
|
2474
2487
|
ne3 = o2(ee3);
|
|
2475
2488
|
oe2 = o2(te3);
|
|
2476
|
-
re3 = o2(
|
|
2489
|
+
re3 = o2(G);
|
|
2477
2490
|
ae3 = o2(_2);
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
le2 = o2(
|
|
2481
|
-
de2 = o2(
|
|
2482
|
-
|
|
2483
|
-
t3(
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
ge2 = n3.lazy(() => n3.array(
|
|
2488
|
-
be2 = n3.lazy(() => n3.record(n3.string(),
|
|
2489
|
-
he2 = W2 = n3.object({ key: n3.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'), value: n3.union([n3.string(), n3.number(), n3.boolean()]).optional().describe("Static primitive value"), fn: n3.string().optional().describe("Custom transformation function as string (serialized)"), map: be2.optional().describe("Object mapping: transform event data to structured output"), loop:
|
|
2490
|
-
ve2 = n3.record(n3.string(),
|
|
2491
|
-
Se2 = n3.object({ name: n3.string().nullable().optional(), data: n3.union([
|
|
2492
|
-
ye2 = n3.object({ name: n3.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), data: n3.union([
|
|
2491
|
+
se3 = o2(H2);
|
|
2492
|
+
ce2 = o2(X2);
|
|
2493
|
+
le2 = o2(V2);
|
|
2494
|
+
de2 = o2(Z3);
|
|
2495
|
+
pe = {};
|
|
2496
|
+
t3(pe, { ConfigSchema: () => ke2, LoopSchema: () => fe, MapSchema: () => be2, PolicySchema: () => ve2, ResultSchema: () => Ce2, RulePatchSchema: () => Se2, RuleSchema: () => ye2, RulesSchema: () => we2, SetSchema: () => ge2, ValueConfigSchema: () => he2, ValueSchema: () => ue2, ValuesSchema: () => me, configJsonSchema: () => Je3, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee, policyJsonSchema: () => Oe2, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Re, setJsonSchema: () => De2, valueConfigJsonSchema: () => je2, valueJsonSchema: () => xe });
|
|
2497
|
+
ue2 = n3.lazy(() => n3.union([n3.string().describe('String value or property path (e.g., "data.id")'), n3.number().describe("Numeric value"), n3.boolean().describe("Boolean value"), n3.lazy(() => W2), n3.array(ue2).describe("Array of values")])).meta({ id: "MappingValue", title: "Mapping.Value", description: "Polymorphic transform primitive used in every mapping field. A string path, constant, operator object (map/loop/set/condition/consent), or array of values." });
|
|
2498
|
+
me = n3.array(ue2).meta({ id: "MappingValues", title: "Mapping.Values", description: "Array of transformation values." }).describe("Array of transformation values");
|
|
2499
|
+
fe = n3.lazy(() => n3.tuple([ue2, ue2]).describe("Loop transformation: [source, transform] tuple for array processing")).meta({ id: "MappingLoop", title: "Mapping.Loop", description: "Loop tuple [source, transform] for iterating and transforming arrays." });
|
|
2500
|
+
ge2 = n3.lazy(() => n3.array(ue2).describe("Set: Array of values for selection or combination")).meta({ id: "MappingSet", title: "Mapping.Set", description: "Set: array of values for selection or combination." });
|
|
2501
|
+
be2 = n3.lazy(() => n3.record(n3.string(), ue2).describe("Map: Object mapping keys to transformation values")).meta({ id: "MappingMap", title: "Mapping.Map", description: "Map: object mapping keys to transformation values." });
|
|
2502
|
+
he2 = W2 = n3.object({ key: n3.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'), value: n3.union([n3.string(), n3.number(), n3.boolean()]).optional().describe("Static primitive value"), fn: n3.string().optional().describe("Custom transformation function as string (serialized)"), map: be2.optional().describe("Object mapping: transform event data to structured output"), loop: fe.optional().describe("Loop transformation: [source, transform] for array processing"), set: ge2.optional().describe("Set of values: combine or select from multiple values"), consent: Z3.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");
|
|
2503
|
+
ve2 = n3.record(n3.string(), ue2).meta({ id: "MappingPolicy", title: "Mapping.Policy", description: "Policy rules for event pre-processing (key \u2192 value transformation)." }).describe("Policy rules for event pre-processing (key \u2192 value mapping)");
|
|
2504
|
+
Se2 = n3.object({ name: n3.string().nullable().optional(), data: n3.union([ue2, me]).nullable().optional(), settings: n3.unknown().nullable().optional(), condition: n3.string().nullable().optional(), consent: Z3.nullable().optional(), policy: ve2.nullable().optional(), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).nullable().optional(), include: n3.array(n3.string()).nullable().optional(), ignore: n3.boolean().nullable().optional(), silent: n3.boolean().nullable().optional() }).meta({ id: "MappingRulePatch", title: "Mapping.RulePatch", description: "Partial rule deep-merged onto a package-shipped default; a null value clears the inherited field." }).describe("Partial rule for `extend`; null clears an inherited field");
|
|
2505
|
+
ye2 = n3.object({ name: n3.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), data: n3.union([ue2, me]).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: Z3.optional().describe("Required consent states to process this event"), policy: ve2.optional().describe("Event-level policy overrides (applied after config-level policy)"), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).optional().describe("Batch scheduling: bare number is the debounce wait window (legacy); object form supports wait/size/age."), include: n3.array(n3.string()).optional().describe('Event sections (e.g. ["context", "globals"]) flattened into context.data'), ignore: n3.boolean().optional().describe("Skip the event entirely. No push, no side effects. Use for suppression."), silent: n3.boolean().optional().describe("Run side effects (settings.identify, ...) but suppress the destination default push call."), extend: Se2.optional().describe("Merge mode: a partial rule deep-merged onto the package-shipped default at this key (instead of replacing it). A null value clears an inherited field."), remove: n3.array(n3.string()).optional().describe("Dotted paths stripped from the produced data payload after evaluation (applied last).") }).meta({ id: "MappingRule", title: "Mapping.Rule", description: "Configuration for transforming a single event at one stage of the flow (source or destination)." }).describe("Mapping rule for specific entity-action combination");
|
|
2493
2506
|
we2 = n3.record(n3.string(), n3.record(n3.string(), n3.union([ye2, n3.array(ye2)])).optional()).meta({ id: "MappingRules", title: "Mapping.Rules", description: 'Event mapping rules tree: entity \u2192 action \u2192 Rule (or Rule[]). Use "*" as wildcard for entity or action.' }).describe('Event mapping rules: entity \u2192 action \u2192 Rule. Keys match event name split by space. Use "*" as wildcard for entity or action. Priority: exact > entity wildcard > action wildcard > global wildcard (*\u2192*).');
|
|
2494
|
-
ke2 = n3.object({ consent:
|
|
2507
|
+
ke2 = n3.object({ consent: Z3.optional().describe("Required consent states to process any events"), data: n3.union([ue2, me]).optional().describe("Global data transformation applied to all events"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), mapping: we2.optional().describe("Entity-action specific mapping rules"), policy: ve2.optional().describe("Pre-processing policy rules applied before mapping") }).meta({ id: "MappingConfig", title: "Mapping.Config", description: "Shared mapping configuration (consent, data, include, mapping, policy)." }).describe("Shared mapping configuration for sources and destinations");
|
|
2495
2508
|
Ce2 = n3.object({ eventMapping: ye2.optional().describe("Resolved mapping rule for event"), mappingKey: n3.string().optional().describe('Mapping key used (e.g., "product.view")') }).meta({ id: "MappingResult", title: "Mapping.Result", description: "Mapping resolution result (matched rule + key)." }).describe("Mapping resolution result");
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
Pe2 = o2(
|
|
2499
|
-
|
|
2500
|
-
|
|
2509
|
+
xe = o2(ue2);
|
|
2510
|
+
je2 = o2(he2);
|
|
2511
|
+
Pe2 = o2(fe);
|
|
2512
|
+
De2 = o2(ge2);
|
|
2513
|
+
Ee = o2(be2);
|
|
2501
2514
|
Oe2 = o2(ve2);
|
|
2502
|
-
|
|
2503
|
-
|
|
2515
|
+
Ie2 = o2(ye2);
|
|
2516
|
+
Re = o2(we2);
|
|
2504
2517
|
Je3 = o2(ke2);
|
|
2505
2518
|
Me2 = {};
|
|
2506
|
-
t3(Me2, { BatchSchema: () => ut2, ConfigSchema: () =>
|
|
2507
|
-
|
|
2508
|
-
t3(
|
|
2519
|
+
t3(Me2, { BatchSchema: () => ut2, ConfigSchema: () => ot3, ContextSchema: () => st3, DLQSchema: () => wt3, DataSchema: () => mt2, DestinationPolicySchema: () => at2, DestinationsSchema: () => ht2, InitDestinationsSchema: () => bt3, InitSchema: () => gt3, InstanceSchema: () => ft2, PartialConfigSchema: () => rt3, PushBatchContextSchema: () => lt2, PushContextSchema: () => ct2, PushEventSchema: () => dt2, PushEventsSchema: () => pt2, PushResultSchema: () => St3, RefSchema: () => vt3, ResultSchema: () => yt2, batchJsonSchema: () => Pt3, configJsonSchema: () => kt3, contextJsonSchema: () => xt3, instanceJsonSchema: () => Dt2, partialConfigJsonSchema: () => Ct2, pushContextJsonSchema: () => jt3, resultJsonSchema: () => Et3 });
|
|
2520
|
+
Te2 = {};
|
|
2521
|
+
t3(Te2, { MatchExpressionSchema: () => Ae2, RouteSchema: () => Be2, RouteWithoutManySchema: () => Ve3 });
|
|
2509
2522
|
Fe3 = n3.enum(["eq", "contains", "prefix", "suffix", "regex", "gt", "lt", "exists"]).meta({ id: "MatcherOperator", title: "Matcher.Operator", description: "Supported operators for a match condition." });
|
|
2510
2523
|
$e2 = n3.object({ key: n3.string(), operator: Fe3, value: n3.string(), not: n3.boolean().optional() }).meta({ id: "MatcherCondition", title: "Matcher.Condition", description: "Single match condition (key, operator, value, optional not)." });
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
Le2 = n3.strictObject({ match:
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
We3 = n3.union([
|
|
2517
|
-
|
|
2518
|
-
Ue3 = n3.strictObject({ match:
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
Ve3 = n3.union([n3.string(), n3.array(n3.lazy(() => Ve3)),
|
|
2524
|
+
Ae2 = n3.union([$e2, n3.object({ and: n3.array(n3.lazy(() => Ae2)) }), n3.object({ or: n3.array(n3.lazy(() => Ae2)) })]).meta({ id: "MatcherExpression", title: "Matcher.Expression", description: "Boolean expression tree of match conditions (leaf, and, or)." });
|
|
2525
|
+
ze2 = n3.strictObject({ match: Ae2.optional(), next: n3.lazy(() => Be2) });
|
|
2526
|
+
Le2 = n3.strictObject({ match: Ae2.optional(), one: n3.array(n3.lazy(() => Be2)) });
|
|
2527
|
+
qe = n3.strictObject({ match: Ae2.optional(), many: n3.array(n3.lazy(() => Be2)) });
|
|
2528
|
+
Ne3 = n3.strictObject({ match: Ae2 });
|
|
2529
|
+
We3 = n3.union([ze2, Le2, qe, Ne3]);
|
|
2530
|
+
Be2 = n3.union([n3.string(), n3.array(n3.lazy(() => Be2)), We3]).meta({ id: "Route", title: "Route", description: "Recursive route: string ID, sequence of routes, or a RouteConfig (next/one/many/gate)." });
|
|
2531
|
+
Ue3 = n3.strictObject({ match: Ae2.optional(), next: n3.lazy(() => Ve3) });
|
|
2532
|
+
_e = n3.strictObject({ match: Ae2.optional(), one: n3.array(n3.lazy(() => Ve3)) });
|
|
2533
|
+
He3 = n3.union([Ue3, _e, Ne3]);
|
|
2534
|
+
Ve3 = n3.union([n3.string(), n3.array(n3.lazy(() => Ve3)), He3]).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." });
|
|
2522
2535
|
Ze3 = {};
|
|
2523
|
-
t3(Ze3, { CacheRuleSchema: () => Ye3, CacheSchema: () => et3, EventCacheRuleSchema: () => Ge3, EventCacheSchema: () => Ke3, StoreCacheRuleSchema: () => Qe3, StoreCacheSchema: () =>
|
|
2524
|
-
Ge3 = n3.object({ match:
|
|
2536
|
+
t3(Ze3, { CacheRuleSchema: () => Ye3, CacheSchema: () => et3, EventCacheRuleSchema: () => Ge3, EventCacheSchema: () => Ke3, StoreCacheRuleSchema: () => Qe3, StoreCacheSchema: () => Xe2 });
|
|
2537
|
+
Ge3 = n3.object({ match: Ae2.optional().describe("Optional match expression \u2014 omit for always-match."), key: n3.array(n3.string()).min(1).describe("Dot-path fields used to build the cache key"), ttl: n3.number().positive().describe("Time-to-live in seconds"), update: n3.record(n3.string(), ue2).optional().describe("Response mutations applied on cache hit (key \u2192 Value mapping)") }).meta({ id: "EventCacheRule", title: "EventCache.Rule", description: "Single event-cache rule: when it applies (match), what event fields it keys off, TTL, and optional response mutations on hit." });
|
|
2525
2538
|
Ke3 = n3.object({ stop: n3.boolean().optional().describe("Stop the chain on cache HIT (default: false). When true, skip remaining steps and return cached value."), store: n3.string().optional().describe("Store ID for persistent caching (references a configured store)"), namespace: n3.string().optional().describe("Optional key prefix. Omit to write keys directly to the store. Same store + same key + same namespace = same cache entry."), rules: n3.array(Ge3).min(1).describe("Cache rules \u2014 at least one required") }).meta({ id: "EventCacheConfig", title: "EventCache.Config", description: "Top-level cache configuration for an event-context pipeline step (source / transformer / destination)." });
|
|
2526
|
-
Qe3 = n3.strictObject({ match:
|
|
2527
|
-
|
|
2539
|
+
Qe3 = n3.strictObject({ match: Ae2.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)." });
|
|
2540
|
+
Xe2 = n3.strictObject({ store: n3.string().optional().describe("Store ID for persistent caching (references a configured store)"), namespace: n3.string().min(1).optional().describe("Optional key prefix. Omit to default to the host store id. Empty string is rejected."), rules: n3.array(Qe3).min(1).describe("Cache rules \u2014 at least one required") }).meta({ id: "StoreCacheConfig", title: "StoreCache.Config", description: "Top-level cache configuration for a store wrapper. No `stop` (always falls through on miss); namespace defaults to the host store id." });
|
|
2528
2541
|
Ye3 = Ge3;
|
|
2529
2542
|
et3 = Ke3;
|
|
2530
|
-
tt3 = n3.object({ mode: n3.enum(["get", "set"]).describe("Direction: 'get' reads from the store, 'set' writes to it"), store: n3.string().optional().describe("Store id; defaults to the in-memory __cache store when omitted"), key:
|
|
2543
|
+
tt3 = n3.object({ mode: n3.enum(["get", "set"]).describe("Direction: 'get' reads from the store, 'set' writes to it"), store: n3.string().optional().describe("Store id; defaults to the in-memory __cache store when omitted"), key: ue2.describe("Resolves against the event to the store key"), value: ue2.optional().describe("set: resolves to the payload to store. get: its key/bare-string path is the event write-target.") }).superRefine((e4, t4) => {
|
|
2531
2544
|
if (void 0 !== e4.value) {
|
|
2532
2545
|
if ("get" === e4.mode) {
|
|
2533
2546
|
const i5 = e4.value;
|
|
@@ -2542,67 +2555,67 @@ var init_dev = __esm({
|
|
|
2542
2555
|
}
|
|
2543
2556
|
} else t4.addIssue({ code: "custom", message: `\`value\` is required for mode "${e4.mode}".`, path: ["value"] });
|
|
2544
2557
|
}).meta({ id: "StateConfig", title: "State.Config", description: "Declarative store operation: stash (set) or fetch (get) a value against a store. key = store side, value = event side, mode = direction." });
|
|
2545
|
-
|
|
2546
|
-
nt3 = n3.object({ level: n3.union([n3.number(), n3.enum(["ERROR", "WARN", "INFO", "DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"), handler:
|
|
2547
|
-
|
|
2548
|
-
|
|
2558
|
+
it3 = n3.any().meta({ id: "LoggerHandler", title: "Logger.Handler", description: "Custom log handler function (level, ...args) => void" });
|
|
2559
|
+
nt3 = n3.object({ level: n3.union([n3.number(), n3.enum(["ERROR", "WARN", "INFO", "DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"), handler: it3.optional().describe("Custom log handler function") }).meta({ id: "LoggerConfig", title: "Logger.Config", description: "Logger configuration (level, handler) to override the collector defaults" });
|
|
2560
|
+
ot3 = n3.object({ consent: Z3.optional().describe("Required consent states to send events to this destination"), settings: n3.any().meta({ id: "DestinationSettings", title: "Destination.Settings", description: "Implementation-specific configuration (destination-defined shape)." }).describe("Implementation-specific configuration").optional(), credentials: n3.any().meta({ id: "DestinationCredentials", title: "Destination.Credentials", description: "Optional credentials slot (destination-defined shape); back it with a managed secret via $secret.NAME (credentials use $secret, not $env). The per-package shape is supplied via mergeConfigSchema." }).describe("Optional credentials (destination-defined shape)").optional(), data: n3.union([ue2, me]).optional().describe("Global data transformation applied to all events for this destination"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), env: n3.any().meta({ id: "DestinationEnv", title: "Destination.Env", description: "Environment dependencies (destination-defined shape) \u2014 platform, SDK, or mock hook." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Destination instance identifier (defaults to destination key)").optional(), init: n3.boolean().describe("Whether to initialize immediately").optional(), loadScript: n3.boolean().describe("Whether to load external script (for web destinations)").optional(), mapping: we2.optional().describe("Entity-action specific mapping rules for this destination"), policy: ve2.optional().describe("Pre-processing policy rules applied before event mapping"), queue: n3.boolean().describe("Whether to queue events when consent is not granted").optional(), require: n3.array(n3.string()).optional().describe('Defer destination initialization until these collector events fire (e.g., ["consent"])'), logger: nt3.optional().describe("Logger configuration (level, handler) to override the collector defaults"), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)"), before: Ve3.optional().describe("Post-collector transformer chain applied before this destination receives the event. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), next: Ve3.optional().describe("Post-push transformer chain. Runs after destination push completes; push response is available at ingest._response. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), cache: Ke3.optional().describe("Cache configuration for deduplication; skip push on cache HIT"), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this destination"), disabled: n3.boolean().describe("Completely skip this destination (no init, no push, no queue)").optional(), mock: n3.unknown().meta({ id: "DestinationMock", title: "Destination.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Dev/testing only."), queueMax: n3.number().optional().describe("Maximum consent-denied events retained in queuePush for this destination. FIFO drop on overflow. Default 1000."), dlqMax: n3.number().optional().describe("Maximum failed-push entries retained in dlq for this destination. FIFO drop on overflow. Default 100."), timeout: n3.number().optional().describe("Per-destination delivery timeout in ms (default 10000); a delivery that does not settle in this window is routed to the DLQ like a thrown push."), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).optional().describe("Enables batching for all of this destination's events into one shared default buffer; a mapping rule's own batch splits that entity-action into its own buffer and overrides per field. Bare number is the debounce wait window; object form supports wait (debounce ms), size (count cap, default 1000), age (max ms since first entry, default 30000)."), breaker: n3.union([n3.number(), n3.object({ threshold: n3.number().optional(), cooldown: n3.number().optional() })]).optional().describe("Per-destination circuit breaker (presence-gated). After threshold consecutive transport failures the breaker opens and events are skipped until cooldown ms elapse, then one probe is admitted; success closes it, failure re-opens it. Partial-batch row failures are breaker-neutral. Bare number is the threshold; object form supports threshold (default 5) and cooldown (default 30000ms).") }).meta({ id: "DestinationConfig", title: "Destination.Config", description: "Destination configuration: consent, settings, data, env, mapping rules, policy, queue, logger, before/next chains, cache." }).describe("Destination configuration");
|
|
2561
|
+
rt3 = ot3.partial().meta({ id: "DestinationPartialConfig", title: "Destination.PartialConfig", description: "Partial destination configuration with all fields optional." }).describe("Partial destination configuration with all fields optional");
|
|
2549
2562
|
at2 = ve2.describe("Destination policy rules for event pre-processing");
|
|
2550
|
-
|
|
2551
|
-
ct2 =
|
|
2552
|
-
|
|
2563
|
+
st3 = 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: ot3.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");
|
|
2564
|
+
ct2 = st3.extend({ mapping: ye2.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");
|
|
2565
|
+
lt2 = ct2.describe("Batch push context with event-specific mapping");
|
|
2553
2566
|
dt2 = n3.object({ event: ee3.describe("The event to process"), mapping: ye2.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");
|
|
2554
|
-
|
|
2567
|
+
pt2 = n3.array(dt2).meta({ id: "DestinationPushEvents", title: "Destination.PushEvents", description: "Array of events with mappings (batch input)." }).describe("Array of events with mappings");
|
|
2555
2568
|
ut2 = n3.object({ key: n3.string().describe('Batch key (usually mapping key like "product.view")'), events: n3.array(ee3).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: ye2.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");
|
|
2556
2569
|
mt2 = n3.union([n3.unknown(), n3.array(n3.unknown())]).meta({ id: "DestinationData", title: "Destination.Data", description: "Transformed event data delivered to the destination (Property, undefined, or array)." }).optional().describe("Transformed event data (Property, undefined, or array)");
|
|
2557
|
-
ft2 = n3.object({ config:
|
|
2558
|
-
gt3 = n3.object({ code: ft2.describe("Destination instance with implementation"), config:
|
|
2570
|
+
ft2 = n3.object({ config: ot3.describe("Destination configuration"), queue: n3.array(ee3).optional().describe("Queued events awaiting consent"), dlq: n3.array(n3.tuple([ee3, n3.unknown()])).optional().describe("Dead letter queue (failed events with errors)"), type: n3.string().optional().describe("Destination type identifier"), env: n3.unknown().optional().describe("Environment dependencies"), init: n3.unknown().optional().describe("Initialization function"), push: n3.unknown().describe("Push function for single events"), pushBatch: n3.unknown().optional().describe("Batch push function"), on: n3.unknown().optional().describe("Event lifecycle hook function") }).meta({ id: "DestinationInstance", title: "Destination.Instance", description: "Destination instance (runtime object with init/push/pushBatch/on)." }).describe("Destination instance (runtime object with functions)");
|
|
2571
|
+
gt3 = n3.object({ code: ft2.describe("Destination instance with implementation"), config: rt3.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");
|
|
2559
2572
|
bt3 = n3.record(n3.string(), gt3).meta({ id: "DestinationInitDestinations", title: "Destination.InitDestinations", description: "Map of destination IDs to initialization configurations." }).describe("Map of destination IDs to initialization configurations");
|
|
2560
|
-
|
|
2573
|
+
ht2 = n3.record(n3.string(), ft2).meta({ id: "DestinationDestinations", title: "Destination.Destinations", description: "Map of destination IDs to runtime destination instances." }).describe("Map of destination IDs to runtime instances");
|
|
2561
2574
|
vt3 = n3.object({ type: n3.string().describe('Destination type ("gtag", "meta", "bigquery")'), data: n3.unknown().optional().describe("Response from push()"), error: n3.unknown().optional().describe("Error if failed") }).meta({ id: "DestinationRef", title: "Destination.Ref", description: "Reference to a destination outcome (type + response data or error)." }).describe("Destination reference with type and response data");
|
|
2562
2575
|
St3 = n3.object({ queue: n3.array(ee3).optional().describe("Events queued (awaiting consent)"), error: n3.unknown().optional().describe("Error if push failed") }).meta({ id: "DestinationPushResult", title: "Destination.PushResult", description: "Result of a single destination push (queued events, optional error)." }).describe("Push operation result");
|
|
2563
2576
|
yt2 = n3.object({ ok: n3.boolean().describe("True if nothing failed"), event: n3.unknown().optional().describe("The processed event"), done: n3.record(n3.string(), vt3).optional().describe("Destinations that processed successfully"), queued: n3.record(n3.string(), vt3).optional().describe("Destinations that queued events"), failed: n3.record(n3.string(), vt3).optional().describe("Destinations that failed to process") }).meta({ id: "DestinationResult", title: "Destination.Result", description: "Overall push result aggregated across all destinations (done/queued/failed maps)." }).describe("Push result with destination outcomes");
|
|
2564
2577
|
wt3 = n3.array(n3.tuple([ee3, n3.unknown()])).meta({ id: "DestinationDLQ", title: "Destination.DLQ", description: "Dead-letter queue: list of [event, error] tuples." }).describe("Dead letter queue: [(event, error), ...]");
|
|
2565
|
-
kt3 = o2(
|
|
2566
|
-
Ct2 = o2(
|
|
2567
|
-
|
|
2578
|
+
kt3 = o2(ot3);
|
|
2579
|
+
Ct2 = o2(rt3);
|
|
2580
|
+
xt3 = o2(st3);
|
|
2568
2581
|
jt3 = o2(ct2);
|
|
2569
|
-
|
|
2582
|
+
Pt3 = o2(ut2);
|
|
2570
2583
|
Dt2 = o2(ft2);
|
|
2571
2584
|
Et3 = o2(yt2);
|
|
2572
2585
|
Ot3 = {};
|
|
2573
|
-
t3(Ot3, { CommandTypeSchema: () => It3, ConfigSchema: () => Rt, DestinationsSchema: () => $
|
|
2586
|
+
t3(Ot3, { CommandTypeSchema: () => It3, ConfigSchema: () => Rt, DestinationsSchema: () => $t2, InitConfigSchema: () => Mt2, InstanceSchema: () => At3, PushContextSchema: () => Tt3, SessionDataSchema: () => Jt2, SourcesSchema: () => Ft, commandTypeJsonSchema: () => zt, configJsonSchema: () => Lt2, initConfigJsonSchema: () => Nt3, instanceJsonSchema: () => Bt, pushContextJsonSchema: () => Wt2, sessionDataJsonSchema: () => qt2 });
|
|
2574
2587
|
It3 = n3.union([n3.enum(["action", "config", "consent", "context", "destination", "elb", "globals", "hook", "init", "link", "run", "user", "walker"]), n3.string()]).meta({ id: "CollectorCommandType", title: "Collector.CommandType", description: "Collector command type identifier (standard or extension string)." }).describe("Collector command type: standard commands or custom string for extensions");
|
|
2575
2588
|
Rt = n3.object({ run: n3.boolean().describe("Whether to run collector automatically on initialization").optional(), globalsStatic: _2.describe("Static global properties that persist across collector runs"), sessionStatic: n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorSessionStatic", title: "Collector.SessionStatic", description: "Static session data that persists across collector runs." }).describe("Static session data that persists across collector runs"), logger: nt3.optional().describe("Logger configuration (level, handler)"), queueMax: n3.number().optional().describe("Maximum events retained in collector.queue (late-registration replay). FIFO drop on overflow. Default 1000."), name: n3.string().optional().describe("Flow name; keys this flow's entry in event.source.release and the observer flowId."), release: n3.string().optional().describe("Config release id stamped into event.source.release for this flow.") }).meta({ id: "CollectorConfig", title: "Collector.Config", description: "Core collector configuration (globals/session statics, logger, buffer bounds)." }).describe("Core collector configuration");
|
|
2576
2589
|
Jt2 = _2.and(n3.object({ isStart: n3.boolean().describe("Whether this is a new session start"), storage: n3.boolean().describe("Whether storage is available"), id: c.describe("Session identifier").optional(), start: l2.describe("Session start timestamp").optional(), marketing: n3.literal(true).optional().describe("Marketing attribution flag"), updated: l2.describe("Last update timestamp").optional(), isNew: n3.boolean().describe("Whether this is a new session").optional(), device: c.describe("Device identifier").optional(), count: d.describe("Event count in session").optional(), runs: d.describe("Number of runs").optional() })).meta({ id: "CollectorSessionData", title: "Collector.SessionData", description: "Session state and tracking data." }).describe("Session state and tracking data");
|
|
2577
|
-
|
|
2578
|
-
|
|
2590
|
+
Mt2 = Rt.partial().extend({ consent: Z3.optional().describe("Initial consent state"), user: G.optional().describe("Initial user data"), globals: _2.optional().describe("Initial global properties"), sources: n3.unknown().meta({ id: "CollectorInitSources", title: "Source.InitSources", description: "Source configurations map (id \u2192 InitSource)." }).optional().describe("Source configurations"), destinations: n3.unknown().meta({ id: "CollectorInitDestinations", title: "Destination.InitDestinations", description: "Destination configurations map (id \u2192 Init)." }).optional().describe("Destination configurations"), transformers: n3.unknown().meta({ id: "CollectorInitTransformers", title: "Transformer.Configs", description: "Transformer configurations map (id \u2192 Config)." }).optional().describe("Transformer configurations"), stores: n3.unknown().meta({ id: "CollectorInitStores", title: "Store.Configs", description: "Store configurations map (id \u2192 Config)." }).optional().describe("Store configurations"), custom: _2.optional().describe("Initial custom implementation-specific properties"), hooks: n3.unknown().meta({ id: "CollectorHooks", title: "Collector.Hooks", description: "Pipeline observation hooks." }).optional().describe("Pipeline observation hooks"), observe: n3.union([n3.object({ url: n3.string().describe("Observer base URL"), binding: n3.string().describe("Public project binding the web credential must match") }), n3.object({ url: n3.string().describe("Observer base URL"), sessionId: n3.string().describe("Session id the runtime posts under"), token: n3.string().describe("Ingest bearer token"), level: n3.enum(["off", "standard", "trace"]).optional().describe("Telemetry level"), sample: n3.number().optional().describe("Deterministic sample fraction in [0, 1]") })]).meta({ id: "CollectorObserve", title: "Observe", description: "Observation session connect config: web arm (url + binding) or server arm (url + sessionId + token)." }).optional().describe("Observation session connect config"), observers: n3.unknown().meta({ id: "CollectorObservers", title: "Collector.Observers", description: "Caller-supplied advisory observer functions (runtime objects)." }).optional().describe("Caller-supplied advisory observer functions") }).meta({ id: "CollectorInitConfig", title: "Collector.InitConfig", description: "Collector initialization configuration with initial state (consent, user, globals, components, hooks)." }).describe("Collector initialization configuration with initial state");
|
|
2591
|
+
Tt3 = n3.object({ mapping: ke2.optional().describe("Source-level mapping configuration") }).meta({ id: "CollectorPushContext", title: "Collector.PushContext", description: "Push context with optional source-level mapping." }).describe("Push context with optional source mapping");
|
|
2579
2592
|
Ft = n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorSources", title: "Collector.Sources", description: "Map of source IDs to runtime source instances." }).describe("Map of source IDs to source instances");
|
|
2580
|
-
$
|
|
2581
|
-
At3 = n3.object({ push: n3.unknown().describe("Push function for processing events"), command: n3.unknown().describe("Command function for walker commands"), allowed: n3.boolean().describe("Whether event processing is allowed"), config: Rt.describe("Current collector configuration"), consent:
|
|
2593
|
+
$t2 = 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");
|
|
2594
|
+
At3 = n3.object({ push: n3.unknown().describe("Push function for processing events"), command: n3.unknown().describe("Command function for walker commands"), allowed: n3.boolean().describe("Whether event processing is allowed"), config: Rt.describe("Current collector configuration"), consent: Z3.describe("Current consent state"), custom: _2.describe("Custom implementation-specific properties"), sources: Ft.describe("Registered source instances"), destinations: $t2.describe("Registered destination instances"), globals: _2.describe("Current global properties"), hooks: n3.unknown().describe("Lifecycle hook functions"), on: n3.unknown().describe("Event lifecycle configuration"), queue: n3.array(ee3).describe("Queued events awaiting processing"), round: n3.number().describe("Collector run count (increments with each run)"), session: n3.union([Jt2]).describe("Current session state"), timing: n3.number().describe("Event processing timing information"), user: G.describe("Current user data") }).meta({ id: "CollectorInstance", title: "Collector.Instance", description: "Collector instance (runtime object with push/command + full state and component maps)." }).describe("Collector instance with state and methods");
|
|
2582
2595
|
zt = o2(It3);
|
|
2583
2596
|
Lt2 = o2(Rt);
|
|
2584
2597
|
qt2 = o2(Jt2);
|
|
2585
|
-
|
|
2586
|
-
Wt2 = o2(
|
|
2598
|
+
Nt3 = o2(Mt2);
|
|
2599
|
+
Wt2 = o2(Tt3);
|
|
2587
2600
|
Bt = o2(At3);
|
|
2588
2601
|
Ut = {};
|
|
2589
|
-
t3(Ut, { BaseEnvSchema: () =>
|
|
2590
|
-
|
|
2591
|
-
Ht2 = ke2.extend({ settings: n3.any().meta({ id: "SourceSettings", title: "Source.Settings", description: "Implementation-specific configuration (source-defined shape)." }).describe("Implementation-specific configuration").optional(), credentials: n3.any().meta({ id: "SourceCredentials", title: "Source.Credentials", description: "Optional credentials slot (source-defined shape); back it with a managed secret via $secret.NAME (credentials use $secret, not $env). The per-package shape is supplied via mergeConfigSchema." }).describe("Optional credentials (source-defined shape)").optional(), env:
|
|
2602
|
+
t3(Ut, { BaseEnvSchema: () => _t3, ConfigSchema: () => Ht2, InitSchema: () => Gt2, InitSourceSchema: () => Kt, InitSourcesSchema: () => Qt2, InstanceSchema: () => Zt, PartialConfigSchema: () => Vt2, baseEnvJsonSchema: () => Xt, configJsonSchema: () => Yt2, initSourceJsonSchema: () => ii, initSourcesJsonSchema: () => ni, instanceJsonSchema: () => ti, partialConfigJsonSchema: () => ei });
|
|
2603
|
+
_t3 = 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");
|
|
2604
|
+
Ht2 = ke2.extend({ settings: n3.any().meta({ id: "SourceSettings", title: "Source.Settings", description: "Implementation-specific configuration (source-defined shape)." }).describe("Implementation-specific configuration").optional(), credentials: n3.any().meta({ id: "SourceCredentials", title: "Source.Credentials", description: "Optional credentials slot (source-defined shape); back it with a managed secret via $secret.NAME (credentials use $secret, not $env). The per-package shape is supplied via mergeConfigSchema." }).describe("Optional credentials (source-defined shape)").optional(), env: _t3.optional().describe("Environment dependencies (platform-specific)"), id: c.describe("Source identifier (defaults to source key)").optional(), primary: n3.boolean().describe("Mark as primary (only one can be primary)").optional(), require: n3.array(n3.string()).optional().describe('Defer source initialization until these collector events fire (e.g., ["consent"])'), logger: nt3.optional().describe("Logger configuration (level, handler) to override the collector defaults"), async: n3.boolean().optional().describe('Respond-first acknowledgement for response-producing server sources (express today; future fetch/lambda). When true (the default for such sources) the source responds 2xx ("accepted") before the event is delivered; when false it waits for delivery to settle. Browser/dataLayer sources have no HTTP response to defer and ignore it. A 2xx means accepted, not delivered. Default is per source type.'), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)"), ingest: n3.union([ue2, me]).optional().describe("Ingest metadata extraction mapping. Extracts values from raw request objects (Express req, Lambda event) using mapping syntax."), disabled: n3.boolean().describe("Completely skip this source (no init, no event capture)").optional(), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this source"), init: n3.boolean().optional().describe("Init lifecycle flag set by collector to true after Instance.init() runs") }).meta({ id: "SourceConfig", title: "Source.Config", description: "Source configuration with mapping, environment, and lifecycle hooks." }).describe("Source configuration with mapping and environment");
|
|
2592
2605
|
Vt2 = Ht2.partial().meta({ id: "SourcePartialConfig", title: "Source.PartialConfig", description: "Partial source configuration with all fields optional." }).describe("Partial source configuration with all fields optional");
|
|
2593
2606
|
Zt = n3.object({ type: n3.string().describe('Source type identifier (e.g., "browser", "dataLayer")'), config: Ht2.describe("Current source configuration"), push: n3.any().meta({ id: "SourceInstancePushFn", title: "Source.PushFn", description: "Push function \u2014 THE HANDLER (flexible signature for platform compatibility)." }).describe("Push function - THE HANDLER (flexible signature for platform compatibility)"), destroy: n3.any().meta({ id: "SourceDestroyFn", title: "Source.DestroyFn", description: "Cleanup function called when the source is removed." }).optional().describe("Cleanup function called when source is removed"), on: n3.unknown().optional().describe("Lifecycle hook function for event types") }).meta({ id: "SourceInstance", title: "Source.Instance", description: "Source instance (runtime object with push handler and lifecycle methods)." }).describe("Source instance with push handler and lifecycle methods");
|
|
2594
2607
|
Gt2 = n3.any().meta({ id: "SourceInit", title: "Source.Init", description: "Source initialization function: (config, env) => Instance | Promise<Instance>." }).describe("Source initialization function: (config, env) => Instance | Promise<Instance>");
|
|
2595
|
-
Kt = n3.object({ code: Gt2.describe("Source initialization function"), config: Vt2.optional().describe("Partial configuration overrides"), env:
|
|
2596
|
-
|
|
2597
|
-
|
|
2608
|
+
Kt = n3.object({ code: Gt2.describe("Source initialization function"), config: Vt2.optional().describe("Partial configuration overrides"), env: _t3.partial().optional().describe("Partial environment overrides"), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this source"), primary: n3.boolean().optional().describe("Mark as primary source (only one can be primary)") }).meta({ id: "SourceInitSource", title: "Source.InitSource", description: "Source initialization bundle (init function + config + env + primary flag)." }).describe("Source initialization configuration");
|
|
2609
|
+
Qt2 = n3.record(n3.string(), Kt).meta({ id: "SourceInitSources", title: "Source.InitSources", description: "Map of source IDs to initialization configurations." }).describe("Map of source IDs to initialization configurations");
|
|
2610
|
+
Xt = o2(_t3);
|
|
2598
2611
|
Yt2 = o2(Ht2);
|
|
2599
2612
|
ei = o2(Vt2);
|
|
2600
2613
|
ti = o2(Zt);
|
|
2601
2614
|
ii = o2(Kt);
|
|
2602
|
-
ni = o2(
|
|
2615
|
+
ni = o2(Qt2);
|
|
2603
2616
|
oi = {};
|
|
2604
2617
|
t3(oi, { ConfigSchema: () => ri, PartialConfigSchema: () => ai, configJsonSchema: () => si, partialConfigJsonSchema: () => ci });
|
|
2605
|
-
ri = n3.object({ settings: n3.any().meta({ id: "TransformerSettings", title: "Transformer.Settings", description: "Implementation-specific configuration (transformer-defined shape)." }).describe("Implementation-specific configuration").optional(), env: n3.any().meta({ id: "TransformerEnv", title: "Transformer.Env", description: "Environment dependencies (transformer-defined shape)." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Transformer instance identifier (defaults to transformer key)").optional(), logger: nt3.optional().describe("Logger configuration (level, handler) to override the collector defaults"), before:
|
|
2618
|
+
ri = n3.object({ settings: n3.any().meta({ id: "TransformerSettings", title: "Transformer.Settings", description: "Implementation-specific configuration (transformer-defined shape)." }).describe("Implementation-specific configuration").optional(), env: n3.any().meta({ id: "TransformerEnv", title: "Transformer.Env", description: "Environment dependencies (transformer-defined shape)." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Transformer instance identifier (defaults to transformer key)").optional(), logger: nt3.optional().describe("Logger configuration (level, handler) to override the collector defaults"), before: Be2.optional().describe("Pre-transformer chain that runs before this transformer pushes"), next: Be2.optional().describe("Graph wiring to the next transformer in the chain"), cache: Ke3.optional().describe("Step-level cache configuration for this transformer"), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this transformer"), init: n3.boolean().describe("Whether to initialize immediately").optional(), disabled: n3.boolean().describe("Completely skip this transformer in chains").optional(), mock: n3.unknown().meta({ id: "TransformerMock", title: "Transformer.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Global mock for all chains. Dev/testing only."), chainMocks: n3.record(n3.string(), n3.unknown().meta({ id: "TransformerChainMock", title: "Transformer.ChainMock", description: "Chain-path-specific mock value. Dev/testing only." })).optional().describe("Path-specific mock values keyed by chain path. Takes precedence over global mock. Dev/testing only."), mapping: ke2.optional().describe("Declarative event-to-event mapping applied when this transformer step has no code. At this position, only event-mutating fields apply (policy, mapping[].policy, mapping[].name, mapping[].ignore, mapping[].consent, include); vendor-payload fields are ignored.") }).strict().meta({ id: "TransformerConfig", title: "Transformer.Config", description: "Transformer configuration (settings, env, chain wiring, cache, mocks)." }).describe("Transformer configuration");
|
|
2606
2619
|
ai = ri.partial().meta({ id: "TransformerPartialConfig", title: "Transformer.PartialConfig", description: "Partial transformer configuration with all fields optional." }).describe("Partial transformer configuration with all fields optional");
|
|
2607
2620
|
si = o2(ri);
|
|
2608
2621
|
ci = o2(ai);
|
|
@@ -2625,10 +2638,10 @@ var init_dev = __esm({
|
|
|
2625
2638
|
Ci = n3.record(n3.string(), ki).meta({ id: "FlowStepExamples", title: "Flow.StepExamples", description: "Named step examples keyed by scenario name." }).describe("Named step examples for testing and documentation");
|
|
2626
2639
|
xi = n3.record(n3.string(), n3.unknown()).meta({ id: "JsonSchema", title: "JsonSchema", description: "Structural JSON Schema fragment (Record<string, unknown>)" });
|
|
2627
2640
|
ji = n3.record(n3.string(), n3.record(n3.string(), xi)).meta({ id: "ValidateEvents", title: "ValidateEvents", description: "Entity-action keyed JSON Schemas" }).describe("Entity-action keyed JSON Schemas");
|
|
2628
|
-
Di = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-source-browser@2.0.0")'), code: yi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowSourceConfig", title: "Source.Config", description: "Source-specific configuration object (Source.Config)." }).optional().describe("Source-specific configuration object"), env: n3.unknown().meta({ id: "FlowSourceEnv", title: "Source.BaseEnv", description: "Source environment configuration (Source.BaseEnv overrides)." }).optional().describe("Source environment configuration"), primary: n3.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary."), variables: gi.optional().describe("Source-level variables (highest priority in cascade)"), next:
|
|
2629
|
-
Ei = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/transformer-enricher@1.0.0")'), code: yi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.unknown().meta({ id: "FlowTransformerConfig", title: "Transformer.Config", description: "Transformer-specific configuration object." }).optional().describe("Transformer-specific configuration object"), env: n3.unknown().meta({ id: "FlowTransformerEnv", title: "Transformer.Env", description: "Transformer environment configuration." }).optional().describe("Transformer environment configuration"), before:
|
|
2641
|
+
Di = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-source-browser@2.0.0")'), code: yi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowSourceConfig", title: "Source.Config", description: "Source-specific configuration object (Source.Config)." }).optional().describe("Source-specific configuration object"), env: n3.unknown().meta({ id: "FlowSourceEnv", title: "Source.BaseEnv", description: "Source environment configuration (Source.BaseEnv overrides)." }).optional().describe("Source environment configuration"), primary: n3.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary."), variables: gi.optional().describe("Source-level variables (highest priority in cascade)"), next: Be2.optional().describe("Pre-collector transformer chain. String, string[], or Route[] for conditional routing based on ingest data."), before: Be2.optional().describe("Pre-source transformer chain (consent-exempt). Handles transport-level preprocessing."), examples: Ci.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ke3.optional().describe("Cache configuration for this source (match \u2192 key \u2192 ttl rules)") }).strict().meta({ id: "FlowSource", title: "Flow.Source", description: "Source package reference with configuration, env, chains, and examples." }).describe("Source package reference with configuration").superRefine(Pi);
|
|
2642
|
+
Ei = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/transformer-enricher@1.0.0")'), code: yi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.unknown().meta({ id: "FlowTransformerConfig", title: "Transformer.Config", description: "Transformer-specific configuration object." }).optional().describe("Transformer-specific configuration object"), env: n3.unknown().meta({ id: "FlowTransformerEnv", title: "Transformer.Env", description: "Transformer environment configuration." }).optional().describe("Transformer environment configuration"), before: Be2.optional().describe("Pre-transformer chain. Runs before this transformer push function."), next: Be2.optional().describe("Next transformer in chain. String, string[], or Route[] for conditional routing."), variables: gi.optional().describe("Transformer-level variables (highest priority in cascade)"), examples: Ci.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ke3.optional().describe("Cache configuration for this transformer (match \u2192 key \u2192 ttl rules)") }).meta({ id: "FlowTransformer", title: "Flow.Transformer", description: "Transformer package reference with configuration, env, chains, and cache." }).describe("Transformer package reference with configuration").superRefine(Pi);
|
|
2630
2643
|
Oi = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-destination-gtag@2.0.0")'), code: yi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowDestinationConfig", title: "Destination.Config", description: "Destination-specific configuration object." }).optional().describe("Destination-specific configuration object"), env: n3.unknown().meta({ id: "FlowDestinationEnv", title: "Destination.Env", description: "Destination environment configuration." }).optional().describe("Destination environment configuration"), variables: gi.optional().describe("Destination-level variables (highest priority in cascade)"), before: Ve3.optional().describe("Post-collector transformer chain. String, string[], or Route[] for conditional routing. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), next: Ve3.optional().describe("Post-push transformer chain. Push response available at context.ingest._response. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), examples: Ci.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ke3.optional().describe("Cache configuration for this destination (match \u2192 key \u2192 ttl rules)") }).meta({ id: "FlowDestination", title: "Flow.Destination", description: "Destination package reference with configuration, env, chains, and cache." }).describe("Destination package reference with configuration").superRefine(Pi);
|
|
2631
|
-
Ii = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe("Store package specifier with optional version"), code: yi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during store registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowStoreConfig", title: "Store.Config", description: "Store-specific configuration object." }).optional().describe("Store-specific configuration object"), env: n3.unknown().meta({ id: "FlowStoreEnv", title: "Store.Env", description: "Store environment configuration." }).optional().describe("Store environment configuration"), cache:
|
|
2644
|
+
Ii = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe("Store package specifier with optional version"), code: yi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during store registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowStoreConfig", title: "Store.Config", description: "Store-specific configuration object." }).optional().describe("Store-specific configuration object"), env: n3.unknown().meta({ id: "FlowStoreEnv", title: "Store.Env", description: "Store environment configuration." }).optional().describe("Store environment configuration"), cache: Xe2.optional().describe("Cache configuration for this store (TTL-only rules, optional recursive `cache.store`)"), variables: gi.optional().describe("Store-level variables (highest priority in cascade)"), examples: Ci.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).meta({ id: "FlowStore", title: "Flow.Store", description: "Store package reference with configuration, env, cache, and examples." }).describe("Store package reference with configuration").superRefine(Pi);
|
|
2632
2645
|
Ri = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowContractSchemaEntry", title: "Flow.ContractSchemaEntry", description: "JSON Schema object for event validation with description/examples annotations." }).describe("JSON Schema object for event validation with description/examples annotations");
|
|
2633
2646
|
Ji = n3.record(n3.string(), Ri).meta({ id: "FlowContractActions", title: "Flow.ContractActions", description: "Action-level contract entries keyed by action name." }).describe("Action-level contract entries");
|
|
2634
2647
|
Mi = n3.record(n3.string(), Ji).meta({ id: "FlowContractEvents", title: "Flow.ContractEvents", description: "Entity-action event schemas (entity \u2192 action \u2192 schema)." }).describe("Entity-action event schemas");
|
|
@@ -2650,21 +2663,24 @@ var init_dev = __esm({
|
|
|
2650
2663
|
Yi = o2(ji);
|
|
2651
2664
|
tn = en.object({ lang: en.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"), code: en.string().describe("Code snippet") });
|
|
2652
2665
|
nn = en.object({ text: en.string().describe("Short actionable hint text focused on walkerOS usage"), code: en.array(tn).optional().describe("Optional code snippets") });
|
|
2653
|
-
|
|
2666
|
+
on = en.record(en.string(), nn).describe("Keyed hints for AI consumption \u2014 lightweight context beyond schemas and examples");
|
|
2654
2667
|
rn = n3.object({ param: n3.string().describe("Lowercase URL parameter name. Match is case-insensitive on lookup."), platform: n3.string().describe("Canonical platform identifier (lowercase, kebab-case).") });
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
+
an2 = n3.object({ client_email: n3.string().describe("Service account client email"), private_key: n3.string().describe("Service account private key (PEM)"), project_id: n3.string().optional().describe("GCP project id (derived from environment when omitted)") }).meta({ id: "ServiceAccount", title: "ServiceAccount", description: "Google-style service account credentials (client_email, private_key, optional project_id)." }).describe("Google-style service account credentials");
|
|
2669
|
+
sn = n3.union([n3.string(), an2]).meta({ id: "Credentials", title: "Credentials", description: "Service account credentials: a JSON string (back it with a managed secret via $secret.NAME) or a parsed service account object." }).describe("Service account credentials: a JSON string (back it with a managed secret via $secret.NAME) or a parsed object");
|
|
2670
|
+
cn = o2(sn);
|
|
2671
|
+
dn2 = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
|
|
2672
|
+
pn3 = /* @__PURE__ */ new Set(["additionalItems", "additionalProperties", "contains", "contentSchema", "else", "if", "items", "not", "propertyNames", "then", "unevaluatedItems", "unevaluatedProperties"]);
|
|
2673
|
+
un2 = /* @__PURE__ */ new Set(["allOf", "anyOf", "items", "oneOf", "prefixItems"]);
|
|
2674
|
+
mn = /* @__PURE__ */ new Set(["properties", "patternProperties", "dependentSchemas", "dependentRequired", "dependencies", "$defs", "definitions"]);
|
|
2675
|
+
yn2 = /\$store\.([a-zA-Z_][a-zA-Z0-9_]*)/g;
|
|
2676
|
+
wn2 = /\$env\.([A-Za-z_]\w*)(=[^"}\s]*)?/g;
|
|
2677
|
+
kn2 = /\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?/g;
|
|
2678
|
+
Cn2 = /\$(var|store|flow|secret):([a-zA-Z_][a-zA-Z0-9_]*)/g;
|
|
2679
|
+
xn2 = /\$secret\.([A-Z0-9_]+)/g;
|
|
2680
|
+
jn2 = ["@walkeros/server-store-fs", "@walkeros/server-store-s3", "@walkeros/server-store-gcs"];
|
|
2681
|
+
Pn = "@walkeros/server-transformer-file";
|
|
2682
|
+
Dn2 = /^\$store\.([a-zA-Z_][a-zA-Z0-9_]*)$/;
|
|
2683
|
+
Hn2 = { source: Ut.configJsonSchema, destination: Me2.configJsonSchema, store: li.configJsonSchema };
|
|
2668
2684
|
}
|
|
2669
2685
|
});
|
|
2670
2686
|
|
|
@@ -2919,15 +2935,15 @@ function loadBundleConfig(rawConfig, options) {
|
|
|
2919
2935
|
const config = validateFlowConfig(sanitized);
|
|
2920
2936
|
const availableFlows = getAvailableFlows(config);
|
|
2921
2937
|
const flowName = resolveFlow(config, options.flowName, availableFlows);
|
|
2922
|
-
let flowSettings =
|
|
2923
|
-
const platform =
|
|
2938
|
+
let flowSettings = se(config, flowName, { deferred: true });
|
|
2939
|
+
const platform = ie(flowSettings);
|
|
2924
2940
|
if (!platform) {
|
|
2925
2941
|
throw new Error(
|
|
2926
2942
|
`Invalid configuration: flow "${flowName}" must have config.platform set to "web" or "server".`
|
|
2927
2943
|
);
|
|
2928
2944
|
}
|
|
2929
2945
|
if (platform === "web") {
|
|
2930
|
-
flowSettings =
|
|
2946
|
+
flowSettings = se(config, flowName);
|
|
2931
2947
|
}
|
|
2932
2948
|
const buildDefaults = getBuildDefaults(platform);
|
|
2933
2949
|
const bundle2 = flowSettings.config?.bundle;
|
|
@@ -3062,7 +3078,7 @@ var init_config = __esm({
|
|
|
3062
3078
|
// src/commands/bundle/config-classifier.ts
|
|
3063
3079
|
function containsCodeMarkers(value) {
|
|
3064
3080
|
if (typeof value === "string") {
|
|
3065
|
-
return value.startsWith("$code:") || value.startsWith("$store.") || value.includes("__WALKEROS_ENV:") || value.includes(
|
|
3081
|
+
return value.startsWith("$code:") || value.startsWith("$store.") || value.includes("__WALKEROS_ENV:") || value.includes(ee);
|
|
3066
3082
|
}
|
|
3067
3083
|
if (Array.isArray(value)) {
|
|
3068
3084
|
return value.some(containsCodeMarkers);
|
|
@@ -3099,14 +3115,14 @@ var init_config_classifier = __esm({
|
|
|
3099
3115
|
|
|
3100
3116
|
// src/commands/bundle/structural-validators.ts
|
|
3101
3117
|
function isInlineCode(code) {
|
|
3102
|
-
return
|
|
3118
|
+
return he(code) && "push" in code;
|
|
3103
3119
|
}
|
|
3104
3120
|
function hasCodeReference(code) {
|
|
3105
3121
|
return isInlineCode(code) || typeof code === "string";
|
|
3106
3122
|
}
|
|
3107
3123
|
function validateReference(type, name, ref) {
|
|
3108
3124
|
if (type === "Transformer") {
|
|
3109
|
-
const r6 =
|
|
3125
|
+
const r6 = vr({ ...ref }, "Transformer");
|
|
3110
3126
|
if (!r6.ok) {
|
|
3111
3127
|
throw new Error(`Transformer "${name}": ${r6.reason ?? "invalid entry."}`);
|
|
3112
3128
|
}
|
|
@@ -4668,7 +4684,7 @@ function applyStepPackages(flowSettings, packages, logger) {
|
|
|
4668
4684
|
for (const pkg of stepPackages) {
|
|
4669
4685
|
const isLocalPath = pkg.startsWith(".") || pkg.startsWith("/");
|
|
4670
4686
|
if (isLocalPath) {
|
|
4671
|
-
const varName =
|
|
4687
|
+
const varName = oe(pkg);
|
|
4672
4688
|
if (!packages[varName]) {
|
|
4673
4689
|
packages[varName] = {
|
|
4674
4690
|
path: pkg
|
|
@@ -4741,7 +4757,7 @@ async function generateImportStatements(packages, destinationPackages, sourcePac
|
|
|
4741
4757
|
const hasNamed = namedImports.has(packageName);
|
|
4742
4758
|
const namedImportsToGenerate = [];
|
|
4743
4759
|
if (isUsedByDestOrSource && !hasNamed) {
|
|
4744
|
-
const varName =
|
|
4760
|
+
const varName = oe(packageName);
|
|
4745
4761
|
importStatements.push(`import ${varName} from '${packageName}';`);
|
|
4746
4762
|
}
|
|
4747
4763
|
if (hasNamed) {
|
|
@@ -4806,9 +4822,9 @@ function packageSpecName(spec) {
|
|
|
4806
4822
|
return parsePackageSpec(spec).name;
|
|
4807
4823
|
}
|
|
4808
4824
|
function readSourceElb(source) {
|
|
4809
|
-
if (!
|
|
4825
|
+
if (!he(source.config)) return void 0;
|
|
4810
4826
|
const settings = source.config.settings;
|
|
4811
|
-
if (!
|
|
4827
|
+
if (!he(settings)) return void 0;
|
|
4812
4828
|
return typeof settings.elb === "string" ? settings.elb : void 0;
|
|
4813
4829
|
}
|
|
4814
4830
|
function bridgeWindowElb(flow, logger) {
|
|
@@ -4836,8 +4852,8 @@ function bridgeWindowElb(flow, logger) {
|
|
|
4836
4852
|
}
|
|
4837
4853
|
const nextSources = { ...sources };
|
|
4838
4854
|
for (const [id, source] of toForward) {
|
|
4839
|
-
const config =
|
|
4840
|
-
const settings =
|
|
4855
|
+
const config = he(source.config) ? source.config : {};
|
|
4856
|
+
const settings = he(config.settings) ? config.settings : {};
|
|
4841
4857
|
nextSources[id] = {
|
|
4842
4858
|
...source,
|
|
4843
4859
|
config: { ...config, settings: { ...settings, elb: windowElb } }
|
|
@@ -4949,7 +4965,7 @@ function buildSplitConfigObject(flowSettings, namedImports) {
|
|
|
4949
4965
|
if (typeof step.import === "string" && step.package) {
|
|
4950
4966
|
return step.import;
|
|
4951
4967
|
}
|
|
4952
|
-
return
|
|
4968
|
+
return oe(step.package);
|
|
4953
4969
|
}
|
|
4954
4970
|
function getStepProps(step) {
|
|
4955
4971
|
const props = {};
|
|
@@ -5004,12 +5020,12 @@ function buildSplitConfigObject(flowSettings, namedImports) {
|
|
|
5004
5020
|
return buildSplitStepEntry("destinations", key, dest);
|
|
5005
5021
|
});
|
|
5006
5022
|
const transformersEntries = Object.entries(transformers).filter(
|
|
5007
|
-
([, transformer]) => transformer.package || hasCodeReference2(transformer.code) ||
|
|
5023
|
+
([, transformer]) => transformer.package || hasCodeReference2(transformer.code) || hr({ ...transformer }, "Transformer")
|
|
5008
5024
|
).map(([key, transformer]) => {
|
|
5009
5025
|
if (isInlineCode2(transformer.code)) {
|
|
5010
5026
|
return ` ${key}: ${generateInlineCode(transformer.code, transformer.config || {}, transformer.env, { before: transformer.before, next: transformer.next })}`;
|
|
5011
5027
|
}
|
|
5012
|
-
if (
|
|
5028
|
+
if (hr({ ...transformer }, "Transformer")) {
|
|
5013
5029
|
const chainLines = [];
|
|
5014
5030
|
if (transformer.before !== void 0) {
|
|
5015
5031
|
chainLines.push(`before: ${JSON.stringify(transformer.before)}`);
|
|
@@ -5230,11 +5246,11 @@ function serializeWithCode(value, indent) {
|
|
|
5230
5246
|
if (value.startsWith("$code:")) {
|
|
5231
5247
|
return value.slice(6);
|
|
5232
5248
|
}
|
|
5233
|
-
if (value.startsWith(
|
|
5234
|
-
const name = value.slice(
|
|
5249
|
+
if (value.startsWith(ee)) {
|
|
5250
|
+
const name = value.slice(ee.length);
|
|
5235
5251
|
return `__walkerosRequireSecret(${JSON.stringify(name)}, process.env[${JSON.stringify(name)}])`;
|
|
5236
5252
|
}
|
|
5237
|
-
const esc =
|
|
5253
|
+
const esc = Q.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5238
5254
|
const markerRe = new RegExp(
|
|
5239
5255
|
esc + "([a-zA-Z_][a-zA-Z0-9_]*)(?::((?:(?!" + esc + `)[^\\s"'])*))?`,
|
|
5240
5256
|
"g"
|
|
@@ -5858,7 +5874,7 @@ var init_contract = __esm({
|
|
|
5858
5874
|
"src/core/contract.ts"() {
|
|
5859
5875
|
"use strict";
|
|
5860
5876
|
init_config_file();
|
|
5861
|
-
bakedContractVersion = true ? "4.
|
|
5877
|
+
bakedContractVersion = true ? "4.3.0" : PLACEHOLDER;
|
|
5862
5878
|
}
|
|
5863
5879
|
});
|
|
5864
5880
|
|
|
@@ -6668,7 +6684,7 @@ function r2(e4, t4) {
|
|
|
6668
6684
|
const n5 = {};
|
|
6669
6685
|
return Object.entries(t4).forEach(([e5, t5]) => {
|
|
6670
6686
|
n5[e5] = !!t5;
|
|
6671
|
-
}), e4.consent =
|
|
6687
|
+
}), e4.consent = ce(e4.consent, n5), { update: n5 };
|
|
6672
6688
|
}
|
|
6673
6689
|
function T2(e4, t4, n5) {
|
|
6674
6690
|
return { traceId: e4.source?.trace ?? t4?._meta.trace ?? n5.trace, sourceId: t4?._meta.path[0], parentEventId: t4?._meta.parentEventId };
|
|
@@ -6677,10 +6693,10 @@ function _(e4, t4) {
|
|
|
6677
6693
|
const n5 = e4.status.startedAt, o4 = { flowId: e4.name ?? "default", stepId: t4.stepId, stepType: t4.stepType, phase: t4.phase, eventId: t4.eventId, timestamp: new Date(t4.now).toISOString(), elapsedMs: t4.now - n5 };
|
|
6678
6694
|
return t4.traceId && (o4.traceId = t4.traceId), t4.sourceId && (o4.sourceId = t4.sourceId), t4.parentEventId && (o4.parentEventId = t4.parentEventId), o4;
|
|
6679
6695
|
}
|
|
6680
|
-
function
|
|
6696
|
+
function R2(e4) {
|
|
6681
6697
|
return "object" == typeof e4 && null !== e4;
|
|
6682
6698
|
}
|
|
6683
|
-
function
|
|
6699
|
+
function z2(e4, t4, n5) {
|
|
6684
6700
|
if (null === e4 || "object" != typeof e4) return e4;
|
|
6685
6701
|
if (n5 >= 8) return e4;
|
|
6686
6702
|
const o4 = t4.get(e4);
|
|
@@ -6688,18 +6704,18 @@ function U2(e4, t4, n5) {
|
|
|
6688
6704
|
if (Array.isArray(e4)) {
|
|
6689
6705
|
const o5 = [];
|
|
6690
6706
|
t4.set(e4, o5);
|
|
6691
|
-
for (const r7 of e4) o5.push(
|
|
6707
|
+
for (const r7 of e4) o5.push(z2(r7, t4, n5 + 1));
|
|
6692
6708
|
return o5;
|
|
6693
6709
|
}
|
|
6694
6710
|
const r6 = {};
|
|
6695
6711
|
t4.set(e4, r6);
|
|
6696
|
-
for (const [o5, s4] of Object.entries(e4)) r6[o5] = "function" == typeof s4 ? s4 :
|
|
6712
|
+
for (const [o5, s4] of Object.entries(e4)) r6[o5] = "function" == typeof s4 ? s4 : z2(s4, t4, n5 + 1);
|
|
6697
6713
|
return r6;
|
|
6698
6714
|
}
|
|
6699
|
-
function
|
|
6700
|
-
const t4 = [], n5 = [], { simulation: o4, ...r6 } = e4, s4 =
|
|
6715
|
+
function U2(e4) {
|
|
6716
|
+
const t4 = [], n5 = [], { simulation: o4, ...r6 } = e4, s4 = z2(r6, /* @__PURE__ */ new WeakMap(), 0);
|
|
6701
6717
|
for (const e5 of o4) {
|
|
6702
|
-
const o5 =
|
|
6718
|
+
const o5 = Mn(e5);
|
|
6703
6719
|
if (0 === o5.length) continue;
|
|
6704
6720
|
const r7 = o5.join(".");
|
|
6705
6721
|
if (o5.length - 1 >= 8) {
|
|
@@ -6709,7 +6725,7 @@ function K(e4) {
|
|
|
6709
6725
|
let a4 = s4, i5 = true;
|
|
6710
6726
|
for (let e6 = 0; e6 < o5.length - 1; e6++) {
|
|
6711
6727
|
const t5 = a4[o5[e6]];
|
|
6712
|
-
if (!
|
|
6728
|
+
if (!R2(t5)) {
|
|
6713
6729
|
i5 = false;
|
|
6714
6730
|
break;
|
|
6715
6731
|
}
|
|
@@ -6720,21 +6736,21 @@ function K(e4) {
|
|
|
6720
6736
|
n5.push(r7);
|
|
6721
6737
|
continue;
|
|
6722
6738
|
}
|
|
6723
|
-
const
|
|
6724
|
-
"function" == typeof
|
|
6725
|
-
return t4.push({ fn: r7, args: e6, ts: Date.now() }),
|
|
6739
|
+
const u3 = a4[c2];
|
|
6740
|
+
"function" == typeof u3 ? a4[c2] = function(...e6) {
|
|
6741
|
+
return t4.push({ fn: r7, args: e6, ts: Date.now() }), u3.apply(this, e6);
|
|
6726
6742
|
} : n5.push(r7);
|
|
6727
6743
|
}
|
|
6728
6744
|
return { wrappedEnv: s4, calls: t4, unresolved: n5 };
|
|
6729
6745
|
}
|
|
6730
|
-
function
|
|
6746
|
+
function K2(e4, t4) {
|
|
6731
6747
|
try {
|
|
6732
6748
|
return e4[t4];
|
|
6733
6749
|
} catch {
|
|
6734
6750
|
return "[unreadable]";
|
|
6735
6751
|
}
|
|
6736
6752
|
}
|
|
6737
|
-
function
|
|
6753
|
+
function B2(e4) {
|
|
6738
6754
|
const t4 = /* @__PURE__ */ new WeakSet(), n5 = (e5, o4) => {
|
|
6739
6755
|
if (null === e5) return null;
|
|
6740
6756
|
if ("function" == typeof e5) return "[function]";
|
|
@@ -6754,7 +6770,7 @@ function F2(e4) {
|
|
|
6754
6770
|
return t5 === Object.prototype || null === t5;
|
|
6755
6771
|
})(r6)) {
|
|
6756
6772
|
const e6 = {};
|
|
6757
|
-
for (const t5 of Object.keys(r6)) e6[t5] = n5(
|
|
6773
|
+
for (const t5 of Object.keys(r6)) e6[t5] = n5(K2(r6, t5), o4 + 1);
|
|
6758
6774
|
s4 = e6;
|
|
6759
6775
|
} else s4 = (function(e6) {
|
|
6760
6776
|
try {
|
|
@@ -6770,27 +6786,27 @@ function F2(e4) {
|
|
|
6770
6786
|
};
|
|
6771
6787
|
return e4.map((e5) => n5(e5, 0));
|
|
6772
6788
|
}
|
|
6773
|
-
function
|
|
6774
|
-
return e4.map((e5) => ({ fn: e5.fn, args:
|
|
6789
|
+
function F2(e4) {
|
|
6790
|
+
return e4.map((e5) => ({ fn: e5.fn, args: B2(e5.args), ts: e5.ts }));
|
|
6775
6791
|
}
|
|
6776
|
-
function
|
|
6792
|
+
function V(e4, t4, n5, o4) {
|
|
6777
6793
|
if (!Number.isFinite(n5.max) || n5.max <= 0) throw new Error(`pushBounded: max must be > 0 (got ${n5.max})`);
|
|
6778
6794
|
if ("dropNewest" === (n5.onOverflow ?? "dropOldest")) return e4.length >= n5.max ? (o4 && o4([t4]), { appended: false, dropped: 1 }) : (e4.push(t4), { appended: true, dropped: 0 });
|
|
6779
6795
|
const r6 = [];
|
|
6780
6796
|
for (; e4.length >= n5.max; ) r6.push(e4.shift());
|
|
6781
6797
|
return e4.push(t4), r6.length > 0 && o4 && o4(r6), { appended: true, dropped: r6.length };
|
|
6782
6798
|
}
|
|
6783
|
-
var
|
|
6784
|
-
function
|
|
6785
|
-
|
|
6799
|
+
var N2 = /* @__PURE__ */ new WeakMap();
|
|
6800
|
+
function Y(e4, t4, n5, o4) {
|
|
6801
|
+
N2.get(e4) || (N2.set(e4, true), t4.warn(n5, o4));
|
|
6786
6802
|
}
|
|
6787
|
-
function
|
|
6788
|
-
|
|
6803
|
+
function J(e4) {
|
|
6804
|
+
N2.delete(e4);
|
|
6789
6805
|
}
|
|
6790
|
-
var
|
|
6806
|
+
var Z2 = 3e4;
|
|
6791
6807
|
var ee2 = () => Date.now();
|
|
6792
6808
|
function te2(e4) {
|
|
6793
|
-
if (void 0 !== e4) return "number" == typeof e4 ? { threshold: e4, cooldown:
|
|
6809
|
+
if (void 0 !== e4) return "number" == typeof e4 ? { threshold: e4, cooldown: Z2 } : { threshold: e4.threshold ?? 5, cooldown: e4.cooldown ?? Z2 };
|
|
6794
6810
|
}
|
|
6795
6811
|
function ne2(e4, t4, n5, o4, r6) {
|
|
6796
6812
|
if ("partial" === n5) return;
|
|
@@ -6800,7 +6816,7 @@ function ne2(e4, t4, n5, o4, r6) {
|
|
|
6800
6816
|
return "success" === n5 ? (s4.consecutiveFailures = 0, s4.state = "closed", s4.probing = false, void (s4.openUntil = void 0)) : (s4.consecutiveFailures += 1, "half-open" === s4.state ? (s4.state = "open", s4.probing = false, void (s4.openUntil = ee2() + r6)) : void (s4.consecutiveFailures >= o4 && (s4.state = "open", s4.probing = false, s4.openUntil = ee2() + r6)));
|
|
6801
6817
|
}
|
|
6802
6818
|
var re2 = 100;
|
|
6803
|
-
function
|
|
6819
|
+
function se2(e4, t4) {
|
|
6804
6820
|
return e4.status.destinations[t4] || (e4.status.destinations[t4] = { count: 0, failed: 0, duration: 0, queuePushSize: 0, dlqSize: 0 }), e4.status.destinations[t4];
|
|
6805
6821
|
}
|
|
6806
6822
|
function ae2(e4, t4, n5, o4) {
|
|
@@ -6813,17 +6829,17 @@ function ie2(e4, t4, n5, o4, r6) {
|
|
|
6813
6829
|
return (t5, a4) => {
|
|
6814
6830
|
try {
|
|
6815
6831
|
if (a4) return r6 ? (function(e5, t6, n6, o5, r7, s5) {
|
|
6816
|
-
const a5 = t6.dlq = t6.dlq || [], i5 = { max: t6.config.dlqMax ?? re2 }, c2 =
|
|
6832
|
+
const a5 = t6.dlq = t6.dlq || [], i5 = { max: t6.config.dlqMax ?? re2 }, c2 = V(a5, [o5, r7], i5);
|
|
6817
6833
|
if (c2.dropped > 0) {
|
|
6818
6834
|
const t7 = ae2(e5.status, o("destination", n6), "dlq", c2.dropped);
|
|
6819
|
-
|
|
6820
|
-
} else a5.length < i5.max &&
|
|
6821
|
-
const
|
|
6822
|
-
|
|
6823
|
-
const
|
|
6824
|
-
if (
|
|
6835
|
+
Y(a5, s5, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: n6, cap: i5.max, droppedCount: t7 });
|
|
6836
|
+
} else a5.length < i5.max && J(a5);
|
|
6837
|
+
const u3 = se2(e5, n6);
|
|
6838
|
+
u3.failed++, u3.dlqSize = a5.length, e5.status.failed++;
|
|
6839
|
+
const d2 = te2(t6.config.breaker);
|
|
6840
|
+
if (d2) {
|
|
6825
6841
|
const o6 = t6.config.id || n6;
|
|
6826
|
-
ne2(e5.status.breakers, o("destination", o6), "transport-failure",
|
|
6842
|
+
ne2(e5.status.breakers, o("destination", o6), "transport-failure", d2.threshold, d2.cooldown);
|
|
6827
6843
|
}
|
|
6828
6844
|
})(e4, r6, n5, a4, t5, o4) : e4.status.failed++, void o4.error("report error", { error: t5 instanceof Error ? t5.message : String(t5), event: a4.name });
|
|
6829
6845
|
e4.status.connectionErrors[s4] = (e4.status.connectionErrors[s4] ?? 0) + 1, o4.error("connection error", { error: t5 instanceof Error ? t5.message : String(t5) });
|
|
@@ -6831,13 +6847,13 @@ function ie2(e4, t4, n5, o4, r6) {
|
|
|
6831
6847
|
}
|
|
6832
6848
|
};
|
|
6833
6849
|
}
|
|
6834
|
-
function
|
|
6850
|
+
function ze(e4, t4) {
|
|
6835
6851
|
return e4.storeId && t4.stores[e4.storeId] ? t4.stores[e4.storeId] : t4.stores.__cache;
|
|
6836
6852
|
}
|
|
6837
|
-
function
|
|
6853
|
+
function Ue2(e4, t4) {
|
|
6838
6854
|
return e4 ? t4.stores[e4] : t4.stores.__cache;
|
|
6839
6855
|
}
|
|
6840
|
-
function
|
|
6856
|
+
function Ke2(e4) {
|
|
6841
6857
|
const t4 = {};
|
|
6842
6858
|
for (const [n5, o4] of Object.entries(e4)) {
|
|
6843
6859
|
const e5 = o4.config?.next;
|
|
@@ -6845,11 +6861,11 @@ function Be2(e4) {
|
|
|
6845
6861
|
}
|
|
6846
6862
|
return t4;
|
|
6847
6863
|
}
|
|
6848
|
-
function
|
|
6864
|
+
function Be(e4, t4) {
|
|
6849
6865
|
const n5 = e4.config || {}, o4 = e4[t4];
|
|
6850
6866
|
return void 0 !== o4 ? { config: { ...n5, [t4]: o4 }, chainValue: o4 } : { config: n5, chainValue: void 0 };
|
|
6851
6867
|
}
|
|
6852
|
-
function
|
|
6868
|
+
function Fe2(e4, t4 = {}) {
|
|
6853
6869
|
if (!e4) return [];
|
|
6854
6870
|
if (Array.isArray(e4)) return e4;
|
|
6855
6871
|
const n5 = [], o4 = /* @__PURE__ */ new Set();
|
|
@@ -6865,34 +6881,34 @@ function Re2(e4, t4 = {}) {
|
|
|
6865
6881
|
}
|
|
6866
6882
|
return n5;
|
|
6867
6883
|
}
|
|
6868
|
-
async function
|
|
6884
|
+
async function He2(e4, t4, n5) {
|
|
6869
6885
|
if (t4.init && !t4.config.init) {
|
|
6870
|
-
const o4 = t4.type || "unknown", r6 = e4.logger.scope(`transformer:${o4}`), s4 = { collector: e4, logger: r6, id: n5, ingest:
|
|
6886
|
+
const o4 = t4.type || "unknown", r6 = e4.logger.scope(`transformer:${o4}`), s4 = { collector: e4, logger: r6, id: n5, ingest: E(n5), config: t4.config, env: Qe2(t4.config.env), reportError: ie2(e4, "transformer", n5, r6) };
|
|
6871
6887
|
r6.debug("init");
|
|
6872
|
-
const a4 = await
|
|
6888
|
+
const a4 = await bt(t4.init, "TransformerInit", e4.hooks, e4.logger)(s4);
|
|
6873
6889
|
if (false === a4) return false;
|
|
6874
6890
|
t4.config = { ...a4 || t4.config, env: a4?.env || t4.config.env, init: true }, r6.debug("init done");
|
|
6875
6891
|
}
|
|
6876
6892
|
return true;
|
|
6877
6893
|
}
|
|
6878
6894
|
async function Ge2(e4, t4, n5, o4, r6, s4) {
|
|
6879
|
-
const a4 = t4.type || "unknown", i5 = e4.logger.scope(`transformer:${a4}`), c2 = { collector: e4, logger: i5, id: n5, ingest: r6, config: t4.config, env: { ...
|
|
6895
|
+
const a4 = t4.type || "unknown", i5 = e4.logger.scope(`transformer:${a4}`), c2 = { collector: e4, logger: i5, id: n5, ingest: r6, config: t4.config, env: { ...Qe2(t4.config.env), ...s4 ? { respond: s4 } : {} }, reportError: ie2(e4, "transformer", n5, i5) };
|
|
6880
6896
|
i5.debug("push", { event: o4.name });
|
|
6881
|
-
const
|
|
6882
|
-
g3.inEvent = o4,
|
|
6897
|
+
const u3 = "string" == typeof o4.id ? o4.id : "", { traceId: d2, sourceId: l3, parentEventId: f2 } = T2(o4, r6, e4), p3 = Date.now(), g3 = _(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "in", eventId: u3, now: p3, traceId: d2, sourceId: l3, parentEventId: f2 });
|
|
6898
|
+
g3.inEvent = o4, pn(e4, g3);
|
|
6883
6899
|
try {
|
|
6884
|
-
const r7 = await
|
|
6885
|
-
return a5.durationMs = s5 - p3, a5.outEvent = r7,
|
|
6900
|
+
const r7 = await bt(t4.push, "TransformerPush", e4.hooks, e4.logger)(o4, c2), s5 = Date.now(), a5 = _(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "out", eventId: u3, now: s5, traceId: d2, sourceId: l3, parentEventId: f2 });
|
|
6901
|
+
return a5.durationMs = s5 - p3, a5.outEvent = r7, pn(e4, a5), i5.debug("push done"), r7;
|
|
6886
6902
|
} catch (t5) {
|
|
6887
|
-
const o5 = Date.now(), r7 = _(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "error", eventId:
|
|
6888
|
-
throw r7.durationMs = o5 - p3, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) },
|
|
6903
|
+
const o5 = Date.now(), r7 = _(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "error", eventId: u3, now: o5, traceId: d2, sourceId: l3, parentEventId: f2 });
|
|
6904
|
+
throw r7.durationMs = o5 - p3, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, pn(e4, r7), t5;
|
|
6889
6905
|
}
|
|
6890
6906
|
}
|
|
6891
6907
|
function We2(e4, t4) {
|
|
6892
|
-
return e4 ? { ...e4, _meta: { ...e4._meta, path: [...e4._meta.path] } } :
|
|
6908
|
+
return e4 ? { ...e4, _meta: { ...e4._meta, path: [...e4._meta.path] } } : E(t4);
|
|
6893
6909
|
}
|
|
6894
6910
|
async function Le(e4, t4, n5, o4, r6, s4, a4) {
|
|
6895
|
-
r6 || (r6 =
|
|
6911
|
+
r6 || (r6 = E(n5[0] ?? "chain")), a4 && r6._meta && (r6._meta.chainPath = a4);
|
|
6896
6912
|
let i5 = o4, c2 = s4;
|
|
6897
6913
|
for (const o5 of n5) {
|
|
6898
6914
|
const s5 = t4[o5];
|
|
@@ -6902,8 +6918,8 @@ async function Le(e4, t4, n5, o4, r6, s4, a4) {
|
|
|
6902
6918
|
}
|
|
6903
6919
|
if (r6 && r6._meta && r6._meta.path.length > 256) return e4.logger.error(`Max path length exceeded at ${o5}`), { event: null, respond: c2 };
|
|
6904
6920
|
r6 && r6._meta && (r6._meta.hops++, r6._meta.path.push(o5));
|
|
6905
|
-
if (!await
|
|
6906
|
-
if (t5 instanceof
|
|
6921
|
+
if (!await tt(He2, (t5) => {
|
|
6922
|
+
if (t5 instanceof nt) throw t5;
|
|
6907
6923
|
return e4.status.failed++, e4.logger.scope(`transformer:${s5.type || "unknown"}`).error("transformer init failed", { transformer: o5, error: t5 }), false;
|
|
6908
6924
|
})(e4, s5, o5)) return { event: null, respond: c2 };
|
|
6909
6925
|
if (a4 && void 0 !== s5.config?.chainMocks?.[a4]) {
|
|
@@ -6916,162 +6932,163 @@ async function Le(e4, t4, n5, o4, r6, s4, a4) {
|
|
|
6916
6932
|
continue;
|
|
6917
6933
|
}
|
|
6918
6934
|
if (s5.config?.disabled) continue;
|
|
6919
|
-
const
|
|
6935
|
+
const u3 = s5.config?.cache, d2 = u3 ? ir(u3) : void 0, l3 = d2 ? ze(d2, e4) : void 0, f2 = s5.config?.state ? ur(s5.config.state) : void 0, p3 = f2?.filter((e5) => "get" === e5.mode), g3 = f2?.filter((e5) => "set" === e5.mode), m3 = async (t5) => g3 && 0 !== g3.length ? lr(g3, (t6) => Ue2(t6, e4), t5, e4) : t5;
|
|
6920
6936
|
let h3;
|
|
6921
|
-
if (
|
|
6922
|
-
const e5 =
|
|
6937
|
+
if (d2 && l3) {
|
|
6938
|
+
const e5 = sr(r6, i5), t5 = await ar(d2, l3, e5);
|
|
6923
6939
|
if ("HIT" === t5?.status && t5.value) {
|
|
6924
|
-
if (i5 = t5.value,
|
|
6940
|
+
if (i5 = t5.value, d2.stop) return { event: i5, respond: c2, stopped: true };
|
|
6925
6941
|
continue;
|
|
6926
6942
|
}
|
|
6927
6943
|
"MISS" === t5?.status && (h3 = { key: t5.key, ttl: t5.rule.ttl });
|
|
6928
6944
|
}
|
|
6929
6945
|
const v2 = s5.config.before;
|
|
6930
6946
|
if (v2) {
|
|
6931
|
-
const n6 =
|
|
6947
|
+
const n6 = Wn(v2, sr(r6, i5));
|
|
6932
6948
|
if (1 === n6.length) {
|
|
6933
|
-
const o6 =
|
|
6949
|
+
const o6 = Fe2(n6[0], Ke2(t4));
|
|
6934
6950
|
if (o6.length > 0) {
|
|
6935
6951
|
const n7 = await Le(e4, t4, o6, i5, r6, c2, a4);
|
|
6936
6952
|
if (null === n7.event) return { event: null, respond: n7.respond ?? c2 };
|
|
6937
6953
|
if (n7.stopped) return { event: Array.isArray(n7.event) ? n7.event[0] : n7.event, respond: n7.respond ?? c2, stopped: true };
|
|
6938
6954
|
n7.respond && (c2 = n7.respond), i5 = Array.isArray(n7.event) ? n7.event[0] : n7.event;
|
|
6939
6955
|
}
|
|
6940
|
-
} else n6.length > 1 && await Promise.all(n6.map((n7) =>
|
|
6956
|
+
} else n6.length > 1 && await Promise.all(n6.map((n7) => tt(Le, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, Fe2(n7, Ke2(t4)), i5, We2(r6, n7), void 0, a4)));
|
|
6941
6957
|
}
|
|
6942
|
-
p3 && p3.length > 0 && (i5 = await
|
|
6943
|
-
const y3 = await
|
|
6958
|
+
p3 && p3.length > 0 && (i5 = await lr(p3, (t5) => Ue2(t5, e4), i5, e4));
|
|
6959
|
+
const y3 = await tt(Ge2, (t5) => (e4.logger.scope(`transformer:${s5.type || "unknown"}`).error("Push failed", { error: t5 }), false))(e4, s5, o5, i5, r6, c2);
|
|
6944
6960
|
if (false === y3) return { event: null, respond: c2, droppedBy: o5 };
|
|
6945
6961
|
if (Array.isArray(y3)) {
|
|
6946
|
-
const s6 = n5.slice(n5.indexOf(o5) + 1),
|
|
6947
|
-
const o6 = await m3(n6.event || i5),
|
|
6962
|
+
const s6 = n5.slice(n5.indexOf(o5) + 1), u4 = await Promise.all(y3.map(async (n6) => {
|
|
6963
|
+
const o6 = await m3(n6.event || i5), u5 = We2(r6, "unknown");
|
|
6948
6964
|
if (n6.next) {
|
|
6949
|
-
const r7 =
|
|
6965
|
+
const r7 = Wn(n6.next, sr(u5, o6));
|
|
6950
6966
|
if (0 === r7.length) return { event: o6, respond: c2 };
|
|
6951
6967
|
if (1 === r7.length) {
|
|
6952
|
-
const n7 =
|
|
6953
|
-
return n7.length > 0 ? Le(e4, t4, n7, o6,
|
|
6968
|
+
const n7 = Fe2(r7[0], Ke2(t4));
|
|
6969
|
+
return n7.length > 0 ? Le(e4, t4, n7, o6, u5, c2, a4) : { event: o6, respond: c2 };
|
|
6954
6970
|
}
|
|
6955
|
-
return (await Promise.all(r7.map((n7) =>
|
|
6971
|
+
return (await Promise.all(r7.map((n7) => tt(Le, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, Fe2(n7, Ke2(t4)), o6, We2(u5, n7), void 0, a4)))).map((e5) => ({ event: e5.event, respond: void 0 }));
|
|
6956
6972
|
}
|
|
6957
|
-
return s6.length > 0 ? Le(e4, t4, s6, o6,
|
|
6973
|
+
return s6.length > 0 ? Le(e4, t4, s6, o6, u5, c2, a4) : { event: o6, respond: c2 };
|
|
6958
6974
|
}));
|
|
6959
|
-
let
|
|
6975
|
+
let d3 = c2;
|
|
6960
6976
|
const l4 = [];
|
|
6961
|
-
for (const e5 of
|
|
6977
|
+
for (const e5 of u4.flat()) if (null !== e5) if (e5 && "object" == typeof e5 && "event" in e5) {
|
|
6962
6978
|
const t5 = e5;
|
|
6963
|
-
if (t5.respond && (
|
|
6979
|
+
if (t5.respond && (d3 = t5.respond), null === t5.event) continue;
|
|
6964
6980
|
Array.isArray(t5.event) ? l4.push(...t5.event) : l4.push(t5.event);
|
|
6965
6981
|
} else l4.push(e5);
|
|
6966
|
-
return 0 === l4.length ? { event: null, respond:
|
|
6982
|
+
return 0 === l4.length ? { event: null, respond: d3 } : 1 === l4.length ? { event: l4[0], respond: d3 } : { event: l4, respond: d3 };
|
|
6967
6983
|
}
|
|
6968
6984
|
if (y3 && "object" == typeof y3) {
|
|
6969
6985
|
const { event: n6, respond: o6, next: s6 } = y3;
|
|
6970
6986
|
if (o6 && (c2 = o6), void 0 !== s6) {
|
|
6971
|
-
const o7 = await m3(n6 || i5),
|
|
6972
|
-
if (0 ===
|
|
6987
|
+
const o7 = await m3(n6 || i5), u4 = Wn(s6, sr(r6, o7));
|
|
6988
|
+
if (0 === u4.length) {
|
|
6973
6989
|
i5 = o7;
|
|
6974
6990
|
continue;
|
|
6975
6991
|
}
|
|
6976
|
-
if (1 ===
|
|
6977
|
-
const n7 =
|
|
6992
|
+
if (1 === u4.length) {
|
|
6993
|
+
const n7 = Fe2(u4[0], Ke2(t4));
|
|
6978
6994
|
return n7.length > 0 ? Le(e4, t4, n7, o7, r6, c2, a4) : (e4.logger.warn(`Branch target not found: ${JSON.stringify(s6)}`), { event: null, respond: c2 });
|
|
6979
6995
|
}
|
|
6980
|
-
return await Promise.all(
|
|
6996
|
+
return await Promise.all(u4.map((n7) => tt(Le, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, Fe2(n7, Ke2(t4)), o7, We2(r6, n7), void 0, a4))), { event: null, respond: void 0 };
|
|
6981
6997
|
}
|
|
6982
6998
|
n6 && (i5 = n6);
|
|
6983
6999
|
}
|
|
6984
|
-
g3 && g3.length > 0 && (i5 = await
|
|
7000
|
+
g3 && g3.length > 0 && (i5 = await lr(g3, (t5) => Ue2(t5, e4), i5, e4)), h3 && l3 && cr(l3, h3.key, i5, h3.ttl);
|
|
6985
7001
|
const w3 = s5.config.next, b3 = "string" == typeof w3 || Array.isArray(w3) && w3.every((e5) => "string" == typeof e5), k3 = void 0 !== w3 && !b3;
|
|
6986
7002
|
if ((!y3 || "object" == typeof y3 && !y3.next) && k3) {
|
|
6987
|
-
const n6 =
|
|
7003
|
+
const n6 = Wn(s5.config.next, sr(r6, i5));
|
|
6988
7004
|
if (1 === n6.length) {
|
|
6989
|
-
const o6 =
|
|
7005
|
+
const o6 = Fe2(n6[0], Ke2(t4));
|
|
6990
7006
|
return o6.length > 0 ? Le(e4, t4, o6, i5, r6, c2, a4) : { event: i5, respond: c2 };
|
|
6991
7007
|
}
|
|
6992
|
-
return n6.length > 1 ? (await Promise.all(n6.map((n7) =>
|
|
7008
|
+
return n6.length > 1 ? (await Promise.all(n6.map((n7) => tt(Le, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, Fe2(n7, Ke2(t4)), i5, We2(r6, n7), void 0, a4))), { event: null, respond: void 0 }) : { event: i5, respond: c2 };
|
|
6993
7009
|
}
|
|
6994
7010
|
}
|
|
6995
7011
|
return { event: i5, respond: c2 };
|
|
6996
7012
|
}
|
|
6997
|
-
function
|
|
6998
|
-
return e4 &&
|
|
7013
|
+
function Qe2(e4) {
|
|
7014
|
+
return e4 && he(e4) ? e4 : {};
|
|
6999
7015
|
}
|
|
7000
|
-
function
|
|
7016
|
+
function Ve2(e4) {
|
|
7001
7017
|
return "string" == typeof e4 || !(!Array.isArray(e4) || !e4.every((e5) => "string" == typeof e5));
|
|
7002
7018
|
}
|
|
7003
|
-
async function
|
|
7019
|
+
async function Ne2(e4, t4, n5) {
|
|
7004
7020
|
if (!t4.on || !t4.queueOn?.length) return;
|
|
7005
7021
|
const o4 = t4.queueOn;
|
|
7006
7022
|
t4.queueOn = [];
|
|
7007
7023
|
const r6 = n5 || t4.config?.id || "unknown";
|
|
7008
|
-
for (const { type: n6, data: s4 } of o4) at(n6) && !
|
|
7009
|
-
if (t5 instanceof
|
|
7024
|
+
for (const { type: n6, data: s4 } of o4) at(n6) && !lt(e4, t4, n6) || (await tt(t4.on, (t5) => {
|
|
7025
|
+
if (t5 instanceof nt) throw t5;
|
|
7010
7026
|
e4.status.failed++, e4.logger.scope("source").error("source on flush failed", { sourceId: r6, type: n6, error: t5 });
|
|
7011
|
-
})(n6, s4), at(n6) &&
|
|
7027
|
+
})(n6, s4), at(n6) && dt(e4, t4, n6));
|
|
7012
7028
|
}
|
|
7013
|
-
function
|
|
7029
|
+
function Ye2(e4) {
|
|
7014
7030
|
return Boolean(e4.config.init) && !e4.config.require?.length;
|
|
7015
7031
|
}
|
|
7016
|
-
function
|
|
7032
|
+
function Je2(e4) {
|
|
7017
7033
|
return "object" == typeof e4 && null !== e4;
|
|
7018
7034
|
}
|
|
7019
|
-
async function
|
|
7020
|
-
const { code: o4, config: r6 = {}, env: s4 = {}, primary: a4, next: i5, before: c2, cache: d2 } = n5,
|
|
7035
|
+
async function Xe(e4, t4, n5) {
|
|
7036
|
+
const { code: o4, config: r6 = {}, env: s4 = {}, primary: a4, next: i5, before: c2, cache: u3, terminus: d2 } = n5, l3 = r6.state ?? n5.state, f2 = l3 ? ur(l3) : void 0, p3 = u3, g3 = p3 ? ir({ ...p3, stop: p3.stop ?? true }) : void 0, m3 = Ve2(i5) ? Fe2(i5, Ke2(e4.transformers)) : void 0, h3 = Ve2(c2) ? Fe2(c2, Ke2(e4.transformers)) : void 0, v2 = d2 ?? e4.push, y3 = Boolean(d2), w3 = async (n6, o5, s5) => {
|
|
7037
|
+
if (y3) return v2(n6);
|
|
7021
7038
|
let a5;
|
|
7022
|
-
const
|
|
7023
|
-
const t5 =
|
|
7039
|
+
const u4 = "string" == typeof n6.id && "" !== n6.id ? n6 : { ...n6, id: Pe() }, d3 = h3 ?? (void 0 !== c2 ? (() => {
|
|
7040
|
+
const t5 = Wn(c2, sr(s5.ingest));
|
|
7024
7041
|
if (0 === t5.length) return [];
|
|
7025
|
-
return
|
|
7042
|
+
return Fe2(1 === t5.length ? t5[0] : t5, Ke2(e4.transformers));
|
|
7026
7043
|
})() : []);
|
|
7027
|
-
let
|
|
7028
|
-
if (
|
|
7029
|
-
const n7 = await Le(e4, e4.transformers,
|
|
7044
|
+
let l4 = [u4];
|
|
7045
|
+
if (d3.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
7046
|
+
const n7 = await Le(e4, e4.transformers, d3, u4, s5.ingest, s5.respond, `source.${t4}.before`);
|
|
7030
7047
|
if (null === n7.event) return { ok: true };
|
|
7031
7048
|
if (n7.stopped) return n7.respond && (s5.respond = n7.respond), { ok: true };
|
|
7032
7049
|
n7.respond && (s5.respond = n7.respond);
|
|
7033
|
-
const o6 = "string" == typeof
|
|
7034
|
-
if (Array.isArray(n7.event))
|
|
7050
|
+
const o6 = "string" == typeof u4.id ? u4.id : "";
|
|
7051
|
+
if (Array.isArray(n7.event)) l4 = n7.event.map((e5) => "" !== o6 && e5.id === o6 ? { ...e5, id: Pe() } : e5);
|
|
7035
7052
|
else {
|
|
7036
7053
|
const e5 = n7.event;
|
|
7037
|
-
|
|
7054
|
+
l4 = "" === o6 || "string" == typeof e5.id && "" !== e5.id ? [e5] : [{ ...e5, id: o6 }];
|
|
7038
7055
|
}
|
|
7039
7056
|
}
|
|
7040
|
-
if (
|
|
7041
|
-
const t5 =
|
|
7057
|
+
if (g3) {
|
|
7058
|
+
const t5 = ze(g3, e4);
|
|
7042
7059
|
if (t5) {
|
|
7043
|
-
const n7 =
|
|
7060
|
+
const n7 = sr(s5.ingest), o6 = await ar(g3, t5, n7);
|
|
7044
7061
|
if (o6) {
|
|
7045
|
-
if ("HIT" === o6.status && void 0 !== o6.value &&
|
|
7062
|
+
if ("HIT" === o6.status && void 0 !== o6.value && g3.stop) {
|
|
7046
7063
|
let t6 = o6.value;
|
|
7047
|
-
return o6.rule.update && (t6 = await
|
|
7064
|
+
return o6.rule.update && (t6 = await fr(t6, o6.rule.update, { ...n7, cache: { status: "HIT" } }, e4)), s5.respond?.(t6), { ok: true };
|
|
7048
7065
|
}
|
|
7049
|
-
if ("MISS" === o6.status &&
|
|
7050
|
-
const r7 = s5.respond, i6 = o6.rule.update, c3 = { ...n7, cache: { status: "MISS" } },
|
|
7051
|
-
|
|
7052
|
-
const t6 = await
|
|
7066
|
+
if ("MISS" === o6.status && g3.stop && s5.respond) {
|
|
7067
|
+
const r7 = s5.respond, i6 = o6.rule.update, c3 = { ...n7, cache: { status: "MISS" } }, u5 = o6.key, d4 = o6.rule.ttl, l5 = (n8) => {
|
|
7068
|
+
cr(t5, u5, n8, d4), i6 ? a5 = (async () => {
|
|
7069
|
+
const t6 = await fr(n8, i6, c3, e4);
|
|
7053
7070
|
r7(t6);
|
|
7054
7071
|
})() : r7(n8);
|
|
7055
7072
|
};
|
|
7056
|
-
s5.respond =
|
|
7073
|
+
s5.respond = l5;
|
|
7057
7074
|
}
|
|
7058
|
-
"MISS" !== o6.status ||
|
|
7075
|
+
"MISS" !== o6.status || g3.stop || cr(t5, o6.key, true, o6.rule.ttl);
|
|
7059
7076
|
}
|
|
7060
7077
|
}
|
|
7061
7078
|
}
|
|
7062
|
-
const
|
|
7063
|
-
const t5 =
|
|
7064
|
-
return 0 === t5.length ? { kind: "single", preChain: [] } : 1 === t5.length ? { kind: "single", preChain:
|
|
7079
|
+
const p4 = m3 ? { kind: "single", preChain: m3 } : void 0 !== i5 ? (() => {
|
|
7080
|
+
const t5 = Wn(i5, sr(s5.ingest));
|
|
7081
|
+
return 0 === t5.length ? { kind: "single", preChain: [] } : 1 === t5.length ? { kind: "single", preChain: Fe2(t5[0], Ke2(e4.transformers)) } : { kind: "many", branches: t5.map((t6) => Fe2(t6, Ke2(e4.transformers))) };
|
|
7065
7082
|
})() : { kind: "single", preChain: [] };
|
|
7066
|
-
|
|
7083
|
+
f2 && f2.length > 0 && (l4 = await Promise.all(l4.map((t5) => lr(f2, (t6) => Ue2(t6, e4), t5, e4))));
|
|
7067
7084
|
let w4 = { ok: true };
|
|
7068
|
-
for (const n7 of
|
|
7085
|
+
for (const n7 of l4) "many" === p4.kind ? (await Promise.all(p4.branches.map((a6, i6) => tt(async () => v2(n7, { ...o5, id: t4, ingest: We2(s5.ingest, `${t4}.${i6}`), respond: void 0, mapping: r6, preChain: a6 }), (t5) => (e4.logger.scope("source:many").error(`many branch ${i6} failed`, { error: t5 }), { ok: true }))())), w4 = { ok: true }) : w4 = await v2(n7, { ...o5, id: t4, ingest: s5.ingest, respond: s5.respond, mapping: r6, preChain: p4.preChain });
|
|
7069
7086
|
return a5 && await a5, w4;
|
|
7070
7087
|
}, b3 = async (n6) => {
|
|
7071
|
-
const o5 =
|
|
7072
|
-
if (!
|
|
7088
|
+
const o5 = E(t4), s5 = Ue((function(e5) {
|
|
7089
|
+
if (!Je2(e5)) return;
|
|
7073
7090
|
const t5 = e5.headers;
|
|
7074
|
-
if (
|
|
7091
|
+
if (Je2(t5)) {
|
|
7075
7092
|
if ((function(e6) {
|
|
7076
7093
|
return "get" in e6 && "function" == typeof e6.get;
|
|
7077
7094
|
})(t5)) return t5.get("traceparent") ?? void 0;
|
|
@@ -7080,26 +7097,26 @@ async function Qe2(e4, t4, n5) {
|
|
|
7080
7097
|
}
|
|
7081
7098
|
})(n6));
|
|
7082
7099
|
if (s5 && (o5._meta.trace = s5.trace, o5._meta.parentEventId = s5.parentSpan), !r6.ingest || void 0 === n6) return o5;
|
|
7083
|
-
const a5 = await
|
|
7100
|
+
const a5 = await ot(n6, r6.ingest, { collector: e4 });
|
|
7084
7101
|
return { ...o5, ...a5, _meta: o5._meta };
|
|
7085
|
-
}, k3 = e4.logger.scope("source").scope(t4), I2 = {
|
|
7086
|
-
const o5 = { ingest:
|
|
7102
|
+
}, k3 = e4.logger.scope("source").scope(t4), I2 = { ...s4, push: async (e5, n6 = {}) => {
|
|
7103
|
+
const o5 = { ingest: E(t4), respond: void 0 };
|
|
7087
7104
|
return w3(e5, n6, o5);
|
|
7088
|
-
} }, C3 = { collector: e4, logger: k3, id: t4, config: r6, env: I2, withScope: async (e5, t5, n6) => {
|
|
7105
|
+
}, command: e4.command, sources: e4.sources, elb: e4.elb, logger: k3 }, C3 = { collector: e4, logger: k3, id: t4, config: r6, env: I2, withScope: async (e5, t5, n6) => {
|
|
7089
7106
|
const o5 = { ingest: await b3(e5), respond: t5 };
|
|
7090
7107
|
return n6({ ...I2, push: (e6, t6 = {}) => w3(e6, t6, o5), ingest: o5.ingest, respond: o5.respond });
|
|
7091
|
-
}, reportError: ie2(e4, "source", t4, k3) },
|
|
7092
|
-
if (n6 instanceof
|
|
7108
|
+
}, reportError: ie2(e4, "source", t4, k3) }, E3 = await tt(o4, (n6) => {
|
|
7109
|
+
if (n6 instanceof nt) throw n6;
|
|
7093
7110
|
e4.status.failed++, e4.logger.scope("source").error("source factory failed", { sourceId: t4, error: n6 });
|
|
7094
7111
|
})(C3);
|
|
7095
|
-
if (!
|
|
7096
|
-
const S2 =
|
|
7097
|
-
return I2.logger = q3, a4 && (
|
|
7112
|
+
if (!E3) return;
|
|
7113
|
+
const S2 = E3.type || "unknown", q3 = e4.logger.scope(S2).scope(t4);
|
|
7114
|
+
return I2.logger = q3, a4 && (E3.config = { ...E3.config, primary: a4 }), E3;
|
|
7098
7115
|
}
|
|
7099
7116
|
async function Ze2(e4, t4 = {}) {
|
|
7100
7117
|
const n5 = {};
|
|
7101
7118
|
for (const [o4, r6] of Object.entries(t4)) {
|
|
7102
|
-
const t5 = await
|
|
7119
|
+
const t5 = await Xe(e4, o4, r6);
|
|
7103
7120
|
if (!t5) continue;
|
|
7104
7121
|
const s4 = r6.config?.require;
|
|
7105
7122
|
t5.config = { ...t5.config, init: false, ...s4 ? { require: [...s4] } : {} }, n5[o4] = t5;
|
|
@@ -7108,20 +7125,20 @@ async function Ze2(e4, t4 = {}) {
|
|
|
7108
7125
|
for (const t5 of Object.keys(n5)) {
|
|
7109
7126
|
const n6 = e4.sources[t5];
|
|
7110
7127
|
let o4 = false;
|
|
7111
|
-
n6.init && await
|
|
7112
|
-
if (n7 instanceof
|
|
7128
|
+
n6.init && await tt(n6.init.bind(n6), (n7) => {
|
|
7129
|
+
if (n7 instanceof nt) throw n7;
|
|
7113
7130
|
o4 = true, e4.status.failed++, e4.logger.scope("source").error("source init failed", { sourceId: t5, error: n7 });
|
|
7114
|
-
})(), o4 || (n6.config.init = true,
|
|
7131
|
+
})(), o4 || (n6.config.init = true, Ye2(n6) && await Ne2(e4, n6, t5));
|
|
7115
7132
|
}
|
|
7116
7133
|
return await et2(e4), n5;
|
|
7117
7134
|
}
|
|
7118
7135
|
async function et2(e4) {
|
|
7119
7136
|
for (const [t4, n5] of Object.entries(e4.sources)) {
|
|
7120
|
-
if (
|
|
7137
|
+
if (Ye2(n5)) continue;
|
|
7121
7138
|
const o4 = n5.config.require;
|
|
7122
7139
|
if (!o4?.length) continue;
|
|
7123
7140
|
const r6 = o4.filter((t5) => !ct(e4, t5));
|
|
7124
|
-
r6.length !== o4.length && (n5.config.require = r6,
|
|
7141
|
+
r6.length !== o4.length && (n5.config.require = r6, Ye2(n5) && await Ne2(e4, n5, t4));
|
|
7125
7142
|
}
|
|
7126
7143
|
for (const [t4, n5] of Object.entries(e4.pending.destinations)) {
|
|
7127
7144
|
if (!e4.pending.destinations[t4] || e4.destinations[t4]) continue;
|
|
@@ -7130,7 +7147,7 @@ async function et2(e4) {
|
|
|
7130
7147
|
const r6 = o4.filter((t5) => !ct(e4, t5));
|
|
7131
7148
|
if (n5.config && (n5.config.require = r6), r6.length > 0) continue;
|
|
7132
7149
|
delete e4.pending.destinations[t4];
|
|
7133
|
-
const s4 =
|
|
7150
|
+
const s4 = Tt2(n5);
|
|
7134
7151
|
false !== s4.config.queue && (s4.queuePush = [...e4.queue]), e4.destinations[t4] = s4;
|
|
7135
7152
|
}
|
|
7136
7153
|
}
|
|
@@ -7141,18 +7158,18 @@ function tt2(e4) {
|
|
|
7141
7158
|
return "object" == typeof t4 && null !== t4 && ("scope" in t4 && "function" == typeof t4.scope);
|
|
7142
7159
|
}
|
|
7143
7160
|
var nt2 = false;
|
|
7144
|
-
function
|
|
7161
|
+
function ot2() {
|
|
7145
7162
|
nt2 || (nt2 = true, "undefined" != typeof console && "function" == typeof console.warn && console.warn("walkerOS: ignored an on-dispatch call with a non-collector argument"));
|
|
7146
7163
|
}
|
|
7147
|
-
function
|
|
7148
|
-
if (n5 instanceof
|
|
7164
|
+
function rt2(e4, t4, n5, o4) {
|
|
7165
|
+
if (n5 instanceof nt) throw n5;
|
|
7149
7166
|
e4.logger.scope("on").error("on callback failed", { kind: t4, ...o4, error: n5 });
|
|
7150
7167
|
}
|
|
7151
|
-
var
|
|
7168
|
+
var st2 = [n.Commands.Consent, n.Commands.User, n.Commands.Globals, n.Commands.Custom];
|
|
7152
7169
|
function at(e4) {
|
|
7153
|
-
return
|
|
7170
|
+
return st2.includes(e4);
|
|
7154
7171
|
}
|
|
7155
|
-
function
|
|
7172
|
+
function it2(e4, t4) {
|
|
7156
7173
|
switch (t4) {
|
|
7157
7174
|
case n.Commands.Consent:
|
|
7158
7175
|
return Object.keys(e4.consent).length > 0;
|
|
@@ -7172,7 +7189,7 @@ function ct(e4, t4) {
|
|
|
7172
7189
|
case n.Commands.User:
|
|
7173
7190
|
case n.Commands.Globals:
|
|
7174
7191
|
case n.Commands.Custom:
|
|
7175
|
-
return
|
|
7192
|
+
return it2(e4, t4);
|
|
7176
7193
|
case n.Commands.Run:
|
|
7177
7194
|
case n.Commands.Ready:
|
|
7178
7195
|
return true === e4.allowed;
|
|
@@ -7180,15 +7197,15 @@ function ct(e4, t4) {
|
|
|
7180
7197
|
return e4.seenEvents.has(String(t4));
|
|
7181
7198
|
}
|
|
7182
7199
|
}
|
|
7183
|
-
function
|
|
7200
|
+
function ut(e4, t4) {
|
|
7184
7201
|
return e4.cellVersion[String(t4)] ?? 0;
|
|
7185
7202
|
}
|
|
7186
|
-
function
|
|
7203
|
+
function dt(e4, t4, n5) {
|
|
7187
7204
|
let o4 = e4.delivery.get(t4);
|
|
7188
|
-
o4 || (o4 = {}, e4.delivery.set(t4, o4)), o4[String(n5)] =
|
|
7205
|
+
o4 || (o4 = {}, e4.delivery.set(t4, o4)), o4[String(n5)] = ut(e4, n5);
|
|
7189
7206
|
}
|
|
7190
|
-
function
|
|
7191
|
-
return e4.allowed &&
|
|
7207
|
+
function lt(e4, t4, n5) {
|
|
7208
|
+
return e4.allowed && ut(e4, n5) > (function(e5, t5, n6) {
|
|
7192
7209
|
const o4 = e5.delivery.get(t5), r6 = o4?.[String(n6)];
|
|
7193
7210
|
return void 0 === r6 ? -1 : r6;
|
|
7194
7211
|
})(e4, t4, n5);
|
|
@@ -7199,7 +7216,7 @@ function ft(e4) {
|
|
|
7199
7216
|
e4.cascade = void 0;
|
|
7200
7217
|
});
|
|
7201
7218
|
}
|
|
7202
|
-
function
|
|
7219
|
+
function pt(e4, t4, n5) {
|
|
7203
7220
|
const o4 = e4.cascade;
|
|
7204
7221
|
if (!o4) return true;
|
|
7205
7222
|
let r6 = o4.counts.get(t4);
|
|
@@ -7211,28 +7228,28 @@ function gt2(e4, t4) {
|
|
|
7211
7228
|
return { collector: e4, logger: e4.logger.scope("on").scope(String(t4)) };
|
|
7212
7229
|
}
|
|
7213
7230
|
async function mt(e4, t4, n5) {
|
|
7214
|
-
if (!tt2(e4)) return void
|
|
7215
|
-
const o4 = e4.on, r6 = o4[t4] || [], s4 =
|
|
7231
|
+
if (!tt2(e4)) return void ot2();
|
|
7232
|
+
const o4 = e4.on, r6 = o4[t4] || [], s4 = ue(n5) ? n5 : [n5];
|
|
7216
7233
|
s4.forEach((e5) => {
|
|
7217
7234
|
r6.push(e5);
|
|
7218
7235
|
}), o4[t4] = r6, vt2(e4, t4, s4);
|
|
7219
7236
|
}
|
|
7220
|
-
function
|
|
7237
|
+
function ht(e4, t4, n5, o4, r6) {
|
|
7221
7238
|
if (!t4.on) return;
|
|
7222
|
-
const s4 = t4.type || "unknown", a4 = e4.logger.scope(s4).scope("on").scope(o4), i5 = { collector: e4, logger: a4, id: n5, config: t4.config, data: r6, env:
|
|
7223
|
-
|
|
7239
|
+
const s4 = t4.type || "unknown", a4 = e4.logger.scope(s4).scope("on").scope(o4), i5 = { collector: e4, logger: a4, id: n5, config: t4.config, data: r6, env: Pt2(t4.env, t4.config.env), reportError: ie2(e4, "destination", n5, a4, t4) };
|
|
7240
|
+
et(t4.on, (t5) => rt2(e4, "destination", t5, { destId: n5, type: o4 }))(o4, i5);
|
|
7224
7241
|
}
|
|
7225
7242
|
function vt2(e4, t4, o4, r6) {
|
|
7226
|
-
if (!tt2(e4)) return void
|
|
7243
|
+
if (!tt2(e4)) return void ot2();
|
|
7227
7244
|
const s4 = yt(e4, t4, r6);
|
|
7228
7245
|
if (o4.length) switch (t4) {
|
|
7229
7246
|
case n.Commands.Consent:
|
|
7230
7247
|
!(function(e5, t5, o5) {
|
|
7231
7248
|
const r7 = o5 || e5.consent, s5 = gt2(e5, n.Commands.Consent);
|
|
7232
7249
|
t5.forEach((t6) => {
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
}),
|
|
7250
|
+
lt(e5, t6, n.Commands.Consent) && pt(e5, t6, n.Commands.Consent) && (Object.keys(r7).filter((e6) => e6 in t6).forEach((n5) => {
|
|
7251
|
+
et(t6[n5], (t7) => rt2(e5, "consent", t7, { key: n5 }))(r7, s5);
|
|
7252
|
+
}), dt(e5, t6, n.Commands.Consent));
|
|
7236
7253
|
});
|
|
7237
7254
|
})(e4, o4, r6);
|
|
7238
7255
|
break;
|
|
@@ -7241,7 +7258,7 @@ function vt2(e4, t4, o4, r6) {
|
|
|
7241
7258
|
if (!e5.allowed) return;
|
|
7242
7259
|
const o5 = gt2(e5, n.Commands.Ready);
|
|
7243
7260
|
t5.forEach((t6) => {
|
|
7244
|
-
|
|
7261
|
+
et(t6, (t7) => rt2(e5, "ready", t7))(void 0, o5);
|
|
7245
7262
|
});
|
|
7246
7263
|
})(e4, o4);
|
|
7247
7264
|
break;
|
|
@@ -7250,7 +7267,7 @@ function vt2(e4, t4, o4, r6) {
|
|
|
7250
7267
|
if (!e5.allowed) return;
|
|
7251
7268
|
const o5 = gt2(e5, n.Commands.Run);
|
|
7252
7269
|
t5.forEach((t6) => {
|
|
7253
|
-
|
|
7270
|
+
et(t6, (t7) => rt2(e5, "run", t7))(void 0, o5);
|
|
7254
7271
|
});
|
|
7255
7272
|
})(e4, o4);
|
|
7256
7273
|
break;
|
|
@@ -7259,14 +7276,14 @@ function vt2(e4, t4, o4, r6) {
|
|
|
7259
7276
|
if (!e5.session) return;
|
|
7260
7277
|
const o5 = gt2(e5, n.Commands.Session);
|
|
7261
7278
|
t5.forEach((t6) => {
|
|
7262
|
-
|
|
7279
|
+
et(t6, (t7) => rt2(e5, "session", t7))(e5.session, o5);
|
|
7263
7280
|
});
|
|
7264
7281
|
})(e4, o4);
|
|
7265
7282
|
break;
|
|
7266
7283
|
default: {
|
|
7267
7284
|
const n5 = gt2(e4, t4), r7 = at(t4);
|
|
7268
7285
|
o4.forEach((o5) => {
|
|
7269
|
-
"function" == typeof o5 && (r7 && !
|
|
7286
|
+
"function" == typeof o5 && (r7 && !lt(e4, o5, t4) || r7 && !pt(e4, o5, t4) || (et(o5, (n6) => rt2(e4, "generic", n6, { type: t4 }))(s4, n5), r7 && dt(e4, o5, t4)));
|
|
7270
7287
|
});
|
|
7271
7288
|
break;
|
|
7272
7289
|
}
|
|
@@ -7292,22 +7309,22 @@ function yt(e4, t4, o4) {
|
|
|
7292
7309
|
}
|
|
7293
7310
|
async function wt2(e4, t4, n5, o4, r6) {
|
|
7294
7311
|
if (!t4.on) return false;
|
|
7295
|
-
if (at(o4) && !
|
|
7296
|
-
if (at(o4) && !
|
|
7297
|
-
const s4 = await
|
|
7298
|
-
return at(o4) &&
|
|
7312
|
+
if (at(o4) && !lt(e4, t4, o4)) return false;
|
|
7313
|
+
if (at(o4) && !pt(e4, t4, o4)) return false;
|
|
7314
|
+
const s4 = await tt(t4.on, (t5) => rt2(e4, "source", t5, { sourceId: n5, type: o4 }))(o4, r6);
|
|
7315
|
+
return at(o4) && dt(e4, t4, o4), false === s4;
|
|
7299
7316
|
}
|
|
7300
7317
|
async function bt2(e4) {
|
|
7301
|
-
if (tt2(e4)) for (const t4 of
|
|
7302
|
-
if (!
|
|
7318
|
+
if (tt2(e4)) for (const t4 of st2) {
|
|
7319
|
+
if (!it2(e4, t4)) continue;
|
|
7303
7320
|
const n5 = yt(e4, t4);
|
|
7304
7321
|
vt2(e4, t4, e4.on[t4] || []);
|
|
7305
|
-
for (const [o4, r6] of Object.entries(e4.sources))
|
|
7322
|
+
for (const [o4, r6] of Object.entries(e4.sources)) Ye2(r6) && await wt2(e4, r6, o4, t4, n5);
|
|
7306
7323
|
}
|
|
7307
|
-
else
|
|
7324
|
+
else ot2();
|
|
7308
7325
|
}
|
|
7309
7326
|
async function kt2(e4, t4, n5, o4) {
|
|
7310
|
-
if (!tt2(e4)) return
|
|
7327
|
+
if (!tt2(e4)) return ot2(), true;
|
|
7311
7328
|
e4.seenEvents.add(String(t4));
|
|
7312
7329
|
let r6 = n5 || [];
|
|
7313
7330
|
n5 || (r6 = e4.on[t4] || []);
|
|
@@ -7318,18 +7335,18 @@ async function kt2(e4, t4, n5, o4) {
|
|
|
7318
7335
|
const e5 = o5.config.require.indexOf(t4);
|
|
7319
7336
|
-1 !== e5 && o5.config.require.splice(e5, 1);
|
|
7320
7337
|
}
|
|
7321
|
-
if (o5.on) if (
|
|
7338
|
+
if (o5.on) if (Ye2(o5)) {
|
|
7322
7339
|
await wt2(e4, o5, n6, t4, s4) && (a4 = true);
|
|
7323
7340
|
} else o5.queueOn = o5.queueOn || [], o5.queueOn.push({ type: t4, data: s4 });
|
|
7324
7341
|
}
|
|
7325
7342
|
Object.entries(e4.destinations).forEach(([n6, o5]) => {
|
|
7326
7343
|
if (o5.on) {
|
|
7327
7344
|
if (!o5.config.init) return o5.queueOn = o5.queueOn || [], void o5.queueOn.push({ type: t4, data: s4 });
|
|
7328
|
-
|
|
7345
|
+
ht(e4, o5, n6, t4, s4);
|
|
7329
7346
|
}
|
|
7330
7347
|
});
|
|
7331
|
-
for (const [t5, n6] of Object.entries(e4.sources))
|
|
7332
|
-
const i5 = Object.values(e4.sources).some((e5) => !
|
|
7348
|
+
for (const [t5, n6] of Object.entries(e4.sources)) Ye2(n6) && n6.queueOn?.length && await Ne2(e4, n6, t5);
|
|
7349
|
+
const i5 = Object.values(e4.sources).some((e5) => !Ye2(e5) && e5.config.require?.length);
|
|
7333
7350
|
return (Object.keys(e4.pending.destinations).length > 0 || i5) && await et2(e4), vt2(e4, t4, r6, o4), !a4;
|
|
7334
7351
|
}
|
|
7335
7352
|
function It2(e4) {
|
|
@@ -7353,72 +7370,72 @@ var St2 = Object.freeze({ batched: true });
|
|
|
7353
7370
|
function qt(e4) {
|
|
7354
7371
|
return e4 === St2;
|
|
7355
7372
|
}
|
|
7356
|
-
function
|
|
7373
|
+
function xt2(e4) {
|
|
7357
7374
|
return void 0 === e4 ? {} : "number" == typeof e4 ? { wait: e4 } : { wait: e4.wait, size: e4.size, age: e4.age };
|
|
7358
7375
|
}
|
|
7359
7376
|
function Ot2(e4, t4, n5) {
|
|
7360
7377
|
if (!e4) return [];
|
|
7361
|
-
if (Array.isArray(e4) && e4.every((e5) => "string" == typeof e5)) return
|
|
7362
|
-
if ("string" == typeof e4) return
|
|
7363
|
-
const o4 =
|
|
7364
|
-
return 0 === o4.length ? [] : 1 === o4.length ?
|
|
7378
|
+
if (Array.isArray(e4) && e4.every((e5) => "string" == typeof e5)) return Fe2(e4, t4);
|
|
7379
|
+
if ("string" == typeof e4) return Fe2(e4, t4);
|
|
7380
|
+
const o4 = Wn(e4, sr(n5));
|
|
7381
|
+
return 0 === o4.length ? [] : 1 === o4.length ? Fe2(o4[0], t4) : Fe2(o4, t4);
|
|
7365
7382
|
}
|
|
7366
7383
|
async function jt2(e4, t4) {
|
|
7367
7384
|
const { code: n5, config: o4 = {}, env: r6 = {}, before: s4, next: a4, cache: i5, state: c2 } = t4;
|
|
7368
|
-
if (!
|
|
7369
|
-
const
|
|
7370
|
-
let
|
|
7371
|
-
a4 && (
|
|
7372
|
-
let l3 =
|
|
7385
|
+
if (!ge(n5.push)) return Mt({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
|
|
7386
|
+
const u3 = o4 || { init: false };
|
|
7387
|
+
let d2 = s4 ? { ...u3, before: s4 } : { ...u3 };
|
|
7388
|
+
a4 && (d2 = { ...d2, next: a4 }), i5 && (d2 = { ...d2, cache: i5 }), void 0 !== c2 && void 0 === d2.state && (d2 = { ...d2, state: c2 });
|
|
7389
|
+
let l3 = d2.id;
|
|
7373
7390
|
if (!l3) do {
|
|
7374
|
-
l3 =
|
|
7391
|
+
l3 = Me(5, "abcdefghijklmnopqrstuvwxyz");
|
|
7375
7392
|
} while (e4.destinations[l3] || e4.pending.destinations[l3]);
|
|
7376
|
-
if (
|
|
7393
|
+
if (d2.require?.length) {
|
|
7377
7394
|
e4.pending.destinations[l3] = t4, await et2(e4);
|
|
7378
7395
|
const n6 = e4.destinations[l3];
|
|
7379
|
-
return n6 ? $
|
|
7396
|
+
return n6 ? $t(e4, void 0, {}, { [l3]: n6 }) : Mt({ ok: true });
|
|
7380
7397
|
}
|
|
7381
|
-
const f2 = { ...n5, config:
|
|
7382
|
-
return e4.destinations[l3] = f2, false !== f2.config.queue && (f2.queuePush = [...e4.queue]), $
|
|
7398
|
+
const f2 = { ...n5, config: d2, env: Pt2(n5.env, r6) };
|
|
7399
|
+
return e4.destinations[l3] = f2, false !== f2.config.queue && (f2.queuePush = [...e4.queue]), $t(e4, void 0, {}, { [l3]: f2 });
|
|
7383
7400
|
}
|
|
7384
|
-
async function $
|
|
7401
|
+
async function $t(e4, t4, n5 = {}, o4) {
|
|
7385
7402
|
const { allowed: r6, consent: s4, user: a4 } = e4;
|
|
7386
|
-
if (!r6) return
|
|
7403
|
+
if (!r6) return Mt({ ok: false });
|
|
7387
7404
|
if (t4) {
|
|
7388
7405
|
const n6 = e4.config.queueMax;
|
|
7389
7406
|
if (void 0 === n6) throw new Error("Collector.Config.queueMax is undefined; defaults must be seeded by collector()");
|
|
7390
|
-
const o5 =
|
|
7407
|
+
const o5 = V(e4.queue, t4, { max: n6 });
|
|
7391
7408
|
if (o5.dropped > 0) {
|
|
7392
7409
|
const t5 = ae2(e4.status, o("collector"), "queue", o5.dropped);
|
|
7393
|
-
|
|
7394
|
-
} else e4.queue.length < n6 &&
|
|
7410
|
+
Y(e4.queue, e4.logger, "collector.queue overflow; oldest events dropped", { buffer: "queue", cap: n6, droppedCount: t5 });
|
|
7411
|
+
} else e4.queue.length < n6 && J(e4.queue);
|
|
7395
7412
|
e4.status.in++;
|
|
7396
7413
|
}
|
|
7397
7414
|
o4 || (o4 = e4.destinations);
|
|
7398
|
-
const i5 = e4.transformers ?
|
|
7415
|
+
const i5 = e4.transformers ? Ke2(e4.transformers) : {}, c2 = await Promise.all(Object.entries(o4 || {}).map(async ([o5, r7]) => {
|
|
7399
7416
|
if (r7.config.disabled) return { id: o5, destination: r7, skipped: true };
|
|
7400
|
-
const c3 = r7.config.id || o5,
|
|
7401
|
-
if (
|
|
7417
|
+
const c3 = r7.config.id || o5, u4 = o("destination", c3), d3 = te2(r7.config.breaker);
|
|
7418
|
+
if (d3 && (function(e5, t5, n6) {
|
|
7402
7419
|
const o6 = e5[t5];
|
|
7403
7420
|
if (!o6 || "closed" === o6.state) return false;
|
|
7404
7421
|
if ("half-open" === o6.state) return true === o6.probing;
|
|
7405
7422
|
const r8 = ee2();
|
|
7406
7423
|
return void 0 !== o6.openUntil && r8 < o6.openUntil || (o6.state = "half-open", o6.probing = true, o6.openUntil = r8 + n6, false);
|
|
7407
|
-
})(e4.status.breakers,
|
|
7424
|
+
})(e4.status.breakers, u4, d3.cooldown)) return { id: o5, destination: r7, skipped: true };
|
|
7408
7425
|
const y4 = (t5) => {
|
|
7409
|
-
|
|
7426
|
+
d3 && ne2(e4.status.breakers, u4, t5, d3.threshold, d3.cooldown);
|
|
7410
7427
|
}, b3 = () => {
|
|
7411
|
-
|
|
7428
|
+
d3 && (function(e5, t5) {
|
|
7412
7429
|
const n6 = e5[t5];
|
|
7413
7430
|
n6 && "half-open" === n6.state && true === n6.probing && (n6.state = "open", n6.probing = false);
|
|
7414
|
-
})(e4.status.breakers,
|
|
7431
|
+
})(e4.status.breakers, u4);
|
|
7415
7432
|
};
|
|
7416
7433
|
let I2 = (r7.queuePush || []).map((e5) => ({ ...e5, consent: s4 }));
|
|
7417
|
-
r7.queuePush = [], t4 && I2.push(
|
|
7418
|
-
const C3 = n5.ingest ? { ...n5.ingest, _meta: { ...n5.ingest._meta, path: [...n5.ingest._meta.path] } } :
|
|
7434
|
+
r7.queuePush = [], t4 && I2.push(we(t4));
|
|
7435
|
+
const C3 = n5.ingest ? { ...n5.ingest, _meta: { ...n5.ingest._meta, path: [...n5.ingest._meta.path] } } : E("unknown");
|
|
7419
7436
|
if (!I2.length && !r7.queueOn?.length) return b3(), { id: o5, destination: r7, skipped: true };
|
|
7420
7437
|
if (!I2.length && r7.queueOn?.length) {
|
|
7421
|
-
if (!
|
|
7438
|
+
if (!Oe(r7.config.consent, s4)) return b3(), { id: o5, destination: r7, skipped: true };
|
|
7422
7439
|
let t5 = false;
|
|
7423
7440
|
try {
|
|
7424
7441
|
t5 = await At2(e4, r7, o5, true);
|
|
@@ -7429,25 +7446,25 @@ async function $t2(e4, t4, n5 = {}, o4) {
|
|
|
7429
7446
|
}
|
|
7430
7447
|
return b3(), { id: o5, destination: r7, skipped: !t5 };
|
|
7431
7448
|
}
|
|
7432
|
-
const
|
|
7433
|
-
const n6 =
|
|
7434
|
-
if (n6) return t5.consent = n6,
|
|
7449
|
+
const E3 = [], S2 = I2.filter((t5) => {
|
|
7450
|
+
const n6 = Oe(r7.config.consent, s4, t5.consent);
|
|
7451
|
+
if (n6) return t5.consent = n6, E3.push(t5), false;
|
|
7435
7452
|
const a5 = _(e4, { stepId: o("destination", o5), stepType: "destination", phase: "skip", eventId: "string" == typeof t5.id ? t5.id : "", now: Date.now(), ...T2(t5, C3, e4) });
|
|
7436
|
-
return a5.skipReason = "consent", s4 && (a5.consent = { ...s4 }), r7.config.consent && (a5.meta = { required: { ...r7.config.consent } }),
|
|
7453
|
+
return a5.skipReason = "consent", s4 && (a5.consent = { ...s4 }), r7.config.consent && (a5.meta = { required: { ...r7.config.consent } }), pn(e4, a5), true;
|
|
7437
7454
|
});
|
|
7438
7455
|
if (S2.length > 0) {
|
|
7439
7456
|
const t5 = r7.queuePush, n6 = r7.config.id || o5, s5 = { max: r7.config.queueMax ?? 1e3 };
|
|
7440
7457
|
let a5 = 0;
|
|
7441
7458
|
for (const e5 of S2) {
|
|
7442
|
-
a5 +=
|
|
7459
|
+
a5 += V(t5, e5, s5).dropped;
|
|
7443
7460
|
}
|
|
7444
7461
|
if (a5 > 0) {
|
|
7445
|
-
|
|
7462
|
+
se2(e4, n6);
|
|
7446
7463
|
const o6 = ae2(e4.status, o("destination", n6), "queue", a5);
|
|
7447
|
-
|
|
7448
|
-
} else t5.length < s5.max &&
|
|
7464
|
+
Y(t5, e4.logger.scope(r7.type || "unknown"), "destination.queuePush overflow; oldest events dropped", { buffer: "queuePush", destination: n6, cap: s5.max, droppedCount: o6 });
|
|
7465
|
+
} else t5.length < s5.max && J(t5);
|
|
7449
7466
|
}
|
|
7450
|
-
if (!
|
|
7467
|
+
if (!E3.length) return b3(), { id: o5, destination: r7, queue: I2 };
|
|
7451
7468
|
let q3, x2, $2 = false;
|
|
7452
7469
|
try {
|
|
7453
7470
|
$2 = await At2(e4, r7, o5, true);
|
|
@@ -7458,67 +7475,67 @@ async function $t2(e4, t4, n5 = {}, o4) {
|
|
|
7458
7475
|
}
|
|
7459
7476
|
if (!$2) return b3(), { id: o5, destination: r7, queue: I2 };
|
|
7460
7477
|
r7.dlq || (r7.dlq = []);
|
|
7461
|
-
const M2 = Ot2(r7.config.before, i5, C3), P3 = r7.config.next,
|
|
7462
|
-
let H3 = 0,
|
|
7463
|
-
return await Promise.all(
|
|
7478
|
+
const M2 = Ot2(r7.config.before, i5, C3), P3 = r7.config.next, R4 = r7.config?.cache, z5 = R4 ? ir(R4) : void 0, U4 = z5 ? ze(z5, e4) : void 0, K4 = r7.config?.state ? ur(r7.config.state) : void 0, B4 = K4?.filter((e5) => "get" === e5.mode), F4 = K4?.filter((e5) => "set" === e5.mode);
|
|
7479
|
+
let H3 = 0, G2 = 0;
|
|
7480
|
+
return await Promise.all(E3.map(async (t5) => {
|
|
7464
7481
|
let s5;
|
|
7465
|
-
if (t5.user =
|
|
7466
|
-
const e5 =
|
|
7482
|
+
if (t5.user = ce(a4, t5.user), z5?.stop && U4) {
|
|
7483
|
+
const e5 = sr(C3, t5), n6 = await ar(z5, U4, e5);
|
|
7467
7484
|
if ("HIT" === n6?.status) return t5;
|
|
7468
7485
|
"MISS" === n6?.status && (s5 = { key: n6.key, ttl: n6.rule.ttl });
|
|
7469
7486
|
}
|
|
7470
|
-
let c4 = t5,
|
|
7487
|
+
let c4 = t5, u5 = n5.respond;
|
|
7471
7488
|
if (M2.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
7472
7489
|
const r8 = await Le(e4, e4.transformers, M2, t5, C3, n5.respond, `destination.${o5}.before`);
|
|
7473
7490
|
if (null === r8.event) return t5;
|
|
7474
|
-
r8.respond && (
|
|
7491
|
+
r8.respond && (u5 = r8.respond), c4 = Array.isArray(r8.event) ? r8.event[0] : r8.event;
|
|
7475
7492
|
}
|
|
7476
|
-
if (
|
|
7477
|
-
const e5 =
|
|
7493
|
+
if (z5 && !z5.stop && U4) {
|
|
7494
|
+
const e5 = sr(C3, c4), n6 = await ar(z5, U4, e5);
|
|
7478
7495
|
if ("HIT" === n6?.status) return t5;
|
|
7479
7496
|
"MISS" === n6?.status && (s5 = { key: n6.key, ttl: n6.rule.ttl });
|
|
7480
7497
|
}
|
|
7481
|
-
|
|
7482
|
-
const
|
|
7498
|
+
B4 && B4.length > 0 && c4 && (c4 = await lr(B4, (t6) => Ue2(t6, e4), c4, e4));
|
|
7499
|
+
const d4 = Date.now();
|
|
7483
7500
|
let p3 = false;
|
|
7484
|
-
const g3 = await
|
|
7501
|
+
const g3 = await tt(Dt, (t6) => {
|
|
7485
7502
|
const n6 = r7.type || "unknown";
|
|
7486
7503
|
e4.logger.scope(n6).error("Push failed", { error: t6, event: c4.name }), q3 = t6, p3 = true;
|
|
7487
|
-
const s6 = r7.dlq, a5 = r7.config.id || o5, i6 = { max: r7.config.dlqMax ?? re2 },
|
|
7488
|
-
if (
|
|
7489
|
-
|
|
7490
|
-
const t7 = ae2(e4.status, o("destination", a5), "dlq",
|
|
7491
|
-
|
|
7492
|
-
} else s6.length < i6.max &&
|
|
7493
|
-
})(e4, r7, o5, c4, C3,
|
|
7494
|
-
if (H3 += Date.now() -
|
|
7504
|
+
const s6 = r7.dlq, a5 = r7.config.id || o5, i6 = { max: r7.config.dlqMax ?? re2 }, u6 = V(s6, [c4, t6], i6);
|
|
7505
|
+
if (u6.dropped > 0) {
|
|
7506
|
+
se2(e4, a5);
|
|
7507
|
+
const t7 = ae2(e4.status, o("destination", a5), "dlq", u6.dropped);
|
|
7508
|
+
Y(s6, e4.logger.scope(r7.type || "unknown"), "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: a5, cap: i6.max, droppedCount: t7 });
|
|
7509
|
+
} else s6.length < i6.max && J(s6);
|
|
7510
|
+
})(e4, r7, o5, c4, C3, u5);
|
|
7511
|
+
if (H3 += Date.now() - d4, s5 && U4 && void 0 === r7.config.mock && cr(U4, s5.key, g3 ?? true, s5.ttl), !p3 && !qt(g3) && F4 && F4.length > 0 && c4 && (c4 = await lr(F4, (t6) => Ue2(t6, e4), c4, e4)), void 0 === g3 || qt(g3) || (x2 = g3), qt(g3) && G2++, !p3 && P3) {
|
|
7495
7512
|
void 0 !== g3 && (C3._response = g3);
|
|
7496
7513
|
const t6 = Ot2(P3, i5, C3);
|
|
7497
7514
|
if (t6.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
7498
|
-
const n6 = await Le(e4, e4.transformers, t6, c4, C3,
|
|
7499
|
-
n6.respond && (
|
|
7515
|
+
const n6 = await Le(e4, e4.transformers, t6, c4, C3, u5, `destination.${o5}.next`);
|
|
7516
|
+
n6.respond && (u5 = n6.respond);
|
|
7500
7517
|
}
|
|
7501
7518
|
}
|
|
7502
7519
|
return t5;
|
|
7503
|
-
})), { id: o5, destination: r7, error: q3, response: x2, totalDuration: H3, batchedCount:
|
|
7504
|
-
})),
|
|
7520
|
+
})), { id: o5, destination: r7, error: q3, response: x2, totalDuration: H3, batchedCount: G2, allowedCount: E3.length, canonicalId: c3, breakerConfig: d3 };
|
|
7521
|
+
})), u3 = {}, d2 = {}, y3 = {};
|
|
7505
7522
|
for (const t5 of c2) {
|
|
7506
7523
|
if (t5.skipped) continue;
|
|
7507
7524
|
const n6 = t5.destination, o5 = { type: n6.type || "unknown", data: t5.response };
|
|
7508
|
-
|
|
7525
|
+
se2(e4, t5.id);
|
|
7509
7526
|
const r7 = e4.status.destinations[t5.id], s5 = Date.now();
|
|
7510
7527
|
r7.queuePushSize = n6.queuePush?.length ?? 0, r7.dlqSize = n6.dlq?.length ?? 0;
|
|
7511
7528
|
const a5 = t5.breakerConfig, i6 = t5.canonicalId ? o("destination", t5.canonicalId) : void 0, c3 = (t6) => {
|
|
7512
7529
|
a5 && i6 && ne2(e4.status.breakers, i6, t6, a5.threshold, a5.cooldown);
|
|
7513
7530
|
};
|
|
7514
7531
|
if (t5.error) o5.error = t5.error, y3[t5.id] = o5, r7.failed++, r7.lastAt = s5, r7.duration += t5.totalDuration || 0, e4.status.failed++, c3("transport-failure");
|
|
7515
|
-
else if (t5.queue && t5.queue.length)
|
|
7532
|
+
else if (t5.queue && t5.queue.length) d2[t5.id] = o5;
|
|
7516
7533
|
else {
|
|
7517
7534
|
const n7 = t5.batchedCount ?? 0, a6 = t5.allowedCount ?? 0;
|
|
7518
|
-
(Math.max(0, a6 - n7) > 0 || 0 === a6) && (
|
|
7535
|
+
(Math.max(0, a6 - n7) > 0 || 0 === a6) && (u3[t5.id] = o5, r7.count++, r7.lastAt = s5, r7.duration += t5.totalDuration || 0, e4.status.out++, c3("success"));
|
|
7519
7536
|
}
|
|
7520
7537
|
}
|
|
7521
|
-
return
|
|
7538
|
+
return Mt({ event: t4, ...Object.keys(u3).length && { done: u3 }, ...Object.keys(d2).length && { queued: d2 }, ...Object.keys(y3).length && { failed: y3 } });
|
|
7522
7539
|
}
|
|
7523
7540
|
async function At2(e4, t4, n5, o4 = false) {
|
|
7524
7541
|
if (t4.init && !t4.config.init) {
|
|
@@ -7526,43 +7543,43 @@ async function At2(e4, t4, n5, o4 = false) {
|
|
|
7526
7543
|
const t5 = e5.config.consent;
|
|
7527
7544
|
return !!t5 && Object.keys(t5).length > 0;
|
|
7528
7545
|
})(t4)) return e4.logger.scope(t4.type || "unknown").debug("init blocked: consent gate not cleared"), false;
|
|
7529
|
-
const r6 = t4.type || "unknown", s4 = e4.logger.scope(r6), a4 = { collector: e4, logger: s4, id: n5, config: t4.config, env:
|
|
7546
|
+
const r6 = t4.type || "unknown", s4 = e4.logger.scope(r6), a4 = { collector: e4, logger: s4, id: n5, config: t4.config, env: Pt2(t4.env, t4.config.env), reportError: ie2(e4, "destination", n5, s4, t4) };
|
|
7530
7547
|
s4.debug("init");
|
|
7531
7548
|
const i5 = Date.now();
|
|
7532
7549
|
let c2;
|
|
7533
|
-
|
|
7550
|
+
pn(e4, _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "init", eventId: "", now: i5 }));
|
|
7534
7551
|
try {
|
|
7535
|
-
c2 = await
|
|
7552
|
+
c2 = await bt(t4.init, "DestinationInit", e4.hooks, e4.logger)(a4);
|
|
7536
7553
|
} catch (t5) {
|
|
7537
7554
|
const o5 = Date.now(), r7 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: "", now: o5 });
|
|
7538
|
-
throw r7.durationMs = o5 - i5, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) },
|
|
7555
|
+
throw r7.durationMs = o5 - i5, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, pn(e4, r7), t5;
|
|
7539
7556
|
}
|
|
7540
7557
|
if (false === c2) return c2;
|
|
7541
7558
|
if (t4.config = { ...c2 || t4.config, init: true }, t4.queueOn?.length) {
|
|
7542
7559
|
const o5 = t4.queueOn;
|
|
7543
7560
|
t4.queueOn = [];
|
|
7544
|
-
for (const { type: r7, data: s5 } of o5)
|
|
7561
|
+
for (const { type: r7, data: s5 } of o5) ht(e4, t4, n5, r7, s5);
|
|
7545
7562
|
}
|
|
7546
7563
|
s4.debug("init done");
|
|
7547
7564
|
}
|
|
7548
7565
|
return true;
|
|
7549
7566
|
}
|
|
7550
7567
|
async function Dt(e4, t4, n5, o4, r6, s4) {
|
|
7551
|
-
const { config: a4 } = t4, i5 = await
|
|
7568
|
+
const { config: a4 } = t4, i5 = await it(o4, a4, e4);
|
|
7552
7569
|
if (i5.ignore) return false;
|
|
7553
|
-
const c2 = t4.type || "unknown",
|
|
7554
|
-
if (void 0 !== a4.mock) return
|
|
7570
|
+
const c2 = t4.type || "unknown", u3 = e4.logger.scope(c2), d2 = { collector: e4, logger: u3, id: n5, config: a4, data: i5.data, rule: i5.mapping, ingest: r6, env: { ...Pt2(t4.env, a4.env), ...s4 ? { respond: s4 } : {} }, reportError: ie2(e4, "destination", n5, u3, t4) };
|
|
7571
|
+
if (void 0 !== a4.mock) return u3.debug("mock", { event: i5.event.name }), a4.mock;
|
|
7555
7572
|
const l3 = i5.mapping, f2 = void 0 !== l3?.batch, p3 = f2 ? i5.mappingKey || "* *" : " batch-all";
|
|
7556
7573
|
if ((f2 || void 0 !== a4.batch) && t4.pushBatch && void 0 === a4.mock) {
|
|
7557
7574
|
if (t4.batches = t4.batches || {}, !t4.batches[p3]) {
|
|
7558
|
-
const o5 = { key: p3, entries: [], events: [], data: [] }, r7 =
|
|
7575
|
+
const o5 = { key: p3, entries: [], events: [], data: [] }, r7 = xt2(l3?.batch), s5 = xt2(a4.batch), i6 = r7.wait ?? s5.wait ?? 3e4, c4 = r7.size ?? s5.size ?? 1e3, d4 = r7.age ?? s5.age ?? 3e4, g4 = Pt2(t4.env, a4.env), m4 = We(async () => {
|
|
7559
7576
|
const o6 = t4.batches[p3], r8 = o6.batched;
|
|
7560
7577
|
if (0 === r8.entries.length) return;
|
|
7561
7578
|
const s6 = { key: r8.key, entries: r8.entries, events: r8.events, data: r8.data };
|
|
7562
7579
|
r8.entries = [], r8.events = [], r8.data = [];
|
|
7563
|
-
const i7 = s6.entries[0], c5 = { collector: e4, logger:
|
|
7564
|
-
|
|
7565
|
-
const
|
|
7580
|
+
const i7 = s6.entries[0], c5 = { collector: e4, logger: u3, id: n5, config: a4, data: void 0, rule: o6.isDefault ? void 0 : i7.rule, ingest: i7.ingest, env: { ...g4, ...i7.respond ? { respond: i7.respond } : {} }, reportError: ie2(e4, "destination", n5, u3, t4) };
|
|
7581
|
+
u3.debug("push batch", { events: s6.entries.length });
|
|
7582
|
+
const d5 = t4.config.id || n5, l4 = se2(e4, d5), f3 = te2(t4.config.breaker), m5 = o("destination", d5), h4 = (t5) => {
|
|
7566
7583
|
f3 && ne2(e4.status.breakers, m5, t5, f3.threshold, f3.cooldown);
|
|
7567
7584
|
}, v3 = Date.now(), y3 = /* @__PURE__ */ new Map();
|
|
7568
7585
|
let b4, k4 = false;
|
|
@@ -7570,19 +7587,19 @@ async function Dt(e4, t4, n5, o4, r6, s4) {
|
|
|
7570
7587
|
const o7 = t4.dlq = t4.dlq || [], r9 = { max: t4.config.dlqMax ?? re2 };
|
|
7571
7588
|
let s7 = 0;
|
|
7572
7589
|
for (const e5 of n6) {
|
|
7573
|
-
s7 +=
|
|
7590
|
+
s7 += V(o7, e5, r9).dropped;
|
|
7574
7591
|
}
|
|
7575
7592
|
if (s7 > 0) {
|
|
7576
|
-
const t5 = ae2(e4.status, o("destination",
|
|
7577
|
-
|
|
7578
|
-
} else o7.length < r9.max &&
|
|
7593
|
+
const t5 = ae2(e4.status, o("destination", d5), "dlq", s7);
|
|
7594
|
+
Y(o7, u3, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: d5, cap: r9.max, droppedCount: t5 });
|
|
7595
|
+
} else o7.length < r9.max && J(o7);
|
|
7579
7596
|
l4.failed += n6.length, l4.dlqSize = o7.length, e4.status.failed += n6.length;
|
|
7580
7597
|
};
|
|
7581
7598
|
let C3 = s6.entries.length;
|
|
7582
|
-
const
|
|
7583
|
-
C3 = 0, k4 = true, b4 = e5, I2(s6.entries.map((t5) => [t5.event, e5])), h4("transport-failure"),
|
|
7599
|
+
const E3 = It2(a4.timeout), q3 = await tt((o7, r9) => Et2(Promise.resolve(bt(t4.pushBatch, "DestinationPushBatch", e4.hooks, e4.logger)(o7, r9)), E3, `Destination "${n5}" batch delivery timed out after ${E3}ms`), (e5) => {
|
|
7600
|
+
C3 = 0, k4 = true, b4 = e5, I2(s6.entries.map((t5) => [t5.event, e5])), h4("transport-failure"), u3.error("Push batch failed", { error: e5 instanceof Error ? e5.message : String(e5), entries: s6.entries.length });
|
|
7584
7601
|
})(s6, c5);
|
|
7585
|
-
if (
|
|
7602
|
+
if (he(x2 = q3) && Array.isArray(x2.failed) && q3.failed.length > 0) {
|
|
7586
7603
|
const e5 = [];
|
|
7587
7604
|
for (const t5 of q3.failed) {
|
|
7588
7605
|
const n6 = s6.entries[t5.index];
|
|
@@ -7590,7 +7607,7 @@ async function Dt(e4, t4, n5, o4, r6, s4) {
|
|
|
7590
7607
|
const o7 = t5.error ?? new Error(`Push batch entry ${t5.index} failed (no per-row error provided)`);
|
|
7591
7608
|
y3.set(t5.index, o7), e5.push([n6.event, o7]);
|
|
7592
7609
|
}
|
|
7593
|
-
e5.length > 0 && (I2(e5), C3 = Math.max(0, s6.entries.length - e5.length),
|
|
7610
|
+
e5.length > 0 && (I2(e5), C3 = Math.max(0, s6.entries.length - e5.length), u3.error("Push batch partial failure", { failed: e5.length, delivered: C3, entries: s6.entries.length }));
|
|
7594
7611
|
}
|
|
7595
7612
|
var x2;
|
|
7596
7613
|
const A2 = Date.now();
|
|
@@ -7600,9 +7617,9 @@ async function Dt(e4, t4, n5, o4, r6, s4) {
|
|
|
7600
7617
|
const e5 = k4 ? b4 : y3.get(o7);
|
|
7601
7618
|
i8.error = e5 instanceof Error ? { name: e5.name, message: e5.message } : { message: String(e5) };
|
|
7602
7619
|
}
|
|
7603
|
-
|
|
7604
|
-
}),
|
|
7605
|
-
}, { wait: i6, size: c4, age:
|
|
7620
|
+
pn(e4, i8);
|
|
7621
|
+
}), u3.debug("push batch done"), l4.inFlightBatch = Math.max(0, (l4.inFlightBatch ?? 0) - s6.entries.length), C3 > 0 && (l4.count += C3, l4.lastAt = Date.now(), e4.status.out += C3, h4("success"));
|
|
7622
|
+
}, { wait: i6, size: c4, age: d4 });
|
|
7606
7623
|
t4.batches[p3] = { batched: o5, isDefault: !f2, batchFn: () => {
|
|
7607
7624
|
m4();
|
|
7608
7625
|
}, flush: async () => {
|
|
@@ -7610,47 +7627,47 @@ async function Dt(e4, t4, n5, o4, r6, s4) {
|
|
|
7610
7627
|
} };
|
|
7611
7628
|
}
|
|
7612
7629
|
const c3 = t4.batches[p3];
|
|
7613
|
-
c3.batched.entries.push({ event: i5.event, ingest: r6, respond: s4, rule: l3, data: i5.data }), c3.batched.events.push(i5.event),
|
|
7614
|
-
const
|
|
7615
|
-
i5.mappingKey && (h3.mappingKey = i5.mappingKey), i5.event.consent && (h3.consent = { ...i5.event.consent }), h3.inEvent = i5.event,
|
|
7616
|
-
const v2 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "out", eventId:
|
|
7617
|
-
i5.mappingKey && (v2.mappingKey = i5.mappingKey), v2.outEvent = i5.event, v2.batch = { size: c3.batched.entries.length, index: c3.batched.entries.length - 1 },
|
|
7618
|
-
const b3 = t4.config.id || n5, k3 =
|
|
7630
|
+
c3.batched.entries.push({ event: i5.event, ingest: r6, respond: s4, rule: l3, data: i5.data }), c3.batched.events.push(i5.event), de(i5.data) && c3.batched.data.push(i5.data);
|
|
7631
|
+
const d3 = "string" == typeof i5.event.id ? i5.event.id : "", g3 = T2(o4, r6, e4), m3 = Date.now(), h3 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "in", eventId: d3, now: m3, traceId: g3.traceId, sourceId: g3.sourceId, parentEventId: g3.parentEventId });
|
|
7632
|
+
i5.mappingKey && (h3.mappingKey = i5.mappingKey), i5.event.consent && (h3.consent = { ...i5.event.consent }), h3.inEvent = i5.event, pn(e4, h3);
|
|
7633
|
+
const v2 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "out", eventId: d3, now: m3, traceId: g3.traceId, sourceId: g3.sourceId, parentEventId: g3.parentEventId });
|
|
7634
|
+
i5.mappingKey && (v2.mappingKey = i5.mappingKey), v2.outEvent = i5.event, v2.batch = { size: c3.batched.entries.length, index: c3.batched.entries.length - 1 }, pn(e4, v2);
|
|
7635
|
+
const b3 = t4.config.id || n5, k3 = se2(e4, b3);
|
|
7619
7636
|
return k3.inFlightBatch = (k3.inFlightBatch ?? 0) + 1, c3.batchFn(), St2;
|
|
7620
7637
|
}
|
|
7621
7638
|
{
|
|
7622
7639
|
let s5;
|
|
7623
|
-
if (
|
|
7624
|
-
const e5 =
|
|
7625
|
-
|
|
7640
|
+
if (u3.debug("push", { event: i5.event.name }), "trace" === e4.observeLevel?.() && Array.isArray(t4.calls) && t4.calls.length > 0) {
|
|
7641
|
+
const e5 = U2({ ...d2.env, simulation: t4.calls });
|
|
7642
|
+
d2.env = e5.wrappedEnv, s5 = e5.calls, e5.unresolved.length > 0 && (e5.wrappedEnv[On] = { paths: e5.unresolved, record: (t5, n6) => e5.calls.push({ fn: t5, args: n6, ts: Date.now() }) });
|
|
7626
7643
|
}
|
|
7627
7644
|
const c3 = "string" == typeof i5.event.id ? i5.event.id : "", { traceId: l4, sourceId: f3, parentEventId: p4 } = T2(o4, r6, e4), g3 = Date.now(), m3 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "in", eventId: c3, now: g3, traceId: l4, sourceId: f3, parentEventId: p4 });
|
|
7628
|
-
i5.mappingKey && (m3.mappingKey = i5.mappingKey), i5.event.consent && (m3.consent = { ...i5.event.consent }), m3.inEvent = i5.event,
|
|
7645
|
+
i5.mappingKey && (m3.mappingKey = i5.mappingKey), i5.event.consent && (m3.consent = { ...i5.event.consent }), m3.inEvent = i5.event, pn(e4, m3);
|
|
7629
7646
|
try {
|
|
7630
|
-
const o5 = It2(a4.timeout), r7 = await Et2(Promise.resolve(
|
|
7631
|
-
return h3.durationMs = m4 - g3, h3.outEvent = i5.event, s5 && s5.length > 0 && (h3.calls =
|
|
7647
|
+
const o5 = It2(a4.timeout), r7 = await Et2(Promise.resolve(bt(t4.push, "DestinationPush", e4.hooks, e4.logger)(i5.event, d2)), o5, `Destination "${n5}" delivery timed out after ${o5}ms`), m4 = Date.now(), h3 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "out", eventId: c3, now: m4, traceId: l4, sourceId: f3, parentEventId: p4 });
|
|
7648
|
+
return h3.durationMs = m4 - g3, h3.outEvent = i5.event, s5 && s5.length > 0 && (h3.calls = F2(s5)), de(r7) && (h3.meta = { ...h3.meta, response: r7 }), i5.mappingKey && (h3.mappingKey = i5.mappingKey), pn(e4, h3), u3.debug("push done"), r7;
|
|
7632
7649
|
} catch (t5) {
|
|
7633
7650
|
const o5 = Date.now(), r7 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: c3, now: o5, traceId: l4, sourceId: f3, parentEventId: p4 });
|
|
7634
|
-
throw r7.durationMs = o5 - g3, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, s5 && s5.length > 0 && (r7.calls =
|
|
7651
|
+
throw r7.durationMs = o5 - g3, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, s5 && s5.length > 0 && (r7.calls = F2(s5)), i5.mappingKey && (r7.mappingKey = i5.mappingKey), pn(e4, r7), t5;
|
|
7635
7652
|
}
|
|
7636
7653
|
}
|
|
7637
7654
|
}
|
|
7638
|
-
function
|
|
7655
|
+
function Mt(e4) {
|
|
7639
7656
|
return { ok: !e4?.failed, ...e4 };
|
|
7640
7657
|
}
|
|
7641
|
-
function
|
|
7642
|
-
const { code: t4, config: n5 = {}, env: o4 = {}, cache: r6, state: s4 } = e4, { config: a4 } =
|
|
7658
|
+
function Tt2(e4) {
|
|
7659
|
+
const { code: t4, config: n5 = {}, env: o4 = {}, cache: r6, state: s4 } = e4, { config: a4 } = Be(e4, "before"), { config: i5 } = Be({ ...e4, config: a4 }, "next"), c2 = { ...t4.config, ...n5, ...i5 };
|
|
7643
7660
|
r6 && (c2.cache = r6), void 0 !== s4 && void 0 === c2.state && (c2.state = s4);
|
|
7644
|
-
const
|
|
7645
|
-
return { ...t4, config: c2, env:
|
|
7661
|
+
const u3 = Pt2(t4.env, o4);
|
|
7662
|
+
return { ...t4, config: c2, env: u3 };
|
|
7646
7663
|
}
|
|
7647
|
-
async function
|
|
7664
|
+
async function _t2(e4, t4 = {}) {
|
|
7648
7665
|
const n5 = {};
|
|
7649
|
-
for (const [o4, r6] of Object.entries(t4)) r6.config?.require?.length ? e4.pending.destinations[o4] = r6 : n5[o4] =
|
|
7666
|
+
for (const [o4, r6] of Object.entries(t4)) r6.config?.require?.length ? e4.pending.destinations[o4] = r6 : n5[o4] = Tt2(r6);
|
|
7650
7667
|
return n5;
|
|
7651
7668
|
}
|
|
7652
|
-
function
|
|
7653
|
-
return e4 || t4 ? t4 ? e4 &&
|
|
7669
|
+
function Pt2(e4, t4) {
|
|
7670
|
+
return e4 || t4 ? t4 ? e4 && he(e4) && he(t4) ? { ...e4, ...t4 } : t4 : e4 : {};
|
|
7654
7671
|
}
|
|
7655
7672
|
var Ht = 5e3;
|
|
7656
7673
|
async function Gt(e4) {
|
|
@@ -7697,38 +7714,38 @@ async function Wt(e4, t4, n5) {
|
|
|
7697
7714
|
function Lt(e4, t4) {
|
|
7698
7715
|
e4.stateVersion++, e4.cellVersion[t4] = e4.stateVersion;
|
|
7699
7716
|
}
|
|
7700
|
-
async function
|
|
7717
|
+
async function Qt(e4, t4, o4) {
|
|
7701
7718
|
let s4, a4, i5 = false;
|
|
7702
7719
|
const c2 = ft(e4);
|
|
7703
7720
|
try {
|
|
7704
7721
|
return await (async function() {
|
|
7705
7722
|
switch (t4) {
|
|
7706
7723
|
case n.Commands.Config:
|
|
7707
|
-
|
|
7724
|
+
he(o4) && (ce(e4.config, o4, { shallow: false }), a4 = o4, i5 = true);
|
|
7708
7725
|
break;
|
|
7709
7726
|
case n.Commands.Consent:
|
|
7710
|
-
if (
|
|
7727
|
+
if (he(o4)) {
|
|
7711
7728
|
const { update: t5 } = r2(e4, o4);
|
|
7712
7729
|
Lt(e4, n.Commands.Consent), a4 = t5, i5 = true;
|
|
7713
7730
|
}
|
|
7714
7731
|
break;
|
|
7715
7732
|
case n.Commands.Custom:
|
|
7716
|
-
|
|
7733
|
+
he(o4) && (e4.custom = ce(e4.custom, o4), Lt(e4, n.Commands.Custom), a4 = o4, i5 = true);
|
|
7717
7734
|
break;
|
|
7718
7735
|
case n.Commands.Destination:
|
|
7719
|
-
|
|
7736
|
+
he(o4) && "code" in o4 && he(o4.code) && (s4 = await jt2(e4, o4));
|
|
7720
7737
|
break;
|
|
7721
7738
|
case n.Commands.Globals:
|
|
7722
|
-
|
|
7739
|
+
he(o4) && (e4.globals = ce(e4.globals, o4), Lt(e4, n.Commands.Globals), a4 = o4, i5 = true);
|
|
7723
7740
|
break;
|
|
7724
7741
|
case n.Commands.Hook:
|
|
7725
|
-
if (
|
|
7742
|
+
if (he(o4) && be(o4.name) && ge(o4.fn)) {
|
|
7726
7743
|
const { name: t5, fn: n5 } = o4;
|
|
7727
7744
|
e4.hooks[t5] = n5, a4 = o4, i5 = true;
|
|
7728
7745
|
}
|
|
7729
7746
|
break;
|
|
7730
7747
|
case n.Commands.On:
|
|
7731
|
-
if (
|
|
7748
|
+
if (he(o4) && be(o4.type)) {
|
|
7732
7749
|
const { type: t5, rules: n5 } = o4;
|
|
7733
7750
|
await mt(e4, t5, n5);
|
|
7734
7751
|
}
|
|
@@ -7737,7 +7754,7 @@ async function Vt(e4, t4, o4) {
|
|
|
7737
7754
|
i5 = true;
|
|
7738
7755
|
break;
|
|
7739
7756
|
case n.Commands.Run:
|
|
7740
|
-
s4 = await
|
|
7757
|
+
s4 = await Jt(e4, o4), i5 = true;
|
|
7741
7758
|
break;
|
|
7742
7759
|
case n.Commands.Session:
|
|
7743
7760
|
i5 = true;
|
|
@@ -7746,77 +7763,107 @@ async function Vt(e4, t4, o4) {
|
|
|
7746
7763
|
e4.hasShutdown || (e4.hasShutdown = true, await Gt(e4));
|
|
7747
7764
|
break;
|
|
7748
7765
|
case n.Commands.User:
|
|
7749
|
-
|
|
7766
|
+
he(o4) && (ce(e4.user, o4, { shallow: false }), Lt(e4, n.Commands.User), a4 = o4, i5 = true);
|
|
7750
7767
|
break;
|
|
7751
7768
|
default:
|
|
7752
|
-
return e4.logger.warn("unknown command", { command: t4 }),
|
|
7769
|
+
return e4.logger.warn("unknown command", { command: t4 }), Mt({ ok: false });
|
|
7753
7770
|
}
|
|
7754
|
-
|
|
7755
|
-
|
|
7771
|
+
if (i5) {
|
|
7772
|
+
await kt2(e4, t4, void 0, a4);
|
|
7773
|
+
const n5 = await $t(e4);
|
|
7774
|
+
if (s4 && false === s4.ok) {
|
|
7775
|
+
const e5 = { ...n5.failed ?? {}, ...s4.failed ?? {} };
|
|
7776
|
+
s4 = { ...n5, ok: false, ...Object.keys(e5).length > 0 ? { failed: e5 } : {} };
|
|
7777
|
+
} else s4 = n5;
|
|
7778
|
+
}
|
|
7779
|
+
return s4 || Mt({ ok: true });
|
|
7756
7780
|
})();
|
|
7757
7781
|
} finally {
|
|
7758
7782
|
c2();
|
|
7759
7783
|
}
|
|
7760
7784
|
}
|
|
7761
|
-
function
|
|
7785
|
+
function Vt(e4, t4) {
|
|
7762
7786
|
return { timing: Math.round((Date.now() - e4.timing) / 10) / 100, source: { type: "collector", schema: "4" }, ...t4 };
|
|
7763
7787
|
}
|
|
7764
|
-
function
|
|
7788
|
+
function Nt2(e4, t4, n5) {
|
|
7765
7789
|
if (!t4.name) throw new Error("Event name is required");
|
|
7766
7790
|
const [o4, r6] = t4.name.split(" ");
|
|
7767
7791
|
if (!o4 || !r6) throw new Error("Event name is invalid");
|
|
7768
|
-
const { timestamp: s4 = Date.now(), name: a4 = `${o4} ${r6}`, data: i5 = {}, context: c2 = {}, globals:
|
|
7792
|
+
const { timestamp: s4 = Date.now(), name: a4 = `${o4} ${r6}`, data: i5 = {}, context: c2 = {}, globals: u3 = {}, custom: d2 = {}, user: l3 = e4.user, nested: f2 = [], consent: p3 = e4.consent, id: g3 = Pe(), trigger: m3 = "", entity: h3 = o4, action: v2 = r6, timing: y3 = 0, source: w3 = { type: "collector", schema: "4" } } = t4, b3 = w3.count ?? (e4.count += 1), k3 = w3.trace ?? n5?._meta.trace ?? e4.trace, I2 = { ...w3, count: b3 };
|
|
7769
7793
|
void 0 !== k3 && (I2.trace = k3);
|
|
7770
|
-
const C3 = e4.name ?? w3.platform ?? "default",
|
|
7771
|
-
I2.release = { ...w3.release, [C3]:
|
|
7772
|
-
return { name: a4, data: i5, context: c2, globals:
|
|
7794
|
+
const C3 = e4.name ?? w3.platform ?? "default", E3 = e4.release ?? "4.4.0";
|
|
7795
|
+
I2.release = { ...w3.release, [C3]: E3 };
|
|
7796
|
+
return { name: a4, data: i5, context: c2, globals: ce(e4.globals, u3), custom: d2, user: l3, nested: f2, consent: p3, id: g3, trigger: m3, entity: h3, action: v2, timestamp: s4, timing: y3, source: I2 };
|
|
7773
7797
|
}
|
|
7774
|
-
function
|
|
7775
|
-
return
|
|
7798
|
+
function Yt(e4, t4, n5) {
|
|
7799
|
+
return Nt2(e4, Vt(e4, t4), n5);
|
|
7776
7800
|
}
|
|
7777
|
-
async function
|
|
7778
|
-
e4.allowed = true, e4.timing = Date.now(), e4.trace =
|
|
7801
|
+
async function Jt(e4, t4) {
|
|
7802
|
+
e4.allowed = true, e4.timing = Date.now(), e4.trace = De(), e4.count = 0, t4 && (t4.consent && (e4.consent = ce(e4.consent, t4.consent), Lt(e4, n.Commands.Consent)), t4.user && (e4.user = ce(e4.user, t4.user), Lt(e4, n.Commands.User)), t4.globals && (e4.globals = ce(e4.config.globalsStatic || {}, t4.globals), Lt(e4, n.Commands.Globals)), t4.custom && (e4.custom = ce(e4.custom, t4.custom), Lt(e4, n.Commands.Custom))), Object.values(e4.destinations).forEach((e5) => {
|
|
7779
7803
|
e5.queuePush = [];
|
|
7780
7804
|
}), e4.queue = [], e4.round++, await et2(e4), await bt2(e4);
|
|
7781
|
-
|
|
7782
|
-
}
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7805
|
+
let o4 = true;
|
|
7806
|
+
const r6 = {};
|
|
7807
|
+
if (e4.preRunQueue.length) {
|
|
7808
|
+
const t5 = e4.preRunQueue.splice(0);
|
|
7809
|
+
e4.logger.debug("replaying pre-run events", { count: t5.length });
|
|
7810
|
+
for (const { event: n5, options: s5 } of t5) {
|
|
7811
|
+
const t6 = await e4.push(n5, s5);
|
|
7812
|
+
false === t6.ok && (o4 = false), t6.failed && Object.assign(r6, t6.failed);
|
|
7813
|
+
}
|
|
7814
|
+
}
|
|
7815
|
+
const s4 = await $t(e4);
|
|
7816
|
+
if (o4) return s4;
|
|
7817
|
+
const a4 = { ...s4.failed ?? {}, ...r6 };
|
|
7818
|
+
return { ...s4, ok: false, ...Object.keys(a4).length > 0 ? { failed: a4 } : {} };
|
|
7819
|
+
}
|
|
7820
|
+
function an(e4, t4) {
|
|
7821
|
+
const n5 = bt(async (n6, o4 = {}) => await tt(async () => {
|
|
7822
|
+
if (!e4.allowed) {
|
|
7823
|
+
const t5 = e4.config.queueMax;
|
|
7824
|
+
if (void 0 === t5) throw new Error("Collector.Config.queueMax is undefined; defaults must be seeded by collector()");
|
|
7825
|
+
const r7 = V(e4.preRunQueue, { event: n6, options: o4 }, { max: t5 });
|
|
7826
|
+
if (r7.dropped > 0) {
|
|
7827
|
+
const n7 = ae2(e4.status, "collector.preRun", "queue", r7.dropped);
|
|
7828
|
+
Y(e4.preRunQueue, e4.logger, "collector.preRunQueue overflow; oldest events dropped", { buffer: "queue", cap: t5, droppedCount: n7 });
|
|
7829
|
+
} else e4.preRunQueue.length < t5 && J(e4.preRunQueue);
|
|
7830
|
+
return e4.logger.debug("event held until run", { name: n6.name, dropped: r7.dropped }), Mt({ ok: true });
|
|
7831
|
+
}
|
|
7832
|
+
const r6 = Date.now(), { id: s4, ingest: a4, respond: i5, mapping: c2, preChain: u3, include: d2, exclude: l3 } = o4;
|
|
7786
7833
|
let f2 = i5, p3 = n6;
|
|
7787
|
-
const g3 =
|
|
7834
|
+
const g3 = d2 || l3 ? (function(e5, t5, n7) {
|
|
7788
7835
|
let o5 = e5;
|
|
7789
7836
|
return t5 && (o5 = Object.fromEntries(Object.entries(o5).filter(([e6]) => t5.includes(e6)))), n7 && (o5 = Object.fromEntries(Object.entries(o5).filter(([e6]) => !n7.includes(e6)))), o5;
|
|
7790
|
-
})(e4.destinations,
|
|
7837
|
+
})(e4.destinations, d2, l3) : void 0, m3 = a4 ?? E(s4 || "unknown");
|
|
7791
7838
|
if (c2) {
|
|
7792
|
-
const t5 = await
|
|
7793
|
-
if (t5.ignore) return
|
|
7839
|
+
const t5 = await it(p3, c2, e4);
|
|
7840
|
+
if (t5.ignore) return Mt({ ok: true });
|
|
7794
7841
|
if (c2.consent) {
|
|
7795
|
-
if (!
|
|
7842
|
+
if (!Oe(c2.consent, e4.consent, t5.event.consent)) return Mt({ ok: true });
|
|
7796
7843
|
}
|
|
7797
7844
|
p3 = t5.event;
|
|
7798
7845
|
}
|
|
7799
|
-
if (
|
|
7800
|
-
const n7 = await Le(e4, e4.transformers,
|
|
7801
|
-
if (null === n7.event) return e4.logger.debug("Event dropped by transformer chain" + (n7.droppedBy ? ` (${n7.droppedBy})` : "")),
|
|
7802
|
-
if (n7.stopped) return n7.respond && (f2 = n7.respond),
|
|
7846
|
+
if (u3?.length && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
7847
|
+
const n7 = await Le(e4, e4.transformers, u3, p3, m3, f2, s4 ? `source.${s4}.next` : void 0);
|
|
7848
|
+
if (null === n7.event) return e4.logger.debug("Event dropped by transformer chain" + (n7.droppedBy ? ` (${n7.droppedBy})` : "")), Mt({ ok: true, dropped: true });
|
|
7849
|
+
if (n7.stopped) return n7.respond && (f2 = n7.respond), Mt({ ok: true });
|
|
7803
7850
|
n7.respond && (f2 = n7.respond);
|
|
7804
7851
|
const o5 = "string" == typeof p3.id ? p3.id : "";
|
|
7805
7852
|
if (Array.isArray(n7.event)) {
|
|
7806
7853
|
const a5 = await Promise.all(n7.event.map(async (n8) => {
|
|
7807
|
-
const r7 = "" !== o5 && n8.id === o5 ? { ...n8, id:
|
|
7808
|
-
return $
|
|
7854
|
+
const r7 = "" !== o5 && n8.id === o5 ? { ...n8, id: Pe() } : n8, a6 = t4(r7), i6 = Nt2(e4, a6, m3);
|
|
7855
|
+
return $t(e4, i6, { id: s4, ingest: m3, respond: f2 }, g3);
|
|
7809
7856
|
}));
|
|
7810
7857
|
if (s4) {
|
|
7811
7858
|
e4.status.sources[s4] || (e4.status.sources[s4] = { count: 0, duration: 0 });
|
|
7812
7859
|
const t5 = e4.status.sources[s4];
|
|
7813
7860
|
t5.count += n7.event.length, t5.lastAt = Date.now(), t5.duration += Date.now() - r6;
|
|
7814
7861
|
}
|
|
7815
|
-
return a5[0] ??
|
|
7862
|
+
return a5[0] ?? Mt({ ok: true });
|
|
7816
7863
|
}
|
|
7817
7864
|
p3 = "" === o5 || "string" == typeof n7.event.id && "" !== n7.event.id ? n7.event : { ...n7.event, id: o5 };
|
|
7818
7865
|
}
|
|
7819
|
-
const h3 =
|
|
7866
|
+
const h3 = Yt(e4, p3, m3), v2 = await $t(e4, h3, { id: s4, ingest: m3, respond: f2 }, g3);
|
|
7820
7867
|
if (s4) {
|
|
7821
7868
|
e4.status.sources[s4] || (e4.status.sources[s4] = { count: 0, duration: 0 });
|
|
7822
7869
|
const t5 = e4.status.sources[s4];
|
|
@@ -7824,22 +7871,22 @@ function an2(e4, t4) {
|
|
|
7824
7871
|
}
|
|
7825
7872
|
return v2;
|
|
7826
7873
|
}, (t5) => {
|
|
7827
|
-
if (t5 instanceof
|
|
7828
|
-
return e4.status.failed++, e4.logger.error("push failed", { event: n6, ingest: o4.ingest, error: t5 }),
|
|
7874
|
+
if (t5 instanceof nt) throw t5;
|
|
7875
|
+
return e4.status.failed++, e4.logger.error("push failed", { event: n6, ingest: o4.ingest, error: t5 }), Mt({ ok: false });
|
|
7829
7876
|
})(), "Push", e4.hooks, e4.logger);
|
|
7830
7877
|
return async (t5, o4) => {
|
|
7831
|
-
const r6 = "string" == typeof t5.id && "" !== t5.id ? t5 : { ...t5, id:
|
|
7832
|
-
|
|
7878
|
+
const r6 = "string" == typeof t5.id && "" !== t5.id ? t5 : { ...t5, id: Pe() }, s4 = "string" == typeof r6.id ? r6.id : "", { traceId: a4, sourceId: i5, parentEventId: c2 } = T2(r6, o4?.ingest, e4), u3 = Date.now(), d2 = _(e4, { stepId: "collector.push", stepType: "collector", phase: "in", eventId: s4, now: u3, traceId: a4, sourceId: i5, parentEventId: c2 });
|
|
7879
|
+
d2.inEvent = r6, pn(e4, d2);
|
|
7833
7880
|
try {
|
|
7834
|
-
const t6 = await n5(r6, o4),
|
|
7835
|
-
return l3.durationMs =
|
|
7881
|
+
const t6 = await n5(r6, o4), d3 = Date.now(), l3 = _(e4, { stepId: "collector.push", stepType: "collector", phase: "out", eventId: s4, now: d3, traceId: a4, sourceId: i5, parentEventId: c2 });
|
|
7882
|
+
return l3.durationMs = d3 - u3, l3.outEvent = t6, pn(e4, l3), t6;
|
|
7836
7883
|
} catch (t6) {
|
|
7837
7884
|
const n6 = Date.now(), o5 = _(e4, { stepId: "collector.push", stepType: "collector", phase: "error", eventId: s4, now: n6, traceId: a4, sourceId: i5, parentEventId: c2 });
|
|
7838
|
-
throw o5.durationMs = n6 -
|
|
7885
|
+
throw o5.durationMs = n6 - u3, o5.error = t6 instanceof Error ? { name: t6.name, message: t6.message } : { message: String(t6) }, pn(e4, o5), t6;
|
|
7839
7886
|
}
|
|
7840
7887
|
};
|
|
7841
7888
|
}
|
|
7842
|
-
function
|
|
7889
|
+
function pn2(e4 = {}) {
|
|
7843
7890
|
const t4 = e4.maxEntries ?? 1e4, n5 = e4.lowWaterMark ?? 0.8, o4 = e4.sweepIntervalMs ?? 6e4, r6 = Math.floor(t4 * n5), s4 = /* @__PURE__ */ new Map(), a4 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, evictions_entries: 0, evictions_ttl: 0 };
|
|
7844
7891
|
let i5;
|
|
7845
7892
|
o4 > 0 && (i5 = setInterval(function() {
|
|
@@ -7876,19 +7923,19 @@ function yn(e4, t4) {
|
|
|
7876
7923
|
const { cacheConfig: n5, cacheStore: o4, namespace: r6, logger: s4, storeId: a4, collector: i5 } = t4, c2 = (e5, t5) => {
|
|
7877
7924
|
if (!i5) return;
|
|
7878
7925
|
const n6 = _(i5, { stepId: `store.${a4}`, stepType: "store", phase: "in", eventId: "", now: Date.now() });
|
|
7879
|
-
n6.meta = { op: "cache", cached: "hit" === t5, status: t5, key: e5 },
|
|
7880
|
-
},
|
|
7926
|
+
n6.meta = { op: "cache", cached: "hit" === t5, status: t5, key: e5 }, pn(i5, n6);
|
|
7927
|
+
}, u3 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, inflight_dedups: 0 }, d2 = n5.rules.map((e5) => ({ match: e5.match ? Dn(e5.match) : () => true, ttl: e5.ttl })), l3 = (e5) => `${r6}:${e5}`;
|
|
7881
7928
|
function f2(e5, t5) {
|
|
7882
7929
|
const n6 = void 0 === t5 ? { key: e5 } : { key: e5, value: t5 };
|
|
7883
|
-
return
|
|
7930
|
+
return d2.find((e6) => e6.match(n6));
|
|
7884
7931
|
}
|
|
7885
7932
|
const p3 = /* @__PURE__ */ new Map();
|
|
7886
7933
|
return { type: e4.type, config: e4.config, setup: e4.setup, get counters() {
|
|
7887
|
-
return { ...
|
|
7934
|
+
return { ...u3 };
|
|
7888
7935
|
}, async get(t5) {
|
|
7889
|
-
const n6 = l3(t5), r7 = await o4.get(n6), s5 =
|
|
7936
|
+
const n6 = l3(t5), r7 = await o4.get(n6), s5 = Jn(r7);
|
|
7890
7937
|
if (void 0 !== s5) {
|
|
7891
|
-
if (!("expired" in s5)) return
|
|
7938
|
+
if (!("expired" in s5)) return u3.hits++, c2(t5, "hit"), s5.value;
|
|
7892
7939
|
try {
|
|
7893
7940
|
await o4.delete(n6);
|
|
7894
7941
|
} catch (e5) {
|
|
@@ -7896,8 +7943,8 @@ function yn(e4, t4) {
|
|
|
7896
7943
|
}
|
|
7897
7944
|
}
|
|
7898
7945
|
const a5 = p3.get(n6);
|
|
7899
|
-
if (a5) return
|
|
7900
|
-
|
|
7946
|
+
if (a5) return u3.inflight_dedups++, c2(t5, "hit"), a5;
|
|
7947
|
+
u3.misses++, c2(t5, "miss");
|
|
7901
7948
|
const i6 = (async () => {
|
|
7902
7949
|
try {
|
|
7903
7950
|
const r8 = await e4.get(t5);
|
|
@@ -7905,7 +7952,7 @@ function yn(e4, t4) {
|
|
|
7905
7952
|
const s6 = f2(t5, r8);
|
|
7906
7953
|
if (s6) try {
|
|
7907
7954
|
const e5 = 1e3 * s6.ttl;
|
|
7908
|
-
await o4.set(n6,
|
|
7955
|
+
await o4.set(n6, Hn(r8, e5), e5), u3.populates++;
|
|
7909
7956
|
} catch (e5) {
|
|
7910
7957
|
g3("set", t5, e5);
|
|
7911
7958
|
}
|
|
@@ -7916,16 +7963,16 @@ function yn(e4, t4) {
|
|
|
7916
7963
|
})();
|
|
7917
7964
|
return p3.set(n6, i6), i6;
|
|
7918
7965
|
}, async set(t5, n6, r7) {
|
|
7919
|
-
|
|
7966
|
+
u3.writes++, await e4.set(t5, n6, r7);
|
|
7920
7967
|
const s5 = f2(t5, n6);
|
|
7921
7968
|
if (s5) try {
|
|
7922
7969
|
const e5 = 1e3 * s5.ttl;
|
|
7923
|
-
await o4.set(l3(t5),
|
|
7970
|
+
await o4.set(l3(t5), Hn(n6, e5), e5);
|
|
7924
7971
|
} catch (e5) {
|
|
7925
7972
|
g3("set", t5, e5);
|
|
7926
7973
|
}
|
|
7927
7974
|
}, async delete(t5) {
|
|
7928
|
-
|
|
7975
|
+
u3.deletes++, await e4.delete(t5);
|
|
7929
7976
|
try {
|
|
7930
7977
|
await o4.delete(l3(t5));
|
|
7931
7978
|
} catch (e5) {
|
|
@@ -7937,47 +7984,47 @@ function yn(e4, t4) {
|
|
|
7937
7984
|
s4 ? s4.warn(o5, { error: n6 }) : console.warn(o5, n6);
|
|
7938
7985
|
}
|
|
7939
7986
|
}
|
|
7940
|
-
function
|
|
7941
|
-
const o4 = `store.${n5}`, r6 =
|
|
7987
|
+
function wn(e4, t4, n5) {
|
|
7988
|
+
const o4 = `store.${n5}`, r6 = bt(t4.get, "StoreGet", e4.hooks, e4.logger), s4 = bt(t4.set, "StoreSet", e4.hooks, e4.logger), a4 = bt(t4.delete, "StoreDelete", e4.hooks, e4.logger);
|
|
7942
7989
|
t4.get = async (t5) => {
|
|
7943
7990
|
const n6 = Date.now(), s5 = _(e4, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: n6 });
|
|
7944
|
-
s5.meta = { op: "get", key: t5 },
|
|
7991
|
+
s5.meta = { op: "get", key: t5 }, pn(e4, s5);
|
|
7945
7992
|
try {
|
|
7946
7993
|
const s6 = await r6(t5), a5 = Date.now(), i5 = _(e4, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: a5 });
|
|
7947
|
-
return i5.durationMs = a5 - n6, i5.meta = { op: "get", key: t5 },
|
|
7994
|
+
return i5.durationMs = a5 - n6, i5.meta = { op: "get", key: t5 }, pn(e4, i5), s6;
|
|
7948
7995
|
} catch (r7) {
|
|
7949
7996
|
const s6 = Date.now(), a5 = _(e4, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: s6 });
|
|
7950
|
-
throw a5.durationMs = s6 - n6, a5.meta = { op: "get", key: t5 }, a5.error = r7 instanceof Error ? { name: r7.name, message: r7.message } : { message: String(r7) },
|
|
7997
|
+
throw a5.durationMs = s6 - n6, a5.meta = { op: "get", key: t5 }, a5.error = r7 instanceof Error ? { name: r7.name, message: r7.message } : { message: String(r7) }, pn(e4, a5), r7;
|
|
7951
7998
|
}
|
|
7952
7999
|
}, t4.set = async (t5, n6, r7) => {
|
|
7953
8000
|
const a5 = Date.now(), i5 = _(e4, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: a5 });
|
|
7954
|
-
i5.meta = { op: "set", key: t5 },
|
|
8001
|
+
i5.meta = { op: "set", key: t5 }, pn(e4, i5);
|
|
7955
8002
|
try {
|
|
7956
8003
|
await s4(t5, n6, r7);
|
|
7957
8004
|
const i6 = Date.now(), c2 = _(e4, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: i6 });
|
|
7958
|
-
c2.durationMs = i6 - a5, c2.meta = { op: "set", key: t5 },
|
|
8005
|
+
c2.durationMs = i6 - a5, c2.meta = { op: "set", key: t5 }, pn(e4, c2);
|
|
7959
8006
|
} catch (n7) {
|
|
7960
8007
|
const r8 = Date.now(), s5 = _(e4, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: r8 });
|
|
7961
|
-
throw s5.durationMs = r8 - a5, s5.meta = { op: "set", key: t5 }, s5.error = n7 instanceof Error ? { name: n7.name, message: n7.message } : { message: String(n7) },
|
|
8008
|
+
throw s5.durationMs = r8 - a5, s5.meta = { op: "set", key: t5 }, s5.error = n7 instanceof Error ? { name: n7.name, message: n7.message } : { message: String(n7) }, pn(e4, s5), n7;
|
|
7962
8009
|
}
|
|
7963
8010
|
}, t4.delete = async (t5) => {
|
|
7964
8011
|
const n6 = Date.now(), r7 = _(e4, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: n6 });
|
|
7965
|
-
r7.meta = { op: "delete", key: t5 },
|
|
8012
|
+
r7.meta = { op: "delete", key: t5 }, pn(e4, r7);
|
|
7966
8013
|
try {
|
|
7967
8014
|
await a4(t5);
|
|
7968
8015
|
const r8 = Date.now(), s5 = _(e4, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: r8 });
|
|
7969
|
-
s5.durationMs = r8 - n6, s5.meta = { op: "delete", key: t5 },
|
|
8016
|
+
s5.durationMs = r8 - n6, s5.meta = { op: "delete", key: t5 }, pn(e4, s5);
|
|
7970
8017
|
} catch (r8) {
|
|
7971
8018
|
const s5 = Date.now(), a5 = _(e4, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: s5 });
|
|
7972
|
-
throw a5.durationMs = s5 - n6, a5.meta = { op: "delete", key: t5 }, a5.error = r8 instanceof Error ? { name: r8.name, message: r8.message } : { message: String(r8) },
|
|
8019
|
+
throw a5.durationMs = s5 - n6, a5.meta = { op: "delete", key: t5 }, a5.error = r8 instanceof Error ? { name: r8.name, message: r8.message } : { message: String(r8) }, pn(e4, a5), r8;
|
|
7973
8020
|
}
|
|
7974
8021
|
};
|
|
7975
8022
|
}
|
|
7976
8023
|
async function bn(e4, t4 = {}) {
|
|
7977
8024
|
const n5 = {};
|
|
7978
8025
|
for (const [o5, r7] of Object.entries(t4)) {
|
|
7979
|
-
const { code: t5, config: s4 = {}, env: a4 = {} } = r7, i5 = e4.logger.scope("store").scope(o5), c2 = { collector: e4, logger: i5, id: o5, config: s4, env: a4, reportError: ie2(e4, "store", o5, i5) },
|
|
7980
|
-
n5[o5] =
|
|
8026
|
+
const { code: t5, config: s4 = {}, env: a4 = {} } = r7, i5 = e4.logger.scope("store").scope(o5), c2 = { collector: e4, logger: i5, id: o5, config: s4, env: a4, reportError: ie2(e4, "store", o5, i5) }, u3 = await t5(c2);
|
|
8027
|
+
n5[o5] = u3;
|
|
7981
8028
|
}
|
|
7982
8029
|
const o4 = t4, r6 = (function(e5) {
|
|
7983
8030
|
const t5 = {};
|
|
@@ -8005,21 +8052,21 @@ async function bn(e4, t4 = {}) {
|
|
|
8005
8052
|
const r7 = o4[t5].cache;
|
|
8006
8053
|
if (!r7) continue;
|
|
8007
8054
|
let s4, a4;
|
|
8008
|
-
void 0 !== r7.store ? (s4 = n5[r7.store], a4 = r7.store) : (n5.__cache || (n5.__cache =
|
|
8055
|
+
void 0 !== r7.store ? (s4 = n5[r7.store], a4 = r7.store) : (n5.__cache || (n5.__cache = pn2()), s4 = n5.__cache, a4 = "__cache");
|
|
8009
8056
|
const i5 = r7.namespace ?? t5;
|
|
8010
8057
|
e4.logger.scope("store-cache").scope(t5).info(`store "${t5}" caches with namespace "${i5}:" via ${a4}`), n5[t5] = yn(n5[t5], { storeId: t5, cacheConfig: r7, cacheStore: s4, namespace: i5, logger: e4.logger.scope("store-cache").scope(t5), collector: e4 });
|
|
8011
8058
|
}
|
|
8012
|
-
for (const [t5, o5] of Object.entries(n5)) "__cache" !== t5 &&
|
|
8059
|
+
for (const [t5, o5] of Object.entries(n5)) "__cache" !== t5 && wn(e4, o5, t5);
|
|
8013
8060
|
return n5;
|
|
8014
8061
|
}
|
|
8015
|
-
async function
|
|
8016
|
-
const t4 =
|
|
8017
|
-
void 0 !== e4.name && (s4.name = e4.name), void 0 !== e4.release && (s4.release = e4.release), s4.push =
|
|
8018
|
-
return
|
|
8019
|
-
if (t6 instanceof
|
|
8020
|
-
return e5.status.failed++, e5.logger.error("command failed", { command: n6, data: o5, error: t6 }),
|
|
8062
|
+
async function kn(e4) {
|
|
8063
|
+
const t4 = ce({ globalsStatic: {}, sessionStatic: {}, run: true, queueMax: 1e3 }, e4, { merge: false, extend: false }), n5 = { level: e4.logger?.level, handler: e4.logger?.handler }, o4 = Je(n5), r6 = { ...t4.globalsStatic, ...e4.globals }, s4 = { allowed: false, config: t4, consent: e4.consent || {}, custom: e4.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: r6, hooks: e4.hooks || {}, observers: /* @__PURE__ */ new Set(), logger: o4, on: {}, queue: [], preRunQueue: [], round: 0, count: 0, stateVersion: 0, cellVersion: {}, delivery: /* @__PURE__ */ new WeakMap(), session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {}, dropped: {}, connectionErrors: {}, breakers: {} }, timing: Date.now(), user: e4.user || {}, sources: {}, pending: { destinations: {} }, hasShutdown: false, seenEvents: /* @__PURE__ */ new Set(), push: void 0, command: void 0, elb: void 0 };
|
|
8064
|
+
void 0 !== e4.name && (s4.name = e4.name), void 0 !== e4.release && (s4.release = e4.release), s4.push = an(s4, (e5) => Vt(s4, e5)), s4.command = (function(e5, t5) {
|
|
8065
|
+
return bt(async (n6, o5, r7) => await tt(async () => await t5(e5, n6, o5, r7), (t6) => {
|
|
8066
|
+
if (t6 instanceof nt) throw t6;
|
|
8067
|
+
return e5.status.failed++, e5.logger.error("command failed", { command: n6, data: o5, error: t6 }), Mt({ ok: false });
|
|
8021
8068
|
})(), "Command", e5.hooks, e5.logger);
|
|
8022
|
-
})(s4,
|
|
8069
|
+
})(s4, Qt), s4.elb = /* @__PURE__ */ (function(e5) {
|
|
8023
8070
|
return async (t5, n6, o5, r7, s5) => {
|
|
8024
8071
|
if ("string" == typeof t5 && t5.startsWith("walker ")) {
|
|
8025
8072
|
const o6 = t5.replace("walker ", "");
|
|
@@ -8028,7 +8075,7 @@ async function kn2(e4) {
|
|
|
8028
8075
|
let a5;
|
|
8029
8076
|
if ("string" == typeof t5) a5 = { name: t5 }, n6 && "object" == typeof n6 && !Array.isArray(n6) && (a5.data = n6);
|
|
8030
8077
|
else {
|
|
8031
|
-
if (!t5 || "object" != typeof t5 || Array.isArray(t5)) return
|
|
8078
|
+
if (!t5 || "object" != typeof t5 || Array.isArray(t5)) return Mt({ ok: false });
|
|
8032
8079
|
a5 = { ...t5 }, n6 && "object" == typeof n6 && !Array.isArray(n6) && (a5.data = { ...a5.data || {}, ...n6 });
|
|
8033
8080
|
}
|
|
8034
8081
|
return o5 && "object" == typeof o5 && (a5.context = o5), r7 && Array.isArray(r7) && (a5.nested = r7), s5 && "object" == typeof s5 && (a5.custom = s5), e5.push(a5);
|
|
@@ -8049,15 +8096,15 @@ async function kn2(e4) {
|
|
|
8049
8096
|
}
|
|
8050
8097
|
}
|
|
8051
8098
|
}
|
|
8052
|
-
})(a4, s4.stores, e4), s4.stores.__cache || (s4.stores.__cache =
|
|
8099
|
+
})(a4, s4.stores, e4), s4.stores.__cache || (s4.stores.__cache = pn2()), s4.destinations = await _t2(s4, e4.destinations || {}), s4.transformers = await (async function(e5, t5 = {}) {
|
|
8053
8100
|
const n6 = {};
|
|
8054
8101
|
for (const [o5, r7] of Object.entries(t5)) {
|
|
8055
|
-
const { code: t6, env: s5 = {} } = r7, a5 =
|
|
8102
|
+
const { code: t6, env: s5 = {} } = r7, a5 = vr(r7, "Transformer");
|
|
8056
8103
|
if (!a5.ok) {
|
|
8057
8104
|
e5.logger.warn(`Transformer ${o5} invalid (${a5.code}): ${a5.reason}. Skipping.`);
|
|
8058
8105
|
continue;
|
|
8059
8106
|
}
|
|
8060
|
-
const { config: i5 } =
|
|
8107
|
+
const { config: i5 } = Be(r7, "before"), { config: c2 } = Be({ ...r7, config: i5 }, "next"), u3 = Object.keys(s5).length > 0 ? { ...c2, env: s5 } : c2, { cache: d2 } = r7, l3 = d2 ? { ...u3, cache: d2 } : u3, f2 = r7.config?.state ?? r7.state, p3 = void 0 !== f2 && void 0 === l3.state ? { ...l3, state: f2 } : l3, g3 = e5.logger.scope("transformer").scope(o5), m3 = { collector: e5, logger: g3, id: o5, ingest: E(o5), config: p3, env: s5, reportError: ie2(e5, "transformer", o5, g3) }, h3 = t6 ?? ((e6) => {
|
|
8061
8108
|
const t7 = r7.mapping;
|
|
8062
8109
|
if (t7) {
|
|
8063
8110
|
const n7 = [];
|
|
@@ -8069,7 +8116,7 @@ async function kn2(e4) {
|
|
|
8069
8116
|
}
|
|
8070
8117
|
}
|
|
8071
8118
|
return n7.length > 0 && e6.collector.logger.warn(`Transformer ${o5}: \`${n7.join(", ")}\` ignored at transformer position (only event-mutating fields apply).`), { type: "pass", config: e6.config, push: async (n8) => {
|
|
8072
|
-
const o6 = await
|
|
8119
|
+
const o6 = await it(n8, t7, e6.collector);
|
|
8073
8120
|
return !o6.ignore && { event: o6.event };
|
|
8074
8121
|
} };
|
|
8075
8122
|
}
|
|
@@ -8081,15 +8128,15 @@ async function kn2(e4) {
|
|
|
8081
8128
|
})(s4, e4.transformers || {}), s4;
|
|
8082
8129
|
}
|
|
8083
8130
|
var In2 = globalThis;
|
|
8084
|
-
function
|
|
8131
|
+
function Cn(e4) {
|
|
8085
8132
|
try {
|
|
8086
8133
|
const t4 = In2.window;
|
|
8087
8134
|
if (!t4) return;
|
|
8088
|
-
t4.localStorage.getItem(
|
|
8135
|
+
t4.localStorage.getItem(Pt) === e4 && t4.localStorage.removeItem(Pt);
|
|
8089
8136
|
} catch {
|
|
8090
8137
|
}
|
|
8091
8138
|
}
|
|
8092
|
-
function
|
|
8139
|
+
function En(e4, t4) {
|
|
8093
8140
|
return void 0 === t4 ? e4 : (n5) => e4({ ...n5, release: t4 });
|
|
8094
8141
|
}
|
|
8095
8142
|
function Sn2(e4, t4) {
|
|
@@ -8102,54 +8149,54 @@ function Sn2(e4, t4) {
|
|
|
8102
8149
|
const e5 = In2.window, t6 = In2.URLSearchParams;
|
|
8103
8150
|
if (!e5 || !t6) return null;
|
|
8104
8151
|
try {
|
|
8105
|
-
const n6 = new t6(e5.location.search.replace(/^\?/, "")).getAll(
|
|
8152
|
+
const n6 = new t6(e5.location.search.replace(/^\?/, "")).getAll(Pt);
|
|
8106
8153
|
return n6.length > 0 ? n6[n6.length - 1] ?? null : null;
|
|
8107
8154
|
} catch {
|
|
8108
8155
|
return null;
|
|
8109
8156
|
}
|
|
8110
8157
|
})(), r7 = t5 ?? (function() {
|
|
8111
8158
|
try {
|
|
8112
|
-
return In2.window?.localStorage.getItem(
|
|
8159
|
+
return In2.window?.localStorage.getItem(Pt) ?? null;
|
|
8113
8160
|
} catch {
|
|
8114
8161
|
return null;
|
|
8115
8162
|
}
|
|
8116
8163
|
})();
|
|
8117
8164
|
if (!r7) return;
|
|
8118
|
-
const
|
|
8119
|
-
if (!
|
|
8120
|
-
if (
|
|
8121
|
-
let
|
|
8165
|
+
const u3 = Tn(r7);
|
|
8166
|
+
if (!u3) return void (null === t5 ? (e4.logger.warn("observe: malformed stored credential cleared"), Cn(r7)) : e4.logger.warn("observe: malformed credential ignored"));
|
|
8167
|
+
if (u3.pb !== n5.binding) return void e4.logger.warn("observe: credential binding mismatch, credential ignored");
|
|
8168
|
+
let d2;
|
|
8122
8169
|
!(function(e5) {
|
|
8123
8170
|
try {
|
|
8124
|
-
In2.window?.localStorage.setItem(
|
|
8171
|
+
In2.window?.localStorage.setItem(Pt, e5);
|
|
8125
8172
|
} catch {
|
|
8126
8173
|
}
|
|
8127
8174
|
})(r7), null !== t5 && (function() {
|
|
8128
8175
|
const e5 = In2.window, t6 = In2.URLSearchParams;
|
|
8129
8176
|
if (e5 && t6) try {
|
|
8130
|
-
const n6 = e5.location.href, o5 = n6.indexOf("#"), r8 = o5 >= 0 ? n6.slice(o5) : "", a4 = o5 >= 0 ? n6.slice(0, o5) : n6, i5 = a4.indexOf("?"), c2 = i5 >= 0 ? a4.slice(0, i5) : a4,
|
|
8131
|
-
|
|
8132
|
-
const
|
|
8133
|
-
e5.history.replaceState({}, "", `${c2}${
|
|
8177
|
+
const n6 = e5.location.href, o5 = n6.indexOf("#"), r8 = o5 >= 0 ? n6.slice(o5) : "", a4 = o5 >= 0 ? n6.slice(0, o5) : n6, i5 = a4.indexOf("?"), c2 = i5 >= 0 ? a4.slice(0, i5) : a4, u4 = new t6(i5 >= 0 ? a4.slice(i5 + 1) : "");
|
|
8178
|
+
u4.delete(Pt);
|
|
8179
|
+
const d3 = u4.toString();
|
|
8180
|
+
e5.history.replaceState({}, "", `${c2}${d3 ? `?${d3}` : ""}${r8}`);
|
|
8134
8181
|
} catch {
|
|
8135
8182
|
}
|
|
8136
8183
|
})();
|
|
8137
|
-
const l3 =
|
|
8138
|
-
401 === t6 && (
|
|
8184
|
+
const l3 = dn({ url: `${n5.url}/ingest/${u3.ses}`, token: u3.secret, headers: { "X-Walkeros-Binding": n5.binding }, onStatus: (t6) => {
|
|
8185
|
+
401 === t6 && (Cn(r7), d2 && e4.observers.delete(d2));
|
|
8139
8186
|
} });
|
|
8140
|
-
|
|
8187
|
+
d2 = kt(/* @__PURE__ */ (function(e5, t6) {
|
|
8141
8188
|
return void 0 === t6 ? e5 : (n6) => e5({ ...n6, flowId: t6 });
|
|
8142
|
-
})(
|
|
8189
|
+
})(En(l3, e4.release), n5.flowId), { flowId: n5.flowId ?? o4, ...void 0 !== n5.level ? { level: n5.level } : {}, ...void 0 !== n5.sample ? { sample: n5.sample } : {} }), e4.observers.add(d2);
|
|
8143
8190
|
const f2 = n5.level;
|
|
8144
8191
|
return void (void 0 !== f2 && (e4.observeLevel = () => f2));
|
|
8145
8192
|
}
|
|
8146
8193
|
if ("off" === n5.level) return;
|
|
8147
8194
|
const r6 = n5.level;
|
|
8148
|
-
void 0 !== r6 && (e4.observeLevel = () => r6), e4.observers.add(
|
|
8195
|
+
void 0 !== r6 && (e4.observeLevel = () => r6), e4.observers.add(kt(En(dn({ url: `${n5.url}/ingest/${n5.sessionId}`, token: n5.token }), e4.release), { flowId: o4, level: n5.level, sample: n5.sample }));
|
|
8149
8196
|
}
|
|
8150
8197
|
async function qn2(e4) {
|
|
8151
8198
|
e4 = e4 || {};
|
|
8152
|
-
const t4 = await
|
|
8199
|
+
const t4 = await kn(e4);
|
|
8153
8200
|
Sn2(t4, e4), await Ze2(t4, e4.sources || {});
|
|
8154
8201
|
const { consent: n5, user: o4, globals: r6, custom: s4 } = e4;
|
|
8155
8202
|
n5 && await t4.command("consent", n5), o4 && await t4.command("user", o4), r6 && await t4.command("globals", r6), s4 && await t4.command("custom", s4), t4.config.run && await t4.command("run");
|
|
@@ -8164,7 +8211,7 @@ init_dist2();
|
|
|
8164
8211
|
var destinationAPI = { type: "api", config: {}, env: { sendServer: a2 }, async push(event, { config, rule, data, env, logger }) {
|
|
8165
8212
|
const { settings } = config, { url, headers, method, transform, timeout } = settings || {};
|
|
8166
8213
|
if (!url) return;
|
|
8167
|
-
const eventData =
|
|
8214
|
+
const eventData = de(data) ? data : event, body = transform ? transform(eventData, config, rule) : JSON.stringify(eventData);
|
|
8168
8215
|
logger?.debug("API destination sending request", { url, method: method || "POST", eventName: event.name });
|
|
8169
8216
|
const sendServerFn = env?.sendServer || a2, response = await sendServerFn(url, body, { headers, method, timeout });
|
|
8170
8217
|
logger?.debug("API destination response", { ok: response?.ok });
|
|
@@ -8907,7 +8954,7 @@ async function prepareFlow(input) {
|
|
|
8907
8954
|
configPath: process.cwd(),
|
|
8908
8955
|
flowName: input.flow
|
|
8909
8956
|
});
|
|
8910
|
-
const platform =
|
|
8957
|
+
const platform = ie(flowSettings);
|
|
8911
8958
|
const overrides = buildOverrides(
|
|
8912
8959
|
{ simulate: input.simulate, mock: input.mock },
|
|
8913
8960
|
flowSettings
|
|
@@ -9172,7 +9219,7 @@ function resolveBeforeChain(before, transformers, ingest, event) {
|
|
|
9172
9219
|
if (Array.isArray(before) && before.every(isString)) {
|
|
9173
9220
|
return before;
|
|
9174
9221
|
}
|
|
9175
|
-
const ids =
|
|
9222
|
+
const ids = Wn(before, sr(ingest, event));
|
|
9176
9223
|
if (ids.length === 0) return [];
|
|
9177
9224
|
if (ids.length === 1) return walkStaticChain(ids[0], transformers);
|
|
9178
9225
|
return ids;
|
|
@@ -9298,7 +9345,7 @@ async function executeConfigPush(options, validatedEvent, logger, setTempDir, sn
|
|
|
9298
9345
|
flowName: options.flow,
|
|
9299
9346
|
logger
|
|
9300
9347
|
});
|
|
9301
|
-
const platform =
|
|
9348
|
+
const platform = ie(flowSettings);
|
|
9302
9349
|
const overrides = buildOverrides({ mock: options.mock }, flowSettings);
|
|
9303
9350
|
logger.debug("Bundling flow configuration");
|
|
9304
9351
|
const tempDir = getTmpPath(
|
|
@@ -9601,7 +9648,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
9601
9648
|
`Transformer "${options.transformerId}" not found in collector. Available: ${Object.keys(collector.transformers || {}).join(", ") || "none"}`
|
|
9602
9649
|
);
|
|
9603
9650
|
}
|
|
9604
|
-
const initialized = await
|
|
9651
|
+
const initialized = await He2(
|
|
9605
9652
|
collector,
|
|
9606
9653
|
transformer,
|
|
9607
9654
|
options.transformerId
|
|
@@ -9613,7 +9660,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
9613
9660
|
}
|
|
9614
9661
|
const inputEvent = event;
|
|
9615
9662
|
const ingest = {
|
|
9616
|
-
...
|
|
9663
|
+
...E(options.transformerId),
|
|
9617
9664
|
...options.ingest
|
|
9618
9665
|
};
|
|
9619
9666
|
const captured = [];
|
|
@@ -9773,7 +9820,7 @@ async function simulateCollector(configOrPath, event, options) {
|
|
|
9773
9820
|
if (options.state.timing !== void 0)
|
|
9774
9821
|
collector.timing = options.state.timing;
|
|
9775
9822
|
}
|
|
9776
|
-
const enriched =
|
|
9823
|
+
const enriched = Yt(collector, event);
|
|
9777
9824
|
const captured = [{ event: enriched, timestamp: Date.now() }];
|
|
9778
9825
|
await collector.command("shutdown");
|
|
9779
9826
|
return buildSimulationResult({
|
|
@@ -9879,7 +9926,7 @@ async function simulateDestination(configOrPath, event, options) {
|
|
|
9879
9926
|
...devEnv.push,
|
|
9880
9927
|
simulation: devEnv.simulation
|
|
9881
9928
|
};
|
|
9882
|
-
const { wrappedEnv, calls } =
|
|
9929
|
+
const { wrappedEnv, calls } = U2(combined);
|
|
9883
9930
|
if (destConfig) destConfig.env = wrappedEnv;
|
|
9884
9931
|
trackedCalls = calls;
|
|
9885
9932
|
}
|
|
@@ -10623,7 +10670,7 @@ function readGrantHeader(req) {
|
|
|
10623
10670
|
return "";
|
|
10624
10671
|
}
|
|
10625
10672
|
function guardPreviewIntake(req, res, gate, logger, onPass) {
|
|
10626
|
-
|
|
10673
|
+
Tt(readGrantHeader(req), {
|
|
10627
10674
|
keyring: gate.keyring,
|
|
10628
10675
|
iss: gate.iss,
|
|
10629
10676
|
pb: gate.pb,
|
|
@@ -11045,9 +11092,9 @@ function createTracePoller(config, logger) {
|
|
|
11045
11092
|
if (!("traceUntil" in parsed)) return;
|
|
11046
11093
|
const value = parsed.traceUntil;
|
|
11047
11094
|
if (typeof value === "string" && value.length > 0) {
|
|
11048
|
-
|
|
11095
|
+
ln(value);
|
|
11049
11096
|
} else if (value === null) {
|
|
11050
|
-
|
|
11097
|
+
ln(null);
|
|
11051
11098
|
}
|
|
11052
11099
|
} finally {
|
|
11053
11100
|
inFlight = false;
|
|
@@ -11474,22 +11521,22 @@ function buildTelemetryObservers(flowId, observeLevel) {
|
|
|
11474
11521
|
const deploymentId = process.env.WALKEROS_DEPLOYMENT_ID;
|
|
11475
11522
|
if (!base || !token || !deploymentId) return void 0;
|
|
11476
11523
|
const url = `${base}/ingest/${deploymentId}`;
|
|
11477
|
-
const emit =
|
|
11524
|
+
const emit = dn({ url, token });
|
|
11478
11525
|
const observe = observeLevel !== void 0 ? { level: observeLevel } : void 0;
|
|
11479
11526
|
return [
|
|
11480
|
-
|
|
11527
|
+
kt(
|
|
11481
11528
|
emit,
|
|
11482
|
-
() =>
|
|
11529
|
+
() => At({ flowId, observe, traceUntil: un() })
|
|
11483
11530
|
)
|
|
11484
11531
|
];
|
|
11485
11532
|
}
|
|
11486
11533
|
function buildObserveLevelSupplier(flowId, observeLevel) {
|
|
11487
11534
|
const observe = observeLevel !== void 0 ? { level: observeLevel } : void 0;
|
|
11488
11535
|
return () => {
|
|
11489
|
-
const opts =
|
|
11536
|
+
const opts = At({
|
|
11490
11537
|
flowId,
|
|
11491
11538
|
observe,
|
|
11492
|
-
traceUntil:
|
|
11539
|
+
traceUntil: un()
|
|
11493
11540
|
});
|
|
11494
11541
|
return opts ? opts.level ?? "standard" : "off";
|
|
11495
11542
|
};
|
|
@@ -11850,8 +11897,8 @@ function resolveEnvMarkers(value) {
|
|
|
11850
11897
|
return value;
|
|
11851
11898
|
}
|
|
11852
11899
|
function resolveEnvMarkersInString(input) {
|
|
11853
|
-
if (!input.includes(
|
|
11854
|
-
const esc =
|
|
11900
|
+
if (!input.includes(Q)) return input;
|
|
11901
|
+
const esc = Q.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
11855
11902
|
const re4 = new RegExp(
|
|
11856
11903
|
esc + "([a-zA-Z_][a-zA-Z0-9_]*)(?::((?:(?!" + esc + `)[^\\s"'])*))?`,
|
|
11857
11904
|
"g"
|
|
@@ -12044,7 +12091,7 @@ function validateContract(input) {
|
|
|
12044
12091
|
const keys = Object.keys(obj);
|
|
12045
12092
|
const unknownKeys = keys.filter((k3) => !KNOWN_KEYS.has(k3));
|
|
12046
12093
|
const hasKnownKey = keys.some((k3) => KNOWN_KEYS.has(k3));
|
|
12047
|
-
const objectValuedUnknown = unknownKeys.filter((k3) =>
|
|
12094
|
+
const objectValuedUnknown = unknownKeys.filter((k3) => he(obj[k3]));
|
|
12048
12095
|
if (!hasKnownKey && objectValuedUnknown.length > 0) {
|
|
12049
12096
|
errors.push({
|
|
12050
12097
|
path: name,
|
|
@@ -12067,7 +12114,7 @@ function validateContract(input) {
|
|
|
12067
12114
|
code: "INVALID_TAGGING"
|
|
12068
12115
|
});
|
|
12069
12116
|
}
|
|
12070
|
-
if (obj.schema !== void 0 && !
|
|
12117
|
+
if (obj.schema !== void 0 && !he(obj.schema)) {
|
|
12071
12118
|
errors.push({
|
|
12072
12119
|
path: `${name}.schema`,
|
|
12073
12120
|
message: "schema must be a JSON Schema object",
|
|
@@ -13312,9 +13359,9 @@ function p2(e4, t4, i5) {
|
|
|
13312
13359
|
// src/commands/validate/validators/flow.ts
|
|
13313
13360
|
var { validateFlowConfig: validateFlowConfig2 } = i3;
|
|
13314
13361
|
function isFlowJson(value) {
|
|
13315
|
-
if (!
|
|
13362
|
+
if (!he(value)) return false;
|
|
13316
13363
|
if (!("version" in value) || !("flows" in value)) return false;
|
|
13317
|
-
return
|
|
13364
|
+
return he(value.flows);
|
|
13318
13365
|
}
|
|
13319
13366
|
function validateFlow(input, options = {}) {
|
|
13320
13367
|
const errors = [];
|
|
@@ -13345,9 +13392,9 @@ function validateFlow(input, options = {}) {
|
|
|
13345
13392
|
message: issue.message
|
|
13346
13393
|
});
|
|
13347
13394
|
}
|
|
13348
|
-
const config =
|
|
13395
|
+
const config = he(input) ? input : {};
|
|
13349
13396
|
const flowsValue = config.flows;
|
|
13350
|
-
const flows =
|
|
13397
|
+
const flows = he(flowsValue) ? flowsValue : void 0;
|
|
13351
13398
|
if (flows && Object.keys(flows).length === 0) {
|
|
13352
13399
|
errors.push({
|
|
13353
13400
|
path: "flows",
|
|
@@ -13357,14 +13404,14 @@ function validateFlow(input, options = {}) {
|
|
|
13357
13404
|
}
|
|
13358
13405
|
if (flows) {
|
|
13359
13406
|
for (const [flowName, flowValue] of Object.entries(flows)) {
|
|
13360
|
-
if (!
|
|
13407
|
+
if (!he(flowValue)) continue;
|
|
13361
13408
|
const transformersValue = flowValue.transformers;
|
|
13362
|
-
if (!
|
|
13409
|
+
if (!he(transformersValue)) continue;
|
|
13363
13410
|
for (const [name, transformerValue] of Object.entries(
|
|
13364
13411
|
transformersValue
|
|
13365
13412
|
)) {
|
|
13366
|
-
if (!
|
|
13367
|
-
const result =
|
|
13413
|
+
if (!he(transformerValue)) continue;
|
|
13414
|
+
const result = vr(transformerValue, "Transformer");
|
|
13368
13415
|
if (!result.ok) {
|
|
13369
13416
|
errors.push({
|
|
13370
13417
|
path: `flows.${flowName}.transformers.${name}`,
|
|
@@ -13394,15 +13441,15 @@ function validateFlow(input, options = {}) {
|
|
|
13394
13441
|
let totalPackageCount = 0;
|
|
13395
13442
|
if (flows) {
|
|
13396
13443
|
for (const [flowName, flowValue] of Object.entries(flows)) {
|
|
13397
|
-
if (!
|
|
13444
|
+
if (!he(flowValue)) continue;
|
|
13398
13445
|
const flowConfig = flowValue.config;
|
|
13399
|
-
if (!
|
|
13446
|
+
if (!he(flowConfig)) continue;
|
|
13400
13447
|
const bundle2 = flowConfig.bundle;
|
|
13401
|
-
if (!
|
|
13448
|
+
if (!he(bundle2)) continue;
|
|
13402
13449
|
const packages = bundle2.packages;
|
|
13403
|
-
if (!
|
|
13450
|
+
if (!he(packages)) continue;
|
|
13404
13451
|
for (const [pkgName, pkgConfigValue] of Object.entries(packages)) {
|
|
13405
|
-
if (!
|
|
13452
|
+
if (!he(pkgConfigValue)) continue;
|
|
13406
13453
|
if (!pkgConfigValue.version && !pkgConfigValue.path) {
|
|
13407
13454
|
warnings.push({
|
|
13408
13455
|
path: `flows.${flowName}.config.bundle.packages.${pkgName}`,
|
|
@@ -13451,9 +13498,9 @@ function validateFlow(input, options = {}) {
|
|
|
13451
13498
|
for (const [destName, dest] of Object.entries(
|
|
13452
13499
|
flowSettings.destinations || {}
|
|
13453
13500
|
)) {
|
|
13454
|
-
if (!
|
|
13501
|
+
if (!he(dest.config)) continue;
|
|
13455
13502
|
const mapping = dest.config.mapping;
|
|
13456
|
-
if (!
|
|
13503
|
+
if (!he(mapping)) continue;
|
|
13457
13504
|
for (const key of Object.keys(mapping)) {
|
|
13458
13505
|
if (key.includes(".") && !key.includes(" ")) {
|
|
13459
13506
|
const parts = key.split(".");
|
|
@@ -13481,7 +13528,7 @@ function validateFlow(input, options = {}) {
|
|
|
13481
13528
|
const flowsToResolve = options.flow ? options.flow in flowsMap ? [options.flow] : [] : Object.keys(flowsMap);
|
|
13482
13529
|
for (const name of flowsToResolve) {
|
|
13483
13530
|
try {
|
|
13484
|
-
|
|
13531
|
+
se(input, name, {
|
|
13485
13532
|
deferred: true,
|
|
13486
13533
|
// don't fail on missing $env when validating
|
|
13487
13534
|
strictFlowRefs: false,
|
|
@@ -13731,11 +13778,11 @@ function lintRoute(spec, position, warnings) {
|
|
|
13731
13778
|
}
|
|
13732
13779
|
}
|
|
13733
13780
|
function checkContractCompliance(config, contract, errors, warnings, strict) {
|
|
13734
|
-
const resolved =
|
|
13781
|
+
const resolved = z(contract);
|
|
13735
13782
|
const rules = Object.values(resolved);
|
|
13736
13783
|
if (rules.length === 0) return;
|
|
13737
13784
|
const checkExample = (path19, candidate) => {
|
|
13738
|
-
if (!
|
|
13785
|
+
if (!he(candidate)) return;
|
|
13739
13786
|
const entity = typeof candidate.entity === "string" ? candidate.entity : void 0;
|
|
13740
13787
|
const action = typeof candidate.action === "string" ? candidate.action : void 0;
|
|
13741
13788
|
if (!entity || !action) return;
|
|
@@ -13825,7 +13872,7 @@ function validateMapping(input) {
|
|
|
13825
13872
|
// src/commands/validate/validators/entry.ts
|
|
13826
13873
|
init_dist();
|
|
13827
13874
|
import Ajv from "ajv";
|
|
13828
|
-
var CLIENT_HEADER = "walkeros-cli/4.4.0
|
|
13875
|
+
var CLIENT_HEADER = "walkeros-cli/4.4.0";
|
|
13829
13876
|
var SECTIONS = ["destinations", "sources", "transformers"];
|
|
13830
13877
|
function resolveEntry(path19, flowConfig) {
|
|
13831
13878
|
const flows = flowConfig.flows;
|
|
@@ -13901,7 +13948,7 @@ async function validateEntry(path19, flowConfig) {
|
|
|
13901
13948
|
}
|
|
13902
13949
|
let schemas;
|
|
13903
13950
|
try {
|
|
13904
|
-
const info = await
|
|
13951
|
+
const info = await xn(packageName, {
|
|
13905
13952
|
client: CLIENT_HEADER
|
|
13906
13953
|
});
|
|
13907
13954
|
schemas = info.schemas;
|
|
@@ -14803,7 +14850,7 @@ async function createDeployCommand(config, options) {
|
|
|
14803
14850
|
const result2 = await loadFlowConfig(config, {
|
|
14804
14851
|
flowName: options.flow
|
|
14805
14852
|
});
|
|
14806
|
-
type =
|
|
14853
|
+
type = ie(result2.flowSettings);
|
|
14807
14854
|
}
|
|
14808
14855
|
const deployment = await createDeployment({
|
|
14809
14856
|
type,
|