@walkeros/server-source-fetch 1.0.5 → 1.1.0-next-1771252576264

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,6 +42,28 @@ const { elb } = await startFlow<SourceFetch.Push>({
42
42
  export default { fetch: elb };
43
43
  ```
44
44
 
45
+ ## Multi-Path with Method Control
46
+
47
+ ```typescript
48
+ const { sources } = await startFlow({
49
+ sources: {
50
+ api: {
51
+ code: sourceFetch,
52
+ config: {
53
+ settings: {
54
+ paths: [
55
+ '/collect', // GET + POST (default)
56
+ { path: '/pixel', methods: ['GET'] }, // GET only (pixel tracking)
57
+ { path: '/ingest', methods: ['POST'] }, // POST only (JSON ingestion)
58
+ { path: '/webhooks/*', methods: ['POST'] }, // POST wildcard
59
+ ],
60
+ },
61
+ },
62
+ },
63
+ },
64
+ });
65
+ ```
66
+
45
67
  ## Platform Deployment
46
68
 
47
69
  ### Cloudflare Workers
@@ -54,7 +76,7 @@ const { elb } = await startFlow<SourceFetch.Push>({
54
76
  sources: {
55
77
  api: {
56
78
  code: sourceFetch,
57
- config: { settings: { cors: true } },
79
+ config: { settings: { paths: ['/collect'], cors: true } },
58
80
  },
59
81
  },
60
82
  destinations: {
@@ -163,13 +185,31 @@ curl https://your-endpoint.com/health
163
185
 
164
186
  ```typescript
165
187
  interface Settings {
166
- path: string; // Collection path (default: '/collect')
188
+ /**
189
+ * Route paths to handle.
190
+ * String shorthand accepts GET+POST. RouteConfig allows per-route method control.
191
+ * @default ['/collect']
192
+ */
193
+ paths?: Array<string | RouteConfig>;
194
+
195
+ /**
196
+ * @deprecated Use `paths` instead. Converted to `paths: [path]` internally.
197
+ */
198
+ path?: string;
199
+
167
200
  cors: boolean | CorsOptions; // CORS config (default: true)
168
201
  healthPath: string; // Health check path (default: '/health')
169
202
  maxRequestSize: number; // Max bytes (default: 102400 = 100KB)
170
203
  maxBatchSize: number; // Max events per batch (default: 100)
171
204
  }
172
205
 
206
+ interface RouteConfig {
207
+ /** URL path pattern (supports wildcards like /api/*) */
208
+ path: string;
209
+ /** HTTP methods to accept. OPTIONS always included for CORS. */
210
+ methods?: ('GET' | 'POST')[];
211
+ }
212
+
173
213
  interface CorsOptions {
174
214
  origin?: string | string[] | '*';
175
215
  methods?: string[];
package/dist/dev.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as _walkeros_core_dev from '@walkeros/core/dev';
1
2
  import { z } from '@walkeros/core/dev';
2
3
  import { WalkerOS } from '@walkeros/core';
3
4
 
@@ -27,9 +28,37 @@ declare const CorsOptionsSchema: z.ZodObject<{
27
28
  maxAge: z.ZodOptional<z.ZodNumber>;
28
29
  }, z.core.$strip>;
29
30
  type CorsOptions = 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: z.ZodEnum<{
36
+ GET: "GET";
37
+ POST: "POST";
38
+ }>;
39
+ /**
40
+ * Route configuration for multi-path support.
41
+ */
42
+ declare const RouteConfigSchema: z.ZodObject<{
43
+ path: z.ZodString;
44
+ methods: z.ZodOptional<z.ZodArray<z.ZodEnum<{
45
+ GET: "GET";
46
+ POST: "POST";
47
+ }>>>;
48
+ }, z.core.$strip>;
30
49
 
50
+ /**
51
+ * Fetch source settings schema.
52
+ */
31
53
  declare const SettingsSchema: z.ZodObject<{
32
- path: z.ZodDefault<z.ZodString>;
54
+ path: z.ZodOptional<z.ZodString>;
55
+ paths: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
56
+ path: z.ZodString;
57
+ methods: z.ZodOptional<z.ZodArray<z.ZodEnum<{
58
+ GET: "GET";
59
+ POST: "POST";
60
+ }>>>;
61
+ }, z.core.$strip>]>>>;
33
62
  cors: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
34
63
  origin: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodLiteral<"*">]>>;
35
64
  methods: z.ZodOptional<z.ZodArray<z.ZodEnum<{
@@ -86,6 +115,23 @@ declare const EventSchema: z.ZodObject<{
86
115
  }, z.core.$loose>;
87
116
  type ValidatedEvent = z.infer<typeof EventSchema>;
88
117
 
118
+ declare const settings: _walkeros_core_dev.JSONSchema;
119
+
120
+ type index$1_CorsOptions = CorsOptions;
121
+ declare const index$1_CorsOptionsSchema: typeof CorsOptionsSchema;
122
+ declare const index$1_CorsOrigin: typeof CorsOrigin;
123
+ declare const index$1_EventSchema: typeof EventSchema;
124
+ declare const index$1_HttpMethod: typeof HttpMethod;
125
+ declare const index$1_RouteConfigSchema: typeof RouteConfigSchema;
126
+ declare const index$1_RouteMethod: typeof RouteMethod;
127
+ type index$1_Settings = Settings;
128
+ declare const index$1_SettingsSchema: typeof SettingsSchema;
129
+ type index$1_ValidatedEvent = ValidatedEvent;
130
+ declare const index$1_settings: typeof settings;
131
+ declare namespace index$1 {
132
+ export { type index$1_CorsOptions 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, index$1_RouteMethod as RouteMethod, type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, type index$1_ValidatedEvent as ValidatedEvent, index$1_settings as settings };
133
+ }
134
+
89
135
  /**
90
136
  * Example walkerOS events that HTTP clients send to this source.
91
137
  * These are the CONTRACT - tests verify implementation handles these inputs.
@@ -174,4 +220,4 @@ declare namespace index {
174
220
  export { index_inputs as inputs, index_requests as requests };
175
221
  }
176
222
 
177
- export { type CorsOptions, CorsOptionsSchema, CorsOrigin, EventSchema, HttpMethod, type Settings, SettingsSchema, type ValidatedEvent, index as examples };
223
+ export { index as examples, index$1 as schemas };
package/dist/dev.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as _walkeros_core_dev from '@walkeros/core/dev';
1
2
  import { z } from '@walkeros/core/dev';
2
3
  import { WalkerOS } from '@walkeros/core';
3
4
 
@@ -27,9 +28,37 @@ declare const CorsOptionsSchema: z.ZodObject<{
27
28
  maxAge: z.ZodOptional<z.ZodNumber>;
28
29
  }, z.core.$strip>;
29
30
  type CorsOptions = 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: z.ZodEnum<{
36
+ GET: "GET";
37
+ POST: "POST";
38
+ }>;
39
+ /**
40
+ * Route configuration for multi-path support.
41
+ */
42
+ declare const RouteConfigSchema: z.ZodObject<{
43
+ path: z.ZodString;
44
+ methods: z.ZodOptional<z.ZodArray<z.ZodEnum<{
45
+ GET: "GET";
46
+ POST: "POST";
47
+ }>>>;
48
+ }, z.core.$strip>;
30
49
 
50
+ /**
51
+ * Fetch source settings schema.
52
+ */
31
53
  declare const SettingsSchema: z.ZodObject<{
32
- path: z.ZodDefault<z.ZodString>;
54
+ path: z.ZodOptional<z.ZodString>;
55
+ paths: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
56
+ path: z.ZodString;
57
+ methods: z.ZodOptional<z.ZodArray<z.ZodEnum<{
58
+ GET: "GET";
59
+ POST: "POST";
60
+ }>>>;
61
+ }, z.core.$strip>]>>>;
33
62
  cors: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
34
63
  origin: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodLiteral<"*">]>>;
