@walkeros/cli 4.0.1 → 4.0.2

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/dist/cli.js CHANGED
@@ -1418,14 +1418,14 @@ var init_sse = __esm({
1418
1418
 
1419
1419
  // ../core/dist/dev.mjs
1420
1420
  import { z as n3 } from "zod";
1421
- import { z as Ni } from "zod";
1421
+ import { z as Li } from "zod";
1422
1422
  function o(e3, t3, i2 = "draft-7") {
1423
1423
  return n3.toJSONSchema(e3, { target: i2 });
1424
1424
  }
1425
- function M2(e3, t3) {
1425
+ function R2(e3, t3) {
1426
1426
  return n3.object({ data: n3.union([e3, t3]).optional().describe("Data transformation rules") }).partial();
1427
1427
  }
1428
- function R2(e3) {
1428
+ function M2(e3) {
1429
1429
  return n3.object({ mapping: e3.optional().describe("Event mapping rules") }).partial();
1430
1430
  }
1431
1431
  function T2(e3) {
@@ -1618,7 +1618,7 @@ function tn(e3, t3, i2) {
1618
1618
  function nn(e3) {
1619
1619
  return n3.toJSONSchema(e3, { target: "draft-7" });
1620
1620
  }
1621
- var e2, t2, i, r2, a2, s4, c2, l, d, p, u2, m, f, g, b, h, S2, v, y, w, k, C2, x, P2, D2, E2, j, I, J2, O2, N2, L2, z2, $2, W2, q2, A2, B2, U2, H, V2, _2, Z2, G, K2, Q2, X3, Y3, ee2, te3, ie3, ne2, oe3, re3, ae3, se3, ce3, le3, de2, pe3, ue3, me3, fe3, ge2, be3, he3, Se3, ve3, ye2, we3, ke3, Ce2, xe, Pe2, De2, Ee3, je, Ie2, Je2, Oe2, Me2, Re2, Te2, Fe2, Ne3, Le, ze2, $e2, We2, qe, Ae2, Be2, Ue2, He2, Ve2, _e2, Ze2, Ge, Ke, Qe, Xe, Ye, et, tt, it, nt, ot, rt, at2, st2, ct2, lt2, dt2, pt, ut, mt2, ft, gt2, bt2, ht2, St, vt2, yt2, wt2, kt, Ct, xt, Pt, Dt, Et, jt2, It, Jt, Ot, Mt, Rt, Tt, Ft, Nt, Lt, zt, $t, Wt, qt, At, Bt, Ut, Ht, Vt, _t, Zt, Gt, Kt, Qt, Xt, Yt, ei, ti, ii, ni, oi, ri, ai, si, ci, li, di, pi, ui, mi, fi, gi, bi, hi, Si, vi, yi, wi, ki, Ei, ji, Ii, Ji, Oi, Mi, Ri, Ti, Fi, Li, zi, $i, Wi, Ai, Bi, Ui, Hi, rn;
1621
+ var e2, t2, i, r2, a2, s4, c2, l, d, p, u2, m, f, g, b, h, S2, v, y, w, k, C2, x, P2, D2, E2, j, I, J2, O2, L2, z2, N2, $2, W2, q2, A2, B2, U2, H, V2, _2, Z2, G, K2, Q2, X3, Y3, ee2, te3, ie3, ne2, oe3, re3, ae3, se3, ce3, le3, de2, pe3, ue3, me3, fe3, ge2, be3, he3, Se2, ve3, ye2, we3, ke3, Ce2, xe, Pe2, De2, Ee3, je, Ie2, Je2, Oe3, Re2, Me2, Te3, Fe2, Le, ze3, Ne2, $e2, We2, qe, Ae2, Be2, Ue2, He, Ve2, _e3, Ze2, Ge, Ke, Qe, Xe, Ye, et, tt, it, nt, ot, rt, at2, st2, ct2, lt2, dt2, pt, ut, mt2, ft, gt2, bt2, ht2, St, vt2, yt2, wt2, kt, Ct, xt, Pt, Dt, Et, jt2, It, Jt, Ot, Rt, Mt, Tt, Ft, Lt, zt, Nt, $t, Wt, qt, At, Bt, Ut, Ht, Vt, _t, Zt, Gt, Kt, Qt, Xt, Yt, ei, ti, ii, ni, oi, ri, ai, si, ci, li, di, pi, ui, mi, fi, gi, bi, hi, Si, vi, yi, wi, ki, Ei, ji, Ii, Ji, Oi, Ri, Mi, Ti, Fi, zi, Ni, $i, Wi, Ai, Bi, Ui, Hi, rn;
1622
1622
  var init_dev = __esm({
1623
1623
  "../core/dist/dev.mjs"() {
1624
1624
  "use strict";
@@ -1627,7 +1627,7 @@ var init_dev = __esm({
1627
1627
  for (var n4 in i2) e2(t3, n4, { get: i2[n4], enumerable: true });
1628
1628
  };
1629
1629
  i = {};
1630
- t2(i, { BaseContextConfig: () => L2, BatchConfig: () => z2, CacheRuleSchema: () => qe, CacheSchema: () => Ae2, CacheSchemas: () => We2, ClickIdEntrySchema: () => Wi, CodeSchema: () => Li, CollectorSchemas: () => bt2, ConsentSchema: () => G, ContractActionsSchema: () => bi, ContractRuleSchema: () => Si, ContractSchema: () => vi, ContractSchemaEntry: () => gi, Counter: () => d, DeepPartialEventSchema: () => ie3, DestinationSchemas: () => Me2, DestinationsMapConfig: () => q2, EntitiesSchema: () => Y3, EntitySchema: () => X3, EventSchema: () => ee2, FlowBundlePackageSchema: () => ri, FlowBundleSchema: () => ai, FlowCodeSchema: () => si, FlowConfigSchema: () => yi, FlowDestinationSchema: () => mi, FlowJsonSchema: () => ki, FlowSchema: () => wi, FlowSchemas: () => ti, FlowSourceSchema: () => pi, FlowStoreSchema: () => fi, FlowTransformerSchema: () => ui, GenericEnvConfig: () => O2, GenericSettingsConfig: () => J2, HandlersConfig: () => x, HintSchema: () => zi, HintsSchema: () => $i, IdConfig: () => E2, Identifier: () => c2, InitConfig: () => j, LoggerConfigSchema: () => Ue2, LoggerHandlerSchema: () => Be2, LoopSchema: () => fe3, MapSchema: () => be3, MappingResultSchema: () => ke3, MappingSchemas: () => pe3, MatchExpressionSchema: () => Ne3, MatcherSchemas: () => Re2, NextRuleSchema: () => $e2, OptionalPrimitiveValue: () => u2, OrderedPropertiesSchema: () => _2, PartialEventSchema: () => te3, PolicySchema: () => Se3, PrimaryConfig: () => I, PrimitiveValue: () => p, ProcessingControlConfig: () => $2, PropertiesSchema: () => V2, PropertySchema: () => H, PropertyTypeSchema: () => U2, QueueConfig: () => D2, RequiredBoolean: () => s4, RequiredNumber: () => a2, RequiredString: () => r2, RoutableNextSchema: () => ze2, RuleSchema: () => ve3, RulesSchema: () => ye2, RuntimeInstanceConfig: () => N2, SetSchema: () => ge2, SourceSchema: () => Q2, SourceSchemas: () => Ot, SourceTypeSchema: () => Z2, SourcesMapConfig: () => W2, StoreSchemas: () => Kt, Timestamp: () => l, TransformerSchemas: () => Ht, UserSchema: () => K2, UtilitySchemas: () => m, ValueConfigSchema: () => he3, ValueSchema: () => ue3, ValuesSchema: () => me3, VerboseConfig: () => P2, WalkerOSSchemas: () => A2, configJsonSchema: () => Ei, consentJsonSchema: () => de2, contractJsonSchema: () => Fi, contractRuleJsonSchema: () => Ti, createArraySchema: () => Yi, createConsentConfig: () => F2, createDataTransformationConfig: () => M2, createEnumSchema: () => en, createMappingRulesConfig: () => R2, createObjectSchema: () => Qi, createPolicyConfig: () => T2, createTupleSchema: () => tn, destinationJsonSchema: () => Oi, entityJsonSchema: () => ce3, eventJsonSchema: () => ne2, flowConfigJsonSchema: () => Ii, flowJsonSchema: () => ji, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee3, orderedPropertiesJsonSchema: () => se3, parseConfig: () => Ci, parseFlow: () => Pi, partialEventJsonSchema: () => oe3, policyJsonSchema: () => je, propertiesJsonSchema: () => ae3, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Je2, safeParseConfig: () => xi, safeParseFlow: () => Di, setJsonSchema: () => De2, sourceJsonSchema: () => Ji, sourceTypeJsonSchema: () => le3, storeJsonSchema: () => Ri, transformerJsonSchema: () => Mi, userJsonSchema: () => re3, validateFlowConfig: () => qi, valueConfigJsonSchema: () => xe, valueJsonSchema: () => Ce2, z: () => n3, zodToSchema: () => nn });
1630
+ t2(i, { BaseContextConfig: () => z2, BatchConfig: () => N2, CacheRuleSchema: () => qe, CacheSchema: () => Ae2, CacheSchemas: () => We2, ClickIdEntrySchema: () => Wi, CodeSchema: () => zi, CollectorSchemas: () => bt2, ConsentSchema: () => G, ContractActionsSchema: () => bi, ContractRuleSchema: () => Si, ContractSchema: () => vi, ContractSchemaEntry: () => gi, Counter: () => d, DeepPartialEventSchema: () => ie3, DestinationSchemas: () => Re2, DestinationsMapConfig: () => q2, EntitiesSchema: () => Y3, EntitySchema: () => X3, EventSchema: () => ee2, FlowBundlePackageSchema: () => ri, FlowBundleSchema: () => ai, FlowCodeSchema: () => si, FlowConfigSchema: () => yi, FlowDestinationSchema: () => mi, FlowJsonSchema: () => ki, FlowSchema: () => wi, FlowSchemas: () => ti, FlowSourceSchema: () => pi, FlowStoreSchema: () => fi, FlowTransformerSchema: () => ui, GenericEnvConfig: () => O2, GenericSettingsConfig: () => J2, HandlersConfig: () => x, HintSchema: () => Ni, HintsSchema: () => $i, IdConfig: () => E2, Identifier: () => c2, InitConfig: () => j, LoggerConfigSchema: () => Ue2, LoggerHandlerSchema: () => Be2, LoopSchema: () => fe3, MapSchema: () => be3, MappingResultSchema: () => ke3, MappingSchemas: () => pe3, MatchExpressionSchema: () => Le, MatcherSchemas: () => Me2, OptionalPrimitiveValue: () => u2, OrderedPropertiesSchema: () => _2, PartialEventSchema: () => te3, PolicySchema: () => Se2, PrimaryConfig: () => I, PrimitiveValue: () => p, ProcessingControlConfig: () => $2, PropertiesSchema: () => V2, PropertySchema: () => H, PropertyTypeSchema: () => U2, QueueConfig: () => D2, RequiredBoolean: () => s4, RequiredNumber: () => a2, RequiredString: () => r2, RouteSchema: () => $e2, RouteSpecSchema: () => Ne2, RuleSchema: () => ve3, RulesSchema: () => ye2, RuntimeInstanceConfig: () => L2, SetSchema: () => ge2, SourceSchema: () => Q2, SourceSchemas: () => Ot, SourceTypeSchema: () => Z2, SourcesMapConfig: () => W2, StoreSchemas: () => Kt, Timestamp: () => l, TransformerSchemas: () => Ht, UserSchema: () => K2, UtilitySchemas: () => m, ValueConfigSchema: () => he3, ValueSchema: () => ue3, ValuesSchema: () => me3, VerboseConfig: () => P2, WalkerOSSchemas: () => A2, configJsonSchema: () => Ei, consentJsonSchema: () => de2, contractJsonSchema: () => Fi, contractRuleJsonSchema: () => Ti, createArraySchema: () => Yi, createConsentConfig: () => F2, createDataTransformationConfig: () => R2, createEnumSchema: () => en, createMappingRulesConfig: () => M2, createObjectSchema: () => Qi, createPolicyConfig: () => T2, createTupleSchema: () => tn, destinationJsonSchema: () => Oi, entityJsonSchema: () => ce3, eventJsonSchema: () => ne2, flowConfigJsonSchema: () => Ii, flowJsonSchema: () => ji, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee3, orderedPropertiesJsonSchema: () => se3, parseConfig: () => Ci, parseFlow: () => Pi, partialEventJsonSchema: () => oe3, policyJsonSchema: () => je, propertiesJsonSchema: () => ae3, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Je2, safeParseConfig: () => xi, safeParseFlow: () => Di, setJsonSchema: () => De2, sourceJsonSchema: () => Ji, sourceTypeJsonSchema: () => le3, storeJsonSchema: () => Mi, transformerJsonSchema: () => Ri, userJsonSchema: () => re3, validateFlowConfig: () => qi, valueConfigJsonSchema: () => xe, valueJsonSchema: () => Ce2, z: () => n3, zodToSchema: () => nn });
1631
1631
  r2 = n3.string();
1632
1632
  a2 = n3.number();
1633
1633
  s4 = n3.boolean();
@@ -1656,9 +1656,9 @@ var init_dev = __esm({
1656
1656
  I = n3.object({ primary: n3.boolean().describe("Mark as primary (only one can be primary)").optional() }).partial();
1657
1657
  J2 = n3.object({ settings: n3.any().optional().describe("Implementation-specific configuration") }).partial();
1658
1658
  O2 = n3.object({ env: n3.any().optional().describe("Environment dependencies (platform-specific)") }).partial();
1659
- N2 = n3.object({ type: n3.string().optional().describe("Instance type identifier"), config: n3.unknown().describe("Instance configuration") }).partial();
1660
- L2 = n3.object({ collector: n3.unknown().describe("Collector instance (runtime object)"), config: n3.unknown().describe("Configuration"), env: n3.unknown().describe("Environment dependencies") }).partial();
1661
- z2 = n3.object({ batch: n3.number().optional().describe("Batch size: bundle N events for batch processing"), batched: n3.unknown().optional().describe("Batch of events to be processed") }).partial();
1659
+ L2 = n3.object({ type: n3.string().optional().describe("Instance type identifier"), config: n3.unknown().describe("Instance configuration") }).partial();
1660
+ z2 = n3.object({ collector: n3.unknown().describe("Collector instance (runtime object)"), config: n3.unknown().describe("Configuration"), env: n3.unknown().describe("Environment dependencies") }).partial();
1661
+ N2 = n3.object({ batch: n3.number().optional().describe("Batch size: bundle N events for batch processing"), batched: n3.unknown().optional().describe("Batch of events to be processed") }).partial();
1662
1662
  $2 = n3.object({ ignore: n3.boolean().describe("Set to true to skip processing").optional(), condition: n3.string().optional().describe("Condition function: return true to process") }).partial();
1663
1663
  W2 = n3.object({ sources: n3.record(n3.string(), n3.unknown()).describe("Map of source instances") }).partial();
1664
1664
  q2 = n3.object({ destinations: n3.record(n3.string(), n3.unknown()).describe("Map of destination instances") }).partial();
@@ -1686,54 +1686,54 @@ var init_dev = __esm({
1686
1686
  le3 = o(Z2);
1687
1687
  de2 = o(G);
1688
1688
  pe3 = {};
1689
- t2(pe3, { ConfigSchema: () => we3, LoopSchema: () => fe3, MapSchema: () => be3, PolicySchema: () => Se3, ResultSchema: () => ke3, RuleSchema: () => ve3, RulesSchema: () => ye2, SetSchema: () => ge2, ValueConfigSchema: () => he3, ValueSchema: () => ue3, ValuesSchema: () => me3, configJsonSchema: () => Oe2, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee3, policyJsonSchema: () => je, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Je2, setJsonSchema: () => De2, valueConfigJsonSchema: () => xe, valueJsonSchema: () => Ce2 });
1689
+ t2(pe3, { ConfigSchema: () => we3, LoopSchema: () => fe3, MapSchema: () => be3, PolicySchema: () => Se2, ResultSchema: () => ke3, RuleSchema: () => ve3, RulesSchema: () => ye2, SetSchema: () => ge2, ValueConfigSchema: () => he3, ValueSchema: () => ue3, ValuesSchema: () => me3, configJsonSchema: () => Oe3, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee3, policyJsonSchema: () => je, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Je2, setJsonSchema: () => De2, valueConfigJsonSchema: () => xe, valueJsonSchema: () => Ce2 });
1690
1690
  ue3 = 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(() => B2), n3.array(ue3).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." });
1691
1691
  me3 = n3.array(ue3).meta({ id: "MappingValues", title: "Mapping.Values", description: "Array of transformation values." }).describe("Array of transformation values");
1692
1692
  fe3 = n3.lazy(() => n3.tuple([ue3, ue3]).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." });
1693
1693
  ge2 = n3.lazy(() => n3.array(ue3).describe("Set: Array of values for selection or combination")).meta({ id: "MappingSet", title: "Mapping.Set", description: "Set: array of values for selection or combination." });
1694
1694
  be3 = n3.lazy(() => n3.record(n3.string(), ue3).describe("Map: Object mapping keys to transformation values")).meta({ id: "MappingMap", title: "Mapping.Map", description: "Map: object mapping keys to transformation values." });
1695
1695
  he3 = B2 = 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: be3.optional().describe("Object mapping: transform event data to structured output"), loop: fe3.optional().describe("Loop transformation: [source, transform] for array processing"), set: ge2.optional().describe("Set of values: combine or select from multiple values"), consent: G.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((e3) => Object.keys(e3).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");
1696
- Se3 = n3.record(n3.string(), ue3).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)");
1697
- ve3 = n3.object({ name: n3.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), data: n3.union([ue3, me3]).optional().describe("Data transformation rules for event"), settings: n3.any().optional().describe("Destination-specific settings for this event mapping"), condition: n3.string().optional().describe("Condition function as string: return true to process event"), consent: G.optional().describe("Required consent states to process this event"), policy: Se3.optional().describe("Event-level policy overrides (applied after config-level policy)"), batch: n3.number().optional().describe("Batch size: bundle N events for batch processing"), 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.") }).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");
1696
+ Se2 = n3.record(n3.string(), ue3).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)");
1697
+ ve3 = n3.object({ name: n3.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), data: n3.union([ue3, me3]).optional().describe("Data transformation rules for event"), settings: n3.any().optional().describe("Destination-specific settings for this event mapping"), condition: n3.string().optional().describe("Condition function as string: return true to process event"), consent: G.optional().describe("Required consent states to process this event"), policy: Se2.optional().describe("Event-level policy overrides (applied after config-level policy)"), batch: n3.number().optional().describe("Batch size: bundle N events for batch processing"), 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.") }).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");
1698
1698
  ye2 = n3.record(n3.string(), n3.record(n3.string(), n3.union([ve3, n3.array(ve3)])).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*).');
1699
- we3 = n3.object({ consent: G.optional().describe("Required consent states to process any events"), data: n3.union([ue3, me3]).optional().describe("Global data transformation applied to all events"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), mapping: ye2.optional().describe("Entity-action specific mapping rules"), policy: Se3.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");
1699
+ we3 = n3.object({ consent: G.optional().describe("Required consent states to process any events"), data: n3.union([ue3, me3]).optional().describe("Global data transformation applied to all events"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), mapping: ye2.optional().describe("Entity-action specific mapping rules"), policy: Se2.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");
1700
1700
  ke3 = n3.object({ eventMapping: ve3.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");
1701
1701
  Ce2 = o(ue3);
1702
1702
  xe = o(he3);
1703
1703
  Pe2 = o(fe3);
1704
1704
  De2 = o(ge2);
1705
1705
  Ee3 = o(be3);
1706
- je = o(Se3);
1706
+ je = o(Se2);
1707
1707
  Ie2 = o(ve3);
1708
1708
  Je2 = o(ye2);
1709
- Oe2 = o(we3);
1710
- Me2 = {};
1711
- t2(Me2, { BatchSchema: () => Ye, ConfigSchema: () => He2, ContextSchema: () => Ze2, DLQSchema: () => ct2, DataSchema: () => et, DestinationPolicySchema: () => _e2, DestinationsSchema: () => ot, InitDestinationsSchema: () => nt, InitSchema: () => it, InstanceSchema: () => tt, PartialConfigSchema: () => Ve2, PushBatchContextSchema: () => Ke, PushContextSchema: () => Ge, PushEventSchema: () => Qe, PushEventsSchema: () => Xe, PushResultSchema: () => at2, RefSchema: () => rt, ResultSchema: () => st2, batchJsonSchema: () => mt2, configJsonSchema: () => lt2, contextJsonSchema: () => pt, instanceJsonSchema: () => ft, partialConfigJsonSchema: () => dt2, pushContextJsonSchema: () => ut, resultJsonSchema: () => gt2 });
1709
+ Oe3 = o(we3);
1712
1710
  Re2 = {};
1713
- t2(Re2, { MatchExpressionSchema: () => Ne3, NextRuleSchema: () => $e2, RoutableNextSchema: () => ze2 });
1714
- Te2 = n3.enum(["eq", "contains", "prefix", "suffix", "regex", "gt", "lt", "exists"]).meta({ id: "MatcherOperator", title: "Matcher.Operator", description: "Supported operators for a match condition." });
1715
- Fe2 = n3.object({ key: n3.string(), operator: Te2, value: n3.string(), not: n3.boolean().optional() }).meta({ id: "MatcherCondition", title: "Matcher.Condition", description: "Single match condition (key, operator, value, optional not)." });
1716
- Ne3 = n3.union([Fe2, n3.object({ and: n3.array(n3.lazy(() => Ne3)) }), n3.object({ or: n3.array(n3.lazy(() => Ne3)) })]).meta({ id: "MatcherExpression", title: "Matcher.Expression", description: "Boolean expression tree of match conditions (leaf, and, or)." });
1717
- Le = n3.union([Ne3, n3.literal("*")]);
1718
- ze2 = n3.union([n3.string(), n3.array(n3.string()), n3.array(n3.object({ match: Le, next: n3.lazy(() => ze2) }))]).meta({ id: "MatcherNext", title: "Matcher.Next", description: "Routable next target: ID, ID list, or list of {match, next} rules." });
1719
- $e2 = n3.object({ match: Le, next: n3.lazy(() => ze2) }).meta({ id: "MatcherNextRule", title: "Matcher.NextRule", description: "Single routing rule pairing a match expression with a next target." });
1711
+ t2(Re2, { BatchSchema: () => Ye, ConfigSchema: () => He, ContextSchema: () => Ze2, DLQSchema: () => ct2, DataSchema: () => et, DestinationPolicySchema: () => _e3, DestinationsSchema: () => ot, InitDestinationsSchema: () => nt, InitSchema: () => it, InstanceSchema: () => tt, PartialConfigSchema: () => Ve2, PushBatchContextSchema: () => Ke, PushContextSchema: () => Ge, PushEventSchema: () => Qe, PushEventsSchema: () => Xe, PushResultSchema: () => at2, RefSchema: () => rt, ResultSchema: () => st2, batchJsonSchema: () => mt2, configJsonSchema: () => lt2, contextJsonSchema: () => pt, instanceJsonSchema: () => ft, partialConfigJsonSchema: () => dt2, pushContextJsonSchema: () => ut, resultJsonSchema: () => gt2 });
1712
+ Me2 = {};
1713
+ t2(Me2, { MatchExpressionSchema: () => Le, RouteSchema: () => $e2, RouteSpecSchema: () => Ne2 });
1714
+ Te3 = n3.enum(["eq", "contains", "prefix", "suffix", "regex", "gt", "lt", "exists"]).meta({ id: "MatcherOperator", title: "Matcher.Operator", description: "Supported operators for a match condition." });
1715
+ Fe2 = n3.object({ key: n3.string(), operator: Te3, value: n3.string(), not: n3.boolean().optional() }).meta({ id: "MatcherCondition", title: "Matcher.Condition", description: "Single match condition (key, operator, value, optional not)." });
1716
+ Le = n3.union([Fe2, n3.object({ and: n3.array(n3.lazy(() => Le)) }), n3.object({ or: n3.array(n3.lazy(() => Le)) })]).meta({ id: "MatcherExpression", title: "Matcher.Expression", description: "Boolean expression tree of match conditions (leaf, and, or)." });
1717
+ ze3 = n3.union([Le, n3.literal("*")]);
1718
+ Ne2 = n3.union([n3.string(), n3.array(n3.string()), n3.array(n3.object({ match: ze3, next: n3.lazy(() => Ne2) }))]).meta({ id: "MatcherRouteSpec", title: "Matcher.RouteSpec", description: "Routable next target: ID, ID list, or list of {match, next} rules." });
1719
+ $e2 = n3.object({ match: ze3, next: n3.lazy(() => Ne2) }).meta({ id: "MatcherRoute", title: "Matcher.Route", description: "Single routing rule pairing a match expression with a next target." });
1720
1720
  We2 = {};
1721
1721
  t2(We2, { CacheRuleSchema: () => qe, CacheSchema: () => Ae2 });
1722
- qe = n3.object({ match: n3.union([Ne3, n3.literal("*")]).describe("Match expression or wildcard to determine when this rule applies"), 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 for cached entries"), update: n3.record(n3.string(), ue3).optional().describe("Response mutations applied on cache hit (key \u2192 Value mapping)") }).meta({ id: "CacheRule", title: "Cache.Rule", description: "Single caching rule: when it applies (match), what keys it keys off, TTL, and optional response mutations on hit." });
1722
+ qe = n3.object({ match: n3.union([Le, n3.literal("*")]).describe("Match expression or wildcard to determine when this rule applies"), 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 for cached entries"), update: n3.record(n3.string(), ue3).optional().describe("Response mutations applied on cache hit (key \u2192 Value mapping)") }).meta({ id: "CacheRule", title: "Cache.Rule", description: "Single caching rule: when it applies (match), what keys it keys off, TTL, and optional response mutations on hit." });
1723
1723
  Ae2 = n3.object({ full: n3.boolean().optional().describe("Stop flow 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)"), rules: n3.array(qe).min(1).describe("Cache rules \u2014 at least one required") }).meta({ id: "CacheConfig", title: "Cache.Config", description: "Top-level cache configuration for a pipeline step (destination / transformer / source ref)." });
1724
1724
  Be2 = n3.any().meta({ id: "LoggerHandler", title: "Logger.Handler", description: "Custom log handler function (level, ...args) => void" });
1725
1725
  Ue2 = n3.object({ level: n3.union([n3.number(), n3.enum(["ERROR", "WARN", "INFO", "DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"), handler: Be2.optional().describe("Custom log handler function") }).meta({ id: "LoggerConfig", title: "Logger.Config", description: "Logger configuration (level, handler) to override the collector defaults" });
1726
- He2 = n3.object({ consent: G.optional().describe("Required consent states to send events to this destination"), settings: n3.any().meta({ id: "DestinationSettings", title: "Destination.Settings", description: "Implementation-specific configuration (destination-defined shape)." }).describe("Implementation-specific configuration").optional(), data: n3.union([ue3, me3]).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: c2.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: ye2.optional().describe("Entity-action specific mapping rules for this destination"), policy: Se3.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: Ue2.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: ze2.optional().describe("Post-collector transformer chain applied before this destination receives the event"), next: ze2.optional().describe("Post-push transformer chain. Runs after destination push completes; push response is available at ingest._response"), cache: Ae2.optional().describe("Cache configuration for deduplication; skip push on cache HIT"), disabled: n3.boolean().describe("Completely skip this destination (no init, no push, no queue)").optional(), mock: n3.unknown().meta({ id: "DestinationMock", title: "Destination.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Dev/testing only.") }).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");
1727
- Ve2 = He2.partial().meta({ id: "DestinationPartialConfig", title: "Destination.PartialConfig", description: "Partial destination configuration with all fields optional." }).describe("Partial destination configuration with all fields optional");
1728
- _e2 = Se3.describe("Destination policy rules for event pre-processing");
1729
- Ze2 = 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: He2.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");
1726
+ He = n3.object({ consent: G.optional().describe("Required consent states to send events to this destination"), settings: n3.any().meta({ id: "DestinationSettings", title: "Destination.Settings", description: "Implementation-specific configuration (destination-defined shape)." }).describe("Implementation-specific configuration").optional(), data: n3.union([ue3, me3]).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: c2.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: ye2.optional().describe("Entity-action specific mapping rules for this destination"), policy: Se2.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: Ue2.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: Ne2.optional().describe("Post-collector transformer chain applied before this destination receives the event"), next: Ne2.optional().describe("Post-push transformer chain. Runs after destination push completes; push response is available at ingest._response"), cache: Ae2.optional().describe("Cache configuration for deduplication; skip push on cache HIT"), disabled: n3.boolean().describe("Completely skip this destination (no init, no push, no queue)").optional(), mock: n3.unknown().meta({ id: "DestinationMock", title: "Destination.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Dev/testing only.") }).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");
1727
+ Ve2 = He.partial().meta({ id: "DestinationPartialConfig", title: "Destination.PartialConfig", description: "Partial destination configuration with all fields optional." }).describe("Partial destination configuration with all fields optional");
1728
+ _e3 = Se2.describe("Destination policy rules for event pre-processing");
1729
+ Ze2 = 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: He.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");
1730
1730
  Ge = Ze2.extend({ mapping: ve3.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");
1731
1731
  Ke = Ge.describe("Batch push context with event-specific mapping");
1732
1732
  Qe = n3.object({ event: ee2.describe("The event to process"), mapping: ve3.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");
1733
1733
  Xe = n3.array(Qe).meta({ id: "DestinationPushEvents", title: "Destination.PushEvents", description: "Array of events with mappings (batch input)." }).describe("Array of events with mappings");
1734
1734
  Ye = n3.object({ key: n3.string().describe('Batch key (usually mapping key like "product.view")'), events: n3.array(ee2).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: ve3.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");
1735
1735
  et = 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)");
1736
- tt = n3.object({ config: He2.describe("Destination configuration"), queue: n3.array(ee2).optional().describe("Queued events awaiting consent"), dlq: n3.array(n3.tuple([ee2, 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)");
1736
+ tt = n3.object({ config: He.describe("Destination configuration"), queue: n3.array(ee2).optional().describe("Queued events awaiting consent"), dlq: n3.array(n3.tuple([ee2, 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)");
1737
1737
  it = n3.object({ code: tt.describe("Destination instance with implementation"), config: Ve2.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");
1738
1738
  nt = n3.record(n3.string(), it).meta({ id: "DestinationInitDestinations", title: "Destination.InitDestinations", description: "Map of destination IDs to initialization configurations." }).describe("Map of destination IDs to initialization configurations");
1739
1739
  ot = n3.record(n3.string(), tt).meta({ id: "DestinationDestinations", title: "Destination.Destinations", description: "Map of destination IDs to runtime destination instances." }).describe("Map of destination IDs to runtime instances");
@@ -1741,7 +1741,7 @@ var init_dev = __esm({
1741
1741
  at2 = n3.object({ queue: n3.array(ee2).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");
1742
1742
  st2 = n3.object({ ok: n3.boolean().describe("True if nothing failed"), event: n3.unknown().optional().describe("The processed event"), done: n3.record(n3.string(), rt).optional().describe("Destinations that processed successfully"), queued: n3.record(n3.string(), rt).optional().describe("Destinations that queued events"), failed: n3.record(n3.string(), rt).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");
1743
1743
  ct2 = n3.array(n3.tuple([ee2, n3.unknown()])).meta({ id: "DestinationDLQ", title: "Destination.DLQ", description: "Dead-letter queue: list of [event, error] tuples." }).describe("Dead letter queue: [(event, error), ...]");
1744
- lt2 = o(He2);
1744
+ lt2 = o(He);
1745
1745
  dt2 = o(Ve2);
1746
1746
  pt = o(Ze2);
1747
1747
  ut = o(Ge);
@@ -1765,23 +1765,23 @@ var init_dev = __esm({
1765
1765
  It = o(wt2);
1766
1766
  Jt = o(xt);
1767
1767
  Ot = {};
1768
- t2(Ot, { BaseEnvSchema: () => Mt, ConfigSchema: () => Rt, InitSchema: () => Nt, InitSourceSchema: () => Lt, InitSourcesSchema: () => zt, InstanceSchema: () => Ft, PartialConfigSchema: () => Tt, baseEnvJsonSchema: () => $t, configJsonSchema: () => Wt, initSourceJsonSchema: () => Bt, initSourcesJsonSchema: () => Ut, instanceJsonSchema: () => At, partialConfigJsonSchema: () => qt });
1769
- Mt = 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");
1770
- Rt = we3.extend({ settings: n3.any().meta({ id: "SourceSettings", title: "Source.Settings", description: "Implementation-specific configuration (source-defined shape)." }).describe("Implementation-specific configuration").optional(), env: Mt.optional().describe("Environment dependencies (platform-specific)"), id: c2.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: Ue2.optional().describe("Logger configuration (level, handler) to override the collector defaults"), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)"), ingest: n3.union([ue3, me3]).optional().describe("Ingest metadata extraction mapping. Extracts values from raw request objects (Express req, Lambda event) using mapping syntax."), disabled: n3.boolean().describe("Completely skip this source (no init, no event capture)").optional(), init: n3.boolean().optional().describe("Init lifecycle flag set by collector to true after Instance.init() runs") }).meta({ id: "SourceConfig", title: "Source.Config", description: "Source configuration with mapping, environment, and lifecycle hooks." }).describe("Source configuration with mapping and environment");
1771
- Tt = Rt.partial().meta({ id: "SourcePartialConfig", title: "Source.PartialConfig", description: "Partial source configuration with all fields optional." }).describe("Partial source configuration with all fields optional");
1772
- Ft = n3.object({ type: n3.string().describe('Source type identifier (e.g., "browser", "dataLayer")'), config: Rt.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");
1773
- Nt = 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>");
1774
- Lt = n3.object({ code: Nt.describe("Source initialization function"), config: Tt.optional().describe("Partial configuration overrides"), env: Mt.partial().optional().describe("Partial environment overrides"), primary: n3.boolean().optional().describe("Mark as primary source (only one can be primary)") }).meta({ id: "SourceInitSource", title: "Source.InitSource", description: "Source initialization bundle (init function + config + env + primary flag)." }).describe("Source initialization configuration");
1775
- zt = n3.record(n3.string(), Lt).meta({ id: "SourceInitSources", title: "Source.InitSources", description: "Map of source IDs to initialization configurations." }).describe("Map of source IDs to initialization configurations");
1776
- $t = o(Mt);
1777
- Wt = o(Rt);
1768
+ t2(Ot, { BaseEnvSchema: () => Rt, ConfigSchema: () => Mt, InitSchema: () => Lt, InitSourceSchema: () => zt, InitSourcesSchema: () => Nt, InstanceSchema: () => Ft, PartialConfigSchema: () => Tt, baseEnvJsonSchema: () => $t, configJsonSchema: () => Wt, initSourceJsonSchema: () => Bt, initSourcesJsonSchema: () => Ut, instanceJsonSchema: () => At, partialConfigJsonSchema: () => qt });
1769
+ Rt = 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");
1770
+ Mt = we3.extend({ settings: n3.any().meta({ id: "SourceSettings", title: "Source.Settings", description: "Implementation-specific configuration (source-defined shape)." }).describe("Implementation-specific configuration").optional(), env: Rt.optional().describe("Environment dependencies (platform-specific)"), id: c2.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: Ue2.optional().describe("Logger configuration (level, handler) to override the collector defaults"), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)"), ingest: n3.union([ue3, me3]).optional().describe("Ingest metadata extraction mapping. Extracts values from raw request objects (Express req, Lambda event) using mapping syntax."), disabled: n3.boolean().describe("Completely skip this source (no init, no event capture)").optional(), init: n3.boolean().optional().describe("Init lifecycle flag set by collector to true after Instance.init() runs") }).meta({ id: "SourceConfig", title: "Source.Config", description: "Source configuration with mapping, environment, and lifecycle hooks." }).describe("Source configuration with mapping and environment");
1771
+ Tt = Mt.partial().meta({ id: "SourcePartialConfig", title: "Source.PartialConfig", description: "Partial source configuration with all fields optional." }).describe("Partial source configuration with all fields optional");
1772
+ Ft = n3.object({ type: n3.string().describe('Source type identifier (e.g., "browser", "dataLayer")'), config: Mt.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");
1773
+ Lt = 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>");
1774
+ zt = n3.object({ code: Lt.describe("Source initialization function"), config: Tt.optional().describe("Partial configuration overrides"), env: Rt.partial().optional().describe("Partial environment overrides"), primary: n3.boolean().optional().describe("Mark as primary source (only one can be primary)") }).meta({ id: "SourceInitSource", title: "Source.InitSource", description: "Source initialization bundle (init function + config + env + primary flag)." }).describe("Source initialization configuration");
1775
+ Nt = n3.record(n3.string(), zt).meta({ id: "SourceInitSources", title: "Source.InitSources", description: "Map of source IDs to initialization configurations." }).describe("Map of source IDs to initialization configurations");
1776
+ $t = o(Rt);
1777
+ Wt = o(Mt);
1778
1778
  qt = o(Tt);
1779
1779
  At = o(Ft);
1780
- Bt = o(Lt);
1781
- Ut = o(zt);
1780
+ Bt = o(zt);
1781
+ Ut = o(Nt);
1782
1782
  Ht = {};
1783
1783
  t2(Ht, { ConfigSchema: () => Vt, PartialConfigSchema: () => _t, configJsonSchema: () => Zt, partialConfigJsonSchema: () => Gt });
1784
- Vt = 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: c2.describe("Transformer instance identifier (defaults to transformer key)").optional(), logger: Ue2.optional().describe("Logger configuration (level, handler) to override the collector defaults"), before: ze2.optional().describe("Pre-transformer chain that runs before this transformer pushes"), next: ze2.optional().describe("Graph wiring to the next transformer in the chain"), cache: Ae2.optional().describe("Step-level cache configuration for this transformer"), init: n3.boolean().describe("Whether to initialize immediately").optional(), disabled: n3.boolean().describe("Completely skip this transformer in chains").optional(), mock: n3.unknown().meta({ id: "TransformerMock", title: "Transformer.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Global mock for all chains. Dev/testing only."), chainMocks: n3.record(n3.string(), n3.unknown().meta({ id: "TransformerChainMock", title: "Transformer.ChainMock", description: "Chain-path-specific mock value. Dev/testing only." })).optional().describe("Path-specific mock values keyed by chain path. Takes precedence over global mock. Dev/testing only.") }).meta({ id: "TransformerConfig", title: "Transformer.Config", description: "Transformer configuration (settings, env, chain wiring, cache, mocks)." }).describe("Transformer configuration");
1784
+ Vt = 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: c2.describe("Transformer instance identifier (defaults to transformer key)").optional(), logger: Ue2.optional().describe("Logger configuration (level, handler) to override the collector defaults"), before: Ne2.optional().describe("Pre-transformer chain that runs before this transformer pushes"), next: Ne2.optional().describe("Graph wiring to the next transformer in the chain"), cache: Ae2.optional().describe("Step-level cache configuration for this transformer"), init: n3.boolean().describe("Whether to initialize immediately").optional(), disabled: n3.boolean().describe("Completely skip this transformer in chains").optional(), mock: n3.unknown().meta({ id: "TransformerMock", title: "Transformer.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Global mock for all chains. Dev/testing only."), chainMocks: n3.record(n3.string(), n3.unknown().meta({ id: "TransformerChainMock", title: "Transformer.ChainMock", description: "Chain-path-specific mock value. Dev/testing only." })).optional().describe("Path-specific mock values keyed by chain path. Takes precedence over global mock. Dev/testing only.") }).meta({ id: "TransformerConfig", title: "Transformer.Config", description: "Transformer configuration (settings, env, chain wiring, cache, mocks)." }).describe("Transformer configuration");
1785
1785
  _t = Vt.partial().meta({ id: "TransformerPartialConfig", title: "Transformer.PartialConfig", description: "Partial transformer configuration with all fields optional." }).describe("Partial transformer configuration with all fields optional");
1786
1786
  Zt = o(Vt);
1787
1787
  Gt = o(_t);
@@ -1792,7 +1792,7 @@ var init_dev = __esm({
1792
1792
  Yt = o(Qt);
1793
1793
  ei = o(Xt);
1794
1794
  ti = {};
1795
- t2(ti, { BundlePackageSchema: () => ri, BundleSchema: () => ai, CodeSchema: () => si, ConfigSchema: () => yi, ContractActionsSchema: () => bi, ContractEventsSchema: () => hi, ContractRuleSchema: () => Si, ContractSchema: () => vi, ContractSchemaEntry: () => gi, DestinationSchema: () => mi, FlowSchema: () => wi, JsonSchema: () => ki, SettingsSchema: () => ni, SourceSchema: () => pi, StepExampleSchema: () => li, StepExamplesSchema: () => di, StoreSchema: () => fi, TransformerSchema: () => ui, TriggerDescriptorSchema: () => ci, VariablesSchema: () => ii, configJsonSchema: () => Ei, contractJsonSchema: () => Fi, contractRuleJsonSchema: () => Ti, destinationJsonSchema: () => Oi, flowConfigJsonSchema: () => Ii, flowJsonSchema: () => ji, parseConfig: () => Ci, parseFlow: () => Pi, safeParseConfig: () => xi, safeParseFlow: () => Di, sourceJsonSchema: () => Ji, storeJsonSchema: () => Ri, transformerJsonSchema: () => Mi });
1795
+ t2(ti, { BundlePackageSchema: () => ri, BundleSchema: () => ai, CodeSchema: () => si, ConfigSchema: () => yi, ContractActionsSchema: () => bi, ContractEventsSchema: () => hi, ContractRuleSchema: () => Si, ContractSchema: () => vi, ContractSchemaEntry: () => gi, DestinationSchema: () => mi, FlowSchema: () => wi, JsonSchema: () => ki, SettingsSchema: () => ni, SourceSchema: () => pi, StepExampleSchema: () => li, StepExamplesSchema: () => di, StoreSchema: () => fi, TransformerSchema: () => ui, TriggerDescriptorSchema: () => ci, VariablesSchema: () => ii, configJsonSchema: () => Ei, contractJsonSchema: () => Fi, contractRuleJsonSchema: () => Ti, destinationJsonSchema: () => Oi, flowConfigJsonSchema: () => Ii, flowJsonSchema: () => ji, parseConfig: () => Ci, parseFlow: () => Pi, safeParseConfig: () => xi, safeParseFlow: () => Di, sourceJsonSchema: () => Ji, storeJsonSchema: () => Mi, transformerJsonSchema: () => Ri });
1796
1796
  ii = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowVariables", title: "Flow.Variables", description: "Reusable values referenced via $var.name (with optional deep paths). Whole-string refs preserve native type; inline interpolation requires scalars." });
1797
1797
  ni = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowSettings", title: "Flow.Settings", description: "Free-form key-value settings consumed by the platform runtime." }).describe("Free-form platform settings bag");
1798
1798
  oi = /^(@[a-z0-9\-~][a-z0-9\-._~]*\/)?[a-z0-9\-~][a-z0-9\-._~]*$/;
@@ -1802,9 +1802,9 @@ var init_dev = __esm({
1802
1802
  ci = n3.object({ type: n3.string().optional().describe("Trigger mechanism (e.g., click, POST, load)"), options: n3.unknown().optional().describe("Mechanism-specific options") }).meta({ id: "TriggerDescriptor", title: "Trigger.Descriptor", description: "Source trigger metadata (mechanism + options) used by step examples." });
1803
1803
  li = n3.object({ title: n3.string().optional().describe("Human-readable title (overrides default heading)"), description: n3.string().optional().describe("Human-readable description"), public: n3.boolean().optional().describe("Whether this example is shown in docs/UI/MCP default output (default: true). Set false for test-only fixtures."), in: n3.unknown().optional().describe("Input to the step"), trigger: ci.optional().describe("Source trigger metadata"), mapping: n3.unknown().optional().describe("Mapping configuration"), out: n3.unknown().optional().describe("Expected output from the step"), command: n3.enum(["config", "consent", "user", "run"]).optional().describe("Invoke elb('walker <command>', in) instead of pushing in as an event") }).meta({ id: "FlowStepExample", title: "Flow.StepExample", description: "Named example with input/output pair used for step testing." }).describe("Named example with input/output pair");
1804
1804
  di = n3.record(n3.string(), li).meta({ id: "FlowStepExamples", title: "Flow.StepExamples", description: "Named step examples keyed by scenario name." }).describe("Named step examples for testing and documentation");
1805
- pi = 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: n3.union([n3.string(), si]).optional().describe('Either a named export string (e.g., "sourceExpress") or an inline code object with push function'), 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: ii.optional().describe("Source-level variables (highest priority in cascade)"), next: ze2.optional().describe("Pre-collector transformer chain. String, string[], or NextRule[] for conditional routing based on ingest data."), before: ze2.optional().describe("Pre-source transformer chain (consent-exempt). Handles transport-level preprocessing."), examples: di.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ae2.optional().describe("Cache configuration for this source (match \u2192 key \u2192 ttl rules)") }).meta({ id: "FlowSource", title: "Flow.Source", description: "Source package reference with configuration, env, chains, and examples." }).describe("Source package reference with configuration");
1806
- ui = 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: n3.union([n3.string(), si]).optional().describe('Either a named export string (e.g., "transformerEnricher") or an inline code object with push function'), 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: ze2.optional().describe("Pre-transformer chain. Runs before this transformer push function."), next: ze2.optional().describe("Next transformer in chain. String, string[], or NextRule[] for conditional routing."), variables: ii.optional().describe("Transformer-level variables (highest priority in cascade)"), examples: di.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ae2.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");
1807
- mi = 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: n3.union([n3.string(), si]).optional().describe('Either a named export string (e.g., "destinationAnalytics") or an inline code object with push function'), 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: ii.optional().describe("Destination-level variables (highest priority in cascade)"), before: ze2.optional().describe("Post-collector transformer chain. String, string[], or NextRule[] for conditional routing."), next: ze2.optional().describe("Post-push transformer chain. Push response available at context.ingest._response."), examples: di.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ae2.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");
1805
+ pi = 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: n3.union([n3.string(), si]).optional().describe('Either a named export string (e.g., "sourceExpress") or an inline code object with push function'), 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: ii.optional().describe("Source-level variables (highest priority in cascade)"), next: Ne2.optional().describe("Pre-collector transformer chain. String, string[], or Route[] for conditional routing based on ingest data."), before: Ne2.optional().describe("Pre-source transformer chain (consent-exempt). Handles transport-level preprocessing."), examples: di.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ae2.optional().describe("Cache configuration for this source (match \u2192 key \u2192 ttl rules)") }).meta({ id: "FlowSource", title: "Flow.Source", description: "Source package reference with configuration, env, chains, and examples." }).describe("Source package reference with configuration");
1806
+ ui = 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: n3.union([n3.string(), si]).optional().describe('Either a named export string (e.g., "transformerEnricher") or an inline code object with push function'), 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: Ne2.optional().describe("Pre-transformer chain. Runs before this transformer push function."), next: Ne2.optional().describe("Next transformer in chain. String, string[], or Route[] for conditional routing."), variables: ii.optional().describe("Transformer-level variables (highest priority in cascade)"), examples: di.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ae2.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");
1807
+ mi = 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: n3.union([n3.string(), si]).optional().describe('Either a named export string (e.g., "destinationAnalytics") or an inline code object with push function'), 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: ii.optional().describe("Destination-level variables (highest priority in cascade)"), before: Ne2.optional().describe("Post-collector transformer chain. String, string[], or Route[] for conditional routing."), next: Ne2.optional().describe("Post-push transformer chain. Push response available at context.ingest._response."), examples: di.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ae2.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");
1808
1808
  fi = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe("Store package specifier with optional version"), code: n3.union([n3.string(), si]).optional().describe("Named export string or inline code definition"), 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"), variables: ii.optional().describe("Store-level variables (highest priority in cascade)"), examples: di.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, and examples." }).describe("Store package reference with configuration");
1809
1809
  gi = 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");
1810
1810
  bi = n3.record(n3.string(), gi).meta({ id: "FlowContractActions", title: "Flow.ContractActions", description: "Action-level contract entries keyed by action name." }).describe("Action-level contract entries");
@@ -1819,19 +1819,19 @@ var init_dev = __esm({
1819
1819
  Ii = o(yi);
1820
1820
  Ji = o(pi);
1821
1821
  Oi = o(mi);
1822
- Mi = o(ui);
1823
- Ri = o(fi);
1822
+ Ri = o(ui);
1823
+ Mi = o(fi);
1824
1824
  Ti = o(Si);
1825
1825
  Fi = o(vi);
1826
- Li = Ni.object({ lang: Ni.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"), code: Ni.string().describe("Code snippet") });
1827
- zi = Ni.object({ text: Ni.string().describe("Short actionable hint text focused on walkerOS usage"), code: Ni.array(Li).optional().describe("Optional code snippets") });
1828
- $i = Ni.record(Ni.string(), zi).describe("Keyed hints for AI consumption \u2014 lightweight context beyond schemas and examples");
1826
+ zi = Li.object({ lang: Li.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"), code: Li.string().describe("Code snippet") });
1827
+ Ni = Li.object({ text: Li.string().describe("Short actionable hint text focused on walkerOS usage"), code: Li.array(zi).optional().describe("Optional code snippets") });
1828
+ $i = Li.record(Li.string(), Ni).describe("Keyed hints for AI consumption \u2014 lightweight context beyond schemas and examples");
1829
1829
  Wi = 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).") });
1830
1830
  Ai = /\$store\.([a-zA-Z_][a-zA-Z0-9_]*)/g;
1831
1831
  Bi = /\$env\.([A-Za-z_]\w*)(=[^"}\s]*)?/g;
1832
1832
  Ui = /\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?/g;
1833
1833
  Hi = /\$(var|store|flow|secret):([a-zA-Z_][a-zA-Z0-9_]*)/g;
1834
- rn = { source: Ot.configJsonSchema, destination: Me2.configJsonSchema };
1834
+ rn = { source: Ot.configJsonSchema, destination: Re2.configJsonSchema };
1835
1835
  }
1836
1836
  });
1837
1837
 
@@ -5155,7 +5155,7 @@ function ee(e3, n4 = {}) {
5155
5155
  }
5156
5156
  async function ne(e3, n4, t3) {
5157
5157
  if (n4.init && !n4.config.init) {
5158
- const o2 = n4.type || "unknown", s5 = e3.logger.scope(`transformer:${o2}`), r3 = { collector: e3, logger: s5, id: t3, ingest: $(t3), config: n4.config, env: se2(n4.config.env) };
5158
+ const o2 = n4.type || "unknown", s5 = e3.logger.scope(`transformer:${o2}`), r3 = { collector: e3, logger: s5, id: t3, ingest: $(t3), config: n4.config, env: re2(n4.config.env) };
5159
5159
  s5.debug("init");
5160
5160
  const i2 = await Je(n4.init, "TransformerInit", e3.hooks, e3.logger)(r3);
5161
5161
  if (false === i2) return false;
@@ -5164,12 +5164,15 @@ async function ne(e3, n4, t3) {
5164
5164
  return true;
5165
5165
  }
5166
5166
  async function te2(e3, n4, t3, o2, s5, r3) {
5167
- const i2 = n4.type || "unknown", a3 = e3.logger.scope(`transformer:${i2}`), c3 = { collector: e3, logger: a3, id: t3, ingest: s5, config: n4.config, env: { ...se2(n4.config.env), ...r3 ? { respond: r3 } : {} } };
5167
+ const i2 = n4.type || "unknown", a3 = e3.logger.scope(`transformer:${i2}`), c3 = { collector: e3, logger: a3, id: t3, ingest: s5, config: n4.config, env: { ...re2(n4.config.env), ...r3 ? { respond: r3 } : {} } };
5168
5168
  a3.debug("push", { event: o2.name });
5169
5169
  const u3 = await Je(n4.push, "TransformerPush", e3.hooks, e3.logger)(o2, c3);
5170
5170
  return a3.debug("push done"), u3;
5171
5171
  }
5172
- async function oe2(e3, n4, t3, o2, s5, r3, i2) {
5172
+ function oe2(e3, n4) {
5173
+ if (e3) return "string" == typeof e3 || Array.isArray(e3) && !mt(e3) ? e3 : yt(gt(e3), n4) ?? void 0;
5174
+ }
5175
+ async function se2(e3, n4, t3, o2, s5, r3, i2) {
5173
5176
  i2 && s5?._meta && (s5._meta.chainPath = i2);
5174
5177
  let a3 = o2, c3 = r3;
5175
5178
  for (const o3 of t3) {
@@ -5203,9 +5206,9 @@ async function oe2(e3, n4, t3, o2, s5, r3, i2) {
5203
5206
  }
5204
5207
  const g2 = r4.config.before;
5205
5208
  if (g2) {
5206
- const t4 = ee("string" == typeof g2 || Array.isArray(g2) && !mt(g2) ? g2 : yt(gt(g2), bt(s5, a3)) || void 0, Y2(n4));
5209
+ const t4 = ee(oe2(g2, bt(s5, a3)), Y2(n4));
5207
5210
  if (t4.length > 0) {
5208
- const o4 = await oe2(e3, n4, t4, a3, s5, c3, i2);
5211
+ const o4 = await se2(e3, n4, t4, a3, s5, c3, i2);
5209
5212
  if (null === o4.event) return { event: null, respond: o4.respond ?? c3 };
5210
5213
  o4.respond && (c3 = o4.respond), a3 = Array.isArray(o4.event) ? o4.event[0] : o4.event;
5211
5214
  }
@@ -5216,18 +5219,14 @@ async function oe2(e3, n4, t3, o2, s5, r3, i2) {
5216
5219
  const r5 = t3.slice(t3.indexOf(o3) + 1), u4 = await Promise.all(m2.map(async (t4) => {
5217
5220
  const o4 = t4.event || a3, u5 = s5 ? { ...s5, _meta: { ...s5._meta, path: [...s5._meta.path] } } : $("unknown");
5218
5221
  if (t4.next) {
5219
- let s6 = t4.next;
5220
- if (mt(t4.next)) {
5221
- const e4 = gt(t4.next);
5222
- s6 = yt(e4, bt(u5, o4));
5223
- }
5222
+ const s6 = oe2(t4.next, bt(u5, o4));
5224
5223
  if (s6) {
5225
5224
  const t5 = ee(s6, Y2(n4));
5226
- if (t5.length > 0) return oe2(e3, n4, t5, o4, u5, c3, i2);
5225
+ if (t5.length > 0) return se2(e3, n4, t5, o4, u5, c3, i2);
5227
5226
  }
5228
5227
  return { event: o4, respond: c3 };
5229
5228
  }
5230
- return r5.length > 0 ? oe2(e3, n4, r5, o4, u5, c3, i2) : { event: o4, respond: c3 };
5229
+ return r5.length > 0 ? se2(e3, n4, r5, o4, u5, c3, i2) : { event: o4, respond: c3 };
5231
5230
  }));
5232
5231
  let f3 = c3;
5233
5232
  const l3 = [];
@@ -5241,16 +5240,13 @@ async function oe2(e3, n4, t3, o2, s5, r3, i2) {
5241
5240
  if (m2 && "object" == typeof m2) {
5242
5241
  const { event: t4, respond: o4, next: r5 } = m2;
5243
5242
  if (o4 && (c3 = o4), r5) {
5244
- let o5 = r5;
5245
- if (mt(r5)) {
5246
- const e4 = gt(r5);
5247
- if (o5 = yt(e4, bt(s5, a3)), !o5) {
5248
- t4 && (a3 = t4);
5249
- continue;
5250
- }
5243
+ const o5 = oe2(r5, bt(s5, a3));
5244
+ if (!o5) {
5245
+ t4 && (a3 = t4);
5246
+ continue;
5251
5247
  }
5252
5248
  const u4 = ee(o5, Y2(n4));
5253
- return u4.length > 0 ? oe2(e3, n4, u4, t4 || a3, s5, c3, i2) : (e3.logger.warn(`Branch target not found: ${JSON.stringify(r5)}`), { event: null, respond: c3 });
5249
+ return u4.length > 0 ? se2(e3, n4, u4, t4 || a3, s5, c3, i2) : (e3.logger.warn(`Branch target not found: ${JSON.stringify(r5)}`), { event: null, respond: c3 });
5254
5250
  }
5255
5251
  t4 && (a3 = t4);
5256
5252
  }
@@ -5258,33 +5254,33 @@ async function oe2(e3, n4, t3, o2, s5, r3, i2) {
5258
5254
  const t4 = r4.config.next, o4 = gt(t4), u4 = yt(o4, bt(s5, a3));
5259
5255
  if (u4) {
5260
5256
  const t5 = ee(u4, Y2(n4));
5261
- if (t5.length > 0) return oe2(e3, n4, t5, a3, s5, c3, i2);
5257
+ if (t5.length > 0) return se2(e3, n4, t5, a3, s5, c3, i2);
5262
5258
  }
5263
5259
  return { event: a3, respond: c3 };
5264
5260
  }
5265
5261
  }
5266
5262
  return { event: a3, respond: c3 };
5267
5263
  }
5268
- function se2(e3) {
5264
+ function re2(e3) {
5269
5265
  return e3 && ie(e3) ? e3 : {};
5270
5266
  }
5271
- async function re2(e3, n4) {
5267
+ async function ie2(e3, n4) {
5272
5268
  if (!n4.on || !n4.queueOn?.length) return;
5273
5269
  const t3 = n4.queueOn;
5274
5270
  n4.queueOn = [];
5275
5271
  for (const { type: e4, data: o2 } of t3) await Me(n4.on)(e4, o2);
5276
5272
  }
5277
- function ie2(e3) {
5273
+ function ae2(e3) {
5278
5274
  return Boolean(e3.config.init) && !e3.config.require?.length;
5279
5275
  }
5280
- async function ae2(e3, n4, t3) {
5276
+ async function ce2(e3, n4, t3) {
5281
5277
  const { code: o2, config: s5 = {}, env: r3 = {}, primary: i2, next: a3, before: c3, cache: u3 } = t3;
5282
5278
  let f2, l2 = $(n4);
5283
5279
  const d2 = u3 ? vt({ ...u3, full: u3.full ?? true }) : void 0, g2 = gt(a3), m2 = !(Array.isArray(a3) && mt(a3)) && g2 ? ee(yt(g2), Y2(e3.transformers)) : void 0, p2 = gt(c3), h2 = !(Array.isArray(c3) && mt(c3)) && p2 ? ee(yt(p2), Y2(e3.transformers)) : void 0, y2 = e3.logger.scope("source").scope(n4), b2 = { push: async (t4, o3 = {}) => {
5284
5280
  let r4, i3 = t4;
5285
5281
  const a4 = h2 ?? (p2 ? ee(yt(p2, bt(l2)), Y2(e3.transformers)) : []);
5286
5282
  if (a4.length > 0 && e3.transformers && Object.keys(e3.transformers).length > 0) {
5287
- const t5 = await oe2(e3, e3.transformers, a4, i3, l2, f2, `source.${n4}.before`);
5283
+ const t5 = await se2(e3, e3.transformers, a4, i3, l2, f2, `source.${n4}.before`);
5288
5284
  if (null === t5.event) return { ok: true };
5289
5285
  t5.respond && (f2 = t5.respond), i3 = Array.isArray(t5.event) ? t5.event[0] : t5.event;
5290
5286
  }
@@ -5323,10 +5319,10 @@ async function ae2(e3, n4, t3) {
5323
5319
  const k2 = w2.type || "unknown", C3 = e3.logger.scope(k2).scope(n4);
5324
5320
  return b2.logger = C3, i2 && (w2.config = { ...w2.config, primary: i2 }), w2;
5325
5321
  }
5326
- async function ce2(e3, n4 = {}) {
5322
+ async function ue2(e3, n4 = {}) {
5327
5323
  const t3 = {};
5328
5324
  for (const [o2, s5] of Object.entries(n4)) {
5329
- const n5 = await ae2(e3, o2, s5);
5325
+ const n5 = await ce2(e3, o2, s5);
5330
5326
  if (!n5) continue;
5331
5327
  const r3 = s5.config?.require;
5332
5328
  n5.config = { ...n5.config, init: false, ...r3 ? { require: [...r3] } : {} }, t3[o2] = n5;
@@ -5334,25 +5330,25 @@ async function ce2(e3, n4 = {}) {
5334
5330
  Object.assign(e3.sources, t3);
5335
5331
  for (const n5 of Object.keys(t3)) {
5336
5332
  const t4 = e3.sources[n5];
5337
- t4.init && await Me(t4.init.bind(t4))(), t4.config.init = true, ie2(t4) && await re2(0, t4);
5333
+ t4.init && await Me(t4.init.bind(t4))(), t4.config.init = true, ae2(t4) && await ie2(0, t4);
5338
5334
  }
5339
5335
  return t3;
5340
5336
  }
5341
- function ue2(e3, n4) {
5337
+ function fe2(e3, n4) {
5342
5338
  return { collector: e3, logger: e3.logger.scope("on").scope(String(n4)) };
5343
5339
  }
5344
- async function fe2(e3, n4, t3) {
5340
+ async function le2(e3, n4, t3) {
5345
5341
  const o2 = e3.on, s5 = o2[n4] || [], r3 = Q(t3) ? t3 : [t3];
5346
5342
  r3.forEach((e4) => {
5347
5343
  s5.push(e4);
5348
- }), o2[n4] = s5, de(e3, n4, r3);
5344
+ }), o2[n4] = s5, ge(e3, n4, r3);
5349
5345
  }
5350
- function le2(e3, n4, t3, o2, s5) {
5346
+ function de(e3, n4, t3, o2, s5) {
5351
5347
  if (!n4.on) return;
5352
- const r3 = n4.type || "unknown", i2 = e3.logger.scope(r3).scope("on").scope(o2), a3 = { collector: e3, logger: i2, id: t3, config: n4.config, data: s5, env: Ce(n4.env, n4.config.env) };
5348
+ const r3 = n4.type || "unknown", i2 = e3.logger.scope(r3).scope("on").scope(o2), a3 = { collector: e3, logger: i2, id: t3, config: n4.config, data: s5, env: Oe2(n4.env, n4.config.env) };
5353
5349
  Pe(n4.on)(o2, a3);
5354
5350
  }
5355
- function de(e3, n4, o2, s5) {
5351
+ function ge(e3, n4, o2, s5) {
5356
5352
  let r3;
5357
5353
  switch (n4) {
5358
5354
  case t.Commands.Consent:
@@ -5381,7 +5377,7 @@ function de(e3, n4, o2, s5) {
5381
5377
  if (o2.length) switch (n4) {
5382
5378
  case t.Commands.Consent:
5383
5379
  !(function(e4, n5, o3) {
5384
- const s6 = o3 || e4.consent, r4 = ue2(e4, t.Commands.Consent);
5380
+ const s6 = o3 || e4.consent, r4 = fe2(e4, t.Commands.Consent);
5385
5381
  n5.forEach((e5) => {
5386
5382
  Object.keys(s6).filter((n6) => n6 in e5).forEach((n6) => {
5387
5383
  Pe(e5[n6])(s6, r4);
@@ -5392,7 +5388,7 @@ function de(e3, n4, o2, s5) {
5392
5388
  case t.Commands.Ready:
5393
5389
  !(function(e4, n5) {
5394
5390
  if (!e4.allowed) return;
5395
- const o3 = ue2(e4, t.Commands.Ready);
5391
+ const o3 = fe2(e4, t.Commands.Ready);
5396
5392
  n5.forEach((e5) => {
5397
5393
  Pe(e5)(void 0, o3);
5398
5394
  });
@@ -5401,7 +5397,7 @@ function de(e3, n4, o2, s5) {
5401
5397
  case t.Commands.Run:
5402
5398
  !(function(e4, n5) {
5403
5399
  if (!e4.allowed) return;
5404
- const o3 = ue2(e4, t.Commands.Run);
5400
+ const o3 = fe2(e4, t.Commands.Run);
5405
5401
  n5.forEach((e5) => {
5406
5402
  Pe(e5)(void 0, o3);
5407
5403
  });
@@ -5410,14 +5406,14 @@ function de(e3, n4, o2, s5) {
5410
5406
  case t.Commands.Session:
5411
5407
  !(function(e4, n5) {
5412
5408
  if (!e4.session) return;
5413
- const o3 = ue2(e4, t.Commands.Session);
5409
+ const o3 = fe2(e4, t.Commands.Session);
5414
5410
  n5.forEach((n6) => {
5415
5411
  Pe(n6)(e4.session, o3);
5416
5412
  });
5417
5413
  })(e3, o2);
5418
5414
  break;
5419
5415
  default: {
5420
- const t3 = ue2(e3, n4);
5416
+ const t3 = fe2(e3, n4);
5421
5417
  o2.forEach((e4) => {
5422
5418
  "function" == typeof e4 && Pe(e4)(r3, t3);
5423
5419
  });
@@ -5425,7 +5421,7 @@ function de(e3, n4, o2, s5) {
5425
5421
  }
5426
5422
  }
5427
5423
  }
5428
- async function ge(e3, n4, o2, s5) {
5424
+ async function me2(e3, n4, o2, s5) {
5429
5425
  let r3, i2 = o2 || [];
5430
5426
  switch (o2 || (i2 = e3.on[n4] || []), n4) {
5431
5427
  case t.Commands.Consent:
@@ -5457,17 +5453,17 @@ async function ge(e3, n4, o2, s5) {
5457
5453
  const e4 = t3.config.require.indexOf(n4);
5458
5454
  -1 !== e4 && t3.config.require.splice(e4, 1);
5459
5455
  }
5460
- if (t3.on) if (ie2(t3)) {
5456
+ if (t3.on) if (ae2(t3)) {
5461
5457
  false === await Me(t3.on)(n4, r3) && (a3 = true);
5462
5458
  } else t3.queueOn = t3.queueOn || [], t3.queueOn.push({ type: n4, data: r3 });
5463
5459
  }
5464
5460
  Object.entries(e3.destinations).forEach(([t3, o3]) => {
5465
5461
  if (o3.on) {
5466
5462
  if (!o3.config.init) return o3.queueOn = o3.queueOn || [], void o3.queueOn.push({ type: n4, data: r3 });
5467
- le2(e3, o3, t3, n4, r3);
5463
+ de(e3, o3, t3, n4, r3);
5468
5464
  }
5469
5465
  });
5470
- for (const n5 of Object.values(e3.sources)) ie2(n5) && n5.queueOn?.length && await re2(0, n5);
5466
+ for (const n5 of Object.values(e3.sources)) ae2(n5) && n5.queueOn?.length && await ie2(0, n5);
5471
5467
  return Object.keys(e3.pending.destinations).length > 0 && await (async function(e4, n5) {
5472
5468
  for (const [t3, o3] of Object.entries(e4.pending.destinations)) {
5473
5469
  if (!e4.pending.destinations[t3] || e4.destinations[t3]) continue;
@@ -5477,131 +5473,131 @@ async function ge(e3, n4, o2, s5) {
5477
5473
  if (-1 === r4) continue;
5478
5474
  if (s6.splice(r4, 1), s6.length > 0) continue;
5479
5475
  delete e4.pending.destinations[t3];
5480
- const i3 = we2(o3);
5476
+ const i3 = ke2(o3);
5481
5477
  false !== i3.config.queue && (i3.queuePush = [...e4.queue]), e4.destinations[t3] = i3;
5482
5478
  }
5483
- })(e3, n4), de(e3, n4, i2, s5), !a3;
5479
+ })(e3, n4), ge(e3, n4, i2, s5), !a3;
5484
5480
  }
5485
- function me2(e3, n4, t3, o2) {
5481
+ function pe2(e3, n4, t3, o2) {
5486
5482
  if (!e3) return [];
5487
5483
  if (n4) {
5488
5484
  const e4 = yt(n4, bt(o2));
5489
- return e4 ? ee(e4, Y2(t3)) : [];
5485
+ return e4 ? ee(e4, t3) : [];
5490
5486
  }
5491
- return ee(e3, Y2(t3));
5487
+ return mt(e3) ? [] : ee(e3, t3);
5492
5488
  }
5493
- async function pe2(e3, n4, t3) {
5489
+ async function he2(e3, n4, t3) {
5494
5490
  const { code: o2, config: s5 = {}, env: r3 = {}, before: i2, next: a3, cache: c3 } = n4;
5495
- if (!re(o2.push)) return ve2({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
5491
+ if (!re(o2.push)) return we2({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
5496
5492
  const u3 = t3 || s5 || { init: false };
5497
5493
  let f2 = i2 ? { ...u3, before: i2 } : { ...u3 };
5498
5494
  a3 && (f2 = { ...f2, next: a3 }), c3 && (f2 = { ...f2, cache: c3 });
5499
- const l2 = { ...o2, config: f2, env: Ce(o2.env, r3) };
5495
+ const l2 = { ...o2, config: f2, env: Oe2(o2.env, r3) };
5500
5496
  let d2 = l2.config.id;
5501
5497
  if (!d2) do {
5502
5498
  d2 = we(5, "abcdefghijklmnopqrstuvwxyz");
5503
5499
  } while (e3.destinations[d2]);
5504
- return e3.destinations[d2] = l2, false !== l2.config.queue && (l2.queuePush = [...e3.queue]), he2(e3, void 0, {}, { [d2]: l2 });
5500
+ return e3.destinations[d2] = l2, false !== l2.config.queue && (l2.queuePush = [...e3.queue]), ye(e3, void 0, {}, { [d2]: l2 });
5505
5501
  }
5506
- async function he2(e3, n4, t3 = {}, o2) {
5502
+ async function ye(e3, n4, t3 = {}, o2) {
5507
5503
  const { allowed: s5, consent: r3, globals: i2, user: p2 } = e3;
5508
- if (!s5) return ve2({ ok: false });
5504
+ if (!s5) return we2({ ok: false });
5509
5505
  n4 && (e3.queue.push(n4), e3.status.in++), o2 || (o2 = e3.destinations);
5510
- const h2 = await Promise.all(Object.entries(o2 || {}).map(async ([o3, s6]) => {
5506
+ const h2 = e3.transformers ? Y2(e3.transformers) : {}, b2 = await Promise.all(Object.entries(o2 || {}).map(async ([o3, s6]) => {
5511
5507
  if (s6.config.disabled) return { id: o3, destination: s6, skipped: true };
5512
- let h3 = (s6.queuePush || []).map((e4) => ({ ...e4, consent: r3 }));
5513
- s6.queuePush = [], n4 && h3.push(ce(n4));
5514
- const b3 = t3.ingest ? { ...t3.ingest, _meta: { ...t3.ingest._meta, path: [...t3.ingest._meta.path] } } : $("unknown");
5515
- if (!h3.length && !s6.queueOn?.length) return { id: o3, destination: s6, skipped: true };
5516
- if (!h3.length && s6.queueOn?.length) {
5508
+ let b3 = (s6.queuePush || []).map((e4) => ({ ...e4, consent: r3 }));
5509
+ s6.queuePush = [], n4 && b3.push(ce(n4));
5510
+ const v3 = t3.ingest ? { ...t3.ingest, _meta: { ...t3.ingest._meta, path: [...t3.ingest._meta.path] } } : $("unknown");
5511
+ if (!b3.length && !s6.queueOn?.length) return { id: o3, destination: s6, skipped: true };
5512
+ if (!b3.length && s6.queueOn?.length) {
5517
5513
  let n5 = false;
5518
5514
  try {
5519
- n5 = await ye(e3, s6, o3);
5515
+ n5 = await be2(e3, s6, o3);
5520
5516
  } catch (n6) {
5521
5517
  const t4 = s6.type || "unknown";
5522
5518
  e3.logger.scope(t4).error("Destination init threw", { error: n6 instanceof Error ? n6.message : String(n6) });
5523
5519
  }
5524
5520
  return { id: o3, destination: s6, skipped: !n5 };
5525
5521
  }
5526
- const v3 = [], w3 = h3.filter((e4) => {
5522
+ const w3 = [], C4 = b3.filter((e4) => {
5527
5523
  const n5 = me(s6.config.consent, r3, e4.consent);
5528
- return !n5 || (e4.consent = n5, v3.push(e4), false);
5524
+ return !n5 || (e4.consent = n5, w3.push(e4), false);
5529
5525
  });
5530
- if (s6.queuePush.push(...w3), !v3.length) return { id: o3, destination: s6, queue: h3 };
5531
- let C3, O3, q3 = false;
5526
+ if (s6.queuePush.push(...C4), !w3.length) return { id: o3, destination: s6, queue: b3 };
5527
+ let O3, q3, A3 = false;
5532
5528
  try {
5533
- q3 = await ye(e3, s6, o3);
5529
+ A3 = await be2(e3, s6, o3);
5534
5530
  } catch (n5) {
5535
5531
  const t4 = s6.type || "unknown";
5536
5532
  e3.logger.scope(t4).error("Destination init threw", { error: n5 instanceof Error ? n5.message : String(n5) });
5537
5533
  }
5538
- if (!q3) return { id: o3, destination: s6, queue: h3 };
5534
+ if (!A3) return { id: o3, destination: s6, queue: b3 };
5539
5535
  s6.dlq || (s6.dlq = []);
5540
- const x2 = s6.config.before, A3 = me2(x2, x2 && mt(x2) ? gt(x2) : void 0, e3.transformers, b3), S3 = s6.config.next, D3 = S3 && mt(S3) ? gt(S3) : void 0, $3 = s6.config?.cache, E3 = $3 ? vt($3) : void 0, _3 = E3 ? X2(E3, e3) : void 0;
5541
- let I2 = 0;
5542
- return await Promise.all(v3.map(async (n5) => {
5536
+ const x2 = s6.config.before, S3 = pe2(x2, x2 && mt(x2) ? gt(x2) : void 0, h2, v3), D3 = s6.config.next, $3 = D3 && mt(D3) ? gt(D3) : void 0, E3 = s6.config?.cache, _3 = E3 ? vt(E3) : void 0, I2 = _3 ? X2(_3, e3) : void 0;
5537
+ let P3 = 0;
5538
+ return await Promise.all(w3.map(async (n5) => {
5543
5539
  let r4;
5544
- if (n5.globals = X(i2, n5.globals), n5.user = X(p2, n5.user), E3?.full && _3) {
5545
- const e4 = bt(b3, n5), t4 = ht(E3, _3, e4, `d:${o3}`);
5540
+ if (n5.globals = X(i2, n5.globals), n5.user = X(p2, n5.user), _3?.full && I2) {
5541
+ const e4 = bt(v3, n5), t4 = ht(_3, I2, e4, `d:${o3}`);
5546
5542
  if ("HIT" === t4?.status) return n5;
5547
5543
  "MISS" === t4?.status && (r4 = { key: t4.key, ttl: t4.rule.ttl });
5548
5544
  }
5549
5545
  let u3 = n5, f2 = t3.respond;
5550
- if (A3.length > 0 && e3.transformers && Object.keys(e3.transformers).length > 0) {
5551
- const s7 = await oe2(e3, e3.transformers, A3, n5, b3, t3.respond, `destination.${o3}.before`);
5546
+ if (S3.length > 0 && e3.transformers && Object.keys(e3.transformers).length > 0) {
5547
+ const s7 = await se2(e3, e3.transformers, S3, n5, v3, t3.respond, `destination.${o3}.before`);
5552
5548
  if (null === s7.event) return n5;
5553
5549
  s7.respond && (f2 = s7.respond), u3 = Array.isArray(s7.event) ? s7.event[0] : s7.event;
5554
5550
  }
5555
- if (E3 && !E3.full && _3) {
5556
- const e4 = bt(b3, u3), t4 = ht(E3, _3, e4, `d:${o3}`);
5551
+ if (_3 && !_3.full && I2) {
5552
+ const e4 = bt(v3, u3), t4 = ht(_3, I2, e4, `d:${o3}`);
5557
5553
  if ("HIT" === t4?.status) return n5;
5558
5554
  "MISS" === t4?.status && (r4 = { key: t4.key, ttl: t4.rule.ttl });
5559
5555
  }
5560
5556
  const g2 = Date.now();
5561
5557
  let m2 = false;
5562
- const h4 = await Me(be2, (n6) => {
5558
+ const y2 = await Me(ve2, (n6) => {
5563
5559
  const t4 = s6.type || "unknown";
5564
- e3.logger.scope(t4).error("Push failed", { error: n6, event: u3.name }), C3 = n6, m2 = true, s6.dlq.push([u3, n6]);
5565
- })(e3, s6, o3, u3, b3, f2);
5566
- if (I2 += Date.now() - g2, r4 && _3 && void 0 === s6.config.mock && wt(_3, r4.key, h4 ?? true, r4.ttl), void 0 !== h4 && (O3 = h4), !m2 && S3) {
5567
- void 0 !== h4 && (b3._response = h4);
5568
- const n6 = me2(S3, D3, e3.transformers, b3);
5560
+ e3.logger.scope(t4).error("Push failed", { error: n6, event: u3.name }), O3 = n6, m2 = true, s6.dlq.push([u3, n6]);
5561
+ })(e3, s6, o3, u3, v3, f2);
5562
+ if (P3 += Date.now() - g2, r4 && I2 && void 0 === s6.config.mock && wt(I2, r4.key, y2 ?? true, r4.ttl), void 0 !== y2 && (q3 = y2), !m2 && D3) {
5563
+ void 0 !== y2 && (v3._response = y2);
5564
+ const n6 = pe2(D3, $3, h2, v3);
5569
5565
  if (n6.length > 0 && e3.transformers && Object.keys(e3.transformers).length > 0) {
5570
- const t4 = await oe2(e3, e3.transformers, n6, u3, b3, f2, `destination.${o3}.next`);
5566
+ const t4 = await se2(e3, e3.transformers, n6, u3, v3, f2, `destination.${o3}.next`);
5571
5567
  t4.respond && (f2 = t4.respond);
5572
5568
  }
5573
5569
  }
5574
5570
  return n5;
5575
- })), { id: o3, destination: s6, error: C3, response: O3, totalDuration: I2 };
5576
- })), b2 = {}, v2 = {}, w2 = {};
5577
- for (const n5 of h2) {
5571
+ })), { id: o3, destination: s6, error: O3, response: q3, totalDuration: P3 };
5572
+ })), v2 = {}, w2 = {}, C3 = {};
5573
+ for (const n5 of b2) {
5578
5574
  if (n5.skipped) continue;
5579
5575
  const t4 = { type: n5.destination.type || "unknown", data: n5.response };
5580
5576
  e3.status.destinations[n5.id] || (e3.status.destinations[n5.id] = { count: 0, failed: 0, duration: 0 });
5581
5577
  const o3 = e3.status.destinations[n5.id], s6 = Date.now();
5582
- n5.error ? (t4.error = n5.error, w2[n5.id] = t4, o3.failed++, o3.lastAt = s6, o3.duration += n5.totalDuration || 0, e3.status.failed++) : n5.queue && n5.queue.length ? v2[n5.id] = t4 : (b2[n5.id] = t4, o3.count++, o3.lastAt = s6, o3.duration += n5.totalDuration || 0, e3.status.out++);
5578
+ n5.error ? (t4.error = n5.error, C3[n5.id] = t4, o3.failed++, o3.lastAt = s6, o3.duration += n5.totalDuration || 0, e3.status.failed++) : n5.queue && n5.queue.length ? w2[n5.id] = t4 : (v2[n5.id] = t4, o3.count++, o3.lastAt = s6, o3.duration += n5.totalDuration || 0, e3.status.out++);
5583
5579
  }
5584
- return ve2({ event: n4, ...Object.keys(b2).length && { done: b2 }, ...Object.keys(v2).length && { queued: v2 }, ...Object.keys(w2).length && { failed: w2 } });
5580
+ return we2({ event: n4, ...Object.keys(v2).length && { done: v2 }, ...Object.keys(w2).length && { queued: w2 }, ...Object.keys(C3).length && { failed: C3 } });
5585
5581
  }
5586
- async function ye(e3, n4, t3) {
5582
+ async function be2(e3, n4, t3) {
5587
5583
  if (n4.init && !n4.config.init) {
5588
- const o2 = n4.type || "unknown", s5 = e3.logger.scope(o2), r3 = { collector: e3, logger: s5, id: t3, config: n4.config, env: Ce(n4.env, n4.config.env) };
5584
+ const o2 = n4.type || "unknown", s5 = e3.logger.scope(o2), r3 = { collector: e3, logger: s5, id: t3, config: n4.config, env: Oe2(n4.env, n4.config.env) };
5589
5585
  s5.debug("init");
5590
5586
  const i2 = await Je(n4.init, "DestinationInit", e3.hooks, e3.logger)(r3);
5591
5587
  if (false === i2) return i2;
5592
5588
  if (n4.config = { ...i2 || n4.config, init: true }, n4.queueOn?.length) {
5593
5589
  const o3 = n4.queueOn;
5594
5590
  n4.queueOn = [];
5595
- for (const { type: s6, data: r4 } of o3) le2(e3, n4, t3, s6, r4);
5591
+ for (const { type: s6, data: r4 } of o3) de(e3, n4, t3, s6, r4);
5596
5592
  }
5597
5593
  s5.debug("init done");
5598
5594
  }
5599
5595
  return true;
5600
5596
  }
5601
- async function be2(e3, n4, t3, o2, s5, r3) {
5597
+ async function ve2(e3, n4, t3, o2, s5, r3) {
5602
5598
  const { config: i2 } = n4, a3 = await Ze(o2, i2, e3);
5603
5599
  if (a3.ignore) return false;
5604
- const c3 = n4.type || "unknown", u3 = e3.logger.scope(c3), f2 = { collector: e3, logger: u3, id: t3, config: i2, data: a3.data, rule: a3.mapping, ingest: s5, env: { ...Ce(n4.env, i2.env), ...r3 ? { respond: r3 } : {} } };
5600
+ const c3 = n4.type || "unknown", u3 = e3.logger.scope(c3), f2 = { collector: e3, logger: u3, id: t3, config: i2, data: a3.data, rule: a3.mapping, ingest: s5, env: { ...Oe2(n4.env, i2.env), ...r3 ? { respond: r3 } : {} } };
5605
5601
  if (void 0 !== i2.mock) return u3.debug("mock", { event: a3.event.name }), i2.mock;
5606
5602
  const l2 = a3.mapping, d2 = a3.mappingKey || "* *";
5607
5603
  if (!l2?.batch || !n4.pushBatch || void 0 !== i2.mock) {
@@ -5613,7 +5609,7 @@ async function be2(e3, n4, t3, o2, s5, r3) {
5613
5609
  if (n4.batches = n4.batches || {}, !n4.batches[d2]) {
5614
5610
  const o4 = { key: d2, events: [], data: [] };
5615
5611
  n4.batches[d2] = { batched: o4, batchFn: ke(() => {
5616
- const o5 = n4.batches[d2].batched, a4 = { collector: e3, logger: u3, id: t3, config: i2, data: void 0, rule: l2, ingest: s5, env: { ...Ce(n4.env, i2.env), ...r3 ? { respond: r3 } : {} } };
5612
+ const o5 = n4.batches[d2].batched, a4 = { collector: e3, logger: u3, id: t3, config: i2, data: void 0, rule: l2, ingest: s5, env: { ...Oe2(n4.env, i2.env), ...r3 ? { respond: r3 } : {} } };
5617
5613
  u3.debug("push batch", { events: o5.events.length }), Je(n4.pushBatch, "DestinationPushBatch", e3.hooks, e3.logger)(o5, a4), u3.debug("push batch done"), o5.events = [], o5.data = [];
5618
5614
  }, l2.batch) };
5619
5615
  }
@@ -5622,24 +5618,24 @@ async function be2(e3, n4, t3, o2, s5, r3) {
5622
5618
  }
5623
5619
  return true;
5624
5620
  }
5625
- function ve2(e3) {
5621
+ function we2(e3) {
5626
5622
  return { ok: !e3?.failed, ...e3 };
5627
5623
  }
5628
- function we2(e3) {
5624
+ function ke2(e3) {
5629
5625
  const { code: n4, config: t3 = {}, env: o2 = {}, cache: s5 } = e3, { config: r3 } = Z(e3, "before"), { config: i2 } = Z({ ...e3, config: r3 }, "next"), a3 = { ...n4.config, ...t3, ...i2 };
5630
5626
  s5 && (a3.cache = s5);
5631
- const c3 = Ce(n4.env, o2);
5627
+ const c3 = Oe2(n4.env, o2);
5632
5628
  return { ...n4, config: a3, env: c3 };
5633
5629
  }
5634
- async function ke2(e3, n4 = {}) {
5630
+ async function Ce(e3, n4 = {}) {
5635
5631
  const t3 = {};
5636
- for (const [o2, s5] of Object.entries(n4)) s5.config?.require?.length ? e3.pending.destinations[o2] = s5 : t3[o2] = we2(s5);
5632
+ for (const [o2, s5] of Object.entries(n4)) s5.config?.require?.length ? e3.pending.destinations[o2] = s5 : t3[o2] = ke2(s5);
5637
5633
  return t3;
5638
5634
  }
5639
- function Ce(e3, n4) {
5635
+ function Oe2(e3, n4) {
5640
5636
  return e3 || n4 ? n4 ? e3 && ie(e3) && ie(n4) ? { ...e3, ...n4 } : n4 : e3 : {};
5641
5637
  }
5642
- async function Se2(e3, n4, t3) {
5638
+ async function De(e3, n4, t3) {
5643
5639
  const o2 = Object.entries(e3).map(async ([e4, o3]) => {
5644
5640
  const s5 = o3.destroy;
5645
5641
  if (!s5) return;
@@ -5652,7 +5648,7 @@ async function Se2(e3, n4, t3) {
5652
5648
  });
5653
5649
  await Promise.allSettled(o2);
5654
5650
  }
5655
- async function De(e3, n4, o2, r3) {
5651
+ async function $e(e3, n4, o2, r3) {
5656
5652
  let i2, a3, c3 = false;
5657
5653
  switch (n4) {
5658
5654
  case t.Commands.Config:
@@ -5668,19 +5664,19 @@ async function De(e3, n4, o2, r3) {
5668
5664
  ie(o2) && (e3.custom = X(e3.custom, o2), a3 = o2, c3 = true);
5669
5665
  break;
5670
5666
  case t.Commands.Destination:
5671
- ie(o2) && ("code" in o2 && ie(o2.code) ? i2 = await pe2(e3, o2, r3) : re(o2.push) && (i2 = await pe2(e3, { code: o2 }, r3)));
5667
+ ie(o2) && ("code" in o2 && ie(o2.code) ? i2 = await he2(e3, o2, r3) : re(o2.push) && (i2 = await he2(e3, { code: o2 }, r3)));
5672
5668
  break;
5673
5669
  case t.Commands.Globals:
5674
5670
  ie(o2) && (e3.globals = X(e3.globals, o2), a3 = o2, c3 = true);
5675
5671
  break;
5676
5672
  case t.Commands.On:
5677
- se(o2) && await fe2(e3, o2, r3);
5673
+ se(o2) && await le2(e3, o2, r3);
5678
5674
  break;
5679
5675
  case t.Commands.Ready:
5680
5676
  c3 = true;
5681
5677
  break;
5682
5678
  case t.Commands.Run:
5683
- i2 = await Ee2(e3, o2), c3 = true;
5679
+ i2 = await _e2(e3, o2), c3 = true;
5684
5680
  break;
5685
5681
  case t.Commands.Session:
5686
5682
  c3 = true;
@@ -5688,28 +5684,28 @@ async function De(e3, n4, o2, r3) {
5688
5684
  case t.Commands.Shutdown:
5689
5685
  await (async function(e4) {
5690
5686
  const n5 = e4.logger;
5691
- await Se2(e4.sources, "source", n5), await Se2(e4.destinations, "destination", n5), await Se2(e4.transformers, "transformer", n5), await Se2(e4.stores, "store", n5);
5687
+ await De(e4.sources, "source", n5), await De(e4.destinations, "destination", n5), await De(e4.transformers, "transformer", n5), await De(e4.stores, "store", n5);
5692
5688
  })(e3);
5693
5689
  break;
5694
5690
  case t.Commands.User:
5695
5691
  ie(o2) && (X(e3.user, o2, { shallow: false }), a3 = o2, c3 = true);
5696
5692
  }
5697
- return c3 && (await ge(e3, n4, void 0, a3), i2 = await he2(e3)), i2 || ve2({ ok: true });
5693
+ return c3 && (await me2(e3, n4, void 0, a3), i2 = await ye(e3)), i2 || we2({ ok: true });
5698
5694
  }
5699
- function $e(e3, n4) {
5695
+ function Ee2(e3, n4) {
5700
5696
  if (!n4.name) throw new Error("Event name is required");
5701
5697
  const [t3, o2] = n4.name.split(" ");
5702
5698
  if (!t3 || !o2) throw new Error("Event name is invalid");
5703
5699
  const { timestamp: s5 = Date.now(), name: r3 = `${t3} ${o2}`, data: i2 = {}, context: a3 = {}, globals: c3 = e3.globals, custom: u3 = {}, user: f2 = e3.user, nested: l2 = [], consent: d2 = e3.consent, id: g2 = be(), trigger: m2 = "", entity: p2 = t3, action: h2 = o2, timing: y2 = 0, source: b2 = { type: "collector", schema: "4" } } = n4;
5704
5700
  return { name: r3, data: i2, context: a3, globals: c3, custom: u3, user: f2, nested: l2, consent: d2, id: g2, trigger: m2, entity: p2, action: h2, timestamp: s5, timing: y2, source: b2 };
5705
5701
  }
5706
- async function Ee2(e3, n4) {
5702
+ async function _e2(e3, n4) {
5707
5703
  e3.allowed = true, e3.timing = Date.now(), n4 && (n4.consent && (e3.consent = X(e3.consent, n4.consent)), n4.user && (e3.user = X(e3.user, n4.user)), n4.globals && (e3.globals = X(e3.config.globalsStatic || {}, n4.globals)), n4.custom && (e3.custom = X(e3.custom, n4.custom))), Object.values(e3.destinations).forEach((e4) => {
5708
5704
  e4.queuePush = [];
5709
5705
  }), e3.queue = [], e3.round++;
5710
- return await he2(e3);
5706
+ return await ye(e3);
5711
5707
  }
5712
- function He(e3, n4) {
5708
+ function Te2(e3, n4) {
5713
5709
  return Je(async (t3, o2 = {}) => await Me(async () => {
5714
5710
  const s5 = Date.now(), { id: r3, ingest: i2, respond: a3, mapping: c3, preChain: u3, include: f2, exclude: l2 } = o2;
5715
5711
  let d2 = a3, g2 = t3;
@@ -5719,43 +5715,43 @@ function He(e3, n4) {
5719
5715
  })(e3.destinations, f2, l2) : void 0, p2 = i2 ?? $(r3 || "unknown");
5720
5716
  if (c3) {
5721
5717
  const n5 = await Ze(g2, c3, e3);
5722
- if (n5.ignore) return ve2({ ok: true });
5718
+ if (n5.ignore) return we2({ ok: true });
5723
5719
  if (c3.consent) {
5724
- if (!me(c3.consent, e3.consent, n5.event.consent)) return ve2({ ok: true });
5720
+ if (!me(c3.consent, e3.consent, n5.event.consent)) return we2({ ok: true });
5725
5721
  }
5726
5722
  g2 = n5.event;
5727
5723
  }
5728
5724
  if (u3?.length && e3.transformers && Object.keys(e3.transformers).length > 0) {
5729
- const t4 = await oe2(e3, e3.transformers, u3, g2, p2, d2, r3 ? `source.${r3}.next` : void 0);
5730
- if (null === t4.event) return ve2({ ok: true });
5725
+ const t4 = await se2(e3, e3.transformers, u3, g2, p2, d2, r3 ? `source.${r3}.next` : void 0);
5726
+ if (null === t4.event) return we2({ ok: true });
5731
5727
  if (t4.respond && (d2 = t4.respond), Array.isArray(t4.event)) {
5732
5728
  const o3 = await Promise.all(t4.event.map(async (t5) => {
5733
- const o4 = n4(t5), s6 = $e(e3, o4);
5734
- return he2(e3, s6, { id: r3, ingest: p2, respond: d2 }, m2);
5729
+ const o4 = n4(t5), s6 = Ee2(e3, o4);
5730
+ return ye(e3, s6, { id: r3, ingest: p2, respond: d2 }, m2);
5735
5731
  }));
5736
5732
  if (r3) {
5737
5733
  e3.status.sources[r3] || (e3.status.sources[r3] = { count: 0, duration: 0 });
5738
5734
  const n5 = e3.status.sources[r3];
5739
5735
  n5.count += t4.event.length, n5.lastAt = Date.now(), n5.duration += Date.now() - s5;
5740
5736
  }
5741
- return o3[0] ?? ve2({ ok: true });
5737
+ return o3[0] ?? we2({ ok: true });
5742
5738
  }
5743
5739
  g2 = t4.event;
5744
5740
  }
5745
- const h2 = n4(g2), y2 = $e(e3, h2), b2 = await he2(e3, y2, { id: r3, ingest: p2, respond: d2 }, m2);
5741
+ const h2 = n4(g2), y2 = Ee2(e3, h2), b2 = await ye(e3, y2, { id: r3, ingest: p2, respond: d2 }, m2);
5746
5742
  if (r3) {
5747
5743
  e3.status.sources[r3] || (e3.status.sources[r3] = { count: 0, duration: 0 });
5748
5744
  const n5 = e3.status.sources[r3];
5749
5745
  n5.count++, n5.lastAt = Date.now(), n5.duration += Date.now() - s5;
5750
5746
  }
5751
5747
  return b2;
5752
- }, () => ve2({ ok: false }))(), "Push", e3.hooks, e3.logger);
5748
+ }, () => we2({ ok: false }))(), "Push", e3.hooks, e3.logger);
5753
5749
  }
5754
- async function Ne2(e3) {
5750
+ async function Ue(e3) {
5755
5751
  const n4 = X({ globalsStatic: {}, sessionStatic: {}, run: true }, e3, { merge: false, extend: false }), t3 = { level: e3.logger?.level, handler: e3.logger?.handler }, o2 = _e(t3), s5 = { ...n4.globalsStatic, ...e3.globals }, a3 = { allowed: false, config: n4, consent: e3.consent || {}, custom: e3.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: s5, hooks: e3.hooks || {}, logger: o2, on: {}, queue: [], round: 0, session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {} }, timing: Date.now(), user: e3.user || {}, sources: {}, pending: { destinations: {} }, push: void 0, command: void 0 };
5756
- a3.push = He(a3, (e4) => ({ timing: Math.round((Date.now() - a3.timing) / 10) / 100, source: { type: "collector", schema: "4", version: "4.0.1" }, ...e4 })), a3.command = (function(e4, n5) {
5757
- return Je(async (t4, o3, s6) => await Me(async () => await n5(e4, t4, o3, s6), () => ve2({ ok: false }))(), "Command", e4.hooks, e4.logger);
5758
- })(a3, De);
5752
+ a3.push = Te2(a3, (e4) => ({ timing: Math.round((Date.now() - a3.timing) / 10) / 100, source: { type: "collector", schema: "4", version: "4.0.2" }, ...e4 })), a3.command = (function(e4, n5) {
5753
+ return Je(async (t4, o3, s6) => await Me(async () => await n5(e4, t4, o3, s6), () => we2({ ok: false }))(), "Command", e4.hooks, e4.logger);
5754
+ })(a3, $e);
5759
5755
  const c3 = e3.stores || {};
5760
5756
  if (a3.stores = await (async function(e4, n5 = {}) {
5761
5757
  const t4 = {};
@@ -5792,7 +5788,7 @@ async function Ne2(e3) {
5792
5788
  e4.delete(n5);
5793
5789
  } };
5794
5790
  }
5795
- return a3.destinations = await ke2(a3, e3.destinations || {}), a3.transformers = await (async function(e4, n5 = {}) {
5791
+ return a3.destinations = await Ce(a3, e3.destinations || {}), a3.transformers = await (async function(e4, n5 = {}) {
5796
5792
  const t4 = {};
5797
5793
  for (const [o3, s6] of Object.entries(n5)) {
5798
5794
  const { code: n6, env: r3 = {} } = s6, { config: i2 } = Z(s6, "before"), { config: a4 } = Z({ ...s6, config: i2 }, "next"), c4 = Object.keys(r3).length > 0 ? { ...a4, env: r3 } : a4, { cache: u3 } = s6, f2 = u3 ? { ...c4, cache: u3 } : c4, l2 = e4.logger.scope("transformer").scope(o3), d2 = { collector: e4, logger: l2, id: o3, ingest: $(o3), config: f2, env: r3 }, g2 = await n6(d2);
@@ -5801,9 +5797,9 @@ async function Ne2(e3) {
5801
5797
  return t4;
5802
5798
  })(a3, e3.transformers || {}), a3;
5803
5799
  }
5804
- async function Ue(e3) {
5800
+ async function Fe(e3) {
5805
5801
  e3 = e3 || {};
5806
- const n4 = await Ne2(e3), t3 = (o2 = n4, { type: "elb", config: {}, push: async (e4, n5, t4, s6, r4, i3) => {
5802
+ const n4 = await Ue(e3), t3 = (o2 = n4, { type: "elb", config: {}, push: async (e4, n5, t4, s6, r4, i3) => {
5807
5803
  if ("string" == typeof e4 && e4.startsWith("walker ")) {
5808
5804
  const s7 = e4.replace("walker ", "");
5809
5805
  return o2.command(s7, n5, t4);
@@ -5811,28 +5807,28 @@ async function Ue(e3) {
5811
5807
  let a4;
5812
5808
  if ("string" == typeof e4) a4 = { name: e4 }, n5 && "object" == typeof n5 && !Array.isArray(n5) && (a4.data = n5);
5813
5809
  else {
5814
- if (!e4 || "object" != typeof e4) return ve2({ ok: false });
5810
+ if (!e4 || "object" != typeof e4) return we2({ ok: false });
5815
5811
  a4 = e4, n5 && "object" == typeof n5 && !Array.isArray(n5) && (a4.data = { ...a4.data || {}, ...n5 });
5816
5812
  }
5817
5813
  return s6 && "object" == typeof s6 && (a4.context = s6), r4 && Array.isArray(r4) && (a4.nested = r4), i3 && "object" == typeof i3 && (a4.custom = i3), o2.push(a4);
5818
5814
  } });
5819
5815
  var o2;
5820
- n4.sources.elb = t3, await ce2(n4, e3.sources || {});
5816
+ n4.sources.elb = t3, await ue2(n4, e3.sources || {});
5821
5817
  const { consent: s5, user: r3, globals: i2, custom: a3 } = e3;
5822
5818
  s5 && await n4.command("consent", s5), r3 && await n4.command("user", r3), i2 && Object.assign(n4.globals, i2), a3 && Object.assign(n4.custom, a3), n4.config.run && await n4.command("run");
5823
5819
  let c3 = t3.push;
5824
5820
  const u3 = Object.values(n4.sources).filter((e4) => "elb" !== e4.type), f2 = u3.find((e4) => e4.config.primary);
5825
5821
  return f2 ? c3 = f2.push : u3.length > 0 && (c3 = u3[0].push), { collector: n4, elb: c3 };
5826
5822
  }
5827
- function Fe(e3) {
5823
+ function We(e3) {
5828
5824
  if (null === e3 || "object" != typeof e3) return e3;
5829
- if (Array.isArray(e3)) return e3.map(Fe);
5825
+ if (Array.isArray(e3)) return e3.map(We);
5830
5826
  const n4 = {};
5831
- for (const [t3, o2] of Object.entries(e3)) n4[t3] = "function" == typeof o2 ? o2 : Fe(o2);
5827
+ for (const [t3, o2] of Object.entries(e3)) n4[t3] = "function" == typeof o2 ? o2 : We(o2);
5832
5828
  return n4;
5833
5829
  }
5834
- function We(e3) {
5835
- const n4 = [], { simulation: t3, ...o2 } = e3, s5 = Fe(o2);
5830
+ function ze2(e3) {
5831
+ const n4 = [], { simulation: t3, ...o2 } = e3, s5 = We(o2);
5836
5832
  for (const e4 of t3) {
5837
5833
  const t4 = e4.startsWith("call:") ? e4.slice(5) : e4, o3 = t4.split(".");
5838
5834
  let r3 = s5;
@@ -6003,7 +5999,7 @@ async function createEmitter(opts) {
6003
5999
  }
6004
6000
  }
6005
6001
  };
6006
- const { elb } = await Ue(collectorConfig);
6002
+ const { elb } = await Fe(collectorConfig);
6007
6003
  elbFn = elb;
6008
6004
  return elbFn;
6009
6005
  }
@@ -6650,7 +6646,7 @@ function planSimulate(flags) {
6650
6646
  // src/commands/push/dispatch-simulate.ts
6651
6647
  function dispatchSimulate(flags) {
6652
6648
  const plan = planSimulate(flags);
6653
- return { route: plan.kind, ids: plan.ids };
6649
+ return { kind: plan.kind, ids: plan.ids };
6654
6650
  }
6655
6651
 
6656
6652
  // src/commands/push/run.ts
@@ -6673,7 +6669,7 @@ async function runPushCommand(options) {
6673
6669
  });
6674
6670
  }
6675
6671
  let result;
6676
- switch (plan.route) {
6672
+ switch (plan.kind) {
6677
6673
  case "none":
6678
6674
  result = await push(config, resolvedEvent, {
6679
6675
  flow: options.flow,
@@ -6768,10 +6764,7 @@ function resolveBeforeChain(before, transformers, ingest, event) {
6768
6764
  if (!resolved) return [];
6769
6765
  return ee(resolved, Y2(transformers));
6770
6766
  }
6771
- return ee(
6772
- next,
6773
- Y2(transformers)
6774
- );
6767
+ return ee(next, Y2(transformers));
6775
6768
  }
6776
6769
  async function pushCore(inputPath, event, options = {}) {
6777
6770
  const logger = createCLILogger({
@@ -7209,7 +7202,7 @@ async function simulateTransformer(configOrPath, event, options) {
7209
7202
  processedEvent
7210
7203
  );
7211
7204
  if (beforeChainIds.length > 0) {
7212
- const beforeResult = await oe2(
7205
+ const beforeResult = await se2(
7213
7206
  collector,
7214
7207
  collector.transformers,
7215
7208
  beforeChainIds,
@@ -7344,7 +7337,7 @@ async function simulateDestination(configOrPath, event, options) {
7344
7337
  ...devEnv.push,
7345
7338
  simulation: devEnv.simulation
7346
7339
  };
7347
- const { wrappedEnv, calls } = We(combined);
7340
+ const { wrappedEnv, calls } = ze2(combined);
7348
7341
  if (destConfig) destConfig.env = wrappedEnv;
7349
7342
  trackedCalls = calls;
7350
7343
  }
@@ -8876,11 +8869,23 @@ function validateFlow(input, options = {}) {
8876
8869
  details
8877
8870
  };
8878
8871
  }
8872
+ function flattenRouteTargets(spec) {
8873
+ if (!spec) return [];
8874
+ if (typeof spec === "string") return [spec];
8875
+ if (!Array.isArray(spec) || spec.length === 0) return [];
8876
+ if (typeof spec[0] === "string") {
8877
+ return spec.filter((s5) => typeof s5 === "string");
8878
+ }
8879
+ const routes = spec;
8880
+ return Array.from(
8881
+ new Set(routes.flatMap((r3) => flattenRouteTargets(r3.next)))
8882
+ );
8883
+ }
8879
8884
  function buildConnectionGraph(config) {
8880
8885
  const connections = [];
8881
8886
  for (const [name, source] of Object.entries(config.sources || {})) {
8882
8887
  if (!source.next || !source.examples) continue;
8883
- const nextNames = Array.isArray(source.next) ? source.next : [source.next];
8888
+ const nextNames = flattenRouteTargets(source.next);
8884
8889
  for (const nextName of nextNames) {
8885
8890
  const transformer = config.transformers?.[nextName];
8886
8891
  if (transformer?.examples) {
@@ -8897,7 +8902,7 @@ function buildConnectionGraph(config) {
8897
8902
  }
8898
8903
  for (const [name, transformer] of Object.entries(config.transformers || {})) {
8899
8904
  if (!transformer.next || !transformer.examples) continue;
8900
- const nextNames = Array.isArray(transformer.next) ? transformer.next : [transformer.next];
8905
+ const nextNames = flattenRouteTargets(transformer.next);
8901
8906
  for (const nextName of nextNames) {
8902
8907
  const nextTransformer = config.transformers?.[nextName];
8903
8908
  if (nextTransformer?.examples) {
@@ -8918,7 +8923,7 @@ function buildConnectionGraph(config) {
8918
8923
  }
8919
8924
  for (const [name, dest] of Object.entries(config.destinations || {})) {
8920
8925
  if (!dest.before || !dest.examples) continue;
8921
- const beforeNames = Array.isArray(dest.before) ? dest.before : [dest.before];
8926
+ const beforeNames = flattenRouteTargets(dest.before);
8922
8927
  for (const beforeName of beforeNames) {
8923
8928
  const transformer = config.transformers?.[beforeName];
8924
8929
  if (transformer?.examples) {
@@ -9063,7 +9068,7 @@ function validateMapping(input) {
9063
9068
  // src/commands/validate/validators/entry.ts
9064
9069
  init_dist();
9065
9070
  import Ajv from "ajv";
9066
- var CLIENT_HEADER = "walkeros-cli/4.0.1";
9071
+ var CLIENT_HEADER = "walkeros-cli/4.0.2";
9067
9072
  var SECTIONS = ["destinations", "sources", "transformers"];
9068
9073
  function resolveEntry(path19, flowConfig) {
9069
9074
  const flows = flowConfig.flows;