@walkeros/server-source-fetch 4.0.0-next-1773967844643 → 4.0.0-next-1777463920154

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dev.d.mts CHANGED
@@ -100,16 +100,15 @@ declare const EventSchema: z.ZodObject<{
100
100
  action: z.ZodOptional<z.ZodString>;
101
101
  timestamp: z.ZodOptional<z.ZodNumber>;
102
102
  timing: z.ZodOptional<z.ZodNumber>;
103
- group: z.ZodOptional<z.ZodString>;
104
- count: z.ZodOptional<z.ZodNumber>;
105
- version: z.ZodOptional<z.ZodObject<{
106
- source: z.ZodString;
107
- tagging: z.ZodNumber;
108
- }, z.core.$strip>>;
109
103
  source: z.ZodOptional<z.ZodObject<{
110
104
  type: z.ZodString;
111
- id: z.ZodString;
112
- previous_id: z.ZodString;
105
+ platform: z.ZodOptional<z.ZodString>;
106
+ version: z.ZodOptional<z.ZodString>;
107
+ schema: z.ZodOptional<z.ZodString>;
108
+ count: z.ZodOptional<z.ZodNumber>;
109
+ trace: z.ZodOptional<z.ZodString>;
110
+ url: z.ZodOptional<z.ZodString>;
111
+ referrer: z.ZodOptional<z.ZodString>;
113
112
  }, z.core.$loose>>;
114
113
  }, z.core.$loose>;
115
114
  type ValidatedEvent = z.infer<typeof EventSchema>;
package/dist/dev.d.ts CHANGED
@@ -100,16 +100,15 @@ declare const EventSchema: z.ZodObject<{
100
100
  action: z.ZodOptional<z.ZodString>;
101
101
  timestamp: z.ZodOptional<z.ZodNumber>;
102
102
  timing: z.ZodOptional<z.ZodNumber>;
103
- group: z.ZodOptional<z.ZodString>;
104
- count: z.ZodOptional<z.ZodNumber>;
105
- version: z.ZodOptional<z.ZodObject<{
106
- source: z.ZodString;
107
- tagging: z.ZodNumber;
108
- }, z.core.$strip>>;
109
103
  source: z.ZodOptional<z.ZodObject<{
110
104
  type: z.ZodString;
111
- id: z.ZodString;
112
- previous_id: z.ZodString;
105
+ platform: z.ZodOptional<z.ZodString>;
106
+ version: z.ZodOptional<z.ZodString>;
107
+ schema: z.ZodOptional<z.ZodString>;
108
+ count: z.ZodOptional<z.ZodNumber>;
109
+ trace: z.ZodOptional<z.ZodString>;
110
+ url: z.ZodOptional<z.ZodString>;
111
+ referrer: z.ZodOptional<z.ZodString>;
113
112
  }, z.core.$loose>>;
114
113
  }, z.core.$loose>;
