@walkeros/server-destination-api 4.7.0-next-1790245733116 → 4.7.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/CHANGELOG.md +25 -14
- package/dist/dev.d.mts +3 -3
- package/dist/dev.d.ts +3 -3
- 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 +3 -3
- package/dist/examples/index.d.ts +3 -3
- package/dist/examples/index.js +5 -7
- package/dist/examples/index.mjs +5 -7
- package/dist/walkerOS.json +10 -9
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,24 +1,35 @@
|
|
|
1
1
|
# @walkeros/server-destination-api
|
|
2
2
|
|
|
3
|
-
## 4.7.0
|
|
3
|
+
## 4.7.0
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 74821ed: Simulate records every vendor call through one recorder, `observeEnv`
|
|
8
|
+
from `@walkeros/core`, and runs offline: BigQuery, Data Manager and the
|
|
9
|
+
Sheets, GCS and S3 stores reach the network through `env`. Client and `Env`
|
|
10
|
+
types of BigQuery, Firehose, PostHog, SQS and Pub/Sub are structural.
|
|
11
|
+
`@walkeros/cli` exports `resolveExportName` and `selectDevExamples` and drops
|
|
12
|
+
`findExample` and `compareOutput`.
|
|
13
|
+
- Updated dependencies [74821ed]
|
|
8
14
|
- Updated dependencies [06b498a]
|
|
9
|
-
- Updated dependencies [
|
|
10
|
-
- Updated dependencies [
|
|
15
|
+
- Updated dependencies [74821ed]
|
|
16
|
+
- Updated dependencies [64b06de]
|
|
17
|
+
- Updated dependencies [4b4937f]
|
|
18
|
+
- Updated dependencies [74821ed]
|
|
19
|
+
- Updated dependencies [74821ed]
|
|
20
|
+
- Updated dependencies [74821ed]
|
|
11
21
|
- Updated dependencies [06b498a]
|
|
12
|
-
- Updated dependencies [
|
|
13
|
-
- Updated dependencies [
|
|
14
|
-
- Updated dependencies [
|
|
15
|
-
- Updated dependencies [
|
|
16
|
-
- Updated dependencies [
|
|
17
|
-
- Updated dependencies [
|
|
18
|
-
- Updated dependencies [
|
|
19
|
-
- Updated dependencies [
|
|
20
|
-
|
|
21
|
-
- @walkeros/
|
|
22
|
+
- Updated dependencies [74821ed]
|
|
23
|
+
- Updated dependencies [74821ed]
|
|
24
|
+
- Updated dependencies [74821ed]
|
|
25
|
+
- Updated dependencies [74821ed]
|
|
26
|
+
- Updated dependencies [74821ed]
|
|
27
|
+
- Updated dependencies [e860006]
|
|
28
|
+
- Updated dependencies [74821ed]
|
|
29
|
+
- Updated dependencies [74821ed]
|
|
30
|
+
- Updated dependencies [4f89234]
|
|
31
|
+
- @walkeros/core@4.7.0
|
|
32
|
+
- @walkeros/server-core@4.7.0
|
|
22
33
|
|
|
23
34
|
## 4.6.1
|
|
24
35
|
|
package/dist/dev.d.mts
CHANGED
|
@@ -33,7 +33,7 @@ interface Env extends DestinationServer.Env {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
declare const init: Env | undefined;
|
|
36
|
-
declare const
|
|
36
|
+
declare const push: Env;
|
|
37
37
|
/**
|
|
38
38
|
* Simulation tracking paths
|
|
39
39
|
* Specifies which function calls to track during simulation
|
|
@@ -41,10 +41,10 @@ declare const standard: Env;
|
|
|
41
41
|
declare const simulation: string[];
|
|
42
42
|
|
|
43
43
|
declare const env_init: typeof init;
|
|
44
|
+
declare const env_push: typeof push;
|
|
44
45
|
declare const env_simulation: typeof simulation;
|
|
45
|
-
declare const env_standard: typeof standard;
|
|
46
46
|
declare namespace env {
|
|
47
|
-
export { env_init as init,
|
|
47
|
+
export { env_init as init, env_push as push, env_simulation as simulation };
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
declare const fullEvent: Flow.StepExample;
|
package/dist/dev.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ interface Env extends DestinationServer.Env {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
declare const init: Env | undefined;
|
|
36
|
-
declare const
|
|
36
|
+
declare const push: Env;
|
|
37
37
|
/**
|
|
38
38
|
* Simulation tracking paths
|
|
39
39
|
* Specifies which function calls to track during simulation
|
|
@@ -41,10 +41,10 @@ declare const standard: Env;
|
|
|
41
41
|
declare const simulation: string[];
|
|
42
42
|
|
|
43
43
|
declare const env_init: typeof init;
|
|
44
|
+
declare const env_push: typeof push;
|
|
44
45
|
declare const env_simulation: typeof simulation;
|
|
45
|
-
declare const env_standard: typeof standard;
|
|
46
46
|
declare namespace env {
|
|
47
|
-
export { env_init as init,
|
|
47
|
+
export { env_init as init, env_push as push, env_simulation as simulation };
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
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,a=Object.prototype.hasOwnProperty,i=(e,r)=>{for(var o in r)t(e,o,{get:r[o],enumerable:!0})},s={};i(s,{examples:()=>v,schemas:()=>d}),module.exports=(e=s,((e,i,s,d)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of o(i))a.call(e,n)||n===s||t(e,n,{get:()=>i[n],enumerable:!(d=r(i,n))||d.enumerable});return e})(t({},"__esModule",{value:!0}),e));var d={};i(d,{MappingSchema:()=>
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(e,r)=>{for(var o in r)t(e,o,{get:r[o],enumerable:!0})},s={};i(s,{examples:()=>v,schemas:()=>d}),module.exports=(e=s,((e,i,s,d)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of o(i))a.call(e,n)||n===s||t(e,n,{get:()=>i[n],enumerable:!(d=r(i,n))||d.enumerable});return e})(t({},"__esModule",{value:!0}),e));var d={};i(d,{MappingSchema:()=>c,SettingsSchema:()=>p,mapping:()=>l,settings:()=>u});var n=require("@walkeros/core/dev"),m=require("@walkeros/core/dev"),p=m.z.object({url:m.z.string().url().describe("The API endpoint URL to send events to"),headers:m.z.record(m.z.string(),m.z.string()).describe("Custom HTTP headers to include with requests").optional(),method:m.z.string().describe("HTTP method to use (default: POST)").optional(),transform:m.z.any().describe("Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))").optional(),timeout:m.z.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()}),c=require("@walkeros/core/dev").z.object({}),u=(0,n.zodToSchema)(p),l=(0,n.zodToSchema)(c),v={};i(v,{env:()=>h,step:()=>b});var h={};i(h,{init:()=>y,push:()=>f,simulation:()=>g});var y={sendServer:void 0},f={sendServer:()=>Promise.resolve({ok:!0})},g=["sendServer"],b={};i(b,{customHeaders:()=>w,customTransform:()=>z,fullEvent:()=>P});var S=require("@walkeros/core"),O="https://api.example.com/events",P={title:"Forward event data",description:"A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.",in:(0,S.getEvent)("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"express",platform:"server"}}),mapping:{data:"data"},out:[["sendServer",O,JSON.stringify({title:"Docs",url:"https://example.com/docs"}),{headers:void 0,method:void 0,timeout:void 0}]]},w={title:"Custom headers",description:"A form submission is sent to the API with custom request headers such as an API key for authentication.",in:(0,S.getEvent)("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"express",platform:"server"}}),mapping:{data:"data"},out:[["sendServer",O,JSON.stringify({type:"contact",email:"user@example.com"}),{headers:{"X-API-Key":"YOUR_API_KEY"},method:void 0,timeout:void 0}]]},z={title:"Custom payload",description:"An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.",in:(0,S.getEvent)("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"express",platform:"server"}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:[["sendServer",O,JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"}),{headers:void 0,method:void 0,timeout:void 0}]]};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n url: z.string().url().describe('The API endpoint URL to send events to'),\n headers: z\n .record(z.string(), z.string())\n .describe('Custom HTTP headers to include with requests')\n .optional(),\n method: z.string().describe('HTTP method to use (default: POST)').optional(),\n transform: z\n .any()\n .describe(\n 'Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))',\n )\n .optional(),\n timeout: z\n .number()\n .positive()\n .describe('Request timeout in milliseconds (default: 5000)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n url: z.string().url().describe('The API endpoint URL to send events to'),\n headers: z\n .record(z.string(), z.string())\n .describe('Custom HTTP headers to include with requests')\n .optional(),\n method: z.string().describe('HTTP method to use (default: POST)').optional(),\n transform: z\n .any()\n .describe(\n 'Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))',\n )\n .optional(),\n timeout: z\n .number()\n .positive()\n .describe('Request timeout in milliseconds (default: 5000)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst sendServer: NonNullable<Env['sendServer']> = () =>\n Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const push: Env = {\n sendServer,\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * API server destination step examples.\n *\n * At push time, the destination calls `env.sendServer(url, body, options)`\n * where `url` is the configured endpoint, `body` is the JSON-stringified\n * event data (or mapped data), and `options` carries headers/method/timeout.\n *\n * Each `out` tuple is `['sendServer', url, body, options]` mirroring the real\n * call signature. The test fixture injects the configured settings per example.\n */\nconst URL = 'https://api.example.com/events';\n\nexport const fullEvent: Flow.StepExample = {\n title: 'Forward event data',\n description:\n 'A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.',\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'express', platform: 'server' },\n }),\n mapping: {\n data: 'data',\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n { headers: undefined, method: undefined, timeout: undefined },\n ],\n ],\n};\n\nexport const customHeaders: Flow.StepExample = {\n title: 'Custom headers',\n description:\n 'A form submission is sent to the API with custom request headers such as an API key for authentication.',\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'express', platform: 'server' },\n }),\n mapping: {\n data: 'data',\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n {\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n method: undefined,\n timeout: undefined,\n },\n ],\n ],\n};\n\nexport const customTransform: Flow.StepExample = {\n title: 'Custom payload',\n description:\n 'An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.',\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'express', platform: 'server' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n { headers: undefined, method: undefined, timeout: undefined },\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAA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QACV,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,aAAa;AAAA,QACb,YAAY;AAAA,MACd,CAAC;AAAA,MACD,EAAE,SAAS,QAAW,QAAQ,QAAW,SAAS,OAAU;AAAA,IAC9D;AAAA,EACF;AACF;","names":["import_dev","import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,r)=>{for(var o in r)e(t,o,{get:r[o],enumerable:!0})},r={};t(r,{MappingSchema:()=>d,SettingsSchema:()=>i,mapping:()=>m,settings:()=>n});import{zodToSchema as o}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";var i=a.object({url:a.string().url().describe("The API endpoint URL to send events to"),headers:a.record(a.string(),a.string()).describe("Custom HTTP headers to include with requests").optional(),method:a.string().describe("HTTP method to use (default: POST)").optional(),transform:a.any().describe("Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))").optional(),timeout:a.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()});import{z as s}from"@walkeros/core/dev";var d=s.object({}),n=o(i),m=o(d),p={};t(p,{env:()=>c,step:()=>h});var c={};t(c,{init:()=>u,
|
|
1
|
+
var e=Object.defineProperty,t=(t,r)=>{for(var o in r)e(t,o,{get:r[o],enumerable:!0})},r={};t(r,{MappingSchema:()=>d,SettingsSchema:()=>i,mapping:()=>m,settings:()=>n});import{zodToSchema as o}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";var i=a.object({url:a.string().url().describe("The API endpoint URL to send events to"),headers:a.record(a.string(),a.string()).describe("Custom HTTP headers to include with requests").optional(),method:a.string().describe("HTTP method to use (default: POST)").optional(),transform:a.any().describe("Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))").optional(),timeout:a.number().positive().describe("Request timeout in milliseconds (default: 5000)").optional()});import{z as s}from"@walkeros/core/dev";var d=s.object({}),n=o(i),m=o(d),p={};t(p,{env:()=>c,step:()=>h});var c={};t(c,{init:()=>u,push:()=>l,simulation:()=>v});var u={sendServer:void 0},l={sendServer:()=>Promise.resolve({ok:!0})},v=["sendServer"],h={};t(h,{customHeaders:()=>S,customTransform:()=>b,fullEvent:()=>g});import{getEvent as f}from"@walkeros/core";var y="https://api.example.com/events",g={title:"Forward event data",description:"A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.",in:f("page view",{timestamp:1700000800,data:{title:"Docs",url:"https://example.com/docs"},source:{type:"express",platform:"server"}}),mapping:{data:"data"},out:[["sendServer",y,JSON.stringify({title:"Docs",url:"https://example.com/docs"}),{headers:void 0,method:void 0,timeout:void 0}]]},S={title:"Custom headers",description:"A form submission is sent to the API with custom request headers such as an API key for authentication.",in:f("form submit",{timestamp:1700000801,data:{type:"contact",email:"user@example.com"},source:{type:"express",platform:"server"}}),mapping:{data:"data"},out:[["sendServer",y,JSON.stringify({type:"contact",email:"user@example.com"}),{headers:{"X-API-Key":"YOUR_API_KEY"},method:void 0,timeout:void 0}]]},b={title:"Custom payload",description:"An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.",in:f("order complete",{timestamp:1700000802,data:{id:"ORD-500",total:199.99,currency:"USD"},user:{id:"buyer-42"},source:{type:"express",platform:"server"}}),mapping:{data:{map:{order_id:"data.id",amount:"data.total",currency:"data.currency",customer_id:"user.id",event_type:"name"}}},out:[["sendServer",y,JSON.stringify({order_id:"ORD-500",amount:199.99,currency:"USD",customer_id:"buyer-42",event_type:"order complete"}),{headers:void 0,method:void 0,timeout:void 0}]]};export{p as examples,r as schemas};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n url: z.string().url().describe('The API endpoint URL to send events to'),\n headers: z\n .record(z.string(), z.string())\n .describe('Custom HTTP headers to include with requests')\n .optional(),\n method: z.string().describe('HTTP method to use (default: POST)').optional(),\n transform: z\n .any()\n .describe(\n 'Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))',\n )\n .optional(),\n timeout: z\n .number()\n .positive()\n .describe('Request timeout in milliseconds (default: 5000)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst
|
|
1
|
+
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n url: z.string().url().describe('The API endpoint URL to send events to'),\n headers: z\n .record(z.string(), z.string())\n .describe('Custom HTTP headers to include with requests')\n .optional(),\n method: z.string().describe('HTTP method to use (default: POST)').optional(),\n transform: z\n .any()\n .describe(\n 'Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))',\n )\n .optional(),\n timeout: z\n .number()\n .positive()\n .describe('Request timeout in milliseconds (default: 5000)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nconst sendServer: NonNullable<Env['sendServer']> = () =>\n Promise.resolve({ ok: true });\n\nexport const init: Env | undefined = {\n sendServer: undefined,\n};\n\nexport const push: Env = {\n sendServer,\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * API server destination step examples.\n *\n * At push time, the destination calls `env.sendServer(url, body, options)`\n * where `url` is the configured endpoint, `body` is the JSON-stringified\n * event data (or mapped data), and `options` carries headers/method/timeout.\n *\n * Each `out` tuple is `['sendServer', url, body, options]` mirroring the real\n * call signature. The test fixture injects the configured settings per example.\n */\nconst URL = 'https://api.example.com/events';\n\nexport const fullEvent: Flow.StepExample = {\n title: 'Forward event data',\n description:\n 'A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.',\n in: getEvent('page view', {\n timestamp: 1700000800,\n data: { title: 'Docs', url: 'https://example.com/docs' },\n source: { type: 'express', platform: 'server' },\n }),\n mapping: {\n data: 'data',\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n title: 'Docs',\n url: 'https://example.com/docs',\n }),\n { headers: undefined, method: undefined, timeout: undefined },\n ],\n ],\n};\n\nexport const customHeaders: Flow.StepExample = {\n title: 'Custom headers',\n description:\n 'A form submission is sent to the API with custom request headers such as an API key for authentication.',\n in: getEvent('form submit', {\n timestamp: 1700000801,\n data: { type: 'contact', email: 'user@example.com' },\n source: { type: 'express', platform: 'server' },\n }),\n mapping: {\n data: 'data',\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n type: 'contact',\n email: 'user@example.com',\n }),\n {\n headers: { 'X-API-Key': 'YOUR_API_KEY' },\n method: undefined,\n timeout: undefined,\n },\n ],\n ],\n};\n\nexport const customTransform: Flow.StepExample = {\n title: 'Custom payload',\n description:\n 'An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.',\n in: getEvent('order complete', {\n timestamp: 1700000802,\n data: { id: 'ORD-500', total: 199.99, currency: 'USD' },\n user: { id: 'buyer-42' },\n source: { type: 'express', platform: 'server' },\n }),\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n amount: 'data.total',\n currency: 'data.currency',\n customer_id: 'user.id',\n event_type: 'name',\n },\n },\n },\n out: [\n [\n 'sendServer',\n URL,\n JSON.stringify({\n order_id: 'ORD-500',\n amount: 199.99,\n currency: 'USD',\n customer_id: 'buyer-42',\n event_type: 'order complete',\n }),\n { headers: undefined, method: undefined, timeout: undefined },\n ],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,wCAAwC;AAAA,EACvE,SAAS,EACN,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B,SAAS,8CAA8C,EACvD,SAAS;AAAA,EACZ,QAAQ,EAAE,OAAO,EAAE,SAAS,oCAAoC,EAAE,SAAS;AAAA,EAC3E,WAAW,EACR,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,EACN,OAAO,EACP,SAAS,EACT,SAAS,iDAAiD,EAC1D,SAAS;AACd,CAAC;;;ACpBD,SAAS,KAAAA,UAAS;AAEX,IAAM,gBAAgBA,GAAE,OAAO,CAAC,CAAC;;;AFMjC,IAAM,WAAW,YAA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,QACE,SAAS,EAAE,aAAa,eAAe;AAAA,QACvC,QAAQ;AAAA,QACR,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,kBAAoC;AAAA,EAC/C,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI,SAAS,kBAAkB;AAAA,IAC7B,WAAW;AAAA,IACX,MAAM,EAAE,IAAI,WAAW,OAAO,QAAQ,UAAU,MAAM;AAAA,IACtD,MAAM,EAAE,IAAI,WAAW;AAAA,IACvB,QAAQ,EAAE,MAAM,WAAW,UAAU,SAAS;AAAA,EAChD,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,aAAa;AAAA,QACb,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,KAAK,UAAU;AAAA,QACb,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,aAAa;AAAA,QACb,YAAY;AAAA,MACd,CAAC;AAAA,MACD,EAAE,SAAS,QAAW,QAAQ,QAAW,SAAS,OAAU;AAAA,IAC9D;AAAA,EACF;AACF;","names":["z"]}
|
|
@@ -6,7 +6,7 @@ interface Env extends DestinationServer.Env {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
declare const init: Env | undefined;
|
|
9
|
-
declare const
|
|
9
|
+
declare const push: Env;
|
|
10
10
|
/**
|
|
11
11
|
* Simulation tracking paths
|
|
12
12
|
* Specifies which function calls to track during simulation
|
|
@@ -14,10 +14,10 @@ declare const standard: Env;
|
|
|
14
14
|
declare const simulation: string[];
|
|
15
15
|
|
|
16
16
|
declare const env_init: typeof init;
|
|
17
|
+
declare const env_push: typeof push;
|
|
17
18
|
declare const env_simulation: typeof simulation;
|
|
18
|
-
declare const env_standard: typeof standard;
|
|
19
19
|
declare namespace env {
|
|
20
|
-
export { env_init as init,
|
|
20
|
+
export { env_init as init, env_push as push, env_simulation as simulation };
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
declare const fullEvent: Flow.StepExample;
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ interface Env extends DestinationServer.Env {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
declare const init: Env | undefined;
|
|
9
|
-
declare const
|
|
9
|
+
declare const push: Env;
|
|
10
10
|
/**
|
|
11
11
|
* Simulation tracking paths
|
|
12
12
|
* Specifies which function calls to track during simulation
|
|
@@ -14,10 +14,10 @@ declare const standard: Env;
|
|
|
14
14
|
declare const simulation: string[];
|
|
15
15
|
|
|
16
16
|
declare const env_init: typeof init;
|
|
17
|
+
declare const env_push: typeof push;
|
|
17
18
|
declare const env_simulation: typeof simulation;
|
|
18
|
-
declare const env_standard: typeof standard;
|
|
19
19
|
declare namespace env {
|
|
20
|
-
export { env_init as init,
|
|
20
|
+
export { env_init as init, env_push as push, env_simulation as simulation };
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
declare const fullEvent: Flow.StepExample;
|
package/dist/examples/index.js
CHANGED
|
@@ -29,17 +29,15 @@ module.exports = __toCommonJS(examples_exports);
|
|
|
29
29
|
var env_exports = {};
|
|
30
30
|
__export(env_exports, {
|
|
31
31
|
init: () => init,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
push: () => push,
|
|
33
|
+
simulation: () => simulation
|
|
34
34
|
});
|
|
35
|
-
var
|
|
35
|
+
var sendServer = () => Promise.resolve({ ok: true });
|
|
36
36
|
var init = {
|
|
37
37
|
sendServer: void 0
|
|
38
38
|
};
|
|
39
|
-
var
|
|
40
|
-
sendServer
|
|
41
|
-
// Add any specific properties if needed for sendServer
|
|
42
|
-
})
|
|
39
|
+
var push = {
|
|
40
|
+
sendServer
|
|
43
41
|
};
|
|
44
42
|
var simulation = ["sendServer"];
|
|
45
43
|
|
package/dist/examples/index.mjs
CHANGED
|
@@ -8,17 +8,15 @@ var __export = (target, all) => {
|
|
|
8
8
|
var env_exports = {};
|
|
9
9
|
__export(env_exports, {
|
|
10
10
|
init: () => init,
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
push: () => push,
|
|
12
|
+
simulation: () => simulation
|
|
13
13
|
});
|
|
14
|
-
var
|
|
14
|
+
var sendServer = () => Promise.resolve({ ok: true });
|
|
15
15
|
var init = {
|
|
16
16
|
sendServer: void 0
|
|
17
17
|
};
|
|
18
|
-
var
|
|
19
|
-
sendServer
|
|
20
|
-
// Add any specific properties if needed for sendServer
|
|
21
|
-
})
|
|
18
|
+
var push = {
|
|
19
|
+
sendServer
|
|
22
20
|
};
|
|
23
21
|
var simulation = ["sendServer"];
|
|
24
22
|
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/server-destination-api",
|
|
4
|
-
"version": "4.7.0
|
|
4
|
+
"version": "4.7.0",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"server"
|
|
8
8
|
],
|
|
9
|
+
"exports": {},
|
|
9
10
|
"docs": "https://www.walkeros.io/docs/destinations/api/server",
|
|
10
11
|
"source": "https://github.com/elbwalker/walkerOS/tree/main/packages/server/destinations/api/src"
|
|
11
12
|
},
|
|
@@ -57,14 +58,14 @@
|
|
|
57
58
|
"examples": {
|
|
58
59
|
"env": {
|
|
59
60
|
"init": {},
|
|
60
|
-
"
|
|
61
|
-
"sendServer"
|
|
62
|
-
],
|
|
63
|
-
"standard": {
|
|
61
|
+
"push": {
|
|
64
62
|
"sendServer": {
|
|
65
63
|
"$code": "()=>Promise.resolve({ok:!0})"
|
|
66
64
|
}
|
|
67
|
-
}
|
|
65
|
+
},
|
|
66
|
+
"simulation": [
|
|
67
|
+
"sendServer"
|
|
68
|
+
]
|
|
68
69
|
},
|
|
69
70
|
"step": {
|
|
70
71
|
"customHeaders": {
|
|
@@ -104,7 +105,7 @@
|
|
|
104
105
|
"consent": {
|
|
105
106
|
"functional": true
|
|
106
107
|
},
|
|
107
|
-
"id": "
|
|
108
|
+
"id": "b34c6889ae3613a1",
|
|
108
109
|
"trigger": "test",
|
|
109
110
|
"entity": "form",
|
|
110
111
|
"action": "submit",
|
|
@@ -209,7 +210,7 @@
|
|
|
209
210
|
"consent": {
|
|
210
211
|
"functional": true
|
|
211
212
|
},
|
|
212
|
-
"id": "
|
|
213
|
+
"id": "e97fd63ecde0adf3",
|
|
213
214
|
"trigger": "load",
|
|
214
215
|
"entity": "order",
|
|
215
216
|
"action": "complete",
|
|
@@ -279,7 +280,7 @@
|
|
|
279
280
|
"consent": {
|
|
280
281
|
"functional": true
|
|
281
282
|
},
|
|
282
|
-
"id": "
|
|
283
|
+
"id": "8d5ba0c708d64722",
|
|
283
284
|
"trigger": "load",
|
|
284
285
|
"entity": "page",
|
|
285
286
|
"action": "view",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/server-destination-api",
|
|
3
3
|
"description": "API server destination for walkerOS",
|
|
4
|
-
"version": "4.7.0
|
|
4
|
+
"version": "4.7.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"update": "npx npm-check-updates -u && npm update"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@walkeros/core": "4.7.0
|
|
42
|
-
"@walkeros/server-core": "4.7.0
|
|
41
|
+
"@walkeros/core": "4.7.0",
|
|
42
|
+
"@walkeros/server-core": "4.7.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {},
|
|
45
45
|
"repository": {
|