@walkeros/server-destination-api 3.0.0-next-1773236214827 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/dev.d.mts +7 -1
- package/dist/dev.d.ts +7 -1
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.d.mts +7 -1
- package/dist/examples/index.d.ts +7 -1
- package/dist/examples/index.js +2 -0
- package/dist/examples/index.mjs +2 -0
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +7 -4
- package/package.json +3 -3
package/README.md
CHANGED
package/dist/dev.d.mts
CHANGED
|
@@ -26,11 +26,17 @@ interface Env extends DestinationServer.Env {
|
|
|
26
26
|
|
|
27
27
|
declare const init: Env | undefined;
|
|
28
28
|
declare const standard: Env;
|
|
29
|
+
/**
|
|
30
|
+
* Simulation tracking paths
|
|
31
|
+
* Specifies which function calls to track during simulation
|
|
32
|
+
*/
|
|
33
|
+
declare const simulation: string[];
|
|
29
34
|
|
|
30
35
|
declare const env_init: typeof init;
|
|
36
|
+
declare const env_simulation: typeof simulation;
|
|
31
37
|
declare const env_standard: typeof standard;
|
|
32
38
|
declare namespace env {
|
|
33
|
-
export { env_init as init, env_standard as standard };
|
|
39
|
+
export { env_init as init, env_simulation as simulation, env_standard as standard };
|
|
34
40
|
}
|
|
35
41
|
|
|
36
42
|
declare const fullEvent: Flow.StepExample;
|
package/dist/dev.d.ts
CHANGED
|
@@ -26,11 +26,17 @@ interface Env extends DestinationServer.Env {
|
|
|
26
26
|
|
|
27
27
|
declare const init: Env | undefined;
|
|
28
28
|
declare const standard: Env;
|
|
29
|
+
/**
|
|
30
|
+
* Simulation tracking paths
|
|
31
|
+
* Specifies which function calls to track during simulation
|
|
32
|
+
*/
|
|
33
|
+
declare const simulation: string[];
|
|
29
34
|
|
|
30
35
|
declare const env_init: typeof init;
|
|
36
|
+
declare const env_simulation: typeof simulation;
|
|
31
37
|
declare const env_standard: typeof standard;
|
|
32
38
|
declare namespace env {
|
|
33
|
-
export { env_init as init, env_standard as standard };
|
|
39
|
+
export { env_init as init, env_simulation as simulation, env_standard as standard };
|
|
34
40
|
}
|
|
35
41
|
|
|
36
42
|
declare const fullEvent: Flow.StepExample;
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,a=(e,r)=>{for(var o in r)t(e,o,{get:r[o],enumerable:!0})},i={};a(i,{examples:()=>p,schemas:()=>n}),module.exports=(e=i,((e,a,i,n)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let d of o(a))s.call(e,d)||d===i||t(e,d,{get:()=>a[d],enumerable:!(n=r(a,d))||n.enumerable});return e})(t({},"__esModule",{value:!0}),e));var n={};a(n,{SettingsSchema:()=>c,settings:()=>m});var d=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),c=u.z.object({url:u.z.string().url().describe("The API endpoint URL to send events to"),headers:u.z.record(u.z.string(),u.z.string()).describe("Custom HTTP headers to include with requests").optional(),method:u.z.string().describe("HTTP method to use (default: POST)").optional(),timeout:u.z.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()}),m=(0,d.zodToSchema)(c),p={};a(p,{env:()=>l,step:()=>g});var l={};a(l,{init:()=>v,simulation:()=>b,standard:()=>y});var v={sendServer:void 0},y={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},b=["sendServer"],g={};a(g,{customHeaders:()=>O,customTransform:()=>_,fullEvent:()=>h});var f=require("@walkeros/core"),h={in:(0,f.getEvent)("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({title:"Docs",url:"https://example.com/docs"})}},O={in:(0,f.getEvent)("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({type:"contact",email:"user@example.com"}),headers:{"X-API-Key":"YOUR_API_KEY"}}},_={in:(0,f.getEvent)("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:{url:"https://api.example.com/events",body:JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"})}};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n url: z.string().url().describe('The API endpoint URL to send events to'),\n headers: z\n .record(z.string(), z.string())\n .describe('Custom HTTP headers to include with requests')\n .optional(),\n method: z.string().describe('HTTP method to use (default: POST)').optional(),\n timeout: z\n .number()\n .positive()\n .describe('Request timeout in milliseconds (default: 5000)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n },\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n },\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;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;;;
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n url: z.string().url().describe('The API endpoint URL to send events to'),\n headers: z\n .record(z.string(), z.string())\n .describe('Custom HTTP headers to include with requests')\n .optional(),\n method: z.string().describe('HTTP method to use (default: POST)').optional(),\n timeout: z\n .number()\n .positive()\n .describe('Request timeout in milliseconds (default: 5000)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n },\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n },\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\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A,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;AAEO,IAAM,kBAAoC;AAAA,EAC/C,QAAI,sBAAS,kBAAkB;AAAA,IAC7B,WAAW;AAAA,IACX,MAAM,EAAE,IAAI,WAAW,OAAO,QAAQ,UAAU,MAAM;AAAA,IACtD,MAAM,EAAE,IAAI,WAAW;AAAA,IACvB,QAAQ,EAAE,MAAM,UAAU,IAAI,IAAI,aAAa,GAAG;AAAA,EACpD,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,aAAa;AAAA,QACb,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,KAAK;AAAA,IACL,MAAM,KAAK,UAAU;AAAA,MACnB,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,aAAa;AAAA,MACb,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AACF;","names":["import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,r)=>{for(var o in r)e(t,o,{get:r[o],enumerable:!0})},r={};t(r,{SettingsSchema:()=>a,settings:()=>i});import{zodToSchema as o}from"@walkeros/core/dev";import{z as s}from"@walkeros/core/dev";var a=s.object({url:s.string().url().describe("The API endpoint URL to send events to"),headers:s.record(s.string(),s.string()).describe("Custom HTTP headers to include with requests").optional(),method:s.string().describe("HTTP method to use (default: POST)").optional(),timeout:s.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()}),i=o(a),d={};t(d,{env:()=>m,step:()=>
|
|
1
|
+
var e=Object.defineProperty,t=(t,r)=>{for(var o in r)e(t,o,{get:r[o],enumerable:!0})},r={};t(r,{SettingsSchema:()=>a,settings:()=>i});import{zodToSchema as o}from"@walkeros/core/dev";import{z as s}from"@walkeros/core/dev";var a=s.object({url:s.string().url().describe("The API endpoint URL to send events to"),headers:s.record(s.string(),s.string()).describe("Custom HTTP headers to include with requests").optional(),method:s.string().describe("HTTP method to use (default: POST)").optional(),timeout:s.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()}),i=o(a),d={};t(d,{env:()=>m,step:()=>u});var m={};t(m,{init:()=>n,simulation:()=>c,standard:()=>p});var n={sendServer:void 0},p={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},c=["sendServer"],u={};t(u,{customHeaders:()=>y,customTransform:()=>b,fullEvent:()=>v});import{getEvent as l}from"@walkeros/core";var v={in:l("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({title:"Docs",url:"https://example.com/docs"})}},y={in:l("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({type:"contact",email:"user@example.com"}),headers:{"X-API-Key":"YOUR_API_KEY"}}},b={in:l("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:{url:"https://api.example.com/events",body:JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"})}};export{d as examples,r as schemas};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n url: z.string().url().describe('The API endpoint URL to send events to'),\n headers: z\n .record(z.string(), z.string())\n .describe('Custom HTTP headers to include with requests')\n .optional(),\n method: z.string().describe('HTTP method to use (default: POST)').optional(),\n timeout: z\n .number()\n .positive()\n .describe('Request timeout in milliseconds (default: 5000)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n },\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n },\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n },\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,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;;;
|
|
1
|
+
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n url: z.string().url().describe('The API endpoint URL to send events to'),\n headers: z\n .record(z.string(), z.string())\n .describe('Custom HTTP headers to include with requests')\n .optional(),\n method: z.string().describe('HTTP method to use (default: POST)').optional(),\n timeout: z\n .number()\n .positive()\n .describe('Request timeout in milliseconds (default: 5000)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n },\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n },\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n },\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,wCAAwC;AAAA,EACvE,SAAS,EACN,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B,SAAS,8CAA8C,EACvD,SAAS;AAAA,EACZ,QAAQ,EAAE,OAAO,EAAE,SAAS,oCAAoC,EAAE,SAAS;AAAA,EAC3E,SAAS,EACN,OAAO,EACP,SAAS,EACT,SAAS,iDAAiD,EAC1D,SAAS;AACd,CAAC;;;ADRM,IAAM,WAAW,YAAY,cAAc;;;AENlD;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAM,OAAO,MAAM,QAAQ,QAAQ,EAAE,IAAI,KAAK,CAAC;AAExC,IAAM,OAAwB;AA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A,EACD,SAAS;AAAA,IACP,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,aAAa;AAAA,QACb,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,KAAK;AAAA,IACL,MAAM,KAAK,UAAU;AAAA,MACnB,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,aAAa;AAAA,MACb,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -7,11 +7,17 @@ interface Env extends DestinationServer.Env {
|
|
|
7
7
|
|
|
8
8
|
declare const init: Env | undefined;
|
|
9
9
|
declare const standard: Env;
|
|
10
|
+
/**
|
|
11
|
+
* Simulation tracking paths
|
|
12
|
+
* Specifies which function calls to track during simulation
|
|
13
|
+
*/
|
|
14
|
+
declare const simulation: string[];
|
|
10
15
|
|
|
11
16
|
declare const env_init: typeof init;
|
|
17
|
+
declare const env_simulation: typeof simulation;
|
|
12
18
|
declare const env_standard: typeof standard;
|
|
13
19
|
declare namespace env {
|
|
14
|
-
export { env_init as init, env_standard as standard };
|
|
20
|
+
export { env_init as init, env_simulation as simulation, env_standard as standard };
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
declare const fullEvent: Flow.StepExample;
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -7,11 +7,17 @@ interface Env extends DestinationServer.Env {
|
|
|
7
7
|
|
|
8
8
|
declare const init: Env | undefined;
|
|
9
9
|
declare const standard: Env;
|
|
10
|
+
/**
|
|
11
|
+
* Simulation tracking paths
|
|
12
|
+
* Specifies which function calls to track during simulation
|
|
13
|
+
*/
|
|
14
|
+
declare const simulation: string[];
|
|
10
15
|
|
|
11
16
|
declare const env_init: typeof init;
|
|
17
|
+
declare const env_simulation: typeof simulation;
|
|
12
18
|
declare const env_standard: typeof standard;
|
|
13
19
|
declare namespace env {
|
|
14
|
-
export { env_init as init, env_standard as standard };
|
|
20
|
+
export { env_init as init, env_simulation as simulation, env_standard as standard };
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
declare const fullEvent: Flow.StepExample;
|
package/dist/examples/index.js
CHANGED
|
@@ -29,6 +29,7 @@ module.exports = __toCommonJS(examples_exports);
|
|
|
29
29
|
var env_exports = {};
|
|
30
30
|
__export(env_exports, {
|
|
31
31
|
init: () => init,
|
|
32
|
+
simulation: () => simulation,
|
|
32
33
|
standard: () => standard
|
|
33
34
|
});
|
|
34
35
|
var noop = () => Promise.resolve({ ok: true });
|
|
@@ -40,6 +41,7 @@ var standard = {
|
|
|
40
41
|
// Add any specific properties if needed for sendServer
|
|
41
42
|
})
|
|
42
43
|
};
|
|
44
|
+
var simulation = ["sendServer"];
|
|
43
45
|
|
|
44
46
|
// src/examples/step.ts
|
|
45
47
|
var step_exports = {};
|
package/dist/examples/index.mjs
CHANGED
|
@@ -8,6 +8,7 @@ var __export = (target, all) => {
|
|
|
8
8
|
var env_exports = {};
|
|
9
9
|
__export(env_exports, {
|
|
10
10
|
init: () => init,
|
|
11
|
+
simulation: () => simulation,
|
|
11
12
|
standard: () => standard
|
|
12
13
|
});
|
|
13
14
|
var noop = () => Promise.resolve({ ok: true });
|
|
@@ -19,6 +20,7 @@ var standard = {
|
|
|
19
20
|
// Add any specific properties if needed for sendServer
|
|
20
21
|
})
|
|
21
22
|
};
|
|
23
|
+
var simulation = ["sendServer"];
|
|
22
24
|
|
|
23
25
|
// src/examples/step.ts
|
|
24
26
|
var step_exports = {};
|
package/dist/index.d.mts
CHANGED
|
@@ -37,11 +37,17 @@ declare namespace index$1 {
|
|
|
37
37
|
|
|
38
38
|
declare const init: Env | undefined;
|
|
39
39
|
declare const standard: Env;
|
|
40
|
+
/**
|
|
41
|
+
* Simulation tracking paths
|
|
42
|
+
* Specifies which function calls to track during simulation
|
|
43
|
+
*/
|
|
44
|
+
declare const simulation: string[];
|
|
40
45
|
|
|
41
46
|
declare const env_init: typeof init;
|
|
47
|
+
declare const env_simulation: typeof simulation;
|
|
42
48
|
declare const env_standard: typeof standard;
|
|
43
49
|
declare namespace env {
|
|
44
|
-
export { env_init as init, env_standard as standard };
|
|
50
|
+
export { env_init as init, env_simulation as simulation, env_standard as standard };
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
declare const fullEvent: Flow.StepExample;
|
package/dist/index.d.ts
CHANGED
|
@@ -37,11 +37,17 @@ declare namespace index$1 {
|
|
|
37
37
|
|
|
38
38
|
declare const init: Env | undefined;
|
|
39
39
|
declare const standard: Env;
|
|
40
|
+
/**
|
|
41
|
+
* Simulation tracking paths
|
|
42
|
+
* Specifies which function calls to track during simulation
|
|
43
|
+
*/
|
|
44
|
+
declare const simulation: string[];
|
|
40
45
|
|
|
41
46
|
declare const env_init: typeof init;
|
|
47
|
+
declare const env_simulation: typeof simulation;
|
|
42
48
|
declare const env_standard: typeof standard;
|
|
43
49
|
declare namespace env {
|
|
44
|
-
export { env_init as init, env_standard as standard };
|
|
50
|
+
export { env_init as init, env_simulation as simulation, env_standard as standard };
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
declare const fullEvent: Flow.StepExample;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var mod,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},index_exports={};__export(index_exports,{DestinationAPI:()=>types_exports,default:()=>index_default,destinationAPI:()=>destinationAPI,examples:()=>examples_exports}),module.exports=(mod=index_exports,((to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to})(__defProp({},"__esModule",{value:!0}),mod));var import_core2=require("@walkeros/core"),import_server_core=require("@walkeros/server-core"),types_exports={},examples_exports={};__export(examples_exports,{env:()=>env_exports,step:()=>step_exports});var env_exports={};__export(env_exports,{init:()=>init,standard:()=>standard});var init={sendServer:void 0},standard={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},step_exports={};__export(step_exports,{customHeaders:()=>customHeaders,customTransform:()=>customTransform,fullEvent:()=>fullEvent});var import_core=require("@walkeros/core"),fullEvent={in:(0,import_core.getEvent)("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({title:"Docs",url:"https://example.com/docs"})}},customHeaders={in:(0,import_core.getEvent)("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({type:"contact",email:"user@example.com"}),headers:{"X-API-Key":"YOUR_API_KEY"}}},customTransform={in:(0,import_core.getEvent)("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:{url:"https://api.example.com/events",body:JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"})}},destinationAPI={type:"api",config:{},env:{sendServer:import_server_core.sendServer},async push(event,{config:config,rule:rule,data:data,env:env,logger:logger}){const{settings:settings}=config,{url:url,headers:headers,method:method,transform:transform,timeout:timeout}=settings||{};if(!url)return;const eventData=(0,import_core2.isDefined)(data)?data:event,body=transform?transform(eventData,config,rule):JSON.stringify(eventData);null==logger||logger.debug("API destination sending request",{url:url,method:method||"POST",eventName:event.name});const sendServerFn=(null==env?void 0:env.sendServer)||import_server_core.sendServer,response=await sendServerFn(url,body,{headers:headers,method:method,timeout:timeout});null==logger||logger.debug("API destination response",{ok:null==response?void 0:response.ok})}},index_default=destinationAPI;//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";var mod,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},index_exports={};__export(index_exports,{DestinationAPI:()=>types_exports,default:()=>index_default,destinationAPI:()=>destinationAPI,examples:()=>examples_exports}),module.exports=(mod=index_exports,((to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to})(__defProp({},"__esModule",{value:!0}),mod));var import_core2=require("@walkeros/core"),import_server_core=require("@walkeros/server-core"),types_exports={},examples_exports={};__export(examples_exports,{env:()=>env_exports,step:()=>step_exports});var env_exports={};__export(env_exports,{init:()=>init,simulation:()=>simulation,standard:()=>standard});var init={sendServer:void 0},standard={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},simulation=["sendServer"],step_exports={};__export(step_exports,{customHeaders:()=>customHeaders,customTransform:()=>customTransform,fullEvent:()=>fullEvent});var import_core=require("@walkeros/core"),fullEvent={in:(0,import_core.getEvent)("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({title:"Docs",url:"https://example.com/docs"})}},customHeaders={in:(0,import_core.getEvent)("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({type:"contact",email:"user@example.com"}),headers:{"X-API-Key":"YOUR_API_KEY"}}},customTransform={in:(0,import_core.getEvent)("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:{url:"https://api.example.com/events",body:JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"})}},destinationAPI={type:"api",config:{},env:{sendServer:import_server_core.sendServer},async push(event,{config:config,rule:rule,data:data,env:env,logger:logger}){const{settings:settings}=config,{url:url,headers:headers,method:method,transform:transform,timeout:timeout}=settings||{};if(!url)return;const eventData=(0,import_core2.isDefined)(data)?data:event,body=transform?transform(eventData,config,rule):JSON.stringify(eventData);null==logger||logger.debug("API destination sending request",{url:url,method:method||"POST",eventName:event.name});const sendServerFn=(null==env?void 0:env.sendServer)||import_server_core.sendServer,response=await sendServerFn(url,body,{headers:headers,method:method,timeout:timeout});null==logger||logger.debug("API destination response",{ok:null==response?void 0:response.ok})}},index_default=destinationAPI;//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import type { Settings, Destination, Env } from './types';\nimport { isDefined } from '@walkeros/core';\nimport { sendServer } from '@walkeros/server-core';\n\n// Types\nexport * as DestinationAPI from './types';\n\n// Examples\nexport * as examples from './examples';\n\nexport const destinationAPI: Destination = {\n type: 'api',\n\n config: {},\n\n env: { sendServer },\n\n async push(event, { config, rule, data, env, logger }) {\n const { settings } = config;\n const { url, headers, method, transform, timeout } = settings || {};\n\n if (!url) return;\n\n const eventData = isDefined(data) ? data : event;\n const body = transform\n ? transform(eventData, config, rule) // Transform event data\n : JSON.stringify(eventData);\n\n logger?.debug('API destination sending request', {\n url,\n method: method || 'POST',\n eventName: event.name,\n });\n\n const sendServerFn = (env as Env)?.sendServer || sendServer;\n const response = await sendServerFn(url, body, {\n headers,\n method,\n timeout,\n });\n\n logger?.debug('API destination response', { ok: response?.ok });\n },\n};\n\nexport default destinationAPI;\n","import type {\n Mapping as WalkerOSMapping,\n SendDataValue,\n SendHeaders,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationServer, sendServer } from '@walkeros/server-core';\n\nexport interface Settings {\n url: string;\n headers?: SendHeaders;\n method?: string;\n transform?: Transform;\n timeout?: number;\n}\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationServer.Env {\n sendServer?: typeof sendServer;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env>;\n\nexport type Destination = DestinationServer.Destination<Types>;\nexport type Config = DestinationServer.Config<Types>;\nexport type PushFn = DestinationServer.PushFn<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type Transform = (\n data?: unknown,\n config?: Config,\n mapping?: WalkerOSMapping.Rule<Mapping>,\n) => SendDataValue;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n },\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n },\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA0B;AAC1B,yBAA2B;;;ACF3B;;;ACAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;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;;;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import type { Settings, Destination, Env } from './types';\nimport { isDefined } from '@walkeros/core';\nimport { sendServer } from '@walkeros/server-core';\n\n// Types\nexport * as DestinationAPI from './types';\n\n// Examples\nexport * as examples from './examples';\n\nexport const destinationAPI: Destination = {\n type: 'api',\n\n config: {},\n\n env: { sendServer },\n\n async push(event, { config, rule, data, env, logger }) {\n const { settings } = config;\n const { url, headers, method, transform, timeout } = settings || {};\n\n if (!url) return;\n\n const eventData = isDefined(data) ? data : event;\n const body = transform\n ? transform(eventData, config, rule) // Transform event data\n : JSON.stringify(eventData);\n\n logger?.debug('API destination sending request', {\n url,\n method: method || 'POST',\n eventName: event.name,\n });\n\n const sendServerFn = (env as Env)?.sendServer || sendServer;\n const response = await sendServerFn(url, body, {\n headers,\n method,\n timeout,\n });\n\n logger?.debug('API destination response', { ok: response?.ok });\n },\n};\n\nexport default destinationAPI;\n","import type {\n Mapping as WalkerOSMapping,\n SendDataValue,\n SendHeaders,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationServer, sendServer } from '@walkeros/server-core';\n\nexport interface Settings {\n url: string;\n headers?: SendHeaders;\n method?: string;\n transform?: Transform;\n timeout?: number;\n}\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationServer.Env {\n sendServer?: typeof sendServer;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env>;\n\nexport type Destination = DestinationServer.Destination<Types>;\nexport type Config = DestinationServer.Config<Types>;\nexport type PushFn = DestinationServer.PushFn<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type Transform = (\n data?: unknown,\n config?: Config,\n mapping?: WalkerOSMapping.Rule<Mapping>,\n) => SendDataValue;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n },\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n },\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA0B;AAC1B,yBAA2B;;;ACF3B;;;ACAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAM,OAAO,MAAM,QAAQ,QAAQ,EAAE,IAAI,KAAK,CAAC;AAExC,IAAM,OAAwB;AAAA,EACnC,YAAY;AACd;AAEO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M;AAAA,MACJ,KAAK;AAAA,QACH,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,aAAa;AAAA,QACb,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,KAAK;AAAA,IACL,MAAM,KAAK,UAAU;AAAA,MACnB,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,aAAa;AAAA,MACb,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AACF;;;AJ1DO,IAAM,iBAA8B;AAAA,EACzC,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,0CAAW;AAAA,EAElB,MAAM,KAAK,OAAO,EAAE,QAAQ,MAAM,MAAM,KAAK,OAAO,GAAG;AACrD,UAAM,EAAE,SAAS,IAAI;AACrB,UAAM,EAAE,KAAK,SAAS,QAAQ,WAAW,QAAQ,IAAI,YAAY,CAAC;AAElE,QAAI,CAAC,IAAK;AAEV,UAAM,gBAAY,wBAAU,IAAI,IAAI,OAAO;AAC3C,UAAM,OAAO,YACT,UAAU,WAAW,QAAQ,IAAI,IACjC,KAAK,UAAU,SAAS;AAE5B,qCAAQ,MAAM,mCAAmC;AAAA,MAC/C;AAAA,MACA,QAAQ,UAAU;AAAA,MAClB,WAAW,MAAM;AAAA,IACnB;AAEA,UAAM,gBAAgB,2BAAa,eAAc;AACjD,UAAM,WAAW,MAAM,aAAa,KAAK,MAAM;AAAA,MAC7C;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,qCAAQ,MAAM,4BAA4B,EAAE,IAAI,qCAAU,GAAG;AAAA,EAC/D;AACF;AAEA,IAAO,gBAAQ;","names":["import_core"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var __defProp=Object.defineProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})};import{isDefined}from"@walkeros/core";import{sendServer}from"@walkeros/server-core";var types_exports={},examples_exports={};__export(examples_exports,{env:()=>env_exports,step:()=>step_exports});var env_exports={};__export(env_exports,{init:()=>init,standard:()=>standard});var init={sendServer:void 0},standard={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},step_exports={};__export(step_exports,{customHeaders:()=>customHeaders,customTransform:()=>customTransform,fullEvent:()=>fullEvent});import{getEvent}from"@walkeros/core";var fullEvent={in:getEvent("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({title:"Docs",url:"https://example.com/docs"})}},customHeaders={in:getEvent("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({type:"contact",email:"user@example.com"}),headers:{"X-API-Key":"YOUR_API_KEY"}}},customTransform={in:getEvent("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:{url:"https://api.example.com/events",body:JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"})}},destinationAPI={type:"api",config:{},env:{sendServer:sendServer},async push(event,{config:config,rule:rule,data:data,env:env,logger:logger}){const{settings:settings}=config,{url:url,headers:headers,method:method,transform:transform,timeout:timeout}=settings||{};if(!url)return;const eventData=isDefined(data)?data:event,body=transform?transform(eventData,config,rule):JSON.stringify(eventData);null==logger||logger.debug("API destination sending request",{url:url,method:method||"POST",eventName:event.name});const sendServerFn=(null==env?void 0:env.sendServer)||sendServer,response=await sendServerFn(url,body,{headers:headers,method:method,timeout:timeout});null==logger||logger.debug("API destination response",{ok:null==response?void 0:response.ok})}},index_default=destinationAPI;export{types_exports as DestinationAPI,index_default as default,destinationAPI,examples_exports as examples};//# sourceMappingURL=index.mjs.map
|
|
1
|
+
var __defProp=Object.defineProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})};import{isDefined}from"@walkeros/core";import{sendServer}from"@walkeros/server-core";var types_exports={},examples_exports={};__export(examples_exports,{env:()=>env_exports,step:()=>step_exports});var env_exports={};__export(env_exports,{init:()=>init,simulation:()=>simulation,standard:()=>standard});var init={sendServer:void 0},standard={sendServer:Object.assign(()=>Promise.resolve({ok:!0}),{})},simulation=["sendServer"],step_exports={};__export(step_exports,{customHeaders:()=>customHeaders,customTransform:()=>customTransform,fullEvent:()=>fullEvent});import{getEvent}from"@walkeros/core";var fullEvent={in:getEvent("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({title:"Docs",url:"https://example.com/docs"})}},customHeaders={in:getEvent("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:"data"},out:{url:"https://api.example.com/events",body:JSON.stringify({type:"contact",email:"user@example.com"}),headers:{"X-API-Key":"YOUR_API_KEY"}}},customTransform={in:getEvent("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"server",id:"",previous_id:""}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:{url:"https://api.example.com/events",body:JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"})}},destinationAPI={type:"api",config:{},env:{sendServer:sendServer},async push(event,{config:config,rule:rule,data:data,env:env,logger:logger}){const{settings:settings}=config,{url:url,headers:headers,method:method,transform:transform,timeout:timeout}=settings||{};if(!url)return;const eventData=isDefined(data)?data:event,body=transform?transform(eventData,config,rule):JSON.stringify(eventData);null==logger||logger.debug("API destination sending request",{url:url,method:method||"POST",eventName:event.name});const sendServerFn=(null==env?void 0:env.sendServer)||sendServer,response=await sendServerFn(url,body,{headers:headers,method:method,timeout:timeout});null==logger||logger.debug("API destination response",{ok:null==response?void 0:response.ok})}},index_default=destinationAPI;export{types_exports as DestinationAPI,index_default as default,destinationAPI,examples_exports as examples};//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import type { Settings, Destination, Env } from './types';\nimport { isDefined } from '@walkeros/core';\nimport { sendServer } from '@walkeros/server-core';\n\n// Types\nexport * as DestinationAPI from './types';\n\n// Examples\nexport * as examples from './examples';\n\nexport const destinationAPI: Destination = {\n type: 'api',\n\n config: {},\n\n env: { sendServer },\n\n async push(event, { config, rule, data, env, logger }) {\n const { settings } = config;\n const { url, headers, method, transform, timeout } = settings || {};\n\n if (!url) return;\n\n const eventData = isDefined(data) ? data : event;\n const body = transform\n ? transform(eventData, config, rule) // Transform event data\n : JSON.stringify(eventData);\n\n logger?.debug('API destination sending request', {\n url,\n method: method || 'POST',\n eventName: event.name,\n });\n\n const sendServerFn = (env as Env)?.sendServer || sendServer;\n const response = await sendServerFn(url, body, {\n headers,\n method,\n timeout,\n });\n\n logger?.debug('API destination response', { ok: response?.ok });\n },\n};\n\nexport default destinationAPI;\n","import type {\n Mapping as WalkerOSMapping,\n SendDataValue,\n SendHeaders,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationServer, sendServer } from '@walkeros/server-core';\n\nexport interface Settings {\n url: string;\n headers?: SendHeaders;\n method?: string;\n transform?: Transform;\n timeout?: number;\n}\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationServer.Env {\n sendServer?: typeof sendServer;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env>;\n\nexport type Destination = DestinationServer.Destination<Types>;\nexport type Config = DestinationServer.Config<Types>;\nexport type PushFn = DestinationServer.PushFn<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type Transform = (\n data?: unknown,\n config?: Config,\n mapping?: WalkerOSMapping.Rule<Mapping>,\n) => SendDataValue;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n },\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n },\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n },\n};\n"],"mappings":";;;;;;;AACA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;;;ACF3B;;;ACAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;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;;;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import type { Settings, Destination, Env } from './types';\nimport { isDefined } from '@walkeros/core';\nimport { sendServer } from '@walkeros/server-core';\n\n// Types\nexport * as DestinationAPI from './types';\n\n// Examples\nexport * as examples from './examples';\n\nexport const destinationAPI: Destination = {\n type: 'api',\n\n config: {},\n\n env: { sendServer },\n\n async push(event, { config, rule, data, env, logger }) {\n const { settings } = config;\n const { url, headers, method, transform, timeout } = settings || {};\n\n if (!url) return;\n\n const eventData = isDefined(data) ? data : event;\n const body = transform\n ? transform(eventData, config, rule) // Transform event data\n : JSON.stringify(eventData);\n\n logger?.debug('API destination sending request', {\n url,\n method: method || 'POST',\n eventName: event.name,\n });\n\n const sendServerFn = (env as Env)?.sendServer || sendServer;\n const response = await sendServerFn(url, body, {\n headers,\n method,\n timeout,\n });\n\n logger?.debug('API destination response', { ok: response?.ok });\n },\n};\n\nexport default destinationAPI;\n","import type {\n Mapping as WalkerOSMapping,\n SendDataValue,\n SendHeaders,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationServer, sendServer } from '@walkeros/server-core';\n\nexport interface Settings {\n url: string;\n headers?: SendHeaders;\n method?: string;\n transform?: Transform;\n timeout?: number;\n}\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationServer.Env {\n sendServer?: typeof sendServer;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env>;\n\nexport type Destination = DestinationServer.Destination<Types>;\nexport type Config = DestinationServer.Config<Types>;\nexport type PushFn = DestinationServer.PushFn<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type Transform = (\n data?: unknown,\n config?: Config,\n mapping?: WalkerOSMapping.Rule<Mapping>,\n) => SendDataValue;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst noop = () => Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const standard: Env = {\n sendServer: Object.assign(noop, {\n // Add any specific properties if needed for sendServer\n }) as unknown as Env['sendServer'],\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nexport const fullEvent: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n },\n};\n\nexport const customHeaders: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: 'data',\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n },\n};\n\nexport const customTransform: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'server', id: '', previous_id: '' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: {\n url: 'https://api.example.com/events',\n body: JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n },\n};\n"],"mappings":";;;;;;;AACA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;;;ACF3B;;;ACAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAM,OAAO,MAAM,QAAQ,QAAQ,EAAE,IAAI,KAAK,CAAC;AAExC,IAAM,OAAwB;AAAA,EACnC,YAAY;AACd;AAEO,IAAM,WAAgB;AAAA,EAC3B,YAAY,OAAO,OAAO,MAAM;AAAA;AAAA,EAEhC,CAAC;AACH;AAMO,IAAM,aAAa,CAAC,YAAY;;;ACzBvC;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,SAAS,gBAAgB;AAElB,IAAM,YAA8B;AAAA,EACzC,IAAI,SAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,MAAM,EAAE,OAAO,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,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AS,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":[]}
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/server-destination-api",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": "server",
|
|
7
7
|
"docs": "https://www.walkeros.io/docs/destinations/api/server",
|
|
@@ -46,6 +46,9 @@
|
|
|
46
46
|
"examples": {
|
|
47
47
|
"env": {
|
|
48
48
|
"init": {},
|
|
49
|
+
"simulation": [
|
|
50
|
+
"sendServer"
|
|
51
|
+
],
|
|
49
52
|
"standard": {
|
|
50
53
|
"sendServer": {
|
|
51
54
|
"$code": "()=>Promise.resolve({ok:!0})"
|
|
@@ -104,7 +107,7 @@
|
|
|
104
107
|
"group": "gr0up",
|
|
105
108
|
"count": 1,
|
|
106
109
|
"version": {
|
|
107
|
-
"source": "
|
|
110
|
+
"source": "3.0.0",
|
|
108
111
|
"tagging": 1
|
|
109
112
|
},
|
|
110
113
|
"source": {
|
|
@@ -207,7 +210,7 @@
|
|
|
207
210
|
"group": "gr0up",
|
|
208
211
|
"count": 1,
|
|
209
212
|
"version": {
|
|
210
|
-
"source": "
|
|
213
|
+
"source": "3.0.0",
|
|
211
214
|
"tagging": 1
|
|
212
215
|
},
|
|
213
216
|
"source": {
|
|
@@ -283,7 +286,7 @@
|
|
|
283
286
|
"group": "gr0up",
|
|
284
287
|
"count": 1,
|
|
285
288
|
"version": {
|
|
286
|
-
"source": "
|
|
289
|
+
"source": "3.0.0",
|
|
287
290
|
"tagging": 1
|
|
288
291
|
},
|
|
289
292
|
"source": {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/server-destination-api",
|
|
3
3
|
"description": "API server destination for walkerOS",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.1",
|
|
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": "3.0.
|
|
40
|
-
"@walkeros/server-core": "3.0.
|
|
39
|
+
"@walkeros/core": "^3.0.1",
|
|
40
|
+
"@walkeros/server-core": "^3.0.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {},
|
|
43
43
|
"repository": {
|