115
114
  type ValidatedEvent = z.infer<typeof EventSchema>;
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,i=(e,o)=>{for(var a in o)t(e,a,{get:o[a],enumerable:!0})},r={};i(r,{examples:()=>j,schemas:()=>s}),module.exports=(e=r,((e,i,r,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let l of a(i))n.call(e,l)||l===r||t(e,l,{get:()=>i[l],enumerable:!(s=o(i,l))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};i(s,{CorsOptionsSchema:()=>m,CorsOrigin:()=>u,EventSchema:()=>x,HttpMethod:()=>d,RouteConfigSchema:()=>h,RouteMethod:()=>g,SettingsSchema:()=>z,settings:()=>P});var l=require("@walkeros/core/dev"),c=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),d=p.z.enum(["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"]),u=p.z.union([p.z.string(),p.z.array(p.z.string()),p.z.literal("*")]),m=p.z.object({origin:u.optional(),methods:p.z.array(d).optional(),headers:p.z.array(p.z.string()).optional(),credentials:p.z.boolean().optional(),maxAge:p.z.number().int().positive().optional()}),g=p.z.enum(["GET","POST"]),h=p.z.object({path:p.z.string().describe("URL path pattern (supports wildcards like /api/*)"),methods:p.z.array(g).min(1).describe("HTTP methods to accept. OPTIONS always included for CORS.").optional()}),z=c.z.object({path:c.z.string().describe("Deprecated: use paths instead").optional(),paths:c.z.array(c.z.union([c.z.string(),h])).min(1).describe("Route paths to handle. String shorthand accepts GET+POST. RouteConfig allows per-route method control.").optional(),cors:c.z.union([c.z.boolean(),m]).describe("CORS configuration: false = disabled, true = allow all (default), object = custom").default(!0),maxRequestSize:c.z.number().int().positive().describe("Maximum request body size in bytes").default(102400),maxBatchSize:c.z.number().int().positive().describe("Maximum events per batch request").default(100)}),b=require("@walkeros/core/dev"),y=b.z.record(b.z.string(),b.z.union([b.z.string(),b.z.number(),b.z.boolean(),b.z.record(b.z.string(),b.z.any())])),v=b.z.record(b.z.string(),b.z.tuple([b.z.union([b.z.string(),b.z.number(),b.z.boolean(),b.z.record(b.z.string(),b.z.any())]),b.z.number()])),w=b.z.object({id:b.z.string().optional(),device:b.z.string().optional(),session:b.z.string().optional(),email:b.z.string().optional(),hash:b.z.string().optional()}).passthrough(),O=b.z.record(b.z.string(),b.z.boolean()),f=b.z.lazy(()=>b.z.object({entity:b.z.string(),data:y.optional(),nested:b.z.array(f).optional(),context:v.optional()}).passthrough()),T=b.z.object({source:b.z.string(),tagging:b.z.number()}),S=b.z.object({type:b.z.string(),id:b.z.string(),previous_id:b.z.string()}).passthrough(),x=b.z.object({name:b.z.string().min(1,"Event name is required"),data:y.optional(),context:v.optional(),globals:y.optional(),custom:y.optional(),user:w.optional(),nested:b.z.array(f).optional(),consent:O.optional(),id:b.z.string().optional(),trigger:b.z.string().optional(),entity:b.z.string().optional(),action:b.z.string().optional(),timestamp:b.z.number().optional(),timing:b.z.number().optional(),group:b.z.string().optional(),count:b.z.number().optional(),version:T.optional(),source:S.optional()}).passthrough(),P=(0,l.zodToSchema)(z),j={};i(j,{createTrigger:()=>K,inputs:()=>q,requests:()=>D,step:()=>L});var q={};i(q,{batch:()=>H,completeEvent:()=>k,minimal:()=>C,pageView:()=>E,productAdd:()=>R});var E={name:"page view",data:{title:"Home Page",path:"/",referrer:"https://google.com"},user:{id:"user-123",session:"session-456"},timestamp:17e11},R={name:"product add",data:{id:"P-123",name:"Laptop",price:999.99,quantity:1},context:{stage:["shopping",1]},globals:{language:"en",currency:"USD"},user:{id:"user-123"},nested:[{entity:"category",data:{name:"Electronics",path:"/electronics"}}],consent:{functional:!0,marketing:!0}},k={name:"order complete",data:{id:"ORDER-123",total:999.99,currency:"USD"},context:{stage:["checkout",3],test:["variant-A",0]},globals:{language:"en",country:"US"},custom:{campaignId:"summer-sale",source:"email"},user:{id:"user-123",email:"user@example.com",session:"session-456"},nested:[{entity:"product",data:{id:"P-123",price:999.99}}],consent:{functional:!0,marketing:!0,analytics:!1},trigger:"click",group:"ecommerce"},C={name:"ping"},H=[E,R,{name:"button click",data:{id:"cta"}}],D={};i(D,{batchPostRequest:()=>N,healthCheckRequest:()=>J,invalidJsonRequest:()=>U,optionsRequest:()=>M,oversizedRequest:()=>I,pixelGetRequest:()=>A,validPostRequest:()=>G});var G={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"page view",data:{title:"Home"}})},N={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({batch:[{name:"page view",data:{title:"Home"}},{name:"button click",data:{id:"cta"}}]})},A={method:"GET",url:"https://example.com/collect?event=page%20view&data[title]=Home&user[id]=user123"},J={method:"GET",url:"https://example.com/health"},M={method:"OPTIONS",url:"https://example.com/collect",headers:{Origin:"https://example.com"}},U={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:"invalid json{"},I={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"test",data:{payload:"x".repeat(2e5)}})},L={};i(L,{batchRequest:()=>B,pixelGet:()=>F,postEvent:()=>_});var _={trigger:{type:"POST"},in:{method:"POST",url:"http://localhost/collect",body:{name:"page view",data:{title:"Docs",url:"https://example.com/docs"}}},out:{name:"page view",data:{title:"Docs",url:"https://example.com/docs"},entity:"page",action:"view"}},B={trigger:{type:"POST"},in:{method:"POST",url:"http://localhost/collect",body:{batch:[{name:"page view",data:{title:"Home"}},{name:"button click",data:{id:"cta"}}]}},out:{name:"page view",data:{title:"Home"},entity:"page",action:"view"}},F={trigger:{type:"GET"},in:{method:"GET",url:"http://localhost/collect?e=page+view&d=%7B%22title%22%3A%22Home%22%7D"},out:{name:"page view",data:{title:"Home"},entity:"page",action:"view"}},V=require("@walkeros/collector");var K=async e=>{let t;return{get flow(){return t},trigger:()=>async o=>{if(!t){const o=await(0,V.startFlow)(e);t={collector:o.collector,elb:o.elb}}const a=function(e){for(const t of Object.values(e.sources||{}))if("fetch"===t.type)return t}(t.collector);if(!a)throw new Error("Fetch source not found in collector");const n={method:o.method,headers:{"Content-Type":"application/json",...o.headers}};"GET"!==o.method&&void 0!==o.body&&(n.body=JSON.stringify(o.body));const i=new Request(o.url,n),r=await a.push(i),s={};r.headers.forEach((e,t)=>{s[t]=e});const l=(r.headers.get("content-type")||"").includes("json")?await r.json():await r.text();return{status:r.status,body:l,headers:s}}}};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,r=(e,o)=>{for(var a in o)t(e,a,{get:o[a],enumerable:!0})},i={};r(i,{examples:()=>x,schemas:()=>s}),module.exports=(e=i,((e,r,i,s)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let l of a(r))n.call(e,l)||l===i||t(e,l,{get:()=>r[l],enumerable:!(s=o(r,l))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};r(s,{CorsOptionsSchema:()=>m,CorsOrigin:()=>u,EventSchema:()=>S,HttpMethod:()=>d,RouteConfigSchema:()=>g,RouteMethod:()=>h,SettingsSchema:()=>z,settings:()=>P});var l=require("@walkeros/core/dev"),c=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),d=p.z.enum(["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"]),u=p.z.union([p.z.string(),p.z.array(p.z.string()),p.z.literal("*")]),m=p.z.object({origin:u.optional(),methods:p.z.array(d).optional(),headers:p.z.array(p.z.string()).optional(),credentials:p.z.boolean().optional(),maxAge:p.z.number().int().positive().optional()}),h=p.z.enum(["GET","POST"]),g=p.z.object({path:p.z.string().describe("URL path pattern (supports wildcards like /api/*)"),methods:p.z.array(h).min(1).describe("HTTP methods to accept. OPTIONS always included for CORS.").optional()}),z=c.z.object({path:c.z.string().describe("Deprecated: use paths instead").optional(),paths:c.z.array(c.z.union([c.z.string(),g])).min(1).describe("Route paths to handle. String shorthand accepts GET+POST. RouteConfig allows per-route method control.").optional(),cors:c.z.union([c.z.boolean(),m]).describe("CORS configuration: false = disabled, true = allow all (default), object = custom").default(!0),maxRequestSize:c.z.number().int().positive().describe("Maximum request body size in bytes").default(102400),maxBatchSize:c.z.number().int().positive().describe("Maximum events per batch request").default(100)}),b=require("@walkeros/core/dev"),y=b.z.record(b.z.string(),b.z.union([b.z.string(),b.z.number(),b.z.boolean(),b.z.record(b.z.string(),b.z.any())])),v=b.z.record(b.z.string(),b.z.tuple([b.z.union([b.z.string(),b.z.number(),b.z.boolean(),b.z.record(b.z.string(),b.z.any())]),b.z.number()])),f=b.z.object({id:b.z.string().optional(),device:b.z.string().optional(),session:b.z.string().optional(),email:b.z.string().optional(),hash:b.z.string().optional()}).passthrough(),O=b.z.record(b.z.string(),b.z.boolean()),T=b.z.lazy(()=>b.z.object({entity:b.z.string(),data:y.optional(),nested:b.z.array(T).optional(),context:v.optional()}).passthrough()),w=b.z.object({type:b.z.string(),platform:b.z.string().optional(),version:b.z.string().optional(),schema:b.z.string().optional(),count:b.z.number().optional(),trace:b.z.string().optional(),url:b.z.string().optional(),referrer:b.z.string().optional()}).passthrough(),S=b.z.object({name:b.z.string().min(1,"Event name is required"),data:y.optional(),context:v.optional(),globals:y.optional(),custom:y.optional(),user:f.optional(),nested:b.z.array(T).optional(),consent:O.optional(),id:b.z.string().optional(),trigger:b.z.string().optional(),entity:b.z.string().optional(),action:b.z.string().optional(),timestamp:b.z.number().optional(),timing:b.z.number().optional(),source:w.optional()}).passthrough(),P=(0,l.zodToSchema)(z),x={};r(x,{createTrigger:()=>V,inputs:()=>j,requests:()=>G,step:()=>I});var j={};r(j,{batch:()=>C,completeEvent:()=>R,minimal:()=>k,pageView:()=>q,productAdd:()=>E});var q={name:"page view",data:{title:"Home Page",path:"/",referrer:"https://google.com"},user:{id:"user-123",session:"session-456"},timestamp:17e11},E={name:"product add",data:{id:"P-123",name:"Laptop",price:999.99,quantity:1},context:{stage:["shopping",1]},globals:{language:"en",currency:"USD"},user:{id:"user-123"},nested:[{entity:"category",data:{name:"Electronics",path:"/electronics"}}],consent:{functional:!0,marketing:!0}},R={name:"order complete",data:{id:"ORDER-123",total:999.99,currency:"USD"},context:{stage:["checkout",3],test:["variant-A",0]},globals:{language:"en",country:"US"},custom:{campaignId:"summer-sale",source:"email"},user:{id:"user-123",email:"user@example.com",session:"session-456"},nested:[{entity:"product",data:{id:"P-123",price:999.99}}],consent:{functional:!0,marketing:!0,analytics:!1},trigger:"click"},k={name:"ping"},C=[q,E,{name:"button click",data:{id:"cta"}}],G={};r(G,{batchPostRequest:()=>D,healthCheckRequest:()=>N,invalidJsonRequest:()=>U,optionsRequest:()=>J,oversizedRequest:()=>M,pixelGetRequest:()=>A,validPostRequest:()=>H});var H={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"page view",data:{title:"Home"}})},D={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({batch:[{name:"page view",data:{title:"Home"}},{name:"button click",data:{id:"cta"}}]})},A={method:"GET",url:"https://example.com/collect?event=page%20view&data[title]=Home&user[id]=user123"},N={method:"GET",url:"https://example.com/health"},J={method:"OPTIONS",url:"https://example.com/collect",headers:{Origin:"https://example.com"}},U={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:"invalid json{"},M={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"test",data:{payload:"x".repeat(2e5)}})},I={};r(I,{batchRequest:()=>B,pixelGet:()=>F,postEvent:()=>L});var L={title:"POST event",description:"A fetch POST request with a JSON body becomes a single walker elb event in a fetch-based server.",trigger:{type:"POST"},in:{method:"POST",url:"http://localhost/collect",body:{name:"page view",data:{title:"Docs",url:"https://example.com/docs"}}},out:[["elb",{name:"page view",data:{title:"Docs",url:"https://example.com/docs"}}]]},B={title:"Batch POST",description:"A fetch POST with a batch array produces one walker elb event per batched item preserving order.",trigger:{type:"POST"},in:{method:"POST",url:"http://localhost/collect",body:{batch:[{name:"page view",data:{title:"Home"}},{name:"button click",data:{id:"cta"}}]}},out:[["elb",{name:"page view",data:{title:"Home"}}],["elb",{name:"button click",data:{id:"cta"}}]]},F={title:"Pixel GET",description:"A fetch GET with query parameters in the URL is parsed into an elb event payload for pixel-style tracking.",trigger:{type:"GET"},in:{method:"GET",url:"http://localhost/collect?e=page+view&d=%7B%22title%22%3A%22Home%22%7D"},out:[["elb",{e:"page view",d:'{"title":"Home"}'}]]},_=require("@walkeros/collector");var V=async e=>{let t;return{get flow(){return t},trigger:()=>async o=>{if(!t){const o=await(0,_.startFlow)(e);t={collector:o.collector,elb:o.elb}}const a=function(e){for(const t of Object.values(e.sources||{}))if("fetch"===t.type)return t}(t.collector);if(!a)throw new Error("Fetch source not found in collector");const n={method:o.method,headers:{"Content-Type":"application/json",...o.headers}};"GET"!==o.method&&void 0!==o.body&&(n.body=JSON.stringify(o.body));const r=new Request(o.url,n),i=await a.push(r),s={};i.headers.forEach((e,t)=>{s[t]=e});const l=(i.headers.get("content-type")||"").includes("json")?await i.json():await i.text();return{status:i.status,body:l,headers:s}}}};//# sourceMappingURL=dev.js.map
package/dist/dev.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.ts","../src/schemas/event.ts","../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/requests.ts","../src/examples/step.ts","../src/examples/trigger.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport * from './primitives';\nexport { SettingsSchema, type Settings } from './settings';\nexport * from './event';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\nimport { CorsOptionsSchema, RouteConfigSchema } from './primitives';\n\n/**\n * Fetch source settings schema.\n */\nexport const SettingsSchema = z.object({\n /** @deprecated Use `paths` instead */\n path: z.string().describe('Deprecated: use paths instead').optional(),\n\n paths: z\n .array(z.union([z.string(), RouteConfigSchema]))\n .min(1)\n .describe(\n 'Route paths to handle. String shorthand accepts GET+POST. RouteConfig allows per-route method control.',\n )\n .optional(),\n\n cors: z\n .union([z.boolean(), CorsOptionsSchema])\n .describe(\n 'CORS configuration: false = disabled, true = allow all (default), object = custom',\n )\n .default(true),\n\n maxRequestSize: z\n .number()\n .int()\n .positive()\n .describe('Maximum request body size in bytes')\n .default(1024 * 100), // 100KB\n\n maxBatchSize: z\n .number()\n .int()\n .positive()\n .describe('Maximum events per batch request')\n .default(100),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const HttpMethod = z.enum([\n 'GET',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'OPTIONS',\n 'HEAD',\n]);\n\nexport const CorsOrigin = z.union([\n z.string(),\n z.array(z.string()),\n z.literal('*'),\n]);\n\nexport const CorsOptionsSchema = z.object({\n origin: CorsOrigin.optional(),\n methods: z.array(HttpMethod).optional(),\n headers: z.array(z.string()).optional(),\n credentials: z.boolean().optional(),\n maxAge: z.number().int().positive().optional(),\n});\n\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n\n/**\n * HTTP methods supported for route configuration.\n * OPTIONS is always handled for CORS (not user-configurable per route).\n */\nexport const RouteMethod = z.enum(['GET', 'POST']);\n\n/**\n * Route configuration for multi-path support.\n */\nexport const RouteConfigSchema = z.object({\n path: z\n .string()\n .describe('URL path pattern (supports wildcards like /api/*)'),\n methods: z\n .array(RouteMethod)\n .min(1)\n .describe('HTTP methods to accept. OPTIONS always included for CORS.')\n .optional(),\n});\n","import { z } from '@walkeros/core/dev';\n\n// Properties schema - flexible key-value pairs\nconst PropertiesSchema = z.record(\n z.string(),\n z.union([z.string(), z.number(), z.boolean(), z.record(z.string(), z.any())]),\n);\n\n// Ordered properties - [value, order] tuples\nconst OrderedPropertiesSchema = z.record(\n z.string(),\n z.tuple([\n z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.record(z.string(), z.any()),\n ]),\n z.number(),\n ]),\n);\n\n// User schema with optional fields\nconst UserSchema = z\n .object({\n id: z.string().optional(),\n device: z.string().optional(),\n session: z.string().optional(),\n email: z.string().optional(),\n hash: z.string().optional(),\n })\n .passthrough();\n\n// Consent schema - boolean flags\nconst ConsentSchema = z.record(z.string(), z.boolean());\n\n// Entity schema (recursive for nested entities)\nconst EntitySchema: z.ZodTypeAny = z.lazy(() =>\n z\n .object({\n entity: z.string(),\n data: PropertiesSchema.optional(),\n nested: z.array(EntitySchema).optional(),\n context: OrderedPropertiesSchema.optional(),\n })\n .passthrough(),\n);\n\n// Version schema\nconst VersionSchema = z.object({\n source: z.string(),\n tagging: z.number(),\n});\n\n// Source schema\nconst SourceSchema = z\n .object({\n type: z.string(),\n id: z.string(),\n previous_id: z.string(),\n })\n .passthrough();\n\n// Main event schema - validates incoming events\nexport const EventSchema = z\n .object({\n // Required\n name: z.string().min(1, 'Event name is required'),\n\n // Core properties\n data: PropertiesSchema.optional(),\n context: OrderedPropertiesSchema.optional(),\n globals: PropertiesSchema.optional(),\n custom: PropertiesSchema.optional(),\n user: UserSchema.optional(),\n nested: z.array(EntitySchema).optional(),\n consent: ConsentSchema.optional(),\n\n // System fields (optional for incoming events)\n id: z.string().optional(),\n trigger: z.string().optional(),\n entity: z.string().optional(),\n action: z.string().optional(),\n timestamp: z.number().optional(),\n timing: z.number().optional(),\n group: z.string().optional(),\n count: z.number().optional(),\n version: VersionSchema.optional(),\n source: SourceSchema.optional(),\n })\n .passthrough(); // Allow additional fields\n\nexport type ValidatedEvent = z.infer<typeof EventSchema>;\n","export * as inputs from './inputs';\nexport * as requests from './requests';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Example walkerOS events that HTTP clients send to this source.\n * These are the CONTRACT - tests verify implementation handles these inputs.\n */\n\n// Simple page view event\nexport const pageView: WalkerOS.DeepPartialEvent = {\n name: 'page view',\n data: {\n title: 'Home Page',\n path: '/',\n referrer: 'https://google.com',\n },\n user: {\n id: 'user-123',\n session: 'session-456',\n },\n timestamp: 1700000000000,\n};\n\n// E-commerce event with nested entities\nexport const productAdd: WalkerOS.DeepPartialEvent = {\n name: 'product add',\n data: {\n id: 'P-123',\n name: 'Laptop',\n price: 999.99,\n quantity: 1,\n },\n context: {\n stage: ['shopping', 1],\n },\n globals: {\n language: 'en',\n currency: 'USD',\n },\n user: {\n id: 'user-123',\n },\n nested: [\n {\n entity: 'category',\n data: {\n name: 'Electronics',\n path: '/electronics',\n },\n },\n ],\n consent: {\n functional: true,\n marketing: true,\n },\n};\n\n// Complete event with all optional fields\nexport const completeEvent: WalkerOS.DeepPartialEvent = {\n name: 'order complete',\n data: {\n id: 'ORDER-123',\n total: 999.99,\n currency: 'USD',\n },\n context: {\n stage: ['checkout', 3],\n test: ['variant-A', 0],\n },\n globals: {\n language: 'en',\n country: 'US',\n },\n custom: {\n campaignId: 'summer-sale',\n source: 'email',\n },\n user: {\n id: 'user-123',\n email: 'user@example.com',\n session: 'session-456',\n },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'P-123',\n price: 999.99,\n },\n },\n ],\n consent: {\n functional: true,\n marketing: true,\n analytics: false,\n },\n trigger: 'click',\n group: 'ecommerce',\n};\n\n// Minimal valid event\nexport const minimal: WalkerOS.DeepPartialEvent = {\n name: 'ping',\n};\n\n// Batch of events\nexport const batch: WalkerOS.DeepPartialEvent[] = [\n pageView,\n productAdd,\n { name: 'button click', data: { id: 'cta' } },\n];\n","/**\n * HTTP request examples for testing the fetch source.\n * Shows what external HTTP clients will send.\n */\n\nexport const validPostRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n name: 'page view',\n data: { title: 'Home' },\n }),\n};\n\nexport const batchPostRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n batch: [\n { name: 'page view', data: { title: 'Home' } },\n { name: 'button click', data: { id: 'cta' } },\n ],\n }),\n};\n\nexport const pixelGetRequest = {\n method: 'GET',\n url: 'https://example.com/collect?event=page%20view&data[title]=Home&user[id]=user123',\n};\n\nexport const healthCheckRequest = {\n method: 'GET',\n url: 'https://example.com/health',\n};\n\nexport const optionsRequest = {\n method: 'OPTIONS',\n url: 'https://example.com/collect',\n headers: { Origin: 'https://example.com' },\n};\n\nexport const invalidJsonRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: 'invalid json{',\n};\n\nexport const oversizedRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n name: 'test',\n data: { payload: 'x'.repeat(200000) }, // 200KB\n }),\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const postEvent: Flow.StepExample = {\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n url: 'http://localhost/collect',\n body: {\n name: 'page view',\n data: { title: 'Docs', url: 'https://example.com/docs' },\n },\n },\n out: {\n name: 'page view',\n data: { title: 'Docs', url: 'https://example.com/docs' },\n entity: 'page',\n action: 'view',\n },\n};\n\nexport const batchRequest: Flow.StepExample = {\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n url: 'http://localhost/collect',\n body: {\n batch: [\n { name: 'page view', data: { title: 'Home' } },\n { name: 'button click', data: { id: 'cta' } },\n ],\n },\n },\n out: {\n name: 'page view',\n data: { title: 'Home' },\n entity: 'page',\n action: 'view',\n },\n};\n\nexport const pixelGet: Flow.StepExample = {\n trigger: { type: 'GET' },\n in: {\n method: 'GET',\n url: 'http://localhost/collect?e=page+view&d=%7B%22title%22%3A%22Home%22%7D',\n },\n out: {\n name: 'page view',\n data: { title: 'Home' },\n entity: 'page',\n action: 'view',\n },\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\n\nexport interface Content {\n method: string;\n url: string;\n body?: unknown;\n headers?: Record<string, string>;\n}\n\nexport interface Result {\n status: number;\n body: unknown;\n headers: Record<string, string>;\n}\n\nfunction findFetchSource(collector: Collector.Instance) {\n for (const source of Object.values(collector.sources || {})) {\n if ((source as { type?: string }).type === 'fetch') return source;\n }\n}\n\nconst createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const source = findFetchSource(flow.collector);\n if (!source) throw new Error('Fetch source not found in collector');\n\n // Construct real Request from content\n const init: RequestInit = {\n method: content.method,\n headers: { 'Content-Type': 'application/json', ...content.headers },\n };\n if (content.method !== 'GET' && content.body !== undefined) {\n init.body = JSON.stringify(content.body);\n }\n const request = new Request(content.url, init);\n\n // Call source.push with the real Request\n const response = await (\n source as unknown as { push: (r: Request) => Promise<Response> }\n ).push(request);\n\n // Convert Response to serializable result\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((v, k) => {\n responseHeaders[k] = v;\n });\n\n const ct = response.headers.get('content-type') || '';\n const body = ct.includes('json')\n ? await response.json()\n : await response.text();\n\n return { status: response.status, body, headers: responseHeaders };\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\nexport { createTrigger };\n"],"mappings":";;;;;;;;;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AAAA,EACnE;AAEF,SAAO;AAAA,IACL,IAAI,OAAO;AACT,aAAO;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;","names":["import_dev","import_dev","import_dev"]}
1
+ {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.ts","../src/schemas/event.ts","../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/requests.ts","../src/examples/step.ts","../src/examples/trigger.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport * from './primitives';\nexport { SettingsSchema, type Settings } from './settings';\nexport * from './event';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\nimport { CorsOptionsSchema, RouteConfigSchema } from './primitives';\n\n/**\n * Fetch source settings schema.\n */\nexport const SettingsSchema = z.object({\n /** @deprecated Use `paths` instead */\n path: z.string().describe('Deprecated: use paths instead').optional(),\n\n paths: z\n .array(z.union([z.string(), RouteConfigSchema]))\n .min(1)\n .describe(\n 'Route paths to handle. String shorthand accepts GET+POST. RouteConfig allows per-route method control.',\n )\n .optional(),\n\n cors: z\n .union([z.boolean(), CorsOptionsSchema])\n .describe(\n 'CORS configuration: false = disabled, true = allow all (default), object = custom',\n )\n .default(true),\n\n maxRequestSize: z\n .number()\n .int()\n .positive()\n .describe('Maximum request body size in bytes')\n .default(1024 * 100), // 100KB\n\n maxBatchSize: z\n .number()\n .int()\n .positive()\n .describe('Maximum events per batch request')\n .default(100),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const HttpMethod = z.enum([\n 'GET',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'OPTIONS',\n 'HEAD',\n]);\n\nexport const CorsOrigin = z.union([\n z.string(),\n z.array(z.string()),\n z.literal('*'),\n]);\n\nexport const CorsOptionsSchema = z.object({\n origin: CorsOrigin.optional(),\n methods: z.array(HttpMethod).optional(),\n headers: z.array(z.string()).optional(),\n credentials: z.boolean().optional(),\n maxAge: z.number().int().positive().optional(),\n});\n\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n\n/**\n * HTTP methods supported for route configuration.\n * OPTIONS is always handled for CORS (not user-configurable per route).\n */\nexport const RouteMethod = z.enum(['GET', 'POST']);\n\n/**\n * Route configuration for multi-path support.\n */\nexport const RouteConfigSchema = z.object({\n path: z\n .string()\n .describe('URL path pattern (supports wildcards like /api/*)'),\n methods: z\n .array(RouteMethod)\n .min(1)\n .describe('HTTP methods to accept. OPTIONS always included for CORS.')\n .optional(),\n});\n","import { z } from '@walkeros/core/dev';\n\n// Properties schema - flexible key-value pairs\nconst PropertiesSchema = z.record(\n z.string(),\n z.union([z.string(), z.number(), z.boolean(), z.record(z.string(), z.any())]),\n);\n\n// Ordered properties - [value, order] tuples\nconst OrderedPropertiesSchema = z.record(\n z.string(),\n z.tuple([\n z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.record(z.string(), z.any()),\n ]),\n z.number(),\n ]),\n);\n\n// User schema with optional fields\nconst UserSchema = z\n .object({\n id: z.string().optional(),\n device: z.string().optional(),\n session: z.string().optional(),\n email: z.string().optional(),\n hash: z.string().optional(),\n })\n .passthrough();\n\n// Consent schema - boolean flags\nconst ConsentSchema = z.record(z.string(), z.boolean());\n\n// Entity schema (recursive for nested entities)\nconst EntitySchema: z.ZodTypeAny = z.lazy(() =>\n z\n .object({\n entity: z.string(),\n data: PropertiesSchema.optional(),\n nested: z.array(EntitySchema).optional(),\n context: OrderedPropertiesSchema.optional(),\n })\n .passthrough(),\n);\n\n// Source schema (v4)\nconst SourceSchema = z\n .object({\n type: z.string(),\n platform: z.string().optional(),\n version: z.string().optional(),\n schema: z.string().optional(),\n count: z.number().optional(),\n trace: z.string().optional(),\n url: z.string().optional(),\n referrer: z.string().optional(),\n })\n .passthrough();\n\n// Main event schema - validates incoming events\nexport const EventSchema = z\n .object({\n // Required\n name: z.string().min(1, 'Event name is required'),\n\n // Core properties\n data: PropertiesSchema.optional(),\n context: OrderedPropertiesSchema.optional(),\n globals: PropertiesSchema.optional(),\n custom: PropertiesSchema.optional(),\n user: UserSchema.optional(),\n nested: z.array(EntitySchema).optional(),\n consent: ConsentSchema.optional(),\n\n // System fields (optional for incoming events)\n id: z.string().optional(),\n trigger: z.string().optional(),\n entity: z.string().optional(),\n action: z.string().optional(),\n timestamp: z.number().optional(),\n timing: z.number().optional(),\n source: SourceSchema.optional(),\n })\n .passthrough(); // Allow additional fields\n\nexport type ValidatedEvent = z.infer<typeof EventSchema>;\n","export * as inputs from './inputs';\nexport * as requests from './requests';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Example walkerOS events that HTTP clients send to this source.\n * These are the CONTRACT - tests verify implementation handles these inputs.\n */\n\n// Simple page view event\nexport const pageView: WalkerOS.DeepPartialEvent = {\n name: 'page view',\n data: {\n title: 'Home Page',\n path: '/',\n referrer: 'https://google.com',\n },\n user: {\n id: 'user-123',\n session: 'session-456',\n },\n timestamp: 1700000000000,\n};\n\n// E-commerce event with nested entities\nexport const productAdd: WalkerOS.DeepPartialEvent = {\n name: 'product add',\n data: {\n id: 'P-123',\n name: 'Laptop',\n price: 999.99,\n quantity: 1,\n },\n context: {\n stage: ['shopping', 1],\n },\n globals: {\n language: 'en',\n currency: 'USD',\n },\n user: {\n id: 'user-123',\n },\n nested: [\n {\n entity: 'category',\n data: {\n name: 'Electronics',\n path: '/electronics',\n },\n },\n ],\n consent: {\n functional: true,\n marketing: true,\n },\n};\n\n// Complete event with all optional fields\nexport const completeEvent: WalkerOS.DeepPartialEvent = {\n name: 'order complete',\n data: {\n id: 'ORDER-123',\n total: 999.99,\n currency: 'USD',\n },\n context: {\n stage: ['checkout', 3],\n test: ['variant-A', 0],\n },\n globals: {\n language: 'en',\n country: 'US',\n },\n custom: {\n campaignId: 'summer-sale',\n source: 'email',\n },\n user: {\n id: 'user-123',\n email: 'user@example.com',\n session: 'session-456',\n },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'P-123',\n price: 999.99,\n },\n },\n ],\n consent: {\n functional: true,\n marketing: true,\n analytics: false,\n },\n trigger: 'click',\n};\n\n// Minimal valid event\nexport const minimal: WalkerOS.DeepPartialEvent = {\n name: 'ping',\n};\n\n// Batch of events\nexport const batch: WalkerOS.DeepPartialEvent[] = [\n pageView,\n productAdd,\n { name: 'button click', data: { id: 'cta' } },\n];\n","/**\n * HTTP request examples for testing the fetch source.\n * Shows what external HTTP clients will send.\n */\n\nexport const validPostRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n name: 'page view',\n data: { title: 'Home' },\n }),\n};\n\nexport const batchPostRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n batch: [\n { name: 'page view', data: { title: 'Home' } },\n { name: 'button click', data: { id: 'cta' } },\n ],\n }),\n};\n\nexport const pixelGetRequest = {\n method: 'GET',\n url: 'https://example.com/collect?event=page%20view&data[title]=Home&user[id]=user123',\n};\n\nexport const healthCheckRequest = {\n method: 'GET',\n url: 'https://example.com/health',\n};\n\nexport const optionsRequest = {\n method: 'OPTIONS',\n url: 'https://example.com/collect',\n headers: { Origin: 'https://example.com' },\n};\n\nexport const invalidJsonRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: 'invalid json{',\n};\n\nexport const oversizedRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n name: 'test',\n data: { payload: 'x'.repeat(200000) }, // 200KB\n }),\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const postEvent: Flow.StepExample = {\n title: 'POST event',\n description:\n 'A fetch POST request with a JSON body becomes a single walker elb event in a fetch-based server.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n url: 'http://localhost/collect',\n body: {\n name: 'page view',\n data: { title: 'Docs', url: 'https://example.com/docs' },\n },\n },\n out: [\n [\n 'elb',\n {\n name: 'page view',\n data: { title: 'Docs', url: 'https://example.com/docs' },\n },\n ],\n ],\n};\n\nexport const batchRequest: Flow.StepExample = {\n title: 'Batch POST',\n description:\n 'A fetch POST with a batch array produces one walker elb event per batched item preserving order.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n url: 'http://localhost/collect',\n body: {\n batch: [\n { name: 'page view', data: { title: 'Home' } },\n { name: 'button click', data: { id: 'cta' } },\n ],\n },\n },\n out: [\n ['elb', { name: 'page view', data: { title: 'Home' } }],\n ['elb', { name: 'button click', data: { id: 'cta' } }],\n ],\n};\n\nexport const pixelGet: Flow.StepExample = {\n title: 'Pixel GET',\n description:\n 'A fetch GET with query parameters in the URL is parsed into an elb event payload for pixel-style tracking.',\n trigger: { type: 'GET' },\n in: {\n method: 'GET',\n url: 'http://localhost/collect?e=page+view&d=%7B%22title%22%3A%22Home%22%7D',\n },\n out: [\n [\n 'elb',\n {\n e: 'page view',\n d: '{\"title\":\"Home\"}',\n },\n ],\n ],\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\n\nexport interface Content {\n method: string;\n url: string;\n body?: unknown;\n headers?: Record<string, string>;\n}\n\nexport interface Result {\n status: number;\n body: unknown;\n headers: Record<string, string>;\n}\n\nfunction findFetchSource(collector: Collector.Instance) {\n for (const source of Object.values(collector.sources || {})) {\n if ((source as { type?: string }).type === 'fetch') return source;\n }\n}\n\nconst createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const source = findFetchSource(flow.collector);\n if (!source) throw new Error('Fetch source not found in collector');\n\n // Construct real Request from content\n const init: RequestInit = {\n method: content.method,\n headers: { 'Content-Type': 'application/json', ...content.headers },\n };\n if (content.method !== 'GET' && content.body !== undefined) {\n init.body = JSON.stringify(content.body);\n }\n const request = new Request(content.url, init);\n\n // Call source.push with the real Request\n const response = await (\n source as unknown as { push: (r: Request) => Promise<Response> }\n ).push(request);\n\n // Convert Response to serializable result\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((v, k) => {\n responseHeaders[k] = v;\n });\n\n const ct = response.headers.get('content-type') || '';\n const body = ct.includes('json')\n ? await response.json()\n : await response.text();\n\n return { status: response.status, body, headers: responseHeaders };\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\nexport { createTrigger };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,IAAAC,cAAkB;;;ACAlB,iBAAkB;AAEX,IAAM,aAAa,aAAE,KAAK;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,aAAa,aAAE,MAAM;AAAA,EAChC,aAAE,OAAO;AAAA,EACT,aAAE,MAAM,aAAE,OAAO,CAAC;AAAA,EAClB,aAAE,QAAQ,GAAG;AACf,CAAC;AAEM,IAAM,oBAAoB,aAAE,OAAO;AAAA,EACxC,QAAQ,WAAW,SAAS;AAAA,EAC5B,SAAS,aAAE,MAAM,UAAU,EAAE,SAAS;AAAA,EACtC,SAAS,aAAE,MAAM,aAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACtC,aAAa,aAAE,QAAQ,EAAE,SAAS;AAAA,EAClC,QAAQ,aAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAC/C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,KAAK,SAAS;AAC7C,QAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,qCAAqC;AAGlE,UAAM,OAAoB;AAAA,MACxB,QAAQ,QAAQ;AAAA,MAChB,SAAS,EAAE,gBAAgB,oBAAoB,GAAG,QAAQ,QAAQ;AAAA,IACpE;AACA,QAAI,QAAQ,WAAW,SAAS,QAAQ,SAAS,QAAW;AAC1D,WAAK,OAAO,KAAK,UAAU,QAAQ,IAAI;AAAA,IACzC;AACA,UAAM,UAAU,IAAI,QAAQ,QAAQ,KAAK,IAAI;AAG7C,UAAM,WAAW,MACf,OACA,KAAK,OAAO;AAGd,UAAM,kBAA0C,CAAC;AACjD,aAAS,QAAQ,QAAQ,CAAC,GAAG,MAAM;AACjC,sBAAgB,CAAC,IAAI;AAAA,IACvB,CAAC;AAED,UAAM,KAAK,SAAS,QAAQ,IAAI,cAAc,KAAK;AACnD,UAAM,OAAO,GAAG,SAAS,MAAM,IAC3B,MAAM,SAAS,KAAK,IACpB,MAAM,SAAS,KAAK;AAExB,WAAO,EAAE,QAAQ,SAAS,QAAQ,MAAM,SAAS,gBAAgB;AAAA,EACnE;AAEF,SAAO;AAAA,IACL,IAAI,OAAO;AACT,aAAO;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;","names":["import_dev","import_dev","import_dev"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,o)=>{for(var a in o)e(t,a,{get:o[a],enumerable:!0})},o={};t(o,{CorsOptionsSchema:()=>l,CorsOrigin:()=>s,EventSchema:()=>T,HttpMethod:()=>r,RouteConfigSchema:()=>p,RouteMethod:()=>c,SettingsSchema:()=>d,settings:()=>w});import{zodToSchema as a}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";var r=i.enum(["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"]),s=i.union([i.string(),i.array(i.string()),i.literal("*")]),l=i.object({origin:s.optional(),methods:i.array(r).optional(),headers:i.array(i.string()).optional(),credentials:i.boolean().optional(),maxAge:i.number().int().positive().optional()}),c=i.enum(["GET","POST"]),p=i.object({path:i.string().describe("URL path pattern (supports wildcards like /api/*)"),methods:i.array(c).min(1).describe("HTTP methods to accept. OPTIONS always included for CORS.").optional()}),d=n.object({path:n.string().describe("Deprecated: use paths instead").optional(),paths:n.array(n.union([n.string(),p])).min(1).describe("Route paths to handle. String shorthand accepts GET+POST. RouteConfig allows per-route method control.").optional(),cors:n.union([n.boolean(),l]).describe("CORS configuration: false = disabled, true = allow all (default), object = custom").default(!0),maxRequestSize:n.number().int().positive().describe("Maximum request body size in bytes").default(102400),maxBatchSize:n.number().int().positive().describe("Maximum events per batch request").default(100)});import{z as m}from"@walkeros/core/dev";var u=m.record(m.string(),m.union([m.string(),m.number(),m.boolean(),m.record(m.string(),m.any())])),g=m.record(m.string(),m.tuple([m.union([m.string(),m.number(),m.boolean(),m.record(m.string(),m.any())]),m.number()])),h=m.object({id:m.string().optional(),device:m.string().optional(),session:m.string().optional(),email:m.string().optional(),hash:m.string().optional()}).passthrough(),b=m.record(m.string(),m.boolean()),y=m.lazy(()=>m.object({entity:m.string(),data:u.optional(),nested:m.array(y).optional(),context:g.optional()}).passthrough()),v=m.object({source:m.string(),tagging:m.number()}),f=m.object({type:m.string(),id:m.string(),previous_id:m.string()}).passthrough(),T=m.object({name:m.string().min(1,"Event name is required"),data:u.optional(),context:g.optional(),globals:u.optional(),custom:u.optional(),user:h.optional(),nested:m.array(y).optional(),consent:b.optional(),id:m.string().optional(),trigger:m.string().optional(),entity:m.string().optional(),action:m.string().optional(),timestamp:m.number().optional(),timing:m.number().optional(),group:m.string().optional(),count:m.number().optional(),version:v.optional(),source:f.optional()}).passthrough(),w=a(d),S={};t(S,{createTrigger:()=>L,inputs:()=>O,requests:()=>q,step:()=>A});var O={};t(O,{batch:()=>R,completeEvent:()=>E,minimal:()=>j,pageView:()=>x,productAdd:()=>P});var x={name:"page view",data:{title:"Home Page",path:"/",referrer:"https://google.com"},user:{id:"user-123",session:"session-456"},timestamp:17e11},P={name:"product add",data:{id:"P-123",name:"Laptop",price:999.99,quantity:1},context:{stage:["shopping",1]},globals:{language:"en",currency:"USD"},user:{id:"user-123"},nested:[{entity:"category",data:{name:"Electronics",path:"/electronics"}}],consent:{functional:!0,marketing:!0}},E={name:"order complete",data:{id:"ORDER-123",total:999.99,currency:"USD"},context:{stage:["checkout",3],test:["variant-A",0]},globals:{language:"en",country:"US"},custom:{campaignId:"summer-sale",source:"email"},user:{id:"user-123",email:"user@example.com",session:"session-456"},nested:[{entity:"product",data:{id:"P-123",price:999.99}}],consent:{functional:!0,marketing:!0,analytics:!1},trigger:"click",group:"ecommerce"},j={name:"ping"},R=[x,P,{name:"button click",data:{id:"cta"}}],q={};t(q,{batchPostRequest:()=>C,healthCheckRequest:()=>G,invalidJsonRequest:()=>z,optionsRequest:()=>D,oversizedRequest:()=>N,pixelGetRequest:()=>H,validPostRequest:()=>k});var k={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"page view",data:{title:"Home"}})},C={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({batch:[{name:"page view",data:{title:"Home"}},{name:"button click",data:{id:"cta"}}]})},H={method:"GET",url:"https://example.com/collect?event=page%20view&data[title]=Home&user[id]=user123"},G={method:"GET",url:"https://example.com/health"},D={method:"OPTIONS",url:"https://example.com/collect",headers:{Origin:"https://example.com"}},z={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:"invalid json{"},N={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"test",data:{payload:"x".repeat(2e5)}})},A={};t(A,{batchRequest:()=>U,pixelGet:()=>I,postEvent:()=>J});var J={trigger:{type:"POST"},in:{method:"POST",url:"http://localhost/collect",body:{name:"page view",data:{title:"Docs",url:"https://example.com/docs"}}},out:{name:"page view",data:{title:"Docs",url:"https://example.com/docs"},entity:"page",action:"view"}},U={trigger:{type:"POST"},in:{method:"POST",url:"http://localhost/collect",body:{batch:[{name:"page view",data:{title:"Home"}},{name:"button click",data:{id:"cta"}}]}},out:{name:"page view",data:{title:"Home"},entity:"page",action:"view"}},I={trigger:{type:"GET"},in:{method:"GET",url:"http://localhost/collect?e=page+view&d=%7B%22title%22%3A%22Home%22%7D"},out:{name:"page view",data:{title:"Home"},entity:"page",action:"view"}};import{startFlow as M}from"@walkeros/collector";var L=async e=>{let t;return{get flow(){return t},trigger:()=>async o=>{if(!t){const o=await M(e);t={collector:o.collector,elb:o.elb}}const a=function(e){for(const t of Object.values(e.sources||{}))if("fetch"===t.type)return t}(t.collector);if(!a)throw new Error("Fetch source not found in collector");const n={method:o.method,headers:{"Content-Type":"application/json",...o.headers}};"GET"!==o.method&&void 0!==o.body&&(n.body=JSON.stringify(o.body));const i=new Request(o.url,n),r=await a.push(i),s={};r.headers.forEach((e,t)=>{s[t]=e});const l=(r.headers.get("content-type")||"").includes("json")?await r.json():await r.text();return{status:r.status,body:l,headers:s}}}};export{S as examples,o as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,o)=>{for(var a in o)e(t,a,{get:o[a],enumerable:!0})},o={};t(o,{CorsOptionsSchema:()=>l,CorsOrigin:()=>s,EventSchema:()=>f,HttpMethod:()=>r,RouteConfigSchema:()=>p,RouteMethod:()=>c,SettingsSchema:()=>d,settings:()=>T});import{zodToSchema as a}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";var r=n.enum(["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"]),s=n.union([n.string(),n.array(n.string()),n.literal("*")]),l=n.object({origin:s.optional(),methods:n.array(r).optional(),headers:n.array(n.string()).optional(),credentials:n.boolean().optional(),maxAge:n.number().int().positive().optional()}),c=n.enum(["GET","POST"]),p=n.object({path:n.string().describe("URL path pattern (supports wildcards like /api/*)"),methods:n.array(c).min(1).describe("HTTP methods to accept. OPTIONS always included for CORS.").optional()}),d=i.object({path:i.string().describe("Deprecated: use paths instead").optional(),paths:i.array(i.union([i.string(),p])).min(1).describe("Route paths to handle. String shorthand accepts GET+POST. RouteConfig allows per-route method control.").optional(),cors:i.union([i.boolean(),l]).describe("CORS configuration: false = disabled, true = allow all (default), object = custom").default(!0),maxRequestSize:i.number().int().positive().describe("Maximum request body size in bytes").default(102400),maxBatchSize:i.number().int().positive().describe("Maximum events per batch request").default(100)});import{z as m}from"@walkeros/core/dev";var u=m.record(m.string(),m.union([m.string(),m.number(),m.boolean(),m.record(m.string(),m.any())])),h=m.record(m.string(),m.tuple([m.union([m.string(),m.number(),m.boolean(),m.record(m.string(),m.any())]),m.number()])),g=m.object({id:m.string().optional(),device:m.string().optional(),session:m.string().optional(),email:m.string().optional(),hash:m.string().optional()}).passthrough(),b=m.record(m.string(),m.boolean()),y=m.lazy(()=>m.object({entity:m.string(),data:u.optional(),nested:m.array(y).optional(),context:h.optional()}).passthrough()),v=m.object({type:m.string(),platform:m.string().optional(),version:m.string().optional(),schema:m.string().optional(),count:m.number().optional(),trace:m.string().optional(),url:m.string().optional(),referrer:m.string().optional()}).passthrough(),f=m.object({name:m.string().min(1,"Event name is required"),data:u.optional(),context:h.optional(),globals:u.optional(),custom:u.optional(),user:g.optional(),nested:m.array(y).optional(),consent:b.optional(),id:m.string().optional(),trigger:m.string().optional(),entity:m.string().optional(),action:m.string().optional(),timestamp:m.number().optional(),timing:m.number().optional(),source:v.optional()}).passthrough(),T=a(d),S={};t(S,{createTrigger:()=>L,inputs:()=>O,requests:()=>j,step:()=>N});var O={};t(O,{batch:()=>R,completeEvent:()=>P,minimal:()=>E,pageView:()=>w,productAdd:()=>x});var w={name:"page view",data:{title:"Home Page",path:"/",referrer:"https://google.com"},user:{id:"user-123",session:"session-456"},timestamp:17e11},x={name:"product add",data:{id:"P-123",name:"Laptop",price:999.99,quantity:1},context:{stage:["shopping",1]},globals:{language:"en",currency:"USD"},user:{id:"user-123"},nested:[{entity:"category",data:{name:"Electronics",path:"/electronics"}}],consent:{functional:!0,marketing:!0}},P={name:"order complete",data:{id:"ORDER-123",total:999.99,currency:"USD"},context:{stage:["checkout",3],test:["variant-A",0]},globals:{language:"en",country:"US"},custom:{campaignId:"summer-sale",source:"email"},user:{id:"user-123",email:"user@example.com",session:"session-456"},nested:[{entity:"product",data:{id:"P-123",price:999.99}}],consent:{functional:!0,marketing:!0,analytics:!1},trigger:"click"},E={name:"ping"},R=[w,x,{name:"button click",data:{id:"cta"}}],j={};t(j,{batchPostRequest:()=>q,healthCheckRequest:()=>G,invalidJsonRequest:()=>A,optionsRequest:()=>H,oversizedRequest:()=>D,pixelGetRequest:()=>C,validPostRequest:()=>k});var k={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"page view",data:{title:"Home"}})},q={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({batch:[{name:"page view",data:{title:"Home"}},{name:"button click",data:{id:"cta"}}]})},C={method:"GET",url:"https://example.com/collect?event=page%20view&data[title]=Home&user[id]=user123"},G={method:"GET",url:"https://example.com/health"},H={method:"OPTIONS",url:"https://example.com/collect",headers:{Origin:"https://example.com"}},A={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:"invalid json{"},D={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"test",data:{payload:"x".repeat(2e5)}})},N={};t(N,{batchRequest:()=>J,pixelGet:()=>U,postEvent:()=>z});var z={title:"POST event",description:"A fetch POST request with a JSON body becomes a single walker elb event in a fetch-based server.",trigger:{type:"POST"},in:{method:"POST",url:"http://localhost/collect",body:{name:"page view",data:{title:"Docs",url:"https://example.com/docs"}}},out:[["elb",{name:"page view",data:{title:"Docs",url:"https://example.com/docs"}}]]},J={title:"Batch POST",description:"A fetch POST with a batch array produces one walker elb event per batched item preserving order.",trigger:{type:"POST"},in:{method:"POST",url:"http://localhost/collect",body:{batch:[{name:"page view",data:{title:"Home"}},{name:"button click",data:{id:"cta"}}]}},out:[["elb",{name:"page view",data:{title:"Home"}}],["elb",{name:"button click",data:{id:"cta"}}]]},U={title:"Pixel GET",description:"A fetch GET with query parameters in the URL is parsed into an elb event payload for pixel-style tracking.",trigger:{type:"GET"},in:{method:"GET",url:"http://localhost/collect?e=page+view&d=%7B%22title%22%3A%22Home%22%7D"},out:[["elb",{e:"page view",d:'{"title":"Home"}'}]]};import{startFlow as I}from"@walkeros/collector";var L=async e=>{let t;return{get flow(){return t},trigger:()=>async o=>{if(!t){const o=await I(e);t={collector:o.collector,elb:o.elb}}const a=function(e){for(const t of Object.values(e.sources||{}))if("fetch"===t.type)return t}(t.collector);if(!a)throw new Error("Fetch source not found in collector");const i={method:o.method,headers:{"Content-Type":"application/json",...o.headers}};"GET"!==o.method&&void 0!==o.body&&(i.body=JSON.stringify(o.body));const n=new Request(o.url,i),r=await a.push(n),s={};r.headers.forEach((e,t)=>{s[t]=e});const l=(r.headers.get("content-type")||"").includes("json")?await r.json():await r.text();return{status:r.status,body:l,headers:s}}}};export{S as examples,o as schemas};//# sourceMappingURL=dev.mjs.map
package/dist/dev.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.ts","../src/schemas/event.ts","../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/requests.ts","../src/examples/step.ts","../src/examples/trigger.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport * from './primitives';\nexport { SettingsSchema, type Settings } from './settings';\nexport * from './event';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\nimport { CorsOptionsSchema, RouteConfigSchema } from './primitives';\n\n/**\n * Fetch source settings schema.\n */\nexport const SettingsSchema = z.object({\n /** @deprecated Use `paths` instead */\n path: z.string().describe('Deprecated: use paths instead').optional(),\n\n paths: z\n .array(z.union([z.string(), RouteConfigSchema]))\n .min(1)\n .describe(\n 'Route paths to handle. String shorthand accepts GET+POST. RouteConfig allows per-route method control.',\n )\n .optional(),\n\n cors: z\n .union([z.boolean(), CorsOptionsSchema])\n .describe(\n 'CORS configuration: false = disabled, true = allow all (default), object = custom',\n )\n .default(true),\n\n maxRequestSize: z\n .number()\n .int()\n .positive()\n .describe('Maximum request body size in bytes')\n .default(1024 * 100), // 100KB\n\n maxBatchSize: z\n .number()\n .int()\n .positive()\n .describe('Maximum events per batch request')\n .default(100),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const HttpMethod = z.enum([\n 'GET',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'OPTIONS',\n 'HEAD',\n]);\n\nexport const CorsOrigin = z.union([\n z.string(),\n z.array(z.string()),\n z.literal('*'),\n]);\n\nexport const CorsOptionsSchema = z.object({\n origin: CorsOrigin.optional(),\n methods: z.array(HttpMethod).optional(),\n headers: z.array(z.string()).optional(),\n credentials: z.boolean().optional(),\n maxAge: z.number().int().positive().optional(),\n});\n\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n\n/**\n * HTTP methods supported for route configuration.\n * OPTIONS is always handled for CORS (not user-configurable per route).\n */\nexport const RouteMethod = z.enum(['GET', 'POST']);\n\n/**\n * Route configuration for multi-path support.\n */\nexport const RouteConfigSchema = z.object({\n path: z\n .string()\n .describe('URL path pattern (supports wildcards like /api/*)'),\n methods: z\n .array(RouteMethod)\n .min(1)\n .describe('HTTP methods to accept. OPTIONS always included for CORS.')\n .optional(),\n});\n","import { z } from '@walkeros/core/dev';\n\n// Properties schema - flexible key-value pairs\nconst PropertiesSchema = z.record(\n z.string(),\n z.union([z.string(), z.number(), z.boolean(), z.record(z.string(), z.any())]),\n);\n\n// Ordered properties - [value, order] tuples\nconst OrderedPropertiesSchema = z.record(\n z.string(),\n z.tuple([\n z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.record(z.string(), z.any()),\n ]),\n z.number(),\n ]),\n);\n\n// User schema with optional fields\nconst UserSchema = z\n .object({\n id: z.string().optional(),\n device: z.string().optional(),\n session: z.string().optional(),\n email: z.string().optional(),\n hash: z.string().optional(),\n })\n .passthrough();\n\n// Consent schema - boolean flags\nconst ConsentSchema = z.record(z.string(), z.boolean());\n\n// Entity schema (recursive for nested entities)\nconst EntitySchema: z.ZodTypeAny = z.lazy(() =>\n z\n .object({\n entity: z.string(),\n data: PropertiesSchema.optional(),\n nested: z.array(EntitySchema).optional(),\n context: OrderedPropertiesSchema.optional(),\n })\n .passthrough(),\n);\n\n// Version schema\nconst VersionSchema = z.object({\n source: z.string(),\n tagging: z.number(),\n});\n\n// Source schema\nconst SourceSchema = z\n .object({\n type: z.string(),\n id: z.string(),\n previous_id: z.string(),\n })\n .passthrough();\n\n// Main event schema - validates incoming events\nexport const EventSchema = z\n .object({\n // Required\n name: z.string().min(1, 'Event name is required'),\n\n // Core properties\n data: PropertiesSchema.optional(),\n context: OrderedPropertiesSchema.optional(),\n globals: PropertiesSchema.optional(),\n custom: PropertiesSchema.optional(),\n user: UserSchema.optional(),\n nested: z.array(EntitySchema).optional(),\n consent: ConsentSchema.optional(),\n\n // System fields (optional for incoming events)\n id: z.string().optional(),\n trigger: z.string().optional(),\n entity: z.string().optional(),\n action: z.string().optional(),\n timestamp: z.number().optional(),\n timing: z.number().optional(),\n group: z.string().optional(),\n count: z.number().optional(),\n version: VersionSchema.optional(),\n source: SourceSchema.optional(),\n })\n .passthrough(); // Allow additional fields\n\nexport type ValidatedEvent = z.infer<typeof EventSchema>;\n","export * as inputs from './inputs';\nexport * as requests from './requests';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Example walkerOS events that HTTP clients send to this source.\n * These are the CONTRACT - tests verify implementation handles these inputs.\n */\n\n// Simple page view event\nexport const pageView: WalkerOS.DeepPartialEvent = {\n name: 'page view',\n data: {\n title: 'Home Page',\n path: '/',\n referrer: 'https://google.com',\n },\n user: {\n id: 'user-123',\n session: 'session-456',\n },\n timestamp: 1700000000000,\n};\n\n// E-commerce event with nested entities\nexport const productAdd: WalkerOS.DeepPartialEvent = {\n name: 'product add',\n data: {\n id: 'P-123',\n name: 'Laptop',\n price: 999.99,\n quantity: 1,\n },\n context: {\n stage: ['shopping', 1],\n },\n globals: {\n language: 'en',\n currency: 'USD',\n },\n user: {\n id: 'user-123',\n },\n nested: [\n {\n entity: 'category',\n data: {\n name: 'Electronics',\n path: '/electronics',\n },\n },\n ],\n consent: {\n functional: true,\n marketing: true,\n },\n};\n\n// Complete event with all optional fields\nexport const completeEvent: WalkerOS.DeepPartialEvent = {\n name: 'order complete',\n data: {\n id: 'ORDER-123',\n total: 999.99,\n currency: 'USD',\n },\n context: {\n stage: ['checkout', 3],\n test: ['variant-A', 0],\n },\n globals: {\n language: 'en',\n country: 'US',\n },\n custom: {\n campaignId: 'summer-sale',\n source: 'email',\n },\n user: {\n id: 'user-123',\n email: 'user@example.com',\n session: 'session-456',\n },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'P-123',\n price: 999.99,\n },\n },\n ],\n consent: {\n functional: true,\n marketing: true,\n analytics: false,\n },\n trigger: 'click',\n group: 'ecommerce',\n};\n\n// Minimal valid event\nexport const minimal: WalkerOS.DeepPartialEvent = {\n name: 'ping',\n};\n\n// Batch of events\nexport const batch: WalkerOS.DeepPartialEvent[] = [\n pageView,\n productAdd,\n { name: 'button click', data: { id: 'cta' } },\n];\n","/**\n * HTTP request examples for testing the fetch source.\n * Shows what external HTTP clients will send.\n */\n\nexport const validPostRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n name: 'page view',\n data: { title: 'Home' },\n }),\n};\n\nexport const batchPostRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n batch: [\n { name: 'page view', data: { title: 'Home' } },\n { name: 'button click', data: { id: 'cta' } },\n ],\n }),\n};\n\nexport const pixelGetRequest = {\n method: 'GET',\n url: 'https://example.com/collect?event=page%20view&data[title]=Home&user[id]=user123',\n};\n\nexport const healthCheckRequest = {\n method: 'GET',\n url: 'https://example.com/health',\n};\n\nexport const optionsRequest = {\n method: 'OPTIONS',\n url: 'https://example.com/collect',\n headers: { Origin: 'https://example.com' },\n};\n\nexport const invalidJsonRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: 'invalid json{',\n};\n\nexport const oversizedRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n name: 'test',\n data: { payload: 'x'.repeat(200000) }, // 200KB\n }),\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const postEvent: Flow.StepExample = {\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n url: 'http://localhost/collect',\n body: {\n name: 'page view',\n data: { title: 'Docs', url: 'https://example.com/docs' },\n },\n },\n out: {\n name: 'page view',\n data: { title: 'Docs', url: 'https://example.com/docs' },\n entity: 'page',\n action: 'view',\n },\n};\n\nexport const batchRequest: Flow.StepExample = {\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n url: 'http://localhost/collect',\n body: {\n batch: [\n { name: 'page view', data: { title: 'Home' } },\n { name: 'button click', data: { id: 'cta' } },\n ],\n },\n },\n out: {\n name: 'page view',\n data: { title: 'Home' },\n entity: 'page',\n action: 'view',\n },\n};\n\nexport const pixelGet: Flow.StepExample = {\n trigger: { type: 'GET' },\n in: {\n method: 'GET',\n url: 'http://localhost/collect?e=page+view&d=%7B%22title%22%3A%22Home%22%7D',\n },\n out: {\n name: 'page view',\n data: { title: 'Home' },\n entity: 'page',\n action: 'view',\n },\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\n\nexport interface Content {\n method: string;\n url: string;\n body?: unknown;\n headers?: Record<string, string>;\n}\n\nexport interface Result {\n status: number;\n body: unknown;\n headers: Record<string, string>;\n}\n\nfunction findFetchSource(collector: Collector.Instance) {\n for (const source of Object.values(collector.sources || {})) {\n if ((source as { type?: string }).type === 'fetch') return source;\n }\n}\n\nconst createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const source = findFetchSource(flow.collector);\n if (!source) throw new Error('Fetch source not found in collector');\n\n // Construct real Request from content\n const init: RequestInit = {\n method: content.method,\n headers: { 'Content-Type': 'application/json', ...content.headers },\n };\n if (content.method !== 'GET' && content.body !== undefined) {\n init.body = JSON.stringify(content.body);\n }\n const request = new Request(content.url, init);\n\n // Call source.push with the real Request\n const response = await (\n source as unknown as { push: (r: Request) => Promise<Response> }\n ).push(request);\n\n // Convert Response to serializable result\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((v, k) => {\n responseHeaders[k] = v;\n });\n\n const ct = response.headers.get('content-type') || '';\n const body = ct.includes('json')\n ? await response.json()\n : await response.text();\n\n return { status: response.status, body, headers: responseHeaders };\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\nexport { createTrigger };\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAEX,IAAM,aAAa,EAAE,KAAK;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,aAAa,EAAE,MAAM;AAAA,EAChC,EAAE,OAAO;AAAA,EACT,EAAE,MAA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AAEA,IAAM,gBAAmD,OACvD,WACG;AACH,MAAI;AAEJ,QAAM,UACJ,MACA,OAAO,YAAsC;AAC3C,QAAI,CAAC,MAAM;AACT,YAAM,SAAS,MAAM,UAAU,MAAM;AACrC,aAAO,EAAE,WAAW,OAAO,WAAW,KAAK,OAAO,IAAI;AAAA,IACxD;AAEA,UAAM,SAAS,gBAAgB,KAAK,SAAS;AAC7C,QAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,qCAAqC;AAGlE,UAAM,OAAoB;AAAA,MACxB,QAAQ,QAAQ;AAAA,MAChB,SAAS,EAAE,gBAAgB,oBAAoB,GAAG,QAAQ,QAAQ;AAAA,IACpE;AACA,QAAI,QAAQ,WAAW,SAAS,QAAQ,SAAS,QAAW;AAC1D,WAAK,OAAO,KAAK,UAAU,QAAQ,IAAI;AAAA,IACzC;AACA,UAAM,UAAU,IAAI,QAAQ,QAAQ,KAAK,IAAI;AAG7C,UAAM,WAAW,MACf,OACA,KAAK,OAAO;AAGd,UAAM,kBAA0C,CAAC;AACjD,aAAS,QAAQ,QAAQ,CAAC,GAAG,MAAM;AACjC,sBAAgB,CAAC,IAAI;AAAA,IACvB,CAAC;AAED,UAAM,KAAK,SAAS,QAAQ,IAAI,cAAc,KAAK;AACnD,UAAM,OAAO,GAAG,SAAS,MAAM,IAC3B,MAAM,SAAS,KAAK,IACpB,MAAM,SAAS,KAAK;AAExB,WAAO,EAAE,QAAQ,SAAS,QAAQ,MAAM,SAAS,gBAAgB;AAAA,EACnE;AAEF,SAAO;AAAA,IACL,IAAI,OAAO;AACT,aAAO;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;","names":["z","z","z"]}
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.ts","../src/schemas/event.ts","../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/requests.ts","../src/examples/step.ts","../src/examples/trigger.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport * from './primitives';\nexport { SettingsSchema, type Settings } from './settings';\nexport * from './event';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\nimport { CorsOptionsSchema, RouteConfigSchema } from './primitives';\n\n/**\n * Fetch source settings schema.\n */\nexport const SettingsSchema = z.object({\n /** @deprecated Use `paths` instead */\n path: z.string().describe('Deprecated: use paths instead').optional(),\n\n paths: z\n .array(z.union([z.string(), RouteConfigSchema]))\n .min(1)\n .describe(\n 'Route paths to handle. String shorthand accepts GET+POST. RouteConfig allows per-route method control.',\n )\n .optional(),\n\n cors: z\n .union([z.boolean(), CorsOptionsSchema])\n .describe(\n 'CORS configuration: false = disabled, true = allow all (default), object = custom',\n )\n .default(true),\n\n maxRequestSize: z\n .number()\n .int()\n .positive()\n .describe('Maximum request body size in bytes')\n .default(1024 * 100), // 100KB\n\n maxBatchSize: z\n .number()\n .int()\n .positive()\n .describe('Maximum events per batch request')\n .default(100),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const HttpMethod = z.enum([\n 'GET',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'OPTIONS',\n 'HEAD',\n]);\n\nexport const CorsOrigin = z.union([\n z.string(),\n z.array(z.string()),\n z.literal('*'),\n]);\n\nexport const CorsOptionsSchema = z.object({\n origin: CorsOrigin.optional(),\n methods: z.array(HttpMethod).optional(),\n headers: z.array(z.string()).optional(),\n credentials: z.boolean().optional(),\n maxAge: z.number().int().positive().optional(),\n});\n\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n\n/**\n * HTTP methods supported for route configuration.\n * OPTIONS is always handled for CORS (not user-configurable per route).\n */\nexport const RouteMethod = z.enum(['GET', 'POST']);\n\n/**\n * Route configuration for multi-path support.\n */\nexport const RouteConfigSchema = z.object({\n path: z\n .string()\n .describe('URL path pattern (supports wildcards like /api/*)'),\n methods: z\n .array(RouteMethod)\n .min(1)\n .describe('HTTP methods to accept. OPTIONS always included for CORS.')\n .optional(),\n});\n","import { z } from '@walkeros/core/dev';\n\n// Properties schema - flexible key-value pairs\nconst PropertiesSchema = z.record(\n z.string(),\n z.union([z.string(), z.number(), z.boolean(), z.record(z.string(), z.any())]),\n);\n\n// Ordered properties - [value, order] tuples\nconst OrderedPropertiesSchema = z.record(\n z.string(),\n z.tuple([\n z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.record(z.string(), z.any()),\n ]),\n z.number(),\n ]),\n);\n\n// User schema with optional fields\nconst UserSchema = z\n .object({\n id: z.string().optional(),\n device: z.string().optional(),\n session: z.string().optional(),\n email: z.string().optional(),\n hash: z.string().optional(),\n })\n .passthrough();\n\n// Consent schema - boolean flags\nconst ConsentSchema = z.record(z.string(), z.boolean());\n\n// Entity schema (recursive for nested entities)\nconst EntitySchema: z.ZodTypeAny = z.lazy(() =>\n z\n .object({\n entity: z.string(),\n data: PropertiesSchema.optional(),\n nested: z.array(EntitySchema).optional(),\n context: OrderedPropertiesSchema.optional(),\n })\n .passthrough(),\n);\n\n// Source schema (v4)\nconst SourceSchema = z\n .object({\n type: z.string(),\n platform: z.string().optional(),\n version: z.string().optional(),\n schema: z.string().optional(),\n count: z.number().optional(),\n trace: z.string().optional(),\n url: z.string().optional(),\n referrer: z.string().optional(),\n })\n .passthrough();\n\n// Main event schema - validates incoming events\nexport const EventSchema = z\n .object({\n // Required\n name: z.string().min(1, 'Event name is required'),\n\n // Core properties\n data: PropertiesSchema.optional(),\n context: OrderedPropertiesSchema.optional(),\n globals: PropertiesSchema.optional(),\n custom: PropertiesSchema.optional(),\n user: UserSchema.optional(),\n nested: z.array(EntitySchema).optional(),\n consent: ConsentSchema.optional(),\n\n // System fields (optional for incoming events)\n id: z.string().optional(),\n trigger: z.string().optional(),\n entity: z.string().optional(),\n action: z.string().optional(),\n timestamp: z.number().optional(),\n timing: z.number().optional(),\n source: SourceSchema.optional(),\n })\n .passthrough(); // Allow additional fields\n\nexport type ValidatedEvent = z.infer<typeof EventSchema>;\n","export * as inputs from './inputs';\nexport * as requests from './requests';\nexport * as step from './step';\nexport { createTrigger } from './trigger';\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Example walkerOS events that HTTP clients send to this source.\n * These are the CONTRACT - tests verify implementation handles these inputs.\n */\n\n// Simple page view event\nexport const pageView: WalkerOS.DeepPartialEvent = {\n name: 'page view',\n data: {\n title: 'Home Page',\n path: '/',\n referrer: 'https://google.com',\n },\n user: {\n id: 'user-123',\n session: 'session-456',\n },\n timestamp: 1700000000000,\n};\n\n// E-commerce event with nested entities\nexport const productAdd: WalkerOS.DeepPartialEvent = {\n name: 'product add',\n data: {\n id: 'P-123',\n name: 'Laptop',\n price: 999.99,\n quantity: 1,\n },\n context: {\n stage: ['shopping', 1],\n },\n globals: {\n language: 'en',\n currency: 'USD',\n },\n user: {\n id: 'user-123',\n },\n nested: [\n {\n entity: 'category',\n data: {\n name: 'Electronics',\n path: '/electronics',\n },\n },\n ],\n consent: {\n functional: true,\n marketing: true,\n },\n};\n\n// Complete event with all optional fields\nexport const completeEvent: WalkerOS.DeepPartialEvent = {\n name: 'order complete',\n data: {\n id: 'ORDER-123',\n total: 999.99,\n currency: 'USD',\n },\n context: {\n stage: ['checkout', 3],\n test: ['variant-A', 0],\n },\n globals: {\n language: 'en',\n country: 'US',\n },\n custom: {\n campaignId: 'summer-sale',\n source: 'email',\n },\n user: {\n id: 'user-123',\n email: 'user@example.com',\n session: 'session-456',\n },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'P-123',\n price: 999.99,\n },\n },\n ],\n consent: {\n functional: true,\n marketing: true,\n analytics: false,\n },\n trigger: 'click',\n};\n\n// Minimal valid event\nexport const minimal: WalkerOS.DeepPartialEvent = {\n name: 'ping',\n};\n\n// Batch of events\nexport const batch: WalkerOS.DeepPartialEvent[] = [\n pageView,\n productAdd,\n { name: 'button click', data: { id: 'cta' } },\n];\n","/**\n * HTTP request examples for testing the fetch source.\n * Shows what external HTTP clients will send.\n */\n\nexport const validPostRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n name: 'page view',\n data: { title: 'Home' },\n }),\n};\n\nexport const batchPostRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n batch: [\n { name: 'page view', data: { title: 'Home' } },\n { name: 'button click', data: { id: 'cta' } },\n ],\n }),\n};\n\nexport const pixelGetRequest = {\n method: 'GET',\n url: 'https://example.com/collect?event=page%20view&data[title]=Home&user[id]=user123',\n};\n\nexport const healthCheckRequest = {\n method: 'GET',\n url: 'https://example.com/health',\n};\n\nexport const optionsRequest = {\n method: 'OPTIONS',\n url: 'https://example.com/collect',\n headers: { Origin: 'https://example.com' },\n};\n\nexport const invalidJsonRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: 'invalid json{',\n};\n\nexport const oversizedRequest = {\n method: 'POST',\n url: 'https://example.com/collect',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n name: 'test',\n data: { payload: 'x'.repeat(200000) }, // 200KB\n }),\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const postEvent: Flow.StepExample = {\n title: 'POST event',\n description:\n 'A fetch POST request with a JSON body becomes a single walker elb event in a fetch-based server.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n url: 'http://localhost/collect',\n body: {\n name: 'page view',\n data: { title: 'Docs', url: 'https://example.com/docs' },\n },\n },\n out: [\n [\n 'elb',\n {\n name: 'page view',\n data: { title: 'Docs', url: 'https://example.com/docs' },\n },\n ],\n ],\n};\n\nexport const batchRequest: Flow.StepExample = {\n title: 'Batch POST',\n description:\n 'A fetch POST with a batch array produces one walker elb event per batched item preserving order.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n url: 'http://localhost/collect',\n body: {\n batch: [\n { name: 'page view', data: { title: 'Home' } },\n { name: 'button click', data: { id: 'cta' } },\n ],\n },\n },\n out: [\n ['elb', { name: 'page view', data: { title: 'Home' } }],\n ['elb', { name: 'button click', data: { id: 'cta' } }],\n ],\n};\n\nexport const pixelGet: Flow.StepExample = {\n title: 'Pixel GET',\n description:\n 'A fetch GET with query parameters in the URL is parsed into an elb event payload for pixel-style tracking.',\n trigger: { type: 'GET' },\n in: {\n method: 'GET',\n url: 'http://localhost/collect?e=page+view&d=%7B%22title%22%3A%22Home%22%7D',\n },\n out: [\n [\n 'elb',\n {\n e: 'page view',\n d: '{\"title\":\"Home\"}',\n },\n ],\n ],\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\n\nexport interface Content {\n method: string;\n url: string;\n body?: unknown;\n headers?: Record<string, string>;\n}\n\nexport interface Result {\n status: number;\n body: unknown;\n headers: Record<string, string>;\n}\n\nfunction findFetchSource(collector: Collector.Instance) {\n for (const source of Object.values(collector.sources || {})) {\n if ((source as { type?: string }).type === 'fetch') return source;\n }\n}\n\nconst createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n }\n\n const source = findFetchSource(flow.collector);\n if (!source) throw new Error('Fetch source not found in collector');\n\n // Construct real Request from content\n const init: RequestInit = {\n method: content.method,\n headers: { 'Content-Type': 'application/json', ...content.headers },\n };\n if (content.method !== 'GET' && content.body !== undefined) {\n init.body = JSON.stringify(content.body);\n }\n const request = new Request(content.url, init);\n\n // Call source.push with the real Request\n const response = await (\n source as unknown as { push: (r: Request) => Promise<Response> }\n ).push(request);\n\n // Convert Response to serializable result\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((v, k) => {\n responseHeaders[k] = v;\n });\n\n const ct = response.headers.get('content-type') || '';\n const body = ct.includes('json')\n ? await response.json()\n : await response.text();\n\n return { status: response.status, body, headers: responseHeaders };\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\nexport { createTrigger };\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAEX,IAAM,aAAa,EAAE,KAAK;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,aAAa,EAAE,MAAM;AAAA,EAChC,EAAE,OAAO;AAAA,EACT,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,EAClB,EAAE,QAAQ,GAAG;AACf,CAAC;AAEM,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,QAAQ,WAAW,SAAS;AAAA,EAC5B,SAAS,EAAE,MAAM,UAAU,EAAE,SAAS;AAAA,EACtC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACtC,aAAa,EAAE,QAAQ,EAAE,SAAS;AAAA,EAClC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAC/C,CAAC;AAQM,IAAM,cAAc,EAAE,KAAK,CAAC,OAAO,MAAM,CAAC;AAK1C,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,MAAM,EACH,OAAO,EACP,SAAS,mDAAmD;AAAA,EAC/D,SAAS,EACN,MAAM,WAAW,EACjB,IAAI,CAAC,EACL,SAAS,2DAA2D,EACpE,SAAS;AACd,CAAC;;;ADxCM,IAAM,iBAAiBC,GAAE,OAAO;AAAA;AAAA,EAErC,MAAMA,GAAE,OAAO,EAAE,SAAS,+BAA+B,EAAE,SAAS;AAAA,EAEpE,OAAOA,GACJ,MAAMA,GAAE,MAAM,CAACA,GAAE,OAAO,G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,UAAM,WAAW,MACf,OACA,KAAK,OAAO;AAGd,UAAM,kBAA0C,CAAC;AACjD,aAAS,QAAQ,QAAQ,CAAC,GAAG,MAAM;AACjC,sBAAgB,CAAC,IAAI;AAAA,IACvB,CAAC;AAED,UAAM,KAAK,SAAS,QAAQ,IAAI,cAAc,KAAK;AACnD,UAAM,OAAO,GAAG,SAAS,MAAM,IAC3B,MAAM,SAAS,KAAK,IACpB,MAAM,SAAS,KAAK;AAExB,WAAO,EAAE,QAAQ,SAAS,QAAQ,MAAM,SAAS,gBAAgB;AAAA,EACnE;AAEF,SAAO;AAAA,IACL,IAAI,OAAO;AACT,aAAO;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;","names":["z","z","z"]}
package/dist/index.d.mts CHANGED
@@ -1,17 +1,6 @@
1
1
  import { Source, WalkerOS, Flow, Trigger } from '@walkeros/core';
2
- import * as _walkeros_core_dev from '@walkeros/core/dev';
3
2
  import { z } from '@walkeros/core/dev';
4
3
 
5
- declare const HttpMethod: z.ZodEnum<{
6
- GET: "GET";
7
- POST: "POST";
8
- PUT: "PUT";
9
- PATCH: "PATCH";
10
- DELETE: "DELETE";
11
- OPTIONS: "OPTIONS";
12
- HEAD: "HEAD";
13
- }>;
14
- declare const CorsOrigin: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodLiteral<"*">]>;
15
4
  declare const CorsOptionsSchema: z.ZodObject<{
16
5
  origin: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodLiteral<"*">]>>;
17
6
  methods: z.ZodOptional<z.ZodArray<z.ZodEnum<{
@@ -28,14 +17,6 @@ declare const CorsOptionsSchema: z.ZodObject<{
28
17
  maxAge: z.ZodOptional<z.ZodNumber>;
29
18
  }, z.core.$strip>;
30
19
  type CorsOptions$1 = z.infer<typeof CorsOptionsSchema>;
31
- /**
32
- * HTTP methods supported for route configuration.
33
- * OPTIONS is always handled for CORS (not user-configurable per route).
34
- */
35
- declare const RouteMethod$1: z.ZodEnum<{
36
- GET: "GET";
37
- POST: "POST";
38
- }>;
39
20
  /**
40
21
  * Route configuration for multi-path support.
41
22
  */
@@ -77,57 +58,15 @@ declare const SettingsSchema: z.ZodObject<{
77
58
  maxRequestSize: z.ZodDefault<z.ZodNumber>;
78
59
  maxBatchSize: z.ZodDefault<z.ZodNumber>;
79
60
  }, z.core.$strip>;
80
- type Settings$1 = z.infer<typeof SettingsSchema>;
81
-
82
- declare const EventSchema: z.ZodObject<{
83
- name: z.ZodString;
84
- data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodAny>]>>>;
85
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodAny>]>, z.ZodNumber], null>>>;
86
- globals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodAny>]>>>;
87
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodAny>]>>>;
88
- user: z.ZodOptional<z.ZodObject<{
89
- id: z.ZodOptional<z.ZodString>;
90
- device: z.ZodOptional<z.ZodString>;
91
- session: z.ZodOptional<z.ZodString>;
92
- email: z.ZodOptional<z.ZodString>;
93
- hash: z.ZodOptional<z.ZodString>;
94
- }, z.core.$loose>>;
95
- nested: z.ZodOptional<z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
96
- consent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
97
- id: z.ZodOptional<z.ZodString>;
98
- trigger: z.ZodOptional<z.ZodString>;
99
- entity: z.ZodOptional<z.ZodString>;
100
- action: z.ZodOptional<z.ZodString>;
101
- timestamp: z.ZodOptional<z.ZodNumber>;
102
- timing: z.ZodOptional<z.ZodNumber>;
103
- group: z.ZodOptional<z.ZodString>;
104
- count: z.ZodOptional<z.ZodNumber>;
105
- version: z.ZodOptional<z.ZodObject<{
106
- source: z.ZodString;
107
- tagging: z.ZodNumber;
108
- }, z.core.$strip>>;
109
- source: z.ZodOptional<z.ZodObject<{
110
- type: z.ZodString;
111
- id: z.ZodString;
112
- previous_id: z.ZodString;
113
- }, z.core.$loose>>;
114
- }, z.core.$loose>;
115
- type ValidatedEvent = z.infer<typeof EventSchema>;
116
61
 
117
- declare const settings: _walkeros_core_dev.JSONSchema;
118
-
119
- declare const index$1_CorsOptionsSchema: typeof CorsOptionsSchema;
120
- declare const index$1_CorsOrigin: typeof CorsOrigin;
121
- declare const index$1_EventSchema: typeof EventSchema;
122
- declare const index$1_HttpMethod: typeof HttpMethod;
123
- declare const index$1_RouteConfigSchema: typeof RouteConfigSchema;
124
- declare const index$1_SettingsSchema: typeof SettingsSchema;
125
- type index$1_ValidatedEvent = ValidatedEvent;
126
- declare const index$1_settings: typeof settings;
127
- declare namespace index$1 {
128
- export { type CorsOptions$1 as CorsOptions, index$1_CorsOptionsSchema as CorsOptionsSchema, index$1_CorsOrigin as CorsOrigin, index$1_EventSchema as EventSchema, index$1_HttpMethod as HttpMethod, index$1_RouteConfigSchema as RouteConfigSchema, RouteMethod$1 as RouteMethod, type Settings$1 as Settings, index$1_SettingsSchema as SettingsSchema, type index$1_ValidatedEvent as ValidatedEvent, index$1_settings as settings };
62
+ declare module '@walkeros/core' {
63
+ interface SourceMap {
64
+ fetch: {
65
+ type: 'fetch';
66
+ platform: 'server';
67
+ };
68
+ }
129
69
  }
130
-
131
70
  type Settings = z.infer<typeof SettingsSchema>;
132
71
  type CorsOptions = z.infer<typeof CorsOptionsSchema>;
133
72
  type RouteConfig = z.infer<typeof RouteConfigSchema>;
@@ -295,4 +234,4 @@ declare namespace index {
295
234
 
296
235
  declare const sourceFetch: Source.Init<Types>;
297
236
 
298
- export { type Config, type CorsOptions, type Env, type EventResponse, type FetchSource, type InitSettings, type Mapping, type PartialConfig, type Push, type RouteConfig, type RouteMethod, type Settings, types as SourceFetch, TRANSPARENT_GIF_BASE64, type Types, createCorsHeaders, createJsonResponse, createPixelResponse, sourceFetch as default, index as examples, matchPath, index$1 as schemas, sourceFetch };
237
+ export { type Config, type CorsOptions, type Env, type EventResponse, type FetchSource, type InitSettings, type Mapping, type PartialConfig, type Push, type RouteConfig, type RouteMethod, type Settings, types as SourceFetch, TRANSPARENT_GIF_BASE64, type Types, createCorsHeaders, createJsonResponse, createPixelResponse, sourceFetch as default, index as examples, matchPath, sourceFetch };
package/dist/index.d.ts CHANGED
@@ -1,17 +1,6 @@
1
1
  import { Source, WalkerOS, Flow, Trigger } from '@walkeros/core';
2
- import * as _walkeros_core_dev from '@walkeros/core/dev';
3
2
  import { z } from '@walkeros/core/dev';
4
3
 
5
- declare const HttpMethod: z.ZodEnum<{
6
- GET: "GET";
7
- POST: "POST";
8
- PUT: "PUT";
9
- PATCH: "PATCH";
10
- DELETE: "DELETE";
11
- OPTIONS: "OPTIONS";
12
- HEAD: "HEAD";
13
- }>;
14
- declare const CorsOrigin: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodLiteral<"*">]>;
15
4
  declare const CorsOptionsSchema: z.ZodObject<{
16
5
  origin: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodLiteral<"*">]>>;
17
6
  methods: z.ZodOptional<z.ZodArray<z.ZodEnum<{
@@ -28,14 +17,6 @@ declare const CorsOptionsSchema: z.ZodObject<{
28
17
  maxAge: z.ZodOptional<z.ZodNumber>;
29
18
  }, z.core.$strip>;
30
19
  type CorsOptions$1 = z.infer<typeof CorsOptionsSchema>;
31
- /**
32
- * HTTP methods supported for route configuration.
33
- * OPTIONS is always handled for CORS (not user-configurable per route).
34
- */
35
- declare const RouteMethod$1: z.ZodEnum<{
36
- GET: "GET";
37
- POST: "POST";
38
- }>;
39
20
  /**
40
21
  * Route configuration for multi-path support.
41
22
  */
@@ -77,57 +58,15 @@ declare const SettingsSchema: z.ZodObject<{
77
58
  maxRequestSize: z.ZodDefault<z.ZodNumber>;
78
59
  maxBatchSize: z.ZodDefault<z.ZodNumber>;
79
60
  }, z.core.$strip>;
80
- type Settings$1 = z.infer<typeof SettingsSchema>;
81
-
82
- declare const EventSchema: z.ZodObject<{
83
- name: z.ZodString;
84
- data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodAny>]>>>;
85
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodAny>]>, z.ZodNumber], null>>>;
86
- globals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodAny>]>>>;
87
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodAny>]>>>;
88
- user: z.ZodOptional<z.ZodObject<{
89
- id: z.ZodOptional<z.ZodString>;
90
- device: z.ZodOptional<z.ZodString>;
91
- session: z.ZodOptional<z.ZodString>;
92
- email: z.ZodOptional<z.ZodString>;
93
- hash: z.ZodOptional<z.ZodString>;
94
- }, z.core.$loose>>;
95
- nested: z.ZodOptional<z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
96
- consent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
97
- id: z.ZodOptional<z.ZodString>;
98
- trigger: z.ZodOptional<z.ZodString>;
99
- entity: z.ZodOptional<z.ZodString>;
100
- action: z.ZodOptional<z.ZodString>;
101
- timestamp: z.ZodOptional<z.ZodNumber>;
102
- timing: z.ZodOptional<z.ZodNumber>;
103
- group: z.ZodOptional<z.ZodString>;
104
- count: z.ZodOptional<z.ZodNumber>;
105
- version: z.ZodOptional<z.ZodObject<{
106
- source: z.ZodString;
107
- tagging: z.ZodNumber;
108
- }, z.core.$strip>>;
109
- source: z.ZodOptional<z.ZodObject<{
110
- type: z.ZodString;
111
- id: z.ZodString;
112
- previous_id: z.ZodString;
113
- }, z.core.$loose>>;
114
- }, z.core.$loose>;
115
- type ValidatedEvent = z.infer<typeof EventSchema>;
116
61
 
117
- declare const settings: _walkeros_core_dev.JSONSchema;
118
-
119
- declare const index$1_CorsOptionsSchema: typeof CorsOptionsSchema;
120
- declare const index$1_CorsOrigin: typeof CorsOrigin;
121
- declare const index$1_EventSchema: typeof EventSchema;
122
- declare const index$1_HttpMethod: typeof HttpMethod;
123
- declare const index$1_RouteConfigSchema: typeof RouteConfigSchema;
124
- declare const index$1_SettingsSchema: typeof SettingsSchema;
125
- type index$1_ValidatedEvent = ValidatedEvent;
126
- declare const index$1_settings: typeof settings;
127
- declare namespace index$1 {
128
- export { type CorsOptions$1 as CorsOptions, index$1_CorsOptionsSchema as CorsOptionsSchema, index$1_CorsOrigin as CorsOrigin, index$1_EventSchema as EventSchema, index$1_HttpMethod as HttpMethod, index$1_RouteConfigSchema as RouteConfigSchema, RouteMethod$1 as RouteMethod, type Settings$1 as Settings, index$1_SettingsSchema as SettingsSchema, type index$1_ValidatedEvent as ValidatedEvent, index$1_settings as settings };
62
+ declare module '@walkeros/core' {
63
+ interface SourceMap {
64
+ fetch: {
65
+ type: 'fetch';
66
+ platform: 'server';
67
+ };
68
+ }
129
69
  }
130
-
131
70
  type Settings = z.infer<typeof SettingsSchema>;
132
71
  type CorsOptions = z.infer<typeof CorsOptionsSchema>;
133
72
  type RouteConfig = z.infer<typeof RouteConfigSchema>;
@@ -295,4 +234,4 @@ declare namespace index {
295
234
 
296
235
  declare const sourceFetch: Source.Init<Types>;
297
236
 
298
- export { type Config, type CorsOptions, type Env, type EventResponse, type FetchSource, type InitSettings, type Mapping, type PartialConfig, type Push, type RouteConfig, type RouteMethod, type Settings, types as SourceFetch, TRANSPARENT_GIF_BASE64, type Types, createCorsHeaders, createJsonResponse, createPixelResponse, sourceFetch as default, index as examples, matchPath, index$1 as schemas, sourceFetch };
237
+ export { type Config, type CorsOptions, type Env, type EventResponse, type FetchSource, type InitSettings, type Mapping, type PartialConfig, type Push, type RouteConfig, type RouteMethod, type Settings, types as SourceFetch, TRANSPARENT_GIF_BASE64, type Types, createCorsHeaders, createJsonResponse, createPixelResponse, sourceFetch as default, index as examples, matchPath, sourceFetch };