@walkeros/server-destination-api 3.3.1 → 3.4.0-next-1776749829492

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,a=(e,r)=>{for(var o in r)t(e,o,{get:r[o],enumerable:!0})},i={};a(i,{examples:()=>p,schemas:()=>n}),module.exports=(e=i,((e,a,i,n)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let d of o(a))s.call(e,d)||d===i||t(e,d,{get:()=>a[d],enumerable:!(n=r(a,d))||n.enumerable});return e})(t({},"__esModule",{value:!0}),e));var n={};a(n,{SettingsSchema:()=>c,settings:()=>m});var d=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),c=u.z.object({url:u.z.string().url().describe("The API endpoint URL to send events to"),headers:u.z.record(u.z.string(),u.z.string()).describe("Custom HTTP headers to include with requests").optional(),method:u.z.string().describe("HTTP method to use (default: POST)").optional(),timeout:u.z.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()}),m=(0,d.zodToSchema)(c),p={};a(p,{env:()=>l,step:()=>g});var l={};a(l,{init:()=>v,simulation:()=>b,standard:()=>y});var v={sendServer:void 0},y={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},b=["sendServer"],g={};a(g,{customHeaders:()=>O,customTransform:()=>_,fullEvent:()=>h});var f=require("@walkeros/core"),h={in:(0,f.getEvent)("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({title:"Docs",url:"https://example.com/docs"})}},O={in:(0,f.getEvent)("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({type:"contact",email:"user@example.com"}),headers:{"X-API-Key":"YOUR_API_KEY"}}},_={in:(0,f.getEvent)("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:{url:"https://api.example.com/events",body:JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"})}};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,s=(e,r)=>{for(var o in r)t(e,o,{get:r[o],enumerable:!0})},a={};s(a,{examples:()=>p,schemas:()=>d}),module.exports=(e=a,((e,s,a,d)=>{if(s&&"object"==typeof s||"function"==typeof s)for(let n of o(s))i.call(e,n)||n===a||t(e,n,{get:()=>s[n],enumerable:!(d=r(s,n))||d.enumerable});return e})(t({},"__esModule",{value:!0}),e));var d={};s(d,{SettingsSchema:()=>u,settings:()=>c});var n=require("@walkeros/core/dev"),m=require("@walkeros/core/dev"),u=m.z.object({url:m.z.string().url().describe("The API endpoint URL to send events to"),headers:m.z.record(m.z.string(),m.z.string()).describe("Custom HTTP headers to include with requests").optional(),method:m.z.string().describe("HTTP method to use (default: POST)").optional(),timeout:m.z.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()}),c=(0,n.zodToSchema)(u),p={};s(p,{env:()=>v,step:()=>h});var v={};s(v,{init:()=>l,simulation:()=>g,standard:()=>y});var l={sendServer:void 0},y={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},g=["sendServer"],h={};s(h,{customHeaders:()=>S,customTransform:()=>_,fullEvent:()=>O});var b=require("@walkeros/core"),f="https://api.example.com/events",O={in:(0,b.getEvent)("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:[["sendServer",f,JSON.stringify({title:"Docs",url:"https://example.com/docs"}),{headers:void 0,method:void 0,timeout:void 0}]]},S={in:(0,b.getEvent)("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:[["sendServer",f,JSON.stringify({type:"contact",email:"user@example.com"}),{headers:{"X-API-Key":"YOUR_API_KEY"},method:void 0,timeout:void 0}]]},_={in:(0,b.getEvent)("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:[["sendServer",f,JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"}),{headers:void 0,method:void 0,timeout:void 0}]]};//# 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/examples/index.ts","../src/examples/env.ts","../src/examples/step.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 { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n url: z.string().url().describe('The API endpoint URL to send events to'),\n headers: z\n .record(z.string(), z.string())\n .describe('Custom HTTP headers to include with requests')\n .optional(),\n method: z.string().describe('HTTP method to use (default: POST)').optional(),\n timeout: z\n .number()\n .positive()\n .describe('Request timeout in milliseconds (default: 5000)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n },\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n },\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA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AAe;AAAA,IAC1B,WAAW;AAAA,IACX,MAAM,EAAE,MAAM,WAAW,OAAO,mBAAmB;AAAA,IACnD,QAAQ,EAAE,MAAM,UAAU,IAAI,IAAI,aAAa,GAAG;AAAA,EACpD,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EACA,KAAK;AAAA,IACH,KAAK;AAAA,IACL,MAAM,KAAK,UAAU;AAAA,MACnB,MAAM;AAAA,MACN,OAAO;AAAA,IACT,CAAC;AAAA,IACD,SAAS,EAAE,aAAa,eAAe;AAAA,EACzC;AACF;AAEO,IAAM,kBAAoC;AAAA,EAC/C,QAAI,sBAAS,kBAAkB;AAAA,IAC7B,WAAW;AAAA,IACX,MAAM,EAAE,IAAI,WAAW,OAAO,QAAQ,UAAU,MAAM;AAAA,IACtD,MAAM,EAAE,IAAI,WAAW;AAAA,IACvB,QAAQ,EAAE,MAAM,UAAU,IAAI,IAAI,aAAa,GAAG;AAAA,EACpD,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,aAAa;AAAA,QACb,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,KAAK;AAAA,IACL,MAAM,KAAK,UAAU;AAAA,MACnB,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,aAAa;AAAA,MACb,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AACF;","names":["import_dev"]}
1
+ {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.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 { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n url: z.string().url().describe('The API endpoint URL to send events to'),\n headers: z\n .record(z.string(), z.string())\n .describe('Custom HTTP headers to include with requests')\n .optional(),\n method: z.string().describe('HTTP method to use (default: POST)').optional(),\n timeout: z\n .number()\n .positive()\n .describe('Request timeout in milliseconds (default: 5000)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * API server destination step examples.\n *\n * At push time, the destination calls `env.sendServer(url, body, options)`\n * where `url` is the configured endpoint, `body` is the JSON-stringified\n * event data (or mapped data), and `options` carries headers/method/timeout.\n *\n * Each `out` tuple is `['sendServer', url, body, options]` mirroring the real\n * call signature. The test fixture injects the configured settings per example.\n */\nconst URL = 'https://api.example.com/events';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n { headers: undefined, method: undefined, timeout: undefined },\n ],\n ],\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n {\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n method: undefined,\n timeout: undefined,\n },\n ],\n ],\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n { headers: undefined, method: undefined, timeout: undefined },\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,KAAK,aAAE,OAAO,EAAE,IAAI,EAAE,SAAS,wCAAwC;AAAA,EACvE,SAAS,aACN,OAAO,aAAE,OAAO,GAAG,aAAE,OAAO,CAAC,EAC7B,SAAS,8CAA8C,EACvD,SAAS;AAAA,EACZ,QAAQ,aAAE,OAAO,EAAE,SAAS,oCAAoC,EAAE,SAAS;AAAA,EAC3E,SAAS,aACN,OAAO,EACP,SAAS,EACT,SAAS,iDAAiD,EAC1D,SAAS;AACd,CAAC;;;ADRM,IAAM,eAAW,yBAAY,cAAc;;;AENlD;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAM,OAAO,MAAM,QAAQ,QAAQ,EAA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AS,kBAAkB;AAAA,IAC7B,WAAW;AAAA,IACX,MAAM,EAAE,IAAI,WAAW,OAAO,QAAQ,UAAU,MAAM;AAAA,IACtD,MAAM,EAAE,IAAI,WAAW;AAAA,IACvB,QAAQ,EAAE,MAAM,UAAU,IAAI,IAAI,aAAa,GAAG;AAAA,EACpD,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,aAAa;AAAA,QACb,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,KAAK,UAAU;AAAA,QACb,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,aAAa;AAAA,QACb,YAAY;AAAA,MACd,CAAC;AAAA,MACD,EAAE,SAAS,QAAW,QAAQ,QAAW,SAAS,OAAU;AAAA,IAC9D;AAAA,EACF;AACF;","names":["import_dev"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,r)=>{for(var o in r)e(t,o,{get:r[o],enumerable:!0})},r={};t(r,{SettingsSchema:()=>a,settings:()=>i});import{zodToSchema as o}from"@walkeros/core/dev";import{z as s}from"@walkeros/core/dev";var a=s.object({url:s.string().url().describe("The API endpoint URL to send events to"),headers:s.record(s.string(),s.string()).describe("Custom HTTP headers to include with requests").optional(),method:s.string().describe("HTTP method to use (default: POST)").optional(),timeout:s.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()}),i=o(a),d={};t(d,{env:()=>m,step:()=>u});var m={};t(m,{init:()=>n,simulation:()=>c,standard:()=>p});var n={sendServer:void 0},p={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},c=["sendServer"],u={};t(u,{customHeaders:()=>y,customTransform:()=>b,fullEvent:()=>v});import{getEvent as l}from"@walkeros/core";var v={in:l("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({title:"Docs",url:"https://example.com/docs"})}},y={in:l("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({type:"contact",email:"user@example.com"}),headers:{"X-API-Key":"YOUR_API_KEY"}}},b={in:l("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:{url:"https://api.example.com/events",body:JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"})}};export{d as examples,r as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,r)=>{for(var o in r)e(t,o,{get:r[o],enumerable:!0})},r={};t(r,{SettingsSchema:()=>s,settings:()=>a});import{zodToSchema as o}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";var s=i.object({url:i.string().url().describe("The API endpoint URL to send events to"),headers:i.record(i.string(),i.string()).describe("Custom HTTP headers to include with requests").optional(),method:i.string().describe("HTTP method to use (default: POST)").optional(),timeout:i.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()}),a=o(s),d={};t(d,{env:()=>m,step:()=>p});var m={};t(m,{init:()=>n,simulation:()=>c,standard:()=>u});var n={sendServer:void 0},u={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},c=["sendServer"],p={};t(p,{customHeaders:()=>h,customTransform:()=>g,fullEvent:()=>y});import{getEvent as v}from"@walkeros/core";var l="https://api.example.com/events",y={in:v("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:[["sendServer",l,JSON.stringify({title:"Docs",url:"https://example.com/docs"}),{headers:void 0,method:void 0,timeout:void 0}]]},h={in:v("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:[["sendServer",l,JSON.stringify({type:"contact",email:"user@example.com"}),{headers:{"X-API-Key":"YOUR_API_KEY"},method:void 0,timeout:void 0}]]},g={in:v("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:[["sendServer",l,JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"}),{headers:void 0,method:void 0,timeout:void 0}]]};export{d as examples,r 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/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n url: z.string().url().describe('The API endpoint URL to send events to'),\n headers: z\n .record(z.string(), z.string())\n .describe('Custom HTTP headers to include with requests')\n .optional(),\n method: z.string().describe('HTTP method to use (default: POST)').optional(),\n timeout: z\n .number()\n .positive()\n .describe('Request timeout in milliseconds (default: 5000)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n },\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n },\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n },\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACr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AAG;AAAA,EACpD,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EACA,KAAK;AAAA,IACH,KAAK;AAAA,IACL,MAAM,KAAK,UAAU;AAAA,MACnB,MAAM;AAAA,MACN,OAAO;AAAA,IACT,CAAC;AAAA,IACD,SAAS,EAAE,aAAa,eAAe;AAAA,EACzC;AACF;AAEO,IAAM,kBAAoC;AAAA,EAC/C,IAAI,SAAS,kBAAkB;AAAA,IAC7B,WAAW;AAAA,IACX,MAAM,EAAE,IAAI,WAAW,OAAO,QAAQ,UAAU,MAAM;AAAA,IACtD,MAAM,EAAE,IAAI,WAAW;AAAA,IACvB,QAAQ,EAAE,MAAM,UAAU,IAAI,IAAI,aAAa,GAAG;AAAA,EACpD,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,aAAa;AAAA,QACb,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,KAAK;AAAA,IACL,MAAM,KAAK,UAAU;AAAA,MACnB,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,aAAa;AAAA,MACb,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n url: z.string().url().describe('The API endpoint URL to send events to'),\n headers: z\n .record(z.string(), z.string())\n .describe('Custom HTTP headers to include with requests')\n .optional(),\n method: z.string().describe('HTTP method to use (default: POST)').optional(),\n timeout: z\n .number()\n .positive()\n .describe('Request timeout in milliseconds (default: 5000)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * API server destination step examples.\n *\n * At push time, the destination calls `env.sendServer(url, body, options)`\n * where `url` is the configured endpoint, `body` is the JSON-stringified\n * event data (or mapped data), and `options` carries headers/method/timeout.\n *\n * Each `out` tuple is `['sendServer', url, body, options]` mirroring the real\n * call signature. The test fixture injects the configured settings per example.\n */\nconst URL = 'https://api.example.com/events';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n { headers: undefined, method: undefined, timeout: undefined },\n ],\n ],\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n {\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n method: undefined,\n timeout: undefined,\n },\n ],\n ],\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n { headers: undefined, method: undefined, timeout: undefined },\n ],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,wCAAwC;AAAA,EACvE,SAAS,EACN,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B,SAAS,8CAA8C,EACvD,SAAS;AAAA,EACZ,QAAQ,EAAE,OAAO,EAAE,SAAS,oCAAoC,EAAE,SAAS;AAAA,EAC3E,SAAS,EACN,OAAO,EACP,SAAS,EACT,SAAS,iDAAiD,EAC1D,SAAS;AACd,CAAC;;;ADRM,IAAM,WAAW,YAAY,cAAc;;;AENlD;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAM,OAAO,MAAM,QAAQ,QAAQ,EAAE,IAAI,KAAK,CAAC;AAExC,IAAM,OAAwB;AAAA,EACnC,YAAY;AACd;AAEO,IAAM,WAAgB;AAAA,EAC3B,YAAY,OAAO,OAAO,MAAM;AAAA;AAAA,EAEhC,CAAC;AACH;AAMO,IAAM,aAAa,CAAC,YAAY;;;ACzBvC;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,SAAS,gB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ACP,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,aAAa;AAAA,QACb,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,KAAK,UAAU;AAAA,QACb,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,aAAa;AAAA,QACb,YAAY;AAAA,MACd,CAAC;AAAA,MACD,EAAE,SAAS,QAAW,QAAQ,QAAW,SAAS,OAAU;AAAA,IAC9D;AAAA,EACF;AACF;","names":[]}
@@ -51,6 +51,7 @@ __export(step_exports, {
51
51
  fullEvent: () => fullEvent
52
52
  });
53
53
  var import_core = require("@walkeros/core");
54
+ var URL = "https://api.example.com/events";
54
55
  var fullEvent = {
55
56
  in: (0, import_core.getEvent)("page view", {
56
57
  timestamp: 1700000800,
@@ -60,13 +61,17 @@ var fullEvent = {
60
61
  mapping: {
61
62
  data: "data"
62
63
  },
63
- out: {
64
- url: "https://api.example.com/events",
65
- body: JSON.stringify({
66
- title: "Docs",
67
- url: "https://example.com/docs"
68
- })
69
- }
64
+ out: [
65
+ [
66
+ "sendServer",
67
+ URL,
68
+ JSON.stringify({
69
+ title: "Docs",
70
+ url: "https://example.com/docs"
71
+ }),
72
+ { headers: void 0, method: void 0, timeout: void 0 }
73
+ ]
74
+ ]
70
75
  };
71
76
  var customHeaders = {
72
77
  in: (0, import_core.getEvent)("form submit", {
@@ -77,14 +82,21 @@ var customHeaders = {
77
82
  mapping: {
78
83
  data: "data"
79
84
  },
80
- out: {
81
- url: "https://api.example.com/events",
82
- body: JSON.stringify({
83
- type: "contact",
84
- email: "user@example.com"
85
- }),
86
- headers: { "X-API-Key": "YOUR_API_KEY" }
87
- }
85
+ out: [
86
+ [
87
+ "sendServer",
88
+ URL,
89
+ JSON.stringify({
90
+ type: "contact",
91
+ email: "user@example.com"
92
+ }),
93
+ {
94
+ headers: { "X-API-Key": "YOUR_API_KEY" },
95
+ method: void 0,
96
+ timeout: void 0
97
+ }
98
+ ]
99
+ ]
88
100
  };
89
101
  var customTransform = {
90
102
  in: (0, import_core.getEvent)("order complete", {
@@ -104,16 +116,20 @@ var customTransform = {
104
116
  }
105
117
  }
106
118
  },
107
- out: {
108
- url: "https://api.example.com/events",
109
- body: JSON.stringify({
110
- order_id: "ORD-500",
111
- amount: 199.99,
112
- currency: "USD",
113
- customer_id: "buyer-42",
114
- event_type: "order complete"
115
- })
116
- }
119
+ out: [
120
+ [
121
+ "sendServer",
122
+ URL,
123
+ JSON.stringify({
124
+ order_id: "ORD-500",
125
+ amount: 199.99,
126
+ currency: "USD",
127
+ customer_id: "buyer-42",
128
+ event_type: "order complete"
129
+ }),
130
+ { headers: void 0, method: void 0, timeout: void 0 }
131
+ ]
132
+ ]
117
133
  };
118
134
  // Annotate the CommonJS export names for ESM import in node:
119
135
  0 && (module.exports = {
@@ -30,6 +30,7 @@ __export(step_exports, {
30
30
  fullEvent: () => fullEvent
31
31
  });
32
32
  import { getEvent } from "@walkeros/core";
33
+ var URL = "https://api.example.com/events";
33
34
  var fullEvent = {
34
35
  in: getEvent("page view", {
35
36
  timestamp: 1700000800,
@@ -39,13 +40,17 @@ var fullEvent = {
39
40
  mapping: {
40
41
  data: "data"
41
42
  },
42
- out: {
43
- url: "https://api.example.com/events",
44
- body: JSON.stringify({
45
- title: "Docs",
46
- url: "https://example.com/docs"
47
- })
48
- }
43
+ out: [
44
+ [
45
+ "sendServer",
46
+ URL,
47
+ JSON.stringify({
48
+ title: "Docs",
49
+ url: "https://example.com/docs"
50
+ }),
51
+ { headers: void 0, method: void 0, timeout: void 0 }
52
+ ]
53
+ ]
49
54
  };
50
55
  var customHeaders = {
51
56
  in: getEvent("form submit", {
@@ -56,14 +61,21 @@ var customHeaders = {
56
61
  mapping: {
57
62
  data: "data"
58
63
  },
59
- out: {
60
- url: "https://api.example.com/events",
61
- body: JSON.stringify({
62
- type: "contact",
63
- email: "user@example.com"
64
- }),
65
- headers: { "X-API-Key": "YOUR_API_KEY" }
66
- }
64
+ out: [
65
+ [
66
+ "sendServer",
67
+ URL,
68
+ JSON.stringify({
69
+ type: "contact",
70
+ email: "user@example.com"
71
+ }),
72
+ {
73
+ headers: { "X-API-Key": "YOUR_API_KEY" },
74
+ method: void 0,
75
+ timeout: void 0
76
+ }
77
+ ]
78
+ ]
67
79
  };
68
80
  var customTransform = {
69
81
  in: getEvent("order complete", {
@@ -83,16 +95,20 @@ var customTransform = {
83
95
  }
84
96
  }
85
97
  },
86
- out: {
87
- url: "https://api.example.com/events",
88
- body: JSON.stringify({
89
- order_id: "ORD-500",
90
- amount: 199.99,
91
- currency: "USD",
92
- customer_id: "buyer-42",
93
- event_type: "order complete"
94
- })
95
- }
98
+ out: [
99
+ [
100
+ "sendServer",
101
+ URL,
102
+ JSON.stringify({
103
+ order_id: "ORD-500",
104
+ amount: 199.99,
105
+ currency: "USD",
106
+ customer_id: "buyer-42",
107
+ event_type: "order complete"
108
+ }),
109
+ { headers: void 0, method: void 0, timeout: void 0 }
110
+ ]
111
+ ]
96
112
  };
97
113
  export {
98
114
  env_exports as env,
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var mod,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},index_exports={};__export(index_exports,{DestinationAPI:()=>types_exports,default:()=>index_default,destinationAPI:()=>destinationAPI,examples:()=>examples_exports}),module.exports=(mod=index_exports,((to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to})(__defProp({},"__esModule",{value:!0}),mod));var import_core2=require("@walkeros/core"),import_server_core=require("@walkeros/server-core"),types_exports={},examples_exports={};__export(examples_exports,{env:()=>env_exports,step:()=>step_exports});var env_exports={};__export(env_exports,{init:()=>init,simulation:()=>simulation,standard:()=>standard});var init={sendServer:void 0},standard={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},simulation=["sendServer"],step_exports={};__export(step_exports,{customHeaders:()=>customHeaders,customTransform:()=>customTransform,fullEvent:()=>fullEvent});var import_core=require("@walkeros/core"),fullEvent={in:(0,import_core.getEvent)("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({title:"Docs",url:"https://example.com/docs"})}},customHeaders={in:(0,import_core.getEvent)("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({type:"contact",email:"user@example.com"}),headers:{"X-API-Key":"YOUR_API_KEY"}}},customTransform={in:(0,import_core.getEvent)("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:{url:"https://api.example.com/events",body:JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"})}},destinationAPI={type:"api",config:{},env:{sendServer:import_server_core.sendServer},async push(event,{config:config,rule:rule,data:data,env:env,logger:logger}){const{settings:settings}=config,{url:url,headers:headers,method:method,transform:transform,timeout:timeout}=settings||{};if(!url)return;const eventData=(0,import_core2.isDefined)(data)?data:event,body=transform?transform(eventData,config,rule):JSON.stringify(eventData);null==logger||logger.debug("API destination sending request",{url:url,method:method||"POST",eventName:event.name});const sendServerFn=(null==env?void 0:env.sendServer)||import_server_core.sendServer,response=await sendServerFn(url,body,{headers:headers,method:method,timeout:timeout});null==logger||logger.debug("API destination response",{ok:null==response?void 0:response.ok})}},index_default=destinationAPI;//# sourceMappingURL=index.js.map
1
+ "use strict";var mod,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},index_exports={};__export(index_exports,{DestinationAPI:()=>types_exports,default:()=>index_default,destinationAPI:()=>destinationAPI,examples:()=>examples_exports}),module.exports=(mod=index_exports,((to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to})(__defProp({},"__esModule",{value:!0}),mod));var import_core2=require("@walkeros/core"),import_server_core=require("@walkeros/server-core"),types_exports={},examples_exports={};__export(examples_exports,{env:()=>env_exports,step:()=>step_exports});var env_exports={};__export(env_exports,{init:()=>init,simulation:()=>simulation,standard:()=>standard});var init={sendServer:void 0},standard={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},simulation=["sendServer"],step_exports={};__export(step_exports,{customHeaders:()=>customHeaders,customTransform:()=>customTransform,fullEvent:()=>fullEvent});var import_core=require("@walkeros/core"),URL="https://api.example.com/events",fullEvent={in:(0,import_core.getEvent)("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:[["sendServer",URL,JSON.stringify({title:"Docs",url:"https://example.com/docs"}),{headers:void 0,method:void 0,timeout:void 0}]]},customHeaders={in:(0,import_core.getEvent)("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:[["sendServer",URL,JSON.stringify({type:"contact",email:"user@example.com"}),{headers:{"X-API-Key":"YOUR_API_KEY"},method:void 0,timeout:void 0}]]},customTransform={in:(0,import_core.getEvent)("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:[["sendServer",URL,JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"}),{headers:void 0,method:void 0,timeout:void 0}]]},destinationAPI={type:"api",config:{},env:{sendServer:import_server_core.sendServer},async push(event,{config:config,rule:rule,data:data,env:env,logger:logger}){const{settings:settings}=config,{url:url,headers:headers,method:method,transform:transform,timeout:timeout}=settings||{};if(!url)return;const eventData=(0,import_core2.isDefined)(data)?data:event,body=transform?transform(eventData,config,rule):JSON.stringify(eventData);null==logger||logger.debug("API destination sending request",{url:url,method:method||"POST",eventName:event.name});const sendServerFn=(null==env?void 0:env.sendServer)||import_server_core.sendServer,response=await sendServerFn(url,body,{headers:headers,method:method,timeout:timeout});null==logger||logger.debug("API destination response",{ok:null==response?void 0:response.ok})}},index_default=destinationAPI;//# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import type { Settings, Destination, Env } from './types';\nimport { isDefined } from '@walkeros/core';\nimport { sendServer } from '@walkeros/server-core';\n\n// Types\nexport * as DestinationAPI from './types';\n\n// Examples\nexport * as examples from './examples';\n\nexport const destinationAPI: Destination = {\n type: 'api',\n\n config: {},\n\n env: { sendServer },\n\n async push(event, { config, rule, data, env, logger }) {\n const { settings } = config;\n const { url, headers, method, transform, timeout } = settings || {};\n\n if (!url) return;\n\n const eventData = isDefined(data) ? data : event;\n const body = transform\n ? transform(eventData, config, rule) // Transform event data\n : JSON.stringify(eventData);\n\n logger?.debug('API destination sending request', {\n url,\n method: method || 'POST',\n eventName: event.name,\n });\n\n const sendServerFn = (env as Env)?.sendServer || sendServer;\n const response = await sendServerFn(url, body, {\n headers,\n method,\n timeout,\n });\n\n logger?.debug('API destination response', { ok: response?.ok });\n },\n};\n\nexport default destinationAPI;\n","import type {\n Mapping as WalkerOSMapping,\n SendDataValue,\n SendHeaders,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationServer, sendServer } from '@walkeros/server-core';\n\nexport interface Settings {\n url: string;\n headers?: SendHeaders;\n method?: string;\n transform?: Transform;\n timeout?: number;\n}\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationServer.Env {\n sendServer?: typeof sendServer;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env>;\n\nexport type Destination = DestinationServer.Destination<Types>;\nexport type Config = DestinationServer.Config<Types>;\nexport type PushFn = DestinationServer.PushFn<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type Transform = (\n data?: unknown,\n config?: Config,\n mapping?: WalkerOSMapping.Rule<Mapping>,\n) => SendDataValue;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n },\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n },\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA0B;AAC1B,yBAA2B;;;ACF3B;;;ACAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAM,OAAO,MAAM,QAAQ,QAAQ,EAAE,IAAI,KAAK,CAAC;AAExC,IAAM,OAAwB;AAAA,EACnC,YAAY;AACd;AAEO,IAAM,WAAgB;AAAA,EAC3B,YAAY,OAAO,OAAO,MAAM;AAAA;AAAA,EAEhC,CAAC;AACH;AAMO,IAAM,aAAa,CAAC,YAAY;;;ACzBvC;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAyB;AAElB,IAAM,YAA8B;AAAA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AAK,UAAU;AAAA,MACnB,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,aAAa;AAAA,MACb,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AACF;;;AJ1DO,IAAM,iBAA8B;AAAA,EACzC,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,0CAAW;AAAA,EAElB,MAAM,KAAK,OAAO,EAAE,QAAQ,MAAM,MAAM,KAAK,OAAO,GAAG;AACrD,UAAM,EAAE,SAAS,IAAI;AACrB,UAAM,EAAE,KAAK,SAAS,QAAQ,WAAW,QAAQ,IAAI,YAAY,CAAC;AAElE,QAAI,CAAC,IAAK;AAEV,UAAM,gBAAY,wBAAU,IAAI,IAAI,OAAO;AAC3C,UAAM,OAAO,YACT,UAAU,WAAW,QAAQ,IAAI,IACjC,KAAK,UAAU,SAAS;AAE5B,qCAAQ,MAAM,mCAAmC;AAAA,MAC/C;AAAA,MACA,QAAQ,UAAU;AAAA,MAClB,WAAW,MAAM;AAAA,IACnB;AAEA,UAAM,gBAAgB,2BAAa,eAAc;AACjD,UAAM,WAAW,MAAM,aAAa,KAAK,MAAM;AAAA,MAC7C;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,qCAAQ,MAAM,4BAA4B,EAAE,IAAI,qCAAU,GAAG;AAAA,EAC/D;AACF;AAEA,IAAO,gBAAQ;","names":["import_core"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import type { Settings, Destination, Env } from './types';\nimport { isDefined } from '@walkeros/core';\nimport { sendServer } from '@walkeros/server-core';\n\n// Types\nexport * as DestinationAPI from './types';\n\n// Examples\nexport * as examples from './examples';\n\nexport const destinationAPI: Destination = {\n type: 'api',\n\n config: {},\n\n env: { sendServer },\n\n async push(event, { config, rule, data, env, logger }) {\n const { settings } = config;\n const { url, headers, method, transform, timeout } = settings || {};\n\n if (!url) return;\n\n const eventData = isDefined(data) ? data : event;\n const body = transform\n ? transform(eventData, config, rule) // Transform event data\n : JSON.stringify(eventData);\n\n logger?.debug('API destination sending request', {\n url,\n method: method || 'POST',\n eventName: event.name,\n });\n\n const sendServerFn = (env as Env)?.sendServer || sendServer;\n const response = await sendServerFn(url, body, {\n headers,\n method,\n timeout,\n });\n\n logger?.debug('API destination response', { ok: response?.ok });\n },\n};\n\nexport default destinationAPI;\n","import type {\n Mapping as WalkerOSMapping,\n SendDataValue,\n SendHeaders,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationServer, sendServer } from '@walkeros/server-core';\n\nexport interface Settings {\n url: string;\n headers?: SendHeaders;\n method?: string;\n transform?: Transform;\n timeout?: number;\n}\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationServer.Env {\n sendServer?: typeof sendServer;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env>;\n\nexport type Destination = DestinationServer.Destination<Types>;\nexport type Config = DestinationServer.Config<Types>;\nexport type PushFn = DestinationServer.PushFn<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type Transform = (\n data?: unknown,\n config?: Config,\n mapping?: WalkerOSMapping.Rule<Mapping>,\n) => SendDataValue;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * API server destination step examples.\n *\n * At push time, the destination calls `env.sendServer(url, body, options)`\n * where `url` is the configured endpoint, `body` is the JSON-stringified\n * event data (or mapped data), and `options` carries headers/method/timeout.\n *\n * Each `out` tuple is `['sendServer', url, body, options]` mirroring the real\n * call signature. The test fixture injects the configured settings per example.\n */\nconst URL = 'https://api.example.com/events';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n { headers: undefined, method: undefined, timeout: undefined },\n ],\n ],\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n {\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n method: undefined,\n timeout: undefined,\n },\n ],\n ],\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n { headers: undefined, method: undefined, timeout: undefined },\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA0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A,MACA,QAAQ,UAAU;AAAA,MAClB,WAAW,MAAM;AAAA,IACnB;AAEA,UAAM,gBAAgB,2BAAa,eAAc;AACjD,UAAM,WAAW,MAAM,aAAa,KAAK,MAAM;AAAA,MAC7C;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,qCAAQ,MAAM,4BAA4B,EAAE,IAAI,qCAAU,GAAG;AAAA,EAC/D;AACF;AAEA,IAAO,gBAAQ;","names":["import_core"]}
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var __defProp=Object.defineProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})};import{isDefined}from"@walkeros/core";import{sendServer}from"@walkeros/server-core";var types_exports={},examples_exports={};__export(examples_exports,{env:()=>env_exports,step:()=>step_exports});var env_exports={};__export(env_exports,{init:()=>init,simulation:()=>simulation,standard:()=>standard});var init={sendServer:void 0},standard={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},simulation=["sendServer"],step_exports={};__export(step_exports,{customHeaders:()=>customHeaders,customTransform:()=>customTransform,fullEvent:()=>fullEvent});import{getEvent}from"@walkeros/core";var fullEvent={in:getEvent("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({title:"Docs",url:"https://example.com/docs"})}},customHeaders={in:getEvent("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({type:"contact",email:"user@example.com"}),headers:{"X-API-Key":"YOUR_API_KEY"}}},customTransform={in:getEvent("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:{url:"https://api.example.com/events",body:JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"})}},destinationAPI={type:"api",config:{},env:{sendServer:sendServer},async push(event,{config:config,rule:rule,data:data,env:env,logger:logger}){const{settings:settings}=config,{url:url,headers:headers,method:method,transform:transform,timeout:timeout}=settings||{};if(!url)return;const eventData=isDefined(data)?data:event,body=transform?transform(eventData,config,rule):JSON.stringify(eventData);null==logger||logger.debug("API destination sending request",{url:url,method:method||"POST",eventName:event.name});const sendServerFn=(null==env?void 0:env.sendServer)||sendServer,response=await sendServerFn(url,body,{headers:headers,method:method,timeout:timeout});null==logger||logger.debug("API destination response",{ok:null==response?void 0:response.ok})}},index_default=destinationAPI;export{types_exports as DestinationAPI,index_default as default,destinationAPI,examples_exports as examples};//# sourceMappingURL=index.mjs.map
1
+ var __defProp=Object.defineProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})};import{isDefined}from"@walkeros/core";import{sendServer}from"@walkeros/server-core";var types_exports={},examples_exports={};__export(examples_exports,{env:()=>env_exports,step:()=>step_exports});var env_exports={};__export(env_exports,{init:()=>init,simulation:()=>simulation,standard:()=>standard});var init={sendServer:void 0},standard={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},simulation=["sendServer"],step_exports={};__export(step_exports,{customHeaders:()=>customHeaders,customTransform:()=>customTransform,fullEvent:()=>fullEvent});import{getEvent}from"@walkeros/core";var URL="https://api.example.com/events",fullEvent={in:getEvent("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:[["sendServer",URL,JSON.stringify({title:"Docs",url:"https://example.com/docs"}),{headers:void 0,method:void 0,timeout:void 0}]]},customHeaders={in:getEvent("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:[["sendServer",URL,JSON.stringify({type:"contact",email:"user@example.com"}),{headers:{"X-API-Key":"YOUR_API_KEY"},method:void 0,timeout:void 0}]]},customTransform={in:getEvent("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:[["sendServer",URL,JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"}),{headers:void 0,method:void 0,timeout:void 0}]]},destinationAPI={type:"api",config:{},env:{sendServer:sendServer},async push(event,{config:config,rule:rule,data:data,env:env,logger:logger}){const{settings:settings}=config,{url:url,headers:headers,method:method,transform:transform,timeout:timeout}=settings||{};if(!url)return;const eventData=isDefined(data)?data:event,body=transform?transform(eventData,config,rule):JSON.stringify(eventData);null==logger||logger.debug("API destination sending request",{url:url,method:method||"POST",eventName:event.name});const sendServerFn=(null==env?void 0:env.sendServer)||sendServer,response=await sendServerFn(url,body,{headers:headers,method:method,timeout:timeout});null==logger||logger.debug("API destination response",{ok:null==response?void 0:response.ok})}},index_default=destinationAPI;export{types_exports as DestinationAPI,index_default as default,destinationAPI,examples_exports as examples};//# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import type { Settings, Destination, Env } from './types';\nimport { isDefined } from '@walkeros/core';\nimport { sendServer } from '@walkeros/server-core';\n\n// Types\nexport * as DestinationAPI from './types';\n\n// Examples\nexport * as examples from './examples';\n\nexport const destinationAPI: Destination = {\n type: 'api',\n\n config: {},\n\n env: { sendServer },\n\n async push(event, { config, rule, data, env, logger }) {\n const { settings } = config;\n const { url, headers, method, transform, timeout } = settings || {};\n\n if (!url) return;\n\n const eventData = isDefined(data) ? data : event;\n const body = transform\n ? transform(eventData, config, rule) // Transform event data\n : JSON.stringify(eventData);\n\n logger?.debug('API destination sending request', {\n url,\n method: method || 'POST',\n eventName: event.name,\n });\n\n const sendServerFn = (env as Env)?.sendServer || sendServer;\n const response = await sendServerFn(url, body, {\n headers,\n method,\n timeout,\n });\n\n logger?.debug('API destination response', { ok: response?.ok });\n },\n};\n\nexport default destinationAPI;\n","import type {\n Mapping as WalkerOSMapping,\n SendDataValue,\n SendHeaders,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationServer, sendServer } from '@walkeros/server-core';\n\nexport interface Settings {\n url: string;\n headers?: SendHeaders;\n method?: string;\n transform?: Transform;\n timeout?: number;\n}\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationServer.Env {\n sendServer?: typeof sendServer;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env>;\n\nexport type Destination = DestinationServer.Destination<Types>;\nexport type Config = DestinationServer.Config<Types>;\nexport type PushFn = DestinationServer.PushFn<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type Transform = (\n data?: unknown,\n config?: Config,\n mapping?: WalkerOSMapping.Rule<Mapping>,\n) => SendDataValue;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n },\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n },\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n },\n};\n"],"mappings":";;;;;;;AACA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;;;ACF3B;;;ACAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAM,OAAO,MAAM,QAAQ,QAAQ,EAAE,IAAI,KAAK,CAAC;AAExC,IAAM,OAAwB;AAAA,EACnC,YAAY;AACd;AAEO,IAAM,WAAgB;AAAA,EAC3B,YAAY,OAAO,OAAO,MAAM;AAAA;AAAA,EAEhC,CAAC;AACH;AAMO,IAAM,aAAa,CAAC,YAAY;;;ACzBvC;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,SAAS,gBAAgB;AAElB,IAAM,YAA8B;AAAA,EACzC,IAAI,SAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,MAAM,EAAE,OAAO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aAAa;AAAA,MACb,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AACF;;;AJ1DO,IAAM,iBAA8B;AAAA,EACzC,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,WAAW;AAAA,EAElB,MAAM,KAAK,OAAO,EAAE,QAAQ,MAAM,MAAM,KAAK,OAAO,GAAG;AACrD,UAAM,EAAE,SAAS,IAAI;AACrB,UAAM,EAAE,KAAK,SAAS,QAAQ,WAAW,QAAQ,IAAI,YAAY,CAAC;AAElE,QAAI,CAAC,IAAK;AAEV,UAAM,YAAY,UAAU,IAAI,IAAI,OAAO;AAC3C,UAAM,OAAO,YACT,UAAU,WAAW,QAAQ,IAAI,IACjC,KAAK,UAAU,SAAS;AAE5B,qCAAQ,MAAM,mCAAmC;AAAA,MAC/C;AAAA,MACA,QAAQ,UAAU;AAAA,MAClB,WAAW,MAAM;AAAA,IACnB;AAEA,UAAM,gBAAgB,2BAAa,eAAc;AACjD,UAAM,WAAW,MAAM,aAAa,KAAK,MAAM;AAAA,MAC7C;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,qCAAQ,MAAM,4BAA4B,EAAE,IAAI,qCAAU,GAAG;AAAA,EAC/D;AACF;AAEA,IAAO,gBAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import type { Settings, Destination, Env } from './types';\nimport { isDefined } from '@walkeros/core';\nimport { sendServer } from '@walkeros/server-core';\n\n// Types\nexport * as DestinationAPI from './types';\n\n// Examples\nexport * as examples from './examples';\n\nexport const destinationAPI: Destination = {\n type: 'api',\n\n config: {},\n\n env: { sendServer },\n\n async push(event, { config, rule, data, env, logger }) {\n const { settings } = config;\n const { url, headers, method, transform, timeout } = settings || {};\n\n if (!url) return;\n\n const eventData = isDefined(data) ? data : event;\n const body = transform\n ? transform(eventData, config, rule) // Transform event data\n : JSON.stringify(eventData);\n\n logger?.debug('API destination sending request', {\n url,\n method: method || 'POST',\n eventName: event.name,\n });\n\n const sendServerFn = (env as Env)?.sendServer || sendServer;\n const response = await sendServerFn(url, body, {\n headers,\n method,\n timeout,\n });\n\n logger?.debug('API destination response', { ok: response?.ok });\n },\n};\n\nexport default destinationAPI;\n","import type {\n Mapping as WalkerOSMapping,\n SendDataValue,\n SendHeaders,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationServer, sendServer } from '@walkeros/server-core';\n\nexport interface Settings {\n url: string;\n headers?: SendHeaders;\n method?: string;\n transform?: Transform;\n timeout?: number;\n}\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationServer.Env {\n sendServer?: typeof sendServer;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env>;\n\nexport type Destination = DestinationServer.Destination<Types>;\nexport type Config = DestinationServer.Config<Types>;\nexport type PushFn = DestinationServer.PushFn<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type Transform = (\n data?: unknown,\n config?: Config,\n mapping?: WalkerOSMapping.Rule<Mapping>,\n) => SendDataValue;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * API server destination step examples.\n *\n * At push time, the destination calls `env.sendServer(url, body, options)`\n * where `url` is the configured endpoint, `body` is the JSON-stringified\n * event data (or mapped data), and `options` carries headers/method/timeout.\n *\n * Each `out` tuple is `['sendServer', url, body, options]` mirroring the real\n * call signature. The test fixture injects the configured settings per example.\n */\nconst URL = 'https://api.example.com/events';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n { headers: undefined, method: undefined, timeout: undefined },\n ],\n ],\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n {\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n method: undefined,\n timeout: undefined,\n },\n ],\n ],\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n { headers: undefined, method: undefined, timeout: undefined },\n ],\n ],\n};\n"],"mappings":";;;;;;;AACA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;;;ACF3B;;;ACAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAM,OAAO,MAAM,QAAQ,QAAQ,EAAE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7C;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,qCAAQ,MAAM,4BAA4B,EAAE,IAAI,qCAAU,GAAG;AAAA,EAC/D;AACF;AAEA,IAAO,gBAAQ;","names":[]}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/server-destination-api",
4
- "version": "3.3.1",
4
+ "version": "3.4.0-next-1776749829492",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "server"
@@ -109,7 +109,7 @@
109
109
  "group": "gr0up",
110
110
  "count": 1,
111
111
  "version": {
112
- "source": "3.3.1",
112
+ "source": "3.4.0-next-1776749829492",
113
113
  "tagging": 1
114
114
  },
115
115
  "source": {
@@ -121,13 +121,18 @@
121
121
  "mapping": {
122
122
  "data": "data"
123
123
  },
124
- "out": {
125
- "url": "https://api.example.com/events",
126
- "body": "{\"type\":\"contact\",\"email\":\"user@example.com\"}",
127
- "headers": {
128
- "X-API-Key": "YOUR_API_KEY"
129
- }
130
- }
124
+ "out": [
125
+ [
126
+ "sendServer",
127
+ "https://api.example.com/events",
128
+ "{\"type\":\"contact\",\"email\":\"user@example.com\"}",
129
+ {
130
+ "headers": {
131
+ "X-API-Key": "YOUR_API_KEY"
132
+ }
133
+ }
134
+ ]
135
+ ]
131
136
  },
132
137
  "customTransform": {
133
138
  "in": {
@@ -212,7 +217,7 @@
212
217
  "group": "gr0up",
213
218
  "count": 1,
214
219
  "version": {
215
- "source": "3.3.1",
220
+ "source": "3.4.0-next-1776749829492",
216
221
  "tagging": 1
217
222
  },
218
223
  "source": {
@@ -232,10 +237,14 @@
232
237
  }
233
238
  }
234
239
  },
235
- "out": {
236
- "url": "https://api.example.com/events",
237
- "body": "{\"order_id\":\"ORD-500\",\"amount\":199.99,\"currency\":\"USD\",\"customer_id\":\"buyer-42\",\"event_type\":\"order complete\"}"
238
- }
240
+ "out": [
241
+ [
242
+ "sendServer",
243
+ "https://api.example.com/events",
244
+ "{\"order_id\":\"ORD-500\",\"amount\":199.99,\"currency\":\"USD\",\"customer_id\":\"buyer-42\",\"event_type\":\"order complete\"}",
245
+ {}
246
+ ]
247
+ ]
239
248
  },
240
249
  "fullEvent": {
241
250
  "in": {
@@ -288,7 +297,7 @@
288
297
  "group": "gr0up",
289
298
  "count": 1,
290
299
  "version": {
291
- "source": "3.3.1",
300
+ "source": "3.4.0-next-1776749829492",
292
301
  "tagging": 1
293
302
  },
294
303
  "source": {
@@ -300,10 +309,14 @@
300
309
  "mapping": {
301
310
  "data": "data"
302
311
  },
303
- "out": {
304
- "url": "https://api.example.com/events",
305
- "body": "{\"title\":\"Docs\",\"url\":\"https://example.com/docs\"}"
306
- }
312
+ "out": [
313
+ [
314
+ "sendServer",
315
+ "https://api.example.com/events",
316
+ "{\"title\":\"Docs\",\"url\":\"https://example.com/docs\"}",
317
+ {}
318
+ ]
319
+ ]
307
320
  }
308
321
  }
309
322
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/server-destination-api",
3
3
  "description": "API server destination for walkerOS",
4
- "version": "3.3.1",
4
+ "version": "3.4.0-next-1776749829492",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -37,8 +37,8 @@
37
37
  "update": "npx npm-check-updates -u && npm update"
38
38
  },
39
39
  "dependencies": {
40
- "@walkeros/core": "3.3.1",
41
- "@walkeros/server-core": "3.3.1"
40
+ "@walkeros/core": "3.4.0-next-1776749829492",
41
+ "@walkeros/server-core": "3.4.0-next-1776749829492"
42
42
  },
43
43
  "devDependencies": {},
44
44
  "repository": {