35
64
  methods: z.ZodOptional<z.ZodArray<z.ZodEnum<{
@@ -86,6 +115,23 @@ declare const EventSchema: z.ZodObject<{
86
115
  }, z.core.$loose>;
87
116
  type ValidatedEvent = z.infer<typeof EventSchema>;
88
117
 
118
+ declare const settings: _walkeros_core_dev.JSONSchema;
119
+
120
+ type index$1_CorsOptions = CorsOptions;
121
+ declare const index$1_CorsOptionsSchema: typeof CorsOptionsSchema;
122
+ declare const index$1_CorsOrigin: typeof CorsOrigin;
123
+ declare const index$1_EventSchema: typeof EventSchema;
124
+ declare const index$1_HttpMethod: typeof HttpMethod;
125
+ declare const index$1_RouteConfigSchema: typeof RouteConfigSchema;
126
+ declare const index$1_RouteMethod: typeof RouteMethod;
127
+ type index$1_Settings = Settings;
128
+ declare const index$1_SettingsSchema: typeof SettingsSchema;
129
+ type index$1_ValidatedEvent = ValidatedEvent;
130
+ declare const index$1_settings: typeof settings;
131
+ declare namespace index$1 {
132
+ export { type index$1_CorsOptions 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, index$1_RouteMethod as RouteMethod, type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, type index$1_ValidatedEvent as ValidatedEvent, index$1_settings as settings };
133
+ }
134
+
89
135
  /**
90
136
  * Example walkerOS events that HTTP clients send to this source.
91
137
  * These are the CONTRACT - tests verify implementation handles these inputs.
@@ -174,4 +220,4 @@ declare namespace index {
174
220
  export { index_inputs as inputs, index_requests as requests };
175
221
  }
176
222
 
177
- export { type CorsOptions, CorsOptionsSchema, CorsOrigin, EventSchema, HttpMethod, type Settings, SettingsSchema, type ValidatedEvent, index as examples };
223
+ export { index as examples, index$1 as schemas };
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,{CorsOptionsSchema:()=>c,CorsOrigin:()=>p,EventSchema:()=>x,HttpMethod:()=>l,SettingsSchema:()=>u,examples:()=>f}),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=require("@walkeros/core/dev"),l=s.z.enum(["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"]),p=s.z.union([s.z.string(),s.z.array(s.z.string()),s.z.literal("*")]),c=s.z.object({origin:p.optional(),methods:s.z.array(l).optional(),headers:s.z.array(s.z.string()).optional(),credentials:s.z.boolean().optional(),maxAge:s.z.number().int().positive().optional()}),m=require("@walkeros/core/dev"),u=m.z.object({path:m.z.string().default("/collect"),cors:m.z.union([m.z.boolean(),c]).default(!0),healthPath:m.z.string().default("/health"),maxRequestSize:m.z.number().int().positive().default(102400),maxBatchSize:m.z.number().int().positive().default(100)}),d=require("@walkeros/core/dev"),g=d.z.record(d.z.string(),d.z.union([d.z.string(),d.z.number(),d.z.boolean(),d.z.record(d.z.string(),d.z.any())])),z=d.z.record(d.z.string(),d.z.tuple([d.z.union([d.z.string(),d.z.number(),d.z.boolean(),d.z.record(d.z.string(),d.z.any())]),d.z.number()])),h=d.z.object({id:d.z.string().optional(),device:d.z.string().optional(),session:d.z.string().optional(),email:d.z.string().optional(),hash:d.z.string().optional()}).passthrough(),b=d.z.record(d.z.string(),d.z.boolean()),y=d.z.lazy(()=>d.z.object({entity:d.z.string(),data:g.optional(),nested:d.z.array(y).optional(),context:z.optional()}).passthrough()),v=d.z.object({source:d.z.string(),tagging:d.z.number()}),O=d.z.object({type:d.z.string(),id:d.z.string(),previous_id:d.z.string()}).passthrough(),x=d.z.object({name:d.z.string().min(1,"Event name is required"),data:g.optional(),context:z.optional(),globals:g.optional(),custom:g.optional(),user:h.optional(),nested:d.z.array(y).optional(),consent:b.optional(),id:d.z.string().optional(),trigger:d.z.string().optional(),entity:d.z.string().optional(),action:d.z.string().optional(),timestamp:d.z.number().optional(),timing:d.z.number().optional(),group:d.z.string().optional(),count:d.z.number().optional(),version:v.optional(),source:O.optional()}).passthrough(),f={};i(f,{inputs:()=>P,requests:()=>w});var P={};i(P,{batch:()=>E,completeEvent:()=>T,minimal:()=>q,pageView:()=>S,productAdd:()=>j});var S={name:"page view",data:{title:"Home Page",path:"/",referrer:"https://google.com"},user:{id:"user-123",session:"session-456"},timestamp:17e11},j={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}},T={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"},q={name:"ping"},E=[S,j,{name:"button click",data:{id:"cta"}}],w={};i(w,{batchPostRequest:()=>R,healthCheckRequest:()=>H,invalidJsonRequest:()=>N,optionsRequest:()=>D,oversizedRequest:()=>A,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"}})},R={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"},H={method:"GET",url:"https://example.com/health"},D={method:"OPTIONS",url:"https://example.com/collect",headers:{Origin:"https://example.com"}},N={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:"invalid json{"},A={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"test",data:{payload:"x".repeat(2e5)}})};//# sourceMappingURL=dev.js.map
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:()=>q,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:()=>z,RouteMethod:()=>g,SettingsSchema:()=>h,settings:()=>j});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"]),z=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()}),h=c.z.object({path:c.z.string().describe("Deprecated: use paths instead").optional(),paths:c.z.array(c.z.union([c.z.string(),z])).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),healthPath:c.z.string().describe("Health check endpoint path").default("/health"),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()])),O=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(),S=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()),f=b.z.object({source:b.z.string(),tagging:b.z.number()}),P=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:O.optional(),nested:b.z.array(T).optional(),consent:S.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:f.optional(),source:P.optional()}).passthrough(),j=(0,l.zodToSchema)(h),q={};i(q,{inputs:()=>R,requests:()=>D});var R={};i(R,{batch:()=>H,completeEvent:()=>k,minimal:()=>C,pageView:()=>w,productAdd:()=>E});var w={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}},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=[w,E,{name:"button click",data:{id:"cta"}}],D={};i(D,{batchPostRequest:()=>G,healthCheckRequest:()=>M,invalidJsonRequest:()=>I,optionsRequest:()=>U,oversizedRequest:()=>J,pixelGetRequest:()=>A,validPostRequest:()=>N});var N={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"page view",data:{title:"Home"}})},G={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"},M={method:"GET",url:"https://example.com/health"},U={method:"OPTIONS",url:"https://example.com/collect",headers:{Origin:"https://example.com"}},I={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:"invalid json{"},J={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"test",data:{payload:"x".repeat(2e5)}})};//# sourceMappingURL=dev.js.map
package/dist/dev.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dev.ts","../src/schemas/primitives.ts","../src/schemas/settings.ts","../src/schemas/event.ts","../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/requests.ts"],"sourcesContent":["export * from './schemas';\nexport * as examples from './examples';\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","import { z } from '@walkeros/core/dev';\nimport { CorsOptionsSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n path: z.string().default('/collect'),\n cors: z.union([z.boolean(), CorsOptionsSchema]).default(true),\n healthPath: z.string().default('/health'),\n maxRequestSize: z\n .number()\n .int()\n .positive()\n .default(1024 * 100), // 100KB\n maxBatchSize: z.number().int().positive().default(100), // 100 events\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\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';\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,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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9C,MAAM,KAAK,UAAU;AAAA,IACnB,OAAO;AAAA,MACL,EAAE,MAAM,aAAa,MAAM,EAAE,OAAO,OAAO,EAAE;AAAA,MAC7C,EAAE,MAAM,gBAAgB,MAAM,EAAE,IAAI,MAAM,EAAE;AAAA,IAC9C;AAAA,EACF,CAAC;AACH;AAEO,IAAM,kBAAkB;AAAA,EAC7B,QAAQ;AAAA,EACR,KAAK;AACP;AAEO,IAAM,qBAAqB;AAAA,EAChC,QAAQ;AAAA,EACR,KAAK;AACP;AAEO,IAAM,iBAAiB;AAAA,EAC5B,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS,EAAE,QAAQ,sBAAsB;AAC3C;AAEO,IAAM,qBAAqB;AAAA,EAChC,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,EAC9C,MAAM;AACR;AAEO,IAAM,mBAAmB;AAAA,EAC9B,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,EAC9C,MAAM,KAAK,UAAU;AAAA,IACnB,MAAM;AAAA,IACN,MAAM,EAAE,SAAS,IAAI,OAAO,GAAM,EAAE;AAAA;AAAA,EACtC,CAAC;AACH;","names":["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"],"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 healthPath: z\n .string()\n .describe('Health check endpoint path')\n .default('/health'),\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';\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"],"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,Q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AAM,KAAK,UAAU;AAAA,IACnB,MAAM;AAAA,IACN,MAAM,EAAE,OAAO,OAAO;AAAA,EACxB,CAAC;AACH;AAEO,IAAM,mBAAmB;AAAA,EAC9B,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,EAC9C,MAAM,KAAK,UAAU;AAAA,IACnB,OAAO;AAAA,MACL,EAAE,MAAM,aAAa,MAAM,EAAE,OAAO,OAAO,EAAE;AAAA,MAC7C,EAAE,MAAM,gBAAgB,MAAM,EAAE,IAAI,MAAM,EAAE;AAAA,IAC9C;AAAA,EACF,CAAC;AACH;AAEO,IAAM,kBAAkB;AAAA,EAC7B,QAAQ;AAAA,EACR,KAAK;AACP;AAEO,IAAM,qBAAqB;AAAA,EAChC,QAAQ;AAAA,EACR,KAAK;AACP;AAEO,IAAM,iBAAiB;AAAA,EAC5B,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS,EAAE,QAAQ,sBAAsB;AAC3C;AAEO,IAAM,qBAAqB;AAAA,EAChC,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,EAC9C,MAAM;AACR;AAEO,IAAM,mBAAmB;AAAA,EAC9B,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,EAC9C,MAAM,KAAK,UAAU;AAAA,IACnB,MAAM;AAAA,IACN,MAAM,EAAE,SAAS,IAAI,OAAO,GAAM,EAAE;AAAA;AAAA,EACtC,CAAC;AACH;","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})};import{z as o}from"@walkeros/core/dev";var a=o.enum(["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"]),n=o.union([o.string(),o.array(o.string()),o.literal("*")]),i=o.object({origin:n.optional(),methods:o.array(a).optional(),headers:o.array(o.string()).optional(),credentials:o.boolean().optional(),maxAge:o.number().int().positive().optional()});import{z as r}from"@walkeros/core/dev";var s=r.object({path:r.string().default("/collect"),cors:r.union([r.boolean(),i]).default(!0),healthPath:r.string().default("/health"),maxRequestSize:r.number().int().positive().default(102400),maxBatchSize:r.number().int().positive().default(100)});import{z as l}from"@walkeros/core/dev";var p=l.record(l.string(),l.union([l.string(),l.number(),l.boolean(),l.record(l.string(),l.any())])),c=l.record(l.string(),l.tuple([l.union([l.string(),l.number(),l.boolean(),l.record(l.string(),l.any())]),l.number()])),m=l.object({id:l.string().optional(),device:l.string().optional(),session:l.string().optional(),email:l.string().optional(),hash:l.string().optional()}).passthrough(),d=l.record(l.string(),l.boolean()),u=l.lazy(()=>l.object({entity:l.string(),data:p.optional(),nested:l.array(u).optional(),context:c.optional()}).passthrough()),g=l.object({source:l.string(),tagging:l.number()}),h=l.object({type:l.string(),id:l.string(),previous_id:l.string()}).passthrough(),b=l.object({name:l.string().min(1,"Event name is required"),data:p.optional(),context:c.optional(),globals:p.optional(),custom:p.optional(),user:m.optional(),nested:l.array(u).optional(),consent:d.optional(),id:l.string().optional(),trigger:l.string().optional(),entity:l.string().optional(),action:l.string().optional(),timestamp:l.number().optional(),timing:l.number().optional(),group:l.string().optional(),count:l.number().optional(),version:g.optional(),source:h.optional()}).passthrough(),y={};t(y,{inputs:()=>v,requests:()=>S});var v={};t(v,{batch:()=>O,completeEvent:()=>f,minimal:()=>P,pageView:()=>x,productAdd:()=>T});var x={name:"page view",data:{title:"Home Page",path:"/",referrer:"https://google.com"},user:{id:"user-123",session:"session-456"},timestamp:17e11},T={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}},f={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"},P={name:"ping"},O=[x,T,{name:"button click",data:{id:"cta"}}],S={};t(S,{batchPostRequest:()=>q,healthCheckRequest:()=>k,invalidJsonRequest:()=>w,optionsRequest:()=>R,oversizedRequest:()=>z,pixelGetRequest:()=>E,validPostRequest:()=>j});var j={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"}}]})},E={method:"GET",url:"https://example.com/collect?event=page%20view&data[title]=Home&user[id]=user123"},k={method:"GET",url:"https://example.com/health"},R={method:"OPTIONS",url:"https://example.com/collect",headers:{Origin:"https://example.com"}},w={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:"invalid json{"},z={method:"POST",url:"https://example.com/collect",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"test",data:{payload:"x".repeat(2e5)}})};export{i as CorsOptionsSchema,n as CorsOrigin,b as EventSchema,a as HttpMethod,s as SettingsSchema,y as examples};//# 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:()=>T,HttpMethod:()=>r,RouteConfigSchema:()=>c,RouteMethod:()=>p,SettingsSchema:()=>m,settings:()=>O});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()}),p=i.enum(["GET","POST"]),c=i.object({path:i.string().describe("URL path pattern (supports wildcards like /api/*)"),methods:i.array(p).min(1).describe("HTTP methods to accept. OPTIONS always included for CORS.").optional()}),m=n.object({path:n.string().describe("Deprecated: use paths instead").optional(),paths:n.array(n.union([n.string(),c])).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),healthPath:n.string().describe("Health check endpoint path").default("/health"),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 d}from"@walkeros/core/dev";var u=d.record(d.string(),d.union([d.string(),d.number(),d.boolean(),d.record(d.string(),d.any())])),g=d.record(d.string(),d.tuple([d.union([d.string(),d.number(),d.boolean(),d.record(d.string(),d.any())]),d.number()])),h=d.object({id:d.string().optional(),device:d.string().optional(),session:d.string().optional(),email:d.string().optional(),hash:d.string().optional()}).passthrough(),b=d.record(d.string(),d.boolean()),y=d.lazy(()=>d.object({entity:d.string(),data:u.optional(),nested:d.array(y).optional(),context:g.optional()}).passthrough()),v=d.object({source:d.string(),tagging:d.number()}),S=d.object({type:d.string(),id:d.string(),previous_id:d.string()}).passthrough(),T=d.object({name:d.string().min(1,"Event name is required"),data:u.optional(),context:g.optional(),globals:u.optional(),custom:u.optional(),user:h.optional(),nested:d.array(y).optional(),consent:b.optional(),id:d.string().optional(),trigger:d.string().optional(),entity:d.string().optional(),action:d.string().optional(),timestamp:d.number().optional(),timing:d.number().optional(),group:d.string().optional(),count:d.number().optional(),version:v.optional(),source:S.optional()}).passthrough(),O=a(m),f={};t(f,{inputs:()=>x,requests:()=>q});var x={};t(x,{batch:()=>k,completeEvent:()=>j,minimal:()=>E,pageView:()=>P,productAdd:()=>R});var P={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}},j={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"},E={name:"ping"},k=[P,R,{name:"button click",data:{id:"cta"}}],q={};t(q,{batchPostRequest:()=>C,healthCheckRequest:()=>z,invalidJsonRequest:()=>G,optionsRequest:()=>D,oversizedRequest:()=>N,pixelGetRequest:()=>H,validPostRequest:()=>w});var w={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"},z={method:"GET",url:"https://example.com/health"},D={method:"OPTIONS",url:"https://example.com/collect",headers:{Origin:"https://example.com"}},G={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)}})};export{f as examples,o as schemas};//# sourceMappingURL=dev.mjs.map
package/dist/dev.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schemas/primitives.ts","../src/schemas/settings.ts","../src/schemas/event.ts","../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/requests.ts"],"sourcesContent":["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","import { z } from '@walkeros/core/dev';\nimport { CorsOptionsSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n path: z.string().default('/collect'),\n cors: z.union([z.boolean(), CorsOptionsSchema]).default(true),\n healthPath: z.string().default('/health'),\n maxRequestSize: z\n .number()\n .int()\n .positive()\n .default(1024 * 100), // 100KB\n maxBatchSize: z.number().int().positive().default(100), // 100 events\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\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';\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"],"mappings":";;;;;;;AAAA,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;;;ACxBD,SAAS,KAAAA,UAAS;AAGX,IAAM,iBAAiBC,GAAE,OAAO;AAAA,EACrC,MAAMA,GAAE,OAAO,EAAE,QAAQ,UAAU;AAAA,EACnC,MAAMA,GAAE,MAAM,CAACA,GAAE,QAAQ,GAAG,iBAAiB,CAAC,EAAE,QAAQ,IAAI;AAAA,EAC5D,YAAYA,GAAE,OAAO,EAAE,QAAQ,SAAS;AAAA,EACxC,gBAAgBA,GACb,OAAO,EACP,IAAI,EACJ,SAAS,EACT,QAAQ,OAAO,GAAG;AAAA;AAAA,EACrB,cAAcA,GAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,GAAG;AAAA;AACvD,CAAC;;;ACbD,SAAS,KAAAC,UAAS;AAGl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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"],"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 healthPath: z\n .string()\n .describe('Health check endpoint path')\n .default('/health'),\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';\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"],"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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,gBAAgB,mBAAmB;AAAA,EAC9C,MAAM,KAAK,UAAU;AAAA,IACnB,MAAM;AAAA,IACN,MAAM,EAAE,SAAS,IAAI,OAAO,GAAM,EAAE;AAAA;AAAA,EACtC,CAAC;AACH;","names":["z","z","z"]}
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Source, WalkerOS } from '@walkeros/core';
2
+ import * as _walkeros_core_dev from '@walkeros/core/dev';
2
3
  import { z } from '@walkeros/core/dev';
3
4
 
4
5
  declare const HttpMethod: z.ZodEnum<{
@@ -27,9 +28,37 @@ declare const CorsOptionsSchema: z.ZodObject<{
27
28
  maxAge: z.ZodOptional<z.ZodNumber>;
28
29
  }, z.core.$strip>;
29
30
  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
+ /**
40
+ * Route configuration for multi-path support.
41
+ */
42
+ declare const RouteConfigSchema: z.ZodObject<{
43
+ path: z.ZodString;
44
+ methods: z.ZodOptional<z.ZodArray<z.ZodEnum<{
45
+ GET: "GET";
46
+ POST: "POST";
47
+ }>>>;
48
+ }, z.core.$strip>;
30
49
 
50
+ /**
51
+ * Fetch source settings schema.
52
+ */
31
53
  declare const SettingsSchema: z.ZodObject<{
32
- path: z.ZodDefault<z.ZodString>;
54
+ path: z.ZodOptional<z.ZodString>;
55
+ paths: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
56
+ path: z.ZodString;
57
+ methods: z.ZodOptional<z.ZodArray<z.ZodEnum<{
58
+ GET: "GET";
59
+ POST: "POST";
60
+ }>>>;
61
+ }, z.core.$strip>]>>>;
33
62
  cors: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
