@walkeros/server-destination-api 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dev.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _walkeros_core_dev from '@walkeros/core/dev';
2
2
  import { z } from '@walkeros/core/dev';
3
- import { Mapping as Mapping$1 } from '@walkeros/core';
4
3
  import { DestinationServer, sendServer } from '@walkeros/server-core';
4
+ import { Flow } from '@walkeros/core';
5
5
 
6
6
  declare const SettingsSchema: z.ZodObject<{
7
7
  url: z.ZodString;
@@ -20,12 +20,9 @@ declare namespace index$1 {
20
20
  export { type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, index$1_settings as settings };
21
21
  }
22
22
 
23
- interface Mapping {
24
- }
25
23
  interface Env extends DestinationServer.Env {
26
24
  sendServer?: typeof sendServer;
27
25
  }
28
- type Rule = Mapping$1.Rule<Mapping>;
29
26
 
30
27
  declare const init: Env | undefined;
31
28
  declare const standard: Env;
@@ -36,69 +33,19 @@ declare namespace env {
36
33
  export { env_init as init, env_standard as standard };
37
34
  }
38
35
 
39
- declare function entity_action$1(): string;
40
-
41
- declare namespace events {
42
- export { entity_action$1 as entity_action };
43
- }
44
-
45
- declare const entity_action: Rule;
46
- declare const config: {
47
- entity: {
48
- action: Rule;
49
- };
50
- };
51
-
52
- declare const mapping_config: typeof config;
53
- declare const mapping_entity_action: typeof entity_action;
54
- declare namespace mapping {
55
- export { mapping_config as config, mapping_entity_action as entity_action };
56
- }
57
-
58
- declare const fullEventPost: {
59
- url: string;
60
- body: string;
61
- options: {
62
- headers: undefined;
63
- method: undefined;
64
- timeout: undefined;
65
- };
66
- };
67
- declare const mappedDataPost: {
68
- url: string;
69
- body: string;
70
- options: {
71
- headers: undefined;
72
- method: undefined;
73
- timeout: undefined;
74
- };
75
- };
76
- declare const customOptionsPost: {
77
- url: string;
78
- body: string;
79
- options: {
80
- headers: {
81
- 'X-API-Key': string;
82
- 'Content-Type': string;
83
- };
84
- method: string;
85
- timeout: number;
86
- };
87
- };
36
+ declare const fullEvent: Flow.StepExample;
37
+ declare const customHeaders: Flow.StepExample;
88
38
 
89
- declare const outputs_customOptionsPost: typeof customOptionsPost;
90
- declare const outputs_fullEventPost: typeof fullEventPost;
91
- declare const outputs_mappedDataPost: typeof mappedDataPost;
92
- declare namespace outputs {
93
- export { outputs_customOptionsPost as customOptionsPost, outputs_fullEventPost as fullEventPost, outputs_mappedDataPost as mappedDataPost };
39
+ declare const step_customHeaders: typeof customHeaders;
40
+ declare const step_fullEvent: typeof fullEvent;
41
+ declare namespace step {
42
+ export { step_customHeaders as customHeaders, step_fullEvent as fullEvent };
94
43
  }
95
44
 
96
45
  declare const index_env: typeof env;
97
- declare const index_events: typeof events;
98
- declare const index_mapping: typeof mapping;
99
- declare const index_outputs: typeof outputs;
46
+ declare const index_step: typeof step;
100
47
  declare namespace index {
101
- export { index_env as env, index_events as events, index_mapping as mapping, index_outputs as outputs };
48
+ export { index_env as env, index_step as step };
102
49
  }
103
50
 
104
51
  export { index as examples, index$1 as schemas };
package/dist/dev.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _walkeros_core_dev from '@walkeros/core/dev';
2
2
  import { z } from '@walkeros/core/dev';
3
- import { Mapping as Mapping$1 } from '@walkeros/core';
4
3
  import { DestinationServer, sendServer } from '@walkeros/server-core';
4
+ import { Flow } from '@walkeros/core';
5
5
 
6
6
  declare const SettingsSchema: z.ZodObject<{
7
7
  url: z.ZodString;
@@ -20,12 +20,9 @@ declare namespace index$1 {
20
20
  export { type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, index$1_settings as settings };
21
21
  }
22
22
 
23
- interface Mapping {
24
- }
25
23
  interface Env extends DestinationServer.Env {
26
24
  sendServer?: typeof sendServer;
27
25
  }
28
- type Rule = Mapping$1.Rule<Mapping>;
29
26
 
30
27
  declare const init: Env | undefined;
31
28
  declare const standard: Env;
@@ -36,69 +33,19 @@ declare namespace env {
36
33
  export { env_init as init, env_standard as standard };
37
34
  }
38
35
 
39
- declare function entity_action$1(): string;
40
-
41
- declare namespace events {
42
- export { entity_action$1 as entity_action };
43
- }
44
-
45
- declare const entity_action: Rule;
46
- declare const config: {
47
- entity: {
48
- action: Rule;
49
- };
50
- };
51
-
52
- declare const mapping_config: typeof config;
53
- declare const mapping_entity_action: typeof entity_action;
54
- declare namespace mapping {
55
- export { mapping_config as config, mapping_entity_action as entity_action };
56
- }
57
-
58
- declare const fullEventPost: {
59
- url: string;
60
- body: string;
61
- options: {
62
- headers: undefined;
63
- method: undefined;
64
- timeout: undefined;
65
- };
66
- };
67
- declare const mappedDataPost: {
68
- url: string;
69
- body: string;
70
- options: {
71
- headers: undefined;
72
- method: undefined;
73
- timeout: undefined;
74
- };
75
- };
76
- declare const customOptionsPost: {
77
- url: string;
78
- body: string;
79
- options: {
80
- headers: {
81
- 'X-API-Key': string;
82
- 'Content-Type': string;
83
- };
84
- method: string;
85
- timeout: number;
86
- };
87
- };
36
+ declare const fullEvent: Flow.StepExample;
37
+ declare const customHeaders: Flow.StepExample;
88
38
 
89
- declare const outputs_customOptionsPost: typeof customOptionsPost;
90
- declare const outputs_fullEventPost: typeof fullEventPost;
91
- declare const outputs_mappedDataPost: typeof mappedDataPost;
92
- declare namespace outputs {
93
- export { outputs_customOptionsPost as customOptionsPost, outputs_fullEventPost as fullEventPost, outputs_mappedDataPost as mappedDataPost };
39
+ declare const step_customHeaders: typeof customHeaders;
40
+ declare const step_fullEvent: typeof fullEvent;
41
+ declare namespace step {
42
+ export { step_customHeaders as customHeaders, step_fullEvent as fullEvent };
94
43
  }
95
44
 
96
45
  declare const index_env: typeof env;
97
- declare const index_events: typeof events;
98
- declare const index_mapping: typeof mapping;
99
- declare const index_outputs: typeof outputs;
46
+ declare const index_step: typeof step;
100
47
  declare namespace index {
101
- export { index_env as env, index_events as events, index_mapping as mapping, index_outputs as outputs };
48
+ export { index_env as env, index_step as step };
102
49
  }
103
50
 
104
51
  export { index as examples, index$1 as schemas };
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,n=(e,o)=>{for(var r in o)t(e,r,{get:o[r],enumerable:!0})},s={};n(s,{examples:()=>l,schemas:()=>a}),module.exports=(e=s,((e,n,s,a)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let d of r(n))i.call(e,d)||d===s||t(e,d,{get:()=>n[d],enumerable:!(a=o(n,d))||a.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a={};n(a,{SettingsSchema:()=>p,settings:()=>u});var d=require("@walkeros/core/dev"),c=require("@walkeros/core/dev"),p=c.z.object({url:c.z.string().url().describe("The API endpoint URL to send events to"),headers:c.z.record(c.z.string(),c.z.string()).describe("Custom HTTP headers to include with requests").optional(),method:c.z.string().describe("HTTP method to use (default: POST)").optional(),timeout:c.z.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()}),u=(0,d.zodToSchema)(p),l={};n(l,{env:()=>v,events:()=>g,mapping:()=>f,outputs:()=>S});var v={};n(v,{init:()=>m,standard:()=>y});var m={sendServer:void 0},y={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},g={};n(g,{entity_action:()=>b});var h=require("@walkeros/core");function b(){const e=(0,h.getEvent)("entity action");return JSON.stringify(e.data)}var f={};n(f,{config:()=>P,entity_action:()=>O});var O={data:"data"},P={entity:{action:O}},S={};n(S,{customOptionsPost:()=>z,fullEventPost:()=>j,mappedDataPost:()=>w});var T=(0,require("@walkeros/core").getEvent)("entity action"),j={url:"https://api.example.com/events",body:JSON.stringify(T),options:{headers:void 0,method:void 0,timeout:void 0}},w={url:"https://api.example.com/events",body:JSON.stringify(T.data),options:{headers:void 0,method:void 0,timeout:void 0}},z={url:"https://api.example.com/events",body:JSON.stringify(T),options:{headers:{"X-API-Key":"YOUR_API_KEY","Content-Type":"application/json"},method:"PUT",timeout:1e4}};//# sourceMappingURL=dev.js.map
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:()=>m,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:()=>l});var d=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),c=p.z.object({url:p.z.string().url().describe("The API endpoint URL to send events to"),headers:p.z.record(p.z.string(),p.z.string()).describe("Custom HTTP headers to include with requests").optional(),method:p.z.string().describe("HTTP method to use (default: POST)").optional(),timeout:p.z.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()}),l=(0,d.zodToSchema)(c),m={};a(m,{env:()=>u,step:()=>g});var u={};a(u,{init:()=>v,standard:()=>b});var v={sendServer:void 0},b={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},g={};a(g,{customHeaders:()=>f,fullEvent:()=>h});var y=require("@walkeros/core"),h={in:(0,y.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"})}},f={in:(0,y.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"}}};//# 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/events.ts","../src/examples/mapping.ts","../src/examples/outputs.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 events from './events';\nexport * as mapping from './mapping';\nexport * as outputs from './outputs';\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","import { getEvent } from '@walkeros/core';\n\nexport function entity_action() {\n const event = getEvent('entity action');\n\n return JSON.stringify(event.data);\n}\n","import type { Mapping } from '@walkeros/core';\nimport type { Rule, Rules } from '../types';\n\nexport const entity_action: Rule = {\n data: 'data',\n};\n\nexport const config = {\n entity: { action: entity_action },\n} satisfies Rules;\n","import { getEvent } from '@walkeros/core';\n\n/**\n * Examples of API calls the destination will make.\n * Tests verify implementation produces these outputs.\n */\n\nconst sampleEvent = getEvent('entity action');\n\n// Full event POST (default behavior)\nexport const fullEventPost = {\n url: 'https://api.example.com/events',\n body: JSON.stringify(sampleEvent),\n options: { headers: undefined, method: undefined, timeout: undefined },\n};\n\n// POST with custom data (via mapping)\nexport const mappedDataPost = {\n url: 'https://api.example.com/events',\n body: JSON.stringify(sampleEvent.data),\n options: { headers: undefined, method: undefined, timeout: undefined },\n};\n\n// POST with custom headers and method\nexport const customOptionsPost = {\n url: 'https://api.example.com/events',\n body: JSON.stringify(sampleEvent),\n options: {\n headers: {\n 'X-API-Key': 'YOUR_API_KEY',\n 'Content-Type': 'application/json',\n },\n method: 'PUT',\n timeout: 10000,\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;AAAA;AAAA;;;ACAA;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;;;ACnBA;AAAA;AAAA;AAAA;AAAA,kBAAyB;AAElB,SAAS,gBAAgB;AAC9B,QAAM,YAAQ,sBAAS,eAAe;AAEtC,SAAO,KAAK,UAAU,MAAM,IAAI;AAClC;;;ACNA;AAAA;AAAA;AAAA,uBAAAC;AAAA;AAGO,IAAMA,iBAAsB;AAAA,EACjC,MAAM;AACR;AAEO,IAAM,SAAS;AAAA,EACpB,QAAQ,EAAE,QAAQA,eAAc;AAClC;;;ACTA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAC,eAAyB;AAOzB,IAAM,kBAAc,uBAAS,eAAe;AAGrC,IAAM,gBAAgB;AAAA,EAC3B,KAAK;AAAA,EACL,MAAM,KAAK,UAAU,WAAW;AAAA,EAChC,SAAS,EAAE,SAAS,QAAW,QAAQ,QAAW,SAAS,OAAU;AACvE;AAGO,IAAM,iBAAiB;AAAA,EAC5B,KAAK;AAAA,EACL,MAAM,KAAK,UAAU,YAAY,IAAI;AAAA,EACrC,SAAS,EAAE,SAAS,QAAW,QAAQ,QAAW,SAAS,OAAU;AACvE;AAGO,IAAM,oBAAoB;AAAA,EAC/B,KAAK;AAAA,EACL,MAAM,KAAK,UAAU,WAAW;AAAA,EAChC,SAAS;AAAA,IACP,SAAS;AAAA,MACP,aAAa;AAAA,MACb,gBAAgB;AAAA,IAClB;AAAA,IACA,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AACF;","names":["import_dev","entity_action","import_core"]}
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","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"],"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;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;;;ACnBA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAyB;AAElB,IAAM,YAA8B;AAAA,EACzC,QAAI,sBAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,MAAM,EAAE,OAAO,QAAQ,KAAK,2BAA2B;AAAA,IACvD,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,OAAO;AAAA,MACP,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACF;AAEO,IAAM,gBAAkC;AAAA,EAC7C,QAAI,sBAAS,eAAe;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;","names":["import_dev"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,o)=>{for(var i in o)e(t,i,{get:o[i],enumerable:!0})},o={};t(o,{SettingsSchema:()=>r,settings:()=>n});import{zodToSchema as i}from"@walkeros/core/dev";import{z as s}from"@walkeros/core/dev";var r=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()}),n=i(r),a={};t(a,{env:()=>d,events:()=>c,mapping:()=>u,outputs:()=>g});var d={};t(d,{init:()=>m,standard:()=>p});var m={sendServer:void 0},p={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},c={};t(c,{entity_action:()=>l});import{getEvent as v}from"@walkeros/core";function l(){const e=v("entity action");return JSON.stringify(e.data)}var u={};t(u,{config:()=>f,entity_action:()=>h});var h={data:"data"},f={entity:{action:h}},g={};t(g,{customOptionsPost:()=>S,fullEventPost:()=>P,mappedDataPost:()=>O});import{getEvent as y}from"@walkeros/core";var b=y("entity action"),P={url:"https://api.example.com/events",body:JSON.stringify(b),options:{headers:void 0,method:void 0,timeout:void 0}},O={url:"https://api.example.com/events",body:JSON.stringify(b.data),options:{headers:void 0,method:void 0,timeout:void 0}},S={url:"https://api.example.com/events",body:JSON.stringify(b),options:{headers:{"X-API-Key":"YOUR_API_KEY","Content-Type":"application/json"},method:"PUT",timeout:1e4}};export{a as examples,o as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,r)=>{for(var s in r)e(t,s,{get:r[s],enumerable:!0})},r={};t(r,{SettingsSchema:()=>i,settings:()=>a});import{zodToSchema as s}from"@walkeros/core/dev";import{z as o}from"@walkeros/core/dev";var i=o.object({url:o.string().url().describe("The API endpoint URL to send events to"),headers:o.record(o.string(),o.string()).describe("Custom HTTP headers to include with requests").optional(),method:o.string().describe("HTTP method to use (default: POST)").optional(),timeout:o.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()}),a=s(i),m={};t(m,{env:()=>d,step:()=>c});var d={};t(d,{init:()=>n,standard:()=>p});var n={sendServer:void 0},p={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},c={};t(c,{customHeaders:()=>v,fullEvent:()=>u});import{getEvent as l}from"@walkeros/core";var u={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"})}},v={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"}}};export{m 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/events.ts","../src/examples/mapping.ts","../src/examples/outputs.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 events from './events';\nexport * as mapping from './mapping';\nexport * as outputs from './outputs';\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","import { getEvent } from '@walkeros/core';\n\nexport function entity_action() {\n const event = getEvent('entity action');\n\n return JSON.stringify(event.data);\n}\n","import type { Mapping } from '@walkeros/core';\nimport type { Rule, Rules } from '../types';\n\nexport const entity_action: Rule = {\n data: 'data',\n};\n\nexport const config = {\n entity: { action: entity_action },\n} satisfies Rules;\n","import { getEvent } from '@walkeros/core';\n\n/**\n * Examples of API calls the destination will make.\n * Tests verify implementation produces these outputs.\n */\n\nconst sampleEvent = getEvent('entity action');\n\n// Full event POST (default behavior)\nexport const fullEventPost = {\n url: 'https://api.example.com/events',\n body: JSON.stringify(sampleEvent),\n options: { headers: undefined, method: undefined, timeout: undefined },\n};\n\n// POST with custom data (via mapping)\nexport const mappedDataPost = {\n url: 'https://api.example.com/events',\n body: JSON.stringify(sampleEvent.data),\n options: { headers: undefined, method: undefined, timeout: undefined },\n};\n\n// POST with custom headers and method\nexport const customOptionsPost = {\n url: 'https://api.example.com/events',\n body: JSON.stringify(sampleEvent),\n options: {\n headers: {\n 'X-API-Key': 'YOUR_API_KEY',\n 'Content-Type': 'application/json',\n },\n method: 'PUT',\n timeout: 10000,\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;AAAA;AAAA;;;ACAA;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;;;ACnBA;AAAA;AAAA;AAAA;AAAA,SAAS,gBAAgB;AAElB,SAAS,gBAAgB;AAC9B,QAAM,QAAQ,SAAS,eAAe;AAEtC,SAAO,KAAK,UAAU,MAAM,IAAI;AAClC;;;ACNA;AAAA;AAAA;AAAA,uBAAAA;AAAA;AAGO,IAAMA,iBAAsB;AAAA,EACjC,MAAM;AACR;AAEO,IAAM,SAAS;AAAA,EACpB,QAAQ,EAAE,QAAQA,eAAc;AAClC;;;ACTA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,YAAAC,iBAAgB;AAOzB,IAAM,cAAcA,UAAS,eAAe;AAGrC,IAAM,gBAAgB;AAAA,EAC3B,KAAK;AAAA,EACL,MAAM,KAAK,UAAU,WAAW;AAAA,EAChC,SAAS,EAAE,SAAS,QAAW,QAAQ,QAAW,SAAS,OAAU;AACvE;AAGO,IAAM,iBAAiB;AAAA,EAC5B,KAAK;AAAA,EACL,MAAM,KAAK,UAAU,YAAY,IAAI;AAAA,EACrC,SAAS,EAAE,SAAS,QAAW,QAAQ,QAAW,SAAS,OAAU;AACvE;AAGO,IAAM,oBAAoB;AAAA,EAC/B,KAAK;AAAA,EACL,MAAM,KAAK,UAAU,WAAW;AAAA,EAChC,SAAS;AAAA,IACP,SAAS;AAAA,MACP,aAAa;AAAA,MACb,gBAAgB;AAAA,IAClB;AAAA,IACA,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AACF;","names":["entity_action","getEvent"]}
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","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"],"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;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;;;ACnBA;AAAA;AAAA;AAAA;AAAA;AACA,SAAS,gBAAgB;AAElB,IAAM,YAA8B;AAAA,EACzC,IAAI,SAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,MAAM,EAAE,OAAO,QAAQ,KAAK,2BAA2B;AAAA,IACvD,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,OAAO;AAAA,MACP,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACF;AAEO,IAAM,gBAAkC;AAAA,EAC7C,IAAI,SAAS,eAAe;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;","names":[]}
@@ -1,12 +1,9 @@
1
- import { Mapping as Mapping$1 } from '@walkeros/core';
2
1
  import { DestinationServer, sendServer } from '@walkeros/server-core';
2
+ import { Flow } from '@walkeros/core';
3
3
 
4
- interface Mapping {
5
- }
6
4
  interface Env extends DestinationServer.Env {
7
5
  sendServer?: typeof sendServer;
8
6
  }
9
- type Rule = Mapping$1.Rule<Mapping>;
10
7
 
11
8
  declare const init: Env | undefined;
12
9
  declare const standard: Env;
@@ -17,61 +14,13 @@ declare namespace env {
17
14
  export { env_init as init, env_standard as standard };
18
15
  }
19
16
 
20
- declare function entity_action$1(): string;
21
-
22
- declare namespace events {
23
- export { entity_action$1 as entity_action };
24
- }
25
-
26
- declare const entity_action: Rule;
27
- declare const config: {
28
- entity: {
29
- action: Rule;
30
- };
31
- };
32
-
33
- declare const mapping_config: typeof config;
34
- declare const mapping_entity_action: typeof entity_action;
35
- declare namespace mapping {
36
- export { mapping_config as config, mapping_entity_action as entity_action };
37
- }
38
-
39
- declare const fullEventPost: {
40
- url: string;
41
- body: string;
42
- options: {
43
- headers: undefined;
44
- method: undefined;
45
- timeout: undefined;
46
- };
47
- };
48
- declare const mappedDataPost: {
49
- url: string;
50
- body: string;
51
- options: {
52
- headers: undefined;
53
- method: undefined;
54
- timeout: undefined;
55
- };
56
- };
57
- declare const customOptionsPost: {
58
- url: string;
59
- body: string;
60
- options: {
61
- headers: {
62
- 'X-API-Key': string;
63
- 'Content-Type': string;
64
- };
65
- method: string;
66
- timeout: number;
67
- };
68
- };
17
+ declare const fullEvent: Flow.StepExample;
18
+ declare const customHeaders: Flow.StepExample;
69
19
 
70
- declare const outputs_customOptionsPost: typeof customOptionsPost;
71
- declare const outputs_fullEventPost: typeof fullEventPost;
72
- declare const outputs_mappedDataPost: typeof mappedDataPost;
73
- declare namespace outputs {
74
- export { outputs_customOptionsPost as customOptionsPost, outputs_fullEventPost as fullEventPost, outputs_mappedDataPost as mappedDataPost };
20
+ declare const step_customHeaders: typeof customHeaders;
21
+ declare const step_fullEvent: typeof fullEvent;
22
+ declare namespace step {
23
+ export { step_customHeaders as customHeaders, step_fullEvent as fullEvent };
75
24
  }
76
25
 
77
- export { env, events, mapping, outputs };
26
+ export { env, step };
@@ -1,12 +1,9 @@
1
- import { Mapping as Mapping$1 } from '@walkeros/core';
2
1
  import { DestinationServer, sendServer } from '@walkeros/server-core';
2
+ import { Flow } from '@walkeros/core';
3
3
 
4
- interface Mapping {
5
- }
6
4
  interface Env extends DestinationServer.Env {
7
5
  sendServer?: typeof sendServer;
8
6
  }
9
- type Rule = Mapping$1.Rule<Mapping>;
10
7
 
11
8
  declare const init: Env | undefined;
12
9
  declare const standard: Env;
@@ -17,61 +14,13 @@ declare namespace env {
17
14
  export { env_init as init, env_standard as standard };
18
15
  }
19
16
 
20
- declare function entity_action$1(): string;
21
-
22
- declare namespace events {
23
- export { entity_action$1 as entity_action };
24
- }
25
-
26
- declare const entity_action: Rule;
27
- declare const config: {
28
- entity: {
29
- action: Rule;
30
- };
31
- };
32
-
33
- declare const mapping_config: typeof config;
34
- declare const mapping_entity_action: typeof entity_action;
35
- declare namespace mapping {
36
- export { mapping_config as config, mapping_entity_action as entity_action };
37
- }
38
-
39
- declare const fullEventPost: {
40
- url: string;
41
- body: string;
42
- options: {
43
- headers: undefined;
44
- method: undefined;
45
- timeout: undefined;
46
- };
47
- };
48
- declare const mappedDataPost: {
49
- url: string;
50
- body: string;
51
- options: {
52
- headers: undefined;
53
- method: undefined;
54
- timeout: undefined;
55
- };
56
- };
57
- declare const customOptionsPost: {
58
- url: string;
59
- body: string;
60
- options: {
61
- headers: {
62
- 'X-API-Key': string;
63
- 'Content-Type': string;
64
- };
65
- method: string;
66
- timeout: number;
67
- };
68
- };
17
+ declare const fullEvent: Flow.StepExample;
18
+ declare const customHeaders: Flow.StepExample;
69
19
 
70
- declare const outputs_customOptionsPost: typeof customOptionsPost;
71
- declare const outputs_fullEventPost: typeof fullEventPost;
72
- declare const outputs_mappedDataPost: typeof mappedDataPost;
73
- declare namespace outputs {
74
- export { outputs_customOptionsPost as customOptionsPost, outputs_fullEventPost as fullEventPost, outputs_mappedDataPost as mappedDataPost };
20
+ declare const step_customHeaders: typeof customHeaders;
21
+ declare const step_fullEvent: typeof fullEvent;
22
+ declare namespace step {
23
+ export { step_customHeaders as customHeaders, step_fullEvent as fullEvent };
75
24
  }
76
25
 
77
- export { env, events, mapping, outputs };
26
+ export { env, step };
@@ -21,9 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var examples_exports = {};
22
22
  __export(examples_exports, {
23
23
  env: () => env_exports,
24
- events: () => events_exports,
25
- mapping: () => mapping_exports,
26
- outputs: () => outputs_exports
24
+ step: () => step_exports
27
25
  });
28
26
  module.exports = __toCommonJS(examples_exports);
29
27
 
@@ -43,65 +41,50 @@ var standard = {
43
41
  })
44
42
  };
45
43
 
46
- // src/examples/events.ts
47
- var events_exports = {};
48
- __export(events_exports, {
49
- entity_action: () => entity_action
44
+ // src/examples/step.ts
45
+ var step_exports = {};
46
+ __export(step_exports, {
47
+ customHeaders: () => customHeaders,
48
+ fullEvent: () => fullEvent
50
49
  });
51
50
  var import_core = require("@walkeros/core");
52
- function entity_action() {
53
- const event = (0, import_core.getEvent)("entity action");
54
- return JSON.stringify(event.data);
55
- }
56
-
57
- // src/examples/mapping.ts
58
- var mapping_exports = {};
59
- __export(mapping_exports, {
60
- config: () => config,
61
- entity_action: () => entity_action2
62
- });
63
- var entity_action2 = {
64
- data: "data"
65
- };
66
- var config = {
67
- entity: { action: entity_action2 }
68
- };
69
-
70
- // src/examples/outputs.ts
71
- var outputs_exports = {};
72
- __export(outputs_exports, {
73
- customOptionsPost: () => customOptionsPost,
74
- fullEventPost: () => fullEventPost,
75
- mappedDataPost: () => mappedDataPost
76
- });
77
- var import_core2 = require("@walkeros/core");
78
- var sampleEvent = (0, import_core2.getEvent)("entity action");
79
- var fullEventPost = {
80
- url: "https://api.example.com/events",
81
- body: JSON.stringify(sampleEvent),
82
- options: { headers: void 0, method: void 0, timeout: void 0 }
83
- };
84
- var mappedDataPost = {
85
- url: "https://api.example.com/events",
86
- body: JSON.stringify(sampleEvent.data),
87
- options: { headers: void 0, method: void 0, timeout: void 0 }
51
+ var fullEvent = {
52
+ in: (0, import_core.getEvent)("page view", {
53
+ timestamp: 1700000800,
54
+ data: { title: "Docs", url: "https://example.com/docs" },
55
+ source: { type: "server", id: "", previous_id: "" }
56
+ }),
57
+ mapping: {
58
+ data: "data"
59
+ },
60
+ out: {
61
+ url: "https://api.example.com/events",
62
+ body: JSON.stringify({
63
+ title: "Docs",
64
+ url: "https://example.com/docs"
65
+ })
66
+ }
88
67
  };
89
- var customOptionsPost = {
90
- url: "https://api.example.com/events",
91
- body: JSON.stringify(sampleEvent),
92
- options: {
93
- headers: {
94
- "X-API-Key": "YOUR_API_KEY",
95
- "Content-Type": "application/json"
96
- },
97
- method: "PUT",
98
- timeout: 1e4
68
+ var customHeaders = {
69
+ in: (0, import_core.getEvent)("form submit", {
70
+ timestamp: 1700000801,
71
+ data: { type: "contact", email: "user@example.com" },
72
+ source: { type: "server", id: "", previous_id: "" }
73
+ }),
74
+ mapping: {
75
+ data: "data"
76
+ },
77
+ out: {
78
+ url: "https://api.example.com/events",
79
+ body: JSON.stringify({
80
+ type: "contact",
81
+ email: "user@example.com"
82
+ }),
83
+ headers: { "X-API-Key": "YOUR_API_KEY" }
99
84
  }
100
85
  };
101
86
  // Annotate the CommonJS export names for ESM import in node:
102
87
  0 && (module.exports = {
103
88
  env,
104
- events,
105
- mapping,
106
- outputs
89
+ step
107
90
  });
@@ -20,64 +20,49 @@ var standard = {
20
20
  })
21
21
  };
22
22
 
23
- // src/examples/events.ts
24
- var events_exports = {};
25
- __export(events_exports, {
26
- entity_action: () => entity_action
23
+ // src/examples/step.ts
24
+ var step_exports = {};
25
+ __export(step_exports, {
26
+ customHeaders: () => customHeaders,
27
+ fullEvent: () => fullEvent
27
28
  });
28
29
  import { getEvent } from "@walkeros/core";
29
- function entity_action() {
30
- const event = getEvent("entity action");
31
- return JSON.stringify(event.data);
32
- }
33
-
34
- // src/examples/mapping.ts
35
- var mapping_exports = {};
36
- __export(mapping_exports, {
37
- config: () => config,
38
- entity_action: () => entity_action2
39
- });
40
- var entity_action2 = {
41
- data: "data"
42
- };
43
- var config = {
44
- entity: { action: entity_action2 }
45
- };
46
-
47
- // src/examples/outputs.ts
48
- var outputs_exports = {};
49
- __export(outputs_exports, {
50
- customOptionsPost: () => customOptionsPost,
51
- fullEventPost: () => fullEventPost,
52
- mappedDataPost: () => mappedDataPost
53
- });
54
- import { getEvent as getEvent2 } from "@walkeros/core";
55
- var sampleEvent = getEvent2("entity action");
56
- var fullEventPost = {
57
- url: "https://api.example.com/events",
58
- body: JSON.stringify(sampleEvent),
59
- options: { headers: void 0, method: void 0, timeout: void 0 }
60
- };
61
- var mappedDataPost = {
62
- url: "https://api.example.com/events",
63
- body: JSON.stringify(sampleEvent.data),
64
- options: { headers: void 0, method: void 0, timeout: void 0 }
30
+ var fullEvent = {
31
+ in: getEvent("page view", {
32
+ timestamp: 1700000800,
33
+ data: { title: "Docs", url: "https://example.com/docs" },
34
+ source: { type: "server", id: "", previous_id: "" }
35
+ }),
36
+ mapping: {
37
+ data: "data"
38
+ },
39
+ out: {
40
+ url: "https://api.example.com/events",
41
+ body: JSON.stringify({
42
+ title: "Docs",
43
+ url: "https://example.com/docs"
44
+ })
45
+ }
65
46
  };
66
- var customOptionsPost = {
67
- url: "https://api.example.com/events",
68
- body: JSON.stringify(sampleEvent),
69
- options: {
70
- headers: {
71
- "X-API-Key": "YOUR_API_KEY",
72
- "Content-Type": "application/json"
73
- },
74
- method: "PUT",
75
- timeout: 1e4
47
+ var customHeaders = {
48
+ in: getEvent("form submit", {
49
+ timestamp: 1700000801,
50
+ data: { type: "contact", email: "user@example.com" },
51
+ source: { type: "server", id: "", previous_id: "" }
52
+ }),
53
+ mapping: {
54
+ data: "data"
55
+ },
56
+ out: {
57
+ url: "https://api.example.com/events",
58
+ body: JSON.stringify({
59
+ type: "contact",
60
+ email: "user@example.com"
61
+ }),
62
+ headers: { "X-API-Key": "YOUR_API_KEY" }
76
63
  }
77
64
  };
78
65
  export {
79
66
  env_exports as env,
80
- events_exports as events,
81
- mapping_exports as mapping,
82
- outputs_exports as outputs
67
+ step_exports as step
83
68
  };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { Destination as Destination$1, SendHeaders, Mapping as Mapping$1, SendDataValue } from '@walkeros/core';
1
+ import { Destination as Destination$1, SendHeaders, Mapping as Mapping$1, SendDataValue, Flow } from '@walkeros/core';
2
2
  import { DestinationServer, sendServer } from '@walkeros/server-core';
3
3
 
4
4
  interface Settings {
@@ -44,69 +44,19 @@ declare namespace env {
44
44
  export { env_init as init, env_standard as standard };
45
45
  }
46
46
 
47
- declare function entity_action$1(): string;
47
+ declare const fullEvent: Flow.StepExample;
48
+ declare const customHeaders: Flow.StepExample;
48
49
 
49
- declare namespace events {
50
- export { entity_action$1 as entity_action };
51
- }
52
-
53
- declare const entity_action: Rule;
54
- declare const config: {
55
- entity: {
56
- action: Rule;
57
- };
58
- };
59
-
60
- declare const mapping_config: typeof config;
61
- declare const mapping_entity_action: typeof entity_action;
62
- declare namespace mapping {
63
- export { mapping_config as config, mapping_entity_action as entity_action };
64
- }
65
-
66
- declare const fullEventPost: {
67
- url: string;
68
- body: string;
69
- options: {
70
- headers: undefined;
71
- method: undefined;
72
- timeout: undefined;
73
- };
74
- };
75
- declare const mappedDataPost: {
76
- url: string;
77
- body: string;
78
- options: {
79
- headers: undefined;
80
- method: undefined;
81
- timeout: undefined;
82
- };
83
- };
84
- declare const customOptionsPost: {
85
- url: string;
86
- body: string;
87
- options: {
88
- headers: {
89
- 'X-API-Key': string;
90
- 'Content-Type': string;
91
- };
92
- method: string;
93
- timeout: number;
94
- };
95
- };
96
-
97
- declare const outputs_customOptionsPost: typeof customOptionsPost;
98
- declare const outputs_fullEventPost: typeof fullEventPost;
99
- declare const outputs_mappedDataPost: typeof mappedDataPost;
100
- declare namespace outputs {
101
- export { outputs_customOptionsPost as customOptionsPost, outputs_fullEventPost as fullEventPost, outputs_mappedDataPost as mappedDataPost };
50
+ declare const step_customHeaders: typeof customHeaders;
51
+ declare const step_fullEvent: typeof fullEvent;
52
+ declare namespace step {
53
+ export { step_customHeaders as customHeaders, step_fullEvent as fullEvent };
102
54
  }
103
55
 
104
56
  declare const index_env: typeof env;
105
- declare const index_events: typeof events;
106
- declare const index_mapping: typeof mapping;
107
- declare const index_outputs: typeof outputs;
57
+ declare const index_step: typeof step;
108
58
  declare namespace index {
109
- export { index_env as env, index_events as events, index_mapping as mapping, index_outputs as outputs };
59
+ export { index_env as env, index_step as step };
110
60
  }
111
61
 
112
62
  declare const destinationAPI: Destination;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Destination as Destination$1, SendHeaders, Mapping as Mapping$1, SendDataValue } from '@walkeros/core';
1
+ import { Destination as Destination$1, SendHeaders, Mapping as Mapping$1, SendDataValue, Flow } from '@walkeros/core';
2
2
  import { DestinationServer, sendServer } from '@walkeros/server-core';
3
3
 
4
4
  interface Settings {
@@ -44,69 +44,19 @@ declare namespace env {
44
44
  export { env_init as init, env_standard as standard };
45
45
  }
46
46
 
47
- declare function entity_action$1(): string;
47
+ declare const fullEvent: Flow.StepExample;
48
+ declare const customHeaders: Flow.StepExample;
48
49
 
49
- declare namespace events {
50
- export { entity_action$1 as entity_action };
51
- }
52
-
53
- declare const entity_action: Rule;
54
- declare const config: {
55
- entity: {
56
- action: Rule;
57
- };
58
- };
59
-
60
- declare const mapping_config: typeof config;
61
- declare const mapping_entity_action: typeof entity_action;
62
- declare namespace mapping {
63
- export { mapping_config as config, mapping_entity_action as entity_action };
64
- }
65
-
66
- declare const fullEventPost: {
67
- url: string;
68
- body: string;
69
- options: {
70
- headers: undefined;
71
- method: undefined;
72
- timeout: undefined;
73
- };
74
- };
75
- declare const mappedDataPost: {
76
- url: string;
77
- body: string;
78
- options: {
79
- headers: undefined;
80
- method: undefined;
81
- timeout: undefined;
82
- };
83
- };
84
- declare const customOptionsPost: {
85
- url: string;
86
- body: string;
87
- options: {
88
- headers: {
89
- 'X-API-Key': string;
90
- 'Content-Type': string;
91
- };
92
- method: string;
93
- timeout: number;
94
- };
95
- };
96
-
97
- declare const outputs_customOptionsPost: typeof customOptionsPost;
98
- declare const outputs_fullEventPost: typeof fullEventPost;
99
- declare const outputs_mappedDataPost: typeof mappedDataPost;
100
- declare namespace outputs {
101
- export { outputs_customOptionsPost as customOptionsPost, outputs_fullEventPost as fullEventPost, outputs_mappedDataPost as mappedDataPost };
50
+ declare const step_customHeaders: typeof customHeaders;
51
+ declare const step_fullEvent: typeof fullEvent;
52
+ declare namespace step {
53
+ export { step_customHeaders as customHeaders, step_fullEvent as fullEvent };
102
54
  }
103
55
 
104
56
  declare const index_env: typeof env;
105
- declare const index_events: typeof events;
106
- declare const index_mapping: typeof mapping;
107
- declare const index_outputs: typeof outputs;
57
+ declare const index_step: typeof step;
108
58
  declare namespace index {
109
- export { index_env as env, index_events as events, index_mapping as mapping, index_outputs as outputs };
59
+ export { index_env as env, index_step as step };
110
60
  }
111
61
 
112
62
  declare const destinationAPI: Destination;
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_core3=require("@walkeros/core"),import_server_core=require("@walkeros/server-core"),types_exports={},examples_exports={};__export(examples_exports,{env:()=>env_exports,events:()=>events_exports,mapping:()=>mapping_exports,outputs:()=>outputs_exports});var env_exports={};__export(env_exports,{init:()=>init,standard:()=>standard});var init={sendServer:void 0},standard={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},events_exports={};__export(events_exports,{entity_action:()=>entity_action});var import_core=require("@walkeros/core");function entity_action(){const event=(0,import_core.getEvent)("entity action");return JSON.stringify(event.data)}var mapping_exports={};__export(mapping_exports,{config:()=>config,entity_action:()=>entity_action2});var entity_action2={data:"data"},config={entity:{action:entity_action2}},outputs_exports={};__export(outputs_exports,{customOptionsPost:()=>customOptionsPost,fullEventPost:()=>fullEventPost,mappedDataPost:()=>mappedDataPost});var sampleEvent=(0,require("@walkeros/core").getEvent)("entity action"),fullEventPost={url:"https://api.example.com/events",body:JSON.stringify(sampleEvent),options:{headers:void 0,method:void 0,timeout:void 0}},mappedDataPost={url:"https://api.example.com/events",body:JSON.stringify(sampleEvent.data),options:{headers:void 0,method:void 0,timeout:void 0}},customOptionsPost={url:"https://api.example.com/events",body:JSON.stringify(sampleEvent),options:{headers:{"X-API-Key":"YOUR_API_KEY","Content-Type":"application/json"},method:"PUT",timeout:1e4}},destinationAPI={type:"api",config:{},env:{sendServer:import_server_core.sendServer},async push(event,{config:config2,rule:rule,data:data,env:env,logger:logger}){const{settings:settings}=config2,{url:url,headers:headers,method:method,transform:transform,timeout:timeout}=settings||{};if(!url)return;const eventData=(0,import_core3.isDefined)(data)?data:event,body=transform?transform(eventData,config2,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,standard:()=>standard});var init={sendServer:void 0},standard={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},step_exports={};__export(step_exports,{customHeaders:()=>customHeaders,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"}}},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/events.ts","../src/examples/mapping.ts","../src/examples/outputs.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 events from './events';\nexport * as mapping from './mapping';\nexport * as outputs from './outputs';\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","import { getEvent } from '@walkeros/core';\n\nexport function entity_action() {\n const event = getEvent('entity action');\n\n return JSON.stringify(event.data);\n}\n","import type { Mapping } from '@walkeros/core';\nimport type { Rule, Rules } from '../types';\n\nexport const entity_action: Rule = {\n data: 'data',\n};\n\nexport const config = {\n entity: { action: entity_action },\n} satisfies Rules;\n","import { getEvent } from '@walkeros/core';\n\n/**\n * Examples of API calls the destination will make.\n * Tests verify implementation produces these outputs.\n */\n\nconst sampleEvent = getEvent('entity action');\n\n// Full event POST (default behavior)\nexport const fullEventPost = {\n url: 'https://api.example.com/events',\n body: JSON.stringify(sampleEvent),\n options: { headers: undefined, method: undefined, timeout: undefined },\n};\n\n// POST with custom data (via mapping)\nexport const mappedDataPost = {\n url: 'https://api.example.com/events',\n body: JSON.stringify(sampleEvent.data),\n options: { headers: undefined, method: undefined, timeout: undefined },\n};\n\n// POST with custom headers and method\nexport const customOptionsPost = {\n url: 'https://api.example.com/events',\n body: JSON.stringify(sampleEvent),\n options: {\n headers: {\n 'X-API-Key': 'YOUR_API_KEY',\n 'Content-Type': 'application/json',\n },\n method: 'PUT',\n timeout: 10000,\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA0B;AAC1B,yBAA2B;;;ACF3B;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;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;;;ACnBA;AAAA;AAAA;AAAA;AAAA,kBAAyB;AAElB,SAAS,gBAAgB;AAC9B,QAAM,YAAQ,sBAAS,eAAe;AAEtC,SAAO,KAAK,UAAU,MAAM,IAAI;AAClC;;;ACNA;AAAA;AAAA;AAAA,uBAAAC;AAAA;AAGO,IAAMA,iBAAsB;AAAA,EACjC,MAAM;AACR;AAEO,IAAM,SAAS;AAAA,EACpB,QAAQ,EAAE,QAAQA,eAAc;AAClC;;;ACTA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAC,eAAyB;AAOzB,IAAM,kBAAc,uBAAS,eAAe;AAGrC,IAAM,gBAAgB;AAAA,EAC3B,KAAK;AAAA,EACL,MAAM,KAAK,UAAU,WAAW;AAAA,EAChC,SAAS,EAAE,SAAS,QAAW,QAAQ,QAAW,SAAS,OAAU;AACvE;AAGO,IAAM,iBAAiB;AAAA,EAC5B,KAAK;AAAA,EACL,MAAM,KAAK,UAAU,YAAY,IAAI;AAAA,EACrC,SAAS,EAAE,SAAS,QAAW,QAAQ,QAAW,SAAS,OAAU;AACvE;AAGO,IAAM,oBAAoB;AAAA,EAC/B,KAAK;AAAA,EACL,MAAM,KAAK,UAAU,WAAW;AAAA,EAChC,SAAS;AAAA,IACP,SAAS;AAAA,MACP,aAAa;AAAA,MACb,gBAAgB;AAAA,IAClB;AAAA,IACA,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AACF;;;ANzBO,IAAM,iBAA8B;AAAA,EACzC,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,0CAAW;AAAA,EAElB,MAAM,KAAK,OAAO,EAAE,QAAAC,SAAQ,MAAM,MAAM,KAAK,OAAO,GAAG;AACrD,UAAM,EAAE,SAAS,IAAIA;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,WAAWA,SAAQ,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","entity_action","import_core","config"]}
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","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"],"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;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;;;ACnBA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAyB;AAElB,IAAM,YAA8B;AAAA,EACzC,QAAI,sBAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,MAAM,EAAE,OAAO,QAAQ,KAAK,2BAA2B;AAAA,IACvD,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,OAAO;AAAA,MACP,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACF;AAEO,IAAM,gBAAkC;AAAA,EAC7C,QAAI,sBAAS,eAAe;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;;;AJ5BO,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"]}
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,events:()=>events_exports,mapping:()=>mapping_exports,outputs:()=>outputs_exports});var env_exports={};__export(env_exports,{init:()=>init,standard:()=>standard});var init={sendServer:void 0},standard={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},events_exports={};__export(events_exports,{entity_action:()=>entity_action});import{getEvent}from"@walkeros/core";function entity_action(){const event=getEvent("entity action");return JSON.stringify(event.data)}var mapping_exports={};__export(mapping_exports,{config:()=>config,entity_action:()=>entity_action2});var entity_action2={data:"data"},config={entity:{action:entity_action2}},outputs_exports={};__export(outputs_exports,{customOptionsPost:()=>customOptionsPost,fullEventPost:()=>fullEventPost,mappedDataPost:()=>mappedDataPost});import{getEvent as getEvent2}from"@walkeros/core";var sampleEvent=getEvent2("entity action"),fullEventPost={url:"https://api.example.com/events",body:JSON.stringify(sampleEvent),options:{headers:void 0,method:void 0,timeout:void 0}},mappedDataPost={url:"https://api.example.com/events",body:JSON.stringify(sampleEvent.data),options:{headers:void 0,method:void 0,timeout:void 0}},customOptionsPost={url:"https://api.example.com/events",body:JSON.stringify(sampleEvent),options:{headers:{"X-API-Key":"YOUR_API_KEY","Content-Type":"application/json"},method:"PUT",timeout:1e4}},destinationAPI={type:"api",config:{},env:{sendServer:sendServer},async push(event,{config:config2,rule:rule,data:data,env:env,logger:logger}){const{settings:settings}=config2,{url:url,headers:headers,method:method,transform:transform,timeout:timeout}=settings||{};if(!url)return;const eventData=isDefined(data)?data:event,body=transform?transform(eventData,config2,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,standard:()=>standard});var init={sendServer:void 0},standard={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},step_exports={};__export(step_exports,{customHeaders:()=>customHeaders,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"}}},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/events.ts","../src/examples/mapping.ts","../src/examples/outputs.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 events from './events';\nexport * as mapping from './mapping';\nexport * as outputs from './outputs';\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","import { getEvent } from '@walkeros/core';\n\nexport function entity_action() {\n const event = getEvent('entity action');\n\n return JSON.stringify(event.data);\n}\n","import type { Mapping } from '@walkeros/core';\nimport type { Rule, Rules } from '../types';\n\nexport const entity_action: Rule = {\n data: 'data',\n};\n\nexport const config = {\n entity: { action: entity_action },\n} satisfies Rules;\n","import { getEvent } from '@walkeros/core';\n\n/**\n * Examples of API calls the destination will make.\n * Tests verify implementation produces these outputs.\n */\n\nconst sampleEvent = getEvent('entity action');\n\n// Full event POST (default behavior)\nexport const fullEventPost = {\n url: 'https://api.example.com/events',\n body: JSON.stringify(sampleEvent),\n options: { headers: undefined, method: undefined, timeout: undefined },\n};\n\n// POST with custom data (via mapping)\nexport const mappedDataPost = {\n url: 'https://api.example.com/events',\n body: JSON.stringify(sampleEvent.data),\n options: { headers: undefined, method: undefined, timeout: undefined },\n};\n\n// POST with custom headers and method\nexport const customOptionsPost = {\n url: 'https://api.example.com/events',\n body: JSON.stringify(sampleEvent),\n options: {\n headers: {\n 'X-API-Key': 'YOUR_API_KEY',\n 'Content-Type': 'application/json',\n },\n method: 'PUT',\n timeout: 10000,\n },\n};\n"],"mappings":";;;;;;;AACA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;;;ACF3B;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;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;;;ACnBA;AAAA;AAAA;AAAA;AAAA,SAAS,gBAAgB;AAElB,SAAS,gBAAgB;AAC9B,QAAM,QAAQ,SAAS,eAAe;AAEtC,SAAO,KAAK,UAAU,MAAM,IAAI;AAClC;;;ACNA;AAAA;AAAA;AAAA,uBAAAA;AAAA;AAGO,IAAMA,iBAAsB;AAAA,EACjC,MAAM;AACR;AAEO,IAAM,SAAS;AAAA,EACpB,QAAQ,EAAE,QAAQA,eAAc;AAClC;;;ACTA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,YAAAC,iBAAgB;AAOzB,IAAM,cAAcA,UAAS,eAAe;AAGrC,IAAM,gBAAgB;AAAA,EAC3B,KAAK;AAAA,EACL,MAAM,KAAK,UAAU,WAAW;AAAA,EAChC,SAAS,EAAE,SAAS,QAAW,QAAQ,QAAW,SAAS,OAAU;AACvE;AAGO,IAAM,iBAAiB;AAAA,EAC5B,KAAK;AAAA,EACL,MAAM,KAAK,UAAU,YAAY,IAAI;AAAA,EACrC,SAAS,EAAE,SAAS,QAAW,QAAQ,QAAW,SAAS,OAAU;AACvE;AAGO,IAAM,oBAAoB;AAAA,EAC/B,KAAK;AAAA,EACL,MAAM,KAAK,UAAU,WAAW;AAAA,EAChC,SAAS;AAAA,IACP,SAAS;AAAA,MACP,aAAa;AAAA,MACb,gBAAgB;AAAA,IAClB;AAAA,IACA,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AACF;;;ANzBO,IAAM,iBAA8B;AAAA,EACzC,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,WAAW;AAAA,EAElB,MAAM,KAAK,OAAO,EAAE,QAAAC,SAAQ,MAAM,MAAM,KAAK,OAAO,GAAG;AACrD,UAAM,EAAE,SAAS,IAAIA;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,WAAWA,SAAQ,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":["entity_action","getEvent","config"]}
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","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"],"mappings":";;;;;;;AACA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;;;ACF3B;;;ACAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;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;;;ACnBA;AAAA;AAAA;AAAA;AAAA;AACA,SAAS,gBAAgB;AAElB,IAAM,YAA8B;AAAA,EACzC,IAAI,SAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,MAAM,EAAE,OAAO,QAAQ,KAAK,2BAA2B;AAAA,IACvD,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,OAAO;AAAA,MACP,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACF;AAEO,IAAM,gBAAkC;AAAA,EAC7C,IAAI,SAAS,eAAe;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;;;AJ5BO,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,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/server-destination-api",
4
- "version": "2.0.0",
4
+ "version": "2.0.1",
5
5
  "type": "destination",
6
6
  "platform": "server"
7
7
  },
@@ -50,45 +50,145 @@
50
50
  }
51
51
  }
52
52
  },
53
- "events": {
54
- "entity_action": {
55
- "$code": "function l(){const e=v(\"entity action\");return JSON.stringify(e.data)}"
56
- }
57
- },
58
- "mapping": {
59
- "config": {
60
- "entity": {
61
- "action": {
62
- "data": "data"
53
+ "step": {
54
+ "customHeaders": {
55
+ "in": {
56
+ "name": "form submit",
57
+ "data": {
58
+ "type": "contact",
59
+ "email": "user@example.com"
60
+ },
61
+ "context": {
62
+ "dev": [
63
+ "test",
64
+ 1
65
+ ]
66
+ },
67
+ "globals": {
68
+ "lang": "elb"
69
+ },
70
+ "custom": {
71
+ "completely": "random"
72
+ },
73
+ "user": {
74
+ "id": "us3r",
75
+ "device": "c00k13",
76
+ "session": "s3ss10n"
77
+ },
78
+ "nested": [
79
+ {
80
+ "entity": "child",
81
+ "data": {
82
+ "is": "subordinated"
83
+ },
84
+ "nested": [],
85
+ "context": {
86
+ "element": [
87
+ "child",
88
+ 0
89
+ ]
90
+ }
91
+ }
92
+ ],
93
+ "consent": {
94
+ "functional": true
95
+ },
96
+ "id": "1700000801-gr0up-1",
97
+ "trigger": "test",
98
+ "entity": "form",
99
+ "action": "submit",
100
+ "timestamp": 1700000801,
101
+ "timing": 3.14,
102
+ "group": "gr0up",
103
+ "count": 1,
104
+ "version": {
105
+ "source": "2.0.1",
106
+ "tagging": 1
107
+ },
108
+ "source": {
109
+ "type": "server",
110
+ "id": "",
111
+ "previous_id": ""
112
+ }
113
+ },
114
+ "mapping": {
115
+ "data": "data"
116
+ },
117
+ "out": {
118
+ "url": "https://api.example.com/events",
119
+ "body": "{\"type\":\"contact\",\"email\":\"user@example.com\"}",
120
+ "headers": {
121
+ "X-API-Key": "YOUR_API_KEY"
63
122
  }
64
123
  }
65
124
  },
66
- "entity_action": {
67
- "data": "data"
68
- }
69
- },
70
- "outputs": {
71
- "customOptionsPost": {
72
- "url": "https://api.example.com/events",
73
- "body": "{\"name\":\"entity action\",\"data\":{\"string\":\"foo\",\"number\":1,\"boolean\":true,\"array\":[0,\"text\",false]},\"context\":{\"dev\":[\"test\",1]},\"globals\":{\"lang\":\"elb\"},\"custom\":{\"completely\":\"random\"},\"user\":{\"id\":\"us3r\",\"device\":\"c00k13\",\"session\":\"s3ss10n\"},\"nested\":[{\"entity\":\"child\",\"data\":{\"is\":\"subordinated\"},\"nested\":[],\"context\":{\"element\":[\"child\",0]}}],\"consent\":{\"functional\":true},\"id\":\"1771373617000-gr0up-1\",\"trigger\":\"test\",\"entity\":\"entity\",\"action\":\"action\",\"timestamp\":1771373617000,\"timing\":3.14,\"group\":\"gr0up\",\"count\":1,\"version\":{\"source\":\"2.0.0\",\"tagging\":1},\"source\":{\"type\":\"web\",\"id\":\"https://localhost:80\",\"previous_id\":\"http://remotehost:9001\"}}",
74
- "options": {
75
- "headers": {
76
- "X-API-Key": "YOUR_API_KEY",
77
- "Content-Type": "application/json"
125
+ "fullEvent": {
126
+ "in": {
127
+ "name": "page view",
128
+ "data": {
129
+ "title": "Docs",
130
+ "url": "https://example.com/docs"
131
+ },
132
+ "context": {
133
+ "dev": [
134
+ "test",
135
+ 1
136
+ ]
137
+ },
138
+ "globals": {
139
+ "pagegroup": "docs"
140
+ },
141
+ "custom": {
142
+ "completely": "random"
143
+ },
144
+ "user": {
145
+ "id": "us3r",
146
+ "device": "c00k13",
147
+ "session": "s3ss10n"
148
+ },
149
+ "nested": [
150
+ {
151
+ "entity": "child",
152
+ "data": {
153
+ "is": "subordinated"
154
+ },
155
+ "nested": [],
156
+ "context": {
157
+ "element": [
158
+ "child",
159
+ 0
160
+ ]
161
+ }
162
+ }
163
+ ],
164
+ "consent": {
165
+ "functional": true
78
166
  },
79
- "method": "PUT",
80
- "timeout": 10000
167
+ "id": "1700000800-gr0up-1",
168
+ "trigger": "load",
169
+ "entity": "page",
170
+ "action": "view",
171
+ "timestamp": 1700000800,
172
+ "timing": 3.14,
173
+ "group": "gr0up",
174
+ "count": 1,
175
+ "version": {
176
+ "source": "2.0.1",
177
+ "tagging": 1
178
+ },
179
+ "source": {
180
+ "type": "server",
181
+ "id": "",
182
+ "previous_id": ""
183
+ }
184
+ },
185
+ "mapping": {
186
+ "data": "data"
187
+ },
188
+ "out": {
189
+ "url": "https://api.example.com/events",
190
+ "body": "{\"title\":\"Docs\",\"url\":\"https://example.com/docs\"}"
81
191
  }
82
- },
83
- "fullEventPost": {
84
- "url": "https://api.example.com/events",
85
- "body": "{\"name\":\"entity action\",\"data\":{\"string\":\"foo\",\"number\":1,\"boolean\":true,\"array\":[0,\"text\",false]},\"context\":{\"dev\":[\"test\",1]},\"globals\":{\"lang\":\"elb\"},\"custom\":{\"completely\":\"random\"},\"user\":{\"id\":\"us3r\",\"device\":\"c00k13\",\"session\":\"s3ss10n\"},\"nested\":[{\"entity\":\"child\",\"data\":{\"is\":\"subordinated\"},\"nested\":[],\"context\":{\"element\":[\"child\",0]}}],\"consent\":{\"functional\":true},\"id\":\"1771373617000-gr0up-1\",\"trigger\":\"test\",\"entity\":\"entity\",\"action\":\"action\",\"timestamp\":1771373617000,\"timing\":3.14,\"group\":\"gr0up\",\"count\":1,\"version\":{\"source\":\"2.0.0\",\"tagging\":1},\"source\":{\"type\":\"web\",\"id\":\"https://localhost:80\",\"previous_id\":\"http://remotehost:9001\"}}",
86
- "options": {}
87
- },
88
- "mappedDataPost": {
89
- "url": "https://api.example.com/events",
90
- "body": "{\"string\":\"foo\",\"number\":1,\"boolean\":true,\"array\":[0,\"text\",false]}",
91
- "options": {}
92
192
  }
93
193
  }
94
194
  }
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": "2.0.1",
4
+ "version": "2.1.0",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -36,8 +36,8 @@
36
36
  "update": "npx npm-check-updates -u && npm update"
37
37
  },
38
38
  "dependencies": {
39
- "@walkeros/core": "^2.0.0",
40
- "@walkeros/server-core": "^2.0.0"
39
+ "@walkeros/core": "^2.1.0",
40
+ "@walkeros/server-core": "^2.1.0"
41
41
  },
42
42
  "devDependencies": {},
43
43
  "repository": {