@walkeros/core 4.0.1-next-1778230564486 → 4.0.1

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 CHANGED
@@ -4892,7 +4892,9 @@ interface IntelliSenseContext {
4892
4892
  sources?: string[];
4893
4893
  destinations?: string[];
4894
4894
  transformers?: string[];
4895
+ stores?: string[];
4895
4896
  };
4897
+ flowNames?: string[];
4896
4898
  contract?: Array<{
4897
4899
  entity: string;
4898
4900
  actions: string[];
package/dist/dev.d.ts CHANGED
@@ -4892,7 +4892,9 @@ interface IntelliSenseContext {
4892
4892
  sources?: string[];
4893
4893
  destinations?: string[];
4894
4894
  transformers?: string[];
4895
+ stores?: string[];
4895
4896
  };
4897
+ flowNames?: string[];
4896
4898
  contract?: Array<{
4897
4899
  entity: string;
4898
4900
  actions: string[];
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,r=(e,i)=>{for(var n in i)t(e,n,{get:i[n],enumerable:!0})},a={};r(a,{ClickIdEntrySchema:()=>$i,formatOut:()=>ln,mergeConfigSchema:()=>sn,schemas:()=>s,z:()=>c.z,zodToSchema:()=>on}),module.exports=(e=a,((e,r,a,s)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let c of n(r))o.call(e,c)||c===a||t(e,c,{get:()=>r[c],enumerable:!(s=i(r,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};r(s,{BaseContextConfig:()=>H,BatchConfig:()=>U,CacheRuleSchema:()=>Ve,CacheSchema:()=>Ge,CacheSchemas:()=>$e,ClickIdEntrySchema:()=>$i,CodeSchema:()=>Hi,CollectorSchemas:()=>yt,ConsentSchema:()=>ee,ContractActionsSchema:()=>yi,ContractRuleSchema:()=>ki,ContractSchema:()=>Ci,ContractSchemaEntry:()=>vi,Counter:()=>g,DeepPartialEventSchema:()=>se,DestinationSchemas:()=>Le,DestinationsMapConfig:()=>V,EntitiesSchema:()=>oe,EntitySchema:()=>ne,EventSchema:()=>re,FlowBundlePackageSchema:()=>di,FlowBundleSchema:()=>pi,FlowCodeSchema:()=>ui,FlowConfigSchema:()=>xi,FlowDestinationSchema:()=>zi,FlowJsonSchema:()=>Di,FlowSchema:()=>Pi,FlowSchemas:()=>ai,FlowSourceSchema:()=>bi,FlowStoreSchema:()=>Si,FlowTransformerSchema:()=>hi,GenericEnvConfig:()=>F,GenericSettingsConfig:()=>T,HandlersConfig:()=>j,HintSchema:()=>Ui,HintsSchema:()=>Ai,IdConfig:()=>J,Identifier:()=>m,InitConfig:()=>M,LoggerConfigSchema:()=>Ke,LoggerHandlerSchema:()=>_e,LoopSchema:()=>Se,MapSchema:()=>ye,MappingResultSchema:()=>De,MappingSchemas:()=>be,MatchExpressionSchema:()=>Be,MatcherSchemas:()=>Ne,NextRuleSchema:()=>Ae,OptionalPrimitiveValue:()=>h,OrderedPropertiesSchema:()=>Y,PartialEventSchema:()=>ae,PolicySchema:()=>ke,PrimaryConfig:()=>R,PrimitiveValue:()=>b,ProcessingControlConfig:()=>A,PropertiesSchema:()=>X,PropertySchema:()=>Q,PropertyTypeSchema:()=>K,QueueConfig:()=>O,RequiredBoolean:()=>u,RequiredNumber:()=>p,RequiredString:()=>d,RoutableNextSchema:()=>Ue,RuleSchema:()=>Ce,RulesSchema:()=>xe,RuntimeInstanceConfig:()=>B,SetSchema:()=>ve,SourceSchema:()=>ie,SourceSchemas:()=>Ft,SourceTypeSchema:()=>Z,SourcesMapConfig:()=>$,StoreSchemas:()=>ti,Timestamp:()=>f,TransformerSchemas:()=>Qt,UserSchema:()=>te,UtilitySchemas:()=>z,ValueConfigSchema:()=>we,ValueSchema:()=>he,ValuesSchema:()=>ze,VerboseConfig:()=>I,WalkerOSSchemas:()=>G,configJsonSchema:()=>Ji,consentJsonSchema:()=>ge,contractJsonSchema:()=>Wi,contractRuleJsonSchema:()=>qi,createArraySchema:()=>en,createConsentConfig:()=>W,createDataTransformationConfig:()=>L,createEnumSchema:()=>tn,createMappingRulesConfig:()=>N,createObjectSchema:()=>Yi,createPolicyConfig:()=>q,createTupleSchema:()=>nn,destinationJsonSchema:()=>Fi,entityJsonSchema:()=>me,eventJsonSchema:()=>ce,flowConfigJsonSchema:()=>Ri,flowJsonSchema:()=>Mi,loopJsonSchema:()=>Ie,mapJsonSchema:()=>Je,orderedPropertiesJsonSchema:()=>ue,parseConfig:()=>Ei,parseFlow:()=>Ii,partialEventJsonSchema:()=>le,policyJsonSchema:()=>Me,propertiesJsonSchema:()=>pe,ruleJsonSchema:()=>Re,rulesJsonSchema:()=>Te,safeParseConfig:()=>ji,safeParseFlow:()=>Oi,setJsonSchema:()=>Oe,sourceJsonSchema:()=>Ti,sourceTypeJsonSchema:()=>fe,storeJsonSchema:()=>Ni,transformerJsonSchema:()=>Li,userJsonSchema:()=>de,validateFlowConfig:()=>Vi,valueConfigJsonSchema:()=>je,valueJsonSchema:()=>Ee,z:()=>c.z,zodToSchema:()=>on});var c=require("zod");function l(e,t,i="draft-7"){return c.z.toJSONSchema(e,{target:i})}var d=c.z.string(),p=c.z.number(),u=c.z.boolean(),m=c.z.string().min(1),f=c.z.number().int().positive(),g=c.z.number().int().nonnegative(),b=c.z.union([c.z.string(),c.z.number(),c.z.boolean()]),h=b.optional(),z={};r(z,{ErrorHandlerSchema:()=>y,HandlerSchema:()=>k,LogHandlerSchema:()=>w,StorageSchema:()=>v,StorageTypeSchema:()=>S,errorHandlerJsonSchema:()=>P,handlerJsonSchema:()=>E,logHandlerJsonSchema:()=>D,storageJsonSchema:()=>x,storageTypeJsonSchema:()=>C});var S=c.z.enum(["local","session","cookie"]).meta({id:"StorageType",title:"Storage.Type",description:"Storage mechanism: local, session, or cookie."}).describe("Storage mechanism: local, session, or cookie"),v=c.z.object({Local:c.z.literal("local"),Session:c.z.literal("session"),Cookie:c.z.literal("cookie")}).meta({id:"StorageConstants",title:"Storage",description:"Storage type constants for type-safe references."}).describe("Storage type constants for type-safe references"),y=c.z.unknown().meta({id:"ErrorHandler",title:"Error.Handler",description:"Error handler function: (error, state?) => void."}).describe("Error handler function: (error, state?) => void"),w=c.z.unknown().meta({id:"LogHandler",title:"Log.Handler",description:"Log handler function: (message, verbose?) => void."}).describe("Log handler function: (message, verbose?) => void"),k=c.z.object({Error:y.describe("Error handler function"),Log:w.describe("Log handler function")}).meta({id:"Handler",title:"Handler",description:"Handler interface with error and log functions."}).describe("Handler interface with error and log functions"),C=l(S),x=l(v),P=l(y),D=l(w),E=l(k),j=c.z.object({onError:y.optional().describe("Error handler function: (error, state?) => void"),onLog:w.optional().describe("Log handler function: (message, verbose?) => void")}).partial(),I=c.z.object({verbose:c.z.boolean().describe("Enable verbose logging for debugging").optional()}).partial(),O=c.z.object({queue:c.z.boolean().describe("Whether to queue events when consent is not granted").optional()}).partial(),J=c.z.object({}).partial(),M=c.z.object({init:c.z.boolean().describe("Whether to initialize immediately").optional(),loadScript:c.z.boolean().describe("Whether to load external script (for web destinations)").optional()}).partial(),R=c.z.object({primary:c.z.boolean().describe("Mark as primary (only one can be primary)").optional()}).partial(),T=c.z.object({settings:c.z.any().optional().describe("Implementation-specific configuration")}).partial(),F=c.z.object({env:c.z.any().optional().describe("Environment dependencies (platform-specific)")}).partial();function L(e,t){return c.z.object({data:c.z.union([e,t]).optional().describe("Data transformation rules")}).partial()}function N(e){return c.z.object({mapping:e.optional().describe("Event mapping rules")}).partial()}function q(e){return c.z.object({policy:e.optional().describe("Pre-processing policy rules")}).partial()}function W(e){return c.z.object({consent:e.optional().describe("Required consent states")}).partial()}var B=c.z.object({type:c.z.string().optional().describe("Instance type identifier"),config:c.z.unknown().describe("Instance configuration")}).partial(),H=c.z.object({collector:c.z.unknown().describe("Collector instance (runtime object)"),config:c.z.unknown().describe("Configuration"),env:c.z.unknown().describe("Environment dependencies")}).partial(),U=c.z.object({batch:c.z.number().optional().describe("Batch size: bundle N events for batch processing"),batched:c.z.unknown().optional().describe("Batch of events to be processed")}).partial(),A=c.z.object({ignore:c.z.boolean().describe("Set to true to skip processing").optional(),condition:c.z.string().optional().describe("Condition function: return true to process")}).partial(),$=c.z.object({sources:c.z.record(c.z.string(),c.z.unknown()).describe("Map of source instances")}).partial(),V=c.z.object({destinations:c.z.record(c.z.string(),c.z.unknown()).describe("Map of destination instances")}).partial(),G={};r(G,{ConsentSchema:()=>ee,DeepPartialEventSchema:()=>se,EntitiesSchema:()=>oe,EntitySchema:()=>ne,EventSchema:()=>re,OrderedPropertiesSchema:()=>Y,PartialEventSchema:()=>ae,PropertiesSchema:()=>X,PropertySchema:()=>Q,PropertyTypeSchema:()=>K,SourceSchema:()=>ie,SourceTypeSchema:()=>Z,UserSchema:()=>te,consentJsonSchema:()=>ge,entityJsonSchema:()=>me,eventJsonSchema:()=>ce,orderedPropertiesJsonSchema:()=>ue,partialEventJsonSchema:()=>le,propertiesJsonSchema:()=>pe,sourceTypeJsonSchema:()=>fe,userJsonSchema:()=>de});var _,K=c.z.lazy(()=>c.z.union([c.z.boolean(),c.z.string(),c.z.number(),c.z.record(c.z.string(),Q)])).meta({id:"WalkerOSPropertyType",title:"WalkerOS.PropertyType",description:"Base property value types (boolean, string, number, or nested Property record)."}),Q=c.z.lazy(()=>c.z.union([K,c.z.array(K)])).meta({id:"WalkerOSProperty",title:"WalkerOS.Property",description:"PropertyType or an array of PropertyType. Recursive structure for nested objects and arrays."}),X=c.z.record(c.z.string(),Q.optional()).meta({id:"WalkerOSProperties",title:"WalkerOS.Properties",description:"Flexible property collection with optional values."}).describe("Flexible property collection with optional values"),Y=c.z.record(c.z.string(),c.z.tuple([Q,c.z.number()]).optional()).meta({id:"WalkerOSOrderedProperties",title:"WalkerOS.OrderedProperties",description:"Ordered properties with [value, order] tuples for priority control."}).describe("Ordered properties with [value, order] tuples for priority control"),Z=c.z.union([c.z.enum(["web","server","app","other"]),c.z.string()]).meta({id:"WalkerOSSourceType",title:"WalkerOS.SourceType",description:"Source type identifier. Standard: web, server, app, other. Extensible to custom strings."}).describe("Source type: web, server, app, other, or custom"),ee=c.z.record(c.z.string(),c.z.boolean()).meta({id:"WalkerOSConsent",title:"WalkerOS.Consent",description:"Consent state mapping. Keys are consent groups (e.g. marketing, functional), values are booleans for granted/denied."}).describe("Consent requirement mapping (group name to state)"),te=X.and(c.z.object({id:c.z.string().optional().describe("User identifier"),device:c.z.string().optional().describe("Device identifier"),session:c.z.string().optional().describe("Session identifier"),hash:c.z.string().optional().describe("Hashed identifier"),address:c.z.string().optional().describe("User address"),email:c.z.string().email().optional().describe("User email address"),phone:c.z.string().optional().describe("User phone number"),userAgent:c.z.string().optional().describe("Browser user agent string"),browser:c.z.string().optional().describe("Browser name"),browserVersion:c.z.string().optional().describe("Browser version"),deviceType:c.z.string().optional().describe("Device type (mobile, desktop, tablet)"),os:c.z.string().optional().describe("Operating system"),osVersion:c.z.string().optional().describe("Operating system version"),screenSize:c.z.string().optional().describe("Screen dimensions"),language:c.z.string().optional().describe("User language"),country:c.z.string().optional().describe("User country"),region:c.z.string().optional().describe("User region/state"),city:c.z.string().optional().describe("User city"),zip:c.z.string().optional().describe("User postal code"),timezone:c.z.string().optional().describe("User timezone"),ip:c.z.string().optional().describe("User IP address"),internal:c.z.boolean().optional().describe("Internal user flag (employee, test user)")})).meta({id:"WalkerOSUser",title:"WalkerOS.User",description:"User identification and attributes."}).describe("User identification and properties"),ie=X.and(c.z.object({type:c.z.string().describe("Source kind (browser, dataLayer, gtag, ...)"),platform:c.z.string().optional().describe("Runtime platform (web, server, app, ios, android, terminal, ...)"),version:c.z.string().optional().describe("Deployment version of the source emitter"),schema:c.z.string().optional().describe('Event model spec version (collector defaults to "4")'),count:c.z.number().int().nonnegative().optional().describe("Emission sequence per run"),trace:c.z.string().optional().describe("W3C traceparent full string"),url:c.z.string().optional(),referrer:c.z.string().optional(),tool:c.z.string().optional(),command:c.z.string().optional()})).meta({id:"WalkerOSSource",title:"WalkerOS.Source",description:"Event source information (origin of the event)."}).describe("Event source information"),ne=c.z.lazy(()=>c.z.object({entity:c.z.string().describe("Entity name"),data:X.describe("Entity-specific properties"),nested:c.z.array(ne).optional().describe("Nested child entities"),context:Y.optional().describe("Entity context data")})).meta({id:"WalkerOSEntity",title:"WalkerOS.Entity",description:"Nested entity structure with recursive nesting support."}).describe("Nested entity structure with recursive nesting support"),oe=c.z.array(ne).meta({id:"WalkerOSEntities",title:"WalkerOS.Entities",description:"Array of nested entities."}).describe("Array of nested entities"),re=c.z.object({name:c.z.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'),data:X.describe("Event-specific properties"),context:Y.describe("Ordered context properties with priorities"),globals:X.describe("Global properties shared across events"),custom:X.describe("Custom implementation-specific properties"),user:te.describe("User identification and attributes"),nested:oe.describe("Related nested entities"),consent:ee.describe("Consent states at event time"),id:m.describe("W3C span_id, 16 lowercase hex characters"),trigger:d.describe("Event trigger identifier"),entity:d.describe("Parsed entity from event name"),action:d.describe("Parsed action from event name"),timestamp:f.describe("Unix timestamp in milliseconds since epoch"),timing:p.describe("Event processing timing information"),source:ie.describe("Event source information")}).meta({id:"WalkerOSEvent",title:"WalkerOS.Event",description:"Complete walkerOS event structure."}).describe("Complete walkerOS event structure"),ae=re.partial().meta({id:"WalkerOSPartialEvent",title:"WalkerOS.PartialEvent",description:"Partial event structure with all fields optional."}).describe("Partial event structure with all fields optional"),se=re.partial().meta({id:"WalkerOSDeepPartialEvent",title:"WalkerOS.DeepPartialEvent",description:"Partial event structure with all top-level fields optional."}).describe("Partial event structure with all top-level fields optional"),ce=l(re),le=l(ae),de=l(te),pe=l(X),ue=l(Y),me=l(ne),fe=l(Z),ge=l(ee),be={};r(be,{ConfigSchema:()=>Pe,LoopSchema:()=>Se,MapSchema:()=>ye,PolicySchema:()=>ke,ResultSchema:()=>De,RuleSchema:()=>Ce,RulesSchema:()=>xe,SetSchema:()=>ve,ValueConfigSchema:()=>we,ValueSchema:()=>he,ValuesSchema:()=>ze,configJsonSchema:()=>Fe,loopJsonSchema:()=>Ie,mapJsonSchema:()=>Je,policyJsonSchema:()=>Me,ruleJsonSchema:()=>Re,rulesJsonSchema:()=>Te,setJsonSchema:()=>Oe,valueConfigJsonSchema:()=>je,valueJsonSchema:()=>Ee});var he=c.z.lazy(()=>c.z.union([c.z.string().describe('String value or property path (e.g., "data.id")'),c.z.number().describe("Numeric value"),c.z.boolean().describe("Boolean value"),c.z.lazy(()=>_),c.z.array(he).describe("Array of values")])).meta({id:"MappingValue",title:"Mapping.Value",description:"Polymorphic transform primitive used in every mapping field. A string path, constant, operator object (map/loop/set/condition/consent), or array of values."}),ze=c.z.array(he).meta({id:"MappingValues",title:"Mapping.Values",description:"Array of transformation values."}).describe("Array of transformation values"),Se=c.z.lazy(()=>c.z.tuple([he,he]).describe("Loop transformation: [source, transform] tuple for array processing")).meta({id:"MappingLoop",title:"Mapping.Loop",description:"Loop tuple [source, transform] for iterating and transforming arrays."}),ve=c.z.lazy(()=>c.z.array(he).describe("Set: Array of values for selection or combination")).meta({id:"MappingSet",title:"Mapping.Set",description:"Set: array of values for selection or combination."}),ye=c.z.lazy(()=>c.z.record(c.z.string(),he).describe("Map: Object mapping keys to transformation values")).meta({id:"MappingMap",title:"Mapping.Map",description:"Map: object mapping keys to transformation values."}),we=_=c.z.object({key:c.z.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'),value:c.z.union([c.z.string(),c.z.number(),c.z.boolean()]).optional().describe("Static primitive value"),fn:c.z.string().optional().describe("Custom transformation function as string (serialized)"),map:ye.optional().describe("Object mapping: transform event data to structured output"),loop:Se.optional().describe("Loop transformation: [source, transform] for array processing"),set:ve.optional().describe("Set of values: combine or select from multiple values"),consent:ee.optional().describe("Required consent states to include this value"),condition:c.z.string().optional().describe("Condition function as string: return true to include value"),validate:c.z.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"}).meta({id:"MappingValueConfig",title:"Mapping.ValueConfig",description:"Object-form value transformation with map/loop/set/condition/consent etc."}).describe("Value transformation configuration with multiple strategies"),ke=c.z.record(c.z.string(),he).meta({id:"MappingPolicy",title:"Mapping.Policy",description:"Policy rules for event pre-processing (key → value transformation)."}).describe("Policy rules for event pre-processing (key → value mapping)"),Ce=c.z.object({name:c.z.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'),data:c.z.union([he,ze]).optional().describe("Data transformation rules for event"),settings:c.z.any().optional().describe("Destination-specific settings for this event mapping"),condition:c.z.string().optional().describe("Condition function as string: return true to process event"),consent:ee.optional().describe("Required consent states to process this event"),policy:ke.optional().describe("Event-level policy overrides (applied after config-level policy)"),batch:c.z.number().optional().describe("Batch size: bundle N events for batch processing"),include:c.z.array(c.z.string()).optional().describe('Event sections (e.g. ["context", "globals"]) flattened into context.data'),ignore:c.z.boolean().optional().describe("Skip the event entirely. No push, no side effects. Use for suppression."),silent:c.z.boolean().optional().describe("Run side effects (settings.identify, ...) but suppress the destination default push call.")}).meta({id:"MappingRule",title:"Mapping.Rule",description:"Configuration for transforming a single event at one stage of the flow (source or destination)."}).describe("Mapping rule for specific entity-action combination"),xe=c.z.record(c.z.string(),c.z.record(c.z.string(),c.z.union([Ce,c.z.array(Ce)])).optional()).meta({id:"MappingRules",title:"Mapping.Rules",description:'Event mapping rules tree: entity → action → Rule (or Rule[]). Use "*" as wildcard for entity or action.'}).describe('Event mapping rules: entity → action → Rule. Keys match event name split by space. Use "*" as wildcard for entity or action. Priority: exact > entity wildcard > action wildcard > global wildcard (*→*).'),Pe=c.z.object({consent:ee.optional().describe("Required consent states to process any events"),data:c.z.union([he,ze]).optional().describe("Global data transformation applied to all events"),include:c.z.array(c.z.string()).optional().describe("Event sections to flatten into context.data"),mapping:xe.optional().describe("Entity-action specific mapping rules"),policy:ke.optional().describe("Pre-processing policy rules applied before mapping")}).meta({id:"MappingConfig",title:"Mapping.Config",description:"Shared mapping configuration (consent, data, include, mapping, policy)."}).describe("Shared mapping configuration for sources and destinations"),De=c.z.object({eventMapping:Ce.optional().describe("Resolved mapping rule for event"),mappingKey:c.z.string().optional().describe('Mapping key used (e.g., "product.view")')}).meta({id:"MappingResult",title:"Mapping.Result",description:"Mapping resolution result (matched rule + key)."}).describe("Mapping resolution result"),Ee=l(he),je=l(we),Ie=l(Se),Oe=l(ve),Je=l(ye),Me=l(ke),Re=l(Ce),Te=l(xe),Fe=l(Pe),Le={};r(Le,{BatchSchema:()=>ot,ConfigSchema:()=>Qe,ContextSchema:()=>Ze,DLQSchema:()=>mt,DataSchema:()=>rt,DestinationPolicySchema:()=>Ye,DestinationsSchema:()=>lt,InitDestinationsSchema:()=>ct,InitSchema:()=>st,InstanceSchema:()=>at,PartialConfigSchema:()=>Xe,PushBatchContextSchema:()=>tt,PushContextSchema:()=>et,PushEventSchema:()=>it,PushEventsSchema:()=>nt,PushResultSchema:()=>pt,RefSchema:()=>dt,ResultSchema:()=>ut,batchJsonSchema:()=>zt,configJsonSchema:()=>ft,contextJsonSchema:()=>bt,instanceJsonSchema:()=>St,partialConfigJsonSchema:()=>gt,pushContextJsonSchema:()=>ht,resultJsonSchema:()=>vt});var Ne={};r(Ne,{MatchExpressionSchema:()=>Be,NextRuleSchema:()=>Ae,RoutableNextSchema:()=>Ue});var qe=c.z.enum(["eq","contains","prefix","suffix","regex","gt","lt","exists"]).meta({id:"MatcherOperator",title:"Matcher.Operator",description:"Supported operators for a match condition."}),We=c.z.object({key:c.z.string(),operator:qe,value:c.z.string(),not:c.z.boolean().optional()}).meta({id:"MatcherCondition",title:"Matcher.Condition",description:"Single match condition (key, operator, value, optional not)."}),Be=c.z.union([We,c.z.object({and:c.z.array(c.z.lazy(()=>Be))}),c.z.object({or:c.z.array(c.z.lazy(()=>Be))})]).meta({id:"MatcherExpression",title:"Matcher.Expression",description:"Boolean expression tree of match conditions (leaf, and, or)."}),He=c.z.union([Be,c.z.literal("*")]),Ue=c.z.union([c.z.string(),c.z.array(c.z.string()),c.z.array(c.z.object({match:He,next:c.z.lazy(()=>Ue)}))]).meta({id:"MatcherNext",title:"Matcher.Next",description:"Routable next target: ID, ID list, or list of {match, next} rules."}),Ae=c.z.object({match:He,next:c.z.lazy(()=>Ue)}).meta({id:"MatcherNextRule",title:"Matcher.NextRule",description:"Single routing rule pairing a match expression with a next target."}),$e={};r($e,{CacheRuleSchema:()=>Ve,CacheSchema:()=>Ge});var Ve=c.z.object({match:c.z.union([Be,c.z.literal("*")]).describe("Match expression or wildcard to determine when this rule applies"),key:c.z.array(c.z.string()).min(1).describe("Dot-path fields used to build the cache key"),ttl:c.z.number().positive().describe("Time-to-live in seconds for cached entries"),update:c.z.record(c.z.string(),he).optional().describe("Response mutations applied on cache hit (key → Value mapping)")}).meta({id:"CacheRule",title:"Cache.Rule",description:"Single caching rule: when it applies (match), what keys it keys off, TTL, and optional response mutations on hit."}),Ge=c.z.object({full:c.z.boolean().optional().describe("Stop flow on cache HIT (default: false). When true, skip remaining steps and return cached value."),store:c.z.string().optional().describe("Store ID for persistent caching (references a configured store)"),rules:c.z.array(Ve).min(1).describe("Cache rules — at least one required")}).meta({id:"CacheConfig",title:"Cache.Config",description:"Top-level cache configuration for a pipeline step (destination / transformer / source ref)."}),_e=c.z.any().meta({id:"LoggerHandler",title:"Logger.Handler",description:"Custom log handler function (level, ...args) => void"}),Ke=c.z.object({level:c.z.union([c.z.number(),c.z.enum(["ERROR","WARN","INFO","DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"),handler:_e.optional().describe("Custom log handler function")}).meta({id:"LoggerConfig",title:"Logger.Config",description:"Logger configuration (level, handler) to override the collector defaults"}),Qe=c.z.object({consent:ee.optional().describe("Required consent states to send events to this destination"),settings:c.z.any().meta({id:"DestinationSettings",title:"Destination.Settings",description:"Implementation-specific configuration (destination-defined shape)."}).describe("Implementation-specific configuration").optional(),data:c.z.union([he,ze]).optional().describe("Global data transformation applied to all events for this destination"),include:c.z.array(c.z.string()).optional().describe("Event sections to flatten into context.data"),env:c.z.any().meta({id:"DestinationEnv",title:"Destination.Env",description:"Environment dependencies (destination-defined shape) — platform, SDK, or mock hook."}).describe("Environment dependencies (platform-specific)").optional(),id:m.describe("Destination instance identifier (defaults to destination key)").optional(),init:c.z.boolean().describe("Whether to initialize immediately").optional(),loadScript:c.z.boolean().describe("Whether to load external script (for web destinations)").optional(),mapping:xe.optional().describe("Entity-action specific mapping rules for this destination"),policy:ke.optional().describe("Pre-processing policy rules applied before event mapping"),queue:c.z.boolean().describe("Whether to queue events when consent is not granted").optional(),require:c.z.array(c.z.string()).optional().describe('Defer destination initialization until these collector events fire (e.g., ["consent"])'),logger:Ke.optional().describe("Logger configuration (level, handler) to override the collector defaults"),setup:c.z.union([c.z.boolean(),c.z.record(c.z.string(),c.z.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)"),before:Ue.optional().describe("Post-collector transformer chain applied before this destination receives the event"),next:Ue.optional().describe("Post-push transformer chain. Runs after destination push completes; push response is available at ingest._response"),cache:Ge.optional().describe("Cache configuration for deduplication; skip push on cache HIT"),disabled:c.z.boolean().describe("Completely skip this destination (no init, no push, no queue)").optional(),mock:c.z.unknown().meta({id:"DestinationMock",title:"Destination.Mock",description:"Return this value instead of calling push(). Dev/testing only."}).optional().describe("Return this value instead of calling push(). Dev/testing only.")}).meta({id:"DestinationConfig",title:"Destination.Config",description:"Destination configuration: consent, settings, data, env, mapping rules, policy, queue, logger, before/next chains, cache."}).describe("Destination configuration"),Xe=Qe.partial().meta({id:"DestinationPartialConfig",title:"Destination.PartialConfig",description:"Partial destination configuration with all fields optional."}).describe("Partial destination configuration with all fields optional"),Ye=ke.describe("Destination policy rules for event pre-processing"),Ze=c.z.object({collector:c.z.unknown().meta({id:"DestinationContextCollector",title:"Collector.Instance",description:"Collector instance handed to the destination (runtime object)."}).describe("Collector instance (runtime object)"),config:Qe.describe("Destination configuration"),data:c.z.union([c.z.unknown(),c.z.array(c.z.unknown())]).optional().describe("Transformed event data"),env:c.z.unknown().meta({id:"DestinationContextEnv",title:"Destination.Env",description:"Environment dependencies (destination-defined shape)."}).describe("Environment dependencies")}).meta({id:"DestinationContext",title:"Destination.Context",description:"Destination context passed to init and push functions."}).describe("Destination context for init and push functions"),et=Ze.extend({mapping:Ce.optional().describe("Resolved mapping rule for this specific event")}).meta({id:"DestinationPushContext",title:"Destination.PushContext",description:"Destination context for push() with the resolved event mapping rule."}).describe("Push context with event-specific mapping"),tt=et.describe("Batch push context with event-specific mapping"),it=c.z.object({event:re.describe("The event to process"),mapping:Ce.optional().describe("Mapping rule for this event")}).meta({id:"DestinationPushEvent",title:"Destination.PushEvent",description:"Single event paired with its resolved mapping rule (batch element)."}).describe("Event with optional mapping for batch processing"),nt=c.z.array(it).meta({id:"DestinationPushEvents",title:"Destination.PushEvents",description:"Array of events with mappings (batch input)."}).describe("Array of events with mappings"),ot=c.z.object({key:c.z.string().describe('Batch key (usually mapping key like "product.view")'),events:c.z.array(re).describe("Array of events in batch"),data:c.z.array(c.z.union([c.z.unknown(),c.z.array(c.z.unknown())]).optional()).describe("Transformed data for each event"),mapping:Ce.optional().describe("Shared mapping rule for batch")}).meta({id:"DestinationBatch",title:"Destination.Batch",description:"Batch of events grouped by mapping key for batch delivery."}).describe("Batch of events grouped by mapping key"),rt=c.z.union([c.z.unknown(),c.z.array(c.z.unknown())]).meta({id:"DestinationData",title:"Destination.Data",description:"Transformed event data delivered to the destination (Property, undefined, or array)."}).optional().describe("Transformed event data (Property, undefined, or array)"),at=c.z.object({config:Qe.describe("Destination configuration"),queue:c.z.array(re).optional().describe("Queued events awaiting consent"),dlq:c.z.array(c.z.tuple([re,c.z.unknown()])).optional().describe("Dead letter queue (failed events with errors)"),type:c.z.string().optional().describe("Destination type identifier"),env:c.z.unknown().optional().describe("Environment dependencies"),init:c.z.unknown().optional().describe("Initialization function"),push:c.z.unknown().describe("Push function for single events"),pushBatch:c.z.unknown().optional().describe("Batch push function"),on:c.z.unknown().optional().describe("Event lifecycle hook function")}).meta({id:"DestinationInstance",title:"Destination.Instance",description:"Destination instance (runtime object with init/push/pushBatch/on)."}).describe("Destination instance (runtime object with functions)"),st=c.z.object({code:at.describe("Destination instance with implementation"),config:Xe.optional().describe("Partial configuration overrides"),env:c.z.unknown().optional().describe("Partial environment overrides")}).meta({id:"DestinationInit",title:"Destination.Init",description:"Destination initialization bundle (instance code + config + env)."}).describe("Destination initialization configuration"),ct=c.z.record(c.z.string(),st).meta({id:"DestinationInitDestinations",title:"Destination.InitDestinations",description:"Map of destination IDs to initialization configurations."}).describe("Map of destination IDs to initialization configurations"),lt=c.z.record(c.z.string(),at).meta({id:"DestinationDestinations",title:"Destination.Destinations",description:"Map of destination IDs to runtime destination instances."}).describe("Map of destination IDs to runtime instances"),dt=c.z.object({type:c.z.string().describe('Destination type ("gtag", "meta", "bigquery")'),data:c.z.unknown().optional().describe("Response from push()"),error:c.z.unknown().optional().describe("Error if failed")}).meta({id:"DestinationRef",title:"Destination.Ref",description:"Reference to a destination outcome (type + response data or error)."}).describe("Destination reference with type and response data"),pt=c.z.object({queue:c.z.array(re).optional().describe("Events queued (awaiting consent)"),error:c.z.unknown().optional().describe("Error if push failed")}).meta({id:"DestinationPushResult",title:"Destination.PushResult",description:"Result of a single destination push (queued events, optional error)."}).describe("Push operation result"),ut=c.z.object({ok:c.z.boolean().describe("True if nothing failed"),event:c.z.unknown().optional().describe("The processed event"),done:c.z.record(c.z.string(),dt).optional().describe("Destinations that processed successfully"),queued:c.z.record(c.z.string(),dt).optional().describe("Destinations that queued events"),failed:c.z.record(c.z.string(),dt).optional().describe("Destinations that failed to process")}).meta({id:"DestinationResult",title:"Destination.Result",description:"Overall push result aggregated across all destinations (done/queued/failed maps)."}).describe("Push result with destination outcomes"),mt=c.z.array(c.z.tuple([re,c.z.unknown()])).meta({id:"DestinationDLQ",title:"Destination.DLQ",description:"Dead-letter queue: list of [event, error] tuples."}).describe("Dead letter queue: [(event, error), ...]"),ft=l(Qe),gt=l(Xe),bt=l(Ze),ht=l(et),zt=l(ot),St=l(at),vt=l(ut),yt={};r(yt,{CommandTypeSchema:()=>wt,ConfigSchema:()=>kt,DestinationsSchema:()=>Et,InitConfigSchema:()=>xt,InstanceSchema:()=>jt,PushContextSchema:()=>Pt,SessionDataSchema:()=>Ct,SourcesSchema:()=>Dt,commandTypeJsonSchema:()=>It,configJsonSchema:()=>Ot,initConfigJsonSchema:()=>Mt,instanceJsonSchema:()=>Tt,pushContextJsonSchema:()=>Rt,sessionDataJsonSchema:()=>Jt});var wt=c.z.union([c.z.enum(["action","config","consent","context","destination","elb","globals","hook","init","link","run","user","walker"]),c.z.string()]).meta({id:"CollectorCommandType",title:"Collector.CommandType",description:"Collector command type identifier (standard or extension string)."}).describe("Collector command type: standard commands or custom string for extensions"),kt=c.z.object({run:c.z.boolean().describe("Whether to run collector automatically on initialization").optional(),globalsStatic:X.describe("Static global properties that persist across collector runs"),sessionStatic:c.z.record(c.z.string(),c.z.unknown()).meta({id:"CollectorSessionStatic",title:"Collector.SessionStatic",description:"Static session data that persists across collector runs."}).describe("Static session data that persists across collector runs"),logger:Ke.optional().describe("Logger configuration (level, handler)")}).meta({id:"CollectorConfig",title:"Collector.Config",description:"Core collector configuration (globals/session statics, logger)."}).describe("Core collector configuration"),Ct=X.and(c.z.object({isStart:c.z.boolean().describe("Whether this is a new session start"),storage:c.z.boolean().describe("Whether storage is available"),id:m.describe("Session identifier").optional(),start:f.describe("Session start timestamp").optional(),marketing:c.z.literal(!0).optional().describe("Marketing attribution flag"),updated:f.describe("Last update timestamp").optional(),isNew:c.z.boolean().describe("Whether this is a new session").optional(),device:m.describe("Device identifier").optional(),count:g.describe("Event count in session").optional(),runs:g.describe("Number of runs").optional()})).meta({id:"CollectorSessionData",title:"Collector.SessionData",description:"Session state and tracking data."}).describe("Session state and tracking data"),xt=kt.partial().extend({consent:ee.optional().describe("Initial consent state"),user:te.optional().describe("Initial user data"),globals:X.optional().describe("Initial global properties"),sources:c.z.unknown().meta({id:"CollectorInitSources",title:"Source.InitSources",description:"Source configurations map (id → InitSource)."}).optional().describe("Source configurations"),destinations:c.z.unknown().meta({id:"CollectorInitDestinations",title:"Destination.InitDestinations",description:"Destination configurations map (id → Init)."}).optional().describe("Destination configurations"),transformers:c.z.unknown().meta({id:"CollectorInitTransformers",title:"Transformer.Configs",description:"Transformer configurations map (id → Config)."}).optional().describe("Transformer configurations"),stores:c.z.unknown().meta({id:"CollectorInitStores",title:"Store.Configs",description:"Store configurations map (id → Config)."}).optional().describe("Store configurations"),custom:X.optional().describe("Initial custom implementation-specific properties"),hooks:c.z.unknown().meta({id:"CollectorHooks",title:"Collector.Hooks",description:"Pipeline observation hooks."}).optional().describe("Pipeline observation hooks")}).meta({id:"CollectorInitConfig",title:"Collector.InitConfig",description:"Collector initialization configuration with initial state (consent, user, globals, components, hooks)."}).describe("Collector initialization configuration with initial state"),Pt=c.z.object({mapping:Pe.optional().describe("Source-level mapping configuration")}).meta({id:"CollectorPushContext",title:"Collector.PushContext",description:"Push context with optional source-level mapping."}).describe("Push context with optional source mapping"),Dt=c.z.record(c.z.string(),c.z.unknown()).meta({id:"CollectorSources",title:"Collector.Sources",description:"Map of source IDs to runtime source instances."}).describe("Map of source IDs to source instances"),Et=c.z.record(c.z.string(),c.z.unknown()).meta({id:"CollectorDestinations",title:"Collector.Destinations",description:"Map of destination IDs to runtime destination instances."}).describe("Map of destination IDs to destination instances"),jt=c.z.object({push:c.z.unknown().describe("Push function for processing events"),command:c.z.unknown().describe("Command function for walker commands"),allowed:c.z.boolean().describe("Whether event processing is allowed"),config:kt.describe("Current collector configuration"),consent:ee.describe("Current consent state"),custom:X.describe("Custom implementation-specific properties"),sources:Dt.describe("Registered source instances"),destinations:Et.describe("Registered destination instances"),globals:X.describe("Current global properties"),hooks:c.z.unknown().describe("Lifecycle hook functions"),on:c.z.unknown().describe("Event lifecycle configuration"),queue:c.z.array(re).describe("Queued events awaiting processing"),round:c.z.number().describe("Collector run count (increments with each run)"),session:c.z.union([Ct]).describe("Current session state"),timing:c.z.number().describe("Event processing timing information"),user:te.describe("Current user data")}).meta({id:"CollectorInstance",title:"Collector.Instance",description:"Collector instance (runtime object with push/command + full state and component maps)."}).describe("Collector instance with state and methods"),It=l(wt),Ot=l(kt),Jt=l(Ct),Mt=l(xt),Rt=l(Pt),Tt=l(jt),Ft={};r(Ft,{BaseEnvSchema:()=>Lt,ConfigSchema:()=>Nt,InitSchema:()=>Bt,InitSourceSchema:()=>Ht,InitSourcesSchema:()=>Ut,InstanceSchema:()=>Wt,PartialConfigSchema:()=>qt,baseEnvJsonSchema:()=>At,configJsonSchema:()=>$t,initSourceJsonSchema:()=>_t,initSourcesJsonSchema:()=>Kt,instanceJsonSchema:()=>Gt,partialConfigJsonSchema:()=>Vt});var Lt=c.z.object({push:c.z.unknown().meta({id:"SourcePushFn",title:"Source.PushFn",description:"Collector push function passed to the source via dependency injection."}).describe("Collector push function"),command:c.z.unknown().meta({id:"SourceCommandFn",title:"Source.CommandFn",description:"Collector command function passed to the source."}).describe("Collector command function"),sources:c.z.unknown().optional().describe("Map of registered source instances"),elb:c.z.unknown().meta({id:"ElbFn",title:"Elb.Fn",description:"Public `elb(...)` API function alias for collector.push."}).describe("Public API function (alias for collector.push)")}).catchall(c.z.unknown()).meta({id:"SourceBaseEnv",title:"Source.BaseEnv",description:"Base environment for source dependency injection; platform-specific sources extend this."}).describe("Base environment for dependency injection - platform-specific sources extend this"),Nt=Pe.extend({settings:c.z.any().meta({id:"SourceSettings",title:"Source.Settings",description:"Implementation-specific configuration (source-defined shape)."}).describe("Implementation-specific configuration").optional(),env:Lt.optional().describe("Environment dependencies (platform-specific)"),id:m.describe("Source identifier (defaults to source key)").optional(),primary:c.z.boolean().describe("Mark as primary (only one can be primary)").optional(),require:c.z.array(c.z.string()).optional().describe('Defer source initialization until these collector events fire (e.g., ["consent"])'),logger:Ke.optional().describe("Logger configuration (level, handler) to override the collector defaults"),setup:c.z.union([c.z.boolean(),c.z.record(c.z.string(),c.z.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)"),ingest:c.z.union([he,ze]).optional().describe("Ingest metadata extraction mapping. Extracts values from raw request objects (Express req, Lambda event) using mapping syntax."),disabled:c.z.boolean().describe("Completely skip this source (no init, no event capture)").optional(),init:c.z.boolean().optional().describe("Init lifecycle flag set by collector to true after Instance.init() runs")}).meta({id:"SourceConfig",title:"Source.Config",description:"Source configuration with mapping, environment, and lifecycle hooks."}).describe("Source configuration with mapping and environment"),qt=Nt.partial().meta({id:"SourcePartialConfig",title:"Source.PartialConfig",description:"Partial source configuration with all fields optional."}).describe("Partial source configuration with all fields optional"),Wt=c.z.object({type:c.z.string().describe('Source type identifier (e.g., "browser", "dataLayer")'),config:Nt.describe("Current source configuration"),push:c.z.any().meta({id:"SourceInstancePushFn",title:"Source.PushFn",description:"Push function — THE HANDLER (flexible signature for platform compatibility)."}).describe("Push function - THE HANDLER (flexible signature for platform compatibility)"),destroy:c.z.any().meta({id:"SourceDestroyFn",title:"Source.DestroyFn",description:"Cleanup function called when the source is removed."}).optional().describe("Cleanup function called when source is removed"),on:c.z.unknown().optional().describe("Lifecycle hook function for event types")}).meta({id:"SourceInstance",title:"Source.Instance",description:"Source instance (runtime object with push handler and lifecycle methods)."}).describe("Source instance with push handler and lifecycle methods"),Bt=c.z.any().meta({id:"SourceInit",title:"Source.Init",description:"Source initialization function: (config, env) => Instance | Promise<Instance>."}).describe("Source initialization function: (config, env) => Instance | Promise<Instance>"),Ht=c.z.object({code:Bt.describe("Source initialization function"),config:qt.optional().describe("Partial configuration overrides"),env:Lt.partial().optional().describe("Partial environment overrides"),primary:c.z.boolean().optional().describe("Mark as primary source (only one can be primary)")}).meta({id:"SourceInitSource",title:"Source.InitSource",description:"Source initialization bundle (init function + config + env + primary flag)."}).describe("Source initialization configuration"),Ut=c.z.record(c.z.string(),Ht).meta({id:"SourceInitSources",title:"Source.InitSources",description:"Map of source IDs to initialization configurations."}).describe("Map of source IDs to initialization configurations"),At=l(Lt),$t=l(Nt),Vt=l(qt),Gt=l(Wt),_t=l(Ht),Kt=l(Ut),Qt={};r(Qt,{ConfigSchema:()=>Xt,PartialConfigSchema:()=>Yt,configJsonSchema:()=>Zt,partialConfigJsonSchema:()=>ei});var Xt=c.z.object({settings:c.z.any().meta({id:"TransformerSettings",title:"Transformer.Settings",description:"Implementation-specific configuration (transformer-defined shape)."}).describe("Implementation-specific configuration").optional(),env:c.z.any().meta({id:"TransformerEnv",title:"Transformer.Env",description:"Environment dependencies (transformer-defined shape)."}).describe("Environment dependencies (platform-specific)").optional(),id:m.describe("Transformer instance identifier (defaults to transformer key)").optional(),logger:Ke.optional().describe("Logger configuration (level, handler) to override the collector defaults"),before:Ue.optional().describe("Pre-transformer chain that runs before this transformer pushes"),next:Ue.optional().describe("Graph wiring to the next transformer in the chain"),cache:Ge.optional().describe("Step-level cache configuration for this transformer"),init:c.z.boolean().describe("Whether to initialize immediately").optional(),disabled:c.z.boolean().describe("Completely skip this transformer in chains").optional(),mock:c.z.unknown().meta({id:"TransformerMock",title:"Transformer.Mock",description:"Return this value instead of calling push(). Dev/testing only."}).optional().describe("Return this value instead of calling push(). Global mock for all chains. Dev/testing only."),chainMocks:c.z.record(c.z.string(),c.z.unknown().meta({id:"TransformerChainMock",title:"Transformer.ChainMock",description:"Chain-path-specific mock value. Dev/testing only."})).optional().describe("Path-specific mock values keyed by chain path. Takes precedence over global mock. Dev/testing only.")}).meta({id:"TransformerConfig",title:"Transformer.Config",description:"Transformer configuration (settings, env, chain wiring, cache, mocks)."}).describe("Transformer configuration"),Yt=Xt.partial().meta({id:"TransformerPartialConfig",title:"Transformer.PartialConfig",description:"Partial transformer configuration with all fields optional."}).describe("Partial transformer configuration with all fields optional"),Zt=l(Xt),ei=l(Yt),ti={};r(ti,{ConfigSchema:()=>ii,PartialConfigSchema:()=>ni,configJsonSchema:()=>oi,partialConfigJsonSchema:()=>ri});var ii=c.z.object({settings:c.z.unknown().meta({id:"StoreSettings",title:"Store.Settings",description:"Implementation-specific configuration (store-defined shape)."}).describe("Implementation-specific configuration").optional(),env:c.z.unknown().meta({id:"StoreEnv",title:"Store.Env",description:"Environment dependencies (store-defined shape)."}).describe("Environment dependencies (platform-specific)").optional(),id:m.describe("Store instance identifier (defaults to store key)").optional(),logger:Ke.optional().describe("Logger configuration (level, handler) to override the collector defaults"),setup:c.z.union([c.z.boolean(),c.z.record(c.z.string(),c.z.unknown())]).optional().describe("One-time setup options applied during store registration (boolean enables defaults, object configures specifics)")}).meta({id:"StoreConfig",title:"Store.Config",description:"Store configuration (settings, env, logger) — key-value infrastructure component."}).describe("Store configuration"),ni=ii.partial().meta({id:"StorePartialConfig",title:"Store.PartialConfig",description:"Partial store configuration with all fields optional."}).describe("Partial store configuration with all fields optional"),oi=l(ii),ri=l(ni),ai={};r(ai,{BundlePackageSchema:()=>di,BundleSchema:()=>pi,CodeSchema:()=>ui,ConfigSchema:()=>xi,ContractActionsSchema:()=>yi,ContractEventsSchema:()=>wi,ContractRuleSchema:()=>ki,ContractSchema:()=>Ci,ContractSchemaEntry:()=>vi,DestinationSchema:()=>zi,FlowSchema:()=>Pi,JsonSchema:()=>Di,SettingsSchema:()=>ci,SourceSchema:()=>bi,StepExampleSchema:()=>fi,StepExamplesSchema:()=>gi,StoreSchema:()=>Si,TransformerSchema:()=>hi,TriggerDescriptorSchema:()=>mi,VariablesSchema:()=>si,configJsonSchema:()=>Ji,contractJsonSchema:()=>Wi,contractRuleJsonSchema:()=>qi,destinationJsonSchema:()=>Fi,flowConfigJsonSchema:()=>Ri,flowJsonSchema:()=>Mi,parseConfig:()=>Ei,parseFlow:()=>Ii,safeParseConfig:()=>ji,safeParseFlow:()=>Oi,sourceJsonSchema:()=>Ti,storeJsonSchema:()=>Ni,transformerJsonSchema:()=>Li});var si=c.z.record(c.z.string(),c.z.unknown()).meta({id:"FlowVariables",title:"Flow.Variables",description:"Reusable values referenced via $var.name (with optional deep paths). Whole-string refs preserve native type; inline interpolation requires scalars."}),ci=c.z.record(c.z.string(),c.z.unknown()).meta({id:"FlowSettings",title:"Flow.Settings",description:"Free-form key-value settings consumed by the platform runtime."}).describe("Free-form platform settings bag"),li=/^(@[a-z0-9\-~][a-z0-9\-._~]*\/)?[a-z0-9\-~][a-z0-9\-._~]*$/,di=c.z.object({version:c.z.string().optional(),imports:c.z.array(c.z.string()).optional(),path:c.z.string().optional()}).meta({id:"FlowBundlePackage",title:"Flow.BundlePackage",description:"Per-package bundle spec (version / imports / local path)."}),pi=c.z.object({packages:c.z.record(c.z.string().regex(li,"Invalid npm package name"),di).optional().describe("NPM packages to bundle, keyed by package name"),overrides:c.z.record(c.z.string().regex(li,"Invalid npm package name"),c.z.string().min(1,"Override version cannot be empty")).optional().describe("Transitive dependency version pins"),traceInclude:c.z.array(c.z.string()).optional().describe("Extra paths or globs the bundler must include in the trace output (server flows only)")}).strict().meta({id:"FlowBundle",title:"Flow.Bundle",description:"Bundle configuration (packages + overrides + traceInclude)."}).describe("Bundle configuration (packages + overrides + traceInclude)"),ui=c.z.object({push:c.z.string().min(1,"Push function cannot be empty").describe('JavaScript function for processing events. Must start with "$code:" prefix.'),type:c.z.string().optional().describe("Optional type identifier for the inline instance"),init:c.z.string().optional().describe("Optional initialization function. Use $code: prefix for inline JavaScript.")}).meta({id:"FlowCode",title:"Flow.Code",description:"Inline code block for custom sources / transformers / destinations / stores."}).describe("Inline code for custom components"),mi=c.z.object({type:c.z.string().optional().describe("Trigger mechanism (e.g., click, POST, load)"),options:c.z.unknown().optional().describe("Mechanism-specific options")}).meta({id:"TriggerDescriptor",title:"Trigger.Descriptor",description:"Source trigger metadata (mechanism + options) used by step examples."}),fi=c.z.object({title:c.z.string().optional().describe("Human-readable title (overrides default heading)"),description:c.z.string().optional().describe("Human-readable description"),public:c.z.boolean().optional().describe("Whether this example is shown in docs/UI/MCP default output (default: true). Set false for test-only fixtures."),in:c.z.unknown().optional().describe("Input to the step"),trigger:mi.optional().describe("Source trigger metadata"),mapping:c.z.unknown().optional().describe("Mapping configuration"),out:c.z.unknown().optional().describe("Expected output from the step"),command:c.z.enum(["config","consent","user","run"]).optional().describe("Invoke elb('walker <command>', in) instead of pushing in as an event")}).meta({id:"FlowStepExample",title:"Flow.StepExample",description:"Named example with input/output pair used for step testing."}).describe("Named example with input/output pair"),gi=c.z.record(c.z.string(),fi).meta({id:"FlowStepExamples",title:"Flow.StepExamples",description:"Named step examples keyed by scenario name."}).describe("Named step examples for testing and documentation"),bi=c.z.object({package:c.z.string().min(1,"Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-source-browser@2.0.0")'),code:c.z.union([c.z.string(),ui]).optional().describe('Either a named export string (e.g., "sourceExpress") or an inline code object with push function'),config:c.z.looseObject({setup:c.z.union([c.z.boolean(),c.z.record(c.z.string(),c.z.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)")}).meta({id:"FlowSourceConfig",title:"Source.Config",description:"Source-specific configuration object (Source.Config)."}).optional().describe("Source-specific configuration object"),env:c.z.unknown().meta({id:"FlowSourceEnv",title:"Source.BaseEnv",description:"Source environment configuration (Source.BaseEnv overrides)."}).optional().describe("Source environment configuration"),primary:c.z.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary."),variables:si.optional().describe("Source-level variables (highest priority in cascade)"),next:Ue.optional().describe("Pre-collector transformer chain. String, string[], or NextRule[] for conditional routing based on ingest data."),before:Ue.optional().describe("Pre-source transformer chain (consent-exempt). Handles transport-level preprocessing."),examples:gi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"),cache:Ge.optional().describe("Cache configuration for this source (match → key → ttl rules)")}).meta({id:"FlowSource",title:"Flow.Source",description:"Source package reference with configuration, env, chains, and examples."}).describe("Source package reference with configuration"),hi=c.z.object({package:c.z.string().min(1,"Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/transformer-enricher@1.0.0")'),code:c.z.union([c.z.string(),ui]).optional().describe('Either a named export string (e.g., "transformerEnricher") or an inline code object with push function'),config:c.z.unknown().meta({id:"FlowTransformerConfig",title:"Transformer.Config",description:"Transformer-specific configuration object."}).optional().describe("Transformer-specific configuration object"),env:c.z.unknown().meta({id:"FlowTransformerEnv",title:"Transformer.Env",description:"Transformer environment configuration."}).optional().describe("Transformer environment configuration"),before:Ue.optional().describe("Pre-transformer chain. Runs before this transformer push function."),next:Ue.optional().describe("Next transformer in chain. String, string[], or NextRule[] for conditional routing."),variables:si.optional().describe("Transformer-level variables (highest priority in cascade)"),examples:gi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"),cache:Ge.optional().describe("Cache configuration for this transformer (match → key → ttl rules)")}).meta({id:"FlowTransformer",title:"Flow.Transformer",description:"Transformer package reference with configuration, env, chains, and cache."}).describe("Transformer package reference with configuration"),zi=c.z.object({package:c.z.string().min(1,"Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-destination-gtag@2.0.0")'),code:c.z.union([c.z.string(),ui]).optional().describe('Either a named export string (e.g., "destinationAnalytics") or an inline code object with push function'),config:c.z.looseObject({setup:c.z.union([c.z.boolean(),c.z.record(c.z.string(),c.z.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)")}).meta({id:"FlowDestinationConfig",title:"Destination.Config",description:"Destination-specific configuration object."}).optional().describe("Destination-specific configuration object"),env:c.z.unknown().meta({id:"FlowDestinationEnv",title:"Destination.Env",description:"Destination environment configuration."}).optional().describe("Destination environment configuration"),variables:si.optional().describe("Destination-level variables (highest priority in cascade)"),before:Ue.optional().describe("Post-collector transformer chain. String, string[], or NextRule[] for conditional routing."),next:Ue.optional().describe("Post-push transformer chain. Push response available at context.ingest._response."),examples:gi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"),cache:Ge.optional().describe("Cache configuration for this destination (match → key → ttl rules)")}).meta({id:"FlowDestination",title:"Flow.Destination",description:"Destination package reference with configuration, env, chains, and cache."}).describe("Destination package reference with configuration"),Si=c.z.object({package:c.z.string().min(1,"Package name cannot be empty").optional().describe("Store package specifier with optional version"),code:c.z.union([c.z.string(),ui]).optional().describe("Named export string or inline code definition"),config:c.z.looseObject({setup:c.z.union([c.z.boolean(),c.z.record(c.z.string(),c.z.unknown())]).optional().describe("One-time setup options applied during store registration (boolean enables defaults, object configures specifics)")}).meta({id:"FlowStoreConfig",title:"Store.Config",description:"Store-specific configuration object."}).optional().describe("Store-specific configuration object"),env:c.z.unknown().meta({id:"FlowStoreEnv",title:"Store.Env",description:"Store environment configuration."}).optional().describe("Store environment configuration"),variables:si.optional().describe("Store-level variables (highest priority in cascade)"),examples:gi.optional().describe("Named step examples for testing and documentation (stripped during bundling)")}).meta({id:"FlowStore",title:"Flow.Store",description:"Store package reference with configuration, env, and examples."}).describe("Store package reference with configuration"),vi=c.z.record(c.z.string(),c.z.unknown()).meta({id:"FlowContractSchemaEntry",title:"Flow.ContractSchemaEntry",description:"JSON Schema object for event validation with description/examples annotations."}).describe("JSON Schema object for event validation with description/examples annotations"),yi=c.z.record(c.z.string(),vi).meta({id:"FlowContractActions",title:"Flow.ContractActions",description:"Action-level contract entries keyed by action name."}).describe("Action-level contract entries"),wi=c.z.record(c.z.string(),yi).meta({id:"FlowContractEvents",title:"Flow.ContractEvents",description:"Entity-action event schemas (entity → action → schema)."}).describe("Entity-action event schemas"),ki=c.z.object({extends:c.z.string().optional().describe("Inherit from another named contract"),tagging:c.z.number().optional().describe("Tagging level (used by validators / runtime tagging policy)"),description:c.z.string().optional().describe("Human-readable description"),globals:vi.optional().describe("JSON Schema for event.globals"),context:vi.optional().describe("JSON Schema for event.context"),custom:vi.optional().describe("JSON Schema for event.custom"),user:vi.optional().describe("JSON Schema for event.user"),consent:vi.optional().describe("JSON Schema for event.consent"),events:wi.optional().describe("Entity-action event schemas")}).meta({id:"FlowContractRule",title:"Flow.ContractRule",description:"Named contract rule with optional sections (globals/context/custom/user/consent) and event schemas."}).describe("Named contract rule with optional sections and events"),Ci=c.z.record(c.z.string(),ki).meta({id:"FlowContract",title:"Flow.Contract",description:"Named contracts map with optional extends inheritance."}).describe("Named contracts with optional extends inheritance"),xi=c.z.object({platform:c.z.enum(["web","server"]).describe("Platform identity for this flow. Drives bundle target/format."),url:c.z.string().min(1).optional().describe("Public URL where this flow is reachable (for cross-flow $flow.X.url references)."),settings:ci.optional().describe("Free-form key-value settings consumed by the platform runtime."),bundle:pi.optional().describe("Bundle configuration: NPM packages, transitive dependency overrides.")}).meta({id:"FlowConfig",title:"Flow.Config",description:"Per-flow configuration block: platform identity, optional public URL, settings, bundle."}).describe("Per-flow configuration block"),Pi=c.z.object({config:xi.optional().describe("Per-flow configuration: platform, url, settings, bundle."),sources:c.z.record(c.z.string(),bi).optional().describe("Source configurations (data capture) keyed by unique identifier"),destinations:c.z.record(c.z.string(),zi).optional().describe("Destination configurations (data output) keyed by unique identifier"),transformers:c.z.record(c.z.string(),hi).optional().describe("Transformer configurations (event transformation) keyed by unique identifier"),stores:c.z.record(c.z.string(),Si).optional().describe("Store configurations (key-value storage) keyed by unique identifier"),collector:c.z.unknown().meta({id:"FlowCollector",title:"Collector.InitConfig",description:"Collector configuration for event processing (Collector.InitConfig)."}).optional().describe("Collector configuration for event processing (uses Collector.InitConfig)"),variables:si.optional().describe("Flow-level variables (override root variables, overridden by source/destination variables)")}).meta({id:"Flow",title:"Flow",description:"Single flow definition (one deployment target): config, sources, destinations, transformers, stores, collector."}).describe("Single flow definition for one deployment target"),Di=c.z.object({version:c.z.literal(4).describe("Configuration schema version (v4, current)."),$schema:c.z.string().url("Schema URL must be a valid URL").optional().describe('JSON Schema reference for IDE validation (e.g., "https://walkeros.io/schema/flow/v4.json")'),include:c.z.array(c.z.string()).optional().describe("Folders to include in the bundle output"),variables:si.optional().describe("Shared variables for interpolation across all flows (use $var.name syntax, deep paths supported)"),contract:Ci.optional().describe("Named contracts with extends inheritance and dot-path references"),flows:c.z.record(c.z.string(),Pi).refine(e=>Object.keys(e).length>0,{message:"At least one flow is required"}).describe("Named flow configurations (e.g., production, staging, development)")}).meta({id:"FlowJson",title:"Flow.Json",description:"walkerOS root configuration (walkeros.config.json) v4: version, variables, contract, named flows."}).describe("walkerOS root configuration (walkeros.config.json)");function Ei(e){return Di.parse(e)}function ji(e){return Di.safeParse(e)}function Ii(e){return Pi.parse(e)}function Oi(e){return Pi.safeParse(e)}var Ji=c.z.toJSONSchema(Di,{target:"draft-7"}),Mi=l(Pi),Ri=l(xi),Ti=l(bi),Fi=l(zi),Li=l(hi),Ni=l(Si),qi=l(ki),Wi=l(Ci),Bi=require("zod"),Hi=Bi.z.object({lang:Bi.z.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"),code:Bi.z.string().describe("Code snippet")}),Ui=Bi.z.object({text:Bi.z.string().describe("Short actionable hint text focused on walkerOS usage"),code:Bi.z.array(Hi).optional().describe("Optional code snippets")}),Ai=Bi.z.record(Bi.z.string(),Ui).describe("Keyed hints for AI consumption — lightweight context beyond schemas and examples"),$i=c.z.object({param:c.z.string().describe("Lowercase URL parameter name. Match is case-insensitive on lookup."),platform:c.z.string().describe("Canonical platform identifier (lowercase, kebab-case).")});function Vi(e){let t;try{t=JSON.parse(e)}catch(t){const{line:i,column:n}=function(e,t){if(e instanceof SyntaxError){const i=e.message.match(/position\s+(\d+)/);if(i){return Gi(t,parseInt(i[1],10))}const n=e.message.match(/line\s+(\d+)\s+column\s+(\d+)/);if(n)return{line:parseInt(n[1],10),column:parseInt(n[2],10)}}return{line:1,column:1}}(t,e);return{valid:!1,errors:[{message:t instanceof Error?t.message:"Invalid JSON",severity:"error",line:i,column:n}],warnings:[]}}const i=[],n=[],o=Di.safeParse(t);if(!o.success)for(const t of o.error.issues){const n=t.path.join("."),o=Ki(e,t.path);i.push({message:t.message,severity:"error",path:n||"root",...o})}const r=function(e){if(!(Qi(e)&&"version"in e&&"flows"in e&&Qi(e.flows)))return;const t={},i=[],n=[],o=[],r=[],a=[];let s;Xi(t,e.variables),function(e,t){if(!Qi(t))return;for(const[,i]of Object.entries(t)){if(!Qi(i))continue;const t=i.events;if(Qi(t))for(const[i,n]of Object.entries(t)){if(!Qi(n))continue;const t=e.find(e=>e.entity===i),o=Object.keys(n);if(t)for(const e of o)t.actions.includes(e)||t.actions.push(e);else e.push({entity:i,actions:o})}}}(a,e.contract);for(const a of Object.values(e.flows))if(Qi(a)){if(!s){const e=a.config;!Qi(e)||"web"!==e.platform&&"server"!==e.platform||(s=e.platform)}Xi(t,a.variables);for(const e of["sources","destinations","transformers"]){const c="sources"===e?"source":"destinations"===e?"destination":"transformer",l="sources"===e?i:"destinations"===e?n:o;if(Qi(a[e]))for(const[i,n]of Object.entries(a[e]))l.push(i),Qi(n)&&(Xi(t,n.variables),"string"==typeof n.package&&r.push({package:n.package,shortName:i,type:c,platform:s||"web"}))}}const c={variables:t,stepNames:{sources:i,destinations:n,transformers:o}};s&&(c.platform=s);r.length>0&&(c.packages=r);a.length>0&&(c.contract=a);return c}(t);if(r){const t=function(e,t){const i=[];if(t.variables){const n=/\$var\.(\w+)/g;let o;for(;null!==(o=n.exec(e));)if(!(o[1]in t.variables)){const n=_i(e,o.index,o[0].length);i.push({message:`Unknown variable "$var.${o[1]}". Defined: ${Object.keys(t.variables).join(", ")||"none"}`,severity:"warning",path:`$var.${o[1]}`,...n})}}return i}(e,r);n.push(...t)}return{valid:0===i.length,errors:i,warnings:n,context:r}}function Gi(e,t){let i=1,n=1;for(let o=0;o<t&&o<e.length;o++)"\n"===e[o]?(i++,n=1):n++;return{line:i,column:n}}function _i(e,t,i){const n=Gi(e,t),o=Gi(e,t+i);return{line:n.line,column:n.column,endLine:o.line,endColumn:o.column}}function Ki(e,t){if(0===t.length)return{line:1,column:1};const i=t[t.length-1];if("string"==typeof i){const t=`"${i}"`,n=e.lastIndexOf(t);if(-1!==n)return Gi(e,n)}return{line:1,column:1}}function Qi(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Xi(e,t){if(Qi(t))for(const[i,n]of Object.entries(t))e[i]=n}function Yi(e,t){const i=[],n={};for(const[t,o]of Object.entries(e)){o.required&&i.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,i]of Object.entries(o.properties))t[e]=Zi(i);e.properties=t}"array"===o.type&&o.items&&(e.items=Zi(o.items)),n[t]=e}const o={type:"object",properties:n};return t&&(o.title=t),i.length>0&&(o.required=i),o}function Zi(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 i={};for(const[t,n]of Object.entries(e.properties))i[t]=Zi(n);t.properties=i}return"array"===e.type&&e.items&&(t.items=Zi(e.items)),t}function en(e,t){const i={type:"array",items:Zi(e)};return void 0!==t?.minItems&&(i.minItems=t.minItems),void 0!==t?.maxItems&&(i.maxItems=t.maxItems),t?.description&&(i.description=t.description),t?.title&&(i.title=t.title),i}function tn(e,t="string",i){const n={type:t,enum:[...e]};return i?.description&&(n.description=i.description),i?.title&&(n.title=i.title),n}function nn(e,t,i){return en({type:"object"},{minItems:2,maxItems:2,description:i||"Tuple with exactly 2 elements [source, transform]"})}function on(e){return c.z.toJSONSchema(e,{target:"draft-7"})}var rn=new Set(["env","onError","onLog","primary"]),an={source:Ft.configJsonSchema,destination:Le.configJsonSchema};function sn(e,t){const i=function(e){if(!e)return e;if(e.properties)return e;const{ref:t,container:i,containerKey:n}=function(e){const t=e.$defs,i=e.definitions,n=t??i,o=t?"$defs":"definitions";let r;if("string"==typeof e.$ref)r=e.$ref;else if(Array.isArray(e.allOf)){const t=e.allOf[0];t&&"string"==typeof t.$ref&&(r=t.$ref)}return{ref:r,container:n,containerKey:o}}(e);if(!t||!i)return e;const o=t.match(/^#\/(\$defs|definitions)\/(.+)$/);if(!o)return e;const r=o[2],a=i[r];return a&&"object"==typeof a?{...a,[n]:i}:e}(an[e]);if(!i||!i.properties){return{type:"object",properties:{settings:t.settings?cn(t.settings):{description:"Implementation-specific configuration"}}}}const n=JSON.parse(JSON.stringify(i)),o=n.properties;for(const e of rn)delete o[e];return t.settings&&(o.settings=cn(t.settings)),n}function cn(e){const{$schema:t,...i}=e;return i}function ln(e){return 0===e.length?"// no output":e.map(dn).join(";\n\n")}function dn(e){const[t,...i]=e,n=i.map(pn).join(", ");return"return"===t?n?`return ${n}`:"return":`${t}(${n})`}function pn(e){return void 0===e?"undefined":null===e?"null":"function"==typeof e?"[Function]":JSON.stringify(e,null,2)}//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,r=(e,i)=>{for(var n in i)t(e,n,{get:i[n],enumerable:!0})},a={};r(a,{ClickIdEntrySchema:()=>Hi,formatOut:()=>mn,mergeConfigSchema:()=>pn,schemas:()=>s,z:()=>c.z,zodToSchema:()=>cn}),module.exports=(e=a,((e,r,a,s)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let c of n(r))o.call(e,c)||c===a||t(e,c,{get:()=>r[c],enumerable:!(s=i(r,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};r(s,{BaseContextConfig:()=>A,BatchConfig:()=>B,CacheRuleSchema:()=>Ve,CacheSchema:()=>_e,CacheSchemas:()=>He,ClickIdEntrySchema:()=>Hi,CodeSchema:()=>Ai,CollectorSchemas:()=>yt,ConsentSchema:()=>ee,ContractActionsSchema:()=>yi,ContractRuleSchema:()=>ki,ContractSchema:()=>Ci,ContractSchemaEntry:()=>vi,Counter:()=>g,DeepPartialEventSchema:()=>se,DestinationSchemas:()=>Ne,DestinationsMapConfig:()=>V,EntitiesSchema:()=>oe,EntitySchema:()=>ne,EventSchema:()=>re,FlowBundlePackageSchema:()=>di,FlowBundleSchema:()=>pi,FlowCodeSchema:()=>ui,FlowConfigSchema:()=>xi,FlowDestinationSchema:()=>zi,FlowJsonSchema:()=>Di,FlowSchema:()=>Pi,FlowSchemas:()=>ai,FlowSourceSchema:()=>bi,FlowStoreSchema:()=>Si,FlowTransformerSchema:()=>hi,GenericEnvConfig:()=>F,GenericSettingsConfig:()=>T,HandlersConfig:()=>j,HintSchema:()=>Bi,HintsSchema:()=>Ui,IdConfig:()=>J,Identifier:()=>m,InitConfig:()=>M,LoggerConfigSchema:()=>Ge,LoggerHandlerSchema:()=>Ze,LoopSchema:()=>Se,MapSchema:()=>ye,MappingResultSchema:()=>De,MappingSchemas:()=>be,MatchExpressionSchema:()=>We,MatcherSchemas:()=>Le,NextRuleSchema:()=>Ue,OptionalPrimitiveValue:()=>h,OrderedPropertiesSchema:()=>X,PartialEventSchema:()=>ae,PolicySchema:()=>ke,PrimaryConfig:()=>R,PrimitiveValue:()=>b,ProcessingControlConfig:()=>U,PropertiesSchema:()=>Q,PropertySchema:()=>K,PropertyTypeSchema:()=>G,QueueConfig:()=>O,RequiredBoolean:()=>u,RequiredNumber:()=>p,RequiredString:()=>d,RoutableNextSchema:()=>Be,RuleSchema:()=>Ce,RulesSchema:()=>xe,RuntimeInstanceConfig:()=>W,SetSchema:()=>ve,SourceSchema:()=>ie,SourceSchemas:()=>Ft,SourceTypeSchema:()=>Y,SourcesMapConfig:()=>H,StoreSchemas:()=>ti,Timestamp:()=>f,TransformerSchemas:()=>Kt,UserSchema:()=>te,UtilitySchemas:()=>z,ValueConfigSchema:()=>we,ValueSchema:()=>he,ValuesSchema:()=>ze,VerboseConfig:()=>I,WalkerOSSchemas:()=>_,configJsonSchema:()=>Ji,consentJsonSchema:()=>ge,contractJsonSchema:()=>qi,contractRuleJsonSchema:()=>$i,createArraySchema:()=>rn,createConsentConfig:()=>q,createDataTransformationConfig:()=>N,createEnumSchema:()=>an,createMappingRulesConfig:()=>L,createObjectSchema:()=>nn,createPolicyConfig:()=>$,createTupleSchema:()=>sn,destinationJsonSchema:()=>Fi,entityJsonSchema:()=>me,eventJsonSchema:()=>ce,flowConfigJsonSchema:()=>Ri,flowJsonSchema:()=>Mi,loopJsonSchema:()=>Ie,mapJsonSchema:()=>Je,orderedPropertiesJsonSchema:()=>ue,parseConfig:()=>Ei,parseFlow:()=>Ii,partialEventJsonSchema:()=>le,policyJsonSchema:()=>Me,propertiesJsonSchema:()=>pe,ruleJsonSchema:()=>Re,rulesJsonSchema:()=>Te,safeParseConfig:()=>ji,safeParseFlow:()=>Oi,setJsonSchema:()=>Oe,sourceJsonSchema:()=>Ti,sourceTypeJsonSchema:()=>fe,storeJsonSchema:()=>Li,transformerJsonSchema:()=>Ni,userJsonSchema:()=>de,validateFlowConfig:()=>Vi,valueConfigJsonSchema:()=>je,valueJsonSchema:()=>Ee,z:()=>c.z,zodToSchema:()=>cn});var c=require("zod");function l(e,t,i="draft-7"){return c.z.toJSONSchema(e,{target:i})}var d=c.z.string(),p=c.z.number(),u=c.z.boolean(),m=c.z.string().min(1),f=c.z.number().int().positive(),g=c.z.number().int().nonnegative(),b=c.z.union([c.z.string(),c.z.number(),c.z.boolean()]),h=b.optional(),z={};r(z,{ErrorHandlerSchema:()=>y,HandlerSchema:()=>k,LogHandlerSchema:()=>w,StorageSchema:()=>v,StorageTypeSchema:()=>S,errorHandlerJsonSchema:()=>P,handlerJsonSchema:()=>E,logHandlerJsonSchema:()=>D,storageJsonSchema:()=>x,storageTypeJsonSchema:()=>C});var S=c.z.enum(["local","session","cookie"]).meta({id:"StorageType",title:"Storage.Type",description:"Storage mechanism: local, session, or cookie."}).describe("Storage mechanism: local, session, or cookie"),v=c.z.object({Local:c.z.literal("local"),Session:c.z.literal("session"),Cookie:c.z.literal("cookie")}).meta({id:"StorageConstants",title:"Storage",description:"Storage type constants for type-safe references."}).describe("Storage type constants for type-safe references"),y=c.z.unknown().meta({id:"ErrorHandler",title:"Error.Handler",description:"Error handler function: (error, state?) => void."}).describe("Error handler function: (error, state?) => void"),w=c.z.unknown().meta({id:"LogHandler",title:"Log.Handler",description:"Log handler function: (message, verbose?) => void."}).describe("Log handler function: (message, verbose?) => void"),k=c.z.object({Error:y.describe("Error handler function"),Log:w.describe("Log handler function")}).meta({id:"Handler",title:"Handler",description:"Handler interface with error and log functions."}).describe("Handler interface with error and log functions"),C=l(S),x=l(v),P=l(y),D=l(w),E=l(k),j=c.z.object({onError:y.optional().describe("Error handler function: (error, state?) => void"),onLog:w.optional().describe("Log handler function: (message, verbose?) => void")}).partial(),I=c.z.object({verbose:c.z.boolean().describe("Enable verbose logging for debugging").optional()}).partial(),O=c.z.object({queue:c.z.boolean().describe("Whether to queue events when consent is not granted").optional()}).partial(),J=c.z.object({}).partial(),M=c.z.object({init:c.z.boolean().describe("Whether to initialize immediately").optional(),loadScript:c.z.boolean().describe("Whether to load external script (for web destinations)").optional()}).partial(),R=c.z.object({primary:c.z.boolean().describe("Mark as primary (only one can be primary)").optional()}).partial(),T=c.z.object({settings:c.z.any().optional().describe("Implementation-specific configuration")}).partial(),F=c.z.object({env:c.z.any().optional().describe("Environment dependencies (platform-specific)")}).partial();function N(e,t){return c.z.object({data:c.z.union([e,t]).optional().describe("Data transformation rules")}).partial()}function L(e){return c.z.object({mapping:e.optional().describe("Event mapping rules")}).partial()}function $(e){return c.z.object({policy:e.optional().describe("Pre-processing policy rules")}).partial()}function q(e){return c.z.object({consent:e.optional().describe("Required consent states")}).partial()}var W=c.z.object({type:c.z.string().optional().describe("Instance type identifier"),config:c.z.unknown().describe("Instance configuration")}).partial(),A=c.z.object({collector:c.z.unknown().describe("Collector instance (runtime object)"),config:c.z.unknown().describe("Configuration"),env:c.z.unknown().describe("Environment dependencies")}).partial(),B=c.z.object({batch:c.z.number().optional().describe("Batch size: bundle N events for batch processing"),batched:c.z.unknown().optional().describe("Batch of events to be processed")}).partial(),U=c.z.object({ignore:c.z.boolean().describe("Set to true to skip processing").optional(),condition:c.z.string().optional().describe("Condition function: return true to process")}).partial(),H=c.z.object({sources:c.z.record(c.z.string(),c.z.unknown()).describe("Map of source instances")}).partial(),V=c.z.object({destinations:c.z.record(c.z.string(),c.z.unknown()).describe("Map of destination instances")}).partial(),_={};r(_,{ConsentSchema:()=>ee,DeepPartialEventSchema:()=>se,EntitiesSchema:()=>oe,EntitySchema:()=>ne,EventSchema:()=>re,OrderedPropertiesSchema:()=>X,PartialEventSchema:()=>ae,PropertiesSchema:()=>Q,PropertySchema:()=>K,PropertyTypeSchema:()=>G,SourceSchema:()=>ie,SourceTypeSchema:()=>Y,UserSchema:()=>te,consentJsonSchema:()=>ge,entityJsonSchema:()=>me,eventJsonSchema:()=>ce,orderedPropertiesJsonSchema:()=>ue,partialEventJsonSchema:()=>le,propertiesJsonSchema:()=>pe,sourceTypeJsonSchema:()=>fe,userJsonSchema:()=>de});var Z,G=c.z.lazy(()=>c.z.union([c.z.boolean(),c.z.string(),c.z.number(),c.z.record(c.z.string(),K)])).meta({id:"WalkerOSPropertyType",title:"WalkerOS.PropertyType",description:"Base property value types (boolean, string, number, or nested Property record)."}),K=c.z.lazy(()=>c.z.union([G,c.z.array(G)])).meta({id:"WalkerOSProperty",title:"WalkerOS.Property",description:"PropertyType or an array of PropertyType. Recursive structure for nested objects and arrays."}),Q=c.z.record(c.z.string(),K.optional()).meta({id:"WalkerOSProperties",title:"WalkerOS.Properties",description:"Flexible property collection with optional values."}).describe("Flexible property collection with optional values"),X=c.z.record(c.z.string(),c.z.tuple([K,c.z.number()]).optional()).meta({id:"WalkerOSOrderedProperties",title:"WalkerOS.OrderedProperties",description:"Ordered properties with [value, order] tuples for priority control."}).describe("Ordered properties with [value, order] tuples for priority control"),Y=c.z.union([c.z.enum(["web","server","app","other"]),c.z.string()]).meta({id:"WalkerOSSourceType",title:"WalkerOS.SourceType",description:"Source type identifier. Standard: web, server, app, other. Extensible to custom strings."}).describe("Source type: web, server, app, other, or custom"),ee=c.z.record(c.z.string(),c.z.boolean()).meta({id:"WalkerOSConsent",title:"WalkerOS.Consent",description:"Consent state mapping. Keys are consent groups (e.g. marketing, functional), values are booleans for granted/denied."}).describe("Consent requirement mapping (group name to state)"),te=Q.and(c.z.object({id:c.z.string().optional().describe("User identifier"),device:c.z.string().optional().describe("Device identifier"),session:c.z.string().optional().describe("Session identifier"),hash:c.z.string().optional().describe("Hashed identifier"),address:c.z.string().optional().describe("User address"),email:c.z.string().email().optional().describe("User email address"),phone:c.z.string().optional().describe("User phone number"),userAgent:c.z.string().optional().describe("Browser user agent string"),browser:c.z.string().optional().describe("Browser name"),browserVersion:c.z.string().optional().describe("Browser version"),deviceType:c.z.string().optional().describe("Device type (mobile, desktop, tablet)"),os:c.z.string().optional().describe("Operating system"),osVersion:c.z.string().optional().describe("Operating system version"),screenSize:c.z.string().optional().describe("Screen dimensions"),language:c.z.string().optional().describe("User language"),country:c.z.string().optional().describe("User country"),region:c.z.string().optional().describe("User region/state"),city:c.z.string().optional().describe("User city"),zip:c.z.string().optional().describe("User postal code"),timezone:c.z.string().optional().describe("User timezone"),ip:c.z.string().optional().describe("User IP address"),internal:c.z.boolean().optional().describe("Internal user flag (employee, test user)")})).meta({id:"WalkerOSUser",title:"WalkerOS.User",description:"User identification and attributes."}).describe("User identification and properties"),ie=Q.and(c.z.object({type:c.z.string().describe("Source kind (browser, dataLayer, gtag, ...)"),platform:c.z.string().optional().describe("Runtime platform (web, server, app, ios, android, terminal, ...)"),version:c.z.string().optional().describe("Deployment version of the source emitter"),schema:c.z.string().optional().describe('Event model spec version (collector defaults to "4")'),count:c.z.number().int().nonnegative().optional().describe("Emission sequence per run"),trace:c.z.string().optional().describe("W3C traceparent full string"),url:c.z.string().optional(),referrer:c.z.string().optional(),tool:c.z.string().optional(),command:c.z.string().optional()})).meta({id:"WalkerOSSource",title:"WalkerOS.Source",description:"Event source information (origin of the event)."}).describe("Event source information"),ne=c.z.lazy(()=>c.z.object({entity:c.z.string().describe("Entity name"),data:Q.describe("Entity-specific properties"),nested:c.z.array(ne).optional().describe("Nested child entities"),context:X.optional().describe("Entity context data")})).meta({id:"WalkerOSEntity",title:"WalkerOS.Entity",description:"Nested entity structure with recursive nesting support."}).describe("Nested entity structure with recursive nesting support"),oe=c.z.array(ne).meta({id:"WalkerOSEntities",title:"WalkerOS.Entities",description:"Array of nested entities."}).describe("Array of nested entities"),re=c.z.object({name:c.z.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'),data:Q.describe("Event-specific properties"),context:X.describe("Ordered context properties with priorities"),globals:Q.describe("Global properties shared across events"),custom:Q.describe("Custom implementation-specific properties"),user:te.describe("User identification and attributes"),nested:oe.describe("Related nested entities"),consent:ee.describe("Consent states at event time"),id:m.describe("W3C span_id, 16 lowercase hex characters"),trigger:d.describe("Event trigger identifier"),entity:d.describe("Parsed entity from event name"),action:d.describe("Parsed action from event name"),timestamp:f.describe("Unix timestamp in milliseconds since epoch"),timing:p.describe("Event processing timing information"),source:ie.describe("Event source information")}).meta({id:"WalkerOSEvent",title:"WalkerOS.Event",description:"Complete walkerOS event structure."}).describe("Complete walkerOS event structure"),ae=re.partial().meta({id:"WalkerOSPartialEvent",title:"WalkerOS.PartialEvent",description:"Partial event structure with all fields optional."}).describe("Partial event structure with all fields optional"),se=re.partial().meta({id:"WalkerOSDeepPartialEvent",title:"WalkerOS.DeepPartialEvent",description:"Partial event structure with all top-level fields optional."}).describe("Partial event structure with all top-level fields optional"),ce=l(re),le=l(ae),de=l(te),pe=l(Q),ue=l(X),me=l(ne),fe=l(Y),ge=l(ee),be={};r(be,{ConfigSchema:()=>Pe,LoopSchema:()=>Se,MapSchema:()=>ye,PolicySchema:()=>ke,ResultSchema:()=>De,RuleSchema:()=>Ce,RulesSchema:()=>xe,SetSchema:()=>ve,ValueConfigSchema:()=>we,ValueSchema:()=>he,ValuesSchema:()=>ze,configJsonSchema:()=>Fe,loopJsonSchema:()=>Ie,mapJsonSchema:()=>Je,policyJsonSchema:()=>Me,ruleJsonSchema:()=>Re,rulesJsonSchema:()=>Te,setJsonSchema:()=>Oe,valueConfigJsonSchema:()=>je,valueJsonSchema:()=>Ee});var he=c.z.lazy(()=>c.z.union([c.z.string().describe('String value or property path (e.g., "data.id")'),c.z.number().describe("Numeric value"),c.z.boolean().describe("Boolean value"),c.z.lazy(()=>Z),c.z.array(he).describe("Array of values")])).meta({id:"MappingValue",title:"Mapping.Value",description:"Polymorphic transform primitive used in every mapping field. A string path, constant, operator object (map/loop/set/condition/consent), or array of values."}),ze=c.z.array(he).meta({id:"MappingValues",title:"Mapping.Values",description:"Array of transformation values."}).describe("Array of transformation values"),Se=c.z.lazy(()=>c.z.tuple([he,he]).describe("Loop transformation: [source, transform] tuple for array processing")).meta({id:"MappingLoop",title:"Mapping.Loop",description:"Loop tuple [source, transform] for iterating and transforming arrays."}),ve=c.z.lazy(()=>c.z.array(he).describe("Set: Array of values for selection or combination")).meta({id:"MappingSet",title:"Mapping.Set",description:"Set: array of values for selection or combination."}),ye=c.z.lazy(()=>c.z.record(c.z.string(),he).describe("Map: Object mapping keys to transformation values")).meta({id:"MappingMap",title:"Mapping.Map",description:"Map: object mapping keys to transformation values."}),we=Z=c.z.object({key:c.z.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'),value:c.z.union([c.z.string(),c.z.number(),c.z.boolean()]).optional().describe("Static primitive value"),fn:c.z.string().optional().describe("Custom transformation function as string (serialized)"),map:ye.optional().describe("Object mapping: transform event data to structured output"),loop:Se.optional().describe("Loop transformation: [source, transform] for array processing"),set:ve.optional().describe("Set of values: combine or select from multiple values"),consent:ee.optional().describe("Required consent states to include this value"),condition:c.z.string().optional().describe("Condition function as string: return true to include value"),validate:c.z.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"}).meta({id:"MappingValueConfig",title:"Mapping.ValueConfig",description:"Object-form value transformation with map/loop/set/condition/consent etc."}).describe("Value transformation configuration with multiple strategies"),ke=c.z.record(c.z.string(),he).meta({id:"MappingPolicy",title:"Mapping.Policy",description:"Policy rules for event pre-processing (key → value transformation)."}).describe("Policy rules for event pre-processing (key → value mapping)"),Ce=c.z.object({name:c.z.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'),data:c.z.union([he,ze]).optional().describe("Data transformation rules for event"),settings:c.z.any().optional().describe("Destination-specific settings for this event mapping"),condition:c.z.string().optional().describe("Condition function as string: return true to process event"),consent:ee.optional().describe("Required consent states to process this event"),policy:ke.optional().describe("Event-level policy overrides (applied after config-level policy)"),batch:c.z.number().optional().describe("Batch size: bundle N events for batch processing"),include:c.z.array(c.z.string()).optional().describe('Event sections (e.g. ["context", "globals"]) flattened into context.data'),ignore:c.z.boolean().optional().describe("Skip the event entirely. No push, no side effects. Use for suppression."),silent:c.z.boolean().optional().describe("Run side effects (settings.identify, ...) but suppress the destination default push call.")}).meta({id:"MappingRule",title:"Mapping.Rule",description:"Configuration for transforming a single event at one stage of the flow (source or destination)."}).describe("Mapping rule for specific entity-action combination"),xe=c.z.record(c.z.string(),c.z.record(c.z.string(),c.z.union([Ce,c.z.array(Ce)])).optional()).meta({id:"MappingRules",title:"Mapping.Rules",description:'Event mapping rules tree: entity → action → Rule (or Rule[]). Use "*" as wildcard for entity or action.'}).describe('Event mapping rules: entity → action → Rule. Keys match event name split by space. Use "*" as wildcard for entity or action. Priority: exact > entity wildcard > action wildcard > global wildcard (*→*).'),Pe=c.z.object({consent:ee.optional().describe("Required consent states to process any events"),data:c.z.union([he,ze]).optional().describe("Global data transformation applied to all events"),include:c.z.array(c.z.string()).optional().describe("Event sections to flatten into context.data"),mapping:xe.optional().describe("Entity-action specific mapping rules"),policy:ke.optional().describe("Pre-processing policy rules applied before mapping")}).meta({id:"MappingConfig",title:"Mapping.Config",description:"Shared mapping configuration (consent, data, include, mapping, policy)."}).describe("Shared mapping configuration for sources and destinations"),De=c.z.object({eventMapping:Ce.optional().describe("Resolved mapping rule for event"),mappingKey:c.z.string().optional().describe('Mapping key used (e.g., "product.view")')}).meta({id:"MappingResult",title:"Mapping.Result",description:"Mapping resolution result (matched rule + key)."}).describe("Mapping resolution result"),Ee=l(he),je=l(we),Ie=l(Se),Oe=l(ve),Je=l(ye),Me=l(ke),Re=l(Ce),Te=l(xe),Fe=l(Pe),Ne={};r(Ne,{BatchSchema:()=>ot,ConfigSchema:()=>Ke,ContextSchema:()=>Ye,DLQSchema:()=>mt,DataSchema:()=>rt,DestinationPolicySchema:()=>Xe,DestinationsSchema:()=>lt,InitDestinationsSchema:()=>ct,InitSchema:()=>st,InstanceSchema:()=>at,PartialConfigSchema:()=>Qe,PushBatchContextSchema:()=>tt,PushContextSchema:()=>et,PushEventSchema:()=>it,PushEventsSchema:()=>nt,PushResultSchema:()=>pt,RefSchema:()=>dt,ResultSchema:()=>ut,batchJsonSchema:()=>zt,configJsonSchema:()=>ft,contextJsonSchema:()=>bt,instanceJsonSchema:()=>St,partialConfigJsonSchema:()=>gt,pushContextJsonSchema:()=>ht,resultJsonSchema:()=>vt});var Le={};r(Le,{MatchExpressionSchema:()=>We,NextRuleSchema:()=>Ue,RoutableNextSchema:()=>Be});var $e=c.z.enum(["eq","contains","prefix","suffix","regex","gt","lt","exists"]).meta({id:"MatcherOperator",title:"Matcher.Operator",description:"Supported operators for a match condition."}),qe=c.z.object({key:c.z.string(),operator:$e,value:c.z.string(),not:c.z.boolean().optional()}).meta({id:"MatcherCondition",title:"Matcher.Condition",description:"Single match condition (key, operator, value, optional not)."}),We=c.z.union([qe,c.z.object({and:c.z.array(c.z.lazy(()=>We))}),c.z.object({or:c.z.array(c.z.lazy(()=>We))})]).meta({id:"MatcherExpression",title:"Matcher.Expression",description:"Boolean expression tree of match conditions (leaf, and, or)."}),Ae=c.z.union([We,c.z.literal("*")]),Be=c.z.union([c.z.string(),c.z.array(c.z.string()),c.z.array(c.z.object({match:Ae,next:c.z.lazy(()=>Be)}))]).meta({id:"MatcherNext",title:"Matcher.Next",description:"Routable next target: ID, ID list, or list of {match, next} rules."}),Ue=c.z.object({match:Ae,next:c.z.lazy(()=>Be)}).meta({id:"MatcherNextRule",title:"Matcher.NextRule",description:"Single routing rule pairing a match expression with a next target."}),He={};r(He,{CacheRuleSchema:()=>Ve,CacheSchema:()=>_e});var Ve=c.z.object({match:c.z.union([We,c.z.literal("*")]).describe("Match expression or wildcard to determine when this rule applies"),key:c.z.array(c.z.string()).min(1).describe("Dot-path fields used to build the cache key"),ttl:c.z.number().positive().describe("Time-to-live in seconds for cached entries"),update:c.z.record(c.z.string(),he).optional().describe("Response mutations applied on cache hit (key → Value mapping)")}).meta({id:"CacheRule",title:"Cache.Rule",description:"Single caching rule: when it applies (match), what keys it keys off, TTL, and optional response mutations on hit."}),_e=c.z.object({full:c.z.boolean().optional().describe("Stop flow on cache HIT (default: false). When true, skip remaining steps and return cached value."),store:c.z.string().optional().describe("Store ID for persistent caching (references a configured store)"),rules:c.z.array(Ve).min(1).describe("Cache rules — at least one required")}).meta({id:"CacheConfig",title:"Cache.Config",description:"Top-level cache configuration for a pipeline step (destination / transformer / source ref)."}),Ze=c.z.any().meta({id:"LoggerHandler",title:"Logger.Handler",description:"Custom log handler function (level, ...args) => void"}),Ge=c.z.object({level:c.z.union([c.z.number(),c.z.enum(["ERROR","WARN","INFO","DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"),handler:Ze.optional().describe("Custom log handler function")}).meta({id:"LoggerConfig",title:"Logger.Config",description:"Logger configuration (level, handler) to override the collector defaults"}),Ke=c.z.object({consent:ee.optional().describe("Required consent states to send events to this destination"),settings:c.z.any().meta({id:"DestinationSettings",title:"Destination.Settings",description:"Implementation-specific configuration (destination-defined shape)."}).describe("Implementation-specific configuration").optional(),data:c.z.union([he,ze]).optional().describe("Global data transformation applied to all events for this destination"),include:c.z.array(c.z.string()).optional().describe("Event sections to flatten into context.data"),env:c.z.any().meta({id:"DestinationEnv",title:"Destination.Env",description:"Environment dependencies (destination-defined shape) — platform, SDK, or mock hook."}).describe("Environment dependencies (platform-specific)").optional(),id:m.describe("Destination instance identifier (defaults to destination key)").optional(),init:c.z.boolean().describe("Whether to initialize immediately").optional(),loadScript:c.z.boolean().describe("Whether to load external script (for web destinations)").optional(),mapping:xe.optional().describe("Entity-action specific mapping rules for this destination"),policy:ke.optional().describe("Pre-processing policy rules applied before event mapping"),queue:c.z.boolean().describe("Whether to queue events when consent is not granted").optional(),require:c.z.array(c.z.string()).optional().describe('Defer destination initialization until these collector events fire (e.g., ["consent"])'),logger:Ge.optional().describe("Logger configuration (level, handler) to override the collector defaults"),setup:c.z.union([c.z.boolean(),c.z.record(c.z.string(),c.z.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)"),before:Be.optional().describe("Post-collector transformer chain applied before this destination receives the event"),next:Be.optional().describe("Post-push transformer chain. Runs after destination push completes; push response is available at ingest._response"),cache:_e.optional().describe("Cache configuration for deduplication; skip push on cache HIT"),disabled:c.z.boolean().describe("Completely skip this destination (no init, no push, no queue)").optional(),mock:c.z.unknown().meta({id:"DestinationMock",title:"Destination.Mock",description:"Return this value instead of calling push(). Dev/testing only."}).optional().describe("Return this value instead of calling push(). Dev/testing only.")}).meta({id:"DestinationConfig",title:"Destination.Config",description:"Destination configuration: consent, settings, data, env, mapping rules, policy, queue, logger, before/next chains, cache."}).describe("Destination configuration"),Qe=Ke.partial().meta({id:"DestinationPartialConfig",title:"Destination.PartialConfig",description:"Partial destination configuration with all fields optional."}).describe("Partial destination configuration with all fields optional"),Xe=ke.describe("Destination policy rules for event pre-processing"),Ye=c.z.object({collector:c.z.unknown().meta({id:"DestinationContextCollector",title:"Collector.Instance",description:"Collector instance handed to the destination (runtime object)."}).describe("Collector instance (runtime object)"),config:Ke.describe("Destination configuration"),data:c.z.union([c.z.unknown(),c.z.array(c.z.unknown())]).optional().describe("Transformed event data"),env:c.z.unknown().meta({id:"DestinationContextEnv",title:"Destination.Env",description:"Environment dependencies (destination-defined shape)."}).describe("Environment dependencies")}).meta({id:"DestinationContext",title:"Destination.Context",description:"Destination context passed to init and push functions."}).describe("Destination context for init and push functions"),et=Ye.extend({mapping:Ce.optional().describe("Resolved mapping rule for this specific event")}).meta({id:"DestinationPushContext",title:"Destination.PushContext",description:"Destination context for push() with the resolved event mapping rule."}).describe("Push context with event-specific mapping"),tt=et.describe("Batch push context with event-specific mapping"),it=c.z.object({event:re.describe("The event to process"),mapping:Ce.optional().describe("Mapping rule for this event")}).meta({id:"DestinationPushEvent",title:"Destination.PushEvent",description:"Single event paired with its resolved mapping rule (batch element)."}).describe("Event with optional mapping for batch processing"),nt=c.z.array(it).meta({id:"DestinationPushEvents",title:"Destination.PushEvents",description:"Array of events with mappings (batch input)."}).describe("Array of events with mappings"),ot=c.z.object({key:c.z.string().describe('Batch key (usually mapping key like "product.view")'),events:c.z.array(re).describe("Array of events in batch"),data:c.z.array(c.z.union([c.z.unknown(),c.z.array(c.z.unknown())]).optional()).describe("Transformed data for each event"),mapping:Ce.optional().describe("Shared mapping rule for batch")}).meta({id:"DestinationBatch",title:"Destination.Batch",description:"Batch of events grouped by mapping key for batch delivery."}).describe("Batch of events grouped by mapping key"),rt=c.z.union([c.z.unknown(),c.z.array(c.z.unknown())]).meta({id:"DestinationData",title:"Destination.Data",description:"Transformed event data delivered to the destination (Property, undefined, or array)."}).optional().describe("Transformed event data (Property, undefined, or array)"),at=c.z.object({config:Ke.describe("Destination configuration"),queue:c.z.array(re).optional().describe("Queued events awaiting consent"),dlq:c.z.array(c.z.tuple([re,c.z.unknown()])).optional().describe("Dead letter queue (failed events with errors)"),type:c.z.string().optional().describe("Destination type identifier"),env:c.z.unknown().optional().describe("Environment dependencies"),init:c.z.unknown().optional().describe("Initialization function"),push:c.z.unknown().describe("Push function for single events"),pushBatch:c.z.unknown().optional().describe("Batch push function"),on:c.z.unknown().optional().describe("Event lifecycle hook function")}).meta({id:"DestinationInstance",title:"Destination.Instance",description:"Destination instance (runtime object with init/push/pushBatch/on)."}).describe("Destination instance (runtime object with functions)"),st=c.z.object({code:at.describe("Destination instance with implementation"),config:Qe.optional().describe("Partial configuration overrides"),env:c.z.unknown().optional().describe("Partial environment overrides")}).meta({id:"DestinationInit",title:"Destination.Init",description:"Destination initialization bundle (instance code + config + env)."}).describe("Destination initialization configuration"),ct=c.z.record(c.z.string(),st).meta({id:"DestinationInitDestinations",title:"Destination.InitDestinations",description:"Map of destination IDs to initialization configurations."}).describe("Map of destination IDs to initialization configurations"),lt=c.z.record(c.z.string(),at).meta({id:"DestinationDestinations",title:"Destination.Destinations",description:"Map of destination IDs to runtime destination instances."}).describe("Map of destination IDs to runtime instances"),dt=c.z.object({type:c.z.string().describe('Destination type ("gtag", "meta", "bigquery")'),data:c.z.unknown().optional().describe("Response from push()"),error:c.z.unknown().optional().describe("Error if failed")}).meta({id:"DestinationRef",title:"Destination.Ref",description:"Reference to a destination outcome (type + response data or error)."}).describe("Destination reference with type and response data"),pt=c.z.object({queue:c.z.array(re).optional().describe("Events queued (awaiting consent)"),error:c.z.unknown().optional().describe("Error if push failed")}).meta({id:"DestinationPushResult",title:"Destination.PushResult",description:"Result of a single destination push (queued events, optional error)."}).describe("Push operation result"),ut=c.z.object({ok:c.z.boolean().describe("True if nothing failed"),event:c.z.unknown().optional().describe("The processed event"),done:c.z.record(c.z.string(),dt).optional().describe("Destinations that processed successfully"),queued:c.z.record(c.z.string(),dt).optional().describe("Destinations that queued events"),failed:c.z.record(c.z.string(),dt).optional().describe("Destinations that failed to process")}).meta({id:"DestinationResult",title:"Destination.Result",description:"Overall push result aggregated across all destinations (done/queued/failed maps)."}).describe("Push result with destination outcomes"),mt=c.z.array(c.z.tuple([re,c.z.unknown()])).meta({id:"DestinationDLQ",title:"Destination.DLQ",description:"Dead-letter queue: list of [event, error] tuples."}).describe("Dead letter queue: [(event, error), ...]"),ft=l(Ke),gt=l(Qe),bt=l(Ye),ht=l(et),zt=l(ot),St=l(at),vt=l(ut),yt={};r(yt,{CommandTypeSchema:()=>wt,ConfigSchema:()=>kt,DestinationsSchema:()=>Et,InitConfigSchema:()=>xt,InstanceSchema:()=>jt,PushContextSchema:()=>Pt,SessionDataSchema:()=>Ct,SourcesSchema:()=>Dt,commandTypeJsonSchema:()=>It,configJsonSchema:()=>Ot,initConfigJsonSchema:()=>Mt,instanceJsonSchema:()=>Tt,pushContextJsonSchema:()=>Rt,sessionDataJsonSchema:()=>Jt});var wt=c.z.union([c.z.enum(["action","config","consent","context","destination","elb","globals","hook","init","link","run","user","walker"]),c.z.string()]).meta({id:"CollectorCommandType",title:"Collector.CommandType",description:"Collector command type identifier (standard or extension string)."}).describe("Collector command type: standard commands or custom string for extensions"),kt=c.z.object({run:c.z.boolean().describe("Whether to run collector automatically on initialization").optional(),globalsStatic:Q.describe("Static global properties that persist across collector runs"),sessionStatic:c.z.record(c.z.string(),c.z.unknown()).meta({id:"CollectorSessionStatic",title:"Collector.SessionStatic",description:"Static session data that persists across collector runs."}).describe("Static session data that persists across collector runs"),logger:Ge.optional().describe("Logger configuration (level, handler)")}).meta({id:"CollectorConfig",title:"Collector.Config",description:"Core collector configuration (globals/session statics, logger)."}).describe("Core collector configuration"),Ct=Q.and(c.z.object({isStart:c.z.boolean().describe("Whether this is a new session start"),storage:c.z.boolean().describe("Whether storage is available"),id:m.describe("Session identifier").optional(),start:f.describe("Session start timestamp").optional(),marketing:c.z.literal(!0).optional().describe("Marketing attribution flag"),updated:f.describe("Last update timestamp").optional(),isNew:c.z.boolean().describe("Whether this is a new session").optional(),device:m.describe("Device identifier").optional(),count:g.describe("Event count in session").optional(),runs:g.describe("Number of runs").optional()})).meta({id:"CollectorSessionData",title:"Collector.SessionData",description:"Session state and tracking data."}).describe("Session state and tracking data"),xt=kt.partial().extend({consent:ee.optional().describe("Initial consent state"),user:te.optional().describe("Initial user data"),globals:Q.optional().describe("Initial global properties"),sources:c.z.unknown().meta({id:"CollectorInitSources",title:"Source.InitSources",description:"Source configurations map (id → InitSource)."}).optional().describe("Source configurations"),destinations:c.z.unknown().meta({id:"CollectorInitDestinations",title:"Destination.InitDestinations",description:"Destination configurations map (id → Init)."}).optional().describe("Destination configurations"),transformers:c.z.unknown().meta({id:"CollectorInitTransformers",title:"Transformer.Configs",description:"Transformer configurations map (id → Config)."}).optional().describe("Transformer configurations"),stores:c.z.unknown().meta({id:"CollectorInitStores",title:"Store.Configs",description:"Store configurations map (id → Config)."}).optional().describe("Store configurations"),custom:Q.optional().describe("Initial custom implementation-specific properties"),hooks:c.z.unknown().meta({id:"CollectorHooks",title:"Collector.Hooks",description:"Pipeline observation hooks."}).optional().describe("Pipeline observation hooks")}).meta({id:"CollectorInitConfig",title:"Collector.InitConfig",description:"Collector initialization configuration with initial state (consent, user, globals, components, hooks)."}).describe("Collector initialization configuration with initial state"),Pt=c.z.object({mapping:Pe.optional().describe("Source-level mapping configuration")}).meta({id:"CollectorPushContext",title:"Collector.PushContext",description:"Push context with optional source-level mapping."}).describe("Push context with optional source mapping"),Dt=c.z.record(c.z.string(),c.z.unknown()).meta({id:"CollectorSources",title:"Collector.Sources",description:"Map of source IDs to runtime source instances."}).describe("Map of source IDs to source instances"),Et=c.z.record(c.z.string(),c.z.unknown()).meta({id:"CollectorDestinations",title:"Collector.Destinations",description:"Map of destination IDs to runtime destination instances."}).describe("Map of destination IDs to destination instances"),jt=c.z.object({push:c.z.unknown().describe("Push function for processing events"),command:c.z.unknown().describe("Command function for walker commands"),allowed:c.z.boolean().describe("Whether event processing is allowed"),config:kt.describe("Current collector configuration"),consent:ee.describe("Current consent state"),custom:Q.describe("Custom implementation-specific properties"),sources:Dt.describe("Registered source instances"),destinations:Et.describe("Registered destination instances"),globals:Q.describe("Current global properties"),hooks:c.z.unknown().describe("Lifecycle hook functions"),on:c.z.unknown().describe("Event lifecycle configuration"),queue:c.z.array(re).describe("Queued events awaiting processing"),round:c.z.number().describe("Collector run count (increments with each run)"),session:c.z.union([Ct]).describe("Current session state"),timing:c.z.number().describe("Event processing timing information"),user:te.describe("Current user data")}).meta({id:"CollectorInstance",title:"Collector.Instance",description:"Collector instance (runtime object with push/command + full state and component maps)."}).describe("Collector instance with state and methods"),It=l(wt),Ot=l(kt),Jt=l(Ct),Mt=l(xt),Rt=l(Pt),Tt=l(jt),Ft={};r(Ft,{BaseEnvSchema:()=>Nt,ConfigSchema:()=>Lt,InitSchema:()=>Wt,InitSourceSchema:()=>At,InitSourcesSchema:()=>Bt,InstanceSchema:()=>qt,PartialConfigSchema:()=>$t,baseEnvJsonSchema:()=>Ut,configJsonSchema:()=>Ht,initSourceJsonSchema:()=>Zt,initSourcesJsonSchema:()=>Gt,instanceJsonSchema:()=>_t,partialConfigJsonSchema:()=>Vt});var Nt=c.z.object({push:c.z.unknown().meta({id:"SourcePushFn",title:"Source.PushFn",description:"Collector push function passed to the source via dependency injection."}).describe("Collector push function"),command:c.z.unknown().meta({id:"SourceCommandFn",title:"Source.CommandFn",description:"Collector command function passed to the source."}).describe("Collector command function"),sources:c.z.unknown().optional().describe("Map of registered source instances"),elb:c.z.unknown().meta({id:"ElbFn",title:"Elb.Fn",description:"Public `elb(...)` API function alias for collector.push."}).describe("Public API function (alias for collector.push)")}).catchall(c.z.unknown()).meta({id:"SourceBaseEnv",title:"Source.BaseEnv",description:"Base environment for source dependency injection; platform-specific sources extend this."}).describe("Base environment for dependency injection - platform-specific sources extend this"),Lt=Pe.extend({settings:c.z.any().meta({id:"SourceSettings",title:"Source.Settings",description:"Implementation-specific configuration (source-defined shape)."}).describe("Implementation-specific configuration").optional(),env:Nt.optional().describe("Environment dependencies (platform-specific)"),id:m.describe("Source identifier (defaults to source key)").optional(),primary:c.z.boolean().describe("Mark as primary (only one can be primary)").optional(),require:c.z.array(c.z.string()).optional().describe('Defer source initialization until these collector events fire (e.g., ["consent"])'),logger:Ge.optional().describe("Logger configuration (level, handler) to override the collector defaults"),setup:c.z.union([c.z.boolean(),c.z.record(c.z.string(),c.z.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)"),ingest:c.z.union([he,ze]).optional().describe("Ingest metadata extraction mapping. Extracts values from raw request objects (Express req, Lambda event) using mapping syntax."),disabled:c.z.boolean().describe("Completely skip this source (no init, no event capture)").optional(),init:c.z.boolean().optional().describe("Init lifecycle flag set by collector to true after Instance.init() runs")}).meta({id:"SourceConfig",title:"Source.Config",description:"Source configuration with mapping, environment, and lifecycle hooks."}).describe("Source configuration with mapping and environment"),$t=Lt.partial().meta({id:"SourcePartialConfig",title:"Source.PartialConfig",description:"Partial source configuration with all fields optional."}).describe("Partial source configuration with all fields optional"),qt=c.z.object({type:c.z.string().describe('Source type identifier (e.g., "browser", "dataLayer")'),config:Lt.describe("Current source configuration"),push:c.z.any().meta({id:"SourceInstancePushFn",title:"Source.PushFn",description:"Push function — THE HANDLER (flexible signature for platform compatibility)."}).describe("Push function - THE HANDLER (flexible signature for platform compatibility)"),destroy:c.z.any().meta({id:"SourceDestroyFn",title:"Source.DestroyFn",description:"Cleanup function called when the source is removed."}).optional().describe("Cleanup function called when source is removed"),on:c.z.unknown().optional().describe("Lifecycle hook function for event types")}).meta({id:"SourceInstance",title:"Source.Instance",description:"Source instance (runtime object with push handler and lifecycle methods)."}).describe("Source instance with push handler and lifecycle methods"),Wt=c.z.any().meta({id:"SourceInit",title:"Source.Init",description:"Source initialization function: (config, env) => Instance | Promise<Instance>."}).describe("Source initialization function: (config, env) => Instance | Promise<Instance>"),At=c.z.object({code:Wt.describe("Source initialization function"),config:$t.optional().describe("Partial configuration overrides"),env:Nt.partial().optional().describe("Partial environment overrides"),primary:c.z.boolean().optional().describe("Mark as primary source (only one can be primary)")}).meta({id:"SourceInitSource",title:"Source.InitSource",description:"Source initialization bundle (init function + config + env + primary flag)."}).describe("Source initialization configuration"),Bt=c.z.record(c.z.string(),At).meta({id:"SourceInitSources",title:"Source.InitSources",description:"Map of source IDs to initialization configurations."}).describe("Map of source IDs to initialization configurations"),Ut=l(Nt),Ht=l(Lt),Vt=l($t),_t=l(qt),Zt=l(At),Gt=l(Bt),Kt={};r(Kt,{ConfigSchema:()=>Qt,PartialConfigSchema:()=>Xt,configJsonSchema:()=>Yt,partialConfigJsonSchema:()=>ei});var Qt=c.z.object({settings:c.z.any().meta({id:"TransformerSettings",title:"Transformer.Settings",description:"Implementation-specific configuration (transformer-defined shape)."}).describe("Implementation-specific configuration").optional(),env:c.z.any().meta({id:"TransformerEnv",title:"Transformer.Env",description:"Environment dependencies (transformer-defined shape)."}).describe("Environment dependencies (platform-specific)").optional(),id:m.describe("Transformer instance identifier (defaults to transformer key)").optional(),logger:Ge.optional().describe("Logger configuration (level, handler) to override the collector defaults"),before:Be.optional().describe("Pre-transformer chain that runs before this transformer pushes"),next:Be.optional().describe("Graph wiring to the next transformer in the chain"),cache:_e.optional().describe("Step-level cache configuration for this transformer"),init:c.z.boolean().describe("Whether to initialize immediately").optional(),disabled:c.z.boolean().describe("Completely skip this transformer in chains").optional(),mock:c.z.unknown().meta({id:"TransformerMock",title:"Transformer.Mock",description:"Return this value instead of calling push(). Dev/testing only."}).optional().describe("Return this value instead of calling push(). Global mock for all chains. Dev/testing only."),chainMocks:c.z.record(c.z.string(),c.z.unknown().meta({id:"TransformerChainMock",title:"Transformer.ChainMock",description:"Chain-path-specific mock value. Dev/testing only."})).optional().describe("Path-specific mock values keyed by chain path. Takes precedence over global mock. Dev/testing only.")}).meta({id:"TransformerConfig",title:"Transformer.Config",description:"Transformer configuration (settings, env, chain wiring, cache, mocks)."}).describe("Transformer configuration"),Xt=Qt.partial().meta({id:"TransformerPartialConfig",title:"Transformer.PartialConfig",description:"Partial transformer configuration with all fields optional."}).describe("Partial transformer configuration with all fields optional"),Yt=l(Qt),ei=l(Xt),ti={};r(ti,{ConfigSchema:()=>ii,PartialConfigSchema:()=>ni,configJsonSchema:()=>oi,partialConfigJsonSchema:()=>ri});var ii=c.z.object({settings:c.z.unknown().meta({id:"StoreSettings",title:"Store.Settings",description:"Implementation-specific configuration (store-defined shape)."}).describe("Implementation-specific configuration").optional(),env:c.z.unknown().meta({id:"StoreEnv",title:"Store.Env",description:"Environment dependencies (store-defined shape)."}).describe("Environment dependencies (platform-specific)").optional(),id:m.describe("Store instance identifier (defaults to store key)").optional(),logger:Ge.optional().describe("Logger configuration (level, handler) to override the collector defaults"),setup:c.z.union([c.z.boolean(),c.z.record(c.z.string(),c.z.unknown())]).optional().describe("One-time setup options applied during store registration (boolean enables defaults, object configures specifics)")}).meta({id:"StoreConfig",title:"Store.Config",description:"Store configuration (settings, env, logger) — key-value infrastructure component."}).describe("Store configuration"),ni=ii.partial().meta({id:"StorePartialConfig",title:"Store.PartialConfig",description:"Partial store configuration with all fields optional."}).describe("Partial store configuration with all fields optional"),oi=l(ii),ri=l(ni),ai={};r(ai,{BundlePackageSchema:()=>di,BundleSchema:()=>pi,CodeSchema:()=>ui,ConfigSchema:()=>xi,ContractActionsSchema:()=>yi,ContractEventsSchema:()=>wi,ContractRuleSchema:()=>ki,ContractSchema:()=>Ci,ContractSchemaEntry:()=>vi,DestinationSchema:()=>zi,FlowSchema:()=>Pi,JsonSchema:()=>Di,SettingsSchema:()=>ci,SourceSchema:()=>bi,StepExampleSchema:()=>fi,StepExamplesSchema:()=>gi,StoreSchema:()=>Si,TransformerSchema:()=>hi,TriggerDescriptorSchema:()=>mi,VariablesSchema:()=>si,configJsonSchema:()=>Ji,contractJsonSchema:()=>qi,contractRuleJsonSchema:()=>$i,destinationJsonSchema:()=>Fi,flowConfigJsonSchema:()=>Ri,flowJsonSchema:()=>Mi,parseConfig:()=>Ei,parseFlow:()=>Ii,safeParseConfig:()=>ji,safeParseFlow:()=>Oi,sourceJsonSchema:()=>Ti,storeJsonSchema:()=>Li,transformerJsonSchema:()=>Ni});var si=c.z.record(c.z.string(),c.z.unknown()).meta({id:"FlowVariables",title:"Flow.Variables",description:"Reusable values referenced via $var.name (with optional deep paths). Whole-string refs preserve native type; inline interpolation requires scalars."}),ci=c.z.record(c.z.string(),c.z.unknown()).meta({id:"FlowSettings",title:"Flow.Settings",description:"Free-form key-value settings consumed by the platform runtime."}).describe("Free-form platform settings bag"),li=/^(@[a-z0-9\-~][a-z0-9\-._~]*\/)?[a-z0-9\-~][a-z0-9\-._~]*$/,di=c.z.object({version:c.z.string().optional(),imports:c.z.array(c.z.string()).optional(),path:c.z.string().optional()}).meta({id:"FlowBundlePackage",title:"Flow.BundlePackage",description:"Per-package bundle spec (version / imports / local path)."}),pi=c.z.object({packages:c.z.record(c.z.string().regex(li,"Invalid npm package name"),di).optional().describe("NPM packages to bundle, keyed by package name"),overrides:c.z.record(c.z.string().regex(li,"Invalid npm package name"),c.z.string().min(1,"Override version cannot be empty")).optional().describe("Transitive dependency version pins"),traceInclude:c.z.array(c.z.string()).optional().describe("Extra paths or globs the bundler must include in the trace output (server flows only)")}).strict().meta({id:"FlowBundle",title:"Flow.Bundle",description:"Bundle configuration (packages + overrides + traceInclude)."}).describe("Bundle configuration (packages + overrides + traceInclude)"),ui=c.z.object({push:c.z.string().min(1,"Push function cannot be empty").describe('JavaScript function for processing events. Must start with "$code:" prefix.'),type:c.z.string().optional().describe("Optional type identifier for the inline instance"),init:c.z.string().optional().describe("Optional initialization function. Use $code: prefix for inline JavaScript.")}).meta({id:"FlowCode",title:"Flow.Code",description:"Inline code block for custom sources / transformers / destinations / stores."}).describe("Inline code for custom components"),mi=c.z.object({type:c.z.string().optional().describe("Trigger mechanism (e.g., click, POST, load)"),options:c.z.unknown().optional().describe("Mechanism-specific options")}).meta({id:"TriggerDescriptor",title:"Trigger.Descriptor",description:"Source trigger metadata (mechanism + options) used by step examples."}),fi=c.z.object({title:c.z.string().optional().describe("Human-readable title (overrides default heading)"),description:c.z.string().optional().describe("Human-readable description"),public:c.z.boolean().optional().describe("Whether this example is shown in docs/UI/MCP default output (default: true). Set false for test-only fixtures."),in:c.z.unknown().optional().describe("Input to the step"),trigger:mi.optional().describe("Source trigger metadata"),mapping:c.z.unknown().optional().describe("Mapping configuration"),out:c.z.unknown().optional().describe("Expected output from the step"),command:c.z.enum(["config","consent","user","run"]).optional().describe("Invoke elb('walker <command>', in) instead of pushing in as an event")}).meta({id:"FlowStepExample",title:"Flow.StepExample",description:"Named example with input/output pair used for step testing."}).describe("Named example with input/output pair"),gi=c.z.record(c.z.string(),fi).meta({id:"FlowStepExamples",title:"Flow.StepExamples",description:"Named step examples keyed by scenario name."}).describe("Named step examples for testing and documentation"),bi=c.z.object({package:c.z.string().min(1,"Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-source-browser@2.0.0")'),code:c.z.union([c.z.string(),ui]).optional().describe('Either a named export string (e.g., "sourceExpress") or an inline code object with push function'),config:c.z.looseObject({setup:c.z.union([c.z.boolean(),c.z.record(c.z.string(),c.z.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)")}).meta({id:"FlowSourceConfig",title:"Source.Config",description:"Source-specific configuration object (Source.Config)."}).optional().describe("Source-specific configuration object"),env:c.z.unknown().meta({id:"FlowSourceEnv",title:"Source.BaseEnv",description:"Source environment configuration (Source.BaseEnv overrides)."}).optional().describe("Source environment configuration"),primary:c.z.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary."),variables:si.optional().describe("Source-level variables (highest priority in cascade)"),next:Be.optional().describe("Pre-collector transformer chain. String, string[], or NextRule[] for conditional routing based on ingest data."),before:Be.optional().describe("Pre-source transformer chain (consent-exempt). Handles transport-level preprocessing."),examples:gi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"),cache:_e.optional().describe("Cache configuration for this source (match → key → ttl rules)")}).meta({id:"FlowSource",title:"Flow.Source",description:"Source package reference with configuration, env, chains, and examples."}).describe("Source package reference with configuration"),hi=c.z.object({package:c.z.string().min(1,"Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/transformer-enricher@1.0.0")'),code:c.z.union([c.z.string(),ui]).optional().describe('Either a named export string (e.g., "transformerEnricher") or an inline code object with push function'),config:c.z.unknown().meta({id:"FlowTransformerConfig",title:"Transformer.Config",description:"Transformer-specific configuration object."}).optional().describe("Transformer-specific configuration object"),env:c.z.unknown().meta({id:"FlowTransformerEnv",title:"Transformer.Env",description:"Transformer environment configuration."}).optional().describe("Transformer environment configuration"),before:Be.optional().describe("Pre-transformer chain. Runs before this transformer push function."),next:Be.optional().describe("Next transformer in chain. String, string[], or NextRule[] for conditional routing."),variables:si.optional().describe("Transformer-level variables (highest priority in cascade)"),examples:gi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"),cache:_e.optional().describe("Cache configuration for this transformer (match → key → ttl rules)")}).meta({id:"FlowTransformer",title:"Flow.Transformer",description:"Transformer package reference with configuration, env, chains, and cache."}).describe("Transformer package reference with configuration"),zi=c.z.object({package:c.z.string().min(1,"Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-destination-gtag@2.0.0")'),code:c.z.union([c.z.string(),ui]).optional().describe('Either a named export string (e.g., "destinationAnalytics") or an inline code object with push function'),config:c.z.looseObject({setup:c.z.union([c.z.boolean(),c.z.record(c.z.string(),c.z.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)")}).meta({id:"FlowDestinationConfig",title:"Destination.Config",description:"Destination-specific configuration object."}).optional().describe("Destination-specific configuration object"),env:c.z.unknown().meta({id:"FlowDestinationEnv",title:"Destination.Env",description:"Destination environment configuration."}).optional().describe("Destination environment configuration"),variables:si.optional().describe("Destination-level variables (highest priority in cascade)"),before:Be.optional().describe("Post-collector transformer chain. String, string[], or NextRule[] for conditional routing."),next:Be.optional().describe("Post-push transformer chain. Push response available at context.ingest._response."),examples:gi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"),cache:_e.optional().describe("Cache configuration for this destination (match → key → ttl rules)")}).meta({id:"FlowDestination",title:"Flow.Destination",description:"Destination package reference with configuration, env, chains, and cache."}).describe("Destination package reference with configuration"),Si=c.z.object({package:c.z.string().min(1,"Package name cannot be empty").optional().describe("Store package specifier with optional version"),code:c.z.union([c.z.string(),ui]).optional().describe("Named export string or inline code definition"),config:c.z.looseObject({setup:c.z.union([c.z.boolean(),c.z.record(c.z.string(),c.z.unknown())]).optional().describe("One-time setup options applied during store registration (boolean enables defaults, object configures specifics)")}).meta({id:"FlowStoreConfig",title:"Store.Config",description:"Store-specific configuration object."}).optional().describe("Store-specific configuration object"),env:c.z.unknown().meta({id:"FlowStoreEnv",title:"Store.Env",description:"Store environment configuration."}).optional().describe("Store environment configuration"),variables:si.optional().describe("Store-level variables (highest priority in cascade)"),examples:gi.optional().describe("Named step examples for testing and documentation (stripped during bundling)")}).meta({id:"FlowStore",title:"Flow.Store",description:"Store package reference with configuration, env, and examples."}).describe("Store package reference with configuration"),vi=c.z.record(c.z.string(),c.z.unknown()).meta({id:"FlowContractSchemaEntry",title:"Flow.ContractSchemaEntry",description:"JSON Schema object for event validation with description/examples annotations."}).describe("JSON Schema object for event validation with description/examples annotations"),yi=c.z.record(c.z.string(),vi).meta({id:"FlowContractActions",title:"Flow.ContractActions",description:"Action-level contract entries keyed by action name."}).describe("Action-level contract entries"),wi=c.z.record(c.z.string(),yi).meta({id:"FlowContractEvents",title:"Flow.ContractEvents",description:"Entity-action event schemas (entity → action → schema)."}).describe("Entity-action event schemas"),ki=c.z.object({extends:c.z.string().optional().describe("Inherit from another named contract"),tagging:c.z.number().optional().describe("Tagging level (used by validators / runtime tagging policy)"),description:c.z.string().optional().describe("Human-readable description"),globals:vi.optional().describe("JSON Schema for event.globals"),context:vi.optional().describe("JSON Schema for event.context"),custom:vi.optional().describe("JSON Schema for event.custom"),user:vi.optional().describe("JSON Schema for event.user"),consent:vi.optional().describe("JSON Schema for event.consent"),events:wi.optional().describe("Entity-action event schemas")}).meta({id:"FlowContractRule",title:"Flow.ContractRule",description:"Named contract rule with optional sections (globals/context/custom/user/consent) and event schemas."}).describe("Named contract rule with optional sections and events"),Ci=c.z.record(c.z.string(),ki).meta({id:"FlowContract",title:"Flow.Contract",description:"Named contracts map with optional extends inheritance."}).describe("Named contracts with optional extends inheritance"),xi=c.z.object({platform:c.z.enum(["web","server"]).describe("Platform identity for this flow. Drives bundle target/format."),url:c.z.string().min(1).optional().describe("Public URL where this flow is reachable (for cross-flow $flow.X.url references)."),settings:ci.optional().describe("Free-form key-value settings consumed by the platform runtime."),bundle:pi.optional().describe("Bundle configuration: NPM packages, transitive dependency overrides.")}).meta({id:"FlowConfig",title:"Flow.Config",description:"Per-flow configuration block: platform identity, optional public URL, settings, bundle."}).describe("Per-flow configuration block"),Pi=c.z.object({config:xi.optional().describe("Per-flow configuration: platform, url, settings, bundle."),sources:c.z.record(c.z.string(),bi).optional().describe("Source configurations (data capture) keyed by unique identifier"),destinations:c.z.record(c.z.string(),zi).optional().describe("Destination configurations (data output) keyed by unique identifier"),transformers:c.z.record(c.z.string(),hi).optional().describe("Transformer configurations (event transformation) keyed by unique identifier"),stores:c.z.record(c.z.string(),Si).optional().describe("Store configurations (key-value storage) keyed by unique identifier"),collector:c.z.unknown().meta({id:"FlowCollector",title:"Collector.InitConfig",description:"Collector configuration for event processing (Collector.InitConfig)."}).optional().describe("Collector configuration for event processing (uses Collector.InitConfig)"),variables:si.optional().describe("Flow-level variables (override root variables, overridden by source/destination variables)")}).meta({id:"Flow",title:"Flow",description:"Single flow definition (one deployment target): config, sources, destinations, transformers, stores, collector."}).describe("Single flow definition for one deployment target"),Di=c.z.object({version:c.z.literal(4).describe("Configuration schema version (v4, current)."),$schema:c.z.string().url("Schema URL must be a valid URL").optional().describe('JSON Schema reference for IDE validation (e.g., "https://walkeros.io/schema/flow/v4.json")'),include:c.z.array(c.z.string()).optional().describe("Folders to include in the bundle output"),variables:si.optional().describe("Shared variables for interpolation across all flows (use $var.name syntax, deep paths supported)"),contract:Ci.optional().describe("Named contracts with extends inheritance and dot-path references"),flows:c.z.record(c.z.string(),Pi).refine(e=>Object.keys(e).length>0,{message:"At least one flow is required"}).describe("Named flow configurations (e.g., production, staging, development)")}).meta({id:"FlowJson",title:"Flow.Json",description:"walkerOS root configuration (walkeros.config.json) v4: version, variables, contract, named flows."}).describe("walkerOS root configuration (walkeros.config.json)");function Ei(e){return Di.parse(e)}function ji(e){return Di.safeParse(e)}function Ii(e){return Pi.parse(e)}function Oi(e){return Pi.safeParse(e)}var Ji=c.z.toJSONSchema(Di,{target:"draft-7"}),Mi=l(Pi),Ri=l(xi),Ti=l(bi),Fi=l(zi),Ni=l(hi),Li=l(Si),$i=l(ki),qi=l(Ci),Wi=require("zod"),Ai=Wi.z.object({lang:Wi.z.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"),code:Wi.z.string().describe("Code snippet")}),Bi=Wi.z.object({text:Wi.z.string().describe("Short actionable hint text focused on walkerOS usage"),code:Wi.z.array(Ai).optional().describe("Optional code snippets")}),Ui=Wi.z.record(Wi.z.string(),Bi).describe("Keyed hints for AI consumption — lightweight context beyond schemas and examples"),Hi=c.z.object({param:c.z.string().describe("Lowercase URL parameter name. Match is case-insensitive on lookup."),platform:c.z.string().describe("Canonical platform identifier (lowercase, kebab-case).")});function Vi(e){let t;try{t=JSON.parse(e)}catch(t){const{line:i,column:n}=function(e,t){if(e instanceof SyntaxError){const i=e.message.match(/position\s+(\d+)/);if(i){return Qi(t,parseInt(i[1],10))}const n=e.message.match(/line\s+(\d+)\s+column\s+(\d+)/);if(n)return{line:parseInt(n[1],10),column:parseInt(n[2],10)}}return{line:1,column:1}}(t,e);return{valid:!1,errors:[{message:t instanceof Error?t.message:"Invalid JSON",severity:"error",line:i,column:n}],warnings:[]}}const i=[],n=[],o=Di.safeParse(t);if(!o.success)for(const t of o.error.issues){const n=t.path.join("."),o=Yi(e,t.path);i.push({message:t.message,severity:"error",path:n||"root",...o})}const r=function(e){if(!(en(e)&&"version"in e&&"flows"in e&&en(e.flows)))return;const t={},i=[],n=[],o=[],r=[],a=[],s=[];let c;const l=Object.keys(e.flows);tn(t,e.variables),function(e,t){if(!en(t))return;for(const[,i]of Object.entries(t)){if(!en(i))continue;const t=i.events;if(en(t))for(const[i,n]of Object.entries(t)){if(!en(n))continue;const t=e.find(e=>e.entity===i),o=Object.keys(n);if(t)for(const e of o)t.actions.includes(e)||t.actions.push(e);else e.push({entity:i,actions:o})}}}(s,e.contract);for(const s of Object.values(e.flows))if(en(s)){if(!c){const e=s.config;!en(e)||"web"!==e.platform&&"server"!==e.platform||(c=e.platform)}tn(t,s.variables);for(const e of["sources","destinations","transformers"]){const r="sources"===e?"source":"destinations"===e?"destination":"transformer",l="sources"===e?i:"destinations"===e?n:o;if(en(s[e]))for(const[i,n]of Object.entries(s[e]))l.push(i),en(n)&&(tn(t,n.variables),"string"==typeof n.package&&a.push({package:n.package,shortName:i,type:r,platform:c||"web"}))}if(en(s.stores))for(const[e,i]of Object.entries(s.stores))r.push(e),en(i)&&tn(t,i.variables)}const d={variables:t,stepNames:{sources:i,destinations:n,transformers:o,stores:r},flowNames:l};c&&(d.platform=c);a.length>0&&(d.packages=a);s.length>0&&(d.contract=s);return d}(t);if(r){const t=function(e,t){const i=[];return function(e,t,i){let n;Ki.lastIndex=0;for(;null!==(n=Ki.exec(e));){const t=n[0],o=n[1],r=n[2],a=Xi(e,n.index,t.length);i.push({message:`Malformed reference "${t}", use a dot, not a colon: "$${o}.${r}".`,severity:"warning",path:t,...a})}}(e,0,i),function(e,t,i){if(!t.variables)return;const n=/\$var\.(\w+)/g;let o;for(;null!==(o=n.exec(e));)if(!(o[1]in t.variables)){const n=Xi(e,o.index,o[0].length);i.push({message:`Unknown variable "$var.${o[1]}". Defined: ${Object.keys(t.variables).join(", ")||"none"}`,severity:"warning",path:`$var.${o[1]}`,...n})}}(e,t,i),function(e,t,i){const n=t.stepNames?.stores??[];let o;_i.lastIndex=0;for(;null!==(o=_i.exec(e));)if(!n.includes(o[1])){const t=Xi(e,o.index,o[0].length);i.push({message:`Unknown store "$store.${o[1]}". Defined: ${n.join(", ")||"none"}`,severity:"warning",path:`$store.${o[1]}`,...t})}}(e,t,i),function(e,t,i){let n;Zi.lastIndex=0;for(;null!==(n=Zi.exec(e));){const t=n[0],o=n[1],r=n[2],a=Xi(e,n.index,t.length);r?i.push({message:`Malformed $env reference "${t}". Use ":" for default values, not "=" (e.g., "$env.${o}:fallback").`,severity:"warning",path:t,...a}):/^[A-Z][A-Z0-9_]*$/.test(o)||i.push({message:`$env.${o} should use UPPER_SNAKE_CASE by convention (e.g., $env.${o.toUpperCase()}).`,severity:"warning",path:t,...a})}}(e,0,i),function(e,t,i){const n=t.flowNames??[];if(0===n.length)return;let o;Gi.lastIndex=0;for(;null!==(o=Gi.exec(e));){const t=o[0],r=o[1];if(!n.includes(r)){const a=Xi(e,o.index,t.length);i.push({message:`Unknown flow "$flow.${r}". Defined: ${n.join(", ")}`,severity:"warning",path:t,...a})}}}(e,t,i),i}(e,r);n.push(...t)}return{valid:0===i.length,errors:i,warnings:n,context:r}}var _i=/\$store\.([a-zA-Z_][a-zA-Z0-9_]*)/g,Zi=/\$env\.([A-Za-z_]\w*)(=[^"}\s]*)?/g,Gi=/\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?/g,Ki=/\$(var|store|flow|secret):([a-zA-Z_][a-zA-Z0-9_]*)/g;function Qi(e,t){let i=1,n=1;for(let o=0;o<t&&o<e.length;o++)"\n"===e[o]?(i++,n=1):n++;return{line:i,column:n}}function Xi(e,t,i){const n=Qi(e,t),o=Qi(e,t+i);return{line:n.line,column:n.column,endLine:o.line,endColumn:o.column}}function Yi(e,t){if(0===t.length)return{line:1,column:1};const i=t[t.length-1];if("string"==typeof i){const t=`"${i}"`,n=e.lastIndexOf(t);if(-1!==n)return Qi(e,n)}return{line:1,column:1}}function en(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function tn(e,t){if(en(t))for(const[i,n]of Object.entries(t))e[i]=n}function nn(e,t){const i=[],n={};for(const[t,o]of Object.entries(e)){o.required&&i.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,i]of Object.entries(o.properties))t[e]=on(i);e.properties=t}"array"===o.type&&o.items&&(e.items=on(o.items)),n[t]=e}const o={type:"object",properties:n};return t&&(o.title=t),i.length>0&&(o.required=i),o}function on(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 i={};for(const[t,n]of Object.entries(e.properties))i[t]=on(n);t.properties=i}return"array"===e.type&&e.items&&(t.items=on(e.items)),t}function rn(e,t){const i={type:"array",items:on(e)};return void 0!==t?.minItems&&(i.minItems=t.minItems),void 0!==t?.maxItems&&(i.maxItems=t.maxItems),t?.description&&(i.description=t.description),t?.title&&(i.title=t.title),i}function an(e,t="string",i){const n={type:t,enum:[...e]};return i?.description&&(n.description=i.description),i?.title&&(n.title=i.title),n}function sn(e,t,i){return rn({type:"object"},{minItems:2,maxItems:2,description:i||"Tuple with exactly 2 elements [source, transform]"})}function cn(e){return c.z.toJSONSchema(e,{target:"draft-7"})}var ln=new Set(["env","onError","onLog","primary"]),dn={source:Ft.configJsonSchema,destination:Ne.configJsonSchema};function pn(e,t){const i=function(e){if(!e)return e;if(e.properties)return e;const{ref:t,container:i,containerKey:n}=function(e){const t=e.$defs,i=e.definitions,n=t??i,o=t?"$defs":"definitions";let r;if("string"==typeof e.$ref)r=e.$ref;else if(Array.isArray(e.allOf)){const t=e.allOf[0];t&&"string"==typeof t.$ref&&(r=t.$ref)}return{ref:r,container:n,containerKey:o}}(e);if(!t||!i)return e;const o=t.match(/^#\/(\$defs|definitions)\/(.+)$/);if(!o)return e;const r=o[2],a=i[r];return a&&"object"==typeof a?{...a,[n]:i}:e}(dn[e]);if(!i||!i.properties){return{type:"object",properties:{settings:t.settings?un(t.settings):{description:"Implementation-specific configuration"}}}}const n=JSON.parse(JSON.stringify(i)),o=n.properties;for(const e of ln)delete o[e];return t.settings&&(o.settings=un(t.settings)),n}function un(e){const{$schema:t,...i}=e;return i}function mn(e){return 0===e.length?"// no output":e.map(fn).join(";\n\n")}function fn(e){const[t,...i]=e,n=i.map(gn).join(", ");return"return"===t?n?`return ${n}`:"return":`${t}(${n})`}function gn(e){return void 0===e?"undefined":null===e?"null":"function"==typeof e?"[Function]":JSON.stringify(e,null,2)}//# sourceMappingURL=dev.js.map