34
63
  origin: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodLiteral<"*">]>>;
35
64
  methods: z.ZodOptional<z.ZodArray<z.ZodEnum<{
@@ -86,18 +115,24 @@ declare const EventSchema: z.ZodObject<{
86
115
  }, z.core.$loose>;
87
116
  type ValidatedEvent = z.infer<typeof EventSchema>;
88
117
 
118
+ declare const settings: _walkeros_core_dev.JSONSchema;
119
+
89
120
  declare const index$1_CorsOptionsSchema: typeof CorsOptionsSchema;
90
121
  declare const index$1_CorsOrigin: typeof CorsOrigin;
91
122
  declare const index$1_EventSchema: typeof EventSchema;
92
123
  declare const index$1_HttpMethod: typeof HttpMethod;
124
+ declare const index$1_RouteConfigSchema: typeof RouteConfigSchema;
93
125
  declare const index$1_SettingsSchema: typeof SettingsSchema;
94
126
  type index$1_ValidatedEvent = ValidatedEvent;
127
+ declare const index$1_settings: typeof settings;
95
128
  declare namespace index$1 {
96
- 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, type Settings$1 as Settings, index$1_SettingsSchema as SettingsSchema, type index$1_ValidatedEvent as ValidatedEvent };
129
+ 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 };
97
130
  }
