@walkeros/server-destination-api 4.8.1-next-1792019907609 → 4.8.2

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,12 +1,38 @@
1
1
  # @walkeros/server-destination-api
2
2
 
3
- ## 4.8.1-next-1792019907609
3
+ ## 4.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 2374f54: `settings.url` is required: without it the destination fails to start
8
+ with a `config` error. Requests run on `fetch`, and a request that fails,
9
+ times out or gets an error status is reported as a failed push.
10
+ - 2374f54: A failed request is reported as a failed push (dead-letter queue, one
11
+ ERROR line with the status) instead of counting as delivered or being logged
12
+ at debug. Events a destination cannot send, such as a missing user identifier,
13
+ fail with `missing-input`. Rules with `silent: true` send no event of their
14
+ own.
15
+ - Updated dependencies [2374f54]
16
+ - Updated dependencies [7e5fc27]
17
+ - Updated dependencies [2374f54]
18
+ - Updated dependencies [964590a]
19
+ - Updated dependencies [4100ede]
20
+ - Updated dependencies [2374f54]
21
+ - Updated dependencies [2374f54]
22
+ - Updated dependencies [15eb7b2]
23
+ - Updated dependencies [33a2779]
24
+ - Updated dependencies [33a2779]
25
+ - Updated dependencies [2374f54]
26
+ - @walkeros/core@4.8.2
27
+ - @walkeros/server-core@4.8.2
28
+
29
+ ## 4.8.1
4
30
 
5
31
  ### Patch Changes
6
32
 
7
33
  - Updated dependencies [1062e99]
8
- - @walkeros/core@4.8.1-next-1792019907609
9
- - @walkeros/server-core@4.8.1-next-1792019907609
34
+ - @walkeros/core@4.8.1
35
+ - @walkeros/server-core@4.8.1
10
36
 
11
37
  ## 4.8.0
12
38
 
package/dist/dev.d.mts CHANGED
@@ -9,7 +9,7 @@ declare const SettingsSchema: z.ZodObject<{
9
9
  method: z.ZodOptional<z.ZodString>;
10
10
  transform: z.ZodOptional<z.ZodAny>;
11
11
  timeout: z.ZodOptional<z.ZodNumber>;
12
- }, z.core.$strip>;
12
+ }, z.core.$strict>;
13
13
  type Settings = z.infer<typeof SettingsSchema>;
14
14
 
15
15
  declare const MappingSchema: z.ZodObject<{}, z.core.$strip>;
@@ -50,12 +50,15 @@ declare namespace env {
50
50
  declare const fullEvent: Flow.StepExample;
51
51
  declare const customHeaders: Flow.StepExample;
52
52
  declare const customTransform: Flow.StepExample;
53
+ /** A silent rule sends nothing to the endpoint. */
54
+ declare const silentRule: Flow.StepExample;
53
55
 
54
56
  declare const step_customHeaders: typeof customHeaders;
55
57
  declare const step_customTransform: typeof customTransform;
56
58
  declare const step_fullEvent: typeof fullEvent;
59
+ declare const step_silentRule: typeof silentRule;
57
60
  declare namespace step {
58
- export { step_customHeaders as customHeaders, step_customTransform as customTransform, step_fullEvent as fullEvent };
61
+ export { step_customHeaders as customHeaders, step_customTransform as customTransform, step_fullEvent as fullEvent, step_silentRule as silentRule };
59
62
  }
60
63
 
61
64
  declare const index_env: typeof env;
package/dist/dev.d.ts CHANGED
@@ -9,7 +9,7 @@ declare const SettingsSchema: z.ZodObject<{
9
9
  method: z.ZodOptional<z.ZodString>;
10
10
  transform: z.ZodOptional<z.ZodAny>;
11
11
  timeout: z.ZodOptional<z.ZodNumber>;
12
- }, z.core.$strip>;
12
+ }, z.core.$strict>;
13
13
  type Settings = z.infer<typeof SettingsSchema>;
14
14
 
15
15
  declare const MappingSchema: z.ZodObject<{}, z.core.$strip>;
