@walkeros/core 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -8
- package/dist/dev.d.mts +132 -33
- package/dist/dev.d.ts +132 -33
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/index.d.mts +508 -206
- package/dist/index.d.ts +508 -206
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/validation.ts","../src/schemas/primitives.ts","../src/schemas/utilities.ts","../src/schemas/patterns.ts","../src/schemas/walkeros.ts","../src/schemas/mapping.ts","../src/schemas/destination.ts","../src/schemas/collector.ts","../src/schemas/source.ts","../src/schemas/flow.ts","../src/schemas/schema-builder.ts"],"sourcesContent":["export * as schemas from './schemas';\n\nexport { zodToSchema, z, type JSONSchema } from './schemas';\n","/**\n * walkerOS Core Schemas\n *\n * Zod schemas for runtime validation and JSON Schema generation.\n * These schemas mirror TypeScript types in packages/core/src/types/\n * and are used for:\n * - Runtime validation at system boundaries (MCP tools, APIs, CLI)\n * - JSON Schema generation for Explorer UI (RJSF)\n * - Documentation and type metadata\n *\n * Note: TypeScript types remain the source of truth for development.\n * Schemas are for runtime validation and tooling support.\n *\n * Organization: Schema files mirror type files\n * - types/walkeros.ts → schemas/walkeros.ts\n * - types/mapping.ts → schemas/mapping.ts\n * - types/destination.ts → schemas/destination.ts\n * - types/collector.ts → schemas/collector.ts\n * - types/source.ts → schemas/source.ts\n * - types/flow.ts → schemas/flow.ts\n * - types/storage.ts + types/handler.ts → schemas/utilities.ts\n *\n * Import strategy:\n * Due to overlapping schema names across domains (ConfigSchema, InstanceSchema, etc.),\n * schemas are organized into namespaces. Import either:\n * 1. From namespaces: import { WalkerOSSchemas, MappingSchemas } from '@walkeros/core/dev'\n * 2. Direct from files: import { EventSchema } from '@walkeros/core/schemas/walkeros'\n */\n\n// ========================================\n// Primitives & Patterns (DRY building blocks)\n// ========================================\n\nexport * from './primitives';\nexport * from './patterns';\n\n// ========================================\n// Namespace Exports (prevents name collisions)\n// ========================================\n\nimport * as WalkerOSSchemas from './walkeros';\nimport * as MappingSchemas from './mapping';\nimport * as DestinationSchemas from './destination';\nimport * as CollectorSchemas from './collector';\nimport * as SourceSchemas from './source';\nimport * as FlowSchemas from './flow';\nimport * as UtilitySchemas from './utilities';\n\nexport {\n WalkerOSSchemas,\n MappingSchemas,\n DestinationSchemas,\n CollectorSchemas,\n SourceSchemas,\n FlowSchemas,\n UtilitySchemas,\n};\n\n// ========================================\n// Direct Exports (commonly used schemas)\n// ========================================\n\n// Export commonly used schemas from WalkerOS namespace directly\nexport {\n EventSchema,\n PartialEventSchema,\n DeepPartialEventSchema,\n PropertiesSchema,\n OrderedPropertiesSchema,\n UserSchema,\n EntitySchema,\n EntitiesSchema,\n ConsentSchema,\n SourceTypeSchema,\n VersionSchema,\n SourceSchema,\n PropertySchema,\n PropertyTypeSchema,\n // JSON Schemas\n eventJsonSchema,\n partialEventJsonSchema,\n userJsonSchema,\n propertiesJsonSchema,\n orderedPropertiesJsonSchema,\n entityJsonSchema,\n sourceTypeJsonSchema,\n consentJsonSchema,\n} from './walkeros';\n\n// Export commonly used schemas from Mapping namespace directly\nexport {\n ValueSchema,\n ValuesSchema,\n ValueConfigSchema,\n LoopSchema,\n SetSchema,\n MapSchema,\n PolicySchema,\n RuleSchema,\n RulesSchema,\n ResultSchema as MappingResultSchema, // Alias to avoid conflict with Destination.ResultSchema\n // JSON Schemas\n valueJsonSchema,\n valueConfigJsonSchema,\n loopJsonSchema,\n setJsonSchema,\n mapJsonSchema,\n policyJsonSchema,\n ruleJsonSchema,\n rulesJsonSchema,\n} from './mapping';\n\n// Export commonly used schemas from Flow namespace directly\nexport {\n SetupSchema,\n ConfigSchema as FlowConfigSchema, // Alias to avoid conflict with other ConfigSchema exports\n SourceReferenceSchema,\n DestinationReferenceSchema,\n PrimitiveSchema,\n parseSetup,\n safeParseSetup,\n parseConfig,\n safeParseConfig,\n // JSON Schemas\n setupJsonSchema,\n configJsonSchema,\n sourceReferenceJsonSchema,\n destinationReferenceJsonSchema,\n} from './flow';\n\n// ========================================\n// Schema Builder - DRY utility for destinations\n// ========================================\n\n/**\n * Schema Builder - DRY utility for destinations\n *\n * Destinations can use these utilities to create JSON Schemas WITHOUT\n * needing Zod as a dependency. The core package handles all schema logic.\n *\n * This follows the DRY principle - write once in core, use everywhere.\n */\nexport * from './schema-builder';\n\n// ========================================\n// Deprecated: value-config.ts\n// ========================================\n\n/**\n * @deprecated Import from MappingSchemas or directly from './mapping' instead\n *\n * The value-config.ts file has been migrated to mapping.ts for better organization.\n * This export is kept for backward compatibility but will be removed in a future version.\n *\n * Migration:\n * - Old: import { ValueSchema, ValueConfigSchema } from '@walkeros/core'\n * - New: import { ValueSchema, ValueConfigSchema } from '@walkeros/core'\n * (imports now come from mapping.ts but the API is identical)\n *\n * Breaking change: The value-config.ts file will be removed in the next major version.\n * All schemas are now organized by domain (mapping, destination, collector, etc.)\n */\n// Note: Schemas are already exported above from mapping.ts\n\n/**\n * Re-export Zod and zod-to-json-schema for destinations\n *\n * Destinations can import Zod from @walkeros/core instead of adding\n * their own dependency. This ensures version consistency and reduces\n * duplicate dependencies in the monorepo.\n *\n * Usage in destinations:\n * import { z, zodToSchema } from '@walkeros/core/dev';\n */\nexport { z } from './validation';\n\nimport type { zod } from './validation';\nimport { z } from './validation';\n\n/**\n * JSONSchema type for JSON Schema Draft 7 objects\n *\n * Represents a JSON Schema object as returned by Zod's toJSONSchema().\n * Uses Record<string, unknown> as JSON Schema structure is dynamic.\n */\nexport type JSONSchema = Record<string, unknown>;\n\n/**\n * Utility to convert Zod schema to JSON Schema with consistent defaults\n *\n * This wrapper ensures all destinations use the same JSON Schema configuration:\n * - target: 'draft-7' (JSON Schema Draft 7 format)\n *\n * Usage in destinations:\n * import { zodToSchema } from '@walkeros/core/dev';\n * export const settings = zodToSchema(SettingsSchema);\n *\n * @param schema - Zod schema to convert\n * @returns JSON Schema Draft 7 object\n */\nexport function zodToSchema(schema: zod.ZodTypeAny): JSONSchema {\n return z.toJSONSchema(schema, {\n target: 'draft-7',\n }) as JSONSchema;\n}\n","/**\n * Central validation module\n * Single source of truth for validation library access\n *\n * All schema files should import from this module instead of directly\n * from zod to ensure consistent usage and easy maintenance.\n */\n\nimport { z } from 'zod';\n\n// Re-export validation tools for schema files\nexport { z };\nexport type { z as zod } from 'zod';\n\n/**\n * Standard JSON Schema conversion with consistent project defaults\n *\n * Uses Zod 4 native toJSONSchema() method for JSON Schema generation.\n * All walkerOS schemas use JSON Schema Draft 7 format.\n *\n * @param schema - Zod schema to convert\n * @param _name - Schema name (ignored in Zod 4, kept for API compatibility)\n * @param target - JSON Schema target version (default: 'draft-7')\n * @returns JSON Schema object\n */\nexport function toJsonSchema(\n schema: z.ZodTypeAny,\n _name?: string,\n target: 'draft-7' | 'draft-2020-12' | 'openapi-3.0' = 'draft-7',\n) {\n return z.toJSONSchema(schema, {\n target,\n });\n}\n","import { z } from './validation';\n\n/**\n * Primitive Schema Definitions\n *\n * Reusable primitive schemas following DRY principle.\n * These are the building blocks used throughout all schemas to ensure consistency.\n *\n * Benefits:\n * - Single source of truth for common patterns\n * - Consistent descriptions across all schemas\n * - Easier maintenance and updates\n * - Better IntelliSense/autocomplete\n */\n\n// ========================================\n// Basic Primitives\n// ========================================\n\n/**\n * Required string field\n * Used for required text fields throughout schemas\n */\nexport const RequiredString = z.string();\n\n/**\n * Required number field\n * Used for required numeric fields throughout schemas\n */\nexport const RequiredNumber = z.number();\n\n/**\n * Required boolean field\n * Used for required flag fields throughout schemas\n */\nexport const RequiredBoolean = z.boolean();\n\n// ========================================\n// Semantic Primitives\n// ========================================\n\n/**\n * Identifier - Required unique string identifier\n * Used for entity IDs, session IDs, etc.\n */\nexport const Identifier = z.string().min(1);\n\n/**\n * Timestamp - Unix timestamp in milliseconds\n * Used for event timestamps, session timestamps, etc.\n */\nexport const Timestamp = z.number().int().positive();\n\n/**\n * Counter - Sequential counter (non-negative integer)\n * Used for event counts, session counts, etc.\n */\nexport const Counter = z.number().int().nonnegative();\n\n/**\n * TaggingVersion - Version number for event tagging\n * Standardized description used in both Version and Config schemas\n */\nexport const TaggingVersion = z.number().describe('Tagging version number');\n\n// ========================================\n// Primitive Value Unions\n// ========================================\n\n/**\n * PrimitiveValue - Basic primitive types\n * Union of string, number, and boolean\n * Used in Property definitions and value transformations\n */\nexport const PrimitiveValue = z.union([z.string(), z.number(), z.boolean()]);\n\n/**\n * OptionalPrimitiveValue - Optional primitive value\n */\nexport const OptionalPrimitiveValue = PrimitiveValue.optional();\n","import { z, toJsonSchema } from './validation';\n\n/**\n * Utility Schemas\n *\n * Mirrors: types/storage.ts, types/handler.ts, and other utility types\n * Purpose: Runtime validation and JSON Schema generation for utility types\n *\n * Small, standalone schemas for utility types used throughout walkerOS:\n * - Storage types\n * - Handler functions\n * - Error/log management\n */\n\n// ========================================\n// Storage Schemas\n// ========================================\n\n/**\n * StorageType - Storage mechanism identifier\n *\n * Standard storage types:\n * - local: localStorage (persistent)\n * - session: sessionStorage (session-scoped)\n * - cookie: document.cookie (configurable expiry)\n *\n * Used for session persistence and user tracking\n */\nexport const StorageTypeSchema = z\n .enum(['local', 'session', 'cookie'])\n .describe('Storage mechanism: local, session, or cookie');\n\n/**\n * Storage - Storage type constants\n * Provides const values for type-safe storage type references\n */\nexport const StorageSchema = z\n .object({\n Local: z.literal('local'),\n Session: z.literal('session'),\n Cookie: z.literal('cookie'),\n })\n .describe('Storage type constants for type-safe references');\n\n// ========================================\n// Handler Schemas\n// ========================================\n\n/**\n * Error - Error handler function type\n *\n * Signature: (error: unknown, state?: unknown) => void\n *\n * Called when errors occur during:\n * - Event processing\n * - Destination push operations\n * - Source event handling\n * - Mapping transformations\n *\n * Parameters:\n * - error: The error that occurred\n * - state: Optional state information for debugging\n *\n * Note: Function schemas use z.unknown() as functions aren't serializable\n */\nexport const ErrorHandlerSchema = z\n .any()\n .describe('Error handler function: (error, state?) => void');\n\n/**\n * Log - Log handler function type\n *\n * Signature: (message: string, verbose?: boolean) => void\n *\n * Called for logging during:\n * - Event processing\n * - Configuration updates\n * - Debugging (when verbose enabled)\n *\n * Parameters:\n * - message: Log message\n * - verbose: Whether this is a verbose-only log\n *\n * Note: Function schemas use z.unknown() as functions aren't serializable\n */\nexport const LogHandlerSchema = z\n .any()\n .describe('Log handler function: (message, verbose?) => void');\n\n/**\n * Handler - Combined handler interface\n * Groups Error and Log handlers\n */\nexport const HandlerSchema = z\n .object({\n Error: ErrorHandlerSchema.describe('Error handler function'),\n Log: LogHandlerSchema.describe('Log handler function'),\n })\n .describe('Handler interface with error and log functions');\n\n// ========================================\n// JSON Schema Exports (for Explorer/RJSF/MCP)\n// ========================================\n\nexport const storageTypeJsonSchema = toJsonSchema(\n StorageTypeSchema,\n 'StorageType',\n);\n\nexport const storageJsonSchema = toJsonSchema(StorageSchema, 'Storage');\n\nexport const errorHandlerJsonSchema = toJsonSchema(\n ErrorHandlerSchema,\n 'ErrorHandler',\n);\n\nexport const logHandlerJsonSchema = toJsonSchema(\n LogHandlerSchema,\n 'LogHandler',\n);\n\nexport const handlerJsonSchema = toJsonSchema(HandlerSchema, 'Handler');\n","import { z } from './validation';\nimport {} from './primitives';\nimport { ErrorHandlerSchema, LogHandlerSchema } from './utilities';\n\n/**\n * Common Schema Patterns\n *\n * Reusable schema patterns that appear across multiple domain schemas.\n * These patterns combine primitives into commonly used configurations.\n *\n * Benefits:\n * - DRY principle for complex patterns\n * - Consistent configuration interfaces\n * - Single source of truth for common configs\n * - Easier to maintain and update patterns globally\n */\n\n// ========================================\n// Handler Patterns\n// ========================================\n\n/**\n * HandlersConfig - Error and log handler configuration\n * Used in: Destination.Config, Collector.Config, Source.Config\n */\nexport const HandlersConfig = z\n .object({\n onError: ErrorHandlerSchema.optional().describe(\n 'Error handler function: (error, state?) => void',\n ),\n onLog: LogHandlerSchema.optional().describe(\n 'Log handler function: (message, verbose?) => void',\n ),\n })\n .partial();\n\n// ========================================\n// Configuration Patterns\n// ========================================\n\n/**\n * VerboseConfig - Verbose logging configuration\n * Used in: Destination.Config, Collector.Config\n */\nexport const VerboseConfig = z\n .object({\n verbose: z\n .boolean()\n .describe('Enable verbose logging for debugging')\n .optional(),\n })\n .partial();\n\n/**\n * QueueConfig - Event queueing configuration\n * Used in: Destination.Config\n */\nexport const QueueConfig = z\n .object({\n queue: z\n .boolean()\n .describe('Whether to queue events when consent is not granted')\n .optional(),\n })\n .partial();\n\n/**\n * IdConfig - ID configuration pattern\n * Used in: Destination.Config, Source.Config\n */\nexport const IdConfig = z.object({}).partial();\n\n/**\n * InitConfig - Initialization configuration pattern\n * Used in: Destination.Config\n */\nexport const InitConfig = z\n .object({\n init: z.boolean().describe('Whether to initialize immediately').optional(),\n loadScript: z\n .boolean()\n .describe('Whether to load external script (for web destinations)')\n .optional(),\n })\n .partial();\n\n/**\n * DisabledConfig - Disabled flag configuration\n * Used in: Source.Config\n */\nexport const DisabledConfig = z\n .object({\n disabled: z.boolean().describe('Set to true to disable').optional(),\n })\n .partial();\n\n/**\n * PrimaryConfig - Primary flag configuration\n * Used in: Source.Config, Source.InitSource\n */\nexport const PrimaryConfig = z\n .object({\n primary: z\n .boolean()\n .describe('Mark as primary (only one can be primary)')\n .optional(),\n })\n .partial();\n\n// ========================================\n// Generic Configuration Patterns\n// ========================================\n\n/**\n * GenericSettingsConfig - Generic settings configuration\n * Used in: Destination.Config, Source.Config, Collector runtime\n * Settings are implementation-specific and can't be validated generically\n */\nexport const GenericSettingsConfig = z\n .object({\n settings: z\n .any()\n .optional()\n .describe('Implementation-specific configuration'),\n })\n .partial();\n\n/**\n * GenericEnvConfig - Generic environment configuration\n * Used in: Destination.Config, Source.Config, Source.BaseEnv\n * Environment is platform-specific and can't be validated generically\n */\nexport const GenericEnvConfig = z\n .object({\n env: z\n .any()\n .optional()\n .describe('Environment dependencies (platform-specific)'),\n })\n .partial();\n\n// ========================================\n// Mapping Patterns\n// ========================================\n\n/**\n * DataTransformationConfig - Data transformation configuration\n * Used in: Destination.Config, Mapping.Config, Mapping.Rule\n *\n * Note: This creates a forward reference to ValueSchema/ValuesSchema\n * Import from mapping.ts to avoid circular dependencies\n */\nexport function createDataTransformationConfig(\n ValueSchema: z.ZodTypeAny,\n ValuesSchema: z.ZodTypeAny,\n) {\n return z\n .object({\n data: z\n .union([ValueSchema, ValuesSchema])\n .optional()\n .describe('Data transformation rules'),\n })\n .partial();\n}\n\n/**\n * MappingRulesConfig - Mapping rules configuration\n * Used in: Destination.Config, Source.Config (via Mapping.Config)\n *\n * Note: This creates a forward reference to RulesSchema\n * Import from mapping.ts to avoid circular dependencies\n */\nexport function createMappingRulesConfig(RulesSchema: z.ZodTypeAny) {\n return z\n .object({\n mapping: RulesSchema.optional().describe('Event mapping rules'),\n })\n .partial();\n}\n\n/**\n * PolicyConfig - Policy rules configuration\n * Used in: Destination.Config, Mapping.Config, Mapping.Rule\n *\n * Note: This creates a forward reference to PolicySchema\n * Import from mapping.ts to avoid circular dependencies\n */\nexport function createPolicyConfig(PolicySchema: z.ZodTypeAny) {\n return z\n .object({\n policy: PolicySchema.optional().describe('Pre-processing policy rules'),\n })\n .partial();\n}\n\n/**\n * ConsentConfig - Consent requirements configuration\n * Used in: Destination.Config, Mapping.Config, Mapping.Rule, Event\n *\n * Note: This creates a forward reference to ConsentSchema\n * Import from walkeros.ts to avoid circular dependencies\n */\nexport function createConsentConfig(ConsentSchema: z.ZodTypeAny) {\n return z\n .object({\n consent: ConsentSchema.optional().describe('Required consent states'),\n })\n .partial();\n}\n\n// ========================================\n// Instance Patterns\n// ========================================\n\n/**\n * RuntimeInstanceConfig - Runtime instance configuration\n * Used in: Destination.Instance, Source.Instance, Collector.Instance\n *\n * Common fields for runtime instances:\n * - type: Instance type identifier\n * - config: Configuration object\n * - Functions (push, init, etc.) are instance-specific\n */\nexport const RuntimeInstanceConfig = z\n .object({\n type: z.string().optional().describe('Instance type identifier'),\n config: z.unknown().describe('Instance configuration'),\n })\n .partial();\n\n// ========================================\n// Context Patterns\n// ========================================\n\n/**\n * BaseContextConfig - Base context configuration\n * Used in: Destination.Context, Source contexts\n *\n * Common fields for contexts:\n * - collector: Collector instance (runtime)\n * - config: Configuration\n * - env: Environment dependencies\n */\nexport const BaseContextConfig = z\n .object({\n collector: z.unknown().describe('Collector instance (runtime object)'),\n config: z.unknown().describe('Configuration'),\n env: z.unknown().describe('Environment dependencies'),\n })\n .partial();\n\n// ========================================\n// Batch Patterns\n// ========================================\n\n/**\n * BatchConfig - Batch processing configuration\n * Used in: Mapping.Rule\n */\nexport const BatchConfig = z\n .object({\n batch: z\n .number()\n .optional()\n .describe('Batch size: bundle N events for batch processing'),\n batched: z.unknown().optional().describe('Batch of events to be processed'),\n })\n .partial();\n\n// ========================================\n// Processing Patterns\n// ========================================\n\n/**\n * ProcessingControlConfig - Processing control flags\n * Used in: Mapping.Rule\n */\nexport const ProcessingControlConfig = z\n .object({\n ignore: z.boolean().describe('Set to true to skip processing').optional(),\n condition: z\n .string()\n .optional()\n .describe('Condition function: return true to process'),\n })\n .partial();\n\n// ========================================\n// Collection Patterns\n// ========================================\n\n/**\n * SourcesMapConfig - Sources collection pattern\n * Used in: Collector.Instance\n */\nexport const SourcesMapConfig = z\n .object({\n sources: z\n .record(z.string(), z.unknown())\n .describe('Map of source instances'),\n })\n .partial();\n\n/**\n * DestinationsMapConfig - Destinations collection pattern\n * Used in: Collector.Instance\n */\nexport const DestinationsMapConfig = z\n .object({\n destinations: z\n .record(z.string(), z.unknown())\n .describe('Map of destination instances'),\n })\n .partial();\n","import { z, toJsonSchema } from './validation';\nimport {\n RequiredString,\n RequiredNumber,\n Identifier,\n Timestamp,\n Counter,\n TaggingVersion,\n} from './primitives';\n\n/**\n * Core walkerOS Event Model Schemas\n *\n * Mirrors: types/walkeros.ts\n * Purpose: Runtime validation and JSON Schema generation for MCP tools, Explorer UI, and API boundaries\n *\n * These schemas provide:\n * 1. Runtime validation for event data\n * 2. JSON Schema generation for RJSF/Explorer\n * 3. Type documentation via .describe()\n * 4. Compile-time type checking (schemas mirror TypeScript types)\n *\n * Note: TypeScript types in types/walkeros.ts remain the source of truth for development.\n * These Zod schemas are for validation and JSON Schema generation at runtime boundaries.\n */\n\n// ========================================\n// Base Property Types (Recursive)\n// ========================================\n\n/**\n * PropertyType - Base property value types\n * Can be primitive (boolean, string, number) or nested object with Property values\n */\nexport const PropertyTypeSchema: z.ZodTypeAny = z.lazy(() =>\n z.union([\n z.boolean(),\n z.string(),\n z.number(),\n z.record(z.string(), PropertySchema),\n ]),\n);\n\n/**\n * Property - PropertyType or array of PropertyType\n * Recursive structure allows nested objects and arrays\n */\nexport const PropertySchema: z.ZodTypeAny = z.lazy(() =>\n z.union([PropertyTypeSchema, z.array(PropertyTypeSchema)]),\n);\n\n/**\n * Properties - Record of string keys to Property values\n * Used throughout event structure (data, globals, custom, etc.)\n */\nexport const PropertiesSchema = z\n .record(z.string(), PropertySchema.optional())\n .describe('Flexible property collection with optional values');\n\n/**\n * OrderedProperties - Record with [value, order] tuples\n * Used for context data where order matters\n */\nexport const OrderedPropertiesSchema = z\n .record(z.string(), z.tuple([PropertySchema, z.number()]).optional())\n .describe(\n 'Ordered properties with [value, order] tuples for priority control',\n );\n\n// ========================================\n// Enums & Union Types\n// ========================================\n\n/**\n * SourceType - Event source identifier\n * Standard types: web, server, app, other\n * Extensible: allows custom string values\n */\nexport const SourceTypeSchema = z\n .union([z.enum(['web', 'server', 'app', 'other']), z.string()])\n .describe('Source type: web, server, app, other, or custom');\n\n// ========================================\n// Event Sub-Types\n// ========================================\n\n/**\n * Consent - Consent state mapping\n * Maps consent group names to boolean states\n * Used in Event and Destination/Source configs\n */\nexport const ConsentSchema = z\n .record(z.string(), z.boolean())\n .describe('Consent requirement mapping (group name → state)');\n\n/**\n * User - User identification and attributes\n * Extends Properties with specific optional fields\n * Contains IDs, demographics, device info, and location data\n */\nexport const UserSchema = PropertiesSchema.and(\n z.object({\n // IDs\n id: z.string().optional().describe('User identifier'),\n device: z.string().optional().describe('Device identifier'),\n session: z.string().optional().describe('Session identifier'),\n hash: z.string().optional().describe('Hashed identifier'),\n // User attributes\n address: z.string().optional().describe('User address'),\n email: z.string().email().optional().describe('User email address'),\n phone: z.string().optional().describe('User phone number'),\n // Technical attributes\n userAgent: z.string().optional().describe('Browser user agent string'),\n browser: z.string().optional().describe('Browser name'),\n browserVersion: z.string().optional().describe('Browser version'),\n deviceType: z\n .string()\n .optional()\n .describe('Device type (mobile, desktop, tablet)'),\n os: z.string().optional().describe('Operating system'),\n osVersion: z.string().optional().describe('Operating system version'),\n screenSize: z.string().optional().describe('Screen dimensions'),\n // Location attributes\n language: z.string().optional().describe('User language'),\n country: z.string().optional().describe('User country'),\n region: z.string().optional().describe('User region/state'),\n city: z.string().optional().describe('User city'),\n zip: z.string().optional().describe('User postal code'),\n timezone: z.string().optional().describe('User timezone'),\n ip: z.string().optional().describe('User IP address'),\n // Flags\n internal: z\n .boolean()\n .optional()\n .describe('Internal user flag (employee, test user)'),\n }),\n).describe('User identification and properties');\n\n/**\n * Version - Walker version information\n * Tracks source implementation and tagging version\n */\nexport const VersionSchema = PropertiesSchema.and(\n z.object({\n source: RequiredString.describe(\n 'Walker implementation version (e.g., \"2.0.0\")',\n ),\n tagging: TaggingVersion,\n }),\n).describe('Walker version information');\n\n/**\n * Source - Event source information\n * Identifies where the event originated\n */\nexport const SourceSchema = PropertiesSchema.and(\n z.object({\n type: SourceTypeSchema.describe('Source type identifier'),\n id: RequiredString.describe('Source identifier (typically URL on web)'),\n previous_id: RequiredString.describe(\n 'Previous source identifier (typically referrer on web)',\n ),\n }),\n).describe('Event source information');\n\n/**\n * Entity - Nested entity structure\n * Allows events to contain related entities with their own data and context\n * Recursive: entities can contain nested entities\n */\nexport const EntitySchema: z.ZodTypeAny = z\n .lazy(() =>\n z.object({\n entity: z.string().describe('Entity name'),\n data: PropertiesSchema.describe('Entity-specific properties'),\n nested: z.array(EntitySchema).describe('Nested child entities'),\n context: OrderedPropertiesSchema.describe('Entity context data'),\n }),\n )\n .describe('Nested entity structure with recursive nesting support');\n\n/**\n * Entities - Array of Entity objects\n */\nexport const EntitiesSchema = z\n .array(EntitySchema)\n .describe('Array of nested entities');\n\n// ========================================\n// Main Event Schema\n// ========================================\n\n/**\n * Event - Complete walkerOS event structure\n *\n * Core fields:\n * - name: Event identifier in \"entity action\" format (e.g., \"page view\")\n * - data: Event-specific properties\n * - context: Ordered context properties\n * - globals: Global properties shared across events\n * - custom: Custom properties specific to implementation\n * - user: User identification and attributes\n * - nested: Related entities\n * - consent: Consent states at event time\n *\n * System-generated fields:\n * - id: Unique event identifier\n * - timestamp: Event creation time (milliseconds since epoch)\n * - entity: Parsed entity name from event.name\n * - action: Parsed action name from event.name\n * - trigger: Event trigger identifier\n * - timing: Event processing timing information\n * - group: Event grouping identifier\n * - count: Event count in session\n * - version: Walker version information\n * - source: Event source information\n */\nexport const EventSchema = z\n .object({\n // Core event identification\n name: z\n .string()\n .describe(\n 'Event name in \"entity action\" format (e.g., \"page view\", \"product add\")',\n ),\n\n // Event data\n data: PropertiesSchema.describe('Event-specific properties'),\n context: OrderedPropertiesSchema.describe(\n 'Ordered context properties with priorities',\n ),\n globals: PropertiesSchema.describe(\n 'Global properties shared across events',\n ),\n custom: PropertiesSchema.describe(\n 'Custom implementation-specific properties',\n ),\n\n // Related data\n user: UserSchema.describe('User identification and attributes'),\n nested: EntitiesSchema.describe('Related nested entities'),\n consent: ConsentSchema.describe('Consent states at event time'),\n\n // System-generated fields\n id: Identifier.describe('Unique event identifier (timestamp-based)'),\n trigger: RequiredString.describe('Event trigger identifier'),\n entity: RequiredString.describe('Parsed entity from event name'),\n action: RequiredString.describe('Parsed action from event name'),\n timestamp: Timestamp.describe('Unix timestamp in milliseconds since epoch'),\n timing: RequiredNumber.describe('Event processing timing information'),\n group: RequiredString.describe('Event grouping identifier'),\n count: Counter.describe('Event count in session'),\n\n // Version & source tracking\n version: VersionSchema.describe('Walker version information'),\n source: SourceSchema.describe('Event source information'),\n })\n .describe('Complete walkerOS event structure');\n\n/**\n * PartialEvent - Event with all fields optional\n * Used for event creation where not all fields are provided\n */\nexport const PartialEventSchema = EventSchema.partial().describe(\n 'Partial event structure with all fields optional',\n);\n\n/**\n * DeepPartialEvent - Event with all fields optional\n * Used for event updates and patches\n *\n * Note: While the TypeScript type uses DeepPartial<Event> for compile-time validation,\n * the Zod schema uses .partial() which makes top-level fields optional. This is\n * sufficient for runtime validation as deeply nested partial objects are rarely\n * provided (users typically omit entire objects rather than providing partial nested data).\n * Zod 4 deliberately removed .deepPartial() due to internal type complexity issues.\n */\nexport const DeepPartialEventSchema: z.ZodTypeAny =\n EventSchema.partial().describe(\n 'Partial event structure with all top-level fields optional',\n );\n\n// ========================================\n// JSON Schema Exports (for Explorer/RJSF/MCP)\n// ========================================\n\nexport const eventJsonSchema = toJsonSchema(EventSchema, 'Event');\n\nexport const partialEventJsonSchema = toJsonSchema(\n PartialEventSchema,\n 'PartialEvent',\n);\n\nexport const userJsonSchema = toJsonSchema(UserSchema, 'User');\n\nexport const propertiesJsonSchema = toJsonSchema(\n PropertiesSchema,\n 'Properties',\n);\n\nexport const orderedPropertiesJsonSchema = toJsonSchema(\n OrderedPropertiesSchema,\n 'OrderedProperties',\n);\n\nexport const entityJsonSchema = toJsonSchema(EntitySchema, 'Entity');\n\nexport const sourceTypeJsonSchema = toJsonSchema(\n SourceTypeSchema,\n 'SourceType',\n);\n\nexport const consentJsonSchema = toJsonSchema(ConsentSchema, 'Consent');\n","import { z, toJsonSchema } from './validation';\nimport { ConsentSchema } from './walkeros';\n\n/**\n * Mapping System Schemas\n *\n * Mirrors: types/mapping.ts\n * Purpose: Runtime validation and JSON Schema generation for event transformation rules\n *\n * The mapping system allows flexible transformation of events as they flow through\n * the collector to destinations. This includes:\n * - Value extraction and transformation\n * - Conditional logic\n * - Data mapping and restructuring\n * - Array processing (loops)\n * - Consent-based filtering\n *\n * Key Features:\n * - Recursive value definitions (Value → ValueConfig → Value)\n * - Loop vs Set distinction via JSON Schema (minItems/maxItems)\n * - Lazy evaluation for circular dependencies\n * - Function serialization support (functions as strings)\n */\n\n// ========================================\n// Recursive Value Schemas\n// ========================================\n\n// Forward declaration for circular dependency\nlet ValueConfigSchemaLazy: z.ZodTypeAny;\n\n/**\n * Value - Core value type for mapping transformations\n *\n * Can be:\n * - Primitive: string, number, boolean\n * - ValueConfig: Complex transformation object\n * - Array: Multiple values/configs\n *\n * Recursive structure allows nested transformations\n */\nexport const ValueSchema: z.ZodTypeAny = z.lazy(() =>\n z.union([\n z.string().describe('String value or property path (e.g., \"data.id\")'),\n z.number().describe('Numeric value'),\n z.boolean().describe('Boolean value'),\n z.lazy(() => ValueConfigSchemaLazy),\n z.array(ValueSchema).describe('Array of values'),\n ]),\n);\n\n/**\n * Values - Array of Value objects\n * Used for multiple data transformations\n */\nexport const ValuesSchema = z\n .array(ValueSchema)\n .describe('Array of transformation values');\n\n/**\n * Loop - Tuple for array processing\n * Format: [source, transform]\n *\n * IMPORTANT: z.tuple() generates JSON Schema with minItems/maxItems = 2\n * This is how Explorer distinguishes Loop from Set\n *\n * Example: ['nested', { map: { id: 'data.id' } }]\n * Means: Iterate over event.nested array, transform each item\n */\nconst LoopSchema: z.ZodTypeAny = z.lazy(() =>\n z\n .tuple([ValueSchema, ValueSchema])\n .describe(\n 'Loop transformation: [source, transform] tuple for array processing',\n ),\n);\n\n/**\n * Set - Array of values for selection/combination\n * Format: [value1, value2, ...]\n *\n * IMPORTANT: z.array() generates JSON Schema without minItems/maxItems\n * This distinguishes Set from Loop\n *\n * Example: ['data.firstName', ' ', 'data.lastName']\n * Means: Combine multiple values\n */\nconst SetSchema: z.ZodTypeAny = z.lazy(() =>\n z\n .array(ValueSchema)\n .describe('Set: Array of values for selection or combination'),\n);\n\n/**\n * Map - Object mapping for data transformation\n * Format: { outputKey: value, ... }\n *\n * Example: { item_id: 'data.id', item_name: 'data.name' }\n * Means: Transform event data to destination format\n */\nconst MapSchema: z.ZodTypeAny = z.lazy(() =>\n z\n .record(z.string(), ValueSchema)\n .describe('Map: Object mapping keys to transformation values'),\n);\n\n/**\n * ValueConfig - Configuration object for value transformations\n *\n * Supports multiple transformation strategies:\n * - key: Extract property from event (e.g., \"data.id\")\n * - value: Static primitive value\n * - fn: Custom transformation function (as string)\n * - map: Object mapping for structured output\n * - loop: Array iteration and transformation\n * - set: Value combination/selection\n * - consent: Consent-based filtering\n * - condition: Conditional transformation\n * - validate: Value validation\n *\n * At least one property must be present.\n */\nValueConfigSchemaLazy = z\n .object({\n key: z\n .string()\n .optional()\n .describe(\n 'Property path to extract from event (e.g., \"data.id\", \"user.email\")',\n ),\n value: z\n .union([z.string(), z.number(), z.boolean()])\n .optional()\n .describe('Static primitive value'),\n fn: z\n .string()\n .optional()\n .describe('Custom transformation function as string (serialized)'),\n map: MapSchema.optional().describe(\n 'Object mapping: transform event data to structured output',\n ),\n loop: LoopSchema.optional().describe(\n 'Loop transformation: [source, transform] for array processing',\n ),\n set: SetSchema.optional().describe(\n 'Set of values: combine or select from multiple values',\n ),\n consent: ConsentSchema.optional().describe(\n 'Required consent states to include this value',\n ),\n condition: z\n .string()\n .optional()\n .describe('Condition function as string: return true to include value'),\n validate: z\n .string()\n .optional()\n .describe('Validation function as string: return true if value is valid'),\n })\n .refine((data) => Object.keys(data).length > 0, {\n message: 'ValueConfig must have at least one property',\n })\n .describe('Value transformation configuration with multiple strategies');\n\n// Export with original name for backward compatibility\nexport const ValueConfigSchema = ValueConfigSchemaLazy;\n\n// Re-export for use in other schemas\nexport { LoopSchema, SetSchema, MapSchema };\n\n// ========================================\n// Policy Schema\n// ========================================\n\n/**\n * Policy - Pre-processing rules\n * Applied before event mapping\n * Maps policy keys to transformation values\n *\n * Example: { 'consent.marketing': true }\n * Means: Only process events with marketing consent\n */\nexport const PolicySchema = z\n .record(z.string(), ValueSchema)\n .describe('Policy rules for event pre-processing (key → value mapping)');\n\n// ========================================\n// Mapping Rule Schemas\n// ========================================\n\n/**\n * Rule - Event-specific mapping configuration\n *\n * Defines how to transform events for a specific entity-action combination\n * Can include:\n * - Batching configuration\n * - Conditional processing\n * - Consent requirements\n * - Custom settings\n * - Data transformation\n * - Event naming\n * - Policy overrides\n */\nexport const RuleSchema = z\n .object({\n batch: z\n .number()\n .optional()\n .describe('Batch size: bundle N events for batch processing'),\n // Note: batchFn and batched are runtime functions, not serializable\n condition: z\n .string()\n .optional()\n .describe('Condition function as string: return true to process event'),\n consent: ConsentSchema.optional().describe(\n 'Required consent states to process this event',\n ),\n settings: z\n .any()\n .optional()\n .describe('Destination-specific settings for this event mapping'),\n data: z\n .union([ValueSchema, ValuesSchema])\n .optional()\n .describe('Data transformation rules for event'),\n ignore: z\n .boolean()\n .optional()\n .describe('Set to true to skip processing this event'),\n name: z\n .string()\n .optional()\n .describe(\n 'Custom event name override (e.g., \"view_item\" for \"product view\")',\n ),\n policy: PolicySchema.optional().describe(\n 'Event-level policy overrides (applied after config-level policy)',\n ),\n })\n .describe('Mapping rule for specific entity-action combination');\n\n/**\n * Rules - Nested mapping rules structure\n * Format: { entity: { action: Rule | Rule[], ... }, ... }\n *\n * Supports:\n * - Specific entity-action mappings\n * - Wildcard patterns (entity: *, action: *)\n * - Multiple rules per entity-action (array)\n *\n * Example:\n * {\n * product: {\n * view: { name: 'view_item' },\n * add: { name: 'add_to_cart' }\n * },\n * page: {\n * '*': { name: 'page_interaction' }\n * }\n * }\n */\nexport const RulesSchema = z\n .record(\n z.string(),\n z.record(z.string(), z.union([RuleSchema, z.array(RuleSchema)])).optional(),\n )\n .describe(\n 'Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support',\n );\n\n/**\n * Config - Shared mapping configuration\n * Used by both Source.Config and Destination.Config\n *\n * Provides:\n * - Consent requirements\n * - Global data transformations\n * - Entity-action mapping rules\n * - Pre-processing policies\n */\nexport const ConfigSchema = z\n .object({\n consent: ConsentSchema.optional().describe(\n 'Required consent states to process any events',\n ),\n data: z\n .union([ValueSchema, ValuesSchema])\n .optional()\n .describe('Global data transformation applied to all events'),\n mapping: RulesSchema.optional().describe(\n 'Entity-action specific mapping rules',\n ),\n policy: PolicySchema.optional().describe(\n 'Pre-processing policy rules applied before mapping',\n ),\n })\n .describe('Shared mapping configuration for sources and destinations');\n\n/**\n * Result - Mapping resolution result\n * Contains the resolved mapping rule and key used\n */\nexport const ResultSchema = z\n .object({\n eventMapping: RuleSchema.optional().describe(\n 'Resolved mapping rule for event',\n ),\n mappingKey: z\n .string()\n .optional()\n .describe('Mapping key used (e.g., \"product.view\")'),\n })\n .describe('Mapping resolution result');\n\n// ========================================\n// JSON Schema Exports (for Explorer/RJSF/MCP)\n// ========================================\n\nexport const valueJsonSchema = toJsonSchema(ValueSchema, 'Value');\n\nexport const valueConfigJsonSchema = toJsonSchema(\n ValueConfigSchema,\n 'ValueConfig',\n);\n\nexport const loopJsonSchema = toJsonSchema(LoopSchema, 'Loop');\n\nexport const setJsonSchema = toJsonSchema(SetSchema, 'Set');\n\nexport const mapJsonSchema = toJsonSchema(MapSchema, 'Map');\n\nexport const policyJsonSchema = toJsonSchema(PolicySchema, 'Policy');\n\nexport const ruleJsonSchema = toJsonSchema(RuleSchema, 'Rule');\n\nexport const rulesJsonSchema = toJsonSchema(RulesSchema, 'Rules');\n\nexport const configJsonSchema = toJsonSchema(ConfigSchema, 'MappingConfig');\n","import { z, toJsonSchema } from './validation';\nimport { ConsentSchema, EventSchema } from './walkeros';\nimport {\n ValueSchema,\n ValuesSchema,\n RuleSchema,\n RulesSchema,\n PolicySchema,\n} from './mapping';\nimport { Identifier } from './primitives';\nimport { ErrorHandlerSchema, LogHandlerSchema } from './utilities';\n\n/**\n * Destination Schemas\n *\n * Mirrors: types/destination.ts\n * Purpose: Runtime validation and JSON Schema generation for destination configurations\n *\n * Destinations are the endpoints where processed events are sent (analytics tools,\n * marketing platforms, data warehouses, etc.). This file defines schemas for:\n * - Destination configuration\n * - Type bundles for generic constraints\n * - Push contexts\n * - Batching structures\n */\n\n// ========================================\n// Configuration Schemas\n// ========================================\n\n/**\n * Config - Destination configuration\n *\n * Defines how a destination processes events:\n * - Consent requirements\n * - Settings (destination-specific)\n * - Data transformations\n * - Environment dependencies\n * - Initialization options\n * - Mapping rules\n * - Processing policies\n * - Queueing behavior\n * - Logging verbosity\n * - Error/log handlers\n *\n * Generic note: settings, env, and mapping can have destination-specific types\n * but for schema validation we use z.unknown() to allow flexibility\n */\nexport const ConfigSchema = z\n .object({\n consent: ConsentSchema.optional().describe(\n 'Required consent states to send events to this destination',\n ),\n settings: z\n .any()\n .describe('Implementation-specific configuration')\n .optional(),\n data: z\n .union([ValueSchema, ValuesSchema])\n .optional()\n .describe(\n 'Global data transformation applied to all events for this destination',\n ),\n env: z\n .any()\n .describe('Environment dependencies (platform-specific)')\n .optional(),\n id: Identifier.describe(\n 'Destination instance identifier (defaults to destination key)',\n ).optional(),\n init: z.boolean().describe('Whether to initialize immediately').optional(),\n loadScript: z\n .boolean()\n .describe('Whether to load external script (for web destinations)')\n .optional(),\n mapping: RulesSchema.optional().describe(\n 'Entity-action specific mapping rules for this destination',\n ),\n policy: PolicySchema.optional().describe(\n 'Pre-processing policy rules applied before event mapping',\n ),\n queue: z\n .boolean()\n .describe('Whether to queue events when consent is not granted')\n .optional(),\n verbose: z\n .boolean()\n .describe('Enable verbose logging for debugging')\n .optional(),\n // Handler functions\n onError: ErrorHandlerSchema.optional(),\n onLog: LogHandlerSchema.optional(),\n })\n .describe('Destination configuration');\n\n/**\n * PartialConfig - Config with all fields optional\n * Used for config updates and overrides\n *\n * Note: All fields in ConfigSchema are already optional (.optional() on each field).\n * Using .partial() ensures the schema itself makes all fields optional at the type level.\n */\nexport const PartialConfigSchema = ConfigSchema.partial().describe(\n 'Partial destination configuration with all fields optional',\n);\n\n/**\n * Policy - Processing policy rules\n * Maps policy keys to transformation values\n * Applied before event mapping\n */\nexport const DestinationPolicySchema = PolicySchema.describe(\n 'Destination policy rules for event pre-processing',\n);\n\n// ========================================\n// Context Schemas\n// ========================================\n\n/**\n * Context - Base destination context\n * Passed to init and push functions\n * Contains collector instance, config, data, and environment\n *\n * Note: collector is runtime instance, not easily serializable\n */\nexport const ContextSchema = z\n .object({\n collector: z.unknown().describe('Collector instance (runtime object)'),\n config: ConfigSchema.describe('Destination configuration'),\n data: z\n .union([\n z.unknown(), // WalkerOS.Property\n z.array(z.unknown()),\n ])\n .optional()\n .describe('Transformed event data'),\n env: z.unknown().describe('Environment dependencies'),\n })\n .describe('Destination context for init and push functions');\n\n/**\n * PushContext - Context for push function\n * Extends Context with mapping rule information\n */\nexport const PushContextSchema = ContextSchema.extend({\n mapping: RuleSchema.optional().describe(\n 'Resolved mapping rule for this specific event',\n ),\n}).describe('Push context with event-specific mapping');\n\n/**\n * PushBatchContext - Context for pushBatch function\n * Same as PushContext but for batch processing\n */\nexport const PushBatchContextSchema = PushContextSchema.describe(\n 'Batch push context with event-specific mapping',\n);\n\n// ========================================\n// Batch Processing Schemas\n// ========================================\n\n/**\n * PushEvent - Single event with mapping in a batch\n */\nexport const PushEventSchema = z\n .object({\n event: EventSchema.describe('The event to process'),\n mapping: RuleSchema.optional().describe('Mapping rule for this event'),\n })\n .describe('Event with optional mapping for batch processing');\n\n/**\n * PushEvents - Array of PushEvent\n */\nexport const PushEventsSchema = z\n .array(PushEventSchema)\n .describe('Array of events with mappings');\n\n/**\n * Batch - Batched events for processing\n * Groups events by mapping key for efficient batch sends\n */\nexport const BatchSchema = z\n .object({\n key: z\n .string()\n .describe('Batch key (usually mapping key like \"product.view\")'),\n events: z.array(EventSchema).describe('Array of events in batch'),\n data: z\n .array(\n z\n .union([\n z.unknown(), // WalkerOS.Property\n z.array(z.unknown()),\n ])\n .optional(),\n )\n .describe('Transformed data for each event'),\n mapping: RuleSchema.optional().describe('Shared mapping rule for batch'),\n })\n .describe('Batch of events grouped by mapping key');\n\n/**\n * Data - Transformed event data types\n * Can be single property, undefined, or array of properties\n */\nexport const DataSchema = z\n .union([\n z.unknown(), // WalkerOS.Property\n z.array(z.unknown()),\n ])\n .optional()\n .describe('Transformed event data (Property, undefined, or array)');\n\n// ========================================\n// Instance Schemas\n// ========================================\n\n/**\n * Instance - Destination instance (runtime object)\n *\n * Note: This schema is primarily for documentation\n * Runtime functions (init, push, pushBatch) cannot be validated\n * Use z.unknown() for function fields\n */\nexport const InstanceSchema = z\n .object({\n config: ConfigSchema.describe('Destination configuration'),\n queue: z\n .array(EventSchema)\n .optional()\n .describe('Queued events awaiting consent'),\n dlq: z\n .array(z.tuple([EventSchema, z.unknown()]))\n .optional()\n .describe('Dead letter queue (failed events with errors)'),\n type: z.string().optional().describe('Destination type identifier'),\n env: z.unknown().optional().describe('Environment dependencies'),\n // Functions - not validated, use z.unknown()\n init: z.unknown().optional().describe('Initialization function'),\n push: z.unknown().describe('Push function for single events'),\n pushBatch: z.unknown().optional().describe('Batch push function'),\n on: z.unknown().optional().describe('Event lifecycle hook function'),\n })\n .describe('Destination instance (runtime object with functions)');\n\n/**\n * Init - Initialization config\n * Contains destination code and configuration\n */\nexport const InitSchema = z\n .object({\n code: InstanceSchema.describe('Destination instance with implementation'),\n config: PartialConfigSchema.optional().describe(\n 'Partial configuration overrides',\n ),\n env: z.unknown().optional().describe('Partial environment overrides'),\n })\n .describe('Destination initialization configuration');\n\n/**\n * InitDestinations - Map of destination IDs to Init configs\n */\nexport const InitDestinationsSchema = z\n .record(z.string(), InitSchema)\n .describe('Map of destination IDs to initialization configurations');\n\n/**\n * Destinations - Map of destination IDs to instances\n */\nexport const DestinationsSchema = z\n .record(z.string(), InstanceSchema)\n .describe('Map of destination IDs to runtime instances');\n\n// ========================================\n// Result Schemas\n// ========================================\n\n/**\n * Ref - Destination reference\n * Links destination ID to instance\n */\nexport const RefSchema = z\n .object({\n id: z.string().describe('Destination ID'),\n destination: InstanceSchema.describe('Destination instance'),\n })\n .describe('Destination reference (ID + instance)');\n\n/**\n * Push - Push operation result\n */\nexport const PushResultSchema = z\n .object({\n queue: z\n .array(EventSchema)\n .optional()\n .describe('Events queued (awaiting consent)'),\n error: z.unknown().optional().describe('Error if push failed'),\n })\n .describe('Push operation result');\n\n/**\n * Result - Overall processing result\n * Categorizes destinations by processing outcome\n */\nexport const ResultSchema = z\n .object({\n successful: z\n .array(RefSchema)\n .describe('Destinations that processed successfully'),\n queued: z.array(RefSchema).describe('Destinations that queued events'),\n failed: z.array(RefSchema).describe('Destinations that failed to process'),\n })\n .describe('Overall destination processing result');\n\n/**\n * DLQ - Dead Letter Queue\n * Array of failed events with their errors\n */\nexport const DLQSchema = z\n .array(z.tuple([EventSchema, z.unknown()]))\n .describe('Dead letter queue: [(event, error), ...]');\n\n// ========================================\n// JSON Schema Exports (for Explorer/RJSF/MCP)\n// ========================================\n\nexport const configJsonSchema = toJsonSchema(ConfigSchema, 'DestinationConfig');\n\nexport const partialConfigJsonSchema = toJsonSchema(\n PartialConfigSchema,\n 'PartialDestinationConfig',\n);\n\nexport const contextJsonSchema = toJsonSchema(\n ContextSchema,\n 'DestinationContext',\n);\n\nexport const pushContextJsonSchema = toJsonSchema(\n PushContextSchema,\n 'PushContext',\n);\n\nexport const batchJsonSchema = toJsonSchema(BatchSchema, 'Batch');\n\nexport const instanceJsonSchema = toJsonSchema(\n InstanceSchema,\n 'DestinationInstance',\n);\n\nexport const resultJsonSchema = toJsonSchema(ResultSchema, 'DestinationResult');\n","import { z, toJsonSchema } from './validation';\nimport {\n ConsentSchema,\n UserSchema,\n PropertiesSchema,\n EventSchema,\n} from './walkeros';\nimport { ConfigSchema as MappingConfigSchema } from './mapping';\nimport {\n RequiredBoolean,\n RequiredNumber,\n Identifier,\n Timestamp,\n Counter,\n TaggingVersion,\n} from './primitives';\nimport { ErrorHandlerSchema, LogHandlerSchema } from './utilities';\n\n/**\n * Collector Schemas\n *\n * Mirrors: types/collector.ts\n * Purpose: Runtime validation and JSON Schema generation for collector configurations\n *\n * The collector is the central event processing engine in walkerOS:\n * - Receives events from sources\n * - Processes events with consent and context\n * - Routes events to destinations\n * - Manages session state and globals\n * - Handles lifecycle hooks\n *\n * This file defines schemas for collector configuration, commands, and state management.\n */\n\n// ========================================\n// Command Type Schema\n// ========================================\n\n/**\n * CommandType - Walker command identifiers\n *\n * Standard commands:\n * - action: TODO - need documentation\n * - config: Update collector configuration\n * - consent: Update consent state\n * - context: TODO - need documentation\n * - destination: Add/update destination\n * - elb: TODO - need documentation\n * - globals: Update global properties\n * - hook: Register lifecycle hook\n * - init: Initialize collector\n * - link: TODO - need documentation\n * - run: Start/restart collector with state\n * - user: Update user data\n * - walker: TODO - need documentation\n *\n * Extensible: allows custom command strings\n */\nexport const CommandTypeSchema = z\n .union([\n z.enum([\n 'action',\n 'config',\n 'consent',\n 'context',\n 'destination',\n 'elb',\n 'globals',\n 'hook',\n 'init',\n 'link',\n 'run',\n 'user',\n 'walker',\n ]),\n z.string(), // Allow custom commands\n ])\n .describe(\n 'Collector command type: standard commands or custom string for extensions',\n );\n\n// ========================================\n// Configuration Schemas\n// ========================================\n\n/**\n * Config - Core collector configuration\n *\n * Controls collector behavior:\n * - run: Auto-run on initialization\n * - tagging: Version number for event tagging\n * - globalsStatic: Static globals (persist across runs)\n * - sessionStatic: Static session data (persist across runs)\n * - verbose: Enable verbose logging\n * - onError: Error handler\n * - onLog: Log handler\n */\nexport const ConfigSchema = z\n .object({\n run: z\n .boolean()\n .describe('Whether to run collector automatically on initialization')\n .optional(),\n tagging: TaggingVersion,\n globalsStatic: PropertiesSchema.describe(\n 'Static global properties that persist across collector runs',\n ),\n sessionStatic: z\n .record(z.string(), z.unknown())\n .describe('Static session data that persists across collector runs'),\n verbose: z.boolean().describe('Enable verbose logging for debugging'),\n // Function handlers\n onError: ErrorHandlerSchema.optional(),\n onLog: LogHandlerSchema.optional(),\n })\n .describe('Core collector configuration');\n\n/**\n * SessionData - Session state management\n *\n * Tracks session-level information:\n * - IDs and lifecycle\n * - Storage state\n * - Marketing tracking\n * - Timestamps\n * - Counters\n *\n * Extends Properties to allow custom session data\n */\nexport const SessionDataSchema = PropertiesSchema.and(\n z.object({\n isStart: z.boolean().describe('Whether this is a new session start'),\n storage: z.boolean().describe('Whether storage is available'),\n id: Identifier.describe('Session identifier').optional(),\n start: Timestamp.describe('Session start timestamp').optional(),\n marketing: z\n .literal(true)\n .optional()\n .describe('Marketing attribution flag'),\n updated: Timestamp.describe('Last update timestamp').optional(),\n isNew: z.boolean().describe('Whether this is a new session').optional(),\n device: Identifier.describe('Device identifier').optional(),\n count: Counter.describe('Event count in session').optional(),\n runs: Counter.describe('Number of runs').optional(),\n }),\n).describe('Session state and tracking data');\n\n/**\n * InitConfig - Initialization configuration\n *\n * Extends Config with initial state:\n * - Initial consent\n * - Initial user data\n * - Initial globals\n * - Source configurations\n * - Destination configurations\n * - Initial custom properties\n */\nexport const InitConfigSchema = ConfigSchema.partial()\n .extend({\n consent: ConsentSchema.optional().describe('Initial consent state'),\n user: UserSchema.optional().describe('Initial user data'),\n globals: PropertiesSchema.optional().describe('Initial global properties'),\n // Sources and destinations are complex runtime objects\n sources: z.unknown().optional().describe('Source configurations'),\n destinations: z.unknown().optional().describe('Destination configurations'),\n custom: PropertiesSchema.optional().describe(\n 'Initial custom implementation-specific properties',\n ),\n })\n .describe('Collector initialization configuration with initial state');\n\n// ========================================\n// Context Schemas\n// ========================================\n\n/**\n * PushContext - Context for collector.push\n *\n * Provides source-level mapping configuration\n * Applied before destination-specific mappings\n */\nexport const PushContextSchema = z\n .object({\n mapping: MappingConfigSchema.optional().describe(\n 'Source-level mapping configuration',\n ),\n })\n .describe('Push context with optional source mapping');\n\n// ========================================\n// Collection Schemas\n// ========================================\n\n/**\n * Sources - Map of source IDs to instances\n */\nexport const SourcesSchema = z\n .record(z.string(), z.unknown())\n .describe('Map of source IDs to source instances');\n\n/**\n * Destinations - Map of destination IDs to instances\n */\nexport const DestinationsSchema = z\n .record(z.string(), z.unknown())\n .describe('Map of destination IDs to destination instances');\n\n// ========================================\n// Instance Schema\n// ========================================\n\n/**\n * Instance - Collector instance (runtime object)\n *\n * The main collector interface with all state and methods\n *\n * State:\n * - config: Current configuration\n * - consent: Current consent state\n * - user: Current user data\n * - globals: Current global properties\n * - custom: Custom properties\n * - session: Session state\n * - sources: Registered sources\n * - destinations: Registered destinations\n * - hooks: Lifecycle hooks\n * - on: Event lifecycle config\n * - queue: Queued events\n *\n * Flags:\n * - allowed: Processing allowed\n * - count: Event count\n * - round: Collector run count\n * - timing: Processing timing\n * - group: Event grouping ID\n *\n * Methods (not validated):\n * - push: Process events\n * - command: Execute commands\n */\nexport const InstanceSchema = z\n .object({\n // Methods (functions - not validated)\n push: z.unknown().describe('Push function for processing events'),\n command: z.unknown().describe('Command function for walker commands'),\n // State\n allowed: z.boolean().describe('Whether event processing is allowed'),\n config: ConfigSchema.describe('Current collector configuration'),\n consent: ConsentSchema.describe('Current consent state'),\n count: z.number().describe('Event count (increments with each event)'),\n custom: PropertiesSchema.describe(\n 'Custom implementation-specific properties',\n ),\n sources: SourcesSchema.describe('Registered source instances'),\n destinations: DestinationsSchema.describe(\n 'Registered destination instances',\n ),\n globals: PropertiesSchema.describe('Current global properties'),\n group: z.string().describe('Event grouping identifier'),\n hooks: z.unknown().describe('Lifecycle hook functions'),\n on: z.unknown().describe('Event lifecycle configuration'),\n queue: z.array(EventSchema).describe('Queued events awaiting processing'),\n round: z\n .number()\n .describe('Collector run count (increments with each run)'),\n session: z.union([SessionDataSchema]).describe('Current session state'),\n timing: z.number().describe('Event processing timing information'),\n user: UserSchema.describe('Current user data'),\n version: z.string().describe('Walker implementation version'),\n })\n .describe('Collector instance with state and methods');\n\n// ========================================\n// JSON Schema Exports (for Explorer/RJSF/MCP)\n// ========================================\n\nexport const commandTypeJsonSchema = toJsonSchema(\n CommandTypeSchema,\n 'CommandType',\n);\n\nexport const configJsonSchema = toJsonSchema(ConfigSchema, 'CollectorConfig');\n\nexport const sessionDataJsonSchema = toJsonSchema(\n SessionDataSchema,\n 'SessionData',\n);\n\nexport const initConfigJsonSchema = toJsonSchema(\n InitConfigSchema,\n 'InitConfig',\n);\n\nexport const pushContextJsonSchema = toJsonSchema(\n PushContextSchema,\n 'CollectorPushContext',\n);\n\nexport const instanceJsonSchema = toJsonSchema(\n InstanceSchema,\n 'CollectorInstance',\n);\n","import { z, toJsonSchema } from './validation';\nimport { ConfigSchema as MappingConfigSchema } from './mapping';\nimport { Identifier } from './primitives';\nimport { ErrorHandlerSchema } from './utilities';\n\n/**\n * Source Schemas\n *\n * Mirrors: types/source.ts\n * Purpose: Runtime validation and JSON Schema generation for source configurations\n *\n * Sources are the entry points where events enter walkerOS:\n * - Browser sources (DOM events, dataLayer)\n * - Server sources (HTTP handlers, cloud functions)\n * - App sources (mobile, desktop)\n *\n * Sources are platform-agnostic through dependency injection via BaseEnv.\n * All platform-specific dependencies (DOM, HTTP, etc.) are provided through\n * the env object, making sources testable and portable.\n *\n * Key concept: Source.push IS the handler - no wrappers needed\n * Example: http('handler', source.push) for direct deployment\n */\n\n// ========================================\n// Environment Schema\n// ========================================\n\n/**\n * BaseEnv - Base environment interface for dependency injection\n *\n * Sources receive all dependencies through this environment object:\n * - push: Collector push function\n * - command: Collector command function\n * - sources: Other registered sources\n * - elb: Public API function (alias for collector.push)\n *\n * Platform-specific sources extend this with their requirements\n * (e.g., window, document, fetch, req, res)\n *\n * This makes sources:\n * - Platform-agnostic (no direct dependencies)\n * - Testable (mock env for tests)\n * - Composable (share env between sources)\n */\nexport const BaseEnvSchema = z\n .object({\n push: z.unknown().describe('Collector push function'),\n command: z.unknown().describe('Collector command function'),\n sources: z\n .unknown()\n .optional()\n .describe('Map of registered source instances'),\n elb: z.unknown().describe('Public API function (alias for collector.push)'),\n })\n .catchall(z.unknown())\n .describe(\n 'Base environment for dependency injection - platform-specific sources extend this',\n );\n\n// ========================================\n// Configuration Schema\n// ========================================\n\n/**\n * Config - Source configuration\n *\n * Extends Mapping.Config with source-specific options:\n * - consent: Required consent to process events\n * - data: Global data transformations\n * - mapping: Entity-action mapping rules\n * - policy: Pre-processing policies\n * - settings: Source-specific settings\n * - env: Environment dependencies\n * - id: Source identifier\n * - onError: Error handler\n * - disabled: Disable source\n * - primary: Primary source flag (only one can be primary)\n *\n * Generic note: settings, env, and mapping can have source-specific types\n */\nexport const ConfigSchema = MappingConfigSchema.extend({\n settings: z\n .any()\n .describe('Implementation-specific configuration')\n .optional(),\n env: BaseEnvSchema.optional().describe(\n 'Environment dependencies (platform-specific)',\n ),\n id: Identifier.describe(\n 'Source identifier (defaults to source key)',\n ).optional(),\n onError: ErrorHandlerSchema.optional(),\n disabled: z.boolean().describe('Set to true to disable').optional(),\n primary: z\n .boolean()\n .describe('Mark as primary (only one can be primary)')\n .optional(),\n}).describe('Source configuration with mapping and environment');\n\n/**\n * PartialConfig - Config with all fields optional\n * Used for config updates and overrides\n *\n * Note: ConfigSchema extends MappingConfigSchema with mostly optional fields.\n * Using .partial() ensures all fields are optional for config updates.\n */\nexport const PartialConfigSchema = ConfigSchema.partial().describe(\n 'Partial source configuration with all fields optional',\n);\n\n// ========================================\n// Instance Schema\n// ========================================\n\n/**\n * Instance - Source instance (runtime object)\n *\n * Contains:\n * - type: Source type identifier\n * - config: Current configuration\n * - push: Push function (THE HANDLER)\n * - destroy: Cleanup function\n * - on: Lifecycle hook function\n *\n * Key concept: push IS the handler\n * The push function signature is flexible to support different platforms:\n * - Browser: push(event, data) => Promise<void>\n * - HTTP: push(req, res) => Promise<void>\n * - Cloud: push(event, context) => Promise<void>\n *\n * This flexibility allows direct deployment without wrappers:\n * - http.createServer(source.push)\n * - functions.https.onRequest(source.push)\n * - addEventListener('click', source.push)\n */\nexport const InstanceSchema = z\n .object({\n type: z\n .string()\n .describe('Source type identifier (e.g., \"browser\", \"dataLayer\")'),\n config: ConfigSchema.describe('Current source configuration'),\n // Push function - flexible signature, not validated\n push: z\n .any()\n .describe(\n 'Push function - THE HANDLER (flexible signature for platform compatibility)',\n ),\n // Optional lifecycle methods\n destroy: z\n .any()\n .optional()\n .describe('Cleanup function called when source is removed'),\n on: z\n .unknown()\n .optional()\n .describe('Lifecycle hook function for event types'),\n })\n .describe('Source instance with push handler and lifecycle methods');\n\n// ========================================\n// Initialization Schemas\n// ========================================\n\n/**\n * Init - Source initialization function\n *\n * Factory function that creates a source instance:\n * (config, env) => Instance | Promise<Instance>\n *\n * Receives:\n * - config: Partial configuration\n * - env: Environment dependencies\n *\n * Returns:\n * - Source instance with push function\n *\n * The init function sets up the source (e.g., attach DOM listeners,\n * start HTTP server, subscribe to events) and returns the instance.\n */\nexport const InitSchema = z\n .any()\n .describe(\n 'Source initialization function: (config, env) => Instance | Promise<Instance>',\n );\n\n/**\n * InitSource - Initialization configuration\n *\n * Contains:\n * - code: Init function\n * - config: Partial config overrides\n * - env: Partial env overrides\n * - primary: Primary source flag\n */\nexport const InitSourceSchema = z\n .object({\n code: InitSchema.describe('Source initialization function'),\n config: PartialConfigSchema.optional().describe(\n 'Partial configuration overrides',\n ),\n env: BaseEnvSchema.partial()\n .optional()\n .describe('Partial environment overrides'),\n primary: z\n .boolean()\n .optional()\n .describe('Mark as primary source (only one can be primary)'),\n })\n .describe('Source initialization configuration');\n\n/**\n * InitSources - Map of source IDs to init configs\n */\nexport const InitSourcesSchema = z\n .record(z.string(), InitSourceSchema)\n .describe('Map of source IDs to initialization configurations');\n\n// ========================================\n// JSON Schema Exports (for Explorer/RJSF/MCP)\n// ========================================\n\nexport const baseEnvJsonSchema = toJsonSchema(BaseEnvSchema, 'SourceBaseEnv');\n\nexport const configJsonSchema = toJsonSchema(ConfigSchema, 'SourceConfig');\n\nexport const partialConfigJsonSchema = toJsonSchema(\n PartialConfigSchema,\n 'PartialSourceConfig',\n);\n\nexport const instanceJsonSchema = toJsonSchema(\n InstanceSchema,\n 'SourceInstance',\n);\n\nexport const initSourceJsonSchema = toJsonSchema(\n InitSourceSchema,\n 'InitSource',\n);\n\nexport const initSourcesJsonSchema = toJsonSchema(\n InitSourcesSchema,\n 'InitSources',\n);\n","/**\n * Flow Configuration System - Zod Schemas\n *\n * Mirrors: types/flow.ts\n * Purpose: Runtime validation and JSON Schema generation for Flow configurations\n *\n * The Flow system provides unified configuration across all walkerOS environments.\n * These schemas enable:\n * - Runtime validation of config files\n * - Clear error messages for configuration issues\n * - JSON Schema generation for IDE support\n * - Type-safe parsing with Zod\n *\n * @packageDocumentation\n */\n\nimport { z, toJsonSchema } from './validation';\n\n// ========================================\n// Primitive Type Schemas\n// ========================================\n\n/**\n * Primitive value schema for variables.\n *\n * @remarks\n * Variables can be strings, numbers, or booleans.\n * Used in Setup.variables and Config.env.\n */\nexport const PrimitiveSchema = z\n .union([z.string(), z.number(), z.boolean()])\n .describe('Primitive value: string, number, or boolean');\n\n// ========================================\n// Source Reference Schema\n// ========================================\n\n/**\n * Source reference schema.\n *\n * @remarks\n * Defines how to reference and configure a source package.\n * Sources capture events from various origins (browser, HTTP, etc.).\n */\nexport const SourceReferenceSchema = z\n .object({\n package: z\n .string()\n .min(1, 'Package name cannot be empty')\n .describe(\n 'Package specifier with optional version (e.g., \"@walkeros/web-source-browser@2.0.0\")',\n ),\n config: z\n .unknown()\n .optional()\n .describe('Source-specific configuration object'),\n env: z.unknown().optional().describe('Source environment configuration'),\n primary: z\n .boolean()\n .optional()\n .describe(\n 'Mark as primary source (provides main elb). Only one source should be primary.',\n ),\n })\n .describe('Source package reference with configuration');\n\n// ========================================\n// Destination Reference Schema\n// ========================================\n\n/**\n * Destination reference schema.\n *\n * @remarks\n * Defines how to reference and configure a destination package.\n * Destinations send processed events to external services.\n */\nexport const DestinationReferenceSchema = z\n .object({\n package: z\n .string()\n .min(1, 'Package name cannot be empty')\n .describe(\n 'Package specifier with optional version (e.g., \"@walkeros/web-destination-gtag@2.0.0\")',\n ),\n config: z\n .unknown()\n .optional()\n .describe('Destination-specific configuration object'),\n env: z\n .unknown()\n .optional()\n .describe('Destination environment configuration'),\n })\n .describe('Destination package reference with configuration');\n\n// ========================================\n// Flow Environment Configuration Schema\n// ========================================\n\n/**\n * Flow environment configuration schema.\n *\n * @remarks\n * Represents a single deployment environment (e.g., web_prod, server_stage).\n * Uses `.passthrough()` to allow package-specific extensions (build, docker, etc.).\n */\nexport const ConfigSchema = z\n .object({\n platform: z\n .enum(['web', 'server'], {\n error: 'Platform must be \"web\" or \"server\"',\n })\n .describe(\n 'Target platform: \"web\" for browser-based tracking, \"server\" for Node.js server-side collection',\n ),\n sources: z\n .record(z.string(), SourceReferenceSchema)\n .optional()\n .describe(\n 'Source configurations (data capture) keyed by unique identifier',\n ),\n destinations: z\n .record(z.string(), DestinationReferenceSchema)\n .optional()\n .describe(\n 'Destination configurations (data output) keyed by unique identifier',\n ),\n collector: z\n .unknown()\n .optional()\n .describe(\n 'Collector configuration for event processing (uses Collector.InitConfig)',\n ),\n env: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Environment-specific variables (override root-level variables)',\n ),\n })\n .passthrough() // Allow extension fields (build, docker, lambda, etc.)\n .describe('Single environment configuration for one deployment target');\n\n// ========================================\n// Flow Setup Schema (Root Configuration)\n// ========================================\n\n/**\n * Flow setup schema - root configuration.\n *\n * @remarks\n * This is the complete schema for walkeros.config.json files.\n * Contains multiple named environments with shared variables and definitions.\n */\nexport const SetupSchema = z\n .object({\n version: z\n .literal(1, {\n error: 'Only version 1 is currently supported',\n })\n .describe('Configuration schema version (currently only 1 is supported)'),\n $schema: z\n .string()\n .url('Schema URL must be a valid URL')\n .optional()\n .describe(\n 'JSON Schema reference for IDE validation (e.g., \"https://walkeros.io/schema/flow/v1.json\")',\n ),\n variables: z\n .record(z.string(), PrimitiveSchema)\n .optional()\n .describe(\n 'Shared variables for interpolation across all environments (use ${VAR_NAME:default} syntax)',\n ),\n definitions: z\n .record(z.string(), z.unknown())\n .optional()\n .describe(\n 'Reusable configuration definitions (reference with JSON Schema $ref syntax)',\n ),\n environments: z\n .record(z.string(), ConfigSchema)\n .refine((envs) => Object.keys(envs).length > 0, {\n message: 'At least one environment is required',\n })\n .describe(\n 'Named environment configurations (e.g., web_prod, server_stage)',\n ),\n })\n .describe(\n 'Complete multi-environment walkerOS configuration (walkeros.config.json)',\n );\n\n// ========================================\n// Helper Functions\n// ========================================\n\n/**\n * Parse and validate Flow.Setup configuration.\n *\n * @param data - Raw JSON data from config file\n * @returns Validated Flow.Setup object\n * @throws ZodError if validation fails with detailed error messages\n *\n * @example\n * ```typescript\n * import { parseSetup } from '@walkeros/core/dev';\n * import { readFileSync } from 'fs';\n *\n * const raw = JSON.parse(readFileSync('walkeros.config.json', 'utf8'));\n * const config = parseSetup(raw);\n * console.log(`Found ${Object.keys(config.environments).length} environments`);\n * ```\n */\nexport function parseSetup(data: unknown): z.infer<typeof SetupSchema> {\n return SetupSchema.parse(data);\n}\n\n/**\n * Safely parse Flow.Setup configuration without throwing.\n *\n * @param data - Raw JSON data from config file\n * @returns Success result with data or error result with issues\n *\n * @example\n * ```typescript\n * import { safeParseSetup } from '@walkeros/core/dev';\n *\n * const result = safeParseSetup(rawData);\n * if (result.success) {\n * console.log('Valid config:', result.data);\n * } else {\n * console.error('Validation errors:', result.error.issues);\n * }\n * ```\n */\nexport function safeParseSetup(data: unknown) {\n return SetupSchema.safeParse(data);\n}\n\n/**\n * Parse and validate Flow.Config (single environment).\n *\n * @param data - Raw JSON data for single environment\n * @returns Validated Flow.Config object\n * @throws ZodError if validation fails\n *\n * @example\n * ```typescript\n * import { parseConfig } from '@walkeros/core/dev';\n *\n * const envConfig = parseConfig(rawEnvData);\n * console.log(`Platform: ${envConfig.platform}`);\n * ```\n */\nexport function parseConfig(data: unknown): z.infer<typeof ConfigSchema> {\n return ConfigSchema.parse(data);\n}\n\n/**\n * Safely parse Flow.Config without throwing.\n *\n * @param data - Raw JSON data for single environment\n * @returns Success result with data or error result with issues\n */\nexport function safeParseConfig(data: unknown) {\n return ConfigSchema.safeParse(data);\n}\n\n// ========================================\n// JSON Schema Generation\n// ========================================\n\n/**\n * Generate JSON Schema for Flow.Setup.\n *\n * @remarks\n * Used for IDE validation and autocomplete.\n * Hosted at https://walkeros.io/schema/flow/v1.json\n *\n * @returns JSON Schema (Draft 7) representation of SetupSchema\n *\n * @example\n * ```typescript\n * import { setupJsonSchema } from '@walkeros/core/dev';\n * import { writeFileSync } from 'fs';\n *\n * writeFileSync(\n * 'public/schema/flow/v1.json',\n * JSON.stringify(setupJsonSchema, null, 2)\n * );\n * ```\n */\nexport const setupJsonSchema = z.toJSONSchema(SetupSchema, {\n target: 'draft-7',\n});\n\n/**\n * Generate JSON Schema for Flow.Config.\n *\n * @remarks\n * Used for validating individual environment configurations.\n *\n * @returns JSON Schema (Draft 7) representation of ConfigSchema\n */\nexport const configJsonSchema = toJsonSchema(ConfigSchema, 'FlowConfig');\n\n/**\n * Generate JSON Schema for SourceReference.\n *\n * @remarks\n * Used for validating source package references.\n *\n * @returns JSON Schema (Draft 7) representation of SourceReferenceSchema\n */\nexport const sourceReferenceJsonSchema = toJsonSchema(\n SourceReferenceSchema,\n 'SourceReference',\n);\n\n/**\n * Generate JSON Schema for DestinationReference.\n *\n * @remarks\n * Used for validating destination package references.\n *\n * @returns JSON Schema (Draft 7) representation of DestinationReferenceSchema\n */\nexport const destinationReferenceJsonSchema = toJsonSchema(\n DestinationReferenceSchema,\n 'DestinationReference',\n);\n","/**\n * JSON Schema type\n */\nexport type JSONSchema = Record<string, unknown>;\n\n/**\n * Schema Builder - DRY utility for creating JSON Schemas\n *\n * This utility allows destinations to define schemas using simple objects,\n * without needing Zod as a dependency. The core package handles conversion.\n *\n * Benefits:\n * - Single source of schema generation logic\n * - No Zod dependency in destination packages\n * - Simple, declarative schema definitions\n * - Type-safe with TypeScript\n * - Follows DRY principle\n *\n * @example\n * // In destination package (NO Zod needed!)\n * import { createObjectSchema, createArraySchema } from '@walkeros/core/dev';\n *\n * export const settingsSchema = createObjectSchema({\n * pixelId: {\n * type: 'string',\n * required: true,\n * pattern: '^[0-9]+$',\n * description: 'Your Meta Pixel ID',\n * },\n * });\n */\n\n/**\n * Property definition for schema builder\n */\nexport interface PropertyDef {\n type: 'string' | 'number' | 'boolean' | 'object' | 'array';\n required?: boolean;\n description?: string;\n pattern?: string;\n minLength?: number;\n maxLength?: number;\n minimum?: number;\n maximum?: number;\n enum?: readonly string[] | readonly number[];\n properties?: Record<string, PropertyDef>;\n items?: PropertyDef;\n default?: unknown;\n}\n\n/**\n * Create object schema from property definitions\n *\n * @param properties - Property definitions\n * @param title - Optional schema title\n * @returns JSON Schema\n *\n * @example\n * const schema = createObjectSchema({\n * pixelId: {\n * type: 'string',\n * required: true,\n * pattern: '^[0-9]+$',\n * description: 'Your Meta Pixel ID',\n * },\n * eventName: {\n * type: 'string',\n * enum: ['PageView', 'Purchase'],\n * },\n * }, 'Meta Pixel Settings');\n */\nexport function createObjectSchema(\n properties: Record<string, PropertyDef>,\n title?: string,\n): JSONSchema {\n const required: string[] = [];\n const schemaProperties: Record<string, unknown> = {};\n\n for (const [key, def] of Object.entries(properties)) {\n if (def.required) {\n required.push(key);\n }\n\n const property: Record<string, unknown> = {\n type: def.type,\n };\n\n if (def.description) property.description = def.description;\n if (def.pattern) property.pattern = def.pattern;\n if (def.minLength !== undefined) property.minLength = def.minLength;\n if (def.maxLength !== undefined) property.maxLength = def.maxLength;\n if (def.minimum !== undefined) property.minimum = def.minimum;\n if (def.maximum !== undefined) property.maximum = def.maximum;\n if (def.enum) property.enum = [...def.enum];\n if (def.default !== undefined) property.default = def.default;\n\n // Nested object\n if (def.type === 'object' && def.properties) {\n const props: Record<string, unknown> = {};\n for (const [nestedKey, nestedDef] of Object.entries(def.properties)) {\n props[nestedKey] = createPropertySchema(nestedDef);\n }\n property.properties = props;\n }\n\n // Array\n if (def.type === 'array' && def.items) {\n property.items = createPropertySchema(def.items);\n }\n\n schemaProperties[key] = property;\n }\n\n const schema: JSONSchema = {\n type: 'object',\n properties: schemaProperties,\n };\n\n if (title) schema.title = title;\n if (required.length > 0) schema.required = required;\n\n return schema;\n}\n\n/**\n * Create property schema from definition\n * Helper for nested properties\n */\nfunction createPropertySchema(def: PropertyDef): Record<string, unknown> {\n const property: Record<string, unknown> = {\n type: def.type,\n };\n\n if (def.description) property.description = def.description;\n if (def.pattern) property.pattern = def.pattern;\n if (def.minLength !== undefined) property.minLength = def.minLength;\n if (def.maxLength !== undefined) property.maxLength = def.maxLength;\n if (def.minimum !== undefined) property.minimum = def.minimum;\n if (def.maximum !== undefined) property.maximum = def.maximum;\n if (def.enum) property.enum = [...def.enum];\n if (def.default !== undefined) property.default = def.default;\n\n // Nested object\n if (def.type === 'object' && def.properties) {\n const props: Record<string, unknown> = {};\n for (const [key, nestedDef] of Object.entries(def.properties)) {\n props[key] = createPropertySchema(nestedDef);\n }\n property.properties = props;\n }\n\n // Array\n if (def.type === 'array' && def.items) {\n property.items = createPropertySchema(def.items);\n }\n\n return property;\n}\n\n/**\n * Create array schema\n *\n * @param itemDef - Definition for array items\n * @param options - Optional array constraints\n * @returns JSON Schema\n *\n * @example\n * // Simple string array\n * const tagsSchema = createArraySchema({ type: 'string' });\n *\n * // Tuple (loop pattern) - exactly 2 items\n * const loopSchema = createArraySchema(\n * { type: 'object' },\n * { minItems: 2, maxItems: 2 }\n * );\n *\n * // Array with enum\n * const includeSchema = createArraySchema({\n * type: 'string',\n * enum: ['data', 'context', 'globals'],\n * });\n */\nexport function createArraySchema(\n itemDef: PropertyDef,\n options?: {\n minItems?: number;\n maxItems?: number;\n description?: string;\n title?: string;\n },\n): JSONSchema {\n const schema: JSONSchema = {\n type: 'array',\n items: createPropertySchema(itemDef),\n };\n\n if (options?.minItems !== undefined) schema.minItems = options.minItems;\n if (options?.maxItems !== undefined) schema.maxItems = options.maxItems;\n if (options?.description) schema.description = options.description;\n if (options?.title) schema.title = options.title;\n\n return schema;\n}\n\n/**\n * Create enum schema\n *\n * @param values - Allowed values\n * @param type - Value type ('string' or 'number')\n * @param options - Optional constraints\n * @returns JSON Schema\n *\n * @example\n * const eventTypeSchema = createEnumSchema(\n * ['PageView', 'Purchase', 'AddToCart'],\n * 'string',\n * { description: 'Meta Pixel standard event' }\n * );\n */\nexport function createEnumSchema(\n values: readonly string[] | readonly number[],\n type: 'string' | 'number' = 'string',\n options?: {\n description?: string;\n title?: string;\n },\n): JSONSchema {\n const schema: JSONSchema = {\n type,\n enum: [...values],\n };\n\n if (options?.description) schema.description = options.description;\n if (options?.title) schema.title = options.title;\n\n return schema;\n}\n\n/**\n * Create tuple schema (Loop pattern)\n *\n * Creates an array schema with exactly 2 items, which the Explorer\n * type detector recognizes as a \"loop\" pattern.\n *\n * @param firstItem - Definition for first element (source)\n * @param secondItem - Definition for second element (transform)\n * @param description - Optional description\n * @returns JSON Schema with minItems=2, maxItems=2\n *\n * @example\n * const loopSchema = createTupleSchema(\n * { type: 'string' },\n * { type: 'object' },\n * 'Loop: [source, transform]'\n * );\n */\nexport function createTupleSchema(\n firstItem: PropertyDef,\n secondItem: PropertyDef,\n description?: string,\n): JSONSchema {\n return createArraySchema(\n { type: 'object' }, // Generic, items can be different\n {\n minItems: 2,\n maxItems: 2,\n description:\n description || 'Tuple with exactly 2 elements [source, transform]',\n },\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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QACA,OAA4B,UAC5B,SAIY;AACZ,QAAM,SAAqB;AAAA,IACzB;AAAA,IACA,MAAM,CAAC,GAAG,MAAM;AAAA,EAClB;AAEA,MAAI,SAAS,YAAa,QAAO,cAAc,QAAQ;AACvD,MAAI,SAAS,MAAO,QAAO,QAAQ,QAAQ;AAE3C,SAAO;AACT;AAoBO,SAAS,kBACd,WACA,YACA,aACY;AACZ,SAAO;AAAA,IACL,EAAE,MAAM,SAAS;AAAA;AAAA,IACjB;AAAA,MACE,UAAU;AAAA,MACV,UAAU;AAAA,MACV,aACE,eAAe;AAAA,IACnB;AAAA,EACF;AACF;;;AXtEO,SAAS,YAAY,QAAoC;AAC9D,SAAO,aAAE,aAAa,QAAQ;AAAA,IAC5B,QAAQ;AAAA,EACV,CAAC;AACH;","names":["ConfigSchema","configJsonSchema","ValueSchema","ValuesSchema","RulesSchema","PolicySchema","ConsentSchema","ConfigSchema","ResultSchema","configJsonSchema","ConfigSchema","ResultSchema","configJsonSchema","ConfigSchema","DestinationsSchema","InstanceSchema","PushContextSchema","configJsonSchema","instanceJsonSchema","pushContextJsonSchema","ConfigSchema","PushContextSchema","DestinationsSchema","InstanceSchema","configJsonSchema","pushContextJsonSchema","instanceJsonSchema","ConfigSchema","InitSchema","InstanceSchema","PartialConfigSchema","configJsonSchema","instanceJsonSchema","partialConfigJsonSchema","ConfigSchema","PartialConfigSchema","InstanceSchema","InitSchema","configJsonSchema","partialConfigJsonSchema","instanceJsonSchema","ConfigSchema","configJsonSchema","ConfigSchema","configJsonSchema"]}
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/validation.ts","../src/schemas/primitives.ts","../src/schemas/utilities.ts","../src/schemas/patterns.ts","../src/schemas/walkeros.ts","../src/schemas/mapping.ts","../src/schemas/destination.ts","../src/schemas/collector.ts","../src/schemas/source.ts","../src/schemas/flow.ts","../src/schemas/schema-builder.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport { z, zodToSchema, type JSONSchema } from './schemas';\n","/**\n * walkerOS Core Schemas\n *\n * Zod schemas for runtime validation and JSON Schema generation.\n * These schemas mirror TypeScript types in packages/core/src/types/\n * and are used for:\n * - Runtime validation at system boundaries (MCP tools, APIs, CLI)\n * - JSON Schema generation for Explorer UI (RJSF)\n * - Documentation and type metadata\n *\n * Note: TypeScript types remain the source of truth for development.\n * Schemas are for runtime validation and tooling support.\n *\n * Organization: Schema files mirror type files\n * - types/walkeros.ts → schemas/walkeros.ts\n * - types/mapping.ts → schemas/mapping.ts\n * - types/destination.ts → schemas/destination.ts\n * - types/collector.ts → schemas/collector.ts\n * - types/source.ts → schemas/source.ts\n * - types/flow.ts → schemas/flow.ts\n * - types/storage.ts + types/handler.ts → schemas/utilities.ts\n *\n * Import strategy:\n * Due to overlapping schema names across domains (ConfigSchema, InstanceSchema, etc.),\n * schemas are organized into namespaces. Import either:\n * 1. From namespaces: import { WalkerOSSchemas, MappingSchemas } from '@walkeros/core/dev'\n * 2. Direct from files: import { EventSchema } from '@walkeros/core/schemas/walkeros'\n */\n\n// ========================================\n// Primitives & Patterns (DRY building blocks)\n// ========================================\n\nexport * from './primitives';\nexport * from './patterns';\n\n// ========================================\n// Namespace Exports (prevents name collisions)\n// ========================================\n\nimport * as WalkerOSSchemas from './walkeros';\nimport * as MappingSchemas from './mapping';\nimport * as DestinationSchemas from './destination';\nimport * as CollectorSchemas from './collector';\nimport * as SourceSchemas from './source';\nimport * as FlowSchemas from './flow';\nimport * as UtilitySchemas from './utilities';\n\nexport {\n WalkerOSSchemas,\n MappingSchemas,\n DestinationSchemas,\n CollectorSchemas,\n SourceSchemas,\n FlowSchemas,\n UtilitySchemas,\n};\n\n// ========================================\n// Direct Exports (commonly used schemas)\n// ========================================\n\n// Export commonly used schemas from WalkerOS namespace directly\nexport {\n EventSchema,\n PartialEventSchema,\n DeepPartialEventSchema,\n PropertiesSchema,\n OrderedPropertiesSchema,\n UserSchema,\n EntitySchema,\n EntitiesSchema,\n ConsentSchema,\n SourceTypeSchema,\n VersionSchema,\n SourceSchema,\n PropertySchema,\n PropertyTypeSchema,\n // JSON Schemas\n eventJsonSchema,\n partialEventJsonSchema,\n userJsonSchema,\n propertiesJsonSchema,\n orderedPropertiesJsonSchema,\n entityJsonSchema,\n sourceTypeJsonSchema,\n consentJsonSchema,\n} from './walkeros';\n\n// Export commonly used schemas from Mapping namespace directly\nexport {\n ValueSchema,\n ValuesSchema,\n ValueConfigSchema,\n LoopSchema,\n SetSchema,\n MapSchema,\n PolicySchema,\n RuleSchema,\n RulesSchema,\n ResultSchema as MappingResultSchema, // Alias to avoid conflict with Destination.ResultSchema\n // JSON Schemas\n valueJsonSchema,\n valueConfigJsonSchema,\n loopJsonSchema,\n setJsonSchema,\n mapJsonSchema,\n policyJsonSchema,\n ruleJsonSchema,\n rulesJsonSchema,\n} from './mapping';\n\n// Export commonly used schemas from Flow namespace directly\nexport {\n SetupSchema,\n ConfigSchema as FlowConfigSchema, // Alias to avoid conflict with other ConfigSchema exports\n SourceReferenceSchema,\n DestinationReferenceSchema,\n PrimitiveSchema,\n parseSetup,\n safeParseSetup,\n parseConfig,\n safeParseConfig,\n // JSON Schemas\n setupJsonSchema,\n configJsonSchema,\n sourceReferenceJsonSchema,\n destinationReferenceJsonSchema,\n} from './flow';\n\n// ========================================\n// Schema Builder - DRY utility for destinations\n// ========================================\n\n/**\n * Schema Builder - DRY utility for destinations\n *\n * Destinations can use these utilities to create JSON Schemas WITHOUT\n * needing Zod as a dependency. The core package handles all schema logic.\n *\n * This follows the DRY principle - write once in core, use everywhere.\n */\nexport * from './schema-builder';\n\n// ========================================\n// Deprecated: value-config.ts\n// ========================================\n\n/**\n * @deprecated Import from MappingSchemas or directly from './mapping' instead\n *\n * The value-config.ts file has been migrated to mapping.ts for better organization.\n * This export is kept for backward compatibility but will be removed in a future version.\n *\n * Migration:\n * - Old: import { ValueSchema, ValueConfigSchema } from '@walkeros/core'\n * - New: import { ValueSchema, ValueConfigSchema } from '@walkeros/core'\n * (imports now come from mapping.ts but the API is identical)\n *\n * Breaking change: The value-config.ts file will be removed in the next major version.\n * All schemas are now organized by domain (mapping, destination, collector, etc.)\n */\n// Note: Schemas are already exported above from mapping.ts\n\n/**\n * Re-export Zod and zod-to-json-schema for destinations\n *\n * Destinations can import Zod from @walkeros/core instead of adding\n * their own dependency. This ensures version consistency and reduces\n * duplicate dependencies in the monorepo.\n *\n * Usage in destinations:\n * import { z, zodToSchema } from '@walkeros/core/dev';\n */\nexport { z } from './validation';\n\nimport type { zod } from './validation';\nimport { z } from './validation';\n\n/**\n * JSONSchema type for JSON Schema Draft 7 objects\n *\n * Represents a JSON Schema object as returned by Zod's toJSONSchema().\n * Uses Record<string, unknown> as JSON Schema structure is dynamic.\n */\nexport type JSONSchema = Record<string, unknown>;\n\n/**\n * Utility to convert Zod schema to JSON Schema with consistent defaults\n *\n * This wrapper ensures all destinations use the same JSON Schema configuration:\n * - target: 'draft-7' (JSON Schema Draft 7 format)\n *\n * Usage in destinations:\n * import { zodToSchema } from '@walkeros/core/dev';\n * export const settings = zodToSchema(SettingsSchema);\n *\n * @param schema - Zod schema to convert\n * @returns JSON Schema Draft 7 object\n */\nexport function zodToSchema(schema: zod.ZodTypeAny): JSONSchema {\n return z.toJSONSchema(schema, {\n target: 'draft-7',\n }) as JSONSchema;\n}\n","/**\n * Central validation module\n * Single source of truth for validation library access\n *\n * All schema files should import from this module instead of directly\n * from zod to ensure consistent usage and easy maintenance.\n */\n\nimport { z } from 'zod';\n\n// Re-export validation tools for schema files\nexport { z };\nexport type { z as zod } from 'zod';\n\n/**\n * Standard JSON Schema conversion with consistent project defaults\n *\n * Uses Zod 4 native toJSONSchema() method for JSON Schema generation.\n * All walkerOS schemas use JSON Schema Draft 7 format.\n *\n * @param schema - Zod schema to convert\n * @param _name - Schema name (ignored in Zod 4, kept for API compatibility)\n * @param target - JSON Schema target version (default: 'draft-7')\n * @returns JSON Schema object\n */\nexport function toJsonSchema(\n schema: z.ZodTypeAny,\n _name?: string,\n target: 'draft-7' | 'draft-2020-12' | 'openapi-3.0' = 'draft-7',\n) {\n return z.toJSONSchema(schema, {\n target,\n });\n}\n","import { z } from './validation';\n\n/**\n * Primitive Schema Definitions\n *\n * Reusable primitive schemas following DRY principle.\n * These are the building blocks used throughout all schemas to ensure consistency.\n *\n * Benefits:\n * - Single source of truth for common patterns\n * - Consistent descriptions across all schemas\n * - Easier maintenance and updates\n * - Better IntelliSense/autocomplete\n */\n\n// ========================================\n// Basic Primitives\n// ========================================\n\n/**\n * Required string field\n * Used for required text fields throughout schemas\n */\nexport const RequiredString = z.string();\n\n/**\n * Required number field\n * Used for required numeric fields throughout schemas\n */\nexport const RequiredNumber = z.number();\n\n/**\n * Required boolean field\n * Used for required flag fields throughout schemas\n */\nexport const RequiredBoolean = z.boolean();\n\n// ========================================\n// Semantic Primitives\n// ========================================\n\n/**\n * Identifier - Required unique string identifier\n * Used for entity IDs, session IDs, etc.\n */\nexport const Identifier = z.string().min(1);\n\n/**\n * Timestamp - Unix timestamp in milliseconds\n * Used for event timestamps, session timestamps, etc.\n */\nexport const Timestamp = z.number().int().positive();\n\n/**\n * Counter - Sequential counter (non-negative integer)\n * Used for event counts, session counts, etc.\n */\nexport const Counter = z.number().int().nonnegative();\n\n/**\n * TaggingVersion - Version number for event tagging\n * Standardized description used in both Version and Config schemas\n */\nexport const TaggingVersion = z.number().describe('Tagging version number');\n\n// ========================================\n// Primitive Value Unions\n// ========================================\n\n/**\n * PrimitiveValue - Basic primitive types\n * Union of string, number, and boolean\n * Used in Property definitions and value transformations\n */\nexport const PrimitiveValue = z.union([z.string(), z.number(), z.boolean()]);\n\n/**\n * OptionalPrimitiveValue - Optional primitive value\n */\nexport const OptionalPrimitiveValue = PrimitiveValue.optional();\n","import { z, toJsonSchema } from './validation';\n\n/**\n * Utility Schemas\n *\n * Mirrors: types/storage.ts, types/handler.ts, and other utility types\n * Purpose: Runtime validation and JSON Schema generation for utility types\n *\n * Small, standalone schemas for utility types used throughout walkerOS:\n * - Storage types\n * - Handler functions\n * - Error/log management\n */\n\n// ========================================\n// Storage Schemas\n// ========================================\n\n/**\n * StorageType - Storage mechanism identifier\n *\n * Standard storage types:\n * - local: localStorage (persistent)\n * - session: sessionStorage (session-scoped)\n * - cookie: document.cookie (configurable expiry)\n *\n * Used for session persistence and user tracking\n */\nexport const StorageTypeSchema = z\n .enum(['local', 'session', 'cookie'])\n .describe('Storage mechanism: local, session, or cookie');\n\n/**\n * Storage - Storage type constants\n * Provides const values for type-safe storage type references\n */\nexport const StorageSchema = z\n .object({\n Local: z.literal('local'),\n Session: z.literal('session'),\n Cookie: z.literal('cookie'),\n })\n .describe('Storage type constants for type-safe references');\n\n// ========================================\n// Handler Schemas\n// ========================================\n\n/**\n * Error - Error handler function type\n *\n * Signature: (error: unknown, state?: unknown) => void\n *\n * Called when errors occur during:\n * - Event processing\n * - Destination push operations\n * - Source event handling\n * - Mapping transformations\n *\n * Parameters:\n * - error: The error that occurred\n * - state: Optional state information for debugging\n *\n * Note: Function schemas use z.unknown() as functions aren't serializable\n */\nexport const ErrorHandlerSchema = z\n .any()\n .describe('Error handler function: (error, state?) => void');\n\n/**\n * Log - Log handler function type\n *\n * Signature: (message: string, verbose?: boolean) => void\n *\n * Called for logging during:\n * - Event processing\n * - Configuration updates\n * - Debugging (when verbose enabled)\n *\n * Parameters:\n * - message: Log message\n * - verbose: Whether this is a verbose-only log\n *\n * Note: Function schemas use z.unknown() as functions aren't serializable\n */\nexport const LogHandlerSchema = z\n .any()\n .describe('Log handler function: (message, verbose?) => void');\n\n/**\n * Handler - Combined handler interface\n * Groups Error and Log handlers\n */\nexport const HandlerSchema = z\n .object({\n Error: ErrorHandlerSchema.describe('Error handler function'),\n Log: LogHandlerSchema.describe('Log handler function'),\n })\n .describe('Handler interface with error and log functions');\n\n// ========================================\n// JSON Schema Exports (for Explorer/RJSF/MCP)\n// ========================================\n\nexport const storageTypeJsonSchema = toJsonSchema(\n StorageTypeSchema,\n 'StorageType',\n);\n\nexport const storageJsonSchema = toJsonSchema(StorageSchema, 'Storage');\n\nexport const errorHandlerJsonSchema = toJsonSchema(\n ErrorHandlerSchema,\n 'ErrorHandler',\n);\n\nexport const logHandlerJsonSchema = toJsonSchema(\n LogHandlerSchema,\n 'LogHandler',\n);\n\nexport const handlerJsonSchema = toJsonSchema(HandlerSchema, 'Handler');\n","import { z } from './validation';\nimport {} from './primitives';\nimport { ErrorHandlerSchema, LogHandlerSchema } from './utilities';\n\n/**\n * Common Schema Patterns\n *\n * Reusable schema patterns that appear across multiple domain schemas.\n * These patterns combine primitives into commonly used configurations.\n *\n * Benefits:\n * - DRY principle for complex patterns\n * - Consistent configuration interfaces\n * - Single source of truth for common configs\n * - Easier to maintain and update patterns globally\n */\n\n// ========================================\n// Handler Patterns\n// ========================================\n\n/**\n * HandlersConfig - Error and log handler configuration\n * Used in: Destination.Config, Collector.Config, Source.Config\n */\nexport const HandlersConfig = z\n .object({\n onError: ErrorHandlerSchema.optional().describe(\n 'Error handler function: (error, state?) => void',\n ),\n onLog: LogHandlerSchema.optional().describe(\n 'Log handler function: (message, verbose?) => void',\n ),\n })\n .partial();\n\n// ========================================\n// Configuration Patterns\n// ========================================\n\n/**\n * VerboseConfig - Verbose logging configuration\n * Used in: Destination.Config, Collector.Config\n */\nexport const VerboseConfig = z\n .object({\n verbose: z\n .boolean()\n .describe('Enable verbose logging for debugging')\n .optional(),\n })\n .partial();\n\n/**\n * QueueConfig - Event queueing configuration\n * Used in: Destination.Config\n */\nexport const QueueConfig = z\n .object({\n queue: z\n .boolean()\n .describe('Whether to queue events when consent is not granted')\n .optional(),\n })\n .partial();\n\n/**\n * IdConfig - ID configuration pattern\n * Used in: Destination.Config, Source.Config\n */\nexport const IdConfig = z.object({}).partial();\n\n/**\n * InitConfig - Initialization configuration pattern\n * Used in: Destination.Config\n */\nexport const InitConfig = z\n .object({\n init: z.boolean().describe('Whether to initialize immediately').optional(),\n loadScript: z\n .boolean()\n .describe('Whether to load external script (for web destinations)')\n .optional(),\n })\n .partial();\n\n/**\n * DisabledConfig - Disabled flag configuration\n * Used in: Source.Config\n */\nexport const DisabledConfig = z\n .object({\n disabled: z.boolean().describe('Set to true to disable').optional(),\n })\n .partial();\n\n/**\n * PrimaryConfig - Primary flag configuration\n * Used in: Source.Config, Source.InitSource\n */\nexport const PrimaryConfig = z\n .object({\n primary: z\n .boolean()\n .describe('Mark as primary (only one can be primary)')\n .optional(),\n })\n .partial();\n\n// ========================================\n// Generic Configuration Patterns\n// ========================================\n\n/**\n * GenericSettingsConfig - Generic settings configuration\n * Used in: Destination.Config, Source.Config, Collector runtime\n * Settings are implementation-specific and can't be validated generically\n */\nexport const GenericSettingsConfig = z\n .object({\n settings: z\n .any()\n .optional()\n .describe('Implementation-specific configuration'),\n })\n .partial();\n\n/**\n * GenericEnvConfig - Generic environment configuration\n * Used in: Destination.Config, Source.Config, Source.BaseEnv\n * Environment is platform-specific and can't be validated generically\n */\nexport const GenericEnvConfig = z\n .object({\n env: z\n .any()\n .optional()\n .describe('Environment dependencies (platform-specific)'),\n })\n .partial();\n\n// ========================================\n// Mapping Patterns\n// ========================================\n\n/**\n * DataTransformationConfig - Data transformation configuration\n * Used in: Destination.Config, Mapping.Config, Mapping.Rule\n *\n * Note: This creates a forward reference to ValueSchema/ValuesSchema\n * Import from mapping.ts to avoid circular dependencies\n */\nexport function createDataTransformationConfig(\n ValueSchema: z.ZodTypeAny,\n ValuesSchema: z.ZodTypeAny,\n) {\n return z\n .object({\n data: z\n .union([ValueSchema, ValuesSchema])\n .optional()\n .describe('Data transformation rules'),\n })\n .partial();\n}\n\n/**\n * MappingRulesConfig - Mapping rules configuration\n * Used in: Destination.Config, Source.Config (via Mapping.Config)\n *\n * Note: This creates a forward reference to RulesSchema\n * Import from mapping.ts to avoid circular dependencies\n */\nexport function createMappingRulesConfig(RulesSchema: z.ZodTypeAny) {\n return z\n .object({\n mapping: RulesSchema.optional().describe('Event mapping rules'),\n })\n .partial();\n}\n\n/**\n * PolicyConfig - Policy rules configuration\n * Used in: Destination.Config, Mapping.Config, Mapping.Rule\n *\n * Note: This creates a forward reference to PolicySchema\n * Import from mapping.ts to avoid circular dependencies\n */\nexport function createPolicyConfig(PolicySchema: z.ZodTypeAny) {\n return z\n .object({\n policy: PolicySchema.optional().describe('Pre-processing policy rules'),\n })\n .partial();\n}\n\n/**\n * ConsentConfig - Consent requirements configuration\n * Used in: Destination.Config, Mapping.Config, Mapping.Rule, Event\n *\n * Note: This creates a forward reference to ConsentSchema\n * Import from walkeros.ts to avoid circular dependencies\n */\nexport function createConsentConfig(ConsentSchema: z.ZodTypeAny) {\n return z\n .object({\n consent: ConsentSchema.optional().describe('Required consent states'),\n })\n .partial();\n}\n\n// ========================================\n// Instance Patterns\n// ========================================\n\n/**\n * RuntimeInstanceConfig - Runtime instance configuration\n * Used in: Destination.Instance, Source.Instance, Collector.Instance\n *\n * Common fields for runtime instances:\n * - type: Instance type identifier\n * - config: Configuration object\n * - Functions (push, init, etc.) are instance-specific\n */\nexport const RuntimeInstanceConfig = z\n .object({\n type: z.string().optional().describe('Instance type identifier'),\n config: z.unknown().describe('Instance configuration'),\n })\n .partial();\n\n// ========================================\n// Context Patterns\n// ========================================\n\n/**\n * BaseContextConfig - Base context configuration\n * Used in: Destination.Context, Source contexts\n *\n * Common fields for contexts:\n * - collector: Collector instance (runtime)\n * - config: Configuration\n * - env: Environment dependencies\n */\nexport const BaseContextConfig = z\n .object({\n collector: z.unknown().describe('Collector instance (runtime object)'),\n config: z.unknown().describe('Configuration'),\n env: z.unknown().describe('Environment dependencies'),\n })\n .partial();\n\n// ========================================\n// Batch Patterns\n// ========================================\n\n/**\n * BatchConfig - Batch processing configuration\n * Used in: Mapping.Rule\n */\nexport const BatchConfig = z\n .object({\n batch: z\n .number()\n .optional()\n .describe('Batch size: bundle N events for batch processing'),\n batched: z.unknown().optional().describe('Batch of events to be processed'),\n })\n .partial();\n\n// ========================================\n// Processing Patterns\n// ========================================\n\n/**\n * ProcessingControlConfig - Processing control flags\n * Used in: Mapping.Rule\n */\nexport const ProcessingControlConfig = z\n .object({\n ignore: z.boolean().describe('Set to true to skip processing').optional(),\n condition: z\n .string()\n .optional()\n .describe('Condition function: return true to process'),\n })\n .partial();\n\n// ========================================\n// Collection Patterns\n// ========================================\n\n/**\n * SourcesMapConfig - Sources collection pattern\n * Used in: Collector.Instance\n */\nexport const SourcesMapConfig = z\n .object({\n sources: z\n .record(z.string(), z.unknown())\n .describe('Map of source instances'),\n })\n .partial();\n\n/**\n * DestinationsMapConfig - Destinations collection pattern\n * Used in: Collector.Instance\n */\nexport const DestinationsMapConfig = z\n .object({\n destinations: z\n .record(z.string(), z.unknown())\n .describe('Map of destination instances'),\n })\n .partial();\n","import { z, toJsonSchema } from './validation';\nimport {\n RequiredString,\n RequiredNumber,\n Identifier,\n Timestamp,\n Counter,\n TaggingVersion,\n} from './primitives';\n\n/**\n * Core walkerOS Event Model Schemas\n *\n * Mirrors: types/walkeros.ts\n * Purpose: Runtime validation and JSON Schema generation for MCP tools, Explorer UI, and API boundaries\n *\n * These schemas provide:\n * 1. Runtime validation for event data\n * 2. JSON Schema generation for RJSF/Explorer\n * 3. Type documentation via .describe()\n * 4. Compile-time type checking (schemas mirror TypeScript types)\n *\n * Note: TypeScript types in types/walkeros.ts remain the source of truth for development.\n * These Zod schemas are for validation and JSON Schema generation at runtime boundaries.\n */\n\n// ========================================\n// Base Property Types (Recursive)\n// ========================================\n\n/**\n * PropertyType - Base property value types\n * Can be primitive (boolean, string, number) or nested object with Property values\n */\nexport const PropertyTypeSchema: z.ZodTypeAny = z.lazy(() =>\n z.union([\n z.boolean(),\n z.string(),\n z.number(),\n z.record(z.string(), PropertySchema),\n ]),\n);\n\n/**\n * Property - PropertyType or array of PropertyType\n * Recursive structure allows nested objects and arrays\n */\nexport const PropertySchema: z.ZodTypeAny = z.lazy(() =>\n z.union([PropertyTypeSchema, z.array(PropertyTypeSchema)]),\n);\n\n/**\n * Properties - Record of string keys to Property values\n * Used throughout event structure (data, globals, custom, etc.)\n */\nexport const PropertiesSchema = z\n .record(z.string(), PropertySchema.optional())\n .describe('Flexible property collection with optional values');\n\n/**\n * OrderedProperties - Record with [value, order] tuples\n * Used for context data where order matters\n */\nexport const OrderedPropertiesSchema = z\n .record(z.string(), z.tuple([PropertySchema, z.number()]).optional())\n .describe(\n 'Ordered properties with [value, order] tuples for priority control',\n );\n\n// ========================================\n// Enums & Union Types\n// ========================================\n\n/**\n * SourceType - Event source identifier\n * Standard types: web, server, app, other\n * Extensible: allows custom string values\n */\nexport const SourceTypeSchema = z\n .union([z.enum(['web', 'server', 'app', 'other']), z.string()])\n .describe('Source type: web, server, app, other, or custom');\n\n// ========================================\n// Event Sub-Types\n// ========================================\n\n/**\n * Consent - Consent state mapping\n * Maps consent group names to boolean states\n * Used in Event and Destination/Source configs\n */\nexport const ConsentSchema = z\n .record(z.string(), z.boolean())\n .describe('Consent requirement mapping (group name → state)');\n\n/**\n * User - User identification and attributes\n * Extends Properties with specific optional fields\n * Contains IDs, demographics, device info, and location data\n */\nexport const UserSchema = PropertiesSchema.and(\n z.object({\n // IDs\n id: z.string().optional().describe('User identifier'),\n device: z.string().optional().describe('Device identifier'),\n session: z.string().optional().describe('Session identifier'),\n hash: z.string().optional().describe('Hashed identifier'),\n // User attributes\n address: z.string().optional().describe('User address'),\n email: z.string().email().optional().describe('User email address'),\n phone: z.string().optional().describe('User phone number'),\n // Technical attributes\n userAgent: z.string().optional().describe('Browser user agent string'),\n browser: z.string().optional().describe('Browser name'),\n browserVersion: z.string().optional().describe('Browser version'),\n deviceType: z\n .string()\n .optional()\n .describe('Device type (mobile, desktop, tablet)'),\n os: z.string().optional().describe('Operating system'),\n osVersion: z.string().optional().describe('Operating system version'),\n screenSize: z.string().optional().describe('Screen dimensions'),\n // Location attributes\n language: z.string().optional().describe('User language'),\n country: z.string().optional().describe('User country'),\n region: z.string().optional().describe('User region/state'),\n city: z.string().optional().describe('User city'),\n zip: z.string().optional().describe('User postal code'),\n timezone: z.string().optional().describe('User timezone'),\n ip: z.string().optional().describe('User IP address'),\n // Flags\n internal: z\n .boolean()\n .optional()\n .describe('Internal user flag (employee, test user)'),\n }),\n).describe('User identification and properties');\n\n/**\n * Version - Walker version information\n * Tracks source implementation and tagging version\n */\nexport const VersionSchema = PropertiesSchema.and(\n z.object({\n source: RequiredString.describe(\n 'Walker implementation version (e.g., \"2.0.0\")',\n ),\n tagging: TaggingVersion,\n }),\n).describe('Walker version information');\n\n/**\n * Source - Event source information\n * Identifies where the event originated\n */\nexport const SourceSchema = PropertiesSchema.and(\n z.object({\n type: SourceTypeSchema.describe('Source type identifier'),\n id: RequiredString.describe('Source identifier (typically URL on web)'),\n previous_id: RequiredString.describe(\n 'Previous source identifier (typically referrer on web)',\n ),\n }),\n).describe('Event source information');\n\n/**\n * Entity - Nested entity structure\n * Allows events to contain related entities with their own data and context\n * Recursive: entities can contain nested entities\n */\nexport const EntitySchema: z.ZodTypeAny = z\n .lazy(() =>\n z.object({\n entity: z.string().describe('Entity name'),\n data: PropertiesSchema.describe('Entity-specific properties'),\n nested: z.array(EntitySchema).describe('Nested child entities'),\n context: OrderedPropertiesSchema.describe('Entity context data'),\n }),\n )\n .describe('Nested entity structure with recursive nesting support');\n\n/**\n * Entities - Array of Entity objects\n */\nexport const EntitiesSchema = z\n .array(EntitySchema)\n .describe('Array of nested entities');\n\n// ========================================\n// Main Event Schema\n// ========================================\n\n/**\n * Event - Complete walkerOS event structure\n *\n * Core fields:\n * - name: Event identifier in \"entity action\" format (e.g., \"page view\")\n * - data: Event-specific properties\n * - context: Ordered context properties\n * - globals: Global properties shared across events\n * - custom: Custom properties specific to implementation\n * - user: User identification and attributes\n * - nested: Related entities\n * - consent: Consent states at event time\n *\n * System-generated fields:\n * - id: Unique event identifier\n * - timestamp: Event creation time (milliseconds since epoch)\n * - entity: Parsed entity name from event.name\n * - action: Parsed action name from event.name\n * - trigger: Event trigger identifier\n * - timing: Event processing timing information\n * - group: Event grouping identifier\n * - count: Event count in session\n * - version: Walker version information\n * - source: Event source information\n */\nexport const EventSchema = z\n .object({\n // Core event identification\n name: z\n .string()\n .describe(\n 'Event name in \"entity action\" format (e.g., \"page view\", \"product add\")',\n ),\n\n // Event data\n data: PropertiesSchema.describe('Event-specific properties'),\n context: OrderedPropertiesSchema.describe(\n 'Ordered context properties with priorities',\n ),\n globals: PropertiesSchema.describe(\n 'Global properties shared across events',\n ),\n custom: PropertiesSchema.describe(\n 'Custom implementation-specific properties',\n ),\n\n // Related data\n user: UserSchema.describe('User identification and attributes'),\n nested: EntitiesSchema.describe('Related nested entities'),\n consent: ConsentSchema.describe('Consent states at event time'),\n\n // System-generated fields\n id: Identifier.describe('Unique event identifier (timestamp-based)'),\n trigger: RequiredString.describe('Event trigger identifier'),\n entity: RequiredString.describe('Parsed entity from event name'),\n action: RequiredString.describe('Parsed action from event name'),\n timestamp: Timestamp.describe('Unix timestamp in milliseconds since epoch'),\n timing: RequiredNumber.describe('Event processing timing information'),\n group: RequiredString.describe('Event grouping identifier'),\n count: Counter.describe('Event count in session'),\n\n // Version & source tracking\n version: VersionSchema.describe('Walker version information'),\n source: SourceSchema.describe('Event source information'),\n })\n .describe('Complete walkerOS event structure');\n\n/**\n * PartialEvent - Event with all fields optional\n * Used for event creation where not all fields are provided\n */\nexport const PartialEventSchema = EventSchema.partial().describe(\n 'Partial event structure with all fields optional',\n);\n\n/**\n * DeepPartialEvent - Event with all fields optional\n * Used for event updates and patches\n *\n * Note: While the TypeScript type uses DeepPartial<Event> for compile-time validation,\n * the Zod schema uses .partial() which makes top-level fields optional. This is\n * sufficient for runtime validation as deeply nested partial objects are rarely\n * provided (users typically omit entire objects rather than providing partial nested data).\n * Zod 4 deliberately removed .deepPartial() due to internal type complexity issues.\n */\nexport const DeepPartialEventSchema: z.ZodTypeAny =\n EventSchema.partial().describe(\n 'Partial event structure with all top-level fields optional',\n );\n\n// ========================================\n// JSON Schema Exports (for Explorer/RJSF/MCP)\n// ========================================\n\nexport const eventJsonSchema = toJsonSchema(EventSchema, 'Event');\n\nexport const partialEventJsonSchema = toJsonSchema(\n PartialEventSchema,\n 'PartialEvent',\n);\n\nexport const userJsonSchema = toJsonSchema(UserSchema, 'User');\n\nexport const propertiesJsonSchema = toJsonSchema(\n PropertiesSchema,\n 'Properties',\n);\n\nexport const orderedPropertiesJsonSchema = toJsonSchema(\n OrderedPropertiesSchema,\n 'OrderedProperties',\n);\n\nexport const entityJsonSchema = toJsonSchema(EntitySchema, 'Entity');\n\nexport const sourceTypeJsonSchema = toJsonSchema(\n SourceTypeSchema,\n 'SourceType',\n);\n\nexport const consentJsonSchema = toJsonSchema(ConsentSchema, 'Consent');\n","import { z, toJsonSchema } from './validation';\nimport { ConsentSchema } from './walkeros';\n\n/**\n * Mapping System Schemas\n *\n * Mirrors: types/mapping.ts\n * Purpose: Runtime validation and JSON Schema generation for event transformation rules\n *\n * The mapping system allows flexible transformation of events as they flow through\n * the collector to destinations. This includes:\n * - Value extraction and transformation\n * - Conditional logic\n * - Data mapping and restructuring\n * - Array processing (loops)\n * - Consent-based filtering\n *\n * Key Features:\n * - Recursive value definitions (Value → ValueConfig → Value)\n * - Loop vs Set distinction via JSON Schema (minItems/maxItems)\n * - Lazy evaluation for circular dependencies\n * - Function serialization support (functions as strings)\n */\n\n// ========================================\n// Recursive Value Schemas\n// ========================================\n\n// Forward declaration for circular dependency\nlet ValueConfigSchemaLazy: z.ZodTypeAny;\n\n/**\n * Value - Core value type for mapping transformations\n *\n * Can be:\n * - Primitive: string, number, boolean\n * - ValueConfig: Complex transformation object\n * - Array: Multiple values/configs\n *\n * Recursive structure allows nested transformations\n */\nexport const ValueSchema: z.ZodTypeAny = z.lazy(() =>\n z.union([\n z.string().describe('String value or property path (e.g., \"data.id\")'),\n z.number().describe('Numeric value'),\n z.boolean().describe('Boolean value'),\n z.lazy(() => ValueConfigSchemaLazy),\n z.array(ValueSchema).describe('Array of values'),\n ]),\n);\n\n/**\n * Values - Array of Value objects\n * Used for multiple data transformations\n */\nexport const ValuesSchema = z\n .array(ValueSchema)\n .describe('Array of transformation values');\n\n/**\n * Loop - Tuple for array processing\n * Format: [source, transform]\n *\n * IMPORTANT: z.tuple() generates JSON Schema with minItems/maxItems = 2\n * This is how Explorer distinguishes Loop from Set\n *\n * Example: ['nested', { map: { id: 'data.id' } }]\n * Means: Iterate over event.nested array, transform each item\n */\nconst LoopSchema: z.ZodTypeAny = z.lazy(() =>\n z\n .tuple([ValueSchema, ValueSchema])\n .describe(\n 'Loop transformation: [source, transform] tuple for array processing',\n ),\n);\n\n/**\n * Set - Array of values for selection/combination\n * Format: [value1, value2, ...]\n *\n * IMPORTANT: z.array() generates JSON Schema without minItems/maxItems\n * This distinguishes Set from Loop\n *\n * Example: ['data.firstName', ' ', 'data.lastName']\n * Means: Combine multiple values\n */\nconst SetSchema: z.ZodTypeAny = z.lazy(() =>\n z\n .array(ValueSchema)\n .describe('Set: Array of values for selection or combination'),\n);\n\n/**\n * Map - Object mapping for data transformation\n * Format: { outputKey: value, ... }\n *\n * Example: { item_id: 'data.id', item_name: 'data.name' }\n * Means: Transform event data to destination format\n */\nconst MapSchema: z.ZodTypeAny = z.lazy(() =>\n z\n .record(z.string(), ValueSchema)\n .describe('Map: Object mapping keys to transformation values'),\n);\n\n/**\n * ValueConfig - Configuration object for value transformations\n *\n * Supports multiple transformation strategies:\n * - key: Extract property from event (e.g., \"data.id\")\n * - value: Static primitive value\n * - fn: Custom transformation function (as string)\n * - map: Object mapping for structured output\n * - loop: Array iteration and transformation\n * - set: Value combination/selection\n * - consent: Consent-based filtering\n * - condition: Conditional transformation\n * - validate: Value validation\n *\n * At least one property must be present.\n */\nValueConfigSchemaLazy = z\n .object({\n key: z\n .string()\n .optional()\n .describe(\n 'Property path to extract from event (e.g., \"data.id\", \"user.email\")',\n ),\n value: z\n .union([z.string(), z.number(), z.boolean()])\n .optional()\n .describe('Static primitive value'),\n fn: z\n .string()\n .optional()\n .describe('Custom transformation function as string (serialized)'),\n map: MapSchema.optional().describe(\n 'Object mapping: transform event data to structured output',\n ),\n loop: LoopSchema.optional().describe(\n 'Loop transformation: [source, transform] for array processing',\n ),\n set: SetSchema.optional().describe(\n 'Set of values: combine or select from multiple values',\n ),\n consent: ConsentSchema.optional().describe(\n 'Required consent states to include this value',\n ),\n condition: z\n .string()\n .optional()\n .describe('Condition function as string: return true to include value'),\n validate: z\n .string()\n .optional()\n .describe('Validation function as string: return true if value is valid'),\n })\n .refine((data) => Object.keys(data).length > 0, {\n message: 'ValueConfig must have at least one property',\n })\n .describe('Value transformation configuration with multiple strategies');\n\n// Export with original name for backward compatibility\nexport const ValueConfigSchema = ValueConfigSchemaLazy;\n\n// Re-export for use in other schemas\nexport { LoopSchema, SetSchema, MapSchema };\n\n// ========================================\n// Policy Schema\n// ========================================\n\n/**\n * Policy - Pre-processing rules\n * Applied before event mapping\n * Maps policy keys to transformation values\n *\n * Example: { 'consent.marketing': true }\n * Means: Only process events with marketing consent\n */\nexport const PolicySchema = z\n .record(z.string(), ValueSchema)\n .describe('Policy rules for event pre-processing (key → value mapping)');\n\n// ========================================\n// Mapping Rule Schemas\n// ========================================\n\n/**\n * Rule - Event-specific mapping configuration\n *\n * Defines how to transform events for a specific entity-action combination\n * Can include:\n * - Batching configuration\n * - Conditional processing\n * - Consent requirements\n * - Custom settings\n * - Data transformation\n * - Event naming\n * - Policy overrides\n */\nexport const RuleSchema = z\n .object({\n batch: z\n .number()\n .optional()\n .describe('Batch size: bundle N events for batch processing'),\n // Note: batchFn and batched are runtime functions, not serializable\n condition: z\n .string()\n .optional()\n .describe('Condition function as string: return true to process event'),\n consent: ConsentSchema.optional().describe(\n 'Required consent states to process this event',\n ),\n settings: z\n .any()\n .optional()\n .describe('Destination-specific settings for this event mapping'),\n data: z\n .union([ValueSchema, ValuesSchema])\n .optional()\n .describe('Data transformation rules for event'),\n ignore: z\n .boolean()\n .optional()\n .describe('Set to true to skip processing this event'),\n name: z\n .string()\n .optional()\n .describe(\n 'Custom event name override (e.g., \"view_item\" for \"product view\")',\n ),\n policy: PolicySchema.optional().describe(\n 'Event-level policy overrides (applied after config-level policy)',\n ),\n })\n .describe('Mapping rule for specific entity-action combination');\n\n/**\n * Rules - Nested mapping rules structure\n * Format: { entity: { action: Rule | Rule[], ... }, ... }\n *\n * Supports:\n * - Specific entity-action mappings\n * - Wildcard patterns (entity: *, action: *)\n * - Multiple rules per entity-action (array)\n *\n * Example:\n * {\n * product: {\n * view: { name: 'view_item' },\n * add: { name: 'add_to_cart' }\n * },\n * page: {\n * '*': { name: 'page_interaction' }\n * }\n * }\n */\nexport const RulesSchema = z\n .record(\n z.string(),\n z.record(z.string(), z.union([RuleSchema, z.array(RuleSchema)])).optional(),\n )\n .describe(\n 'Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support',\n );\n\n/**\n * Config - Shared mapping configuration\n * Used by both Source.Config and Destination.Config\n *\n * Provides:\n * - Consent requirements\n * - Global data transformations\n * - Entity-action mapping rules\n * - Pre-processing policies\n */\nexport const ConfigSchema = z\n .object({\n consent: ConsentSchema.optional().describe(\n 'Required consent states to process any events',\n ),\n data: z\n .union([ValueSchema, ValuesSchema])\n .optional()\n .describe('Global data transformation applied to all events'),\n mapping: RulesSchema.optional().describe(\n 'Entity-action specific mapping rules',\n ),\n policy: PolicySchema.optional().describe(\n 'Pre-processing policy rules applied before mapping',\n ),\n })\n .describe('Shared mapping configuration for sources and destinations');\n\n/**\n * Result - Mapping resolution result\n * Contains the resolved mapping rule and key used\n */\nexport const ResultSchema = z\n .object({\n eventMapping: RuleSchema.optional().describe(\n 'Resolved mapping rule for event',\n ),\n mappingKey: z\n .string()\n .optional()\n .describe('Mapping key used (e.g., \"product.view\")'),\n })\n .describe('Mapping resolution result');\n\n// ========================================\n// JSON Schema Exports (for Explorer/RJSF/MCP)\n// ========================================\n\nexport const valueJsonSchema = toJsonSchema(ValueSchema, 'Value');\n\nexport const valueConfigJsonSchema = toJsonSchema(\n ValueConfigSchema,\n 'ValueConfig',\n);\n\nexport const loopJsonSchema = toJsonSchema(LoopSchema, 'Loop');\n\nexport const setJsonSchema = toJsonSchema(SetSchema, 'Set');\n\nexport const mapJsonSchema = toJsonSchema(MapSchema, 'Map');\n\nexport const policyJsonSchema = toJsonSchema(PolicySchema, 'Policy');\n\nexport const ruleJsonSchema = toJsonSchema(RuleSchema, 'Rule');\n\nexport const rulesJsonSchema = toJsonSchema(RulesSchema, 'Rules');\n\nexport const configJsonSchema = toJsonSchema(ConfigSchema, 'MappingConfig');\n","import { z, toJsonSchema } from './validation';\nimport { ConsentSchema, EventSchema } from './walkeros';\nimport {\n ValueSchema,\n ValuesSchema,\n RuleSchema,\n RulesSchema,\n PolicySchema,\n} from './mapping';\nimport { Identifier } from './primitives';\nimport { ErrorHandlerSchema, LogHandlerSchema } from './utilities';\n\n/**\n * Destination Schemas\n *\n * Mirrors: types/destination.ts\n * Purpose: Runtime validation and JSON Schema generation for destination configurations\n *\n * Destinations are the endpoints where processed events are sent (analytics tools,\n * marketing platforms, data warehouses, etc.). This file defines schemas for:\n * - Destination configuration\n * - Type bundles for generic constraints\n * - Push contexts\n * - Batching structures\n */\n\n// ========================================\n// Configuration Schemas\n// ========================================\n\n/**\n * Config - Destination configuration\n *\n * Defines how a destination processes events:\n * - Consent requirements\n * - Settings (destination-specific)\n * - Data transformations\n * - Environment dependencies\n * - Initialization options\n * - Mapping rules\n * - Processing policies\n * - Queueing behavior\n * - Logging verbosity\n * - Error/log handlers\n *\n * Generic note: settings, env, and mapping can have destination-specific types\n * but for schema validation we use z.unknown() to allow flexibility\n */\nexport const ConfigSchema = z\n .object({\n consent: ConsentSchema.optional().describe(\n 'Required consent states to send events to this destination',\n ),\n settings: z\n .any()\n .describe('Implementation-specific configuration')\n .optional(),\n data: z\n .union([ValueSchema, ValuesSchema])\n .optional()\n .describe(\n 'Global data transformation applied to all events for this destination',\n ),\n env: z\n .any()\n .describe('Environment dependencies (platform-specific)')\n .optional(),\n id: Identifier.describe(\n 'Destination instance identifier (defaults to destination key)',\n ).optional(),\n init: z.boolean().describe('Whether to initialize immediately').optional(),\n loadScript: z\n .boolean()\n .describe('Whether to load external script (for web destinations)')\n .optional(),\n mapping: RulesSchema.optional().describe(\n 'Entity-action specific mapping rules for this destination',\n ),\n policy: PolicySchema.optional().describe(\n 'Pre-processing policy rules applied before event mapping',\n ),\n queue: z\n .boolean()\n .describe('Whether to queue events when consent is not granted')\n .optional(),\n verbose: z\n .boolean()\n .describe('Enable verbose logging for debugging')\n .optional(),\n // Handler functions\n onError: ErrorHandlerSchema.optional(),\n onLog: LogHandlerSchema.optional(),\n })\n .describe('Destination configuration');\n\n/**\n * PartialConfig - Config with all fields optional\n * Used for config updates and overrides\n *\n * Note: All fields in ConfigSchema are already optional (.optional() on each field).\n * Using .partial() ensures the schema itself makes all fields optional at the type level.\n */\nexport const PartialConfigSchema = ConfigSchema.partial().describe(\n 'Partial destination configuration with all fields optional',\n);\n\n/**\n * Policy - Processing policy rules\n * Maps policy keys to transformation values\n * Applied before event mapping\n */\nexport const DestinationPolicySchema = PolicySchema.describe(\n 'Destination policy rules for event pre-processing',\n);\n\n// ========================================\n// Context Schemas\n// ========================================\n\n/**\n * Context - Base destination context\n * Passed to init and push functions\n * Contains collector instance, config, data, and environment\n *\n * Note: collector is runtime instance, not easily serializable\n */\nexport const ContextSchema = z\n .object({\n collector: z.unknown().describe('Collector instance (runtime object)'),\n config: ConfigSchema.describe('Destination configuration'),\n data: z\n .union([\n z.unknown(), // WalkerOS.Property\n z.array(z.unknown()),\n ])\n .optional()\n .describe('Transformed event data'),\n env: z.unknown().describe('Environment dependencies'),\n })\n .describe('Destination context for init and push functions');\n\n/**\n * PushContext - Context for push function\n * Extends Context with mapping rule information\n */\nexport const PushContextSchema = ContextSchema.extend({\n mapping: RuleSchema.optional().describe(\n 'Resolved mapping rule for this specific event',\n ),\n}).describe('Push context with event-specific mapping');\n\n/**\n * PushBatchContext - Context for pushBatch function\n * Same as PushContext but for batch processing\n */\nexport const PushBatchContextSchema = PushContextSchema.describe(\n 'Batch push context with event-specific mapping',\n);\n\n// ========================================\n// Batch Processing Schemas\n// ========================================\n\n/**\n * PushEvent - Single event with mapping in a batch\n */\nexport const PushEventSchema = z\n .object({\n event: EventSchema.describe('The event to process'),\n mapping: RuleSchema.optional().describe('Mapping rule for this event'),\n })\n .describe('Event with optional mapping for batch processing');\n\n/**\n * PushEvents - Array of PushEvent\n */\nexport const PushEventsSchema = z\n .array(PushEventSchema)\n .describe('Array of events with mappings');\n\n/**\n * Batch - Batched events for processing\n * Groups events by mapping key for efficient batch sends\n */\nexport const BatchSchema = z\n .object({\n key: z\n .string()\n .describe('Batch key (usually mapping key like \"product.view\")'),\n events: z.array(EventSchema).describe('Array of events in batch'),\n data: z\n .array(\n z\n .union([\n z.unknown(), // WalkerOS.Property\n z.array(z.unknown()),\n ])\n .optional(),\n )\n .describe('Transformed data for each event'),\n mapping: RuleSchema.optional().describe('Shared mapping rule for batch'),\n })\n .describe('Batch of events grouped by mapping key');\n\n/**\n * Data - Transformed event data types\n * Can be single property, undefined, or array of properties\n */\nexport const DataSchema = z\n .union([\n z.unknown(), // WalkerOS.Property\n z.array(z.unknown()),\n ])\n .optional()\n .describe('Transformed event data (Property, undefined, or array)');\n\n// ========================================\n// Instance Schemas\n// ========================================\n\n/**\n * Instance - Destination instance (runtime object)\n *\n * Note: This schema is primarily for documentation\n * Runtime functions (init, push, pushBatch) cannot be validated\n * Use z.unknown() for function fields\n */\nexport const InstanceSchema = z\n .object({\n config: ConfigSchema.describe('Destination configuration'),\n queue: z\n .array(EventSchema)\n .optional()\n .describe('Queued events awaiting consent'),\n dlq: z\n .array(z.tuple([EventSchema, z.unknown()]))\n .optional()\n .describe('Dead letter queue (failed events with errors)'),\n type: z.string().optional().describe('Destination type identifier'),\n env: z.unknown().optional().describe('Environment dependencies'),\n // Functions - not validated, use z.unknown()\n init: z.unknown().optional().describe('Initialization function'),\n push: z.unknown().describe('Push function for single events'),\n pushBatch: z.unknown().optional().describe('Batch push function'),\n on: z.unknown().optional().describe('Event lifecycle hook function'),\n })\n .describe('Destination instance (runtime object with functions)');\n\n/**\n * Init - Initialization config\n * Contains destination code and configuration\n */\nexport const InitSchema = z\n .object({\n code: InstanceSchema.describe('Destination instance with implementation'),\n config: PartialConfigSchema.optional().describe(\n 'Partial configuration overrides',\n ),\n env: z.unknown().optional().describe('Partial environment overrides'),\n })\n .describe('Destination initialization configuration');\n\n/**\n * InitDestinations - Map of destination IDs to Init configs\n */\nexport const InitDestinationsSchema = z\n .record(z.string(), InitSchema)\n .describe('Map of destination IDs to initialization configurations');\n\n/**\n * Destinations - Map of destination IDs to instances\n */\nexport const DestinationsSchema = z\n .record(z.string(), InstanceSchema)\n .describe('Map of destination IDs to runtime instances');\n\n// ========================================\n// Result Schemas\n// ========================================\n\n/**\n * Ref - Destination reference\n * Links destination ID to instance\n */\nexport const RefSchema = z\n .object({\n id: z.string().describe('Destination ID'),\n destination: InstanceSchema.describe('Destination instance'),\n })\n .describe('Destination reference (ID + instance)');\n\n/**\n * Push - Push operation result\n */\nexport const PushResultSchema = z\n .object({\n queue: z\n .array(EventSchema)\n .optional()\n .describe('Events queued (awaiting consent)'),\n error: z.unknown().optional().describe('Error if push failed'),\n })\n .describe('Push operation result');\n\n/**\n * Result - Overall processing result\n * Categorizes destinations by processing outcome\n */\nexport const ResultSchema = z\n .object({\n successful: z\n .array(RefSchema)\n .describe('Destinations that processed successfully'),\n queued: z.array(RefSchema).describe('Destinations that queued events'),\n failed: z.array(RefSchema).describe('Destinations that failed to process'),\n })\n .describe('Overall destination processing result');\n\n/**\n * DLQ - Dead Letter Queue\n * Array of failed events with their errors\n */\nexport const DLQSchema = z\n .array(z.tuple([EventSchema, z.unknown()]))\n .describe('Dead letter queue: [(event, error), ...]');\n\n// ========================================\n// JSON Schema Exports (for Explorer/RJSF/MCP)\n// ========================================\n\nexport const configJsonSchema = toJsonSchema(ConfigSchema, 'DestinationConfig');\n\nexport const partialConfigJsonSchema = toJsonSchema(\n PartialConfigSchema,\n 'PartialDestinationConfig',\n);\n\nexport const contextJsonSchema = toJsonSchema(\n ContextSchema,\n 'DestinationContext',\n);\n\nexport const pushContextJsonSchema = toJsonSchema(\n PushContextSchema,\n 'PushContext',\n);\n\nexport const batchJsonSchema = toJsonSchema(BatchSchema, 'Batch');\n\nexport const instanceJsonSchema = toJsonSchema(\n InstanceSchema,\n 'DestinationInstance',\n);\n\nexport const resultJsonSchema = toJsonSchema(ResultSchema, 'DestinationResult');\n","import { z, toJsonSchema } from './validation';\nimport {\n ConsentSchema,\n UserSchema,\n PropertiesSchema,\n EventSchema,\n} from './walkeros';\nimport { ConfigSchema as MappingConfigSchema } from './mapping';\nimport {\n RequiredBoolean,\n RequiredNumber,\n Identifier,\n Timestamp,\n Counter,\n TaggingVersion,\n} from './primitives';\nimport { ErrorHandlerSchema, LogHandlerSchema } from './utilities';\n\n/**\n * Collector Schemas\n *\n * Mirrors: types/collector.ts\n * Purpose: Runtime validation and JSON Schema generation for collector configurations\n *\n * The collector is the central event processing engine in walkerOS:\n * - Receives events from sources\n * - Processes events with consent and context\n * - Routes events to destinations\n * - Manages session state and globals\n * - Handles lifecycle hooks\n *\n * This file defines schemas for collector configuration, commands, and state management.\n */\n\n// ========================================\n// Command Type Schema\n// ========================================\n\n/**\n * CommandType - Walker command identifiers\n *\n * Standard commands:\n * - action: TODO - need documentation\n * - config: Update collector configuration\n * - consent: Update consent state\n * - context: TODO - need documentation\n * - destination: Add/update destination\n * - elb: TODO - need documentation\n * - globals: Update global properties\n * - hook: Register lifecycle hook\n * - init: Initialize collector\n * - link: TODO - need documentation\n * - run: Start/restart collector with state\n * - user: Update user data\n * - walker: TODO - need documentation\n *\n * Extensible: allows custom command strings\n */\nexport const CommandTypeSchema = z\n .union([\n z.enum([\n 'action',\n 'config',\n 'consent',\n 'context',\n 'destination',\n 'elb',\n 'globals',\n 'hook',\n 'init',\n 'link',\n 'run',\n 'user',\n 'walker',\n ]),\n z.string(), // Allow custom commands\n ])\n .describe(\n 'Collector command type: standard commands or custom string for extensions',\n );\n\n// ========================================\n// Configuration Schemas\n// ========================================\n\n/**\n * Config - Core collector configuration\n *\n * Controls collector behavior:\n * - run: Auto-run on initialization\n * - tagging: Version number for event tagging\n * - globalsStatic: Static globals (persist across runs)\n * - sessionStatic: Static session data (persist across runs)\n * - verbose: Enable verbose logging\n * - onError: Error handler\n * - onLog: Log handler\n */\nexport const ConfigSchema = z\n .object({\n run: z\n .boolean()\n .describe('Whether to run collector automatically on initialization')\n .optional(),\n tagging: TaggingVersion,\n globalsStatic: PropertiesSchema.describe(\n 'Static global properties that persist across collector runs',\n ),\n sessionStatic: z\n .record(z.string(), z.unknown())\n .describe('Static session data that persists across collector runs'),\n verbose: z.boolean().describe('Enable verbose logging for debugging'),\n // Function handlers\n onError: ErrorHandlerSchema.optional(),\n onLog: LogHandlerSchema.optional(),\n })\n .describe('Core collector configuration');\n\n/**\n * SessionData - Session state management\n *\n * Tracks session-level information:\n * - IDs and lifecycle\n * - Storage state\n * - Marketing tracking\n * - Timestamps\n * - Counters\n *\n * Extends Properties to allow custom session data\n */\nexport const SessionDataSchema = PropertiesSchema.and(\n z.object({\n isStart: z.boolean().describe('Whether this is a new session start'),\n storage: z.boolean().describe('Whether storage is available'),\n id: Identifier.describe('Session identifier').optional(),\n start: Timestamp.describe('Session start timestamp').optional(),\n marketing: z\n .literal(true)\n .optional()\n .describe('Marketing attribution flag'),\n updated: Timestamp.describe('Last update timestamp').optional(),\n isNew: z.boolean().describe('Whether this is a new session').optional(),\n device: Identifier.describe('Device identifier').optional(),\n count: Counter.describe('Event count in session').optional(),\n runs: Counter.describe('Number of runs').optional(),\n }),\n).describe('Session state and tracking data');\n\n/**\n * InitConfig - Initialization configuration\n *\n * Extends Config with initial state:\n * - Initial consent\n * - Initial user data\n * - Initial globals\n * - Source configurations\n * - Destination configurations\n * - Initial custom properties\n */\nexport const InitConfigSchema = ConfigSchema.partial()\n .extend({\n consent: ConsentSchema.optional().describe('Initial consent state'),\n user: UserSchema.optional().describe('Initial user data'),\n globals: PropertiesSchema.optional().describe('Initial global properties'),\n // Sources and destinations are complex runtime objects\n sources: z.unknown().optional().describe('Source configurations'),\n destinations: z.unknown().optional().describe('Destination configurations'),\n custom: PropertiesSchema.optional().describe(\n 'Initial custom implementation-specific properties',\n ),\n })\n .describe('Collector initialization configuration with initial state');\n\n// ========================================\n// Context Schemas\n// ========================================\n\n/**\n * PushContext - Context for collector.push\n *\n * Provides source-level mapping configuration\n * Applied before destination-specific mappings\n */\nexport const PushContextSchema = z\n .object({\n mapping: MappingConfigSchema.optional().describe(\n 'Source-level mapping configuration',\n ),\n })\n .describe('Push context with optional source mapping');\n\n// ========================================\n// Collection Schemas\n// ========================================\n\n/**\n * Sources - Map of source IDs to instances\n */\nexport const SourcesSchema = z\n .record(z.string(), z.unknown())\n .describe('Map of source IDs to source instances');\n\n/**\n * Destinations - Map of destination IDs to instances\n */\nexport const DestinationsSchema = z\n .record(z.string(), z.unknown())\n .describe('Map of destination IDs to destination instances');\n\n// ========================================\n// Instance Schema\n// ========================================\n\n/**\n * Instance - Collector instance (runtime object)\n *\n * The main collector interface with all state and methods\n *\n * State:\n * - config: Current configuration\n * - consent: Current consent state\n * - user: Current user data\n * - globals: Current global properties\n * - custom: Custom properties\n * - session: Session state\n * - sources: Registered sources\n * - destinations: Registered destinations\n * - hooks: Lifecycle hooks\n * - on: Event lifecycle config\n * - queue: Queued events\n *\n * Flags:\n * - allowed: Processing allowed\n * - count: Event count\n * - round: Collector run count\n * - timing: Processing timing\n * - group: Event grouping ID\n *\n * Methods (not validated):\n * - push: Process events\n * - command: Execute commands\n */\nexport const InstanceSchema = z\n .object({\n // Methods (functions - not validated)\n push: z.unknown().describe('Push function for processing events'),\n command: z.unknown().describe('Command function for walker commands'),\n // State\n allowed: z.boolean().describe('Whether event processing is allowed'),\n config: ConfigSchema.describe('Current collector configuration'),\n consent: ConsentSchema.describe('Current consent state'),\n count: z.number().describe('Event count (increments with each event)'),\n custom: PropertiesSchema.describe(\n 'Custom implementation-specific properties',\n ),\n sources: SourcesSchema.describe('Registered source instances'),\n destinations: DestinationsSchema.describe(\n 'Registered destination instances',\n ),\n globals: PropertiesSchema.describe('Current global properties'),\n group: z.string().describe('Event grouping identifier'),\n hooks: z.unknown().describe('Lifecycle hook functions'),\n on: z.unknown().describe('Event lifecycle configuration'),\n queue: z.array(EventSchema).describe('Queued events awaiting processing'),\n round: z\n .number()\n .describe('Collector run count (increments with each run)'),\n session: z.union([SessionDataSchema]).describe('Current session state'),\n timing: z.number().describe('Event processing timing information'),\n user: UserSchema.describe('Current user data'),\n version: z.string().describe('Walker implementation version'),\n })\n .describe('Collector instance with state and methods');\n\n// ========================================\n// JSON Schema Exports (for Explorer/RJSF/MCP)\n// ========================================\n\nexport const commandTypeJsonSchema = toJsonSchema(\n CommandTypeSchema,\n 'CommandType',\n);\n\nexport const configJsonSchema = toJsonSchema(ConfigSchema, 'CollectorConfig');\n\nexport const sessionDataJsonSchema = toJsonSchema(\n SessionDataSchema,\n 'SessionData',\n);\n\nexport const initConfigJsonSchema = toJsonSchema(\n InitConfigSchema,\n 'InitConfig',\n);\n\nexport const pushContextJsonSchema = toJsonSchema(\n PushContextSchema,\n 'CollectorPushContext',\n);\n\nexport const instanceJsonSchema = toJsonSchema(\n InstanceSchema,\n 'CollectorInstance',\n);\n","import { z, toJsonSchema } from './validation';\nimport { ConfigSchema as MappingConfigSchema } from './mapping';\nimport { Identifier } from './primitives';\nimport { ErrorHandlerSchema } from './utilities';\n\n/**\n * Source Schemas\n *\n * Mirrors: types/source.ts\n * Purpose: Runtime validation and JSON Schema generation for source configurations\n *\n * Sources are the entry points where events enter walkerOS:\n * - Browser sources (DOM events, dataLayer)\n * - Server sources (HTTP handlers, cloud functions)\n * - App sources (mobile, desktop)\n *\n * Sources are platform-agnostic through dependency injection via BaseEnv.\n * All platform-specific dependencies (DOM, HTTP, etc.) are provided through\n * the env object, making sources testable and portable.\n *\n * Key concept: Source.push IS the handler - no wrappers needed\n * Example: http('handler', source.push) for direct deployment\n */\n\n// ========================================\n// Environment Schema\n// ========================================\n\n/**\n * BaseEnv - Base environment interface for dependency injection\n *\n * Sources receive all dependencies through this environment object:\n * - push: Collector push function\n * - command: Collector command function\n * - sources: Other registered sources\n * - elb: Public API function (alias for collector.push)\n *\n * Platform-specific sources extend this with their requirements\n * (e.g., window, document, fetch, req, res)\n *\n * This makes sources:\n * - Platform-agnostic (no direct dependencies)\n * - Testable (mock env for tests)\n * - Composable (share env between sources)\n */\nexport const BaseEnvSchema = z\n .object({\n push: z.unknown().describe('Collector push function'),\n command: z.unknown().describe('Collector command function'),\n sources: z\n .unknown()\n .optional()\n .describe('Map of registered source instances'),\n elb: z.unknown().describe('Public API function (alias for collector.push)'),\n })\n .catchall(z.unknown())\n .describe(\n 'Base environment for dependency injection - platform-specific sources extend this',\n );\n\n// ========================================\n// Configuration Schema\n// ========================================\n\n/**\n * Config - Source configuration\n *\n * Extends Mapping.Config with source-specific options:\n * - consent: Required consent to process events\n * - data: Global data transformations\n * - mapping: Entity-action mapping rules\n * - policy: Pre-processing policies\n * - settings: Source-specific settings\n * - env: Environment dependencies\n * - id: Source identifier\n * - onError: Error handler\n * - disabled: Disable source\n * - primary: Primary source flag (only one can be primary)\n *\n * Generic note: settings, env, and mapping can have source-specific types\n */\nexport const ConfigSchema = MappingConfigSchema.extend({\n settings: z\n .any()\n .describe('Implementation-specific configuration')\n .optional(),\n env: BaseEnvSchema.optional().describe(\n 'Environment dependencies (platform-specific)',\n ),\n id: Identifier.describe(\n 'Source identifier (defaults to source key)',\n ).optional(),\n onError: ErrorHandlerSchema.optional(),\n disabled: z.boolean().describe('Set to true to disable').optional(),\n primary: z\n .boolean()\n .describe('Mark as primary (only one can be primary)')\n .optional(),\n}).describe('Source configuration with mapping and environment');\n\n/**\n * PartialConfig - Config with all fields optional\n * Used for config updates and overrides\n *\n * Note: ConfigSchema extends MappingConfigSchema with mostly optional fields.\n * Using .partial() ensures all fields are optional for config updates.\n */\nexport const PartialConfigSchema = ConfigSchema.partial().describe(\n 'Partial source configuration with all fields optional',\n);\n\n// ========================================\n// Instance Schema\n// ========================================\n\n/**\n * Instance - Source instance (runtime object)\n *\n * Contains:\n * - type: Source type identifier\n * - config: Current configuration\n * - push: Push function (THE HANDLER)\n * - destroy: Cleanup function\n * - on: Lifecycle hook function\n *\n * Key concept: push IS the handler\n * The push function signature is flexible to support different platforms:\n * - Browser: push(event, data) => Promise<void>\n * - HTTP: push(req, res) => Promise<void>\n * - Cloud: push(event, context) => Promise<void>\n *\n * This flexibility allows direct deployment without wrappers:\n * - http.createServer(source.push)\n * - functions.https.onRequest(source.push)\n * - addEventListener('click', source.push)\n */\nexport const InstanceSchema = z\n .object({\n type: z\n .string()\n .describe('Source type identifier (e.g., \"browser\", \"dataLayer\")'),\n config: ConfigSchema.describe('Current source configuration'),\n // Push function - flexible signature, not validated\n push: z\n .any()\n .describe(\n 'Push function - THE HANDLER (flexible signature for platform compatibility)',\n ),\n // Optional lifecycle methods\n destroy: z\n .any()\n .optional()\n .describe('Cleanup function called when source is removed'),\n on: z\n .unknown()\n .optional()\n .describe('Lifecycle hook function for event types'),\n })\n .describe('Source instance with push handler and lifecycle methods');\n\n// ========================================\n// Initialization Schemas\n// ========================================\n\n/**\n * Init - Source initialization function\n *\n * Factory function that creates a source instance:\n * (config, env) => Instance | Promise<Instance>\n *\n * Receives:\n * - config: Partial configuration\n * - env: Environment dependencies\n *\n * Returns:\n * - Source instance with push function\n *\n * The init function sets up the source (e.g., attach DOM listeners,\n * start HTTP server, subscribe to events) and returns the instance.\n */\nexport const InitSchema = z\n .any()\n .describe(\n 'Source initialization function: (config, env) => Instance | Promise<Instance>',\n );\n\n/**\n * InitSource - Initialization configuration\n *\n * Contains:\n * - code: Init function\n * - config: Partial config overrides\n * - env: Partial env overrides\n * - primary: Primary source flag\n */\nexport const InitSourceSchema = z\n .object({\n code: InitSchema.describe('Source initialization function'),\n config: PartialConfigSchema.optional().describe(\n 'Partial configuration overrides',\n ),\n env: BaseEnvSchema.partial()\n .optional()\n .describe('Partial environment overrides'),\n primary: z\n .boolean()\n .optional()\n .describe('Mark as primary source (only one can be primary)'),\n })\n .describe('Source initialization configuration');\n\n/**\n * InitSources - Map of source IDs to init configs\n */\nexport const InitSourcesSchema = z\n .record(z.string(), InitSourceSchema)\n .describe('Map of source IDs to initialization configurations');\n\n// ========================================\n// JSON Schema Exports (for Explorer/RJSF/MCP)\n// ========================================\n\nexport const baseEnvJsonSchema = toJsonSchema(BaseEnvSchema, 'SourceBaseEnv');\n\nexport const configJsonSchema = toJsonSchema(ConfigSchema, 'SourceConfig');\n\nexport const partialConfigJsonSchema = toJsonSchema(\n PartialConfigSchema,\n 'PartialSourceConfig',\n);\n\nexport const instanceJsonSchema = toJsonSchema(\n InstanceSchema,\n 'SourceInstance',\n);\n\nexport const initSourceJsonSchema = toJsonSchema(\n InitSourceSchema,\n 'InitSource',\n);\n\nexport const initSourcesJsonSchema = toJsonSchema(\n InitSourcesSchema,\n 'InitSources',\n);\n","/**\n * Flow Configuration System - Zod Schemas\n *\n * Mirrors: types/flow.ts\n * Purpose: Runtime validation and JSON Schema generation for Flow configurations\n *\n * The Flow system provides unified configuration across all walkerOS flows.\n * These schemas enable:\n * - Runtime validation of config files\n * - Clear error messages for configuration issues\n * - JSON Schema generation for IDE support\n * - Type-safe parsing with Zod\n *\n * @packageDocumentation\n */\n\nimport { z, toJsonSchema } from './validation';\n\n// ========================================\n// Primitive Type Schemas\n// ========================================\n\n/**\n * Primitive value schema for variables.\n *\n * @remarks\n * Variables can be strings, numbers, or booleans.\n * Used in Setup.variables and Config.env.\n */\nexport const PrimitiveSchema = z\n .union([z.string(), z.number(), z.boolean()])\n .describe('Primitive value: string, number, or boolean');\n\n// ========================================\n// Shared Type Schemas\n// ========================================\n\n/**\n * Variables schema for interpolation.\n */\nexport const VariablesSchema = z\n .record(z.string(), PrimitiveSchema)\n .describe('Variables for interpolation');\n\n/**\n * Definitions schema for reusable configurations.\n */\nexport const DefinitionsSchema = z\n .record(z.string(), z.unknown())\n .describe('Reusable configuration definitions');\n\n/**\n * Packages schema for build configuration.\n */\nexport const PackagesSchema = z\n .record(\n z.string(),\n z.object({\n version: z.string().optional(),\n imports: z.array(z.string()).optional(),\n path: z.string().optional(), // Local path (takes precedence over version)\n }),\n )\n .describe('NPM packages to bundle');\n\n// ========================================\n// Platform Configuration Schemas\n// ========================================\n\n/**\n * Web platform configuration schema.\n */\nexport const WebSchema = z\n .object({\n windowCollector: z\n .string()\n .optional()\n .describe(\n 'Window property name for collector instance (default: \"collector\")',\n ),\n windowElb: z\n .string()\n .optional()\n .describe('Window property name for elb function (default: \"elb\")'),\n })\n .describe('Web platform configuration');\n\n/**\n * Server platform configuration schema.\n */\nexport const ServerSchema = z\n .object({})\n .passthrough()\n .describe('Server platform configuration (reserved for future options)');\n\n// ========================================\n// Source Reference Schema\n// ========================================\n\n/**\n * Source reference schema.\n *\n * @remarks\n * Defines how to reference and configure a source package.\n * Sources capture events from various origins (browser, HTTP, etc.).\n */\nexport const SourceReferenceSchema = z\n .object({\n package: z\n .string()\n .min(1, 'Package name cannot be empty')\n .describe(\n 'Package specifier with optional version (e.g., \"@walkeros/web-source-browser@2.0.0\")',\n ),\n code: z\n .string()\n .optional()\n .describe(\n 'Named export to use from the package (e.g., \"sourceExpress\"). If omitted, uses default export.',\n ),\n config: z\n .unknown()\n .optional()\n .describe('Source-specific configuration object'),\n env: z.unknown().optional().describe('Source environment configuration'),\n primary: z\n .boolean()\n .optional()\n .describe(\n 'Mark as primary source (provides main elb). Only one source should be primary.',\n ),\n variables: VariablesSchema.optional().describe(\n 'Source-level variables (highest priority in cascade)',\n ),\n definitions: DefinitionsSchema.optional().describe(\n 'Source-level definitions (highest priority in cascade)',\n ),\n })\n .describe('Source package reference with configuration');\n\n// ========================================\n// Destination Reference Schema\n// ========================================\n\n/**\n * Destination reference schema.\n *\n * @remarks\n * Defines how to reference and configure a destination package.\n * Destinations send processed events to external services.\n */\nexport const DestinationReferenceSchema = z\n .object({\n package: z\n .string()\n .min(1, 'Package name cannot be empty')\n .describe(\n 'Package specifier with optional version (e.g., \"@walkeros/web-destination-gtag@2.0.0\")',\n ),\n code: z\n .string()\n .optional()\n .describe(\n 'Named export to use from the package (e.g., \"destinationAnalytics\"). If omitted, uses default export.',\n ),\n config: z\n .unknown()\n .optional()\n .describe('Destination-specific configuration object'),\n env: z\n .unknown()\n .optional()\n .describe('Destination environment configuration'),\n variables: VariablesSchema.optional().describe(\n 'Destination-level variables (highest priority in cascade)',\n ),\n definitions: DefinitionsSchema.optional().describe(\n 'Destination-level definitions (highest priority in cascade)',\n ),\n })\n .describe('Destination package reference with configuration');\n\n// ========================================\n// Flow Configuration Schema (Single Flow)\n// ========================================\n\n/**\n * Single flow configuration schema.\n *\n * @remarks\n * Represents a single deployment target (e.g., web_prod, server_stage).\n * Platform is determined by presence of `web` or `server` key.\n * Exactly one must be present.\n */\nexport const ConfigSchema = z\n .object({\n web: WebSchema.optional().describe(\n 'Web platform configuration (browser-based tracking). Mutually exclusive with server.',\n ),\n server: ServerSchema.optional().describe(\n 'Server platform configuration (Node.js). Mutually exclusive with web.',\n ),\n sources: z\n .record(z.string(), SourceReferenceSchema)\n .optional()\n .describe(\n 'Source configurations (data capture) keyed by unique identifier',\n ),\n destinations: z\n .record(z.string(), DestinationReferenceSchema)\n .optional()\n .describe(\n 'Destination configurations (data output) keyed by unique identifier',\n ),\n collector: z\n .unknown()\n .optional()\n .describe(\n 'Collector configuration for event processing (uses Collector.InitConfig)',\n ),\n packages: PackagesSchema.optional().describe('NPM packages to bundle'),\n variables: VariablesSchema.optional().describe(\n 'Flow-level variables (override Setup.variables, overridden by source/destination variables)',\n ),\n definitions: DefinitionsSchema.optional().describe(\n 'Flow-level definitions (extend Setup.definitions, overridden by source/destination definitions)',\n ),\n })\n .refine(\n (data) => {\n const hasWeb = data.web !== undefined;\n const hasServer = data.server !== undefined;\n return (hasWeb || hasServer) && !(hasWeb && hasServer);\n },\n {\n message: 'Exactly one of \"web\" or \"server\" must be present',\n },\n )\n .describe('Single flow configuration for one deployment target');\n\n// ========================================\n// Flow Setup Schema (Root Configuration)\n// ========================================\n\n/**\n * Flow setup schema - root configuration.\n *\n * @remarks\n * This is the complete schema for walkeros.config.json files.\n * Contains multiple named flows with shared variables and definitions.\n */\nexport const SetupSchema = z\n .object({\n version: z\n .literal(1, {\n error: 'Only version 1 is currently supported',\n })\n .describe('Configuration schema version (currently only 1 is supported)'),\n $schema: z\n .string()\n .url('Schema URL must be a valid URL')\n .optional()\n .describe(\n 'JSON Schema reference for IDE validation (e.g., \"https://walkeros.io/schema/flow/v1.json\")',\n ),\n variables: VariablesSchema.optional().describe(\n 'Shared variables for interpolation across all flows (use ${VAR_NAME} or ${VAR_NAME:default} syntax)',\n ),\n definitions: DefinitionsSchema.optional().describe(\n 'Reusable configuration definitions (reference with JSON Schema $ref syntax: { \"$ref\": \"#/definitions/name\" })',\n ),\n flows: z\n .record(z.string(), ConfigSchema)\n .refine((flows) => Object.keys(flows).length > 0, {\n message: 'At least one flow is required',\n })\n .describe(\n 'Named flow configurations (e.g., production, staging, development)',\n ),\n })\n .describe(\n 'Complete multi-flow walkerOS configuration (walkeros.config.json)',\n );\n\n// ========================================\n// Helper Functions\n// ========================================\n\n/**\n * Parse and validate Flow.Setup configuration.\n *\n * @param data - Raw JSON data from config file\n * @returns Validated Flow.Setup object\n * @throws ZodError if validation fails with detailed error messages\n *\n * @example\n * ```typescript\n * import { parseSetup } from '@walkeros/core/dev';\n * import { readFileSync } from 'fs';\n *\n * const raw = JSON.parse(readFileSync('walkeros.config.json', 'utf8'));\n * const config = parseSetup(raw);\n * console.log(`Found ${Object.keys(config.flows).length} flows`);\n * ```\n */\nexport function parseSetup(data: unknown): z.infer<typeof SetupSchema> {\n return SetupSchema.parse(data);\n}\n\n/**\n * Safely parse Flow.Setup configuration without throwing.\n *\n * @param data - Raw JSON data from config file\n * @returns Success result with data or error result with issues\n *\n * @example\n * ```typescript\n * import { safeParseSetup } from '@walkeros/core/dev';\n *\n * const result = safeParseSetup(rawData);\n * if (result.success) {\n * console.log('Valid config:', result.data);\n * } else {\n * console.error('Validation errors:', result.error.issues);\n * }\n * ```\n */\nexport function safeParseSetup(data: unknown) {\n return SetupSchema.safeParse(data);\n}\n\n/**\n * Parse and validate Flow.Config (single flow).\n *\n * @param data - Raw JSON data for single flow\n * @returns Validated Flow.Config object\n * @throws ZodError if validation fails\n *\n * @example\n * ```typescript\n * import { parseConfig } from '@walkeros/core/dev';\n *\n * const flowConfig = parseConfig(rawFlowData);\n * console.log(`Platform: ${flowConfig.web ? 'web' : 'server'}`);\n * ```\n */\nexport function parseConfig(data: unknown): z.infer<typeof ConfigSchema> {\n return ConfigSchema.parse(data);\n}\n\n/**\n * Safely parse Flow.Config without throwing.\n *\n * @param data - Raw JSON data for single flow\n * @returns Success result with data or error result with issues\n */\nexport function safeParseConfig(data: unknown) {\n return ConfigSchema.safeParse(data);\n}\n\n// ========================================\n// JSON Schema Generation\n// ========================================\n\n/**\n * Generate JSON Schema for Flow.Setup.\n *\n * @remarks\n * Used for IDE validation and autocomplete.\n * Hosted at https://walkeros.io/schema/flow/v1.json\n *\n * @returns JSON Schema (Draft 7) representation of SetupSchema\n *\n * @example\n * ```typescript\n * import { setupJsonSchema } from '@walkeros/core/dev';\n * import { writeFileSync } from 'fs';\n *\n * writeFileSync(\n * 'public/schema/flow/v1.json',\n * JSON.stringify(setupJsonSchema, null, 2)\n * );\n * ```\n */\nexport const setupJsonSchema = z.toJSONSchema(SetupSchema, {\n target: 'draft-7',\n});\n\n/**\n * Generate JSON Schema for Flow.Config.\n *\n * @remarks\n * Used for validating individual flow configurations.\n *\n * @returns JSON Schema (Draft 7) representation of ConfigSchema\n */\nexport const configJsonSchema = toJsonSchema(ConfigSchema, 'FlowConfig');\n\n/**\n * Generate JSON Schema for SourceReference.\n *\n * @remarks\n * Used for validating source package references.\n *\n * @returns JSON Schema (Draft 7) representation of SourceReferenceSchema\n */\nexport const sourceReferenceJsonSchema = toJsonSchema(\n SourceReferenceSchema,\n 'SourceReference',\n);\n\n/**\n * Generate JSON Schema for DestinationReference.\n *\n * @remarks\n * Used for validating destination package references.\n *\n * @returns JSON Schema (Draft 7) representation of DestinationReferenceSchema\n */\nexport const destinationReferenceJsonSchema = toJsonSchema(\n DestinationReferenceSchema,\n 'DestinationReference',\n);\n","/**\n * JSON Schema type\n */\nexport type JSONSchema = Record<string, unknown>;\n\n/**\n * Schema Builder - DRY utility for creating JSON Schemas\n *\n * This utility allows destinations to define schemas using simple objects,\n * without needing Zod as a dependency. The core package handles conversion.\n *\n * Benefits:\n * - Single source of schema generation logic\n * - No Zod dependency in destination packages\n * - Simple, declarative schema definitions\n * - Type-safe with TypeScript\n * - Follows DRY principle\n *\n * @example\n * // In destination package (NO Zod needed!)\n * import { createObjectSchema, createArraySchema } from '@walkeros/core/dev';\n *\n * export const settingsSchema = createObjectSchema({\n * pixelId: {\n * type: 'string',\n * required: true,\n * pattern: '^[0-9]+$',\n * description: 'Your Meta Pixel ID',\n * },\n * });\n */\n\n/**\n * Property definition for schema builder\n */\nexport interface PropertyDef {\n type: 'string' | 'number' | 'boolean' | 'object' | 'array';\n required?: boolean;\n description?: string;\n pattern?: string;\n minLength?: number;\n maxLength?: number;\n minimum?: number;\n maximum?: number;\n enum?: readonly string[] | readonly number[];\n properties?: Record<string, PropertyDef>;\n items?: PropertyDef;\n default?: unknown;\n}\n\n/**\n * Create object schema from property definitions\n *\n * @param properties - Property definitions\n * @param title - Optional schema title\n * @returns JSON Schema\n *\n * @example\n * const schema = createObjectSchema({\n * pixelId: {\n * type: 'string',\n * required: true,\n * pattern: '^[0-9]+$',\n * description: 'Your Meta Pixel ID',\n * },\n * eventName: {\n * type: 'string',\n * enum: ['PageView', 'Purchase'],\n * },\n * }, 'Meta Pixel Settings');\n */\nexport function createObjectSchema(\n properties: Record<string, PropertyDef>,\n title?: string,\n): JSONSchema {\n const required: string[] = [];\n const schemaProperties: Record<string, unknown> = {};\n\n for (const [key, def] of Object.entries(properties)) {\n if (def.required) {\n required.push(key);\n }\n\n const property: Record<string, unknown> = {\n type: def.type,\n };\n\n if (def.description) property.description = def.description;\n if (def.pattern) property.pattern = def.pattern;\n if (def.minLength !== undefined) property.minLength = def.minLength;\n if (def.maxLength !== undefined) property.maxLength = def.maxLength;\n if (def.minimum !== undefined) property.minimum = def.minimum;\n if (def.maximum !== undefined) property.maximum = def.maximum;\n if (def.enum) property.enum = [...def.enum];\n if (def.default !== undefined) property.default = def.default;\n\n // Nested object\n if (def.type === 'object' && def.properties) {\n const props: Record<string, unknown> = {};\n for (const [nestedKey, nestedDef] of Object.entries(def.properties)) {\n props[nestedKey] = createPropertySchema(nestedDef);\n }\n property.properties = props;\n }\n\n // Array\n if (def.type === 'array' && def.items) {\n property.items = createPropertySchema(def.items);\n }\n\n schemaProperties[key] = property;\n }\n\n const schema: JSONSchema = {\n type: 'object',\n properties: schemaProperties,\n };\n\n if (title) schema.title = title;\n if (required.length > 0) schema.required = required;\n\n return schema;\n}\n\n/**\n * Create property schema from definition\n * Helper for nested properties\n */\nfunction createPropertySchema(def: PropertyDef): Record<string, unknown> {\n const property: Record<string, unknown> = {\n type: def.type,\n };\n\n if (def.description) property.description = def.description;\n if (def.pattern) property.pattern = def.pattern;\n if (def.minLength !== undefined) property.minLength = def.minLength;\n if (def.maxLength !== undefined) property.maxLength = def.maxLength;\n if (def.minimum !== undefined) property.minimum = def.minimum;\n if (def.maximum !== undefined) property.maximum = def.maximum;\n if (def.enum) property.enum = [...def.enum];\n if (def.default !== undefined) property.default = def.default;\n\n // Nested object\n if (def.type === 'object' && def.properties) {\n const props: Record<string, unknown> = {};\n for (const [key, nestedDef] of Object.entries(def.properties)) {\n props[key] = createPropertySchema(nestedDef);\n }\n property.properties = props;\n }\n\n // Array\n if (def.type === 'array' && def.items) {\n property.items = createPropertySchema(def.items);\n }\n\n return property;\n}\n\n/**\n * Create array schema\n *\n * @param itemDef - Definition for array items\n * @param options - Optional array constraints\n * @returns JSON Schema\n *\n * @example\n * // Simple string array\n * const tagsSchema = createArraySchema({ type: 'string' });\n *\n * // Tuple (loop pattern) - exactly 2 items\n * const loopSchema = createArraySchema(\n * { type: 'object' },\n * { minItems: 2, maxItems: 2 }\n * );\n *\n * // Array with enum\n * const includeSchema = createArraySchema({\n * type: 'string',\n * enum: ['data', 'context', 'globals'],\n * });\n */\nexport function createArraySchema(\n itemDef: PropertyDef,\n options?: {\n minItems?: number;\n maxItems?: number;\n description?: string;\n title?: string;\n },\n): JSONSchema {\n const schema: JSONSchema = {\n type: 'array',\n items: createPropertySchema(itemDef),\n };\n\n if (options?.minItems !== undefined) schema.minItems = options.minItems;\n if (options?.maxItems !== undefined) schema.maxItems = options.maxItems;\n if (options?.description) schema.description = options.description;\n if (options?.title) schema.title = options.title;\n\n return schema;\n}\n\n/**\n * Create enum schema\n *\n * @param values - Allowed values\n * @param type - Value type ('string' or 'number')\n * @param options - Optional constraints\n * @returns JSON Schema\n *\n * @example\n * const eventTypeSchema = createEnumSchema(\n * ['PageView', 'Purchase', 'AddToCart'],\n * 'string',\n * { description: 'Meta Pixel standard event' }\n * );\n */\nexport function createEnumSchema(\n values: readonly string[] | readonly number[],\n type: 'string' | 'number' = 'string',\n options?: {\n description?: string;\n title?: string;\n },\n): JSONSchema {\n const schema: JSONSchema = {\n type,\n enum: [...values],\n };\n\n if (options?.description) schema.description = options.description;\n if (options?.title) schema.title = options.title;\n\n return schema;\n}\n\n/**\n * Create tuple schema (Loop pattern)\n *\n * Creates an array schema with exactly 2 items, which the Explorer\n * type detector recognizes as a \"loop\" pattern.\n *\n * @param firstItem - Definition for first element (source)\n * @param secondItem - Definition for second element (transform)\n * @param description - Optional description\n * @returns JSON Schema with minItems=2, maxItems=2\n *\n * @example\n * const loopSchema = createTupleSchema(\n * { type: 'string' },\n * { type: 'object' },\n * 'Loop: [source, transform]'\n * );\n */\nexport function createTupleSchema(\n firstItem: PropertyDef,\n secondItem: PropertyDef,\n description?: string,\n): JSONSchema {\n return createArraySchema(\n { type: 'object' }, // Generic, items can be different\n {\n minItems: 2,\n maxItems: 2,\n description:\n description || 'Tuple with exactly 2 elements [source, transform]',\n },\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACQA,iBAAkB;AAiBX,SAAS,aACd,QACA,OACA,SAAsD,WACtD;AACA,SAAO,aAAE,aAAa,QAAQ;AAAA,IAC5B;AAAA,EACF,CAAC;AACH;;;ACVO,IAAM,iBAAiB,aAAE,OAAO;AAMhC,IAAM,iBAAiB,aAAE,OAAO;AAMhC,IAAM,kBAAkB,aAAE,QAAQ;AAUlC,IAAM,aAAa,aAAE,OAAO,EAAE,IAAI,CAAC;AAMnC,IAAM,YAAY,aAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAM5C,IAAM,UAAU,aAAE,OAAO,EAAE,IAAI,EAAE,YAAY;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,QAAiC,CAAC;AACxC,eAAW,CAAC,KAAK,SAAS,KAAK,OAAO,QAAQ,IAAI,UAAU,GAAG;AAC7D,YAAM,GAAG,IAAI,qBAAqB,SAAS;AAAA,IAC7C;AACA,aAAS,aAAa;AAAA,EACxB;AAGA,MAAI,IAAI,SAAS,WAAW,IAAI,OAAO;AACrC,aAAS,QAAQ,qBAAqB,IAAI,KAAK;AAAA,EACjD;AAEA,SAAO;AACT;AAyBO,SAAS,kBACd,SACA,SAMY;AACZ,QAAM,SAAqB;AAAA,IACzB,MAAM;AAAA,IACN,OAAO,qBAAqB,OAAO;AAAA,EACrC;AAEA,MAAI,SAAS,aAAa,OAAW,QAAO,WAAW,QAAQ;AAC/D,MAAI,SAAS,aAAa,OAAW,QAAO,WAAW,QAAQ;AAC/D,MAAI,SAAS,YAAa,QAAO,cAAc,QAAQ;AACvD,MAAI,SAAS,MAAO,QAAO,QAAQ,QAAQ;AAE3C,SAAO;AACT;AAiBO,SAAS,iBACd,QACA,OAA4B,UAC5B,SAIY;AACZ,QAAM,SAAqB;AAAA,IACzB;AAAA,IACA,MAAM,CAAC,GAAG,MAAM;AAAA,EAClB;AAEA,MAAI,SAAS,YAAa,QAAO,cAAc,QAAQ;AACvD,MAAI,SAAS,MAAO,QAAO,QAAQ,QAAQ;AAE3C,SAAO;AACT;AAoBO,SAAS,kBACd,WACA,YACA,aACY;AACZ,SAAO;AAAA,IACL,EAAE,MAAM,SAAS;AAAA;AAAA,IACjB;AAAA,MACE,UAAU;AAAA,MACV,UAAU;AAAA,MACV,aACE,eAAe;AAAA,IACnB;AAAA,EACF;AACF;;;AXtEO,SAAS,YAAY,QAAoC;AAC9D,SAAO,aAAE,aAAa,QAAQ;AAAA,IAC5B,QAAQ;AAAA,EACV,CAAC;AACH;","names":["ConfigSchema","configJsonSchema","ValueSchema","ValuesSchema","RulesSchema","PolicySchema","ConsentSchema","ConfigSchema","ResultSchema","configJsonSchema","ConfigSchema","ResultSchema","configJsonSchema","ConfigSchema","DestinationsSchema","InstanceSchema","PushContextSchema","configJsonSchema","instanceJsonSchema","pushContextJsonSchema","ConfigSchema","PushContextSchema","DestinationsSchema","InstanceSchema","configJsonSchema","pushContextJsonSchema","instanceJsonSchema","ConfigSchema","InitSchema","InstanceSchema","PartialConfigSchema","configJsonSchema","instanceJsonSchema","partialConfigJsonSchema","ConfigSchema","PartialConfigSchema","InstanceSchema","InitSchema","configJsonSchema","partialConfigJsonSchema","instanceJsonSchema","ConfigSchema","configJsonSchema","ConfigSchema","configJsonSchema"]}
|