98
131
 
99
132
  type Settings = z.infer<typeof SettingsSchema>;
100
133
  type CorsOptions = z.infer<typeof CorsOptionsSchema>;
134
+ type RouteConfig = z.infer<typeof RouteConfigSchema>;
135
+ type RouteMethod = 'GET' | 'POST';
101
136
  type InitSettings = Partial<Settings>;
102
137
  interface Mapping {
103
138
  }
@@ -127,16 +162,23 @@ type types_InitSettings = InitSettings;
127
162
  type types_Mapping = Mapping;
128
163
  type types_PartialConfig = PartialConfig;
129
164
  type types_Push = Push;
165
+ type types_RouteConfig = RouteConfig;
166
+ type types_RouteMethod = RouteMethod;
130
167
  type types_Settings = Settings;
131
168
  type types_Types = Types;
132
169
  declare namespace types {
133
- export type { types_Config as Config, types_CorsOptions as CorsOptions, types_Env as Env, types_EventResponse as EventResponse, types_FetchSource as FetchSource, types_InitSettings as InitSettings, types_Mapping as Mapping, types_PartialConfig as PartialConfig, types_Push as Push, types_Settings as Settings, types_Types as Types };
170
+ export type { types_Config as Config, types_CorsOptions as CorsOptions, types_Env as Env, types_EventResponse as EventResponse, types_FetchSource as FetchSource, types_InitSettings as InitSettings, types_Mapping as Mapping, types_PartialConfig as PartialConfig, types_Push as Push, types_RouteConfig as RouteConfig, types_RouteMethod as RouteMethod, types_Settings as Settings, types_Types as Types };
134
171
  }
