@walkeros/server-source-express 4.7.0-next-1790187973605 → 4.7.0-next-1790722899482

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/CHANGELOG.md CHANGED
@@ -1,27 +1,35 @@
1
1
  # @walkeros/server-source-express
2
2
 
3
- ## 4.7.0-next-1790187973605
4
-
5
- ### Patch Changes
6
-
7
- - 8f8aea6: POST bodies sent as `text/plain` that are not JSON, such as GA4 gtag
8
- batches, no longer fail with 400. They reach `ingest.body` as the raw string,
9
- so `@walkeros/transformer-ga4` now decodes batched hits. sendBeacon JSON is
10
- parsed as before, and malformed `application/json` is still rejected with 400.
11
- - Updated dependencies [57788bc]
12
- - Updated dependencies [2aebc53]
13
- - Updated dependencies [f5a1cfd]
14
- - Updated dependencies [ef02916]
15
- - Updated dependencies [ef02916]
16
- - Updated dependencies [2aebc53]
17
- - Updated dependencies [f5a1cfd]
18
- - Updated dependencies [f5a1cfd]
19
- - Updated dependencies [2aebc53]
20
- - Updated dependencies [8f8aea6]
21
- - Updated dependencies [2aebc53]
22
- - Updated dependencies [2aebc53]
23
- - @walkeros/core@4.7.0-next-1790187973605
24
- - @walkeros/collector@4.7.0-next-1790187973605
3
+ ## 4.7.0-next-1790722899482
4
+
5
+ ### Patch Changes
6
+
7
+ - 74821ed: The express source passes non-JSON `text/plain` bodies, such as
8
+ batched gtag hits, to `ingest.body` instead of failing with 400.
9
+ `@walkeros/transformer-ga4` gives each decoded event its own stable id, caps
10
+ one request at `settings.maxEvents` (default 100), validates
11
+ `settings.mapping` rules, and its wiring hint sets `paths: ["/g/collect"]`.
12
+ - 74821ed: Simulate starts only the simulated step, and a simulated transformer
13
+ continues through its `next`. Source simulations list the commands a source
14
+ issues as `elb` calls; `--page-url` sets the web page. Express flows need no
15
+ port. Packages with several exports use per-export examples and mocks, and a
16
+ destination without a mock env is refused instead of calling the vendor.
17
+ - Updated dependencies [74821ed]
18
+ - Updated dependencies [06b498a]
19
+ - Updated dependencies [74821ed]
20
+ - Updated dependencies [74821ed]
21
+ - Updated dependencies [74821ed]
22
+ - Updated dependencies [74821ed]
23
+ - Updated dependencies [06b498a]
24
+ - Updated dependencies [74821ed]
25
+ - Updated dependencies [74821ed]
26
+ - Updated dependencies [74821ed]
27
+ - Updated dependencies [74821ed]
28
+ - Updated dependencies [74821ed]
29
+ - Updated dependencies [74821ed]
30
+ - Updated dependencies [74821ed]
31
+ - @walkeros/collector@4.7.0-next-1790722899482
32
+ - @walkeros/core@4.7.0-next-1790722899482
25
33
 
26
34
  ## 4.6.1
27
35
 
