@walkeros/core 0.4.1 → 0.4.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/dev.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,n=(n,i)=>{for(var o in i)e(n,o,{get:i[o],enumerable:!0})},i={};n(i,{BaseContextConfig:()=>B,BatchConfig:()=>N,CollectorSchemas:()=>cn,ConsentSchema:()=>X,Counter:()=>d,DeepPartialEventSchema:()=>re,DestinationReferenceSchema:()=>Nn,DestinationSchemas:()=>Me,DestinationsMapConfig:()=>A,DisabledConfig:()=>I,EntitiesSchema:()=>ie,EntitySchema:()=>ne,EventSchema:()=>oe,FlowConfigSchema:()=>Vn,FlowSchemas:()=>Tn,GenericEnvConfig:()=>z,GenericSettingsConfig:()=>L,HandlersConfig:()=>P,IdConfig:()=>D,Identifier:()=>c,InitConfig:()=>x,LoopSchema:()=>he,MapSchema:()=>ve,MappingResultSchema:()=>Pe,MappingSchemas:()=>be,OptionalPrimitiveValue:()=>m,OrderedPropertiesSchema:()=>$,PartialEventSchema:()=>te,PolicySchema:()=>we,PrimaryConfig:()=>R,PrimitiveSchema:()=>Un,PrimitiveValue:()=>u,ProcessingControlConfig:()=>V,PropertiesSchema:()=>F,PropertySchema:()=>Q,PropertyTypeSchema:()=>_,QueueConfig:()=>E,RequiredBoolean:()=>s,RequiredNumber:()=>a,RequiredString:()=>r,RuleSchema:()=>ke,RulesSchema:()=>Ce,RuntimeInstanceConfig:()=>U,SetSchema:()=>Se,SetupSchema:()=>Wn,SourceReferenceSchema:()=>Bn,SourceSchema:()=>ee,SourceSchemas:()=>Cn,SourceTypeSchema:()=>K,SourcesMapConfig:()=>W,TaggingVersion:()=>p,Timestamp:()=>l,UserSchema:()=>Y,UtilitySchemas:()=>b,ValueConfigSchema:()=>ye,ValueSchema:()=>ge,ValuesSchema:()=>fe,VerboseConfig:()=>J,VersionSchema:()=>Z,WalkerOSSchemas:()=>H,configJsonSchema:()=>Fn,consentJsonSchema:()=>me,createArraySchema:()=>Zn,createConsentConfig:()=>T,createDataTransformationConfig:()=>q,createEnumSchema:()=>ei,createMappingRulesConfig:()=>M,createObjectSchema:()=>Xn,createPolicyConfig:()=>O,createTupleSchema:()=>ni,destinationReferenceJsonSchema:()=>Kn,entityJsonSchema:()=>pe,eventJsonSchema:()=>ae,loopJsonSchema:()=>De,mapJsonSchema:()=>Ie,orderedPropertiesJsonSchema:()=>de,parseConfig:()=>Gn,parseSetup:()=>An,partialEventJsonSchema:()=>se,policyJsonSchema:()=>Re,propertiesJsonSchema:()=>le,ruleJsonSchema:()=>Le,rulesJsonSchema:()=>ze,safeParseConfig:()=>_n,safeParseSetup:()=>Hn,setJsonSchema:()=>xe,setupJsonSchema:()=>Qn,sourceReferenceJsonSchema:()=>$n,sourceTypeJsonSchema:()=>ue,userJsonSchema:()=>ce,valueConfigJsonSchema:()=>Ee,valueJsonSchema:()=>Je,z:()=>o,zodToSchema:()=>ii});import{z as o}from"zod";function t(e,n,i="draft-7"){return o.toJSONSchema(e,{target:i})}var r=o.string(),a=o.number(),s=o.boolean(),c=o.string().min(1),l=o.number().int().positive(),d=o.number().int().nonnegative(),p=o.number().describe("Tagging version number"),u=o.union([o.string(),o.number(),o.boolean()]),m=u.optional(),b={};n(b,{ErrorHandlerSchema:()=>h,HandlerSchema:()=>v,LogHandlerSchema:()=>S,StorageSchema:()=>f,StorageTypeSchema:()=>g,errorHandlerJsonSchema:()=>k,handlerJsonSchema:()=>j,logHandlerJsonSchema:()=>C,storageJsonSchema:()=>w,storageTypeJsonSchema:()=>y});var g=o.enum(["local","session","cookie"]).describe("Storage mechanism: local, session, or cookie"),f=o.object({Local:o.literal("local"),Session:o.literal("session"),Cookie:o.literal("cookie")}).describe("Storage type constants for type-safe references"),h=o.any().describe("Error handler function: (error, state?) => void"),S=o.any().describe("Log handler function: (message, verbose?) => void"),v=o.object({Error:h.describe("Error handler function"),Log:S.describe("Log handler function")}).describe("Handler interface with error and log functions"),y=t(g),w=t(f),k=t(h),C=t(S),j=t(v),P=o.object({onError:h.optional().describe("Error handler function: (error, state?) => void"),onLog:S.optional().describe("Log handler function: (message, verbose?) => void")}).partial(),J=o.object({verbose:o.boolean().describe("Enable verbose logging for debugging").optional()}).partial(),E=o.object({queue:o.boolean().describe("Whether to queue events when consent is not granted").optional()}).partial(),D=o.object({}).partial(),x=o.object({init:o.boolean().describe("Whether to initialize immediately").optional(),loadScript:o.boolean().describe("Whether to load external script (for web destinations)").optional()}).partial(),I=o.object({disabled:o.boolean().describe("Set to true to disable").optional()}).partial(),R=o.object({primary:o.boolean().describe("Mark as primary (only one can be primary)").optional()}).partial(),L=o.object({settings:o.any().optional().describe("Implementation-specific configuration")}).partial(),z=o.object({env:o.any().optional().describe("Environment dependencies (platform-specific)")}).partial();function q(e,n){return o.object({data:o.union([e,n]).optional().describe("Data transformation rules")}).partial()}function M(e){return o.object({mapping:e.optional().describe("Event mapping rules")}).partial()}function O(e){return o.object({policy:e.optional().describe("Pre-processing policy rules")}).partial()}function T(e){return o.object({consent:e.optional().describe("Required consent states")}).partial()}var U=o.object({type:o.string().optional().describe("Instance type identifier"),config:o.unknown().describe("Instance configuration")}).partial(),B=o.object({collector:o.unknown().describe("Collector instance (runtime object)"),config:o.unknown().describe("Configuration"),env:o.unknown().describe("Environment dependencies")}).partial(),N=o.object({batch:o.number().optional().describe("Batch size: bundle N events for batch processing"),batched:o.unknown().optional().describe("Batch of events to be processed")}).partial(),V=o.object({ignore:o.boolean().describe("Set to true to skip processing").optional(),condition:o.string().optional().describe("Condition function: return true to process")}).partial(),W=o.object({sources:o.record(o.string(),o.unknown()).describe("Map of source instances")}).partial(),A=o.object({destinations:o.record(o.string(),o.unknown()).describe("Map of destination instances")}).partial(),H={};n(H,{ConsentSchema:()=>X,DeepPartialEventSchema:()=>re,EntitiesSchema:()=>ie,EntitySchema:()=>ne,EventSchema:()=>oe,OrderedPropertiesSchema:()=>$,PartialEventSchema:()=>te,PropertiesSchema:()=>F,PropertySchema:()=>Q,PropertyTypeSchema:()=>_,SourceSchema:()=>ee,SourceTypeSchema:()=>K,UserSchema:()=>Y,VersionSchema:()=>Z,consentJsonSchema:()=>me,entityJsonSchema:()=>pe,eventJsonSchema:()=>ae,orderedPropertiesJsonSchema:()=>de,partialEventJsonSchema:()=>se,propertiesJsonSchema:()=>le,sourceTypeJsonSchema:()=>ue,userJsonSchema:()=>ce});var G,_=o.lazy(()=>o.union([o.boolean(),o.string(),o.number(),o.record(o.string(),Q)])),Q=o.lazy(()=>o.union([_,o.array(_)])),F=o.record(o.string(),Q.optional()).describe("Flexible property collection with optional values"),$=o.record(o.string(),o.tuple([Q,o.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control"),K=o.union([o.enum(["web","server","app","other"]),o.string()]).describe("Source type: web, server, app, other, or custom"),X=o.record(o.string(),o.boolean()).describe("Consent requirement mapping (group name → state)"),Y=F.and(o.object({id:o.string().optional().describe("User identifier"),device:o.string().optional().describe("Device identifier"),session:o.string().optional().describe("Session identifier"),hash:o.string().optional().describe("Hashed identifier"),address:o.string().optional().describe("User address"),email:o.string().email().optional().describe("User email address"),phone:o.string().optional().describe("User phone number"),userAgent:o.string().optional().describe("Browser user agent string"),browser:o.string().optional().describe("Browser name"),browserVersion:o.string().optional().describe("Browser version"),deviceType:o.string().optional().describe("Device type (mobile, desktop, tablet)"),os:o.string().optional().describe("Operating system"),osVersion:o.string().optional().describe("Operating system version"),screenSize:o.string().optional().describe("Screen dimensions"),language:o.string().optional().describe("User language"),country:o.string().optional().describe("User country"),region:o.string().optional().describe("User region/state"),city:o.string().optional().describe("User city"),zip:o.string().optional().describe("User postal code"),timezone:o.string().optional().describe("User timezone"),ip:o.string().optional().describe("User IP address"),internal:o.boolean().optional().describe("Internal user flag (employee, test user)")})).describe("User identification and properties"),Z=F.and(o.object({source:r.describe('Walker implementation version (e.g., "2.0.0")'),tagging:p})).describe("Walker version information"),ee=F.and(o.object({type:K.describe("Source type identifier"),id:r.describe("Source identifier (typically URL on web)"),previous_id:r.describe("Previous source identifier (typically referrer on web)")})).describe("Event source information"),ne=o.lazy(()=>o.object({entity:o.string().describe("Entity name"),data:F.describe("Entity-specific properties"),nested:o.array(ne).describe("Nested child entities"),context:$.describe("Entity context data")})).describe("Nested entity structure with recursive nesting support"),ie=o.array(ne).describe("Array of nested entities"),oe=o.object({name:o.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'),data:F.describe("Event-specific properties"),context:$.describe("Ordered context properties with priorities"),globals:F.describe("Global properties shared across events"),custom:F.describe("Custom implementation-specific properties"),user:Y.describe("User identification and attributes"),nested:ie.describe("Related nested entities"),consent:X.describe("Consent states at event time"),id:c.describe("Unique event identifier (timestamp-based)"),trigger:r.describe("Event trigger identifier"),entity:r.describe("Parsed entity from event name"),action:r.describe("Parsed action from event name"),timestamp:l.describe("Unix timestamp in milliseconds since epoch"),timing:a.describe("Event processing timing information"),group:r.describe("Event grouping identifier"),count:d.describe("Event count in session"),version:Z.describe("Walker version information"),source:ee.describe("Event source information")}).describe("Complete walkerOS event structure"),te=oe.partial().describe("Partial event structure with all fields optional"),re=oe.partial().describe("Partial event structure with all top-level fields optional"),ae=t(oe),se=t(te),ce=t(Y),le=t(F),de=t($),pe=t(ne),ue=t(K),me=t(X),be={};n(be,{ConfigSchema:()=>je,LoopSchema:()=>he,MapSchema:()=>ve,PolicySchema:()=>we,ResultSchema:()=>Pe,RuleSchema:()=>ke,RulesSchema:()=>Ce,SetSchema:()=>Se,ValueConfigSchema:()=>ye,ValueSchema:()=>ge,ValuesSchema:()=>fe,configJsonSchema:()=>qe,loopJsonSchema:()=>De,mapJsonSchema:()=>Ie,policyJsonSchema:()=>Re,ruleJsonSchema:()=>Le,rulesJsonSchema:()=>ze,setJsonSchema:()=>xe,valueConfigJsonSchema:()=>Ee,valueJsonSchema:()=>Je});var ge=o.lazy(()=>o.union([o.string().describe('String value or property path (e.g., "data.id")'),o.number().describe("Numeric value"),o.boolean().describe("Boolean value"),o.lazy(()=>G),o.array(ge).describe("Array of values")])),fe=o.array(ge).describe("Array of transformation values"),he=o.lazy(()=>o.tuple([ge,ge]).describe("Loop transformation: [source, transform] tuple for array processing")),Se=o.lazy(()=>o.array(ge).describe("Set: Array of values for selection or combination")),ve=o.lazy(()=>o.record(o.string(),ge).describe("Map: Object mapping keys to transformation values")),ye=G=o.object({key:o.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'),value:o.union([o.string(),o.number(),o.boolean()]).optional().describe("Static primitive value"),fn:o.string().optional().describe("Custom transformation function as string (serialized)"),map:ve.optional().describe("Object mapping: transform event data to structured output"),loop:he.optional().describe("Loop transformation: [source, transform] for array processing"),set:Se.optional().describe("Set of values: combine or select from multiple values"),consent:X.optional().describe("Required consent states to include this value"),condition:o.string().optional().describe("Condition function as string: return true to include value"),validate:o.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"),we=o.record(o.string(),ge).describe("Policy rules for event pre-processing (key → value mapping)"),ke=o.object({batch:o.number().optional().describe("Batch size: bundle N events for batch processing"),condition:o.string().optional().describe("Condition function as string: return true to process event"),consent:X.optional().describe("Required consent states to process this event"),settings:o.any().optional().describe("Destination-specific settings for this event mapping"),data:o.union([ge,fe]).optional().describe("Data transformation rules for event"),ignore:o.boolean().optional().describe("Set to true to skip processing this event"),name:o.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'),policy:we.optional().describe("Event-level policy overrides (applied after config-level policy)")}).describe("Mapping rule for specific entity-action combination"),Ce=o.record(o.string(),o.record(o.string(),o.union([ke,o.array(ke)])).optional()).describe("Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support"),je=o.object({consent:X.optional().describe("Required consent states to process any events"),data:o.union([ge,fe]).optional().describe("Global data transformation applied to all events"),mapping:Ce.optional().describe("Entity-action specific mapping rules"),policy:we.optional().describe("Pre-processing policy rules applied before mapping")}).describe("Shared mapping configuration for sources and destinations"),Pe=o.object({eventMapping:ke.optional().describe("Resolved mapping rule for event"),mappingKey:o.string().optional().describe('Mapping key used (e.g., "product.view")')}).describe("Mapping resolution result"),Je=t(ge),Ee=t(ye),De=t(he),xe=t(Se),Ie=t(ve),Re=t(we),Le=t(ke),ze=t(Ce),qe=t(je),Me={};n(Me,{BatchSchema:()=>He,ConfigSchema:()=>Oe,ContextSchema:()=>Be,DLQSchema:()=>Ze,DataSchema:()=>Ge,DestinationPolicySchema:()=>Ue,DestinationsSchema:()=>$e,InitDestinationsSchema:()=>Fe,InitSchema:()=>Qe,InstanceSchema:()=>_e,PartialConfigSchema:()=>Te,PushBatchContextSchema:()=>Ve,PushContextSchema:()=>Ne,PushEventSchema:()=>We,PushEventsSchema:()=>Ae,PushResultSchema:()=>Xe,RefSchema:()=>Ke,ResultSchema:()=>Ye,batchJsonSchema:()=>rn,configJsonSchema:()=>en,contextJsonSchema:()=>on,instanceJsonSchema:()=>an,partialConfigJsonSchema:()=>nn,pushContextJsonSchema:()=>tn,resultJsonSchema:()=>sn});var Oe=o.object({consent:X.optional().describe("Required consent states to send events to this destination"),settings:o.any().describe("Implementation-specific configuration").optional(),data:o.union([ge,fe]).optional().describe("Global data transformation applied to all events for this destination"),env:o.any().describe("Environment dependencies (platform-specific)").optional(),id:c.describe("Destination instance identifier (defaults to destination key)").optional(),init:o.boolean().describe("Whether to initialize immediately").optional(),loadScript:o.boolean().describe("Whether to load external script (for web destinations)").optional(),mapping:Ce.optional().describe("Entity-action specific mapping rules for this destination"),policy:we.optional().describe("Pre-processing policy rules applied before event mapping"),queue:o.boolean().describe("Whether to queue events when consent is not granted").optional(),verbose:o.boolean().describe("Enable verbose logging for debugging").optional(),onError:h.optional(),onLog:S.optional()}).describe("Destination configuration"),Te=Oe.partial().describe("Partial destination configuration with all fields optional"),Ue=we.describe("Destination policy rules for event pre-processing"),Be=o.object({collector:o.unknown().describe("Collector instance (runtime object)"),config:Oe.describe("Destination configuration"),data:o.union([o.unknown(),o.array(o.unknown())]).optional().describe("Transformed event data"),env:o.unknown().describe("Environment dependencies")}).describe("Destination context for init and push functions"),Ne=Be.extend({mapping:ke.optional().describe("Resolved mapping rule for this specific event")}).describe("Push context with event-specific mapping"),Ve=Ne.describe("Batch push context with event-specific mapping"),We=o.object({event:oe.describe("The event to process"),mapping:ke.optional().describe("Mapping rule for this event")}).describe("Event with optional mapping for batch processing"),Ae=o.array(We).describe("Array of events with mappings"),He=o.object({key:o.string().describe('Batch key (usually mapping key like "product.view")'),events:o.array(oe).describe("Array of events in batch"),data:o.array(o.union([o.unknown(),o.array(o.unknown())]).optional()).describe("Transformed data for each event"),mapping:ke.optional().describe("Shared mapping rule for batch")}).describe("Batch of events grouped by mapping key"),Ge=o.union([o.unknown(),o.array(o.unknown())]).optional().describe("Transformed event data (Property, undefined, or array)"),_e=o.object({config:Oe.describe("Destination configuration"),queue:o.array(oe).optional().describe("Queued events awaiting consent"),dlq:o.array(o.tuple([oe,o.unknown()])).optional().describe("Dead letter queue (failed events with errors)"),type:o.string().optional().describe("Destination type identifier"),env:o.unknown().optional().describe("Environment dependencies"),init:o.unknown().optional().describe("Initialization function"),push:o.unknown().describe("Push function for single events"),pushBatch:o.unknown().optional().describe("Batch push function"),on:o.unknown().optional().describe("Event lifecycle hook function")}).describe("Destination instance (runtime object with functions)"),Qe=o.object({code:_e.describe("Destination instance with implementation"),config:Te.optional().describe("Partial configuration overrides"),env:o.unknown().optional().describe("Partial environment overrides")}).describe("Destination initialization configuration"),Fe=o.record(o.string(),Qe).describe("Map of destination IDs to initialization configurations"),$e=o.record(o.string(),_e).describe("Map of destination IDs to runtime instances"),Ke=o.object({id:o.string().describe("Destination ID"),destination:_e.describe("Destination instance")}).describe("Destination reference (ID + instance)"),Xe=o.object({queue:o.array(oe).optional().describe("Events queued (awaiting consent)"),error:o.unknown().optional().describe("Error if push failed")}).describe("Push operation result"),Ye=o.object({successful:o.array(Ke).describe("Destinations that processed successfully"),queued:o.array(Ke).describe("Destinations that queued events"),failed:o.array(Ke).describe("Destinations that failed to process")}).describe("Overall destination processing result"),Ze=o.array(o.tuple([oe,o.unknown()])).describe("Dead letter queue: [(event, error), ...]"),en=t(Oe),nn=t(Te),on=t(Be),tn=t(Ne),rn=t(He),an=t(_e),sn=t(Ye),cn={};n(cn,{CommandTypeSchema:()=>ln,ConfigSchema:()=>dn,DestinationsSchema:()=>gn,InitConfigSchema:()=>un,InstanceSchema:()=>fn,PushContextSchema:()=>mn,SessionDataSchema:()=>pn,SourcesSchema:()=>bn,commandTypeJsonSchema:()=>hn,configJsonSchema:()=>Sn,initConfigJsonSchema:()=>yn,instanceJsonSchema:()=>kn,pushContextJsonSchema:()=>wn,sessionDataJsonSchema:()=>vn});var ln=o.union([o.enum(["action","config","consent","context","destination","elb","globals","hook","init","link","run","user","walker"]),o.string()]).describe("Collector command type: standard commands or custom string for extensions"),dn=o.object({run:o.boolean().describe("Whether to run collector automatically on initialization").optional(),tagging:p,globalsStatic:F.describe("Static global properties that persist across collector runs"),sessionStatic:o.record(o.string(),o.unknown()).describe("Static session data that persists across collector runs"),verbose:o.boolean().describe("Enable verbose logging for debugging"),onError:h.optional(),onLog:S.optional()}).describe("Core collector configuration"),pn=F.and(o.object({isStart:o.boolean().describe("Whether this is a new session start"),storage:o.boolean().describe("Whether storage is available"),id:c.describe("Session identifier").optional(),start:l.describe("Session start timestamp").optional(),marketing:o.literal(!0).optional().describe("Marketing attribution flag"),updated:l.describe("Last update timestamp").optional(),isNew:o.boolean().describe("Whether this is a new session").optional(),device:c.describe("Device identifier").optional(),count:d.describe("Event count in session").optional(),runs:d.describe("Number of runs").optional()})).describe("Session state and tracking data"),un=dn.partial().extend({consent:X.optional().describe("Initial consent state"),user:Y.optional().describe("Initial user data"),globals:F.optional().describe("Initial global properties"),sources:o.unknown().optional().describe("Source configurations"),destinations:o.unknown().optional().describe("Destination configurations"),custom:F.optional().describe("Initial custom implementation-specific properties")}).describe("Collector initialization configuration with initial state"),mn=o.object({mapping:je.optional().describe("Source-level mapping configuration")}).describe("Push context with optional source mapping"),bn=o.record(o.string(),o.unknown()).describe("Map of source IDs to source instances"),gn=o.record(o.string(),o.unknown()).describe("Map of destination IDs to destination instances"),fn=o.object({push:o.unknown().describe("Push function for processing events"),command:o.unknown().describe("Command function for walker commands"),allowed:o.boolean().describe("Whether event processing is allowed"),config:dn.describe("Current collector configuration"),consent:X.describe("Current consent state"),count:o.number().describe("Event count (increments with each event)"),custom:F.describe("Custom implementation-specific properties"),sources:bn.describe("Registered source instances"),destinations:gn.describe("Registered destination instances"),globals:F.describe("Current global properties"),group:o.string().describe("Event grouping identifier"),hooks:o.unknown().describe("Lifecycle hook functions"),on:o.unknown().describe("Event lifecycle configuration"),queue:o.array(oe).describe("Queued events awaiting processing"),round:o.number().describe("Collector run count (increments with each run)"),session:o.union([pn]).describe("Current session state"),timing:o.number().describe("Event processing timing information"),user:Y.describe("Current user data"),version:o.string().describe("Walker implementation version")}).describe("Collector instance with state and methods"),hn=t(ln),Sn=t(dn),vn=t(pn),yn=t(un),wn=t(mn),kn=t(fn),Cn={};n(Cn,{BaseEnvSchema:()=>jn,ConfigSchema:()=>Pn,InitSchema:()=>Dn,InitSourceSchema:()=>xn,InitSourcesSchema:()=>In,InstanceSchema:()=>En,PartialConfigSchema:()=>Jn,baseEnvJsonSchema:()=>Rn,configJsonSchema:()=>Ln,initSourceJsonSchema:()=>Mn,initSourcesJsonSchema:()=>On,instanceJsonSchema:()=>qn,partialConfigJsonSchema:()=>zn});var jn=o.object({push:o.unknown().describe("Collector push function"),command:o.unknown().describe("Collector command function"),sources:o.unknown().optional().describe("Map of registered source instances"),elb:o.unknown().describe("Public API function (alias for collector.push)")}).catchall(o.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this"),Pn=je.extend({settings:o.any().describe("Implementation-specific configuration").optional(),env:jn.optional().describe("Environment dependencies (platform-specific)"),id:c.describe("Source identifier (defaults to source key)").optional(),onError:h.optional(),disabled:o.boolean().describe("Set to true to disable").optional(),primary:o.boolean().describe("Mark as primary (only one can be primary)").optional()}).describe("Source configuration with mapping and environment"),Jn=Pn.partial().describe("Partial source configuration with all fields optional"),En=o.object({type:o.string().describe('Source type identifier (e.g., "browser", "dataLayer")'),config:Pn.describe("Current source configuration"),push:o.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"),destroy:o.any().optional().describe("Cleanup function called when source is removed"),on:o.unknown().optional().describe("Lifecycle hook function for event types")}).describe("Source instance with push handler and lifecycle methods"),Dn=o.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>"),xn=o.object({code:Dn.describe("Source initialization function"),config:Jn.optional().describe("Partial configuration overrides"),env:jn.partial().optional().describe("Partial environment overrides"),primary:o.boolean().optional().describe("Mark as primary source (only one can be primary)")}).describe("Source initialization configuration"),In=o.record(o.string(),xn).describe("Map of source IDs to initialization configurations"),Rn=t(jn),Ln=t(Pn),zn=t(Jn),qn=t(En),Mn=t(xn),On=t(In),Tn={};n(Tn,{ConfigSchema:()=>Vn,DestinationReferenceSchema:()=>Nn,PrimitiveSchema:()=>Un,SetupSchema:()=>Wn,SourceReferenceSchema:()=>Bn,configJsonSchema:()=>Fn,destinationReferenceJsonSchema:()=>Kn,parseConfig:()=>Gn,parseSetup:()=>An,safeParseConfig:()=>_n,safeParseSetup:()=>Hn,setupJsonSchema:()=>Qn,sourceReferenceJsonSchema:()=>$n});var Un=o.union([o.string(),o.number(),o.boolean()]).describe("Primitive value: string, number, or boolean"),Bn=o.object({package:o.string().min(1,"Package name cannot be empty").describe('Package specifier with optional version (e.g., "@walkeros/web-source-browser@2.0.0")'),config:o.unknown().optional().describe("Source-specific configuration object"),env:o.unknown().optional().describe("Source environment configuration"),primary:o.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary.")}).describe("Source package reference with configuration"),Nn=o.object({package:o.string().min(1,"Package name cannot be empty").describe('Package specifier with optional version (e.g., "@walkeros/web-destination-gtag@2.0.0")'),config:o.unknown().optional().describe("Destination-specific configuration object"),env:o.unknown().optional().describe("Destination environment configuration")}).describe("Destination package reference with configuration"),Vn=o.object({platform:o.enum(["web","server"],{error:'Platform must be "web" or "server"'}).describe('Target platform: "web" for browser-based tracking, "server" for Node.js server-side collection'),sources:o.record(o.string(),Bn).optional().describe("Source configurations (data capture) keyed by unique identifier"),destinations:o.record(o.string(),Nn).optional().describe("Destination configurations (data output) keyed by unique identifier"),collector:o.unknown().optional().describe("Collector configuration for event processing (uses Collector.InitConfig)"),env:o.record(o.string(),o.string()).optional().describe("Environment-specific variables (override root-level variables)")}).passthrough().describe("Single environment configuration for one deployment target"),Wn=o.object({version:o.literal(1,{error:"Only version 1 is currently supported"}).describe("Configuration schema version (currently only 1 is supported)"),$schema:o.string().url("Schema URL must be a valid URL").optional().describe('JSON Schema reference for IDE validation (e.g., "https://walkeros.io/schema/flow/v1.json")'),variables:o.record(o.string(),Un).optional().describe("Shared variables for interpolation across all environments (use ${VAR_NAME:default} syntax)"),definitions:o.record(o.string(),o.unknown()).optional().describe("Reusable configuration definitions (reference with JSON Schema $ref syntax)"),environments:o.record(o.string(),Vn).refine(e=>Object.keys(e).length>0,{message:"At least one environment is required"}).describe("Named environment configurations (e.g., web_prod, server_stage)")}).describe("Complete multi-environment walkerOS configuration (walkeros.config.json)");function An(e){return Wn.parse(e)}function Hn(e){return Wn.safeParse(e)}function Gn(e){return Vn.parse(e)}function _n(e){return Vn.safeParse(e)}var Qn=o.toJSONSchema(Wn,{target:"draft-7"}),Fn=t(Vn),$n=t(Bn),Kn=t(Nn);function Xn(e,n){const i=[],o={};for(const[n,t]of Object.entries(e)){t.required&&i.push(n);const e={type:t.type};if(t.description&&(e.description=t.description),t.pattern&&(e.pattern=t.pattern),void 0!==t.minLength&&(e.minLength=t.minLength),void 0!==t.maxLength&&(e.maxLength=t.maxLength),void 0!==t.minimum&&(e.minimum=t.minimum),void 0!==t.maximum&&(e.maximum=t.maximum),t.enum&&(e.enum=[...t.enum]),void 0!==t.default&&(e.default=t.default),"object"===t.type&&t.properties){const n={};for(const[e,i]of Object.entries(t.properties))n[e]=Yn(i);e.properties=n}"array"===t.type&&t.items&&(e.items=Yn(t.items)),o[n]=e}const t={type:"object",properties:o};return n&&(t.title=n),i.length>0&&(t.required=i),t}function Yn(e){const n={type:e.type};if(e.description&&(n.description=e.description),e.pattern&&(n.pattern=e.pattern),void 0!==e.minLength&&(n.minLength=e.minLength),void 0!==e.maxLength&&(n.maxLength=e.maxLength),void 0!==e.minimum&&(n.minimum=e.minimum),void 0!==e.maximum&&(n.maximum=e.maximum),e.enum&&(n.enum=[...e.enum]),void 0!==e.default&&(n.default=e.default),"object"===e.type&&e.properties){const i={};for(const[n,o]of Object.entries(e.properties))i[n]=Yn(o);n.properties=i}return"array"===e.type&&e.items&&(n.items=Yn(e.items)),n}function Zn(e,n){const i={type:"array",items:Yn(e)};return void 0!==n?.minItems&&(i.minItems=n.minItems),void 0!==n?.maxItems&&(i.maxItems=n.maxItems),n?.description&&(i.description=n.description),n?.title&&(i.title=n.title),i}function ei(e,n="string",i){const o={type:n,enum:[...e]};return i?.description&&(o.description=i.description),i?.title&&(o.title=i.title),o}function ni(e,n,i){return Zn({type:"object"},{minItems:2,maxItems:2,description:i||"Tuple with exactly 2 elements [source, transform]"})}function ii(e){return o.toJSONSchema(e,{target:"draft-7"})}export{i as schemas,o as z,ii as zodToSchema};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,i=(i,n)=>{for(var o in n)e(i,o,{get:n[o],enumerable:!0})},n={};i(n,{BaseContextConfig:()=>U,BatchConfig:()=>V,CollectorSchemas:()=>si,ConsentSchema:()=>X,Counter:()=>d,DeepPartialEventSchema:()=>re,DestinationReferenceSchema:()=>Hi,DestinationSchemas:()=>qe,DestinationsMapConfig:()=>A,DisabledConfig:()=>I,EntitiesSchema:()=>ne,EntitySchema:()=>ie,EventSchema:()=>oe,FlowConfigSchema:()=>Fi,FlowSchemas:()=>Oi,GenericEnvConfig:()=>M,GenericSettingsConfig:()=>L,HandlersConfig:()=>P,IdConfig:()=>D,Identifier:()=>c,InitConfig:()=>x,LoopSchema:()=>he,MapSchema:()=>ve,MappingResultSchema:()=>Pe,MappingSchemas:()=>be,OptionalPrimitiveValue:()=>m,OrderedPropertiesSchema:()=>_,PartialEventSchema:()=>te,PolicySchema:()=>we,PrimaryConfig:()=>R,PrimitiveSchema:()=>Ti,PrimitiveValue:()=>u,ProcessingControlConfig:()=>W,PropertiesSchema:()=>Q,PropertySchema:()=>$,PropertyTypeSchema:()=>G,QueueConfig:()=>E,RequiredBoolean:()=>s,RequiredNumber:()=>a,RequiredString:()=>r,RuleSchema:()=>ke,RulesSchema:()=>Ce,RuntimeInstanceConfig:()=>N,SetSchema:()=>Se,SetupSchema:()=>Gi,SourceReferenceSchema:()=>Ai,SourceSchema:()=>ee,SourceSchemas:()=>ki,SourceTypeSchema:()=>K,SourcesMapConfig:()=>B,TaggingVersion:()=>p,Timestamp:()=>l,UserSchema:()=>Y,UtilitySchemas:()=>b,ValueConfigSchema:()=>ye,ValueSchema:()=>ge,ValuesSchema:()=>fe,VerboseConfig:()=>J,VersionSchema:()=>Z,WalkerOSSchemas:()=>H,configJsonSchema:()=>Yi,consentJsonSchema:()=>me,createArraySchema:()=>tn,createConsentConfig:()=>T,createDataTransformationConfig:()=>z,createEnumSchema:()=>rn,createMappingRulesConfig:()=>q,createObjectSchema:()=>nn,createPolicyConfig:()=>O,createTupleSchema:()=>an,destinationReferenceJsonSchema:()=>en,entityJsonSchema:()=>pe,eventJsonSchema:()=>ae,loopJsonSchema:()=>De,mapJsonSchema:()=>Ie,orderedPropertiesJsonSchema:()=>de,parseConfig:()=>_i,parseSetup:()=>$i,partialEventJsonSchema:()=>se,policyJsonSchema:()=>Re,propertiesJsonSchema:()=>le,ruleJsonSchema:()=>Le,rulesJsonSchema:()=>Me,safeParseConfig:()=>Ki,safeParseSetup:()=>Qi,setJsonSchema:()=>xe,setupJsonSchema:()=>Xi,sourceReferenceJsonSchema:()=>Zi,sourceTypeJsonSchema:()=>ue,userJsonSchema:()=>ce,valueConfigJsonSchema:()=>Ee,valueJsonSchema:()=>Je,z:()=>o,zodToSchema:()=>sn});import{z as o}from"zod";function t(e,i,n="draft-7"){return o.toJSONSchema(e,{target:n})}var r=o.string(),a=o.number(),s=o.boolean(),c=o.string().min(1),l=o.number().int().positive(),d=o.number().int().nonnegative(),p=o.number().describe("Tagging version number"),u=o.union([o.string(),o.number(),o.boolean()]),m=u.optional(),b={};i(b,{ErrorHandlerSchema:()=>h,HandlerSchema:()=>v,LogHandlerSchema:()=>S,StorageSchema:()=>f,StorageTypeSchema:()=>g,errorHandlerJsonSchema:()=>k,handlerJsonSchema:()=>j,logHandlerJsonSchema:()=>C,storageJsonSchema:()=>w,storageTypeJsonSchema:()=>y});var g=o.enum(["local","session","cookie"]).describe("Storage mechanism: local, session, or cookie"),f=o.object({Local:o.literal("local"),Session:o.literal("session"),Cookie:o.literal("cookie")}).describe("Storage type constants for type-safe references"),h=o.any().describe("Error handler function: (error, state?) => void"),S=o.any().describe("Log handler function: (message, verbose?) => void"),v=o.object({Error:h.describe("Error handler function"),Log:S.describe("Log handler function")}).describe("Handler interface with error and log functions"),y=t(g),w=t(f),k=t(h),C=t(S),j=t(v),P=o.object({onError:h.optional().describe("Error handler function: (error, state?) => void"),onLog:S.optional().describe("Log handler function: (message, verbose?) => void")}).partial(),J=o.object({verbose:o.boolean().describe("Enable verbose logging for debugging").optional()}).partial(),E=o.object({queue:o.boolean().describe("Whether to queue events when consent is not granted").optional()}).partial(),D=o.object({}).partial(),x=o.object({init:o.boolean().describe("Whether to initialize immediately").optional(),loadScript:o.boolean().describe("Whether to load external script (for web destinations)").optional()}).partial(),I=o.object({disabled:o.boolean().describe("Set to true to disable").optional()}).partial(),R=o.object({primary:o.boolean().describe("Mark as primary (only one can be primary)").optional()}).partial(),L=o.object({settings:o.any().optional().describe("Implementation-specific configuration")}).partial(),M=o.object({env:o.any().optional().describe("Environment dependencies (platform-specific)")}).partial();function z(e,i){return o.object({data:o.union([e,i]).optional().describe("Data transformation rules")}).partial()}function q(e){return o.object({mapping:e.optional().describe("Event mapping rules")}).partial()}function O(e){return o.object({policy:e.optional().describe("Pre-processing policy rules")}).partial()}function T(e){return o.object({consent:e.optional().describe("Required consent states")}).partial()}var N=o.object({type:o.string().optional().describe("Instance type identifier"),config:o.unknown().describe("Instance configuration")}).partial(),U=o.object({collector:o.unknown().describe("Collector instance (runtime object)"),config:o.unknown().describe("Configuration"),env:o.unknown().describe("Environment dependencies")}).partial(),V=o.object({batch:o.number().optional().describe("Batch size: bundle N events for batch processing"),batched:o.unknown().optional().describe("Batch of events to be processed")}).partial(),W=o.object({ignore:o.boolean().describe("Set to true to skip processing").optional(),condition:o.string().optional().describe("Condition function: return true to process")}).partial(),B=o.object({sources:o.record(o.string(),o.unknown()).describe("Map of source instances")}).partial(),A=o.object({destinations:o.record(o.string(),o.unknown()).describe("Map of destination instances")}).partial(),H={};i(H,{ConsentSchema:()=>X,DeepPartialEventSchema:()=>re,EntitiesSchema:()=>ne,EntitySchema:()=>ie,EventSchema:()=>oe,OrderedPropertiesSchema:()=>_,PartialEventSchema:()=>te,PropertiesSchema:()=>Q,PropertySchema:()=>$,PropertyTypeSchema:()=>G,SourceSchema:()=>ee,SourceTypeSchema:()=>K,UserSchema:()=>Y,VersionSchema:()=>Z,consentJsonSchema:()=>me,entityJsonSchema:()=>pe,eventJsonSchema:()=>ae,orderedPropertiesJsonSchema:()=>de,partialEventJsonSchema:()=>se,propertiesJsonSchema:()=>le,sourceTypeJsonSchema:()=>ue,userJsonSchema:()=>ce});var F,G=o.lazy(()=>o.union([o.boolean(),o.string(),o.number(),o.record(o.string(),$)])),$=o.lazy(()=>o.union([G,o.array(G)])),Q=o.record(o.string(),$.optional()).describe("Flexible property collection with optional values"),_=o.record(o.string(),o.tuple([$,o.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control"),K=o.union([o.enum(["web","server","app","other"]),o.string()]).describe("Source type: web, server, app, other, or custom"),X=o.record(o.string(),o.boolean()).describe("Consent requirement mapping (group name → state)"),Y=Q.and(o.object({id:o.string().optional().describe("User identifier"),device:o.string().optional().describe("Device identifier"),session:o.string().optional().describe("Session identifier"),hash:o.string().optional().describe("Hashed identifier"),address:o.string().optional().describe("User address"),email:o.string().email().optional().describe("User email address"),phone:o.string().optional().describe("User phone number"),userAgent:o.string().optional().describe("Browser user agent string"),browser:o.string().optional().describe("Browser name"),browserVersion:o.string().optional().describe("Browser version"),deviceType:o.string().optional().describe("Device type (mobile, desktop, tablet)"),os:o.string().optional().describe("Operating system"),osVersion:o.string().optional().describe("Operating system version"),screenSize:o.string().optional().describe("Screen dimensions"),language:o.string().optional().describe("User language"),country:o.string().optional().describe("User country"),region:o.string().optional().describe("User region/state"),city:o.string().optional().describe("User city"),zip:o.string().optional().describe("User postal code"),timezone:o.string().optional().describe("User timezone"),ip:o.string().optional().describe("User IP address"),internal:o.boolean().optional().describe("Internal user flag (employee, test user)")})).describe("User identification and properties"),Z=Q.and(o.object({source:r.describe('Walker implementation version (e.g., "2.0.0")'),tagging:p})).describe("Walker version information"),ee=Q.and(o.object({type:K.describe("Source type identifier"),id:r.describe("Source identifier (typically URL on web)"),previous_id:r.describe("Previous source identifier (typically referrer on web)")})).describe("Event source information"),ie=o.lazy(()=>o.object({entity:o.string().describe("Entity name"),data:Q.describe("Entity-specific properties"),nested:o.array(ie).describe("Nested child entities"),context:_.describe("Entity context data")})).describe("Nested entity structure with recursive nesting support"),ne=o.array(ie).describe("Array of nested entities"),oe=o.object({name:o.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'),data:Q.describe("Event-specific properties"),context:_.describe("Ordered context properties with priorities"),globals:Q.describe("Global properties shared across events"),custom:Q.describe("Custom implementation-specific properties"),user:Y.describe("User identification and attributes"),nested:ne.describe("Related nested entities"),consent:X.describe("Consent states at event time"),id:c.describe("Unique event identifier (timestamp-based)"),trigger:r.describe("Event trigger identifier"),entity:r.describe("Parsed entity from event name"),action:r.describe("Parsed action from event name"),timestamp:l.describe("Unix timestamp in milliseconds since epoch"),timing:a.describe("Event processing timing information"),group:r.describe("Event grouping identifier"),count:d.describe("Event count in session"),version:Z.describe("Walker version information"),source:ee.describe("Event source information")}).describe("Complete walkerOS event structure"),te=oe.partial().describe("Partial event structure with all fields optional"),re=oe.partial().describe("Partial event structure with all top-level fields optional"),ae=t(oe),se=t(te),ce=t(Y),le=t(Q),de=t(_),pe=t(ie),ue=t(K),me=t(X),be={};i(be,{ConfigSchema:()=>je,LoopSchema:()=>he,MapSchema:()=>ve,PolicySchema:()=>we,ResultSchema:()=>Pe,RuleSchema:()=>ke,RulesSchema:()=>Ce,SetSchema:()=>Se,ValueConfigSchema:()=>ye,ValueSchema:()=>ge,ValuesSchema:()=>fe,configJsonSchema:()=>ze,loopJsonSchema:()=>De,mapJsonSchema:()=>Ie,policyJsonSchema:()=>Re,ruleJsonSchema:()=>Le,rulesJsonSchema:()=>Me,setJsonSchema:()=>xe,valueConfigJsonSchema:()=>Ee,valueJsonSchema:()=>Je});var ge=o.lazy(()=>o.union([o.string().describe('String value or property path (e.g., "data.id")'),o.number().describe("Numeric value"),o.boolean().describe("Boolean value"),o.lazy(()=>F),o.array(ge).describe("Array of values")])),fe=o.array(ge).describe("Array of transformation values"),he=o.lazy(()=>o.tuple([ge,ge]).describe("Loop transformation: [source, transform] tuple for array processing")),Se=o.lazy(()=>o.array(ge).describe("Set: Array of values for selection or combination")),ve=o.lazy(()=>o.record(o.string(),ge).describe("Map: Object mapping keys to transformation values")),ye=F=o.object({key:o.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'),value:o.union([o.string(),o.number(),o.boolean()]).optional().describe("Static primitive value"),fn:o.string().optional().describe("Custom transformation function as string (serialized)"),map:ve.optional().describe("Object mapping: transform event data to structured output"),loop:he.optional().describe("Loop transformation: [source, transform] for array processing"),set:Se.optional().describe("Set of values: combine or select from multiple values"),consent:X.optional().describe("Required consent states to include this value"),condition:o.string().optional().describe("Condition function as string: return true to include value"),validate:o.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"),we=o.record(o.string(),ge).describe("Policy rules for event pre-processing (key → value mapping)"),ke=o.object({batch:o.number().optional().describe("Batch size: bundle N events for batch processing"),condition:o.string().optional().describe("Condition function as string: return true to process event"),consent:X.optional().describe("Required consent states to process this event"),settings:o.any().optional().describe("Destination-specific settings for this event mapping"),data:o.union([ge,fe]).optional().describe("Data transformation rules for event"),ignore:o.boolean().optional().describe("Set to true to skip processing this event"),name:o.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'),policy:we.optional().describe("Event-level policy overrides (applied after config-level policy)")}).describe("Mapping rule for specific entity-action combination"),Ce=o.record(o.string(),o.record(o.string(),o.union([ke,o.array(ke)])).optional()).describe("Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support"),je=o.object({consent:X.optional().describe("Required consent states to process any events"),data:o.union([ge,fe]).optional().describe("Global data transformation applied to all events"),mapping:Ce.optional().describe("Entity-action specific mapping rules"),policy:we.optional().describe("Pre-processing policy rules applied before mapping")}).describe("Shared mapping configuration for sources and destinations"),Pe=o.object({eventMapping:ke.optional().describe("Resolved mapping rule for event"),mappingKey:o.string().optional().describe('Mapping key used (e.g., "product.view")')}).describe("Mapping resolution result"),Je=t(ge),Ee=t(ye),De=t(he),xe=t(Se),Ie=t(ve),Re=t(we),Le=t(ke),Me=t(Ce),ze=t(je),qe={};i(qe,{BatchSchema:()=>He,ConfigSchema:()=>Oe,ContextSchema:()=>Ue,DLQSchema:()=>Ze,DataSchema:()=>Fe,DestinationPolicySchema:()=>Ne,DestinationsSchema:()=>_e,InitDestinationsSchema:()=>Qe,InitSchema:()=>$e,InstanceSchema:()=>Ge,PartialConfigSchema:()=>Te,PushBatchContextSchema:()=>We,PushContextSchema:()=>Ve,PushEventSchema:()=>Be,PushEventsSchema:()=>Ae,PushResultSchema:()=>Xe,RefSchema:()=>Ke,ResultSchema:()=>Ye,batchJsonSchema:()=>ti,configJsonSchema:()=>ei,contextJsonSchema:()=>ni,instanceJsonSchema:()=>ri,partialConfigJsonSchema:()=>ii,pushContextJsonSchema:()=>oi,resultJsonSchema:()=>ai});var Oe=o.object({consent:X.optional().describe("Required consent states to send events to this destination"),settings:o.any().describe("Implementation-specific configuration").optional(),data:o.union([ge,fe]).optional().describe("Global data transformation applied to all events for this destination"),env:o.any().describe("Environment dependencies (platform-specific)").optional(),id:c.describe("Destination instance identifier (defaults to destination key)").optional(),init:o.boolean().describe("Whether to initialize immediately").optional(),loadScript:o.boolean().describe("Whether to load external script (for web destinations)").optional(),mapping:Ce.optional().describe("Entity-action specific mapping rules for this destination"),policy:we.optional().describe("Pre-processing policy rules applied before event mapping"),queue:o.boolean().describe("Whether to queue events when consent is not granted").optional(),verbose:o.boolean().describe("Enable verbose logging for debugging").optional(),onError:h.optional(),onLog:S.optional()}).describe("Destination configuration"),Te=Oe.partial().describe("Partial destination configuration with all fields optional"),Ne=we.describe("Destination policy rules for event pre-processing"),Ue=o.object({collector:o.unknown().describe("Collector instance (runtime object)"),config:Oe.describe("Destination configuration"),data:o.union([o.unknown(),o.array(o.unknown())]).optional().describe("Transformed event data"),env:o.unknown().describe("Environment dependencies")}).describe("Destination context for init and push functions"),Ve=Ue.extend({mapping:ke.optional().describe("Resolved mapping rule for this specific event")}).describe("Push context with event-specific mapping"),We=Ve.describe("Batch push context with event-specific mapping"),Be=o.object({event:oe.describe("The event to process"),mapping:ke.optional().describe("Mapping rule for this event")}).describe("Event with optional mapping for batch processing"),Ae=o.array(Be).describe("Array of events with mappings"),He=o.object({key:o.string().describe('Batch key (usually mapping key like "product.view")'),events:o.array(oe).describe("Array of events in batch"),data:o.array(o.union([o.unknown(),o.array(o.unknown())]).optional()).describe("Transformed data for each event"),mapping:ke.optional().describe("Shared mapping rule for batch")}).describe("Batch of events grouped by mapping key"),Fe=o.union([o.unknown(),o.array(o.unknown())]).optional().describe("Transformed event data (Property, undefined, or array)"),Ge=o.object({config:Oe.describe("Destination configuration"),queue:o.array(oe).optional().describe("Queued events awaiting consent"),dlq:o.array(o.tuple([oe,o.unknown()])).optional().describe("Dead letter queue (failed events with errors)"),type:o.string().optional().describe("Destination type identifier"),env:o.unknown().optional().describe("Environment dependencies"),init:o.unknown().optional().describe("Initialization function"),push:o.unknown().describe("Push function for single events"),pushBatch:o.unknown().optional().describe("Batch push function"),on:o.unknown().optional().describe("Event lifecycle hook function")}).describe("Destination instance (runtime object with functions)"),$e=o.object({code:Ge.describe("Destination instance with implementation"),config:Te.optional().describe("Partial configuration overrides"),env:o.unknown().optional().describe("Partial environment overrides")}).describe("Destination initialization configuration"),Qe=o.record(o.string(),$e).describe("Map of destination IDs to initialization configurations"),_e=o.record(o.string(),Ge).describe("Map of destination IDs to runtime instances"),Ke=o.object({id:o.string().describe("Destination ID"),destination:Ge.describe("Destination instance")}).describe("Destination reference (ID + instance)"),Xe=o.object({queue:o.array(oe).optional().describe("Events queued (awaiting consent)"),error:o.unknown().optional().describe("Error if push failed")}).describe("Push operation result"),Ye=o.object({successful:o.array(Ke).describe("Destinations that processed successfully"),queued:o.array(Ke).describe("Destinations that queued events"),failed:o.array(Ke).describe("Destinations that failed to process")}).describe("Overall destination processing result"),Ze=o.array(o.tuple([oe,o.unknown()])).describe("Dead letter queue: [(event, error), ...]"),ei=t(Oe),ii=t(Te),ni=t(Ue),oi=t(Ve),ti=t(He),ri=t(Ge),ai=t(Ye),si={};i(si,{CommandTypeSchema:()=>ci,ConfigSchema:()=>li,DestinationsSchema:()=>bi,InitConfigSchema:()=>pi,InstanceSchema:()=>gi,PushContextSchema:()=>ui,SessionDataSchema:()=>di,SourcesSchema:()=>mi,commandTypeJsonSchema:()=>fi,configJsonSchema:()=>hi,initConfigJsonSchema:()=>vi,instanceJsonSchema:()=>wi,pushContextJsonSchema:()=>yi,sessionDataJsonSchema:()=>Si});var ci=o.union([o.enum(["action","config","consent","context","destination","elb","globals","hook","init","link","run","user","walker"]),o.string()]).describe("Collector command type: standard commands or custom string for extensions"),li=o.object({run:o.boolean().describe("Whether to run collector automatically on initialization").optional(),tagging:p,globalsStatic:Q.describe("Static global properties that persist across collector runs"),sessionStatic:o.record(o.string(),o.unknown()).describe("Static session data that persists across collector runs"),verbose:o.boolean().describe("Enable verbose logging for debugging"),onError:h.optional(),onLog:S.optional()}).describe("Core collector configuration"),di=Q.and(o.object({isStart:o.boolean().describe("Whether this is a new session start"),storage:o.boolean().describe("Whether storage is available"),id:c.describe("Session identifier").optional(),start:l.describe("Session start timestamp").optional(),marketing:o.literal(!0).optional().describe("Marketing attribution flag"),updated:l.describe("Last update timestamp").optional(),isNew:o.boolean().describe("Whether this is a new session").optional(),device:c.describe("Device identifier").optional(),count:d.describe("Event count in session").optional(),runs:d.describe("Number of runs").optional()})).describe("Session state and tracking data"),pi=li.partial().extend({consent:X.optional().describe("Initial consent state"),user:Y.optional().describe("Initial user data"),globals:Q.optional().describe("Initial global properties"),sources:o.unknown().optional().describe("Source configurations"),destinations:o.unknown().optional().describe("Destination configurations"),custom:Q.optional().describe("Initial custom implementation-specific properties")}).describe("Collector initialization configuration with initial state"),ui=o.object({mapping:je.optional().describe("Source-level mapping configuration")}).describe("Push context with optional source mapping"),mi=o.record(o.string(),o.unknown()).describe("Map of source IDs to source instances"),bi=o.record(o.string(),o.unknown()).describe("Map of destination IDs to destination instances"),gi=o.object({push:o.unknown().describe("Push function for processing events"),command:o.unknown().describe("Command function for walker commands"),allowed:o.boolean().describe("Whether event processing is allowed"),config:li.describe("Current collector configuration"),consent:X.describe("Current consent state"),count:o.number().describe("Event count (increments with each event)"),custom:Q.describe("Custom implementation-specific properties"),sources:mi.describe("Registered source instances"),destinations:bi.describe("Registered destination instances"),globals:Q.describe("Current global properties"),group:o.string().describe("Event grouping identifier"),hooks:o.unknown().describe("Lifecycle hook functions"),on:o.unknown().describe("Event lifecycle configuration"),queue:o.array(oe).describe("Queued events awaiting processing"),round:o.number().describe("Collector run count (increments with each run)"),session:o.union([di]).describe("Current session state"),timing:o.number().describe("Event processing timing information"),user:Y.describe("Current user data"),version:o.string().describe("Walker implementation version")}).describe("Collector instance with state and methods"),fi=t(ci),hi=t(li),Si=t(di),vi=t(pi),yi=t(ui),wi=t(gi),ki={};i(ki,{BaseEnvSchema:()=>Ci,ConfigSchema:()=>ji,InitSchema:()=>Ei,InitSourceSchema:()=>Di,InitSourcesSchema:()=>xi,InstanceSchema:()=>Ji,PartialConfigSchema:()=>Pi,baseEnvJsonSchema:()=>Ii,configJsonSchema:()=>Ri,initSourceJsonSchema:()=>zi,initSourcesJsonSchema:()=>qi,instanceJsonSchema:()=>Mi,partialConfigJsonSchema:()=>Li});var Ci=o.object({push:o.unknown().describe("Collector push function"),command:o.unknown().describe("Collector command function"),sources:o.unknown().optional().describe("Map of registered source instances"),elb:o.unknown().describe("Public API function (alias for collector.push)")}).catchall(o.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this"),ji=je.extend({settings:o.any().describe("Implementation-specific configuration").optional(),env:Ci.optional().describe("Environment dependencies (platform-specific)"),id:c.describe("Source identifier (defaults to source key)").optional(),onError:h.optional(),disabled:o.boolean().describe("Set to true to disable").optional(),primary:o.boolean().describe("Mark as primary (only one can be primary)").optional()}).describe("Source configuration with mapping and environment"),Pi=ji.partial().describe("Partial source configuration with all fields optional"),Ji=o.object({type:o.string().describe('Source type identifier (e.g., "browser", "dataLayer")'),config:ji.describe("Current source configuration"),push:o.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"),destroy:o.any().optional().describe("Cleanup function called when source is removed"),on:o.unknown().optional().describe("Lifecycle hook function for event types")}).describe("Source instance with push handler and lifecycle methods"),Ei=o.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>"),Di=o.object({code:Ei.describe("Source initialization function"),config:Pi.optional().describe("Partial configuration overrides"),env:Ci.partial().optional().describe("Partial environment overrides"),primary:o.boolean().optional().describe("Mark as primary source (only one can be primary)")}).describe("Source initialization configuration"),xi=o.record(o.string(),Di).describe("Map of source IDs to initialization configurations"),Ii=t(Ci),Ri=t(ji),Li=t(Pi),Mi=t(Ji),zi=t(Di),qi=t(xi),Oi={};i(Oi,{ConfigSchema:()=>Fi,DefinitionsSchema:()=>Ui,DestinationReferenceSchema:()=>Hi,PackagesSchema:()=>Vi,PrimitiveSchema:()=>Ti,ServerSchema:()=>Bi,SetupSchema:()=>Gi,SourceReferenceSchema:()=>Ai,VariablesSchema:()=>Ni,WebSchema:()=>Wi,configJsonSchema:()=>Yi,destinationReferenceJsonSchema:()=>en,parseConfig:()=>_i,parseSetup:()=>$i,safeParseConfig:()=>Ki,safeParseSetup:()=>Qi,setupJsonSchema:()=>Xi,sourceReferenceJsonSchema:()=>Zi});var Ti=o.union([o.string(),o.number(),o.boolean()]).describe("Primitive value: string, number, or boolean"),Ni=o.record(o.string(),Ti).describe("Variables for interpolation"),Ui=o.record(o.string(),o.unknown()).describe("Reusable configuration definitions"),Vi=o.record(o.string(),o.object({version:o.string().optional(),imports:o.array(o.string()).optional(),path:o.string().optional()})).describe("NPM packages to bundle"),Wi=o.object({windowCollector:o.string().optional().describe('Window property name for collector instance (default: "collector")'),windowElb:o.string().optional().describe('Window property name for elb function (default: "elb")')}).describe("Web platform configuration"),Bi=o.object({}).passthrough().describe("Server platform configuration (reserved for future options)"),Ai=o.object({package:o.string().min(1,"Package name cannot be empty").describe('Package specifier with optional version (e.g., "@walkeros/web-source-browser@2.0.0")'),config:o.unknown().optional().describe("Source-specific configuration object"),env:o.unknown().optional().describe("Source environment configuration"),primary:o.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary."),variables:Ni.optional().describe("Source-level variables (highest priority in cascade)"),definitions:Ui.optional().describe("Source-level definitions (highest priority in cascade)")}).describe("Source package reference with configuration"),Hi=o.object({package:o.string().min(1,"Package name cannot be empty").describe('Package specifier with optional version (e.g., "@walkeros/web-destination-gtag@2.0.0")'),config:o.unknown().optional().describe("Destination-specific configuration object"),env:o.unknown().optional().describe("Destination environment configuration"),variables:Ni.optional().describe("Destination-level variables (highest priority in cascade)"),definitions:Ui.optional().describe("Destination-level definitions (highest priority in cascade)")}).describe("Destination package reference with configuration"),Fi=o.object({web:Wi.optional().describe("Web platform configuration (browser-based tracking). Mutually exclusive with server."),server:Bi.optional().describe("Server platform configuration (Node.js). Mutually exclusive with web."),sources:o.record(o.string(),Ai).optional().describe("Source configurations (data capture) keyed by unique identifier"),destinations:o.record(o.string(),Hi).optional().describe("Destination configurations (data output) keyed by unique identifier"),collector:o.unknown().optional().describe("Collector configuration for event processing (uses Collector.InitConfig)"),packages:Vi.optional().describe("NPM packages to bundle"),variables:Ni.optional().describe("Flow-level variables (override Setup.variables, overridden by source/destination variables)"),definitions:Ui.optional().describe("Flow-level definitions (extend Setup.definitions, overridden by source/destination definitions)")}).refine(e=>{const i=void 0!==e.web,n=void 0!==e.server;return(i||n)&&!(i&&n)},{message:'Exactly one of "web" or "server" must be present'}).describe("Single flow configuration for one deployment target"),Gi=o.object({version:o.literal(1,{error:"Only version 1 is currently supported"}).describe("Configuration schema version (currently only 1 is supported)"),$schema:o.string().url("Schema URL must be a valid URL").optional().describe('JSON Schema reference for IDE validation (e.g., "https://walkeros.io/schema/flow/v1.json")'),variables:Ni.optional().describe("Shared variables for interpolation across all flows (use ${VAR_NAME} or ${VAR_NAME:default} syntax)"),definitions:Ui.optional().describe('Reusable configuration definitions (reference with JSON Schema $ref syntax: { "$ref": "#/definitions/name" })'),flows:o.record(o.string(),Fi).refine(e=>Object.keys(e).length>0,{message:"At least one flow is required"}).describe("Named flow configurations (e.g., production, staging, development)")}).describe("Complete multi-flow walkerOS configuration (walkeros.config.json)");function $i(e){return Gi.parse(e)}function Qi(e){return Gi.safeParse(e)}function _i(e){return Fi.parse(e)}function Ki(e){return Fi.safeParse(e)}var Xi=o.toJSONSchema(Gi,{target:"draft-7"}),Yi=t(Fi),Zi=t(Ai),en=t(Hi);function nn(e,i){const n=[],o={};for(const[i,t]of Object.entries(e)){t.required&&n.push(i);const e={type:t.type};if(t.description&&(e.description=t.description),t.pattern&&(e.pattern=t.pattern),void 0!==t.minLength&&(e.minLength=t.minLength),void 0!==t.maxLength&&(e.maxLength=t.maxLength),void 0!==t.minimum&&(e.minimum=t.minimum),void 0!==t.maximum&&(e.maximum=t.maximum),t.enum&&(e.enum=[...t.enum]),void 0!==t.default&&(e.default=t.default),"object"===t.type&&t.properties){const i={};for(const[e,n]of Object.entries(t.properties))i[e]=on(n);e.properties=i}"array"===t.type&&t.items&&(e.items=on(t.items)),o[i]=e}const t={type:"object",properties:o};return i&&(t.title=i),n.length>0&&(t.required=n),t}function on(e){const i={type:e.type};if(e.description&&(i.description=e.description),e.pattern&&(i.pattern=e.pattern),void 0!==e.minLength&&(i.minLength=e.minLength),void 0!==e.maxLength&&(i.maxLength=e.maxLength),void 0!==e.minimum&&(i.minimum=e.minimum),void 0!==e.maximum&&(i.maximum=e.maximum),e.enum&&(i.enum=[...e.enum]),void 0!==e.default&&(i.default=e.default),"object"===e.type&&e.properties){const n={};for(const[i,o]of Object.entries(e.properties))n[i]=on(o);i.properties=n}return"array"===e.type&&e.items&&(i.items=on(e.items)),i}function tn(e,i){const n={type:"array",items:on(e)};return void 0!==i?.minItems&&(n.minItems=i.minItems),void 0!==i?.maxItems&&(n.maxItems=i.maxItems),i?.description&&(n.description=i.description),i?.title&&(n.title=i.title),n}function rn(e,i="string",n){const o={type:i,enum:[...e]};return n?.description&&(o.description=n.description),n?.title&&(o.title=n.title),o}function an(e,i,n){return tn({type:"object"},{minItems:2,maxItems:2,description:n||"Tuple with exactly 2 elements [source, transform]"})}function sn(e){return o.toJSONSchema(e,{target:"draft-7"})}export{n as schemas,o as z,sn as zodToSchema};//# sourceMappingURL=dev.mjs.map