@@ -50,12 +50,15 @@ declare namespace env {
50
50
  declare const fullEvent: Flow.StepExample;
51
51
  declare const customHeaders: Flow.StepExample;
52
52
  declare const customTransform: Flow.StepExample;
53
+ /** A silent rule sends nothing to the endpoint. */
54
+ declare const silentRule: Flow.StepExample;
53
55
 
54
56
  declare const step_customHeaders: typeof customHeaders;
55
57
  declare const step_customTransform: typeof customTransform;
56
58
  declare const step_fullEvent: typeof fullEvent;
59
+ declare const step_silentRule: typeof silentRule;
57
60
  declare namespace step {
58
- export { step_customHeaders as customHeaders, step_customTransform as customTransform, step_fullEvent as fullEvent };
61
+ export { step_customHeaders as customHeaders, step_customTransform as customTransform, step_fullEvent as fullEvent, step_silentRule as silentRule };
59
62
  }
60
63
 
61
64
  declare const index_env: typeof env;
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(e,r)=>{for(var o in r)t(e,o,{get:r[o],enumerable:!0})},s={};i(s,{examples:()=>v,schemas:()=>d}),module.exports=(e=s,((e,i,s,d)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of o(i))a.call(e,n)||n===s||t(e,n,{get:()=>i[n],enumerable:!(d=r(i,n))||d.enumerable});return e})(t({},"__esModule",{value:!0}),e));var d={};i(d,{MappingSchema:()=>c,SettingsSchema:()=>p,mapping:()=>l,settings:()=>u});var n=require("@walkeros/core/dev"),m=require("@walkeros/core/dev"),p=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(),transform:m.z.any().describe("Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))").optional(),timeout:m.z.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()}),c=require("@walkeros/core/dev").z.object({}),u=(0,n.zodToSchema)(p),l=(0,n.zodToSchema)(c),v={};i(v,{env:()=>h,step:()=>b});var h={};i(h,{init:()=>y,push:()=>f,simulation:()=>g});var y={sendServer:void 0},f={sendServer:()=>Promise.resolve({ok:!0})},g=["sendServer"],b={};i(b,{customHeaders:()=>w,customTransform:()=>z,fullEvent:()=>P});var S=require("@walkeros/core"),O="https://api.example.com/events",P={title:"Forward event data",description:"A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.",in:(0,S.getEvent)("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"express",platform:"server"}}),mapping:{data:"data"},out:[["sendServer",O,JSON.stringify({title:"Docs",url:"https://example.com/docs"}),{headers:void 0,method:void 0,timeout:void 0}]]},w={title:"Custom headers",description:"A form submission is sent to the API with custom request headers such as an API key for authentication.",in:(0,S.getEvent)("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"express",platform:"server"}}),mapping:{data:"data"},out:[["sendServer",O,JSON.stringify({type:"contact",email:"user@example.com"}),{headers:{"X-API-Key":"YOUR_API_KEY"},method:void 0,timeout:void 0}]]},z={title:"Custom payload",description:"An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.",in:(0,S.getEvent)("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"express",platform:"server"}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:[["sendServer",O,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
1
+ "use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a=(e,r)=>{for(var o in r)t(e,o,{get:r[o],enumerable:!0})},s={};a(s,{examples:()=>v,schemas:()=>n}),module.exports=(e=s,((e,a,s,n)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let d of o(a))i.call(e,d)||d===s||t(e,d,{get:()=>a[d],enumerable:!(n=r(a,d))||n.enumerable});return e})(t({},"__esModule",{value:!0}),e));var n={};a(n,{MappingSchema:()=>u,SettingsSchema:()=>p,mapping:()=>l,settings:()=>c});var d=require("@walkeros/core/dev"),m=require("@walkeros/core/dev"),p=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(),transform:m.z.any().describe("Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))").optional(),timeout:m.z.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()}).strict(),u=require("@walkeros/core/dev").z.object({}),c=(0,d.zodToSchema)(p),l=(0,d.zodToSchema)(u),v={};a(v,{env:()=>h,step:()=>b});var h={};a(h,{init:()=>g,push:()=>y,simulation:()=>f});var g={sendServer:void 0},y={sendServer:()=>Promise.resolve({})},f=["sendServer"],b={};a(b,{customHeaders:()=>P,customTransform:()=>z,fullEvent:()=>w,silentRule:()=>x});var S=require("@walkeros/core"),O="https://api.example.com/events",w={title:"Forward event data",description:"A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.",in:(0,S.getEvent)("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"express",platform:"server"}}),mapping:{data:"data"},out:[["sendServer",O,JSON.stringify({title:"Docs",url:"https://example.com/docs"}),{headers:void 0,method:void 0,timeout:void 0}]]},P={title:"Custom headers",description:"A form submission is sent to the API with custom request headers such as an API key for authentication.",in:(0,S.createEvent)({name:"form submit",timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"express",platform:"server"}}),mapping:{data:"data"},out:[["sendServer",O,JSON.stringify({type:"contact",email:"user@example.com"}),{headers:{"X-API-Key":"YOUR_API_KEY"},method:void 0,timeout:void 0}]]},z={title:"Custom payload",description:"An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.",in:(0,S.getEvent)("order complete",{timestamp:1700000802,data:{id:"ORD-500",value:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"express",platform:"server"}}),mapping:{data:{map:{order_id:"data.id",amount:"data.value",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:[["sendServer",O,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}]]},x={public:!1,description:"A rule with silent: true sends no request to the endpoint.",in:(0,S.getEvent)("page view",{timestamp:1700000802}),mapping:{silent:!0},out:[]};//# 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/mapping.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';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\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 transform: z\n .any()\n .describe(\n 'Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))',\n )\n .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","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\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 sendServer: NonNullable<Env['sendServer']> = () =>\n Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const push: Env = {\n 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 title: 'Forward event data',\n description:\n 'A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.',\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'express', platform: 'server' },\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 title: 'Custom headers',\n description:\n 'A form submission is sent to the API with custom request headers such as an API key for authentication.',\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'express', platform: 'server' },\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 title: 'Custom payload',\n description:\n 'An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.',\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: 'express', platform: 'server' },\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;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,WAAW,aACR,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,aACN,OAAO,EACP,SAAS,EACT,SAAS,iDAAiD,EAC1D,SAAS;AACd,CAAC;;;ACpBD,IAAAC,cAAkB;AAEX,IAAM,gBAAgB,cAAE,OAAO,CAAC,CAAC;;;AFMjC,IAAM,eAAW,yBAAY,cAAc;AAC3C,IAAM,cAAU,yBAAY,aAAa;;;AGThD;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAM,aAA6C,MACjD,QAAQ,QAAQ,EAAE,IAAI,KAAK,CAAC;AAEvB,IAAM,OAAwB;AAAA,EACnC,YAAY;AACd;AAEO,IAAM,OAAY;AAAA,EACvB;AACF;AAMO,IAAM,aAAa,CAAC,YAAY;;;ACxBvC;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAyB;AAYzB,IAAM,MAAM;AAEL,IAAM,YAA8B;AAAA,EACzC,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAI,sBAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,MAAM,EAAE,OAAO,QAAQ,KAA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,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","import_dev"]}
1
+ {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.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';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z\n .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\n .string()\n .describe('HTTP method to use (default: POST)')\n .optional(),\n transform: z\n .any()\n .describe(\n 'Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))',\n )\n .optional(),\n timeout: z\n .number()\n .positive()\n .describe('Request timeout in milliseconds (default: 5000)')\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\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 sendServer: NonNullable<Env['sendServer']> = () => Promise.resolve({});\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const push: Env = {\n 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 { createEvent, 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 title: 'Forward event data',\n description:\n 'A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.',\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'express', platform: 'server' },\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 title: 'Custom headers',\n description:\n 'A form submission is sent to the API with custom request headers such as an API key for authentication.',\n in: createEvent({\n name: 'form submit',\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'express', platform: 'server' },\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 title: 'Custom payload',\n description:\n 'An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.',\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', value: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'express', platform: 'server' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.value',\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\n/** A silent rule sends nothing to the endpoint. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true sends no request to the endpoint.',\n in: getEvent('page view', { timestamp: 1700000802 }),\n mapping: { silent: true },\n out: [],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAC3B,OAAO;AAAA,EACN,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,aACL,OAAO,EACP,SAAS,oCAAoC,EAC7C,SAAS;AAAA,EACZ,WAAW,aACR,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,aACN,OAAO,EACP,SAAS,EACT,SAAS,iDAAiD,EAC1D,SAAS;AACd,CAAC,EACA,OAAO;;;ACzBV,IAAAC,cAAkB;AAEX,IAAM,gBAAgB,cAAE,OAAO,CAAC,CAAC;;;AFMjC,IAAM,eAAW,yBAAY,cAAc;AAC3C,IAAM,cAAU,yBAAY,aAAa;;;AGThD;AAAA;AAAA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SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,kBAAoC;AAAA,EAC/C,OAAO;AAAA,EACP,aACE;AAAA,EACF,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,WAAW,UAAU,SAAS;AAAA,EAChD,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;AAGO,IAAM,aAA+B;AAAA,EAC1C,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,QAAI,sBAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;","names":["import_dev","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,{MappingSchema:()=>d,SettingsSchema:()=>i,mapping:()=>m,settings:()=>n});import{zodToSchema as o}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";var i=a.object({url:a.string().url().describe("The API endpoint URL to send events to"),headers:a.record(a.string(),a.string()).describe("Custom HTTP headers to include with requests").optional(),method:a.string().describe("HTTP method to use (default: POST)").optional(),transform:a.any().describe("Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))").optional(),timeout:a.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()});import{z as s}from"@walkeros/core/dev";var d=s.object({}),n=o(i),m=o(d),p={};t(p,{env:()=>c,step:()=>h});var c={};t(c,{init:()=>u,push:()=>l,simulation:()=>v});var u={sendServer:void 0},l={sendServer:()=>Promise.resolve({ok:!0})},v=["sendServer"],h={};t(h,{customHeaders:()=>S,customTransform:()=>b,fullEvent:()=>g});import{getEvent as f}from"@walkeros/core";var y="https://api.example.com/events",g={title:"Forward event data",description:"A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.",in:f("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"express",platform:"server"}}),mapping:{data:"data"},out:[["sendServer",y,JSON.stringify({title:"Docs",url:"https://example.com/docs"}),{headers:void 0,method:void 0,timeout:void 0}]]},S={title:"Custom headers",description:"A form submission is sent to the API with custom request headers such as an API key for authentication.",in:f("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"express",platform:"server"}}),mapping:{data:"data"},out:[["sendServer",y,JSON.stringify({type:"contact",email:"user@example.com"}),{headers:{"X-API-Key":"YOUR_API_KEY"},method:void 0,timeout:void 0}]]},b={title:"Custom payload",description:"An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.",in:f("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"express",platform:"server"}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:[["sendServer",y,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{p as examples,r as schemas};//# sourceMappingURL=dev.mjs.map
1
+ import{createRequire as e}from"module";e(import.meta.url);var t=Object.defineProperty,r=(e,r)=>{for(var o in r)t(e,o,{get:r[o],enumerable:!0})},o={};r(o,{MappingSchema:()=>n,SettingsSchema:()=>s,mapping:()=>p,settings:()=>m});import{zodToSchema as i}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";var s=a.object({url:a.string().url().describe("The API endpoint URL to send events to"),headers:a.record(a.string(),a.string()).describe("Custom HTTP headers to include with requests").optional(),method:a.string().describe("HTTP method to use (default: POST)").optional(),transform:a.any().describe("Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))").optional(),timeout:a.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()}).strict();import{z as d}from"@walkeros/core/dev";var n=d.object({}),m=i(s),p=i(n),u={};r(u,{env:()=>c,step:()=>f});var c={};r(c,{init:()=>l,push:()=>v,simulation:()=>h});var l={sendServer:void 0},v={sendServer:()=>Promise.resolve({})},h=["sendServer"],f={};r(f,{customHeaders:()=>w,customTransform:()=>O,fullEvent:()=>b,silentRule:()=>P});import{createEvent as g,getEvent as y}from"@walkeros/core";var S="https://api.example.com/events",b={title:"Forward event data",description:"A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.",in:y("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"express",platform:"server"}}),mapping:{data:"data"},out:[["sendServer",S,JSON.stringify({title:"Docs",url:"https://example.com/docs"}),{headers:void 0,method:void 0,timeout:void 0}]]},w={title:"Custom headers",description:"A form submission is sent to the API with custom request headers such as an API key for authentication.",in:g({name:"form submit",timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"express",platform:"server"}}),mapping:{data:"data"},out:[["sendServer",S,JSON.stringify({type:"contact",email:"user@example.com"}),{headers:{"X-API-Key":"YOUR_API_KEY"},method:void 0,timeout:void 0}]]},O={title:"Custom payload",description:"An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.",in:y("order complete",{timestamp:1700000802,data:{id:"ORD-500",value:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"express",platform:"server"}}),mapping:{data:{map:{order_id:"data.id",amount:"data.value",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:[["sendServer",S,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}]]},P={public:!1,description:"A rule with silent: true sends no request to the endpoint.",in:y("page view",{timestamp:1700000802}),mapping:{silent:!0},out:[]};export{u 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/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\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 transform: z\n .any()\n .describe(\n 'Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))',\n )\n .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","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\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 sendServer: NonNullable<Env['sendServer']> = () =>\n Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const push: Env = {\n 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 title: 'Forward event data',\n description:\n 'A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.',\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'express', platform: 'server' },\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 title: 'Custom headers',\n description:\n 'A form submission is sent to the API with custom request headers such as an API key for authentication.',\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'express', platform: 'server' },\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 title: 'Custom payload',\n description:\n 'An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.',\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: 'express', platform: 'server' },\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,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,WAAW,EACR,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,EACN,OAAO,EACP,SAAS,EACT,SAAS,iDAAiD,EAC1D,SAAS;AACd,CAAC;;;ACpBD,SAAS,KAAAA,UAAS;AAEX,IAAM,gBAAgBA,GAAE,OAAO,CAAC,CAAC;;;AFMjC,IAAM,WAAW,YAAY,cAAc;AAC3C,IAAM,UAAU,YAAY,aAAa;;;AGThD;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAM,aAA6C,MACjD,QAAQ,QAAQ,EAAE,IAAI,KAAK,CAAC;AAEvB,IAAM,OAAwB;AAAA,EACnC,YAAY;AACd;AAEO,IAAM,OAAY;AAAA,EACvB;AACF;AAMO,IAAM,aAAa,CAAC,YAAY;;;ACxBvC;AAA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AI,WAAW;AAAA,IACvB,QAAQ,EAAE,MAAM,WAAW,UAAU,SAAS;AAAA,EAChD,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":["z"]}
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z\n .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\n .string()\n .describe('HTTP method to use (default: POST)')\n .optional(),\n transform: z\n .any()\n .describe(\n 'Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))',\n )\n .optional(),\n timeout: z\n .number()\n .positive()\n .describe('Request timeout in milliseconds (default: 5000)')\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\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 sendServer: NonNullable<Env['sendServer']> = () => Promise.resolve({});\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const push: Env = {\n 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 { createEvent, 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 title: 'Forward event data',\n description:\n 'A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.',\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'express', platform: 'server' },\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 title: 'Custom headers',\n description:\n 'A form submission is sent to the API with custom request headers such as an API key for authentication.',\n in: createEvent({\n name: 'form submit',\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'express', platform: 'server' },\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 title: 'Custom payload',\n description:\n 'An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.',\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', value: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'express', platform: 'server' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.value',\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\n/** A silent rule sends nothing to the endpoint. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true sends no request to the endpoint.',\n in: getEvent('page view', { timestamp: 1700000802 }),\n mapping: { silent: true },\n out: [],\n};\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,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,EACL,OAAO,EACP,SAAS,oCAAoC,EAC7C,SAAS;AAAA,EACZ,WAAW,EACR,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,EACN,OAAO,EACP,SAAS,EACT,SAAS,iDAAiD,EAC1D,SAAS;AACd,CAAC,EACA,OAAO;;;ACzBV,SAAS,KAAAA,UAAS;AAEX,IAAM,gBAAgBA,GAAE,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M;AAAA,QACN,OAAO;AAAA,MACT,CAAC;AAAA,MACD;AAAA,QACE,SAAS,EAAE,aAAa,eAAe;AAAA,QACvC,QAAQ;AAAA,QACR,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,kBAAoC;AAAA,EAC/C,OAAO;AAAA,EACP,aACE;AAAA,EACF,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,WAAW,UAAU,SAAS;AAAA,EAChD,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;AAGO,IAAM,aAA+B;AAAA,EAC1C,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,IAAI,SAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;","names":["z"]}
@@ -23,12 +23,15 @@ declare namespace env {
23
23
  declare const fullEvent: Flow.StepExample;
24
24
  declare const customHeaders: Flow.StepExample;
25
25
  declare const customTransform: Flow.StepExample;
26
+ /** A silent rule sends nothing to the endpoint. */
27
+ declare const silentRule: Flow.StepExample;
26
28
 
27
29
  declare const step_customHeaders: typeof customHeaders;
28
30
  declare const step_customTransform: typeof customTransform;
29
31
  declare const step_fullEvent: typeof fullEvent;
32
+ declare const step_silentRule: typeof silentRule;
30
33
  declare namespace step {
31
- export { step_customHeaders as customHeaders, step_customTransform as customTransform, step_fullEvent as fullEvent };
34
+ export { step_customHeaders as customHeaders, step_customTransform as customTransform, step_fullEvent as fullEvent, step_silentRule as silentRule };
32
35
  }
33
36
 
34
37
  export { env, step };
@@ -23,12 +23,15 @@ declare namespace env {
23
23
  declare const fullEvent: Flow.StepExample;
24
24
  declare const customHeaders: Flow.StepExample;
25
25
  declare const customTransform: Flow.StepExample;
26
+ /** A silent rule sends nothing to the endpoint. */
27
+ declare const silentRule: Flow.StepExample;
26
28
 
27
29
  declare const step_customHeaders: typeof customHeaders;
28
30
  declare const step_customTransform: typeof customTransform;
29
31
  declare const step_fullEvent: typeof fullEvent;
32
+ declare const step_silentRule: typeof silentRule;
30
33
  declare namespace step {
31
- export { step_customHeaders as customHeaders, step_customTransform as customTransform, step_fullEvent as fullEvent };
34
+ export { step_customHeaders as customHeaders, step_customTransform as customTransform, step_fullEvent as fullEvent, step_silentRule as silentRule };
32
35
  }
33
36
 
34
37
  export { env, step };
@@ -32,7 +32,7 @@ __export(env_exports, {
32
32
  push: () => push,
33
33
  simulation: () => simulation
34
34
  });
35
- var sendServer = () => Promise.resolve({ ok: true });
35
+ var sendServer = () => Promise.resolve({});
36
36
  var init = {
37
37
  sendServer: void 0
38
38
  };
@@ -46,7 +46,8 @@ var step_exports = {};
46
46
  __export(step_exports, {
47
47
  customHeaders: () => customHeaders,
48
48
  customTransform: () => customTransform,
49
- fullEvent: () => fullEvent
49
+ fullEvent: () => fullEvent,
50
+ silentRule: () => silentRule
50
51
  });
51
52
  var import_core = require("@walkeros/core");
52
53
  var URL = "https://api.example.com/events";
@@ -76,7 +77,8 @@ var fullEvent = {
76
77
  var customHeaders = {
77
78
  title: "Custom headers",
78
79
  description: "A form submission is sent to the API with custom request headers such as an API key for authentication.",
79
- in: (0, import_core.getEvent)("form submit", {
80
+ in: (0, import_core.createEvent)({
81
+ name: "form submit",
80
82
  timestamp: 1700000801,
81
83
  data: { type: "contact", email: "user@example.com" },
82
84
  source: { type: "express", platform: "server" }
@@ -105,7 +107,7 @@ var customTransform = {
105
107
  description: "An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.",
106
108
  in: (0, import_core.getEvent)("order complete", {
107
109
  timestamp: 1700000802,
108
- data: { id: "ORD-500", total: 199.99, currency: "USD" },
110
+ data: { id: "ORD-500", value: 199.99, currency: "USD" },
109
111
  user: { id: "buyer-42" },
110
112
  source: { type: "express", platform: "server" }
111
113
  }),
@@ -113,7 +115,7 @@ var customTransform = {
113
115
  data: {
114
116
  map: {
115
117
  order_id: "data.id",
116
- amount: "data.total",
118
+ amount: "data.value",
117
119
  currency: "data.currency",
118
120
  customer_id: "user.id",
119
121
  event_type: "name"
@@ -135,6 +137,13 @@ var customTransform = {
135
137
  ]
136
138
  ]
137
139
  };
140
+ var silentRule = {
141
+ public: false,
142
+ description: "A rule with silent: true sends no request to the endpoint.",
143
+ in: (0, import_core.getEvent)("page view", { timestamp: 1700000802 }),
144
+ mapping: { silent: true },
145
+ out: []
146
+ };
138
147
  // Annotate the CommonJS export names for ESM import in node:
139
148
  0 && (module.exports = {
140
149
  env,
@@ -11,7 +11,7 @@ __export(env_exports, {
11
11
  push: () => push,
12
12
  simulation: () => simulation
13
13
  });
14
- var sendServer = () => Promise.resolve({ ok: true });
14
+ var sendServer = () => Promise.resolve({});
15
15
  var init = {
16
16
  sendServer: void 0
17
17
  };
@@ -25,9 +25,10 @@ var step_exports = {};
25
25
  __export(step_exports, {
26
26
  customHeaders: () => customHeaders,
27
27
  customTransform: () => customTransform,
28
- fullEvent: () => fullEvent
28
+ fullEvent: () => fullEvent,
29
+ silentRule: () => silentRule
29
30
  });
30
- import { getEvent } from "@walkeros/core";
31
+ import { createEvent, getEvent } from "@walkeros/core";
31
32
  var URL = "https://api.example.com/events";
32
33
  var fullEvent = {
33
34
  title: "Forward event data",
@@ -55,7 +56,8 @@ var fullEvent = {
55
56
  var customHeaders = {
56
57
  title: "Custom headers",
57
58
  description: "A form submission is sent to the API with custom request headers such as an API key for authentication.",
58
- in: getEvent("form submit", {
59
+ in: createEvent({
60
+ name: "form submit",
59
61
  timestamp: 1700000801,
60
62
  data: { type: "contact", email: "user@example.com" },
61
63
  source: { type: "express", platform: "server" }
@@ -84,7 +86,7 @@ var customTransform = {
84
86
  description: "An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.",
85
87
  in: getEvent("order complete", {
86
88
  timestamp: 1700000802,
87
- data: { id: "ORD-500", total: 199.99, currency: "USD" },
89
+ data: { id: "ORD-500", value: 199.99, currency: "USD" },
88
90
  user: { id: "buyer-42" },
89
91
  source: { type: "express", platform: "server" }
90
92
  }),
@@ -92,7 +94,7 @@ var customTransform = {
92
94
  data: {
93
95
  map: {
94
96
  order_id: "data.id",
95
- amount: "data.total",
97
+ amount: "data.value",
96
98
  currency: "data.currency",
97
99
  customer_id: "user.id",
98
100
  event_type: "name"
@@ -114,6 +116,13 @@ var customTransform = {
114
116
  ]
115
117
  ]
116
118
  };
119
+ var silentRule = {
120
+ public: false,
121
+ description: "A rule with silent: true sends no request to the endpoint.",
122
+ in: getEvent("page view", { timestamp: 1700000802 }),
123
+ mapping: { silent: true },
124
+ out: []
125
+ };
117
126
  export {
118
127
  env_exports as env,
119
128
  step_exports as step
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,index_exports={};((target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})})(index_exports,{DestinationAPI:()=>types_exports,default:()=>index_default,destinationAPI:()=>destinationAPI}),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_core=require("@walkeros/core"),import_server_core=require("@walkeros/server-core"),types_exports={};async function send(body,settings,env,logger){const{url:url,headers:headers,method:method,timeout:timeout}=settings,sendServerFn=env?.sendServer||import_server_core.sendServer,response=await sendServerFn(url,body,{headers:headers,method:method,timeout:timeout});logger?.debug("API destination response",{ok:response?.ok})}var 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,method:method,transform:transform}=settings||{};if(!url)return;const eventData=(0,import_core.isDefined)(data)?data:event,body=transform?transform(eventData,config,rule):JSON.stringify(eventData);logger?.debug("API destination sending request",{url:url,method:method||"POST",eventName:event.name}),await send(body,{...settings,url:url},env,logger)},async pushBatch(batch,{config:config,rule:rule,env:env,logger:logger}){const{settings:settings}=config,{url:url,method:method,transform:transform}=settings||{};if(!url)return;const items=batch.entries.map(entry=>(0,import_core.isDefined)(entry.data)?entry.data:entry.event),payload=transform?items.map(item=>transform(item,config,rule)):items;logger?.debug("API destination sending batch",{url:url,method:method||"POST",events:items.length}),await send(JSON.stringify(payload),{...settings,url:url},env,logger)}},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,index_exports={};((target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})})(index_exports,{DestinationAPI:()=>types_exports,default:()=>index_default,destinationAPI:()=>destinationAPI}),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_core=require("@walkeros/core"),import_server_core=require("@walkeros/server-core"),types_exports={};async function send(body,settings,env){const{url:url,headers:headers,method:method,timeout:timeout}=settings,sendServerFn=env?.sendServer||import_server_core.sendServer;await sendServerFn(url,body,{headers:headers,method:method,timeout:timeout})}function missingUrl(){return new import_core.StepError("Config settings url missing",{code:"config"})}var destinationAPI={type:"api",config:{},env:{sendServer:import_server_core.sendServer},async init({config:config}){if(!config.settings?.url)throw missingUrl();return config},async push(event,{config:config,rule:rule,data:data,env:env,logger:logger}){const{settings:settings}=config,{url:url,method:method,transform:transform}=settings||{};if(!url)throw missingUrl();if(!rule?.silent){const eventData=(0,import_core.isDefined)(data)?data:event,body=transform?transform(eventData,config,rule):JSON.stringify(eventData);logger?.debug("API destination sending request",{url:url,method:method||"POST",eventName:event.name}),await send(body,{...settings,url:url},env)}},async pushBatch(batch,{config:config,rule:rule,env:env,logger:logger}){const{settings:settings}=config,{url:url,method:method,transform:transform}=settings||{};if(!url)throw missingUrl();const entries=batch.entries.filter(entry=>!entry.rule?.silent);if(entries.length>0){const items=entries.map(entry=>(0,import_core.isDefined)(entry.data)?entry.data:entry.event),payload=transform?items.map(item=>transform(item,config,rule)):items;logger?.debug("API destination sending batch",{url:url,method:method||"POST",events:items.length}),await send(JSON.stringify(payload),{...settings,url:url},env)}}},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"],"sourcesContent":["import type { Logger, SendDataValue } from '@walkeros/core';\nimport 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\nasync function send(\n body: SendDataValue,\n settings: Settings,\n env: Env | undefined,\n logger?: Logger.Instance,\n): Promise<void> {\n const { url, headers, method, timeout } = settings;\n const sendServerFn = env?.sendServer || sendServer;\n\n const response = await sendServerFn(url, body, { headers, method, timeout });\n\n logger?.debug('API destination response', { ok: response?.ok });\n}\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, method, transform } = 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 await send(body, { ...settings, url }, env, logger);\n },\n\n async pushBatch(batch, { config, rule, env, logger }) {\n const { settings } = config;\n const { url, method, transform } = settings || {};\n\n if (!url) return;\n\n const items = batch.entries.map((entry) =>\n isDefined(entry.data) ? entry.data : entry.event,\n );\n\n // Transform applies per item; the request body is the array of results\n const payload = transform\n ? items.map((item) => transform(item, config, rule))\n : items;\n\n logger?.debug('API destination sending batch', {\n url,\n method: method || 'POST',\n events: items.length,\n });\n\n await send(JSON.stringify(payload), { ...settings, url }, env, logger);\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 map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,uBAAU,MAAM,IAAI,IAAI,MAAM,OAAO,MAAM;AAAA,IAC7C;AAGA,UAAM,UAAU,YACZ,MAAM,IAAI,CAAC,SAAS,UAAU,MAAM,QAAQ,IAAI,CAAC,IACjD;AAEJ,YAAQ,MAAM,iCAAiC;AAAA,MAC7C;AAAA,MACA,QAAQ,UAAU;AAAA,MAClB,QAAQ,MAAM;AAAA,IAChB,CAAC;AAED,UAAM,KAAK,KAAK,UAAU,OAAO,GAAG,EAAE,GAAG,UAAU,IAAI,GAAG,KAAK,MAAM;AAAA,EACvE;AACF;AAEA,IAAO,gBAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { SendDataValue } from '@walkeros/core';\nimport type { Settings, Destination, Env } from './types';\nimport { isDefined, StepError } from '@walkeros/core';\nimport { sendServer } from '@walkeros/server-core';\n\n// Types\nexport * as DestinationAPI from './types';\n\nasync function send(\n body: SendDataValue,\n settings: Settings,\n env: Env | undefined,\n): Promise<void> {\n const { url, headers, method, timeout } = settings;\n const sendServerFn = env?.sendServer || sendServer;\n\n await sendServerFn(url, body, { headers, method, timeout });\n}\n\nfunction missingUrl(): StepError {\n return new StepError('Config settings url missing', { code: 'config' });\n}\n\nexport const destinationAPI: Destination = {\n type: 'api',\n\n config: {},\n\n env: { sendServer },\n\n async init({ config }) {\n if (!config.settings?.url) throw missingUrl();\n return config;\n },\n\n async push(event, { config, rule, data, env, logger }) {\n const { settings } = config;\n const { url, method, transform } = settings || {};\n\n if (!url) throw missingUrl();\n\n // A silent rule has no call of its own: nothing to send.\n if (!rule?.silent) {\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 await send(body, { ...settings, url }, env);\n }\n },\n\n async pushBatch(batch, { config, rule, env, logger }) {\n const { settings } = config;\n const { url, method, transform } = settings || {};\n\n if (!url) throw missingUrl();\n\n // Silent rules have no call of their own; with nothing left, send nothing.\n const entries = batch.entries.filter((entry) => !entry.rule?.silent);\n if (entries.length > 0) {\n const items = entries.map((entry) =>\n isDefined(entry.data) ? entry.data : entry.event,\n );\n\n // Transform applies per item; the request body is the array of results\n const payload = transform\n ? items.map((item) => transform(item, config, rule))\n : items;\n\n logger?.debug('API destination sending batch', {\n url,\n method: method || 'POST',\n events: items.length,\n });\n\n await send(JSON.stringify(payload), { ...settings, url }, env);\n }\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAqC;AACrC,yBAA2B;;;ACH3B;;;ADQA,eAAe,KACb,MACA,UACA,KACe;AACf,QAAM,EAAE,KAAK,SAAS,QAAQ,QAAQ,IAAI;AAC1C,QAAM,eAAe,KAAK,cAAc;AAExC,QAAM,aAAa,KAAK,MAAM,EAAE,SAAS,QAAQ,QAAQ,CAAC;AAC5D;AAEA,SAAS,aAAwB;AAC/B,SAAO,IAAI,sBAAU,+BAA+B,EAAE,M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QAAQ,IAAI,CAAC,IACjD;AAEJ,cAAQ,MAAM,iCAAiC;AAAA,QAC7C;AAAA,QACA,QAAQ,UAAU;AAAA,QAClB,QAAQ,MAAM;AAAA,MAChB,CAAC;AAED,YAAM,KAAK,KAAK,UAAU,OAAO,GAAG,EAAE,GAAG,UAAU,IAAI,GAAG,GAAG;AAAA,IAC/D;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":[]}
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{isDefined}from"@walkeros/core";import{sendServer}from"@walkeros/server-core";var types_exports={};async function send(body,settings,env,logger){const{url:url,headers:headers,method:method,timeout:timeout}=settings,sendServerFn=env?.sendServer||sendServer,response=await sendServerFn(url,body,{headers:headers,method:method,timeout:timeout});logger?.debug("API destination response",{ok:response?.ok})}var 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,method:method,transform:transform}=settings||{};if(!url)return;const eventData=isDefined(data)?data:event,body=transform?transform(eventData,config,rule):JSON.stringify(eventData);logger?.debug("API destination sending request",{url:url,method:method||"POST",eventName:event.name}),await send(body,{...settings,url:url},env,logger)},async pushBatch(batch,{config:config,rule:rule,env:env,logger:logger}){const{settings:settings}=config,{url:url,method:method,transform:transform}=settings||{};if(!url)return;const items=batch.entries.map(entry=>isDefined(entry.data)?entry.data:entry.event),payload=transform?items.map(item=>transform(item,config,rule)):items;logger?.debug("API destination sending batch",{url:url,method:method||"POST",events:items.length}),await send(JSON.stringify(payload),{...settings,url:url},env,logger)}},index_default=destinationAPI;export{types_exports as DestinationAPI,index_default as default,destinationAPI};//# sourceMappingURL=index.mjs.map
1
+ import{createRequire}from"module";createRequire(import.meta.url);import{isDefined,StepError}from"@walkeros/core";import{sendServer}from"@walkeros/server-core";var types_exports={};async function send(body,settings,env){const{url:url,headers:headers,method:method,timeout:timeout}=settings,sendServerFn=env?.sendServer||sendServer;await sendServerFn(url,body,{headers:headers,method:method,timeout:timeout})}function missingUrl(){return new StepError("Config settings url missing",{code:"config"})}var destinationAPI={type:"api",config:{},env:{sendServer:sendServer},async init({config:config}){if(!config.settings?.url)throw missingUrl();return config},async push(event,{config:config,rule:rule,data:data,env:env,logger:logger}){const{settings:settings}=config,{url:url,method:method,transform:transform}=settings||{};if(!url)throw missingUrl();if(!rule?.silent){const eventData=isDefined(data)?data:event,body=transform?transform(eventData,config,rule):JSON.stringify(eventData);logger?.debug("API destination sending request",{url:url,method:method||"POST",eventName:event.name}),await send(body,{...settings,url:url},env)}},async pushBatch(batch,{config:config,rule:rule,env:env,logger:logger}){const{settings:settings}=config,{url:url,method:method,transform:transform}=settings||{};if(!url)throw missingUrl();const entries=batch.entries.filter(entry=>!entry.rule?.silent);if(entries.length>0){const items=entries.map(entry=>isDefined(entry.data)?entry.data:entry.event),payload=transform?items.map(item=>transform(item,config,rule)):items;logger?.debug("API destination sending batch",{url:url,method:method||"POST",events:items.length}),await send(JSON.stringify(payload),{...settings,url:url},env)}}},index_default=destinationAPI;export{types_exports as DestinationAPI,index_default as default,destinationAPI};//# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { Logger, SendDataValue } from '@walkeros/core';\nimport 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\nasync function send(\n body: SendDataValue,\n settings: Settings,\n env: Env | undefined,\n logger?: Logger.Instance,\n): Promise<void> {\n const { url, headers, method, timeout } = settings;\n const sendServerFn = env?.sendServer || sendServer;\n\n const response = await sendServerFn(url, body, { headers, method, timeout });\n\n logger?.debug('API destination response', { ok: response?.ok });\n}\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, method, transform } = 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 await send(body, { ...settings, url }, env, logger);\n },\n\n async pushBatch(batch, { config, rule, env, logger }) {\n const { settings } = config;\n const { url, method, transform } = settings || {};\n\n if (!url) return;\n\n const items = batch.entries.map((entry) =>\n isDefined(entry.data) ? entry.data : entry.event,\n );\n\n // Transform applies per item; the request body is the array of results\n const payload = transform\n ? items.map((item) => transform(item, config, rule))\n : items;\n\n logger?.debug('API destination sending batch', {\n url,\n method: method || 'POST',\n events: items.length,\n });\n\n await send(JSON.stringify(payload), { ...settings, url }, env, logger);\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"],"mappings":";AAEA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;;;ACH3B;;;ADQA,eAAe,KACb,MACA,UACA,KACA,QACe;AACf,QAAM,EAAE,KAAK,SAAS,QAAQ,QAAQ,IAAI;AAC1C,QAAM,eAAe,KAAK,cAAc;AAExC,QAAM,WAAW,MAAM,aAAa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,IAAI,GAAG,KAAK,MAAM;AAAA,EACvE;AACF;AAEA,IAAO,gBAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { SendDataValue } from '@walkeros/core';\nimport type { Settings, Destination, Env } from './types';\nimport { isDefined, StepError } from '@walkeros/core';\nimport { sendServer } from '@walkeros/server-core';\n\n// Types\nexport * as DestinationAPI from './types';\n\nasync function send(\n body: SendDataValue,\n settings: Settings,\n env: Env | undefined,\n): Promise<void> {\n const { url, headers, method, timeout } = settings;\n const sendServerFn = env?.sendServer || sendServer;\n\n await sendServerFn(url, body, { headers, method, timeout });\n}\n\nfunction missingUrl(): StepError {\n return new StepError('Config settings url missing', { code: 'config' });\n}\n\nexport const destinationAPI: Destination = {\n type: 'api',\n\n config: {},\n\n env: { sendServer },\n\n async init({ config }) {\n if (!config.settings?.url) throw missingUrl();\n return config;\n },\n\n async push(event, { config, rule, data, env, logger }) {\n const { settings } = config;\n const { url, method, transform } = settings || {};\n\n if (!url) throw missingUrl();\n\n // A silent rule has no call of its own: nothing to send.\n if (!rule?.silent) {\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 await send(body, { ...settings, url }, env);\n }\n },\n\n async pushBatch(batch, { config, rule, env, logger }) {\n const { settings } = config;\n const { url, method, transform } = settings || {};\n\n if (!url) throw missingUrl();\n\n // Silent rules have no call of their own; with nothing left, send nothing.\n const entries = batch.entries.filter((entry) => !entry.rule?.silent);\n if (entries.length > 0) {\n const items = entries.map((entry) =>\n isDefined(entry.data) ? entry.data : entry.event,\n );\n\n // Transform applies per item; the request body is the array of results\n const payload = transform\n ? items.map((item) => transform(item, config, rule))\n : items;\n\n logger?.debug('API destination sending batch', {\n url,\n method: method || 'POST',\n events: items.length,\n });\n\n await send(JSON.stringify(payload), { ...settings, url }, env);\n }\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"],"mappings":";;;AAEA,SAAS,WAAW,iBAAiB;AACrC,SAAS,kBAAkB;;;ACH3B;;;ADQA,eAAe,KACb,MACA,UACA,KACe;AACf,QAAM,EAAE,KAAK,SAAS,QAAQ,QAAQ,IAAI;AAC1C,QAAM,eAAe,KAAK,cAAc;AAExC,QAAM,aAAa,KAAK,MAAM,EAAE,SAAS,QAAQ,QAAQ,CAAC;AAC5D;AAEA,SAAS,aAAwB;AAC/B,SAAO,IAAI,UAAU,+BAA+B,EAAE,MAAM,SAAS,CAAC;AACxE;AAEO,IAAM,iBAA8B;AAAA,EACzC,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,WAAW;AAAA,EAElB,MAAM,KAAK,EAAE,OAAO,GAAG;AACrB,QAAI,CAAC,OAAO,UAAU,IAAK,OAAM,WAAW;AAC5C,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,KAAK,OAAO,EAAE,QAAQ,MAAM,MAAM,KAAK,OAAO,GAAG;AACrD,UAAM,EAAE,SAAS,IAAI;AACrB,UAAM,EAAE,KAAK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907609",
4
+ "version": "4.8.2",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "server"
@@ -60,7 +60,7 @@
60
60
  "init": {},
61
61
  "push": {
62
62
  "sendServer": {
63
- "$code": "()=>Promise.resolve({ok:!0})"
63
+ "$code": "()=>Promise.resolve({})"
64
64
  }
65
65
  },
66
66
  "simulation": [
@@ -105,7 +105,7 @@
105
105
  "consent": {
106
106
  "functional": true
107
107
  },
108
- "id": "fa9a5a9a3b7da997",
108
+ "id": "54f2d09e77cf03ce",
109
109
  "trigger": "test",
110
110
  "entity": "form",
111
111
  "action": "submit",
@@ -141,7 +141,7 @@
141
141
  "name": "order complete",
142
142
  "data": {
143
143
  "id": "ORD-500",
144
- "total": 199.99,
144
+ "value": 199.99,
145
145
  "currency": "USD"
146
146
  },
147
147
  "context": {
@@ -210,7 +210,7 @@
210
210
  "consent": {
211
211
  "functional": true
212
212
  },
213
- "id": "1d9049d7669d269d",
213
+ "id": "235d0d7bd7a213f2",
214
214
  "trigger": "load",
215
215
  "entity": "order",
216
216
  "action": "complete",
@@ -227,7 +227,7 @@
227
227
  "data": {
228
228
  "map": {
229
229
  "order_id": "data.id",
230
- "amount": "data.total",
230
+ "amount": "data.value",
231
231
  "currency": "data.currency",
232
232
  "customer_id": "user.id",
233
233
  "event_type": "name"
@@ -280,7 +280,7 @@
280
280
  "consent": {
281
281
  "functional": true
282
282
  },
283
- "id": "41cf2dd0be876fc1",
283
+ "id": "f0cc5f6fec3d8eeb",
284
284
  "trigger": "load",
285
285
  "entity": "page",
286
286
  "action": "view",
@@ -304,6 +304,65 @@
304
304
  {}
305
305
  ]
306
306
  ]
307
+ },
308
+ "silentRule": {
309
+ "public": false,
310
+ "description": "A rule with silent: true sends no request to the endpoint.",
311
+ "in": {
312
+ "name": "page view",
313
+ "data": {
314
+ "domain": "www.example.com",
315
+ "title": "walkerOS documentation",
316
+ "referrer": "https://www.walkeros.io/",
317
+ "search": "?foo=bar",
318
+ "hash": "#hash",
319
+ "id": "/docs/"
320
+ },
321
+ "context": {
322
+ "dev": [
323
+ "test",
324
+ 1
325
+ ]
326
+ },
327
+ "globals": {
328
+ "pagegroup": "docs"
329
+ },
330
+ "custom": {
331
+ "completely": "random"
332
+ },
333
+ "user": {
334
+ "id": "us3r",
335
+ "device": "c00k13",
336
+ "session": "s3ss10n"
337
+ },
338
+ "nested": [
339
+ {
340
+ "entity": "child",
341
+ "data": {
342
+ "is": "subordinated"
343
+ }
344
+ }
345
+ ],
346
+ "consent": {
347
+ "functional": true
348
+ },
349
+ "id": "f0cc5f6fec3d8eeb",
350
+ "trigger": "load",
351
+ "entity": "page",
352
+ "action": "view",
353
+ "timestamp": 1700000802,
354
+ "timing": 3.14,
355
+ "source": {
356
+ "count": 1,
357
+ "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
358
+ "type": "collector",
359
+ "schema": "4"
360
+ }
361
+ },
362
+ "mapping": {
363
+ "silent": true
364
+ },
365
+ "out": []
307
366
  }
308
367
  }
309
368
  }
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": "4.8.1-next-1792019907609",
4
+ "version": "4.8.2",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -38,10 +38,12 @@
38
38
  "update": "npx npm-check-updates -u && npm update"
39
39
  },
40
40
  "dependencies": {
41
- "@walkeros/core": "4.8.1-next-1792019907609",
42
- "@walkeros/server-core": "4.8.1-next-1792019907609"
41
+ "@walkeros/core": "4.8.2",
42
+ "@walkeros/server-core": "4.8.2"
43
+ },
44
+ "devDependencies": {
45
+ "@walkeros/collector": "4.8.2"
43
46
  },
44
- "devDependencies": {},
45
47
  "repository": {
46
48
  "url": "git+https://github.com/elbwalker/walkerOS.git",
47
49
  "directory": "packages/server/destinations/api"