package/dist/dev.d.mts CHANGED
@@ -135,7 +135,7 @@ interface Result {
135
135
  * Boots a real express server via startFlow, then fires real HTTP requests.
136
136
  * Blackbox: no source instance access, no mocked req/res — just fetch().
137
137
  *
138
- * Pass `port: 0` in the express source settings to use a random available port.
138
+ * Without `settings.port` the triggered source listens on a free port.
139
139
  *
140
140
  * @example
141
141
  * const { trigger, flow } = await createTrigger(config);
package/dist/dev.d.ts CHANGED
@@ -135,7 +135,7 @@ interface Result {
135
135
  * Boots a real express server via startFlow, then fires real HTTP requests.
136
136
  * Blackbox: no source instance access, no mocked req/res — just fetch().
137
137
  *
138
- * Pass `port: 0` in the express source settings to use a random available port.
138
+ * Without `settings.port` the triggered source listens on a free port.
139
139
  *
140
140
  * @example
141
141
  * const { trigger, flow } = await createTrigger(config);
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,s=(e,o)=>{for(var r in o)t(e,r,{get:o[r],enumerable:!0})},i={};s(i,{examples:()=>y,schemas:()=>n}),module.exports=(e=i,((e,s,i,n)=>{if(s&&"object"==typeof s||"function"==typeof s)for(let l of r(s))a.call(e,l)||l===i||t(e,l,{get:()=>s[l],enumerable:!(n=o(s,l))||n.enumerable});return e})(t({},"__esModule",{value:!0}),e));var n={};s(n,{CorsOptionsSchema:()=>b,CorsOrigin:()=>m,HttpMethod:()=>p,RouteConfigSchema:()=>h,RouteMethod:()=>u,SettingsSchema:()=>g,settings:()=>f});var l=require("@walkeros/core/dev"),c=require("@walkeros/core/dev"),d=require("@walkeros/core/dev"),p=d.z.enum(["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"]),u=d.z.enum(["GET","POST"]),h=d.z.object({path:d.z.string().describe("Express route path (supports wildcards like /api/*)"),methods:d.z.array(u).min(1).describe("HTTP methods to register. OPTIONS always included for CORS.").optional()}),m=d.z.union([d.z.string(),d.z.array(d.z.string()),d.z.literal("*")]),b=d.z.object({origin:m.describe("Allowed origins (* for all, URL string, or array of URLs)").optional(),methods:d.z.array(p).describe("Allowed HTTP methods").optional(),headers:d.z.array(d.z.string()).describe("Allowed request headers").optional(),credentials:d.z.boolean().describe("Allow credentials (cookies, authorization headers)").optional(),maxAge:d.z.number().int().positive().describe("Preflight cache duration in seconds").optional()}),g=c.z.object({port:c.z.number().int().min(0).max(65535).describe("HTTP server port to listen on. Use 0 for random available port. If not provided, server will not start (app only mode)").optional(),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 register. String shorthand registers GET+POST. RouteConfig allows per-route method control.").optional(),maxBatchSize:c.z.number().int().min(1).describe("Maximum number of events accepted in a single batch request").default(100),cors:c.z.union([c.z.boolean(),b]).describe("CORS configuration: false = disabled, true = allow all origins (default), object = custom configuration").default(!0)}),f=(0,l.zodToSchema)(g),y={};s(y,{createTrigger:()=>O,step:()=>w});var w={};s(w,{pixelGet:()=>T,postEvent:()=>v});var v={title:"POST event",description:"An Express POST to /collect with a JSON body becomes a single walker elb event.",trigger:{type:"POST"},in:{method:"POST",path:"/collect",body:{name:"page view",data:{title:"Home",url:"https://example.com/"}}},out:[["elb",{name:"page view",data:{title:"Home",url:"https://example.com/"}}]]},T={title:"Pixel GET",description:"An Express GET to /collect with query parameters is parsed into an elb event payload for pixel tracking.",trigger:{type:"GET"},in:{method:"GET",path:"/collect",query:{e:"page view",d:'{"title":"Home"}'}},out:[["elb",{e:"page view",d:'{"title":"Home"}'}]]},z=require("@walkeros/collector");var O=async e=>{let t,o;return{get flow(){return t},trigger:()=>async r=>{const a=r.method||"POST";if(!t){const r=await(0,z.startFlow)(e);t={collector:r.collector,elb:r.elb};const a=function(e){for(const t of Object.values(e.sources||{})){const e=t;if(e.server){const t=e.server.address();if("object"==typeof t&&null!==t)return t.port}}}(r.collector);if(!a)throw new Error("Express source server not found — ensure port is configured in source settings");o=`http://localhost:${a}`}let s=`${o}${r.path}`;r.query&&(s+=`?${new URLSearchParams(r.query).toString()}`);const i={method:a,headers:{...r.headers&&Object.keys(r.headers).some(e=>"content-type"===e.toLowerCase())?{}:{"Content-Type":"application/json"},...r.headers}};"GET"!==a&&"HEAD"!==a&&void 0!==r.body&&(i.body="string"==typeof r.body?r.body:JSON.stringify(r.body));const n=await fetch(s,i),l={};let c;n.headers.forEach((e,t)=>{l[t]=e});return c=(n.headers.get("content-type")||"").includes("application/json")?await n.json():await n.text(),{status:n.status,body:c,headers:l}}}};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,i=(e,o)=>{for(var r in o)t(e,r,{get:o[r],enumerable:!0})},a={};i(a,{examples:()=>y,schemas:()=>n}),module.exports=(e=a,((e,i,a,n)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let l of r(i))s.call(e,l)||l===a||t(e,l,{get:()=>i[l],enumerable:!(n=o(i,l))||n.enumerable});return e})(t({},"__esModule",{value:!0}),e));var n={};i(n,{CorsOptionsSchema:()=>b,CorsOrigin:()=>h,HttpMethod:()=>p,RouteConfigSchema:()=>g,RouteMethod:()=>u,SettingsSchema:()=>m,settings:()=>f});var l=require("@walkeros/core/dev"),c=require("@walkeros/core/dev"),d=require("@walkeros/core/dev"),p=d.z.enum(["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"]),u=d.z.enum(["GET","POST"]),g=d.z.object({path:d.z.string().describe("Express route path (supports wildcards like /api/*)"),methods:d.z.array(u).min(1).describe("HTTP methods to register. OPTIONS always included for CORS.").optional()}),h=d.z.union([d.z.string(),d.z.array(d.z.string()),d.z.literal("*")]),b=d.z.object({origin:h.describe("Allowed origins (* for all, URL string, or array of URLs)").optional(),methods:d.z.array(p).describe("Allowed HTTP methods").optional(),headers:d.z.array(d.z.string()).describe("Allowed request headers").optional(),credentials:d.z.boolean().describe("Allow credentials (cookies, authorization headers)").optional(),maxAge:d.z.number().int().positive().describe("Preflight cache duration in seconds").optional()}),m=c.z.object({port:c.z.number().int().min(0).max(65535).describe("HTTP server port to listen on. Use 0 for random available port. If not provided, server will not start (app only mode)").optional(),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 register. String shorthand registers GET+POST. RouteConfig allows per-route method control.").optional(),maxBatchSize:c.z.number().int().min(1).describe("Maximum number of events accepted in a single batch request").default(100),cors:c.z.union([c.z.boolean(),b]).describe("CORS configuration: false = disabled, true = allow all origins (default), object = custom configuration").default(!0)}),f=(0,l.zodToSchema)(m),y={};i(y,{createTrigger:()=>S,step:()=>v});var v={};i(v,{pixelGet:()=>O,postEvent:()=>w});var w={title:"POST event",description:"An Express POST to /collect with a JSON body becomes a single walker elb event.",trigger:{type:"POST"},in:{method:"POST",path:"/collect",body:{name:"page view",data:{title:"Home",url:"https://example.com/"}}},out:[["elb",{name:"page view",data:{title:"Home",url:"https://example.com/"}}]]},O={title:"Pixel GET",description:"An Express GET to /collect with query parameters is parsed into an elb event payload for pixel tracking.",trigger:{type:"GET"},in:{method:"GET",path:"/collect",query:{e:"page view",d:'{"title":"Home"}'}},out:[["elb",{e:"page view",d:'{"title":"Home"}'}]]},T=require("@walkeros/core"),z=require("@walkeros/collector");var S=async(e,t)=>{const o=function(e,t){const o=e.sources??{},r=Object.keys(o),s=(0,T.isObject)(t)&&"string"==typeof t.sourceId?t.sourceId:1===r.length?r[0]:void 0,i=s?o[s]:void 0;if(!s||!i)return e;const a=i.config??{},n=(0,T.isObject)(a.settings)?a.settings:{};return void 0!==n.port?e:{...e,sources:{...o,[s]:{...i,config:{...a,settings:{...n,port:0}}}}}}(e,t);let r,s;return{get flow(){return r},trigger:()=>async e=>{const t=e.method||"POST";if(!r){const e=await(0,z.startFlow)(o);r={collector:e.collector,elb:e.elb};const t=function(e){for(const t of Object.values(e.sources||{})){const e=t;if(e.server){const t=e.server.address();if("object"==typeof t&&null!==t)return t.port}}}(e.collector);if(!t)throw new Error("Express source server not found: the triggered source did not start a server");s=`http://localhost:${t}`}let i=`${s}${e.path}`;e.query&&(i+=`?${new URLSearchParams(e.query).toString()}`);const a={method:t,headers:{...e.headers&&Object.keys(e.headers).some(e=>"content-type"===e.toLowerCase())?{}:{"Content-Type":"application/json"},...e.headers}};"GET"!==t&&"HEAD"!==t&&void 0!==e.body&&(a.body="string"==typeof e.body?e.body:JSON.stringify(e.body));const n=await fetch(i,a),l={};let c;n.headers.forEach((e,t)=>{l[t]=e});return c=(n.headers.get("content-type")||"").includes("application/json")?await n.json():await n.text(),{status:n.status,body:c,headers:l}}}};//# 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/examples/index.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';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\nimport { CorsOptionsSchema, RouteConfigSchema } from './primitives';\n\n/**\n * Express source settings schema.\n */\nexport const SettingsSchema = z.object({\n port: z\n .number()\n .int()\n .min(0)\n .max(65535)\n .describe(\n 'HTTP server port to listen on. Use 0 for random available port. If not provided, server will not start (app only mode)',\n )\n .optional(),\n\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 register. String shorthand registers GET+POST. RouteConfig allows per-route method control.',\n )\n .optional(),\n\n maxBatchSize: z\n .number()\n .int()\n .min(1)\n .describe('Maximum number of events accepted in a single batch request')\n .default(100),\n\n cors: z\n .union([z.boolean(), CorsOptionsSchema])\n .describe(\n 'CORS configuration: false = disabled, true = allow all origins (default), object = custom configuration',\n )\n .default(true),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * HTTP methods enum\n */\nexport const HttpMethod = z.enum([\n 'GET',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'OPTIONS',\n 'HEAD',\n]);\n\n/**\n * HTTP methods supported for route configuration.\n * OPTIONS is always registered 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('Express route path (supports wildcards like /api/*)'),\n methods: z\n .array(RouteMethod)\n .min(1)\n .describe('HTTP methods to register. OPTIONS always included for CORS.')\n .optional(),\n});\n\n/**\n * CORS origin configuration\n * Accepts:\n * - '*' for all origins\n * - Single URL string\n * - Array of URL strings\n */\nexport const CorsOrigin = z.union([\n z.string(),\n z.array(z.string()),\n z.literal('*'),\n]);\n\n/**\n * CORS options schema\n * Configuration for Cross-Origin Resource Sharing\n */\nexport const CorsOptionsSchema = z.object({\n origin: CorsOrigin.describe(\n 'Allowed origins (* for all, URL string, or array of URLs)',\n ).optional(),\n\n methods: z.array(HttpMethod).describe('Allowed HTTP methods').optional(),\n\n headers: z.array(z.string()).describe('Allowed request headers').optional(),\n\n credentials: z\n .boolean()\n .describe('Allow credentials (cookies, authorization headers)')\n .optional(),\n\n maxAge: z\n .number()\n .int()\n .positive()\n .describe('Preflight cache duration in seconds')\n .optional(),\n});\n\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n","export * as step from './step';\nexport { createTrigger } from './trigger';\n","import type { Flow } from '@walkeros/core';\n\nexport const postEvent: Flow.StepExample = {\n title: 'POST event',\n description:\n 'An Express POST to /collect with a JSON body becomes a single walker elb event.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n path: '/collect',\n body: {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n },\n out: [\n [\n 'elb',\n {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n ],\n ],\n};\n\nexport const pixelGet: Flow.StepExample = {\n title: 'Pixel GET',\n description:\n 'An Express GET to /collect with query parameters is parsed into an elb event payload for pixel tracking.',\n trigger: { type: 'GET' },\n in: {\n method: 'GET',\n path: '/collect',\n query: { e: 'page view', d: '{\"title\":\"Home\"}' },\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 path: string;\n body?: unknown;\n query?: Record<string, string>;\n headers?: Record<string, string>;\n}\n\nexport interface Result {\n status: number;\n body: unknown;\n headers: Record<string, string>;\n}\n\n/**\n * Discover the port of a running HTTP server from the collector's sources.\n * Scans all registered sources for one with a `server` property (express pattern).\n */\nfunction discoverPort(collector: Collector.Instance): number | undefined {\n for (const source of Object.values(collector.sources || {})) {\n const s = source as { server?: { address(): { port: number } | string } };\n if (s.server) {\n const addr = s.server.address();\n if (typeof addr === 'object' && addr !== null) return addr.port;\n }\n }\n return undefined;\n}\n\n/**\n * Express source createTrigger.\n *\n * Boots a real express server via startFlow, then fires real HTTP requests.\n * Blackbox: no source instance access, no mocked req/res — just fetch().\n *\n * Pass `port: 0` in the express source settings to use a random available port.\n *\n * @example\n * const { trigger, flow } = await createTrigger(config);\n * const result = await trigger('POST')({ path: '/collect', body: { name: 'page view' } });\n * console.log(result.status, result.body);\n */\nconst createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n let baseUrl: string | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n const method = content.method || 'POST';\n\n // Lazy startFlow — first call boots the server\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n\n const port = discoverPort(result.collector);\n if (!port)\n throw new Error(\n 'Express source server not found — ensure port is configured in source settings',\n );\n baseUrl = `http://localhost:${port}`;\n }\n\n // Build URL\n let url = `${baseUrl}${content.path}`;\n if (content.query) {\n url += `?${new URLSearchParams(content.query).toString()}`;\n }\n\n // Build fetch options — only set default Content-Type if user doesn't provide one\n const hasContentType =\n content.headers &&\n Object.keys(content.headers).some(\n (k) => k.toLowerCase() === 'content-type',\n );\n const fetchOptions: RequestInit = {\n method,\n headers: {\n ...(hasContentType ? {} : { 'Content-Type': 'application/json' }),\n ...content.headers,\n },\n };\n if (method !== 'GET' && method !== 'HEAD' && content.body !== undefined) {\n // String bodies sent raw (e.g., base64 beacon with text/plain).\n // Object bodies JSON-serialized.\n fetchOptions.body =\n typeof content.body === 'string'\n ? content.body\n : JSON.stringify(content.body);\n }\n\n // Real HTTP request\n const response = await fetch(url, fetchOptions);\n\n // Capture response\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((value, key) => {\n responseHeaders[key] = value;\n });\n\n let body: unknown;\n const ct = response.headers.get('content-type') || '';\n if (ct.includes('application/json')) {\n body = await response.json();\n } else {\n body = await response.text();\n }\n\n return {\n status: response.status,\n body,\n headers: responseHeaders,\n };\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\nex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OACR,KAAK,UAAU,QAAQ,IAAI;AAAA,IACnC;AAGA,UAAM,WAAW,MAAM,MAAM,KAAK,YAAY;AAG9C,UAAM,kBAA0C,CAAC;AACjD,aAAS,QAAQ,QAAQ,CAAC,OAAO,QAAQ;AACvC,sBAAgB,GAAG,IAAI;AAAA,IACzB,CAAC;AAED,QAAI;AACJ,UAAM,KAAK,SAAS,QAAQ,IAAI,cAAc,KAAK;AACnD,QAAI,GAAG,SAAS,kBAAkB,GAAG;AACnC,aAAO,MAAM,SAAS,KAAK;AAAA,IAC7B,OAAO;AACL,aAAO,MAAM,SAAS,KAAK;AAAA,IAC7B;AAEA,WAAO;AAAA,MACL,QAAQ,SAAS;AAAA,MACjB;AAAA,MACA,SAAS;AAAA,IACX;AAAA,EACF;AAEF,SAAO;AAAA,IACL,IAAI,OAAO;AACT,aAAO;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;","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/examples/index.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';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\nimport { CorsOptionsSchema, RouteConfigSchema } from './primitives';\n\n/**\n * Express source settings schema.\n */\nexport const SettingsSchema = z.object({\n port: z\n .number()\n .int()\n .min(0)\n .max(65535)\n .describe(\n 'HTTP server port to listen on. Use 0 for random available port. If not provided, server will not start (app only mode)',\n )\n .optional(),\n\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 register. String shorthand registers GET+POST. RouteConfig allows per-route method control.',\n )\n .optional(),\n\n maxBatchSize: z\n .number()\n .int()\n .min(1)\n .describe('Maximum number of events accepted in a single batch request')\n .default(100),\n\n cors: z\n .union([z.boolean(), CorsOptionsSchema])\n .describe(\n 'CORS configuration: false = disabled, true = allow all origins (default), object = custom configuration',\n )\n .default(true),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * HTTP methods enum\n */\nexport const HttpMethod = z.enum([\n 'GET',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'OPTIONS',\n 'HEAD',\n]);\n\n/**\n * HTTP methods supported for route configuration.\n * OPTIONS is always registered 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('Express route path (supports wildcards like /api/*)'),\n methods: z\n .array(RouteMethod)\n .min(1)\n .describe('HTTP methods to register. OPTIONS always included for CORS.')\n .optional(),\n});\n\n/**\n * CORS origin configuration\n * Accepts:\n * - '*' for all origins\n * - Single URL string\n * - Array of URL strings\n */\nexport const CorsOrigin = z.union([\n z.string(),\n z.array(z.string()),\n z.literal('*'),\n]);\n\n/**\n * CORS options schema\n * Configuration for Cross-Origin Resource Sharing\n */\nexport const CorsOptionsSchema = z.object({\n origin: CorsOrigin.describe(\n 'Allowed origins (* for all, URL string, or array of URLs)',\n ).optional(),\n\n methods: z.array(HttpMethod).describe('Allowed HTTP methods').optional(),\n\n headers: z.array(z.string()).describe('Allowed request headers').optional(),\n\n credentials: z\n .boolean()\n .describe('Allow credentials (cookies, authorization headers)')\n .optional(),\n\n maxAge: z\n .number()\n .int()\n .positive()\n .describe('Preflight cache duration in seconds')\n .optional(),\n});\n\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n","export * as step from './step';\nexport { createTrigger } from './trigger';\n","import type { Flow } from '@walkeros/core';\n\nexport const postEvent: Flow.StepExample = {\n title: 'POST event',\n description:\n 'An Express POST to /collect with a JSON body becomes a single walker elb event.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n path: '/collect',\n body: {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n },\n out: [\n [\n 'elb',\n {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n ],\n ],\n};\n\nexport const pixelGet: Flow.StepExample = {\n title: 'Pixel GET',\n description:\n 'An Express GET to /collect with query parameters is parsed into an elb event payload for pixel tracking.',\n trigger: { type: 'GET' },\n in: {\n method: 'GET',\n path: '/collect',\n query: { e: 'page view', d: '{\"title\":\"Home\"}' },\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 { isObject } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\n\nexport interface Content {\n method: string;\n path: string;\n body?: unknown;\n query?: Record<string, string>;\n headers?: Record<string, string>;\n}\n\nexport interface Result {\n status: number;\n body: unknown;\n headers: Record<string, string>;\n}\n\n/**\n * Discover the port of a running HTTP server from the collector's sources.\n * Scans all registered sources for one with a `server` property (express pattern).\n */\nfunction discoverPort(collector: Collector.Instance): number | undefined {\n for (const source of Object.values(collector.sources || {})) {\n const s = source as { server?: { address(): { port: number } | string } };\n if (s.server) {\n const addr = s.server.address();\n if (typeof addr === 'object' && addr !== null) return addr.port;\n }\n }\n return undefined;\n}\n\n/**\n * The config with the triggered express source on a free port (0) when it\n * names none, so a simulation needs no port setting. The source is the one\n * `options.sourceId` names, else the config's only source. A configured port\n * and every other source stay as given.\n */\nfunction withFreePort(\n config: Collector.InitConfig,\n options: unknown,\n): Collector.InitConfig {\n const sources = config.sources ?? {};\n const ids = Object.keys(sources);\n const sourceId =\n isObject(options) && typeof options.sourceId === 'string'\n ? options.sourceId\n : ids.length === 1\n ? ids[0]\n : undefined;\n const source = sourceId ? sources[sourceId] : undefined;\n if (!sourceId || !source) return config;\n\n const sourceConfig = source.config ?? {};\n const settings = isObject(sourceConfig.settings) ? sourceConfig.settings : {};\n if (settings.port !== undefined) return config;\n\n return {\n ...config,\n sources: {\n ...sources,\n [sourceId]: {\n ...source,\n config: { ...sourceConfig, settings: { ...settings, port: 0 } },\n },\n },\n };\n}\n\n/**\n * Express source createTrigger.\n *\n * Boots a real express server via startFlow, then fires real HTTP requests.\n * Blackbox: no source instance access, no mocked req/res — just fetch().\n *\n * Without `settings.port` the triggered source listens on a free port.\n *\n * @example\n * const { trigger, flow } = await createTrigger(config);\n * const result = await trigger('POST')({ path: '/collect', body: { name: 'page view' } });\n * console.log(result.status, result.body);\n */\nconst createTrigger: Trigger.CreateFn<Content, Result> = async (\n initConfig: Collector.InitConfig,\n options?: unknown,\n) => {\n const config = withFreePort(initConfig, options);\n let flow: Trigger.FlowHandle | undefined;\n let baseUrl: string | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n const method = content.method || 'POST';\n\n // Lazy startFlow — first call boots the server\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n\n const port = discoverPort(result.collector);\n if (!port)\n throw new Error(\n 'Express source server not found: the triggered source did not start a server',\n );\n baseUrl = `http://localhost:${port}`;\n }\n\n // Build URL\n let url = `${baseUrl}${content.path}`;\n if (content.query) {\n url += `?${new URLSearchParams(content.query).toString()}`;\n }\n\n // Build fetch options — only set default Content-Type if user doesn't provide one\n const hasContentType =\n content.headers &&\n Object.keys(content.headers).some(\n (k) => k.toLowerCase() === 'content-type',\n );\n const fetchOptions: RequestInit = {\n method,\n headers: {\n ...(hasContentType ? {} : { 'Content-Type': 'application/json' }),\n ...content.headers,\n },\n };\n if (method !== 'GET' && method !== 'HEAD' && content.body !== undefined) {\n // String bodies sent raw (e.g., base64 beacon with text/plain).\n // Object bodies JSON-serialized.\n fetchOptions.body =\n typeof content.body === 'string'\n ? content.body\n : JSON.stringify(content.body);\n }\n\n // Real HTTP request\n const response = await fetch(url, fetchOptions);\n\n // Capture response\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((value, key) => {\n responseHeaders[key] = value;\n });\n\n let body: unknown;\n const ct = response.headers.get('content-type') || '';\n if (ct.includes('application/json')) {\n body = await response.json();\n } else {\n body = await response.text();\n }\n\n return {\n status: response.status,\n body,\n headers: responseHeaders,\n };\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,IAAAA,cAA4B;;;ACA5B,IAAAC,cAAkB;;;ACAlB,iBAAkB;AAKX,IAAM,aAAa,aAAE,KAAK;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,cAAc,aAAE,KAAK,CAAC,OAAO,MAAM,CAAC;AAK1C,IAAM,oBAAoB,aAAE,OAAO;AAAA,EACxC,MAAM,aACH,OAAO,EACP,SAAS,qDAAqD;AAAA,EACjE,SAAS,aACN,MAAM,WAAW,EACjB,IAAI,CAAC,EACL,SAAS,6DAA6D,EACtE,SAAS;AACd,CAAC;AASM,IAAM,aAAa,aAAE,MAAM;AAAA,EAChC,aAAE,OAAO;AAAA,EACT,aAAE,MAAM,aAAE,OAAO,CAAC;AAAA,EAClB,aAAE,QAAQ,GAAG;AACf,CAAC;AAMM,IAAM,oBAAoB,aAAE,OAAO;AAAA,EACxC,QAAQ,WAAW;AAAA,IACjB;AAAA,EACF,EAAE,SAAS;AAAA,EAEX,SAAS,aAAE,MAAM,UAAU,EAAE,SAAS,sBAAsB,EAAE,SAAS;AAAA,EAEvE,SAAS,aAAE,MAAM,aAAE,OAAO,CAAC,EAAE,SAAS,yBAAyB,EA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AAED,QAAI;AACJ,UAAM,KAAK,SAAS,QAAQ,IAAI,cAAc,KAAK;AACnD,QAAI,GAAG,SAAS,kBAAkB,GAAG;AACnC,aAAO,MAAM,SAAS,KAAK;AAAA,IAC7B,OAAO;AACL,aAAO,MAAM,SAAS,KAAK;AAAA,IAC7B;AAEA,WAAO;AAAA,MACL,QAAQ,SAAS;AAAA,MACjB;AAAA,MACA,SAAS;AAAA,IACX;AAAA,EACF;AAEF,SAAO;AAAA,IACL,IAAI,OAAO;AACT,aAAO;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;","names":["import_dev","import_dev","settings"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,o)=>{for(var r in o)e(t,r,{get:o[r],enumerable:!0})},o={};t(o,{CorsOptionsSchema:()=>d,CorsOrigin:()=>c,HttpMethod:()=>i,RouteConfigSchema:()=>l,RouteMethod:()=>n,SettingsSchema:()=>p,settings:()=>m});import{zodToSchema as r}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";import{z as s}from"@walkeros/core/dev";var i=s.enum(["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"]),n=s.enum(["GET","POST"]),l=s.object({path:s.string().describe("Express route path (supports wildcards like /api/*)"),methods:s.array(n).min(1).describe("HTTP methods to register. OPTIONS always included for CORS.").optional()}),c=s.union([s.string(),s.array(s.string()),s.literal("*")]),d=s.object({origin:c.describe("Allowed origins (* for all, URL string, or array of URLs)").optional(),methods:s.array(i).describe("Allowed HTTP methods").optional(),headers:s.array(s.string()).describe("Allowed request headers").optional(),credentials:s.boolean().describe("Allow credentials (cookies, authorization headers)").optional(),maxAge:s.number().int().positive().describe("Preflight cache duration in seconds").optional()}),p=a.object({port:a.number().int().min(0).max(65535).describe("HTTP server port to listen on. Use 0 for random available port. If not provided, server will not start (app only mode)").optional(),path:a.string().describe("Deprecated: use paths instead").optional(),paths:a.array(a.union([a.string(),l])).min(1).describe("Route paths to register. String shorthand registers GET+POST. RouteConfig allows per-route method control.").optional(),maxBatchSize:a.number().int().min(1).describe("Maximum number of events accepted in a single batch request").default(100),cors:a.union([a.boolean(),d]).describe("CORS configuration: false = disabled, true = allow all origins (default), object = custom configuration").default(!0)}),m=r(p),u={};t(u,{createTrigger:()=>y,step:()=>h});var h={};t(h,{pixelGet:()=>b,postEvent:()=>g});var g={title:"POST event",description:"An Express POST to /collect with a JSON body becomes a single walker elb event.",trigger:{type:"POST"},in:{method:"POST",path:"/collect",body:{name:"page view",data:{title:"Home",url:"https://example.com/"}}},out:[["elb",{name:"page view",data:{title:"Home",url:"https://example.com/"}}]]},b={title:"Pixel GET",description:"An Express GET to /collect with query parameters is parsed into an elb event payload for pixel tracking.",trigger:{type:"GET"},in:{method:"GET",path:"/collect",query:{e:"page view",d:'{"title":"Home"}'}},out:[["elb",{e:"page view",d:'{"title":"Home"}'}]]};import{startFlow as f}from"@walkeros/collector";var y=async e=>{let t,o;return{get flow(){return t},trigger:()=>async r=>{const a=r.method||"POST";if(!t){const r=await f(e);t={collector:r.collector,elb:r.elb};const a=function(e){for(const t of Object.values(e.sources||{})){const e=t;if(e.server){const t=e.server.address();if("object"==typeof t&&null!==t)return t.port}}}(r.collector);if(!a)throw new Error("Express source server not found — ensure port is configured in source settings");o=`http://localhost:${a}`}let s=`${o}${r.path}`;r.query&&(s+=`?${new URLSearchParams(r.query).toString()}`);const i={method:a,headers:{...r.headers&&Object.keys(r.headers).some(e=>"content-type"===e.toLowerCase())?{}:{"Content-Type":"application/json"},...r.headers}};"GET"!==a&&"HEAD"!==a&&void 0!==r.body&&(i.body="string"==typeof r.body?r.body:JSON.stringify(r.body));const n=await fetch(s,i),l={};let c;n.headers.forEach((e,t)=>{l[t]=e});return c=(n.headers.get("content-type")||"").includes("application/json")?await n.json():await n.text(),{status:n.status,body:c,headers:l}}}};export{u as examples,o as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,o)=>{for(var r in o)e(t,r,{get:o[r],enumerable:!0})},o={};t(o,{CorsOptionsSchema:()=>d,CorsOrigin:()=>c,HttpMethod:()=>a,RouteConfigSchema:()=>l,RouteMethod:()=>n,SettingsSchema:()=>p,settings:()=>u});import{zodToSchema as r}from"@walkeros/core/dev";import{z as s}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";var a=i.enum(["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"]),n=i.enum(["GET","POST"]),l=i.object({path:i.string().describe("Express route path (supports wildcards like /api/*)"),methods:i.array(n).min(1).describe("HTTP methods to register. OPTIONS always included for CORS.").optional()}),c=i.union([i.string(),i.array(i.string()),i.literal("*")]),d=i.object({origin:c.describe("Allowed origins (* for all, URL string, or array of URLs)").optional(),methods:i.array(a).describe("Allowed HTTP methods").optional(),headers:i.array(i.string()).describe("Allowed request headers").optional(),credentials:i.boolean().describe("Allow credentials (cookies, authorization headers)").optional(),maxAge:i.number().int().positive().describe("Preflight cache duration in seconds").optional()}),p=s.object({port:s.number().int().min(0).max(65535).describe("HTTP server port to listen on. Use 0 for random available port. If not provided, server will not start (app only mode)").optional(),path:s.string().describe("Deprecated: use paths instead").optional(),paths:s.array(s.union([s.string(),l])).min(1).describe("Route paths to register. String shorthand registers GET+POST. RouteConfig allows per-route method control.").optional(),maxBatchSize:s.number().int().min(1).describe("Maximum number of events accepted in a single batch request").default(100),cors:s.union([s.boolean(),d]).describe("CORS configuration: false = disabled, true = allow all origins (default), object = custom configuration").default(!0)}),u=r(p),m={};t(m,{createTrigger:()=>v,step:()=>g});var g={};t(g,{pixelGet:()=>b,postEvent:()=>h});var h={title:"POST event",description:"An Express POST to /collect with a JSON body becomes a single walker elb event.",trigger:{type:"POST"},in:{method:"POST",path:"/collect",body:{name:"page view",data:{title:"Home",url:"https://example.com/"}}},out:[["elb",{name:"page view",data:{title:"Home",url:"https://example.com/"}}]]},b={title:"Pixel GET",description:"An Express GET to /collect with query parameters is parsed into an elb event payload for pixel tracking.",trigger:{type:"GET"},in:{method:"GET",path:"/collect",query:{e:"page view",d:'{"title":"Home"}'}},out:[["elb",{e:"page view",d:'{"title":"Home"}'}]]};import{isObject as f}from"@walkeros/core";import{startFlow as y}from"@walkeros/collector";var v=async(e,t)=>{const o=function(e,t){const o=e.sources??{},r=Object.keys(o),s=f(t)&&"string"==typeof t.sourceId?t.sourceId:1===r.length?r[0]:void 0,i=s?o[s]:void 0;if(!s||!i)return e;const a=i.config??{},n=f(a.settings)?a.settings:{};return void 0!==n.port?e:{...e,sources:{...o,[s]:{...i,config:{...a,settings:{...n,port:0}}}}}}(e,t);let r,s;return{get flow(){return r},trigger:()=>async e=>{const t=e.method||"POST";if(!r){const e=await y(o);r={collector:e.collector,elb:e.elb};const t=function(e){for(const t of Object.values(e.sources||{})){const e=t;if(e.server){const t=e.server.address();if("object"==typeof t&&null!==t)return t.port}}}(e.collector);if(!t)throw new Error("Express source server not found: the triggered source did not start a server");s=`http://localhost:${t}`}let i=`${s}${e.path}`;e.query&&(i+=`?${new URLSearchParams(e.query).toString()}`);const a={method:t,headers:{...e.headers&&Object.keys(e.headers).some(e=>"content-type"===e.toLowerCase())?{}:{"Content-Type":"application/json"},...e.headers}};"GET"!==t&&"HEAD"!==t&&void 0!==e.body&&(a.body="string"==typeof e.body?e.body:JSON.stringify(e.body));const n=await fetch(i,a),l={};let c;n.headers.forEach((e,t)=>{l[t]=e});return c=(n.headers.get("content-type")||"").includes("application/json")?await n.json():await n.text(),{status:n.status,body:c,headers:l}}}};export{m 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/examples/index.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';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\nimport { CorsOptionsSchema, RouteConfigSchema } from './primitives';\n\n/**\n * Express source settings schema.\n */\nexport const SettingsSchema = z.object({\n port: z\n .number()\n .int()\n .min(0)\n .max(65535)\n .describe(\n 'HTTP server port to listen on. Use 0 for random available port. If not provided, server will not start (app only mode)',\n )\n .optional(),\n\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 register. String shorthand registers GET+POST. RouteConfig allows per-route method control.',\n )\n .optional(),\n\n maxBatchSize: z\n .number()\n .int()\n .min(1)\n .describe('Maximum number of events accepted in a single batch request')\n .default(100),\n\n cors: z\n .union([z.boolean(), CorsOptionsSchema])\n .describe(\n 'CORS configuration: false = disabled, true = allow all origins (default), object = custom configuration',\n )\n .default(true),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * HTTP methods enum\n */\nexport const HttpMethod = z.enum([\n 'GET',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'OPTIONS',\n 'HEAD',\n]);\n\n/**\n * HTTP methods supported for route configuration.\n * OPTIONS is always registered 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('Express route path (supports wildcards like /api/*)'),\n methods: z\n .array(RouteMethod)\n .min(1)\n .describe('HTTP methods to register. OPTIONS always included for CORS.')\n .optional(),\n});\n\n/**\n * CORS origin configuration\n * Accepts:\n * - '*' for all origins\n * - Single URL string\n * - Array of URL strings\n */\nexport const CorsOrigin = z.union([\n z.string(),\n z.array(z.string()),\n z.literal('*'),\n]);\n\n/**\n * CORS options schema\n * Configuration for Cross-Origin Resource Sharing\n */\nexport const CorsOptionsSchema = z.object({\n origin: CorsOrigin.describe(\n 'Allowed origins (* for all, URL string, or array of URLs)',\n ).optional(),\n\n methods: z.array(HttpMethod).describe('Allowed HTTP methods').optional(),\n\n headers: z.array(z.string()).describe('Allowed request headers').optional(),\n\n credentials: z\n .boolean()\n .describe('Allow credentials (cookies, authorization headers)')\n .optional(),\n\n maxAge: z\n .number()\n .int()\n .positive()\n .describe('Preflight cache duration in seconds')\n .optional(),\n});\n\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n","export * as step from './step';\nexport { createTrigger } from './trigger';\n","import type { Flow } from '@walkeros/core';\n\nexport const postEvent: Flow.StepExample = {\n title: 'POST event',\n description:\n 'An Express POST to /collect with a JSON body becomes a single walker elb event.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n path: '/collect',\n body: {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n },\n out: [\n [\n 'elb',\n {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n ],\n ],\n};\n\nexport const pixelGet: Flow.StepExample = {\n title: 'Pixel GET',\n description:\n 'An Express GET to /collect with query parameters is parsed into an elb event payload for pixel tracking.',\n trigger: { type: 'GET' },\n in: {\n method: 'GET',\n path: '/collect',\n query: { e: 'page view', d: '{\"title\":\"Home\"}' },\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 path: string;\n body?: unknown;\n query?: Record<string, string>;\n headers?: Record<string, string>;\n}\n\nexport interface Result {\n status: number;\n body: unknown;\n headers: Record<string, string>;\n}\n\n/**\n * Discover the port of a running HTTP server from the collector's sources.\n * Scans all registered sources for one with a `server` property (express pattern).\n */\nfunction discoverPort(collector: Collector.Instance): number | undefined {\n for (const source of Object.values(collector.sources || {})) {\n const s = source as { server?: { address(): { port: number } | string } };\n if (s.server) {\n const addr = s.server.address();\n if (typeof addr === 'object' && addr !== null) return addr.port;\n }\n }\n return undefined;\n}\n\n/**\n * Express source createTrigger.\n *\n * Boots a real express server via startFlow, then fires real HTTP requests.\n * Blackbox: no source instance access, no mocked req/res — just fetch().\n *\n * Pass `port: 0` in the express source settings to use a random available port.\n *\n * @example\n * const { trigger, flow } = await createTrigger(config);\n * const result = await trigger('POST')({ path: '/collect', body: { name: 'page view' } });\n * console.log(result.status, result.body);\n */\nconst createTrigger: Trigger.CreateFn<Content, Result> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n let baseUrl: string | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n const method = content.method || 'POST';\n\n // Lazy startFlow — first call boots the server\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n\n const port = discoverPort(result.collector);\n if (!port)\n throw new Error(\n 'Express source server not found — ensure port is configured in source settings',\n );\n baseUrl = `http://localhost:${port}`;\n }\n\n // Build URL\n let url = `${baseUrl}${content.path}`;\n if (content.query) {\n url += `?${new URLSearchParams(content.query).toString()}`;\n }\n\n // Build fetch options — only set default Content-Type if user doesn't provide one\n const hasContentType =\n content.headers &&\n Object.keys(content.headers).some(\n (k) => k.toLowerCase() === 'content-type',\n );\n const fetchOptions: RequestInit = {\n method,\n headers: {\n ...(hasContentType ? {} : { 'Content-Type': 'application/json' }),\n ...content.headers,\n },\n };\n if (method !== 'GET' && method !== 'HEAD' && content.body !== undefined) {\n // String bodies sent raw (e.g., base64 beacon with text/plain).\n // Object bodies JSON-serialized.\n fetchOptions.body =\n typeof content.body === 'string'\n ? content.body\n : JSON.stringify(content.body);\n }\n\n // Real HTTP request\n const response = await fetch(url, fetchOptions);\n\n // Capture response\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((value, key) => {\n responseHeaders[key] = value;\n });\n\n let body: unknown;\n const ct = response.headers.get('content-type') || '';\n if (ct.includes('application/json')) {\n body = await response.json();\n } else {\n body = await response.text();\n }\n\n return {\n status: response.status,\n body,\n headers: responseHeaders,\n };\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,SAAS,mBAAmB;;;ACA5B,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAKX,IAAM,aAAa,EAAE,KAAK;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,cAAc,EAAE,KAAK,CAAC,OAAO,MAAM,CAAC;AAK1C,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,MAAM,EACH,OAAO,EACP,SAAS,qDAAqD;AAAA,EACjE,SAAS,EACN,MAAM,WAAW,EACjB,IAAI,CAAC,EACL,SAAS,6DAA6D,EACtE,SAAS;AACd,CAAC;AASM,IAAM,aAAa,EAAE,MAAM;AAAA,EAChC,EAAE,OAAO;AAAA,EACT,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,EAClB,EAAE,QAAQ,GAAG;AACf,CAAC;AAMM,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,QAAQ,WAAW;AAAA,IACjB;AAAA,EACF,EAAE,SAAS;AAAA,EAEX,SAAS,EAAE,MAAM,UAAU,EAAE,SAAS,sBAAsB,EAAE,SAAS;AAAA,EAEvE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,yBAAyB,EAAE,SAAS;AAAA,EAE1E,aAAa,EACV,QAAQ,EACR,SAAS,oDAAoD,EAC7D,SAAS;AAAA,EAEZ,QAAQ,EACL,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,qCAAqC,EAC9C,SAAS;AACd,CAAC;;;ADlEM,IAAM,iBAAiBC,GAAE,OAAO;AAAA,EACrC,MAAMA,GACH,OAAO,EACP,IAAI,E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AQ,SAAS,QAAW;AAGvE,mBAAa,OACX,OAAO,QAAQ,SAAS,WACpB,QAAQ,OACR,KAAK,UAAU,QAAQ,IAAI;AAAA,IACnC;AAGA,UAAM,WAAW,MAAM,MAAM,KAAK,YAAY;AAG9C,UAAM,kBAA0C,CAAC;AACjD,aAAS,QAAQ,QAAQ,CAAC,OAAO,QAAQ;AACvC,sBAAgB,GAAG,IAAI;AAAA,IACzB,CAAC;AAED,QAAI;AACJ,UAAM,KAAK,SAAS,QAAQ,IAAI,cAAc,KAAK;AACnD,QAAI,GAAG,SAAS,kBAAkB,GAAG;AACnC,aAAO,MAAM,SAAS,KAAK;AAAA,IAC7B,OAAO;AACL,aAAO,MAAM,SAAS,KAAK;AAAA,IAC7B;AAEA,WAAO;AAAA,MACL,QAAQ,SAAS;AAAA,MACjB;AAAA,MACA,SAAS;AAAA,IACX;AAAA,EACF;AAEF,SAAO;AAAA,IACL,IAAI,OAAO;AACT,aAAO;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;","names":["z","z"]}
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.ts","../src/examples/index.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';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\nimport { CorsOptionsSchema, RouteConfigSchema } from './primitives';\n\n/**\n * Express source settings schema.\n */\nexport const SettingsSchema = z.object({\n port: z\n .number()\n .int()\n .min(0)\n .max(65535)\n .describe(\n 'HTTP server port to listen on. Use 0 for random available port. If not provided, server will not start (app only mode)',\n )\n .optional(),\n\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 register. String shorthand registers GET+POST. RouteConfig allows per-route method control.',\n )\n .optional(),\n\n maxBatchSize: z\n .number()\n .int()\n .min(1)\n .describe('Maximum number of events accepted in a single batch request')\n .default(100),\n\n cors: z\n .union([z.boolean(), CorsOptionsSchema])\n .describe(\n 'CORS configuration: false = disabled, true = allow all origins (default), object = custom configuration',\n )\n .default(true),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * HTTP methods enum\n */\nexport const HttpMethod = z.enum([\n 'GET',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'OPTIONS',\n 'HEAD',\n]);\n\n/**\n * HTTP methods supported for route configuration.\n * OPTIONS is always registered 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('Express route path (supports wildcards like /api/*)'),\n methods: z\n .array(RouteMethod)\n .min(1)\n .describe('HTTP methods to register. OPTIONS always included for CORS.')\n .optional(),\n});\n\n/**\n * CORS origin configuration\n * Accepts:\n * - '*' for all origins\n * - Single URL string\n * - Array of URL strings\n */\nexport const CorsOrigin = z.union([\n z.string(),\n z.array(z.string()),\n z.literal('*'),\n]);\n\n/**\n * CORS options schema\n * Configuration for Cross-Origin Resource Sharing\n */\nexport const CorsOptionsSchema = z.object({\n origin: CorsOrigin.describe(\n 'Allowed origins (* for all, URL string, or array of URLs)',\n ).optional(),\n\n methods: z.array(HttpMethod).describe('Allowed HTTP methods').optional(),\n\n headers: z.array(z.string()).describe('Allowed request headers').optional(),\n\n credentials: z\n .boolean()\n .describe('Allow credentials (cookies, authorization headers)')\n .optional(),\n\n maxAge: z\n .number()\n .int()\n .positive()\n .describe('Preflight cache duration in seconds')\n .optional(),\n});\n\nexport type CorsOptions = z.infer<typeof CorsOptionsSchema>;\n","export * as step from './step';\nexport { createTrigger } from './trigger';\n","import type { Flow } from '@walkeros/core';\n\nexport const postEvent: Flow.StepExample = {\n title: 'POST event',\n description:\n 'An Express POST to /collect with a JSON body becomes a single walker elb event.',\n trigger: { type: 'POST' },\n in: {\n method: 'POST',\n path: '/collect',\n body: {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n },\n out: [\n [\n 'elb',\n {\n name: 'page view',\n data: { title: 'Home', url: 'https://example.com/' },\n },\n ],\n ],\n};\n\nexport const pixelGet: Flow.StepExample = {\n title: 'Pixel GET',\n description:\n 'An Express GET to /collect with query parameters is parsed into an elb event payload for pixel tracking.',\n trigger: { type: 'GET' },\n in: {\n method: 'GET',\n path: '/collect',\n query: { e: 'page view', d: '{\"title\":\"Home\"}' },\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 { isObject } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\n\nexport interface Content {\n method: string;\n path: string;\n body?: unknown;\n query?: Record<string, string>;\n headers?: Record<string, string>;\n}\n\nexport interface Result {\n status: number;\n body: unknown;\n headers: Record<string, string>;\n}\n\n/**\n * Discover the port of a running HTTP server from the collector's sources.\n * Scans all registered sources for one with a `server` property (express pattern).\n */\nfunction discoverPort(collector: Collector.Instance): number | undefined {\n for (const source of Object.values(collector.sources || {})) {\n const s = source as { server?: { address(): { port: number } | string } };\n if (s.server) {\n const addr = s.server.address();\n if (typeof addr === 'object' && addr !== null) return addr.port;\n }\n }\n return undefined;\n}\n\n/**\n * The config with the triggered express source on a free port (0) when it\n * names none, so a simulation needs no port setting. The source is the one\n * `options.sourceId` names, else the config's only source. A configured port\n * and every other source stay as given.\n */\nfunction withFreePort(\n config: Collector.InitConfig,\n options: unknown,\n): Collector.InitConfig {\n const sources = config.sources ?? {};\n const ids = Object.keys(sources);\n const sourceId =\n isObject(options) && typeof options.sourceId === 'string'\n ? options.sourceId\n : ids.length === 1\n ? ids[0]\n : undefined;\n const source = sourceId ? sources[sourceId] : undefined;\n if (!sourceId || !source) return config;\n\n const sourceConfig = source.config ?? {};\n const settings = isObject(sourceConfig.settings) ? sourceConfig.settings : {};\n if (settings.port !== undefined) return config;\n\n return {\n ...config,\n sources: {\n ...sources,\n [sourceId]: {\n ...source,\n config: { ...sourceConfig, settings: { ...settings, port: 0 } },\n },\n },\n };\n}\n\n/**\n * Express source createTrigger.\n *\n * Boots a real express server via startFlow, then fires real HTTP requests.\n * Blackbox: no source instance access, no mocked req/res — just fetch().\n *\n * Without `settings.port` the triggered source listens on a free port.\n *\n * @example\n * const { trigger, flow } = await createTrigger(config);\n * const result = await trigger('POST')({ path: '/collect', body: { name: 'page view' } });\n * console.log(result.status, result.body);\n */\nconst createTrigger: Trigger.CreateFn<Content, Result> = async (\n initConfig: Collector.InitConfig,\n options?: unknown,\n) => {\n const config = withFreePort(initConfig, options);\n let flow: Trigger.FlowHandle | undefined;\n let baseUrl: string | undefined;\n\n const trigger: Trigger.Fn<Content, Result> =\n () =>\n async (content: Content): Promise<Result> => {\n const method = content.method || 'POST';\n\n // Lazy startFlow — first call boots the server\n if (!flow) {\n const result = await startFlow(config);\n flow = { collector: result.collector, elb: result.elb };\n\n const port = discoverPort(result.collector);\n if (!port)\n throw new Error(\n 'Express source server not found: the triggered source did not start a server',\n );\n baseUrl = `http://localhost:${port}`;\n }\n\n // Build URL\n let url = `${baseUrl}${content.path}`;\n if (content.query) {\n url += `?${new URLSearchParams(content.query).toString()}`;\n }\n\n // Build fetch options — only set default Content-Type if user doesn't provide one\n const hasContentType =\n content.headers &&\n Object.keys(content.headers).some(\n (k) => k.toLowerCase() === 'content-type',\n );\n const fetchOptions: RequestInit = {\n method,\n headers: {\n ...(hasContentType ? {} : { 'Content-Type': 'application/json' }),\n ...content.headers,\n },\n };\n if (method !== 'GET' && method !== 'HEAD' && content.body !== undefined) {\n // String bodies sent raw (e.g., base64 beacon with text/plain).\n // Object bodies JSON-serialized.\n fetchOptions.body =\n typeof content.body === 'string'\n ? content.body\n : JSON.stringify(content.body);\n }\n\n // Real HTTP request\n const response = await fetch(url, fetchOptions);\n\n // Capture response\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((value, key) => {\n responseHeaders[key] = value;\n });\n\n let body: unknown;\n const ct = response.headers.get('content-type') || '';\n if (ct.includes('application/json')) {\n body = await response.json();\n } else {\n body = await response.text();\n }\n\n return {\n status: response.status,\n body,\n headers: responseHeaders,\n };\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,SAAS,mBAAmB;;;ACA5B,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAKX,IAAM,aAAa,EAAE,KAAK;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,cAAc,EAAE,KAAK,CAAC,OAAO,MAAM,CAAC;AAK1C,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,MAAM,EACH,OAAO,EACP,SAAS,qDAAqD;AAAA,EACjE,SAAS,EACN,MAAM,WAAW,EACjB,IAAI,CAAC,EACL,SAAS,6DAA6D,EACtE,SAAS;AACd,CAAC;AASM,IAAM,aAAa,EAAE,MAAM;AAAA,EAChC,EAAE,OAAO;AAAA,EACT,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,EAClB,EAAE,QAAQ,GAAG;AACf,CAAC;AAMM,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,QAAQ,WAAW;AAAA,IACjB;AAAA,EACF,EAAE,SAAS;AAAA,EAEX,SAAS,EAAE,MAAM,UAAU,EAAE,SAAS,sBAAsB,EAAE,SAAS;AAAA,EAEvE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,yBAAyB,EAAE,SAAS;AAAA,EAE1E,aAAa,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,UAAM,KAAK,SAAS,QAAQ,IAAI,cAAc,KAAK;AACnD,QAAI,GAAG,SAAS,kBAAkB,GAAG;AACnC,aAAO,MAAM,SAAS,KAAK;AAAA,IAC7B,OAAO;AACL,aAAO,MAAM,SAAS,KAAK;AAAA,IAC7B;AAEA,WAAO;AAAA,MACL,QAAQ,SAAS;AAAA,MACjB;AAAA,MACA,SAAS;AAAA,IACX;AAAA,EACF;AAEF,SAAO;AAAA,IACL,IAAI,OAAO;AACT,aAAO;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;","names":["z","z","settings"]}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/server-source-express",
4
- "version": "4.7.0-next-1790187973605",
4
+ "version": "4.7.0-next-1790722899482",
5
5
  "type": "source",
6
6
  "platform": [
7
7
  "server"
@@ -141,7 +141,7 @@
141
141
  },
142
142
  "examples": {
143
143
  "createTrigger": {
144
- "$code": "async e=>{let t,o;return{get flow(){return t},trigger:()=>async r=>{const a=r.method||\"POST\";if(!t){const r=await f(e);t={collector:r.collector,elb:r.elb};const a=function(e){for(const t of Object.values(e.sources||{})){const e=t;if(e.server){const t=e.server.address();if(\"object\"==typeof t&&null!==t)return t.port}}}(r.collector);if(!a)throw new Error(\"Express source server not found — ensure port is configured in source settings\");o=`http://localhost:${a}`}let s=`${o}${r.path}`;r.query&&(s+=`?${new URLSearchParams(r.query).toString()}`);const i={method:a,headers:{...r.headers&&Object.keys(r.headers).some(e=>\"content-type\"===e.toLowerCase())?{}:{\"Content-Type\":\"application/json\"},...r.headers}};\"GET\"!==a&&\"HEAD\"!==a&&void 0!==r.body&&(i.body=\"string\"==typeof r.body?r.body:JSON.stringify(r.body));const n=await fetch(s,i),l={};let c;n.headers.forEach((e,t)=>{l[t]=e});return c=(n.headers.get(\"content-type\")||\"\").includes(\"application/json\")?await n.json():await n.text(),{status:n.status,body:c,headers:l}}}}"
144
+ "$code": "async(e,t)=>{const o=function(e,t){const o=e.sources??{},r=Object.keys(o),s=f(t)&&\"string\"==typeof t.sourceId?t.sourceId:1===r.length?r[0]:void 0,i=s?o[s]:void 0;if(!s||!i)return e;const a=i.config??{},n=f(a.settings)?a.settings:{};return void 0!==n.port?e:{...e,sources:{...o,[s]:{...i,config:{...a,settings:{...n,port:0}}}}}}(e,t);let r,s;return{get flow(){return r},trigger:()=>async e=>{const t=e.method||\"POST\";if(!r){const e=await y(o);r={collector:e.collector,elb:e.elb};const t=function(e){for(const t of Object.values(e.sources||{})){const e=t;if(e.server){const t=e.server.address();if(\"object\"==typeof t&&null!==t)return t.port}}}(e.collector);if(!t)throw new Error(\"Express source server not found: the triggered source did not start a server\");s=`http://localhost:${t}`}let i=`${s}${e.path}`;e.query&&(i+=`?${new URLSearchParams(e.query).toString()}`);const a={method:t,headers:{...e.headers&&Object.keys(e.headers).some(e=>\"content-type\"===e.toLowerCase())?{}:{\"Content-Type\":\"application/json\"},...e.headers}};\"GET\"!==t&&\"HEAD\"!==t&&void 0!==e.body&&(a.body=\"string\"==typeof e.body?e.body:JSON.stringify(e.body));const n=await fetch(i,a),l={};let c;n.headers.forEach((e,t)=>{l[t]=e});return c=(n.headers.get(\"content-type\")||\"\").includes(\"application/json\")?await n.json():await n.text(),{status:n.status,body:c,headers:l}}}}"
145
145
  },
146
146
  "step": {
147
147
  "pixelGet": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/server-source-express",
3
3
  "description": "Express server source for walkerOS",
4
- "version": "4.7.0-next-1790187973605",
4
+ "version": "4.7.0-next-1790722899482",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -20,8 +20,8 @@
20
20
  "update": "npx npm-check-updates -u && npm update"
21
21
  },
22
22
  "dependencies": {
23
- "@walkeros/collector": "4.7.0-next-1790187973605",
24
- "@walkeros/core": "4.7.0-next-1790187973605",
23
+ "@walkeros/collector": "4.7.0-next-1790722899482",
24
+ "@walkeros/core": "4.7.0-next-1790722899482",
25
25
  "express": "^5.2.1",
26
26
  "cors": "^2.8.5"
27
27
  },