@walkeros/web-destination-api 3.4.2 → 4.0.0-next-1777463920154
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.js +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.js +21 -16
- package/dist/examples/index.mjs +21 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +10 -45
- package/package.json +3 -3
package/dist/examples/index.js
CHANGED
|
@@ -59,32 +59,37 @@ __export(step_exports, {
|
|
|
59
59
|
|
|
60
60
|
// ../../../core/dist/index.mjs
|
|
61
61
|
var e = Object.defineProperty;
|
|
62
|
-
var
|
|
62
|
+
var a = {};
|
|
63
63
|
((t, n) => {
|
|
64
64
|
for (var o in n) e(t, o, { get: n[o], enumerable: true });
|
|
65
|
-
})(
|
|
66
|
-
var
|
|
67
|
-
var
|
|
68
|
-
function
|
|
69
|
-
n = { ...
|
|
65
|
+
})(a, { Level: () => c });
|
|
66
|
+
var c = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.WARN = 1] = "WARN", e2[e2.INFO = 2] = "INFO", e2[e2.DEBUG = 3] = "DEBUG", e2))(c || {});
|
|
67
|
+
var X = { merge: true, shallow: true, extend: true };
|
|
68
|
+
function G(e2, t = {}, n = {}) {
|
|
69
|
+
n = { ...X, ...n };
|
|
70
70
|
const o = Object.entries(t).reduce((t2, [o2, r]) => {
|
|
71
71
|
const i = e2[o2];
|
|
72
72
|
return n.merge && Array.isArray(i) && Array.isArray(r) ? t2[o2] = r.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...i]) : (n.extend || o2 in e2) && (t2[o2] = r), t2;
|
|
73
73
|
}, {});
|
|
74
74
|
return n.shallow ? { ...e2, ...o } : (Object.assign(e2, o), e2);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function he() {
|
|
77
|
+
let e2 = "";
|
|
78
|
+
for (let t = 0; t < 16; t++) e2 += (16 * Math.random() | 0).toString(16);
|
|
79
|
+
return e2;
|
|
80
|
+
}
|
|
81
|
+
function ve(e2 = {}) {
|
|
77
82
|
var _a;
|
|
78
|
-
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n =
|
|
83
|
+
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = G({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" } }], consent: { functional: true }, id: e2.id || he(), trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, source: { type: "collector", schema: "4" } }, e2, { merge: false });
|
|
79
84
|
if (e2.name) {
|
|
80
|
-
const [t2,
|
|
81
|
-
t2 &&
|
|
85
|
+
const [t2, o] = (_a = e2.name.split(" ")) != null ? _a : [];
|
|
86
|
+
t2 && o && (n.entity = t2, n.action = o);
|
|
82
87
|
}
|
|
83
|
-
return
|
|
88
|
+
return n;
|
|
84
89
|
}
|
|
85
|
-
function
|
|
90
|
+
function we(e2 = "entity action", t = {}) {
|
|
86
91
|
const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), o = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, r = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
|
|
87
|
-
return
|
|
92
|
+
return ve({ ...{ "cart view": { data: { currency: "EUR", value: 2 * o.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...o.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: o.data.price + r.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...o, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...o, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...o.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e2], ...t, name: e2 });
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
// src/examples/step.ts
|
|
@@ -92,7 +97,7 @@ var URL = "https://api.example.com/events";
|
|
|
92
97
|
var entityAction = {
|
|
93
98
|
title: "Entity action",
|
|
94
99
|
description: "A generic entity action event is forwarded to the configured API endpoint with the mapped data JSON body.",
|
|
95
|
-
in:
|
|
100
|
+
in: we("entity action", { timestamp: 1700000500 }),
|
|
96
101
|
mapping: {
|
|
97
102
|
data: "data"
|
|
98
103
|
},
|
|
@@ -113,7 +118,7 @@ var entityAction = {
|
|
|
113
118
|
var pageView = {
|
|
114
119
|
title: "Page view",
|
|
115
120
|
description: "A page view is POSTed to the configured API endpoint with the event data section as the JSON body.",
|
|
116
|
-
in:
|
|
121
|
+
in: we("page view", { timestamp: 1700000501 }),
|
|
117
122
|
mapping: {
|
|
118
123
|
data: "data"
|
|
119
124
|
},
|
|
@@ -136,7 +141,7 @@ var pageView = {
|
|
|
136
141
|
var customTransform = {
|
|
137
142
|
title: "Custom payload",
|
|
138
143
|
description: "An order event is reshaped via a data mapping into a custom JSON body for the API endpoint.",
|
|
139
|
-
in:
|
|
144
|
+
in: we("order complete", { timestamp: 1700000502 }),
|
|
140
145
|
mapping: {
|
|
141
146
|
data: {
|
|
142
147
|
map: {
|
package/dist/examples/index.mjs
CHANGED
|
@@ -38,32 +38,37 @@ __export(step_exports, {
|
|
|
38
38
|
|
|
39
39
|
// ../../../core/dist/index.mjs
|
|
40
40
|
var e = Object.defineProperty;
|
|
41
|
-
var
|
|
41
|
+
var a = {};
|
|
42
42
|
((t, n) => {
|
|
43
43
|
for (var o in n) e(t, o, { get: n[o], enumerable: true });
|
|
44
|
-
})(
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
function
|
|
48
|
-
n = { ...
|
|
44
|
+
})(a, { Level: () => c });
|
|
45
|
+
var c = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.WARN = 1] = "WARN", e2[e2.INFO = 2] = "INFO", e2[e2.DEBUG = 3] = "DEBUG", e2))(c || {});
|
|
46
|
+
var X = { merge: true, shallow: true, extend: true };
|
|
47
|
+
function G(e2, t = {}, n = {}) {
|
|
48
|
+
n = { ...X, ...n };
|
|
49
49
|
const o = Object.entries(t).reduce((t2, [o2, r]) => {
|
|
50
50
|
const i = e2[o2];
|
|
51
51
|
return n.merge && Array.isArray(i) && Array.isArray(r) ? t2[o2] = r.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...i]) : (n.extend || o2 in e2) && (t2[o2] = r), t2;
|
|
52
52
|
}, {});
|
|
53
53
|
return n.shallow ? { ...e2, ...o } : (Object.assign(e2, o), e2);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function he() {
|
|
56
|
+
let e2 = "";
|
|
57
|
+
for (let t = 0; t < 16; t++) e2 += (16 * Math.random() | 0).toString(16);
|
|
58
|
+
return e2;
|
|
59
|
+
}
|
|
60
|
+
function ve(e2 = {}) {
|
|
56
61
|
var _a;
|
|
57
|
-
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n =
|
|
62
|
+
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = G({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" } }], consent: { functional: true }, id: e2.id || he(), trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, source: { type: "collector", schema: "4" } }, e2, { merge: false });
|
|
58
63
|
if (e2.name) {
|
|
59
|
-
const [t2,
|
|
60
|
-
t2 &&
|
|
64
|
+
const [t2, o] = (_a = e2.name.split(" ")) != null ? _a : [];
|
|
65
|
+
t2 && o && (n.entity = t2, n.action = o);
|
|
61
66
|
}
|
|
62
|
-
return
|
|
67
|
+
return n;
|
|
63
68
|
}
|
|
64
|
-
function
|
|
69
|
+
function we(e2 = "entity action", t = {}) {
|
|
65
70
|
const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), o = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, r = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
|
|
66
|
-
return
|
|
71
|
+
return ve({ ...{ "cart view": { data: { currency: "EUR", value: 2 * o.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...o.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: o.data.price + r.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...o, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...o, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...o.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e2], ...t, name: e2 });
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
// src/examples/step.ts
|
|
@@ -71,7 +76,7 @@ var URL = "https://api.example.com/events";
|
|
|
71
76
|
var entityAction = {
|
|
72
77
|
title: "Entity action",
|
|
73
78
|
description: "A generic entity action event is forwarded to the configured API endpoint with the mapped data JSON body.",
|
|
74
|
-
in:
|
|
79
|
+
in: we("entity action", { timestamp: 1700000500 }),
|
|
75
80
|
mapping: {
|
|
76
81
|
data: "data"
|
|
77
82
|
},
|
|
@@ -92,7 +97,7 @@ var entityAction = {
|
|
|
92
97
|
var pageView = {
|
|
93
98
|
title: "Page view",
|
|
94
99
|
description: "A page view is POSTed to the configured API endpoint with the event data section as the JSON body.",
|
|
95
|
-
in:
|
|
100
|
+
in: we("page view", { timestamp: 1700000501 }),
|
|
96
101
|
mapping: {
|
|
97
102
|
data: "data"
|
|
98
103
|
},
|
|
@@ -115,7 +120,7 @@ var pageView = {
|
|
|
115
120
|
var customTransform = {
|
|
116
121
|
title: "Custom payload",
|
|
117
122
|
description: "An order event is reshaped via a data mapping into a custom JSON body for the API endpoint.",
|
|
118
|
-
in:
|
|
123
|
+
in: we("order complete", { timestamp: 1700000502 }),
|
|
119
124
|
mapping: {
|
|
120
125
|
data: {
|
|
121
126
|
map: {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { SendDataValue } from '@walkeros/core';\nimport type { Settings, Destination } from './types';\nimport { isDefined } from '@walkeros/core';\nimport { sendWeb } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationAPI from './types';\n\nfunction send(\n body: SendDataValue,\n settings: Settings,\n sendWebFn: typeof sendWeb,\n): void {\n const { url, headers, method, transport = 'fetch' } = settings;\n sendWebFn(url, body, { headers, method, transport });\n}\n\nexport const destinationAPI: Destination = {\n type: 'api',\n\n config: {},\n\n init({ config, logger }) {\n const { url } = config.settings || {};\n if (!url) logger.throw('Config settings url missing');\n },\n\n push(event, { config, rule, data, env, logger }) {\n const { settings } = config;\n const { url, transform } = settings || {};\n\n const eventData = isDefined(data) ? data : event;\n // Transform returns body directly, otherwise stringify\n const body = transform\n ? transform(eventData, config, rule)\n : JSON.stringify(eventData);\n\n send(body, settings as Settings, env.sendWeb || sendWeb);\n },\n\n pushBatch(batch, { config, rule, env }) {\n const settings = config.settings as Settings;\n const { transform } = settings;\n const items = batch.data.length ? batch.data : batch.events;\n\n // Apply transform to each item if defined, then stringify array\n const payload = transform\n ? items.map((item) => transform(item, config, rule))\n : items;\n\n send(JSON.stringify(payload), settings, env.sendWeb || sendWeb);\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 { DestinationWeb, sendWeb } from '@walkeros/web-core';\nimport type { SendWebTransport } from '@walkeros/web-core';\n\nexport interface Settings {\n url: string;\n headers?: SendHeaders;\n method?: string;\n transform?: Transform;\n transport?: SendWebTransport;\n}\n\n// InitSettings: user input (all optional)\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationWeb.Env {\n sendWeb?: typeof sendWeb;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type Transform = (\n data?: unknown,\n config?: Config,\n mapping?: WalkerOSMapping.Rule<Mapping>,\n) => SendDataValue;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A;;;;;;;;;;;;;AAGA,sBAAwB;;;ACHxB;;;ADQA,SAAS,KACP,MACA,UACA,WACM;AACN,QAAM,EAAE,KAAK,SAAS,QAAQ,YAAY,QAAQ,IAAI;AACtD,YAAU,KAAK,MAAM,EAAE,SAAS,QAAQ,UAAU,CAAC;AACrD;AAEO,IAAM,iBAA8B;AAAA,EACzC,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,QAAQ,OAAO,GAAG;AACvB,UAAM,EAAE,IAAI,IAAI,OAAO,YAAY,CAAC;AACpC,QAAI,CAAC,IAAK,QAAO,MAAM,6BAA6B;AAAA,EACtD;AAAA,EAEA,KAAK,OAAO,EAAE,QAAQ,MAAM,MAAM,KAAK,OAAO,GAAG;AAC/C,UAAM,EAAE,SAAS,IAAI;AACrB,UAAM,EAAE,KAAK,UAAU,IAAI,YAAY,CAAC;AAExC,UAAM,YAAY,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { SendDataValue } from '@walkeros/core';\nimport type { Settings, Destination } from './types';\nimport { isDefined } from '@walkeros/core';\nimport { sendWeb } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationAPI from './types';\n\nfunction send(\n body: SendDataValue,\n settings: Settings,\n sendWebFn: typeof sendWeb,\n): void {\n const { url, headers, method, transport = 'fetch' } = settings;\n sendWebFn(url, body, { headers, method, transport });\n}\n\nexport const destinationAPI: Destination = {\n type: 'api',\n\n config: {},\n\n init({ config, logger }) {\n const { url } = config.settings || {};\n if (!url) logger.throw('Config settings url missing');\n },\n\n push(event, { config, rule, data, env, logger }) {\n const { settings } = config;\n const { url, transform } = settings || {};\n\n const eventData = isDefined(data) ? data : event;\n // Transform returns body directly, otherwise stringify\n const body = transform\n ? transform(eventData, config, rule)\n : JSON.stringify(eventData);\n\n send(body, settings as Settings, env.sendWeb || sendWeb);\n },\n\n pushBatch(batch, { config, rule, env }) {\n const settings = config.settings as Settings;\n const { transform } = settings;\n const items = batch.data.length ? batch.data : batch.events;\n\n // Apply transform to each item if defined, then stringify array\n const payload = transform\n ? items.map((item) => transform(item, config, rule))\n : items;\n\n send(JSON.stringify(payload), settings, env.sendWeb || sendWeb);\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 { DestinationWeb, sendWeb } from '@walkeros/web-core';\nimport type { SendWebTransport } from '@walkeros/web-core';\n\nexport interface Settings {\n url: string;\n headers?: SendHeaders;\n method?: string;\n transform?: Transform;\n transport?: SendWebTransport;\n}\n\n// InitSettings: user input (all optional)\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationWeb.Env {\n sendWeb?: typeof sendWeb;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type Transform = (\n data?: unknown,\n config?: Config,\n mapping?: WalkerOSMapping.Rule<Mapping>,\n) => SendDataValue;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A;;;;;;;;;;;;;AAGA,sBAAwB;;;ACHxB;;;ADQA,SAAS,KACP,MACA,UACA,WACM;AACN,QAAM,EAAE,KAAK,SAAS,QAAQ,YAAY,QAAQ,IAAI;AACtD,YAAU,KAAK,MAAM,EAAE,SAAS,QAAQ,UAAU,CAAC;AACrD;AAEO,IAAM,iBAA8B;AAAA,EACzC,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,QAAQ,OAAO,GAAG;AACvB,UAAM,EAAE,IAAI,IAAI,OAAO,YAAY,CAAC;AACpC,QAAI,CAAC,IAAK,QAAO,MAAM,6BAA6B;AAAA,EACtD;AAAA,EAEA,KAAK,OAAO,EAAE,QAAQ,MAAM,MAAM,KAAK,OAAO,GAAG;AAC/C,UAAM,EAAE,SAAS,IAAI;AACrB,UAAM,EAAE,KAAK,UAAU,IAAI,YAAY,CAAC;AAExC,UAAM,YAAY,GAAU,IAAI,IAAI,OAAO;AAE3C,UAAM,OAAO,YACT,UAAU,WAAW,QAAQ,IAAI,IACjC,KAAK,UAAU,SAAS;AAE5B,SAAK,MAAM,UAAsB,IAAI,WAAW,uBAAO;AAAA,EACzD;AAAA,EAEA,UAAU,OAAO,EAAE,QAAQ,MAAM,IAAI,GAAG;AACtC,UAAM,WAAW,OAAO;AACxB,UAAM,EAAE,UAAU,IAAI;AACtB,UAAM,QAAQ,MAAM,KAAK,SAAS,MAAM,OAAO,MAAM;AAGrD,UAAM,UAAU,YACZ,MAAM,IAAI,CAAC,SAAS,UAAU,MAAM,QAAQ,IAAI,CAAC,IACjD;AAEJ,SAAK,KAAK,UAAU,OAAO,GAAG,UAAU,IAAI,WAAW,uBAAO;AAAA,EAChE;AACF;AAEA,IAAO,gBAAQ;","names":[]}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/index.ts","../src/index.ts"],"sourcesContent":["import type {\n Mapping as WalkerOSMapping,\n SendDataValue,\n SendHeaders,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb, sendWeb } from '@walkeros/web-core';\nimport type { SendWebTransport } from '@walkeros/web-core';\n\nexport interface Settings {\n url: string;\n headers?: SendHeaders;\n method?: string;\n transform?: Transform;\n transport?: SendWebTransport;\n}\n\n// InitSettings: user input (all optional)\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationWeb.Env {\n sendWeb?: typeof sendWeb;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<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","import type { SendDataValue } from '@walkeros/core';\nimport type { Settings, Destination } from './types';\nimport { isDefined } from '@walkeros/core';\nimport { sendWeb } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationAPI from './types';\n\nfunction send(\n body: SendDataValue,\n settings: Settings,\n sendWebFn: typeof sendWeb,\n): void {\n const { url, headers, method, transport = 'fetch' } = settings;\n sendWebFn(url, body, { headers, method, transport });\n}\n\nexport const destinationAPI: Destination = {\n type: 'api',\n\n config: {},\n\n init({ config, logger }) {\n const { url } = config.settings || {};\n if (!url) logger.throw('Config settings url missing');\n },\n\n push(event, { config, rule, data, env, logger }) {\n const { settings } = config;\n const { url, transform } = settings || {};\n\n const eventData = isDefined(data) ? data : event;\n // Transform returns body directly, otherwise stringify\n const body = transform\n ? transform(eventData, config, rule)\n : JSON.stringify(eventData);\n\n send(body, settings as Settings, env.sendWeb || sendWeb);\n },\n\n pushBatch(batch, { config, rule, env }) {\n const settings = config.settings as Settings;\n const { transform } = settings;\n const items = batch.data.length ? batch.data : batch.events;\n\n // Apply transform to each item if defined, then stringify array\n const payload = transform\n ? items.map((item) => transform(item, config, rule))\n : items;\n\n send(JSON.stringify(payload), settings, env.sendWeb || sendWeb);\n },\n};\n\nexport default destinationAPI;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACQA,SAAS,KACP,MACA,UACA,WACM;AACN,QAAM,EAAE,KAAK,SAAS,QAAQ,YAAY,QAAQ,IAAI;AACtD,YAAU,KAAK,MAAM,EAAE,SAAS,QAAQ,UAAU,CAAC;AACrD;AAEO,IAAM,iBAA8B;AAAA,EACzC,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,QAAQ,OAAO,GAAG;AACvB,UAAM,EAAE,IAAI,IAAI,OAAO,YAAY,CAAC;AACpC,QAAI,CAAC,IAAK,QAAO,MAAM,6BAA6B;AAAA,EACtD;AAAA,EAEA,KAAK,OAAO,EAAE,QAAQ,MAAM,MAAM,KAAK,OAAO,GAAG;AAC/C,UAAM,EAAE,SAAS,IAAI;AACrB,UAAM,EAAE,KAAK,UAAU,IAAI,YAAY,CAAC;AAExC,UAAM,YAAY,
|
|
1
|
+
{"version":3,"sources":["../src/types/index.ts","../src/index.ts"],"sourcesContent":["import type {\n Mapping as WalkerOSMapping,\n SendDataValue,\n SendHeaders,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb, sendWeb } from '@walkeros/web-core';\nimport type { SendWebTransport } from '@walkeros/web-core';\n\nexport interface Settings {\n url: string;\n headers?: SendHeaders;\n method?: string;\n transform?: Transform;\n transport?: SendWebTransport;\n}\n\n// InitSettings: user input (all optional)\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationWeb.Env {\n sendWeb?: typeof sendWeb;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<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","import type { SendDataValue } from '@walkeros/core';\nimport type { Settings, Destination } from './types';\nimport { isDefined } from '@walkeros/core';\nimport { sendWeb } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationAPI from './types';\n\nfunction send(\n body: SendDataValue,\n settings: Settings,\n sendWebFn: typeof sendWeb,\n): void {\n const { url, headers, method, transport = 'fetch' } = settings;\n sendWebFn(url, body, { headers, method, transport });\n}\n\nexport const destinationAPI: Destination = {\n type: 'api',\n\n config: {},\n\n init({ config, logger }) {\n const { url } = config.settings || {};\n if (!url) logger.throw('Config settings url missing');\n },\n\n push(event, { config, rule, data, env, logger }) {\n const { settings } = config;\n const { url, transform } = settings || {};\n\n const eventData = isDefined(data) ? data : event;\n // Transform returns body directly, otherwise stringify\n const body = transform\n ? transform(eventData, config, rule)\n : JSON.stringify(eventData);\n\n send(body, settings as Settings, env.sendWeb || sendWeb);\n },\n\n pushBatch(batch, { config, rule, env }) {\n const settings = config.settings as Settings;\n const { transform } = settings;\n const items = batch.data.length ? batch.data : batch.events;\n\n // Apply transform to each item if defined, then stringify array\n const payload = transform\n ? items.map((item) => transform(item, config, rule))\n : items;\n\n send(JSON.stringify(payload), settings, env.sendWeb || sendWeb);\n },\n};\n\nexport default destinationAPI;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACQA,SAAS,KACP,MACA,UACA,WACM;AACN,QAAM,EAAE,KAAK,SAAS,QAAQ,YAAY,QAAQ,IAAI;AACtD,YAAU,KAAK,MAAM,EAAE,SAAS,QAAQ,UAAU,CAAC;AACrD;AAEO,IAAM,iBAA8B;AAAA,EACzC,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,QAAQ,OAAO,GAAG;AACvB,UAAM,EAAE,IAAI,IAAI,OAAO,YAAY,CAAC;AACpC,QAAI,CAAC,IAAK,QAAO,MAAM,6BAA6B;AAAA,EACtD;AAAA,EAEA,KAAK,OAAO,EAAE,QAAQ,MAAM,MAAM,KAAK,OAAO,GAAG;AAC/C,UAAM,EAAE,SAAS,IAAI;AACrB,UAAM,EAAE,KAAK,UAAU,IAAI,YAAY,CAAC;AAExC,UAAM,YAAY,GAAU,IAAI,IAAI,OAAO;AAE3C,UAAM,OAAO,YACT,UAAU,WAAW,QAAQ,IAAI,IACjC,KAAK,UAAU,SAAS;AAE5B,SAAK,MAAM,UAAsB,IAAI,WAAW,CAAO;AAAA,EACzD;AAAA,EAEA,UAAU,OAAO,EAAE,QAAQ,MAAM,IAAI,GAAG;AACtC,UAAM,WAAW,OAAO;AACxB,UAAM,EAAE,UAAU,IAAI;AACtB,UAAM,QAAQ,MAAM,KAAK,SAAS,MAAM,OAAO,MAAM;AAGrD,UAAM,UAAU,YACZ,MAAM,IAAI,CAAC,SAAS,UAAU,MAAM,QAAQ,IAAI,CAAC,IACjD;AAEJ,SAAK,KAAK,UAAU,OAAO,GAAG,UAAU,IAAI,WAAW,CAAO;AAAA,EAChE;AACF;AAEA,IAAO,gBAAQ;","names":[]}
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/web-destination-api",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0-next-1777463920154",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"web"
|
|
@@ -155,22 +155,15 @@
|
|
|
155
155
|
"consent": {
|
|
156
156
|
"functional": true
|
|
157
157
|
},
|
|
158
|
-
"id": "
|
|
158
|
+
"id": "0a1ff9140f4c69ca",
|
|
159
159
|
"trigger": "load",
|
|
160
160
|
"entity": "order",
|
|
161
161
|
"action": "complete",
|
|
162
162
|
"timestamp": 1700000502,
|
|
163
163
|
"timing": 3.14,
|
|
164
|
-
"group": "gr0up",
|
|
165
|
-
"count": 1,
|
|
166
|
-
"version": {
|
|
167
|
-
"source": "3.4.2",
|
|
168
|
-
"tagging": 1
|
|
169
|
-
},
|
|
170
164
|
"source": {
|
|
171
|
-
"type": "
|
|
172
|
-
"
|
|
173
|
-
"previous_id": "http://remotehost:9001"
|
|
165
|
+
"type": "collector",
|
|
166
|
+
"schema": "4"
|
|
174
167
|
}
|
|
175
168
|
},
|
|
176
169
|
"mapping": {
|
|
@@ -234,35 +227,21 @@
|
|
|
234
227
|
"entity": "child",
|
|
235
228
|
"data": {
|
|
236
229
|
"is": "subordinated"
|
|
237
|
-
},
|
|
238
|
-
"nested": [],
|
|
239
|
-
"context": {
|
|
240
|
-
"element": [
|
|
241
|
-
"child",
|
|
242
|
-
0
|
|
243
|
-
]
|
|
244
230
|
}
|
|
245
231
|
}
|
|
246
232
|
],
|
|
247
233
|
"consent": {
|
|
248
234
|
"functional": true
|
|
249
235
|
},
|
|
250
|
-
"id": "
|
|
236
|
+
"id": "1c54771580e6fc14",
|
|
251
237
|
"trigger": "test",
|
|
252
238
|
"entity": "entity",
|
|
253
239
|
"action": "action",
|
|
254
240
|
"timestamp": 1700000500,
|
|
255
241
|
"timing": 3.14,
|
|
256
|
-
"group": "gr0up",
|
|
257
|
-
"count": 1,
|
|
258
|
-
"version": {
|
|
259
|
-
"source": "3.4.2",
|
|
260
|
-
"tagging": 1
|
|
261
|
-
},
|
|
262
242
|
"source": {
|
|
263
|
-
"type": "
|
|
264
|
-
"
|
|
265
|
-
"previous_id": "http://remotehost:9001"
|
|
243
|
+
"type": "collector",
|
|
244
|
+
"schema": "4"
|
|
266
245
|
}
|
|
267
246
|
},
|
|
268
247
|
"mapping": {
|
|
@@ -314,35 +293,21 @@
|
|
|
314
293
|
"entity": "child",
|
|
315
294
|
"data": {
|
|
316
295
|
"is": "subordinated"
|
|
317
|
-
},
|
|
318
|
-
"nested": [],
|
|
319
|
-
"context": {
|
|
320
|
-
"element": [
|
|
321
|
-
"child",
|
|
322
|
-
0
|
|
323
|
-
]
|
|
324
296
|
}
|
|
325
297
|
}
|
|
326
298
|
],
|
|
327
299
|
"consent": {
|
|
328
300
|
"functional": true
|
|
329
301
|
},
|
|
330
|
-
"id": "
|
|
302
|
+
"id": "2bda0016162be2d6",
|
|
331
303
|
"trigger": "load",
|
|
332
304
|
"entity": "page",
|
|
333
305
|
"action": "view",
|
|
334
306
|
"timestamp": 1700000501,
|
|
335
307
|
"timing": 3.14,
|
|
336
|
-
"group": "gr0up",
|
|
337
|
-
"count": 1,
|
|
338
|
-
"version": {
|
|
339
|
-
"source": "3.4.2",
|
|
340
|
-
"tagging": 1
|
|
341
|
-
},
|
|
342
308
|
"source": {
|
|
343
|
-
"type": "
|
|
344
|
-
"
|
|
345
|
-
"previous_id": "http://remotehost:9001"
|
|
309
|
+
"type": "collector",
|
|
310
|
+
"schema": "4"
|
|
346
311
|
}
|
|
347
312
|
},
|
|
348
313
|
"mapping": {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/web-destination-api",
|
|
3
3
|
"description": "Web API destination for walkerOS",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0-next-1777463920154",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"update": "npx npm-check-updates -u && npm update"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@walkeros/web-core": "
|
|
40
|
+
"@walkeros/web-core": "4.0.0-next-1777463920154"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@walkeros/collector": "
|
|
43
|
+
"@walkeros/collector": "4.0.0-next-1777463920154"
|
|
44
44
|
},
|
|
45
45
|
"repository": {
|
|
46
46
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|