135
172
 
136
173
  declare function createCorsHeaders(corsConfig?: boolean | CorsOptions$1, requestOrigin?: string | null): Headers;
137
174
  declare const TRANSPARENT_GIF_BASE64 = "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
138
175
  declare function createPixelResponse(corsHeaders?: Headers): Response;
139
176
  declare function createJsonResponse(body: unknown, status?: number, corsHeaders?: Headers): Response;
177
+ /**
178
+ * Match a request pathname against a route pattern.
179
+ * Supports exact matches and wildcard patterns (e.g., /api/*).
180
+ */
181
+ declare function matchPath(requestPath: string, pattern: string): boolean;
140
182
 
141
183
  /**
142
184
  * Example walkerOS events that HTTP clients send to this source.
@@ -228,4 +270,4 @@ declare namespace index {
228
270
 
229
271
  declare const sourceFetch: Source.Init<Types>;
230
272
 
231
- export { type Config, type CorsOptions, type Env, type EventResponse, type FetchSource, type InitSettings, type Mapping, type PartialConfig, type Push, type Settings, types as SourceFetch, TRANSPARENT_GIF_BASE64, type Types, createCorsHeaders, createJsonResponse, createPixelResponse, sourceFetch as default, index as examples, index$1 as schemas, sourceFetch };
273
+ 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 };