@walkeros/destination-demo 0.3.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 elbWalker GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,125 @@
1
+ <div align="center">
2
+ <a href="https://www.elbwalker.com">
3
+ <img alt="elbwalker" src="https://www.elbwalker.com/img/elbwalker-logo.png" height="40px" />
4
+ </a>
5
+ </div>
6
+
7
+ # walkerOS Destination Demo
8
+
9
+ A demo destination that logs walkerOS events to console with optional field
10
+ filtering - perfect for debugging, testing, and demonstrations.
11
+
12
+ > Learn more at [walkeros.io/docs](https://www.walkeros.io/docs/destinations/)
13
+
14
+ ## What It Does
15
+
16
+ - Logs events to console with JSON formatting
17
+ - Supports field filtering using dot notation
18
+ - Zero external dependencies - ideal for demos and debugging
19
+ - Simple destination interface compatible with walkerOS architecture
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ npm install @walkeros/destination-demo
25
+ ```
26
+
27
+ ## Quick Start
28
+
29
+ ```typescript
30
+ import { startFlow } from '@walkeros/collector';
31
+ import { destinationDemo } from '@walkeros/destination-demo';
32
+
33
+ const { collector } = await startFlow({
34
+ destinations: {
35
+ demo: destinationDemo,
36
+ },
37
+ });
38
+
39
+ await collector.push('page view', { title: 'Home' });
40
+ // Console output: [demo] { "name": "page view", "data": { "title": "Home" }, ... }
41
+ ```
42
+
43
+ ## Configuration
44
+
45
+ | Name | Type | Description | Required |
46
+ | ------ | --------------- | ------------------------------------------------ | -------- |
47
+ | name | `string` | Custom prefix for log messages (default: "demo") | No |
48
+ | values | `Array<string>` | Dot notation paths to extract specific fields | No |
49
+
50
+ ## Example
51
+
52
+ Complete example showing filtered field logging:
53
+
54
+ ```typescript
55
+ import { startFlow } from '@walkeros/collector';
56
+ import { sourceDemo } from '@walkeros/source-demo';
57
+ import { destinationDemo } from '@walkeros/destination-demo';
58
+
59
+ const { collector } = await startFlow({
60
+ sources: {
61
+ demo: {
62
+ code: sourceDemo,
63
+ config: {
64
+ settings: {
65
+ events: [
66
+ {
67
+ name: 'product view',
68
+ data: { id: 'P123', name: 'Laptop', price: 999 },
69
+ },
70
+ ],
71
+ },
72
+ },
73
+ },
74
+ },
75
+ destinations: {
76
+ demo: {
77
+ ...destinationDemo,
78
+ config: {
79
+ settings: {
80
+ name: 'MyApp',
81
+ values: ['name', 'data.id', 'data.name', 'timestamp'],
82
+ },
83
+ },
84
+ },
85
+ },
86
+ });
87
+
88
+ // Console output: [MyApp] {
89
+ // "name": "product view",
90
+ // "data.id": "P123",
91
+ // "data.name": "Laptop",
92
+ // "timestamp": 1647261462000
93
+ // }
94
+ ```
95
+
96
+ ### Without Field Filtering
97
+
98
+ Omit the `values` setting to log the complete event object:
99
+
100
+ ```typescript
101
+ const { collector } = await startFlow({
102
+ destinations: {
103
+ demo: {
104
+ ...destinationDemo,
105
+ config: {
106
+ settings: {
107
+ name: 'Debug',
108
+ },
109
+ },
110
+ },
111
+ },
112
+ });
113
+
114
+ // Console output: [Debug] { "name": "page view", "data": {...}, "context": {...}, ... }
115
+ ```
116
+
117
+ ## Contribute
118
+
119
+ We welcome contributions! Please see our
120
+ [contribution guidelines](https://github.com/elbwalker/walkerOS) for more
121
+ information.
122
+
123
+ ## License
124
+
125
+ MIT
@@ -0,0 +1,38 @@
1
+ import { Destination as Destination$1 } from '@walkeros/core';
2
+
3
+ interface Settings {
4
+ name?: string;
5
+ values?: string[];
6
+ }
7
+ interface Mapping {
8
+ }
9
+ interface Env extends Destination$1.BaseEnv {
10
+ log?: (msg: string) => void;
11
+ }
12
+ type Types = Destination$1.Types<Settings, Mapping, Env>;
13
+ type Destination = Destination$1.Instance<Types>;
14
+ type Config = Destination$1.Config<Types>;
15
+ type InitFn = Destination$1.InitFn<Types>;
16
+ type PushFn = Destination$1.PushFn<Types>;
17
+
18
+ type types_Config = Config;
19
+ type types_Destination = Destination;
20
+ type types_Env = Env;
21
+ type types_InitFn = InitFn;
22
+ type types_Mapping = Mapping;
23
+ type types_PushFn = PushFn;
24
+ type types_Settings = Settings;
25
+ type types_Types = Types;
26
+ declare namespace types {
27
+ export type { types_Config as Config, types_Destination as Destination, types_Env as Env, types_InitFn as InitFn, types_Mapping as Mapping, types_PushFn as PushFn, types_Settings as Settings, types_Types as Types };
28
+ }
29
+
30
+ /**
31
+ * Demo destination for walkerOS
32
+ *
33
+ * Logs events using env.log (or console.log fallback) with optional field filtering.
34
+ * Perfect for testing and demonstrations without external dependencies.
35
+ */
36
+ declare const destinationDemo: Destination;
37
+
38
+ export { types as DestinationDemo, destinationDemo as default, destinationDemo };
@@ -0,0 +1,38 @@
1
+ import { Destination as Destination$1 } from '@walkeros/core';
2
+
3
+ interface Settings {
4
+ name?: string;
5
+ values?: string[];
6
+ }
7
+ interface Mapping {
8
+ }
9
+ interface Env extends Destination$1.BaseEnv {
10
+ log?: (msg: string) => void;
11
+ }
12
+ type Types = Destination$1.Types<Settings, Mapping, Env>;
13
+ type Destination = Destination$1.Instance<Types>;
14
+ type Config = Destination$1.Config<Types>;
15
+ type InitFn = Destination$1.InitFn<Types>;
16
+ type PushFn = Destination$1.PushFn<Types>;
17
+
18
+ type types_Config = Config;
19
+ type types_Destination = Destination;
20
+ type types_Env = Env;
21
+ type types_InitFn = InitFn;
22
+ type types_Mapping = Mapping;
23
+ type types_PushFn = PushFn;
24
+ type types_Settings = Settings;
25
+ type types_Types = Types;
26
+ declare namespace types {
27
+ export type { types_Config as Config, types_Destination as Destination, types_Env as Env, types_InitFn as InitFn, types_Mapping as Mapping, types_PushFn as PushFn, types_Settings as Settings, types_Types as Types };
28
+ }
29
+
30
+ /**
31
+ * Demo destination for walkerOS
32
+ *
33
+ * Logs events using env.log (or console.log fallback) with optional field filtering.
34
+ * Perfect for testing and demonstrations without external dependencies.
35
+ */
36
+ declare const destinationDemo: Destination;
37
+
38
+ export { types as DestinationDemo, destinationDemo as default, destinationDemo };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i={};((e,o)=>{for(var n in o)t(e,n,{get:o[n],enumerable:!0})})(i,{DestinationDemo:()=>s,default:()=>l,destinationDemo:()=>a}),module.exports=(e=i,((e,i,s,a)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let l of n(i))r.call(e,l)||l===s||t(e,l,{get:()=>i[l],enumerable:!(a=o(i,l))||a.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={},a={type:"demo",config:{settings:{name:"demo"}},init({config:e,env:t}){(t?.log||console.log)(`[${(e?.settings||{name:"demo"}).name}] initialized`)},push(e,{config:t,env:o}){const n=o?.log||console.log,r=t?.settings||{name:"demo"},i=r.values?function(e,t){const o={};for(const n of t){const t=n.split(".").reduce((e,t)=>e?.[t],e);void 0!==t&&(o[n]=t)}return o}(e,r.values):e;n(`[${r.name}] ${JSON.stringify(i,null,2)}`)}};var l=a;//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/types.ts"],"sourcesContent":["import type { WalkerOS } from '@walkeros/core';\nimport type { Destination } from './types';\n\nexport * as DestinationDemo from './types';\n\n/**\n * Demo destination for walkerOS\n *\n * Logs events using env.log (or console.log fallback) with optional field filtering.\n * Perfect for testing and demonstrations without external dependencies.\n */\nexport const destinationDemo: Destination = {\n type: 'demo',\n\n config: {\n settings: {\n name: 'demo',\n },\n },\n\n init({ config, env }) {\n // eslint-disable-next-line no-console\n const log = env?.log || console.log;\n const settings = config?.settings || { name: 'demo' };\n\n // Log initialization\n log(`[${settings.name}] initialized`);\n },\n\n push(event, { config, env }) {\n // eslint-disable-next-line no-console\n const log = env?.log || console.log;\n const settings = config?.settings || { name: 'demo' };\n\n const output = settings.values\n ? extractValues(\n event as unknown as Record<string, unknown>,\n settings.values,\n )\n : event;\n\n log(`[${settings.name}] ${JSON.stringify(output, null, 2)}`);\n },\n};\n\n/**\n * Extract values from object using dot notation paths\n */\nfunction extractValues(\n obj: Record<string, unknown>,\n paths: string[],\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const path of paths) {\n const value = path\n .split('.')\n .reduce<unknown>(\n (acc, key) => (acc as Record<string, unknown>)?.[key],\n obj,\n );\n if (value !== undefined) {\n result[path] = value;\n }\n }\n\n return result;\n}\n\nexport default destinationDemo;\n","import type { Destination as CoreDestination } from '@walkeros/core';\n\nexport interface Settings {\n name?: string;\n values?: string[];\n}\n\nexport interface Mapping {}\n\nexport interface Env extends CoreDestination.BaseEnv {\n log?: (msg: string) => void;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env>;\n\nexport type Destination = CoreDestination.Instance<Types>;\nexport type Config = CoreDestination.Config<Types>;\nexport type InitFn = CoreDestination.InitFn<Types>;\nexport type PushFn = CoreDestination.PushFn<Types>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;;;ADWO,IAAM,kBAA+B;AAAA,EAC1C,MAAM;AAAA,EAEN,QAAQ;AAAA,IACN,UAAU;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEA,KAAK,EAAE,QAAQ,IAAI,GAAG;AAEpB,UAAM,MAAM,KAAK,OAAO,QAAQ;AAChC,UAAM,WAAW,QAAQ,YAAY,EAAE,MAAM,OAAO;AAGpD,QAAI,IAAI,SAAS,IAAI,eAAe;AAAA,EACtC;AAAA,EAEA,KAAK,OAAO,EAAE,QAAQ,IAAI,GAAG;AAE3B,UAAM,MAAM,KAAK,OAAO,QAAQ;AAChC,UAAM,WAAW,QAAQ,YAAY,EAAE,MAAM,OAAO;AAEpD,UAAM,SAAS,SAAS,SACpB;AAAA,MACE;AAAA,MACA,SAAS;AAAA,IACX,IACA;AAEJ,QAAI,IAAI,SAAS,IAAI,KAAK,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC,EAAE;AAAA,EAC7D;AACF;AAKA,SAAS,cACP,KACA,OACyB;AACzB,QAAM,SAAkC,CAAC;AAEzC,aAAW,QAAQ,OAAO;AACxB,UAAM,QAAQ,KACX,MAAM,GAAG,EACT;AAAA,MACC,CAAC,KAAK,QAAS,MAAkC,GAAG;AAAA,MACpD;AAAA,IACF;AACF,QAAI,UAAU,QAAW;AACvB,aAAO,IAAI,IAAI;AAAA,IACjB;AAAA,EACF;AAEA,SAAO;AACT;AAEA,IAAO,gBAAQ;","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ var n={},e={type:"demo",config:{settings:{name:"demo"}},init({config:n,env:e}){(e?.log||console.log)(`[${(n?.settings||{name:"demo"}).name}] initialized`)},push(n,{config:e,env:o}){const t=o?.log||console.log,s=e?.settings||{name:"demo"},i=s.values?function(n,e){const o={};for(const t of e){const e=t.split(".").reduce((n,e)=>n?.[e],n);void 0!==e&&(o[t]=e)}return o}(n,s.values):n;t(`[${s.name}] ${JSON.stringify(i,null,2)}`)}};var o=e;export{n as DestinationDemo,o as default,e as destinationDemo};//# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types.ts","../src/index.ts"],"sourcesContent":["import type { Destination as CoreDestination } from '@walkeros/core';\n\nexport interface Settings {\n name?: string;\n values?: string[];\n}\n\nexport interface Mapping {}\n\nexport interface Env extends CoreDestination.BaseEnv {\n log?: (msg: string) => void;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env>;\n\nexport type Destination = CoreDestination.Instance<Types>;\nexport type Config = CoreDestination.Config<Types>;\nexport type InitFn = CoreDestination.InitFn<Types>;\nexport type PushFn = CoreDestination.PushFn<Types>;\n","import type { WalkerOS } from '@walkeros/core';\nimport type { Destination } from './types';\n\nexport * as DestinationDemo from './types';\n\n/**\n * Demo destination for walkerOS\n *\n * Logs events using env.log (or console.log fallback) with optional field filtering.\n * Perfect for testing and demonstrations without external dependencies.\n */\nexport const destinationDemo: Destination = {\n type: 'demo',\n\n config: {\n settings: {\n name: 'demo',\n },\n },\n\n init({ config, env }) {\n // eslint-disable-next-line no-console\n const log = env?.log || console.log;\n const settings = config?.settings || { name: 'demo' };\n\n // Log initialization\n log(`[${settings.name}] initialized`);\n },\n\n push(event, { config, env }) {\n // eslint-disable-next-line no-console\n const log = env?.log || console.log;\n const settings = config?.settings || { name: 'demo' };\n\n const output = settings.values\n ? extractValues(\n event as unknown as Record<string, unknown>,\n settings.values,\n )\n : event;\n\n log(`[${settings.name}] ${JSON.stringify(output, null, 2)}`);\n },\n};\n\n/**\n * Extract values from object using dot notation paths\n */\nfunction extractValues(\n obj: Record<string, unknown>,\n paths: string[],\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const path of paths) {\n const value = path\n .split('.')\n .reduce<unknown>(\n (acc, key) => (acc as Record<string, unknown>)?.[key],\n obj,\n );\n if (value !== undefined) {\n result[path] = value;\n }\n }\n\n return result;\n}\n\nexport default destinationDemo;\n"],"mappings":";AAAA;;;ACWO,IAAM,kBAA+B;AAAA,EAC1C,MAAM;AAAA,EAEN,QAAQ;AAAA,IACN,UAAU;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEA,KAAK,EAAE,QAAQ,IAAI,GAAG;AAEpB,UAAM,MAAM,KAAK,OAAO,QAAQ;AAChC,UAAM,WAAW,QAAQ,YAAY,EAAE,MAAM,OAAO;AAGpD,QAAI,IAAI,SAAS,IAAI,eAAe;AAAA,EACtC;AAAA,EAEA,KAAK,OAAO,EAAE,QAAQ,IAAI,GAAG;AAE3B,UAAM,MAAM,KAAK,OAAO,QAAQ;AAChC,UAAM,WAAW,QAAQ,YAAY,EAAE,MAAM,OAAO;AAEpD,UAAM,SAAS,SAAS,SACpB;AAAA,MACE;AAAA,MACA,SAAS;AAAA,IACX,IACA;AAEJ,QAAI,IAAI,SAAS,IAAI,KAAK,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC,EAAE;AAAA,EAC7D;AACF;AAKA,SAAS,cACP,KACA,OACyB;AACzB,QAAM,SAAkC,CAAC;AAEzC,aAAW,QAAQ,OAAO;AACxB,UAAM,QAAQ,KACX,MAAM,GAAG,EACT;AAAA,MACC,CAAC,KAAK,QAAS,MAAkC,GAAG;AAAA,MACpD;AAAA,IACF;AACF,QAAI,UAAU,QAAW;AACvB,aAAO,IAAI,IAAI;AAAA,IACjB;AAAA,EACF;AAEA,SAAO;AACT;AAEA,IAAO,gBAAQ;","names":[]}
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@walkeros/destination-demo",
3
+ "description": "Demo destination for walkerOS - logs events to console",
4
+ "version": "0.3.0",
5
+ "license": "MIT",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.mjs",
13
+ "require": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist/**"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsup --silent",
21
+ "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
22
+ "dev": "jest --watchAll --colors",
23
+ "lint": "tsc && eslint \"**/*.ts*\"",
24
+ "test": "jest"
25
+ },
26
+ "dependencies": {
27
+ "@walkeros/core": "0.3.0"
28
+ },
29
+ "repository": {
30
+ "url": "git+https://github.com/elbwalker/walkerOS.git",
31
+ "directory": "apps/demos/destination"
32
+ },
33
+ "author": "elbwalker <hello@elbwalker.com>",
34
+ "homepage": "https://github.com/elbwalker/walkerOS#readme",
35
+ "bugs": {
36
+ "url": "https://github.com/elbwalker/walkerOS/issues"
37
+ },
38
+ "keywords": [
39
+ "walker",
40
+ "walkerOS",
41
+ "destination",
42
+ "demo"
43
+ ]
44
+ }