@walkeros/core 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.d.mts +4016 -0
- package/dist/dev.d.ts +4016 -0
- package/dist/dev.js +1 -0
- package/dist/dev.js.map +1 -0
- package/dist/dev.mjs +1 -0
- package/dist/dev.mjs.map +1 -0
- package/dist/index.d.mts +514 -16659
- package/dist/index.d.ts +514 -16659
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -3
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,n)=>{for(var i in n)e(t,i,{get:n[i],enumerable:!0})},n={},i={},o={},r={},a={},s={},c={},l={},d={},p={},u={},m={},g={},b={Utils:{Storage:{Local:"local",Session:"session",Cookie:"cookie"}}};import{z as f}from"zod";var h=f.string(),y=f.number(),S=f.boolean(),v=f.string().min(1),j=f.number().int().positive(),w=f.number().int().nonnegative(),x=f.number().describe("Tagging version number"),E=f.union([f.string(),f.number(),f.boolean()]),C=E.optional();import{z as k}from"zod";var P={};t(P,{ErrorHandlerSchema:()=>O,HandlerSchema:()=>L,LogHandlerSchema:()=>J,StorageSchema:()=>I,StorageTypeSchema:()=>$,errorHandlerJsonSchema:()=>R,handlerJsonSchema:()=>q,logHandlerJsonSchema:()=>A,storageJsonSchema:()=>M,storageTypeJsonSchema:()=>T});import{z}from"zod";import{zodToJsonSchema as D}from"zod-to-json-schema";var $=z.enum(["local","session","cookie"]).describe("Storage mechanism: local, session, or cookie"),I=z.object({Local:z.literal("local"),Session:z.literal("session"),Cookie:z.literal("cookie")}).describe("Storage type constants for type-safe references"),O=z.any().describe("Error handler function: (error, state?) => void"),J=z.any().describe("Log handler function: (message, verbose?) => void"),L=z.object({Error:O.describe("Error handler function"),Log:J.describe("Log handler function")}).describe("Handler interface with error and log functions"),T=D($,{target:"jsonSchema7",$refStrategy:"relative",name:"StorageType"}),M=D(I,{target:"jsonSchema7",$refStrategy:"relative",name:"Storage"}),R=D(O,{target:"jsonSchema7",$refStrategy:"relative",name:"ErrorHandler"}),A=D(J,{target:"jsonSchema7",$refStrategy:"relative",name:"LogHandler"}),q=D(L,{target:"jsonSchema7",$refStrategy:"relative",name:"Handler"}),U=k.object({onError:O.optional().describe("Error handler function: (error, state?) => void"),onLog:J.optional().describe("Log handler function: (message, verbose?) => void")}).partial(),N=k.object({verbose:k.boolean().describe("Enable verbose logging for debugging").optional()}).partial(),B=k.object({queue:k.boolean().describe("Whether to queue events when consent is not granted").optional()}).partial(),W=k.object({}).partial(),V=k.object({init:k.boolean().describe("Whether to initialize immediately").optional(),loadScript:k.boolean().describe("Whether to load external script (for web destinations)").optional()}).partial(),H=k.object({disabled:k.boolean().describe("Set to true to disable").optional()}).partial(),_=k.object({primary:k.boolean().describe("Mark as primary (only one can be primary)").optional()}).partial(),K=k.object({settings:k.any().optional().describe("Implementation-specific configuration")}).partial(),F=k.object({env:k.any().optional().describe("Environment dependencies (platform-specific)")}).partial();function G(e,t){return k.object({data:k.union([e,t]).optional().describe("Data transformation rules")}).partial()}function Q(e){return k.object({mapping:e.optional().describe("Event mapping rules")}).partial()}function X(e){return k.object({policy:e.optional().describe("Pre-processing policy rules")}).partial()}function Y(e){return k.object({consent:e.optional().describe("Required consent states")}).partial()}var Z=k.object({type:k.string().optional().describe("Instance type identifier"),config:k.any().describe("Instance configuration")}).partial(),ee=k.object({collector:k.any().describe("Collector instance (runtime object)"),config:k.any().describe("Configuration"),env:k.any().describe("Environment dependencies")}).partial(),te=k.object({batch:k.number().optional().describe("Batch size: bundle N events for batch processing"),batched:k.any().optional().describe("Batch of events to be processed")}).partial(),ne=k.object({ignore:k.boolean().describe("Set to true to skip processing").optional(),condition:k.string().optional().describe("Condition function: return true to process")}).partial(),ie=k.object({sources:k.record(k.string(),k.any()).describe("Map of source instances")}).partial(),oe=k.object({destinations:k.record(k.string(),k.any()).describe("Map of destination instances")}).partial(),re={};t(re,{ConsentSchema:()=>me,DeepPartialEventSchema:()=>je,EntitiesSchema:()=>ye,EntitySchema:()=>he,EventSchema:()=>Se,OrderedPropertiesSchema:()=>pe,PartialEventSchema:()=>ve,PropertiesSchema:()=>de,PropertySchema:()=>le,PropertyTypeSchema:()=>ce,SourceSchema:()=>fe,SourceTypeSchema:()=>ue,UserSchema:()=>ge,VersionSchema:()=>be,consentJsonSchema:()=>De,entityJsonSchema:()=>Pe,eventJsonSchema:()=>we,orderedPropertiesJsonSchema:()=>ke,partialEventJsonSchema:()=>xe,propertiesJsonSchema:()=>Ce,sourceTypeJsonSchema:()=>ze,userJsonSchema:()=>Ee});import{z as ae}from"zod";import{zodToJsonSchema as se}from"zod-to-json-schema";var ce=ae.lazy(()=>ae.union([ae.boolean(),ae.string(),ae.number(),ae.record(ae.string(),le)])),le=ae.lazy(()=>ae.union([ce,ae.array(ce)])),de=ae.record(ae.string(),le.optional()).describe("Flexible property collection with optional values"),pe=ae.record(ae.string(),ae.tuple([le,ae.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control"),ue=ae.union([ae.enum(["web","server","app","other"]),ae.string()]).describe("Source type: web, server, app, other, or custom"),me=ae.record(ae.string(),ae.boolean()).describe("Consent requirement mapping (group name → state)"),ge=de.and(ae.object({id:ae.string().optional().describe("User identifier"),device:ae.string().optional().describe("Device identifier"),session:ae.string().optional().describe("Session identifier"),hash:ae.string().optional().describe("Hashed identifier"),address:ae.string().optional().describe("User address"),email:ae.string().email().optional().describe("User email address"),phone:ae.string().optional().describe("User phone number"),userAgent:ae.string().optional().describe("Browser user agent string"),browser:ae.string().optional().describe("Browser name"),browserVersion:ae.string().optional().describe("Browser version"),deviceType:ae.string().optional().describe("Device type (mobile, desktop, tablet)"),os:ae.string().optional().describe("Operating system"),osVersion:ae.string().optional().describe("Operating system version"),screenSize:ae.string().optional().describe("Screen dimensions"),language:ae.string().optional().describe("User language"),country:ae.string().optional().describe("User country"),region:ae.string().optional().describe("User region/state"),city:ae.string().optional().describe("User city"),zip:ae.string().optional().describe("User postal code"),timezone:ae.string().optional().describe("User timezone"),ip:ae.string().optional().describe("User IP address"),internal:ae.boolean().optional().describe("Internal user flag (employee, test user)")})).describe("User identification and properties"),be=de.and(ae.object({source:h.describe('Walker implementation version (e.g., "2.0.0")'),tagging:x})).describe("Walker version information"),fe=de.and(ae.object({type:ue.describe("Source type identifier"),id:h.describe("Source identifier (typically URL on web)"),previous_id:h.describe("Previous source identifier (typically referrer on web)")})).describe("Event source information"),he=ae.lazy(()=>ae.object({entity:ae.string().describe("Entity name"),data:de.describe("Entity-specific properties"),nested:ae.array(he).describe("Nested child entities"),context:pe.describe("Entity context data")})).describe("Nested entity structure with recursive nesting support"),ye=ae.array(he).describe("Array of nested entities"),Se=ae.object({name:ae.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'),data:de.describe("Event-specific properties"),context:pe.describe("Ordered context properties with priorities"),globals:de.describe("Global properties shared across events"),custom:de.describe("Custom implementation-specific properties"),user:ge.describe("User identification and attributes"),nested:ye.describe("Related nested entities"),consent:me.describe("Consent states at event time"),id:v.describe("Unique event identifier (timestamp-based)"),trigger:h.describe("Event trigger identifier"),entity:h.describe("Parsed entity from event name"),action:h.describe("Parsed action from event name"),timestamp:j.describe("Unix timestamp in milliseconds since epoch"),timing:y.describe("Event processing timing information"),group:h.describe("Event grouping identifier"),count:w.describe("Event count in session"),version:be.describe("Walker version information"),source:fe.describe("Event source information")}).describe("Complete walkerOS event structure"),ve=Se.partial().describe("Partial event structure with all fields optional"),je=ae.lazy(()=>Se.deepPartial()).describe("Deep partial event structure with all nested fields optional"),we=se(Se,{target:"jsonSchema7",$refStrategy:"relative",name:"Event"}),xe=se(ve,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialEvent"}),Ee=se(ge,{target:"jsonSchema7",$refStrategy:"relative",name:"User"}),Ce=se(de,{target:"jsonSchema7",$refStrategy:"relative",name:"Properties"}),ke=se(pe,{target:"jsonSchema7",$refStrategy:"relative",name:"OrderedProperties"}),Pe=se(he,{target:"jsonSchema7",$refStrategy:"relative",name:"Entity"}),ze=se(ue,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceType"}),De=se(me,{target:"jsonSchema7",$refStrategy:"relative",name:"Consent"}),$e={};t($e,{ConfigSchema:()=>Be,LoopSchema:()=>Te,MapSchema:()=>Re,PolicySchema:()=>qe,ResultSchema:()=>We,RuleSchema:()=>Ue,RulesSchema:()=>Ne,SetSchema:()=>Me,ValueConfigSchema:()=>Ae,ValueSchema:()=>Je,ValuesSchema:()=>Le,configJsonSchema:()=>Ye,loopJsonSchema:()=>_e,mapJsonSchema:()=>Fe,policyJsonSchema:()=>Ge,ruleJsonSchema:()=>Qe,rulesJsonSchema:()=>Xe,setJsonSchema:()=>Ke,valueConfigJsonSchema:()=>He,valueJsonSchema:()=>Ve});import{z as Ie}from"zod";import{zodToJsonSchema as Oe}from"zod-to-json-schema";var Je=Ie.lazy(()=>Ie.union([Ie.string().describe('String value or property path (e.g., "data.id")'),Ie.number().describe("Numeric value"),Ie.boolean().describe("Boolean value"),Ae,Ie.array(Je).describe("Array of values")])),Le=Ie.array(Je).describe("Array of transformation values"),Te=Ie.tuple([Je,Je]).describe("Loop transformation: [source, transform] tuple for array processing"),Me=Ie.array(Je).describe("Set: Array of values for selection or combination"),Re=Ie.record(Ie.string(),Je).describe("Map: Object mapping keys to transformation values"),Ae=Ie.object({key:Ie.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'),value:Ie.union([Ie.string(),Ie.number(),Ie.boolean()]).optional().describe("Static primitive value"),fn:Ie.string().optional().describe("Custom transformation function as string (serialized)"),map:Re.optional().describe("Object mapping: transform event data to structured output"),loop:Te.optional().describe("Loop transformation: [source, transform] for array processing"),set:Me.optional().describe("Set of values: combine or select from multiple values"),consent:me.optional().describe("Required consent states to include this value"),condition:Ie.string().optional().describe("Condition function as string: return true to include value"),validate:Ie.string().optional().describe("Validation function as string: return true if value is valid")}).refine(e=>Object.keys(e).length>0,{message:"ValueConfig must have at least one property"}).describe("Value transformation configuration with multiple strategies"),qe=Ie.record(Ie.string(),Je).describe("Policy rules for event pre-processing (key → value mapping)"),Ue=Ie.object({batch:Ie.number().optional().describe("Batch size: bundle N events for batch processing"),condition:Ie.string().optional().describe("Condition function as string: return true to process event"),consent:me.optional().describe("Required consent states to process this event"),settings:Ie.any().optional().describe("Destination-specific settings for this event mapping"),data:Ie.union([Je,Le]).optional().describe("Data transformation rules for event"),ignore:Ie.boolean().optional().describe("Set to true to skip processing this event"),name:Ie.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'),policy:qe.optional().describe("Event-level policy overrides (applied after config-level policy)")}).describe("Mapping rule for specific entity-action combination"),Ne=Ie.record(Ie.string(),Ie.record(Ie.string(),Ie.union([Ue,Ie.array(Ue)])).optional()).describe("Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support"),Be=Ie.object({consent:me.optional().describe("Required consent states to process any events"),data:Ie.union([Je,Le]).optional().describe("Global data transformation applied to all events"),mapping:Ne.optional().describe("Entity-action specific mapping rules"),policy:qe.optional().describe("Pre-processing policy rules applied before mapping")}).describe("Shared mapping configuration for sources and destinations"),We=Ie.object({eventMapping:Ue.optional().describe("Resolved mapping rule for event"),mappingKey:Ie.string().optional().describe('Mapping key used (e.g., "product.view")')}).describe("Mapping resolution result"),Ve=Oe(Je,{target:"jsonSchema7",$refStrategy:"relative",name:"Value"}),He=Oe(Ae,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),_e=Oe(Te,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),Ke=Oe(Me,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),Fe=Oe(Re,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),Ge=Oe(qe,{target:"jsonSchema7",$refStrategy:"relative",name:"Policy"}),Qe=Oe(Ue,{target:"jsonSchema7",$refStrategy:"relative",name:"Rule"}),Xe=Oe(Ne,{target:"jsonSchema7",$refStrategy:"relative",name:"Rules"}),Ye=Oe(Be,{target:"jsonSchema7",$refStrategy:"relative",name:"MappingConfig"}),Ze={};t(Ze,{BatchSchema:()=>dt,ConfigSchema:()=>nt,ContextSchema:()=>rt,DLQSchema:()=>St,DataSchema:()=>pt,DestinationPolicySchema:()=>ot,DestinationsSchema:()=>bt,InitDestinationsSchema:()=>gt,InitSchema:()=>mt,InstanceSchema:()=>ut,PartialConfigSchema:()=>it,PushBatchContextSchema:()=>st,PushContextSchema:()=>at,PushEventSchema:()=>ct,PushEventsSchema:()=>lt,PushResultSchema:()=>ht,RefSchema:()=>ft,ResultSchema:()=>yt,batchJsonSchema:()=>Et,configJsonSchema:()=>vt,contextJsonSchema:()=>wt,instanceJsonSchema:()=>Ct,partialConfigJsonSchema:()=>jt,pushContextJsonSchema:()=>xt,resultJsonSchema:()=>kt});import{z as et}from"zod";import{zodToJsonSchema as tt}from"zod-to-json-schema";var nt=et.object({consent:me.optional().describe("Required consent states to send events to this destination"),settings:et.any().describe("Implementation-specific configuration").optional(),data:et.union([Je,Le]).optional().describe("Global data transformation applied to all events for this destination"),env:et.any().describe("Environment dependencies (platform-specific)").optional(),id:v.describe("Destination instance identifier (defaults to destination key)").optional(),init:et.boolean().describe("Whether to initialize immediately").optional(),loadScript:et.boolean().describe("Whether to load external script (for web destinations)").optional(),mapping:Ne.optional().describe("Entity-action specific mapping rules for this destination"),policy:qe.optional().describe("Pre-processing policy rules applied before event mapping"),queue:et.boolean().describe("Whether to queue events when consent is not granted").optional(),verbose:et.boolean().describe("Enable verbose logging for debugging").optional(),onError:O.optional(),onLog:J.optional()}).describe("Destination configuration"),it=nt.deepPartial().describe("Partial destination configuration with all fields deeply optional"),ot=qe.describe("Destination policy rules for event pre-processing"),rt=et.object({collector:et.any().describe("Collector instance (runtime object)"),config:nt.describe("Destination configuration"),data:et.union([et.any(),et.undefined(),et.array(et.union([et.any(),et.undefined()]))]).optional().describe("Transformed event data"),env:et.any().describe("Environment dependencies")}).describe("Destination context for init and push functions"),at=rt.extend({mapping:Ue.optional().describe("Resolved mapping rule for this specific event")}).describe("Push context with event-specific mapping"),st=at.describe("Batch push context with event-specific mapping"),ct=et.object({event:Se.describe("The event to process"),mapping:Ue.optional().describe("Mapping rule for this event")}).describe("Event with optional mapping for batch processing"),lt=et.array(ct).describe("Array of events with mappings"),dt=et.object({key:et.string().describe('Batch key (usually mapping key like "product.view")'),events:et.array(Se).describe("Array of events in batch"),data:et.array(et.union([et.any(),et.undefined(),et.array(et.union([et.any(),et.undefined()]))])).describe("Transformed data for each event"),mapping:Ue.optional().describe("Shared mapping rule for batch")}).describe("Batch of events grouped by mapping key"),pt=et.union([et.any(),et.undefined(),et.array(et.union([et.any(),et.undefined()]))]).describe("Transformed event data (Property, undefined, or array)"),ut=et.object({config:nt.describe("Destination configuration"),queue:et.array(Se).optional().describe("Queued events awaiting consent"),dlq:et.array(et.tuple([Se,et.any()])).optional().describe("Dead letter queue (failed events with errors)"),type:et.string().optional().describe("Destination type identifier"),env:et.any().optional().describe("Environment dependencies"),init:et.any().optional().describe("Initialization function"),push:et.any().describe("Push function for single events"),pushBatch:et.any().optional().describe("Batch push function"),on:et.any().optional().describe("Event lifecycle hook function")}).describe("Destination instance (runtime object with functions)"),mt=et.object({code:ut.describe("Destination instance with implementation"),config:it.optional().describe("Partial configuration overrides"),env:et.any().optional().describe("Partial environment overrides")}).describe("Destination initialization configuration"),gt=et.record(et.string(),mt).describe("Map of destination IDs to initialization configurations"),bt=et.record(et.string(),ut).describe("Map of destination IDs to runtime instances"),ft=et.object({id:et.string().describe("Destination ID"),destination:ut.describe("Destination instance")}).describe("Destination reference (ID + instance)"),ht=et.object({queue:et.array(Se).optional().describe("Events queued (awaiting consent)"),error:et.any().optional().describe("Error if push failed")}).describe("Push operation result"),yt=et.object({successful:et.array(ft).describe("Destinations that processed successfully"),queued:et.array(ft).describe("Destinations that queued events"),failed:et.array(ft).describe("Destinations that failed to process")}).describe("Overall destination processing result"),St=et.array(et.tuple([Se,et.any()])).describe("Dead letter queue: [(event, error), ...]"),vt=tt(nt,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationConfig"}),jt=tt(it,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialDestinationConfig"}),wt=tt(rt,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationContext"}),xt=tt(at,{target:"jsonSchema7",$refStrategy:"relative",name:"PushContext"}),Et=tt(dt,{target:"jsonSchema7",$refStrategy:"relative",name:"Batch"}),Ct=tt(ut,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationInstance"}),kt=tt(yt,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationResult"}),Pt={};t(Pt,{CommandTypeSchema:()=>$t,ConfigSchema:()=>It,DestinationsSchema:()=>Mt,InitConfigSchema:()=>Jt,InstanceSchema:()=>Rt,PushContextSchema:()=>Lt,SessionDataSchema:()=>Ot,SourcesSchema:()=>Tt,commandTypeJsonSchema:()=>At,configJsonSchema:()=>qt,initConfigJsonSchema:()=>Nt,instanceJsonSchema:()=>Wt,pushContextJsonSchema:()=>Bt,sessionDataJsonSchema:()=>Ut});import{z as zt}from"zod";import{zodToJsonSchema as Dt}from"zod-to-json-schema";var $t=zt.union([zt.enum(["action","config","consent","context","destination","elb","globals","hook","init","link","run","user","walker"]),zt.string()]).describe("Collector command type: standard commands or custom string for extensions"),It=zt.object({run:zt.boolean().describe("Whether to run collector automatically on initialization").optional(),tagging:x,globalsStatic:de.describe("Static global properties that persist across collector runs"),sessionStatic:zt.record(zt.any()).describe("Static session data that persists across collector runs"),verbose:zt.boolean().describe("Enable verbose logging for debugging"),onError:O.optional(),onLog:J.optional()}).describe("Core collector configuration"),Ot=de.and(zt.object({isStart:zt.boolean().describe("Whether this is a new session start"),storage:zt.boolean().describe("Whether storage is available"),id:v.describe("Session identifier").optional(),start:j.describe("Session start timestamp").optional(),marketing:zt.literal(!0).optional().describe("Marketing attribution flag"),updated:j.describe("Last update timestamp").optional(),isNew:zt.boolean().describe("Whether this is a new session").optional(),device:v.describe("Device identifier").optional(),count:w.describe("Event count in session").optional(),runs:w.describe("Number of runs").optional()})).describe("Session state and tracking data"),Jt=It.partial().extend({consent:me.optional().describe("Initial consent state"),user:ge.optional().describe("Initial user data"),globals:de.optional().describe("Initial global properties"),sources:zt.any().optional().describe("Source configurations"),destinations:zt.any().optional().describe("Destination configurations"),custom:de.optional().describe("Initial custom implementation-specific properties")}).describe("Collector initialization configuration with initial state"),Lt=zt.object({mapping:Be.optional().describe("Source-level mapping configuration")}).describe("Push context with optional source mapping"),Tt=zt.record(zt.string(),zt.any()).describe("Map of source IDs to source instances"),Mt=zt.record(zt.string(),zt.any()).describe("Map of destination IDs to destination instances"),Rt=zt.object({push:zt.any().describe("Push function for processing events"),command:zt.any().describe("Command function for walker commands"),allowed:zt.boolean().describe("Whether event processing is allowed"),config:It.describe("Current collector configuration"),consent:me.describe("Current consent state"),count:zt.number().describe("Event count (increments with each event)"),custom:de.describe("Custom implementation-specific properties"),sources:Tt.describe("Registered source instances"),destinations:Mt.describe("Registered destination instances"),globals:de.describe("Current global properties"),group:zt.string().describe("Event grouping identifier"),hooks:zt.any().describe("Lifecycle hook functions"),on:zt.any().describe("Event lifecycle configuration"),queue:zt.array(Se).describe("Queued events awaiting processing"),round:zt.number().describe("Collector run count (increments with each run)"),session:zt.union([zt.undefined(),Ot]).describe("Current session state"),timing:zt.number().describe("Event processing timing information"),user:ge.describe("Current user data"),version:zt.string().describe("Walker implementation version")}).describe("Collector instance with state and methods"),At=Dt($t,{target:"jsonSchema7",$refStrategy:"relative",name:"CommandType"}),qt=Dt(It,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorConfig"}),Ut=Dt(Ot,{target:"jsonSchema7",$refStrategy:"relative",name:"SessionData"}),Nt=Dt(Jt,{target:"jsonSchema7",$refStrategy:"relative",name:"InitConfig"}),Bt=Dt(Lt,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorPushContext"}),Wt=Dt(Rt,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorInstance"}),Vt={};t(Vt,{BaseEnvSchema:()=>Kt,ConfigSchema:()=>Ft,InitSchema:()=>Xt,InitSourceSchema:()=>Yt,InitSourcesSchema:()=>Zt,InstanceSchema:()=>Qt,PartialConfigSchema:()=>Gt,baseEnvJsonSchema:()=>en,configJsonSchema:()=>tn,initSourceJsonSchema:()=>rn,initSourcesJsonSchema:()=>an,instanceJsonSchema:()=>on,partialConfigJsonSchema:()=>nn});import{z as Ht}from"zod";import{zodToJsonSchema as _t}from"zod-to-json-schema";var Kt=Ht.object({push:Ht.any().describe("Collector push function"),command:Ht.any().describe("Collector command function"),sources:Ht.any().optional().describe("Map of registered source instances"),elb:Ht.any().describe("Public API function (alias for collector.push)")}).catchall(Ht.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this"),Ft=Be.extend({settings:Ht.any().describe("Implementation-specific configuration").optional(),env:Kt.optional().describe("Environment dependencies (platform-specific)"),id:v.describe("Source identifier (defaults to source key)").optional(),onError:O.optional(),disabled:Ht.boolean().describe("Set to true to disable").optional(),primary:Ht.boolean().describe("Mark as primary (only one can be primary)").optional()}).describe("Source configuration with mapping and environment"),Gt=Ft.deepPartial().describe("Partial source configuration with all fields deeply optional"),Qt=Ht.object({type:Ht.string().describe('Source type identifier (e.g., "browser", "dataLayer")'),config:Ft.describe("Current source configuration"),push:Ht.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"),destroy:Ht.any().optional().describe("Cleanup function called when source is removed"),on:Ht.any().optional().describe("Lifecycle hook function for event types")}).describe("Source instance with push handler and lifecycle methods"),Xt=Ht.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>"),Yt=Ht.object({code:Xt.describe("Source initialization function"),config:Gt.optional().describe("Partial configuration overrides"),env:Kt.partial().optional().describe("Partial environment overrides"),primary:Ht.boolean().optional().describe("Mark as primary source (only one can be primary)")}).describe("Source initialization configuration"),Zt=Ht.record(Ht.string(),Yt).describe("Map of source IDs to initialization configurations"),en=_t(Kt,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceBaseEnv"}),tn=_t(Ft,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceConfig"}),nn=_t(Gt,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialSourceConfig"}),on=_t(Qt,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceInstance"}),rn=_t(Yt,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSource"}),an=_t(Zt,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSources"});function sn(e,t){const n=[],i={};for(const[t,o]of Object.entries(e)){o.required&&n.push(t);const e={type:o.type};if(o.description&&(e.description=o.description),o.pattern&&(e.pattern=o.pattern),void 0!==o.minLength&&(e.minLength=o.minLength),void 0!==o.maxLength&&(e.maxLength=o.maxLength),void 0!==o.minimum&&(e.minimum=o.minimum),void 0!==o.maximum&&(e.maximum=o.maximum),o.enum&&(e.enum=[...o.enum]),void 0!==o.default&&(e.default=o.default),"object"===o.type&&o.properties){const t={};for(const[e,n]of Object.entries(o.properties))t[e]=cn(n);e.properties=t}"array"===o.type&&o.items&&(e.items=cn(o.items)),i[t]=e}const o={type:"object",properties:i};return t&&(o.title=t),n.length>0&&(o.required=n),o}function cn(e){const t={type:e.type};if(e.description&&(t.description=e.description),e.pattern&&(t.pattern=e.pattern),void 0!==e.minLength&&(t.minLength=e.minLength),void 0!==e.maxLength&&(t.maxLength=e.maxLength),void 0!==e.minimum&&(t.minimum=e.minimum),void 0!==e.maximum&&(t.maximum=e.maximum),e.enum&&(t.enum=[...e.enum]),void 0!==e.default&&(t.default=e.default),"object"===e.type&&e.properties){const n={};for(const[t,i]of Object.entries(e.properties))n[t]=cn(i);t.properties=n}return"array"===e.type&&e.items&&(t.items=cn(e.items)),t}function ln(e,t){const n={type:"array",items:cn(e)};return void 0!==t?.minItems&&(n.minItems=t.minItems),void 0!==t?.maxItems&&(n.maxItems=t.maxItems),t?.description&&(n.description=t.description),t?.title&&(n.title=t.title),n}function dn(e,t="string",n){const i={type:t,enum:[...e]};return n?.description&&(i.description=n.description),n?.title&&(i.title=n.title),i}function pn(e,t,n){return ln({type:"object"},{minItems:2,maxItems:2,description:n||"Tuple with exactly 2 elements [source, transform]"})}import{z as un}from"zod";import{zodToJsonSchema as mn}from"zod-to-json-schema";import{zodToJsonSchema as gn}from"zod-to-json-schema";function bn(e){return gn(e,{target:"jsonSchema7",$refStrategy:"none"})}function fn(e){return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(e)?e.replace(/\.\d+$/,".0"):""}var hn={merge:!0,shallow:!0,extend:!0};function yn(e,t={},n={}){n={...hn,...n};const i=Object.entries(t).reduce((t,[i,o])=>{const r=e[i];return n.merge&&Array.isArray(r)&&Array.isArray(o)?t[i]=o.reduce((e,t)=>e.includes(t)?e:[...e,t],[...r]):(n.extend||i in e)&&(t[i]=o),t},{});return n.shallow?{...e,...i}:(Object.assign(e,i),e)}function Sn(e){return"[object Arguments]"===Object.prototype.toString.call(e)}function vn(e){return Array.isArray(e)}function jn(e){return"boolean"==typeof e}function wn(e){return"walker"===e}function xn(e){return void 0!==e}function En(e){return e===document||e instanceof Element}function Cn(e){return"function"==typeof e}function kn(e){return"number"==typeof e&&!Number.isNaN(e)}function Pn(e){return"object"==typeof e&&null!==e&&!vn(e)&&"[object Object]"===Object.prototype.toString.call(e)}function zn(e,t){return typeof e==typeof t}function Dn(e){return"string"==typeof e}function $n(e,t=new WeakMap){if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);const n=Object.prototype.toString.call(e);if("[object Object]"===n){const n={};t.set(e,n);for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=$n(e[i],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push($n(e,t))}),n}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){const t=e;return new RegExp(t.source,t.flags)}return e}function In(e,t="",n){const i=t.split(".");let o=e;for(let e=0;e<i.length;e++){const t=i[e];if("*"===t&&vn(o)){const t=i.slice(e+1).join("."),r=[];for(const e of o){const i=In(e,t,n);r.push(i)}return r}if(o=o instanceof Object?o[t]:void 0,!o)break}return xn(o)?o:n}function On(e,t,n){if(!Pn(e))return e;const i=$n(e),o=t.split(".");let r=i;for(let e=0;e<o.length;e++){const t=o[e];e===o.length-1?r[t]=n:(t in r&&"object"==typeof r[t]&&null!==r[t]||(r[t]={}),r=r[t])}return i}function Jn(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function Ln(e,t={},n={}){const i={...t,...n},o={};let r=void 0===e;return Object.keys(i).forEach(t=>{i[t]&&(o[t]=!0,e&&e[t]&&(r=!0))}),!!r&&o}function Tn(e,t){const n={...e};return n.config=yn(e.config,t,{shallow:!0,merge:!0,extend:!0}),e.config.settings&&t.settings&&(n.config.settings=yn(e.config.settings,t.settings,{shallow:!0,merge:!0,extend:!0})),e.config.mapping&&t.mapping&&(n.config.mapping=yn(e.config.mapping,t.mapping,{shallow:!0,merge:!0,extend:!0})),n}function Mn(e={}){const t=e.timestamp||(new Date).setHours(0,13,37,0),n=e.group||"gr0up",i=e.count||1,o=yn({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],not:void 0},context:{dev:["test",1]},globals:{lang:"elb"},custom:{completely:"random"},user:{id:"us3r",device:"c00k13",session:"s3ss10n"},nested:[{entity:"child",data:{is:"subordinated"},nested:[],context:{element:["child",0]}}],consent:{functional:!0},id:`${t}-${n}-${i}`,trigger:"test",entity:"entity",action:"action",timestamp:t,timing:3.14,group:n,count:i,version:{source:"0.3.0",tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){const[t,n]=e.name.split(" ")??[];t&&n&&(o.entity=t,o.action=n)}return o}function Rn(e="entity action",t={}){const n=t.timestamp||(new Date).setHours(0,13,37,0),i={data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420}},o={data:{id:"cc",name:"Cool Cap",size:"one size",price:42}};return Mn({...{"cart view":{data:{currency:"EUR",value:2*i.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...i.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:i.data.price+o.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...i,context:{shopping:["checkout",0]},nested:[]},{entity:"product",...o,context:{shopping:["checkout",0]},nested:[]}],trigger:"load"},"order complete":{data:{id:"0rd3r1d",currency:"EUR",shipping:5.22,taxes:73.76,total:555},context:{shopping:["complete",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...i,context:{shopping:["complete",0]},nested:[]},{entity:"product",...o,context:{shopping:["complete",0]},nested:[]},{entity:"gift",data:{name:"Surprise"},context:{shopping:["complete",0]},nested:[]}],trigger:"load"},"page view":{data:{domain:"www.example.com",title:"walkerOS documentation",referrer:"https://www.elbwalker.com/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...i,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...i,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...i.data,position:3,promo:!0},context:{shopping:["discover",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"promotion visible":{data:{name:"Setting up tracking easily",position:"hero"},context:{ab_test:["engagement",0]},globals:{pagegroup:"homepage"},trigger:"visible"},"session start":{data:{id:"s3ss10n",start:n,isNew:!0,count:1,runs:1,isStart:!0,storage:!0,referrer:"",device:"c00k13"},user:{id:"us3r",device:"c00k13",session:"s3ss10n",hash:"h4sh",address:"street number",email:"user@example.com",phone:"+49 123 456 789",userAgent:"Mozilla...",browser:"Chrome",browserVersion:"90",deviceType:"desktop",language:"de-DE",country:"DE",region:"HH",city:"Hamburg",zip:"20354",timezone:"Berlin",os:"walkerOS",osVersion:"1.0",screenSize:"1337x420",ip:"127.0.0.0",internal:!0,custom:"value"}}}[e],...t,name:e})}function An(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function qn(e,t={}){const n="clickId",i={},o={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:n,fbclid:n,gclid:n,msclkid:n,ttclid:n,twclid:n,igshid:n,sclid:n};return Object.entries(yn(o,t)).forEach(([t,o])=>{const r=e.searchParams.get(t);r&&(o===n&&(o=t,i[n]=t),i[o]=r)}),i}function Un(e,t=1e3,n=!1){let i,o=null,r=!1;return(...a)=>new Promise(s=>{const c=n&&!r;o&&clearTimeout(o),o=setTimeout(()=>{o=null,n&&!r||(i=e(...a),s(i))},t),c&&(r=!0,i=e(...a),s(i))})}function Nn(e,t=1e3){let n=null;return function(...i){if(null===n)return n=setTimeout(()=>{n=null},t),e(...i)}}function Bn(e){return jn(e)||Dn(e)||kn(e)||!xn(e)||vn(e)&&e.every(Bn)||Pn(e)&&Object.values(e).every(Bn)}function Wn(e){return jn(e)||Dn(e)||kn(e)?e:Sn(e)?Wn(Array.from(e)):vn(e)?e.map(e=>Wn(e)).filter(e=>void 0!==e):Pn(e)?Object.entries(e).reduce((e,[t,n])=>{const i=Wn(n);return void 0!==i&&(e[t]=i),e},{}):void 0}function Vn(e){return Bn(e)?e:void 0}function Hn(e,t,n){return function(...i){try{return e(...i)}catch(e){if(!t)return;return t(e)}finally{n?.()}}}function _n(e,t,n){return async function(...i){try{return await e(...i)}catch(e){if(!t)return;return await t(e)}finally{await(n?.())}}}async function Kn(e,t){const[n,i]=(e.name||"").split(" ");if(!t||!n||!i)return{};let o,r="",a=n,s=i;const c=t=>{if(t)return(t=vn(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[a]||(a="*");const l=t[a];return l&&(l[s]||(s="*"),o=c(l[s])),o||(a="*",s="*",o=c(t[a]?.[s])),o&&(r=`${a} ${s}`),{eventMapping:o,mappingKey:r}}async function Fn(e,t={},n={}){if(!xn(e))return;const i=Pn(e)&&e.consent||n.consent||n.collector?.consent,o=vn(t)?t:[t];for(const t of o){const o=await _n(Gn)(e,t,{...n,consent:i});if(xn(o))return o}}async function Gn(e,t,n={}){const{collector:i,consent:o}=n;return(vn(t)?t:[t]).reduce(async(t,r)=>{const a=await t;if(a)return a;const s=Dn(r)?{key:r}:r;if(!Object.keys(s).length)return;const{condition:c,consent:l,fn:d,key:p,loop:u,map:m,set:g,validate:b,value:f}=s;if(c&&!await _n(c)(e,r,i))return;if(l&&!Ln(l,o))return f;let h=xn(f)?f:e;if(d&&(h=await _n(d)(e,r,n)),p&&(h=In(e,p,f)),u){const[t,i]=u,o="this"===t?[e]:await Fn(e,t,n);vn(o)&&(h=(await Promise.all(o.map(e=>Fn(e,i,n)))).filter(xn))}else m?h=await Object.entries(m).reduce(async(t,[i,o])=>{const r=await t,a=await Fn(e,o,n);return xn(a)&&(r[i]=a),r},Promise.resolve({})):g&&(h=await Promise.all(g.map(t=>Gn(e,t,n))));b&&!await _n(b)(h)&&(h=void 0);const y=Vn(h);return xn(y)?y:Vn(f)},Promise.resolve(void 0))}async function Qn(e,t,n){t.policy&&await Promise.all(Object.entries(t.policy).map(async([t,i])=>{const o=await Fn(e,i,{collector:n});e=On(e,t,o)}));const{eventMapping:i,mappingKey:o}=await Kn(e,t.mapping);i?.policy&&await Promise.all(Object.entries(i.policy).map(async([t,i])=>{const o=await Fn(e,i,{collector:n});e=On(e,t,o)}));let r=t.data&&await Fn(e,t.data,{collector:n});if(i){if(i.ignore)return{event:e,data:r,mapping:i,mappingKey:o,ignore:!0};if(i.name&&(e.name=i.name),i.data){const t=i.data&&await Fn(e,i.data,{collector:n});r=Pn(r)&&Pn(t)?yn(r,t):t}}return{event:e,data:r,mapping:i,mappingKey:o,ignore:!1}}function Xn(e,t){const n=(e,i=[])=>new Proxy(e,{get(e,o){const r=e[o],a=[...i,o];return"function"==typeof r?(...e)=>t(a,e,r):r&&"object"==typeof r?n(r,a):r}});return n(e)}function Yn(e,t){const n=(e,i=[])=>{if(!e||"object"!=typeof e)return e;const o=Array.isArray(e)?[]:{};for(const[r,a]of Object.entries(e)){const e=[...i,r];Array.isArray(o)?o[Number(r)]=t(a,e):o[r]=t(a,e),a&&"object"==typeof a&&"function"!=typeof a&&(Array.isArray(o)?o[Number(r)]=n(a,e):o[r]=n(a,e))}return o};return n(e)}function Zn(e,t=!1){t&&console.dir(e,{depth:4})}function ei(e){const t=String(e),n=t.split("?")[1]||t;return Hn(()=>{const e=new URLSearchParams(n),t={};return e.forEach((e,n)=>{const i=n.split(/[[\]]+/).filter(Boolean);let o=t;i.forEach((t,n)=>{const r=n===i.length-1;if(vn(o)){const a=parseInt(t,10);r?o[a]=Jn(e):(o[a]=o[a]||(isNaN(parseInt(i[n+1],10))?{}:[]),o=o[a])}else Pn(o)&&(r?o[t]=Jn(e):(o[t]=o[t]||(isNaN(parseInt(i[n+1],10))?{}:[]),o=o[t]))})}),t})()}function ti(e){if(!e)return"";const t=[],n=encodeURIComponent;function i(e,o){null!=o&&(vn(o)?o.forEach((t,n)=>i(`${e}[${n}]`,t)):Pn(o)?Object.entries(o).forEach(([t,n])=>i(`${e}[${t}]`,n)):t.push(`${n(e)}=${n(String(o))}`))}return"object"!=typeof e?n(e):(Object.entries(e).forEach(([e,t])=>i(e,t)),t.join("&"))}function ni(e){return void 0===e||zn(e,"")?e:JSON.stringify(e)}function ii(e={}){return yn({"Content-Type":"application/json; charset=utf-8"},e)}function oi(e){throw new Error(String(e))}function ri(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function ai(e,t,n){return function(...i){let o;const r="post"+t,a=n["pre"+t],s=n[r];return o=a?a({fn:e},...i):e(...i),s&&(o=s({fn:e,result:o},...i)),o}}function si(e){return e?{userAgent:e,browser:ci(e),browserVersion:li(e),os:di(e),osVersion:pi(e),deviceType:ui(e)}:{}}function ci(e){const t=[{name:"Edge",substr:"Edg"},{name:"Chrome",substr:"Chrome"},{name:"Safari",substr:"Safari",exclude:"Chrome"},{name:"Firefox",substr:"Firefox"},{name:"IE",substr:"MSIE"},{name:"IE",substr:"Trident"}];for(const n of t)if(e.includes(n.substr)&&(!n.exclude||!e.includes(n.exclude)))return n.name}function li(e){const t=[/Edg\/([0-9]+)/,/Chrome\/([0-9]+)/,/Version\/([0-9]+).*Safari/,/Firefox\/([0-9]+)/,/MSIE ([0-9]+)/,/rv:([0-9]+).*Trident/];for(const n of t){const t=e.match(n);if(t)return t[1]}}function di(e){const t=[{name:"Windows",substr:"Windows NT"},{name:"macOS",substr:"Mac OS X"},{name:"Android",substr:"Android"},{name:"iOS",substr:"iPhone OS"},{name:"Linux",substr:"Linux"}];for(const n of t)if(e.includes(n.substr))return n.name}function pi(e){const t=e.match(/(?:Windows NT|Mac OS X|Android|iPhone OS) ([0-9._]+)/);return t?t[1].replace(/_/g,"."):void 0}function ui(e){let t="Desktop";return/Tablet|iPad/i.test(e)?t="Tablet":/Mobi|Android|iPhone|iPod|BlackBerry|Opera Mini|IEMobile|WPDesktop/i.test(e)&&(t="Mobile"),t}function mi(e,t=[]){let n,i,o;zn(e,{})||oi("Invalid object"),zn(e.name,"")?(n=e.name,[i,o]=n.split(" "),i&&o||oi("Invalid event name")):zn(e.entity,"")&&zn(e.action,"")?(i=e.entity,o=e.action,n=`${i} ${o}`):oi("Missing or invalid name, entity, or action");const r={name:n,data:{},context:{},custom:{},globals:{},user:{},nested:[],consent:{},id:"",trigger:"",entity:i,action:o,timestamp:0,timing:0,group:"",count:0,version:{source:"",tagging:0},source:{type:"",id:"",previous_id:""}};return[{"*":{"*":{name:{maxLength:255},user:{allowedKeys:["id","device","session"]},consent:{allowedValues:[!0,!1]},timestamp:{min:0},timing:{min:0},count:{min:0},version:{allowedKeys:["source","tagging"]},source:{allowedKeys:["type","id","previous_id"]}}}}].concat(t).reduce((e,t)=>["*",i].reduce((e,n)=>["*",o].reduce((e,i)=>{const o=t[n]?.[i];return o?e.concat([o]):e},e),e),[]).reduce((t,n)=>{const i=Object.keys(n).filter(e=>{const t=n[e];return!0===t?.required});return[...Object.keys(e),...i].reduce((t,i)=>{const o=n[i];let r=e[i];return o&&(r=Hn(gi,e=>{oi(String(e))})(t,i,r,o)),zn(r,t[i])&&(t[i]=r),t},t)},r)}function gi(e,t,n,i){if(i.validate&&(n=Hn(i.validate,e=>{oi(String(e))})(n,t,e)),i.required&&void 0===n&&oi("Missing required property"),zn(n,""))i.maxLength&&n.length>i.maxLength&&(i.strict&&oi("Value exceeds maxLength"),n=n.substring(0,i.maxLength));else if(zn(n,1))zn(i.min,1)&&n<i.min?(i.strict&&oi("Value below min"),n=i.min):zn(i.max,1)&&n>i.max&&(i.strict&&oi("Value exceeds max"),n=i.max);else if(zn(n,{})){if(i.schema){const e=i.schema;Object.keys(e).reduce((t,n)=>{const i=e[n];let o=t[n];return i&&(i.type&&typeof o!==i.type&&oi(`Type doesn't match (${n})`),o=Hn(gi,e=>{oi(String(e))})(t,n,o,i)),o},n)}for(const e of Object.keys(n))i.allowedKeys&&!i.allowedKeys.includes(e)&&(i.strict&&oi("Key not allowed"),delete n[e])}return n}export{ee as BaseContextConfig,te as BatchConfig,n as Collector,Pt as CollectorSchemas,me as ConsentSchema,b as Const,w as Counter,i as Data,je as DeepPartialEventSchema,o as Destination,Ze as DestinationSchemas,oe as DestinationsMapConfig,H as DisabledConfig,r as Elb,ye as EntitiesSchema,he as EntitySchema,Se as EventSchema,a as Flow,F as GenericEnvConfig,K as GenericSettingsConfig,s as Handler,U as HandlersConfig,c as Hooks,W as IdConfig,v as Identifier,V as InitConfig,Te as LoopSchema,Re as MapSchema,l as Mapping,We as MappingResultSchema,$e as MappingSchemas,d as On,C as OptionalPrimitiveValue,pe as OrderedPropertiesSchema,ve as PartialEventSchema,qe as PolicySchema,_ as PrimaryConfig,E as PrimitiveValue,ne as ProcessingControlConfig,de as PropertiesSchema,le as PropertySchema,ce as PropertyTypeSchema,B as QueueConfig,p as Request,S as RequiredBoolean,y as RequiredNumber,h as RequiredString,Ue as RuleSchema,Ne as RulesSchema,Z as RuntimeInstanceConfig,u as Schema,Me as SetSchema,m as Source,fe as SourceSchema,Vt as SourceSchemas,ue as SourceTypeSchema,ie as SourcesMapConfig,x as TaggingVersion,j as Timestamp,ge as UserSchema,P as UtilitySchemas,Ae as ValueConfigSchema,Je as ValueSchema,Le as ValuesSchema,N as VerboseConfig,be as VersionSchema,g as WalkerOS,re as WalkerOSSchemas,fn as anonymizeIP,yn as assign,Vn as castToProperty,Jn as castValue,$n as clone,De as consentJsonSchema,ln as createArraySchema,Y as createConsentConfig,G as createDataTransformationConfig,Tn as createDestination,dn as createEnumSchema,Mn as createEvent,Q as createMappingRulesConfig,sn as createObjectSchema,X as createPolicyConfig,pn as createTupleSchema,Un as debounce,Pe as entityJsonSchema,we as eventJsonSchema,Wn as filterValues,ci as getBrowser,li as getBrowserVersion,In as getByPath,ui as getDeviceType,Rn as getEvent,Ln as getGrantedConsent,ii as getHeaders,An as getId,Kn as getMappingEvent,Fn as getMappingValue,qn as getMarketingParameters,di as getOS,pi as getOSVersion,Sn as isArguments,vn as isArray,jn as isBoolean,wn as isCommand,xn as isDefined,En as isElementOrDocument,Cn as isFunction,kn as isNumber,Pn as isObject,Bn as isPropertyType,zn as isSameType,Dn as isString,_e as loopJsonSchema,Fe as mapJsonSchema,Xn as mockEnv,Zn as onLog,ke as orderedPropertiesJsonSchema,si as parseUserAgent,xe as partialEventJsonSchema,Ge as policyJsonSchema,Qn as processEventMapping,Ce as propertiesJsonSchema,ei as requestToData,ti as requestToParameter,Qe as ruleJsonSchema,Xe as rulesJsonSchema,On as setByPath,Ke as setJsonSchema,ze as sourceTypeJsonSchema,Nn as throttle,oi as throwError,ni as transformData,Yn as traverseEnv,ri as trim,Hn as tryCatch,_n as tryCatchAsync,ai as useHooks,Ee as userJsonSchema,mi as validateEvent,gi as validateProperty,He as valueConfigJsonSchema,Ve as valueJsonSchema,un as z,mn as zodToJsonSchema,bn as zodToSchema};//# sourceMappingURL=index.mjs.map
|
|
1
|
+
var e={},t={},n={},o={},r={},i={},s={},c={},a={},u={},l={},p={},d={},f={Utils:{Storage:{Local:"local",Session:"session",Cookie:"cookie"}}};function g(e){return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(e)?e.replace(/\.\d+$/,".0"):""}var m={merge:!0,shallow:!0,extend:!0};function y(e,t={},n={}){n={...m,...n};const o=Object.entries(t).reduce((t,[o,r])=>{const i=e[o];return n.merge&&Array.isArray(i)&&Array.isArray(r)?t[o]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||o in e)&&(t[o]=r),t},{});return n.shallow?{...e,...o}:(Object.assign(e,o),e)}function h(e){return"[object Arguments]"===Object.prototype.toString.call(e)}function b(e){return Array.isArray(e)}function w(e){return"boolean"==typeof e}function v(e){return"walker"===e}function x(e){return void 0!==e}function j(e){return e===document||e instanceof Element}function O(e){return"function"==typeof e}function k(e){return"number"==typeof e&&!Number.isNaN(e)}function S(e){return"object"==typeof e&&null!==e&&!b(e)&&"[object Object]"===Object.prototype.toString.call(e)}function E(e,t){return typeof e==typeof t}function A(e){return"string"==typeof e}function P(e,t=new WeakMap){if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);const n=Object.prototype.toString.call(e);if("[object Object]"===n){const n={};t.set(e,n);for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=P(e[o],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push(P(e,t))}),n}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){const t=e;return new RegExp(t.source,t.flags)}return e}function $(e,t="",n){const o=t.split(".");let r=e;for(let e=0;e<o.length;e++){const t=o[e];if("*"===t&&b(r)){const t=o.slice(e+1).join("."),i=[];for(const e of r){const o=$(e,t,n);i.push(o)}return i}if(r=r instanceof Object?r[t]:void 0,!r)break}return x(r)?r:n}function M(e,t,n){if(!S(e))return e;const o=P(e),r=t.split(".");let i=o;for(let e=0;e<r.length;e++){const t=r[e];e===r.length-1?i[t]=n:(t in i&&"object"==typeof i[t]&&null!==i[t]||(i[t]={}),i=i[t])}return o}function N(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function T(e,t={},n={}){const o={...t,...n},r={};let i=void 0===e;return Object.keys(o).forEach(t=>{o[t]&&(r[t]=!0,e&&e[t]&&(i=!0))}),!!i&&r}function I(e,t){const n={...e};return n.config=y(e.config,t,{shallow:!0,merge:!0,extend:!0}),e.config.settings&&t.settings&&(n.config.settings=y(e.config.settings,t.settings,{shallow:!0,merge:!0,extend:!0})),e.config.mapping&&t.mapping&&(n.config.mapping=y(e.config.mapping,t.mapping,{shallow:!0,merge:!0,extend:!0})),n}function C(e={}){const t=e.timestamp||(new Date).setHours(0,13,37,0),n=e.group||"gr0up",o=e.count||1,r=y({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],not:void 0},context:{dev:["test",1]},globals:{lang:"elb"},custom:{completely:"random"},user:{id:"us3r",device:"c00k13",session:"s3ss10n"},nested:[{entity:"child",data:{is:"subordinated"},nested:[],context:{element:["child",0]}}],consent:{functional:!0},id:`${t}-${n}-${o}`,trigger:"test",entity:"entity",action:"action",timestamp:t,timing:3.14,group:n,count:o,version:{source:"0.3.1",tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){const[t,n]=e.name.split(" ")??[];t&&n&&(r.entity=t,r.action=n)}return r}function _(e="entity action",t={}){const n=t.timestamp||(new Date).setHours(0,13,37,0),o={data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420}},r={data:{id:"cc",name:"Cool Cap",size:"one size",price:42}};return C({...{"cart view":{data:{currency:"EUR",value:2*o.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...o.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:o.data.price+r.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...o,context:{shopping:["checkout",0]},nested:[]},{entity:"product",...r,context:{shopping:["checkout",0]},nested:[]}],trigger:"load"},"order complete":{data:{id:"0rd3r1d",currency:"EUR",shipping:5.22,taxes:73.76,total:555},context:{shopping:["complete",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...o,context:{shopping:["complete",0]},nested:[]},{entity:"product",...r,context:{shopping:["complete",0]},nested:[]},{entity:"gift",data:{name:"Surprise"},context:{shopping:["complete",0]},nested:[]}],trigger:"load"},"page view":{data:{domain:"www.example.com",title:"walkerOS documentation",referrer:"https://www.elbwalker.com/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...o,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...o,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...o.data,position:3,promo:!0},context:{shopping:["discover",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"promotion visible":{data:{name:"Setting up tracking easily",position:"hero"},context:{ab_test:["engagement",0]},globals:{pagegroup:"homepage"},trigger:"visible"},"session start":{data:{id:"s3ss10n",start:n,isNew:!0,count:1,runs:1,isStart:!0,storage:!0,referrer:"",device:"c00k13"},user:{id:"us3r",device:"c00k13",session:"s3ss10n",hash:"h4sh",address:"street number",email:"user@example.com",phone:"+49 123 456 789",userAgent:"Mozilla...",browser:"Chrome",browserVersion:"90",deviceType:"desktop",language:"de-DE",country:"DE",region:"HH",city:"Hamburg",zip:"20354",timezone:"Berlin",os:"walkerOS",osVersion:"1.0",screenSize:"1337x420",ip:"127.0.0.0",internal:!0,custom:"value"}}}[e],...t,name:e})}function D(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function K(e,t={}){const n="clickId",o={},r={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:n,fbclid:n,gclid:n,msclkid:n,ttclid:n,twclid:n,igshid:n,sclid:n};return Object.entries(y(r,t)).forEach(([t,r])=>{const i=e.searchParams.get(t);i&&(r===n&&(r=t,o[n]=t),o[r]=i)}),o}function L(e,t=1e3,n=!1){let o,r=null,i=!1;return(...s)=>new Promise(c=>{const a=n&&!i;r&&clearTimeout(r),r=setTimeout(()=>{r=null,n&&!i||(o=e(...s),c(o))},t),a&&(i=!0,o=e(...s),c(o))})}function R(e,t=1e3){let n=null;return function(...o){if(null===n)return n=setTimeout(()=>{n=null},t),e(...o)}}function V(e){return w(e)||A(e)||k(e)||!x(e)||b(e)&&e.every(V)||S(e)&&Object.values(e).every(V)}function z(e){return w(e)||A(e)||k(e)?e:h(e)?z(Array.from(e)):b(e)?e.map(e=>z(e)).filter(e=>void 0!==e):S(e)?Object.entries(e).reduce((e,[t,n])=>{const o=z(n);return void 0!==o&&(e[t]=o),e},{}):void 0}function H(e){return V(e)?e:void 0}function U(e,t,n){return function(...o){try{return e(...o)}catch(e){if(!t)return;return t(e)}finally{n?.()}}}function W(e,t,n){return async function(...o){try{return await e(...o)}catch(e){if(!t)return;return await t(e)}finally{await(n?.())}}}async function q(e,t){const[n,o]=(e.name||"").split(" ");if(!t||!n||!o)return{};let r,i="",s=n,c=o;const a=t=>{if(t)return(t=b(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[s]||(s="*");const u=t[s];return u&&(u[c]||(c="*"),r=a(u[c])),r||(s="*",c="*",r=a(t[s]?.[c])),r&&(i=`${s} ${c}`),{eventMapping:r,mappingKey:i}}async function B(e,t={},n={}){if(!x(e))return;const o=S(e)&&e.consent||n.consent||n.collector?.consent,r=b(t)?t:[t];for(const t of r){const r=await W(F)(e,t,{...n,consent:o});if(x(r))return r}}async function F(e,t,n={}){const{collector:o,consent:r}=n;return(b(t)?t:[t]).reduce(async(t,i)=>{const s=await t;if(s)return s;const c=A(i)?{key:i}:i;if(!Object.keys(c).length)return;const{condition:a,consent:u,fn:l,key:p,loop:d,map:f,set:g,validate:m,value:y}=c;if(a&&!await W(a)(e,i,o))return;if(u&&!T(u,r))return y;let h=x(y)?y:e;if(l&&(h=await W(l)(e,i,n)),p&&(h=$(e,p,y)),d){const[t,o]=d,r="this"===t?[e]:await B(e,t,n);b(r)&&(h=(await Promise.all(r.map(e=>B(e,o,n)))).filter(x))}else f?h=await Object.entries(f).reduce(async(t,[o,r])=>{const i=await t,s=await B(e,r,n);return x(s)&&(i[o]=s),i},Promise.resolve({})):g&&(h=await Promise.all(g.map(t=>F(e,t,n))));m&&!await W(m)(h)&&(h=void 0);const w=H(h);return x(w)?w:H(y)},Promise.resolve(void 0))}async function X(e,t,n){t.policy&&await Promise.all(Object.entries(t.policy).map(async([t,o])=>{const r=await B(e,o,{collector:n});e=M(e,t,r)}));const{eventMapping:o,mappingKey:r}=await q(e,t.mapping);o?.policy&&await Promise.all(Object.entries(o.policy).map(async([t,o])=>{const r=await B(e,o,{collector:n});e=M(e,t,r)}));let i=t.data&&await B(e,t.data,{collector:n});if(o){if(o.ignore)return{event:e,data:i,mapping:o,mappingKey:r,ignore:!0};if(o.name&&(e.name=o.name),o.data){const t=o.data&&await B(e,o.data,{collector:n});i=S(i)&&S(t)?y(i,t):t}}return{event:e,data:i,mapping:o,mappingKey:r,ignore:!1}}function J(e,t){const n=(e,o=[])=>new Proxy(e,{get(e,r){const i=e[r],s=[...o,r];return"function"==typeof i?(...e)=>t(s,e,i):i&&"object"==typeof i?n(i,s):i}});return n(e)}function G(e,t){const n=(e,o=[])=>{if(!e||"object"!=typeof e)return e;const r=Array.isArray(e)?[]:{};for(const[i,s]of Object.entries(e)){const e=[...o,i];Array.isArray(r)?r[Number(i)]=t(s,e):r[i]=t(s,e),s&&"object"==typeof s&&"function"!=typeof s&&(Array.isArray(r)?r[Number(i)]=n(s,e):r[i]=n(s,e))}return r};return n(e)}function Q(e,t=!1){t&&console.dir(e,{depth:4})}function Y(e){const t=String(e),n=t.split("?")[1]||t;return U(()=>{const e=new URLSearchParams(n),t={};return e.forEach((e,n)=>{const o=n.split(/[[\]]+/).filter(Boolean);let r=t;o.forEach((t,n)=>{const i=n===o.length-1;if(b(r)){const s=parseInt(t,10);i?r[s]=N(e):(r[s]=r[s]||(isNaN(parseInt(o[n+1],10))?{}:[]),r=r[s])}else S(r)&&(i?r[t]=N(e):(r[t]=r[t]||(isNaN(parseInt(o[n+1],10))?{}:[]),r=r[t]))})}),t})()}function Z(e){if(!e)return"";const t=[],n=encodeURIComponent;function o(e,r){null!=r&&(b(r)?r.forEach((t,n)=>o(`${e}[${n}]`,t)):S(r)?Object.entries(r).forEach(([t,n])=>o(`${e}[${t}]`,n)):t.push(`${n(e)}=${n(String(r))}`))}return"object"!=typeof e?n(e):(Object.entries(e).forEach(([e,t])=>o(e,t)),t.join("&"))}function ee(e){return void 0===e||E(e,"")?e:JSON.stringify(e)}function te(e={}){return y({"Content-Type":"application/json; charset=utf-8"},e)}function ne(e){throw new Error(String(e))}function oe(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function re(e,t,n){return function(...o){let r;const i="post"+t,s=n["pre"+t],c=n[i];return r=s?s({fn:e},...o):e(...o),c&&(r=c({fn:e,result:r},...o)),r}}function ie(e){return e?{userAgent:e,browser:se(e),browserVersion:ce(e),os:ae(e),osVersion:ue(e),deviceType:le(e)}:{}}function se(e){const t=[{name:"Edge",substr:"Edg"},{name:"Chrome",substr:"Chrome"},{name:"Safari",substr:"Safari",exclude:"Chrome"},{name:"Firefox",substr:"Firefox"},{name:"IE",substr:"MSIE"},{name:"IE",substr:"Trident"}];for(const n of t)if(e.includes(n.substr)&&(!n.exclude||!e.includes(n.exclude)))return n.name}function ce(e){const t=[/Edg\/([0-9]+)/,/Chrome\/([0-9]+)/,/Version\/([0-9]+).*Safari/,/Firefox\/([0-9]+)/,/MSIE ([0-9]+)/,/rv:([0-9]+).*Trident/];for(const n of t){const t=e.match(n);if(t)return t[1]}}function ae(e){const t=[{name:"Windows",substr:"Windows NT"},{name:"macOS",substr:"Mac OS X"},{name:"Android",substr:"Android"},{name:"iOS",substr:"iPhone OS"},{name:"Linux",substr:"Linux"}];for(const n of t)if(e.includes(n.substr))return n.name}function ue(e){const t=e.match(/(?:Windows NT|Mac OS X|Android|iPhone OS) ([0-9._]+)/);return t?t[1].replace(/_/g,"."):void 0}function le(e){let t="Desktop";return/Tablet|iPad/i.test(e)?t="Tablet":/Mobi|Android|iPhone|iPod|BlackBerry|Opera Mini|IEMobile|WPDesktop/i.test(e)&&(t="Mobile"),t}function pe(e,t=[]){let n,o,r;E(e,{})||ne("Invalid object"),E(e.name,"")?(n=e.name,[o,r]=n.split(" "),o&&r||ne("Invalid event name")):E(e.entity,"")&&E(e.action,"")?(o=e.entity,r=e.action,n=`${o} ${r}`):ne("Missing or invalid name, entity, or action");const i={name:n,data:{},context:{},custom:{},globals:{},user:{},nested:[],consent:{},id:"",trigger:"",entity:o,action:r,timestamp:0,timing:0,group:"",count:0,version:{source:"",tagging:0},source:{type:"",id:"",previous_id:""}};return[{"*":{"*":{name:{maxLength:255},user:{allowedKeys:["id","device","session"]},consent:{allowedValues:[!0,!1]},timestamp:{min:0},timing:{min:0},count:{min:0},version:{allowedKeys:["source","tagging"]},source:{allowedKeys:["type","id","previous_id"]}}}}].concat(t).reduce((e,t)=>["*",o].reduce((e,n)=>["*",r].reduce((e,o)=>{const r=t[n]?.[o];return r?e.concat([r]):e},e),e),[]).reduce((t,n)=>{const o=Object.keys(n).filter(e=>{const t=n[e];return!0===t?.required});return[...Object.keys(e),...o].reduce((t,o)=>{const r=n[o];let i=e[o];return r&&(i=U(de,e=>{ne(String(e))})(t,o,i,r)),E(i,t[o])&&(t[o]=i),t},t)},i)}function de(e,t,n,o){if(o.validate&&(n=U(o.validate,e=>{ne(String(e))})(n,t,e)),o.required&&void 0===n&&ne("Missing required property"),E(n,""))o.maxLength&&n.length>o.maxLength&&(o.strict&&ne("Value exceeds maxLength"),n=n.substring(0,o.maxLength));else if(E(n,1))E(o.min,1)&&n<o.min?(o.strict&&ne("Value below min"),n=o.min):E(o.max,1)&&n>o.max&&(o.strict&&ne("Value exceeds max"),n=o.max);else if(E(n,{})){if(o.schema){const e=o.schema;Object.keys(e).reduce((t,n)=>{const o=e[n];let r=t[n];return o&&(o.type&&typeof r!==o.type&&ne(`Type doesn't match (${n})`),r=U(de,e=>{ne(String(e))})(t,n,r,o)),r},n)}for(const e of Object.keys(n))o.allowedKeys&&!o.allowedKeys.includes(e)&&(o.strict&&ne("Key not allowed"),delete n[e])}return n}export{e as Collector,f as Const,t as Data,n as Destination,o as Elb,r as Flow,i as Handler,s as Hooks,c as Mapping,a as On,u as Request,l as Schema,p as Source,d as WalkerOS,g as anonymizeIP,y as assign,H as castToProperty,N as castValue,P as clone,I as createDestination,C as createEvent,L as debounce,z as filterValues,se as getBrowser,ce as getBrowserVersion,$ as getByPath,le as getDeviceType,_ as getEvent,T as getGrantedConsent,te as getHeaders,D as getId,q as getMappingEvent,B as getMappingValue,K as getMarketingParameters,ae as getOS,ue as getOSVersion,h as isArguments,b as isArray,w as isBoolean,v as isCommand,x as isDefined,j as isElementOrDocument,O as isFunction,k as isNumber,S as isObject,V as isPropertyType,E as isSameType,A as isString,J as mockEnv,Q as onLog,ie as parseUserAgent,X as processEventMapping,Y as requestToData,Z as requestToParameter,M as setByPath,R as throttle,ne as throwError,ee as transformData,G as traverseEnv,oe as trim,U as tryCatch,W as tryCatchAsync,re as useHooks,pe as validateEvent,de as validateProperty};//# sourceMappingURL=index.mjs.map
|