@walkeros/web-destination-api 4.1.0-next-1778668930820 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +206 -0
- package/README.md +17 -165
- 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 +4 -42
- package/dist/examples/index.mjs +4 -42
- package/dist/index.browser.js +1 -1
- package/dist/index.es5.js +1 -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 +5 -7
- package/package.json +6 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# @walkeros/web-destination-api
|
|
2
|
+
|
|
3
|
+
## 4.1.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [e155ff8]
|
|
8
|
+
- Updated dependencies [e800974]
|
|
9
|
+
- Updated dependencies [e155ff8]
|
|
10
|
+
- Updated dependencies [1a8f2d7]
|
|
11
|
+
- Updated dependencies [1a8f2d7]
|
|
12
|
+
- Updated dependencies [b276173]
|
|
13
|
+
- Updated dependencies [dd9f5ad]
|
|
14
|
+
- Updated dependencies [c60ef35]
|
|
15
|
+
- Updated dependencies [adeebea]
|
|
16
|
+
- Updated dependencies [13aaeaa]
|
|
17
|
+
- Updated dependencies [e800974]
|
|
18
|
+
- Updated dependencies [adeebea]
|
|
19
|
+
- Updated dependencies [e800974]
|
|
20
|
+
- Updated dependencies [e800974]
|
|
21
|
+
- Updated dependencies [058f7ed]
|
|
22
|
+
- Updated dependencies [28a8ac2]
|
|
23
|
+
- Updated dependencies [fd6076e]
|
|
24
|
+
- @walkeros/core@4.1.0
|
|
25
|
+
- @walkeros/web-core@4.1.0
|
|
26
|
+
|
|
27
|
+
## 4.0.2
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- @walkeros/web-core@4.0.2
|
|
32
|
+
|
|
33
|
+
## 4.0.1
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- @walkeros/web-core@4.0.1
|
|
38
|
+
|
|
39
|
+
## 4.0.0
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [93ea9c4]
|
|
44
|
+
- @walkeros/web-core@4.0.0
|
|
45
|
+
|
|
46
|
+
## 3.4.2
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- @walkeros/web-core@3.4.2
|
|
51
|
+
|
|
52
|
+
## 3.4.1
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- Updated dependencies [caea905]
|
|
57
|
+
- @walkeros/web-core@3.4.1
|
|
58
|
+
|
|
59
|
+
## 3.4.0
|
|
60
|
+
|
|
61
|
+
### Minor Changes
|
|
62
|
+
|
|
63
|
+
- 724f97e: Migrate every step example in every walkerOS package to the
|
|
64
|
+
standardized `[callable, ...args][]` shape introduced in `@walkeros/core`.
|
|
65
|
+
Every step example's `out` is now an array of effect tuples whose first
|
|
66
|
+
element is the callable's public SDK name (`'gtag'`, `'analytics.track'`,
|
|
67
|
+
`'fbq'`, `'dataLayer.push'`, `'sendServer'`, `'fetch'`, `'trackClient.track'`,
|
|
68
|
+
`'amplitude.track'`, `'fs.writeFile'`, `'producer.send'`, `'client.xadd'`,
|
|
69
|
+
`'client.send'`, `'dataset.table.insert'`, etc.). Source examples use `'elb'`
|
|
70
|
+
as the callable; transformer examples use the reserved `'return'` keyword;
|
|
71
|
+
store examples use store-operation callables (`'get'`, `'set'`). Tests capture
|
|
72
|
+
real calls on each component's spy and assert against `example.out` directly —
|
|
73
|
+
the hardcoded `PACKAGE_CALLS` registry in the app is no longer consulted
|
|
74
|
+
(emptied; plan #3 removes it structurally).
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- @walkeros/web-core@3.4.0
|
|
79
|
+
|
|
80
|
+
## 3.3.1
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- @walkeros/web-core@3.3.1
|
|
85
|
+
|
|
86
|
+
## 3.3.0
|
|
87
|
+
|
|
88
|
+
### Patch Changes
|
|
89
|
+
|
|
90
|
+
- @walkeros/web-core@3.3.0
|
|
91
|
+
|
|
92
|
+
## 3.2.0
|
|
93
|
+
|
|
94
|
+
### Patch Changes
|
|
95
|
+
|
|
96
|
+
- @walkeros/web-core@3.2.0
|
|
97
|
+
|
|
98
|
+
## 3.1.1
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- @walkeros/web-core@3.1.1
|
|
103
|
+
|
|
104
|
+
## 3.1.0
|
|
105
|
+
|
|
106
|
+
### Patch Changes
|
|
107
|
+
|
|
108
|
+
- Updated dependencies [ff58828]
|
|
109
|
+
- @walkeros/web-core@3.1.0
|
|
110
|
+
|
|
111
|
+
## 3.0.2
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- @walkeros/web-core@3.0.2
|
|
116
|
+
|
|
117
|
+
## 3.0.1
|
|
118
|
+
|
|
119
|
+
### Patch Changes
|
|
120
|
+
|
|
121
|
+
- @walkeros/web-core@3.0.1
|
|
122
|
+
|
|
123
|
+
## 3.0.0
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- 499e27a: Add sideEffects declarations to all packages for bundler tree-shaking
|
|
128
|
+
support.
|
|
129
|
+
- Updated dependencies [499e27a]
|
|
130
|
+
- @walkeros/web-core@3.0.0
|
|
131
|
+
|
|
132
|
+
## 2.1.1
|
|
133
|
+
|
|
134
|
+
### Patch Changes
|
|
135
|
+
|
|
136
|
+
- @walkeros/web-core@2.1.1
|
|
137
|
+
|
|
138
|
+
## 2.1.0
|
|
139
|
+
|
|
140
|
+
### Minor Changes
|
|
141
|
+
|
|
142
|
+
- 97df0b2: Step examples: upgrade all packages to blueprint pattern with inline
|
|
143
|
+
mapping, no intermediate variables, no `all` export
|
|
144
|
+
|
|
145
|
+
### Patch Changes
|
|
146
|
+
|
|
147
|
+
- @walkeros/web-core@2.1.0
|
|
148
|
+
|
|
149
|
+
## 2.0.1
|
|
150
|
+
|
|
151
|
+
## 1.1.6
|
|
152
|
+
|
|
153
|
+
### Patch Changes
|
|
154
|
+
|
|
155
|
+
- @walkeros/web-core@2.0.0
|
|
156
|
+
|
|
157
|
+
## 1.1.5
|
|
158
|
+
|
|
159
|
+
### Patch Changes
|
|
160
|
+
|
|
161
|
+
- @walkeros/web-core@1.0.5
|
|
162
|
+
|
|
163
|
+
## 1.1.4
|
|
164
|
+
|
|
165
|
+
### Patch Changes
|
|
166
|
+
|
|
167
|
+
- @walkeros/web-core@1.0.4
|
|
168
|
+
|
|
169
|
+
## 1.1.3
|
|
170
|
+
|
|
171
|
+
### Patch Changes
|
|
172
|
+
|
|
173
|
+
- @walkeros/web-core@1.0.3
|
|
174
|
+
|
|
175
|
+
## 1.1.2
|
|
176
|
+
|
|
177
|
+
### Patch Changes
|
|
178
|
+
|
|
179
|
+
- @walkeros/web-core@1.0.2
|
|
180
|
+
|
|
181
|
+
## 1.1.1
|
|
182
|
+
|
|
183
|
+
### Patch Changes
|
|
184
|
+
|
|
185
|
+
- @walkeros/web-core@1.0.1
|
|
186
|
+
|
|
187
|
+
## 1.1.0
|
|
188
|
+
|
|
189
|
+
### Minor Changes
|
|
190
|
+
|
|
191
|
+
- ae79bfa: Add batching support with `pushBatch` method and `init` for early URL
|
|
192
|
+
validation
|
|
193
|
+
|
|
194
|
+
## 1.0.0
|
|
195
|
+
|
|
196
|
+
### Major Changes
|
|
197
|
+
|
|
198
|
+
- 67c9e1d: Hello World! walkerOS v1.0.0
|
|
199
|
+
|
|
200
|
+
Open-source event data collection. Collect event data for digital analytics in
|
|
201
|
+
a unified and privacy-centric way.
|
|
202
|
+
|
|
203
|
+
### Patch Changes
|
|
204
|
+
|
|
205
|
+
- Updated dependencies [67c9e1d]
|
|
206
|
+
- @walkeros/web-core@1.0.0
|
package/README.md
CHANGED
|
@@ -4,55 +4,37 @@
|
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# @walkeros/web-destination-api
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
•
|
|
11
|
-
[NPM Package](https://www.npmjs.com/package/@walkeros/web-destination-api)
|
|
9
|
+
Browser-side HTTP API destination with fetch, XHR, and beacon transports.
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
destination receives processed events from the walkerOS collector and sends them
|
|
18
|
-
to your custom API endpoint, enabling integration with internal analytics
|
|
19
|
-
systems, data warehouses, or custom business logic that requires real-time event
|
|
20
|
-
data.
|
|
11
|
+
[Documentation](https://www.walkeros.io/docs/destinations/api/web) •
|
|
12
|
+
[NPM Package](https://www.npmjs.com/package/@walkeros/web-destination-api)
|
|
13
|
+
•
|
|
14
|
+
[Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/web/destinations/api)
|
|
21
15
|
|
|
22
16
|
## Installation
|
|
23
17
|
|
|
24
|
-
```
|
|
18
|
+
```bash
|
|
25
19
|
npm install @walkeros/web-destination-api
|
|
26
20
|
```
|
|
27
21
|
|
|
28
|
-
##
|
|
29
|
-
|
|
30
|
-
| Name | Type | Description | Required | Example |
|
|
31
|
-
| ----------- | ------------------------------ | ------------------------------------------------ | -------- | ------------------------------------------------------------------------- |
|
|
32
|
-
| `url` | `string` | The HTTP endpoint URL to send events to | Yes | `'https://api.example.com/events'` |
|
|
33
|
-
| `headers` | `Record<string, string>` | Additional HTTP headers to include with requests | No | `{ 'Authorization': 'Bearer token', 'Content-Type': 'application/json' }` |
|
|
34
|
-
| `method` | `string` | HTTP method for the request | No | `'POST'` |
|
|
35
|
-
| `transform` | `function` | Function to transform event data before sending | No | `(data, config, mapping) => JSON.stringify(data)` |
|
|
36
|
-
| `transport` | `'fetch' \| 'xhr' \| 'beacon'` | Transport method for sending requests | No | `'fetch'` |
|
|
37
|
-
|
|
38
|
-
## Quick Start
|
|
39
|
-
|
|
40
|
-
Configure in your Flow JSON:
|
|
22
|
+
## Quick start
|
|
41
23
|
|
|
42
24
|
```json
|
|
43
25
|
{
|
|
44
|
-
"version":
|
|
26
|
+
"version": 4,
|
|
45
27
|
"flows": {
|
|
46
28
|
"default": {
|
|
47
|
-
"
|
|
29
|
+
"config": {
|
|
30
|
+
"platform": "web"
|
|
31
|
+
},
|
|
48
32
|
"destinations": {
|
|
49
33
|
"api": {
|
|
50
34
|
"package": "@walkeros/web-destination-api",
|
|
51
35
|
"config": {
|
|
52
36
|
"settings": {
|
|
53
|
-
"url": "https://api.example.com/events"
|
|
54
|
-
"method": "POST",
|
|
55
|
-
"headers": { "Authorization": "Bearer your-token" }
|
|
37
|
+
"url": "https://api.example.com/events"
|
|
56
38
|
}
|
|
57
39
|
}
|
|
58
40
|
}
|
|
@@ -62,140 +44,10 @@ Configure in your Flow JSON:
|
|
|
62
44
|
}
|
|
63
45
|
```
|
|
64
46
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
import { startFlow } from '@walkeros/collector';
|
|
69
|
-
import { destinationAPI } from '@walkeros/web-destination-api';
|
|
70
|
-
|
|
71
|
-
const { elb } = await startFlow({
|
|
72
|
-
destinations: [
|
|
73
|
-
{
|
|
74
|
-
destination: destinationAPI,
|
|
75
|
-
config: {
|
|
76
|
-
settings: {
|
|
77
|
-
url: 'https://api.example.com/events',
|
|
78
|
-
method: 'POST',
|
|
79
|
-
headers: { Authorization: 'Bearer your-token' },
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
});
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Usage
|
|
88
|
-
|
|
89
|
-
### Advanced Usage with Transform
|
|
90
|
-
|
|
91
|
-
```typescript
|
|
92
|
-
import { startFlow } from '@walkeros/collector';
|
|
93
|
-
import { destinationAPI } from '@walkeros/web-destination-api';
|
|
94
|
-
|
|
95
|
-
const { elb } = await startFlow({
|
|
96
|
-
destinations: [
|
|
97
|
-
{
|
|
98
|
-
destination: destinationAPI,
|
|
99
|
-
config: {
|
|
100
|
-
settings: {
|
|
101
|
-
url: 'https://api.example.com/events',
|
|
102
|
-
transport: 'fetch',
|
|
103
|
-
transform: (event, config, mapping) => {
|
|
104
|
-
return JSON.stringify({
|
|
105
|
-
timestamp: Date.now(),
|
|
106
|
-
event_name: `${event.entity}_${event.action}`,
|
|
107
|
-
properties: event.data,
|
|
108
|
-
context: event.context,
|
|
109
|
-
});
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
});
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## Examples
|
|
119
|
-
|
|
120
|
-
### Sending to Analytics API
|
|
121
|
-
|
|
122
|
-
```json
|
|
123
|
-
{
|
|
124
|
-
"destinations": {
|
|
125
|
-
"analytics": {
|
|
126
|
-
"package": "@walkeros/web-destination-api",
|
|
127
|
-
"config": {
|
|
128
|
-
"settings": {
|
|
129
|
-
"url": "https://analytics.example.com/track",
|
|
130
|
-
"method": "POST",
|
|
131
|
-
"headers": {
|
|
132
|
-
"Content-Type": "application/json",
|
|
133
|
-
"X-API-Key": "your-api-key"
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### Using Beacon Transport
|
|
143
|
-
|
|
144
|
-
For critical events that need to be sent even when the page is unloading:
|
|
145
|
-
|
|
146
|
-
```json
|
|
147
|
-
{
|
|
148
|
-
"destinations": {
|
|
149
|
-
"critical": {
|
|
150
|
-
"package": "@walkeros/web-destination-api",
|
|
151
|
-
"config": {
|
|
152
|
-
"settings": {
|
|
153
|
-
"url": "https://api.example.com/critical-events",
|
|
154
|
-
"transport": "beacon"
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### Custom Data Mapping
|
|
163
|
-
|
|
164
|
-
Use mapping rules to control which events are sent:
|
|
165
|
-
|
|
166
|
-
```json
|
|
167
|
-
{
|
|
168
|
-
"destinations": {
|
|
169
|
-
"api": {
|
|
170
|
-
"package": "@walkeros/web-destination-api",
|
|
171
|
-
"config": {
|
|
172
|
-
"settings": { "url": "https://api.example.com/events" },
|
|
173
|
-
"mapping": {
|
|
174
|
-
"entity": {
|
|
175
|
-
"action": { "data": "data" }
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
## Transport Methods
|
|
185
|
-
|
|
186
|
-
- **fetch** (default): Modern, promise-based HTTP requests
|
|
187
|
-
- **xhr**: Traditional XMLHttpRequest for older browser compatibility
|
|
188
|
-
- **beacon**: Uses Navigator.sendBeacon() for reliable data transmission during
|
|
189
|
-
page unload
|
|
190
|
-
|
|
191
|
-
## Type Definitions
|
|
192
|
-
|
|
193
|
-
See [src/types/](./src/types/) for TypeScript interfaces.
|
|
194
|
-
|
|
195
|
-
## Related
|
|
47
|
+
## Documentation
|
|
196
48
|
|
|
197
|
-
|
|
198
|
-
|
|
49
|
+
Full configuration, mapping, and examples live in the docs:
|
|
50
|
+
**https://www.walkeros.io/docs/destinations/api/web**
|
|
199
51
|
|
|
200
52
|
## Contribute
|
|
201
53
|
|
|
@@ -206,4 +58,4 @@ Feel free to contribute by submitting an
|
|
|
206
58
|
|
|
207
59
|
## License
|
|
208
60
|
|
|
209
|
-
|
|
61
|
+
MIT
|