@walkeros/server-core 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.
Files changed (3) hide show
  1. package/CHANGELOG.md +237 -0
  2. package/README.md +17 -247
  3. package/package.json +6 -5
package/CHANGELOG.md ADDED
@@ -0,0 +1,237 @@
1
+ # @walkeros/server-core
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
+
26
+ ## 4.0.2
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [a6a0ea7]
31
+ - @walkeros/core@4.0.2
32
+
33
+ ## 4.0.1
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [381dfe7]
38
+ - Updated dependencies [1524275]
39
+ - Updated dependencies [03d7055]
40
+ - @walkeros/core@4.0.1
41
+
42
+ ## 4.0.0
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies [93ea9c4]
47
+ - Updated dependencies [465775c]
48
+ - Updated dependencies [942a7fe]
49
+ - Updated dependencies [cfc7469]
50
+ - Updated dependencies [8e06b1f]
51
+ - Updated dependencies [3d50dd6]
52
+ - Updated dependencies [1ef33d9]
53
+ - @walkeros/core@4.0.0
54
+
55
+ ## 3.4.2
56
+
57
+ ### Patch Changes
58
+
59
+ - @walkeros/core@3.4.2
60
+
61
+ ## 3.4.1
62
+
63
+ ### Patch Changes
64
+
65
+ - Updated dependencies [12adf24]
66
+ - Updated dependencies [75aa26b]
67
+ - @walkeros/core@3.4.1
68
+
69
+ ## 3.4.0
70
+
71
+ ### Patch Changes
72
+
73
+ - Updated dependencies [74940cc]
74
+ - Updated dependencies [525f5d9]
75
+ - @walkeros/core@3.4.0
76
+
77
+ ## 3.3.1
78
+
79
+ ### Patch Changes
80
+
81
+ - @walkeros/core@3.3.1
82
+
83
+ ## 3.3.0
84
+
85
+ ### Patch Changes
86
+
87
+ - Updated dependencies [2849acb]
88
+ - Updated dependencies [08c365a]
89
+ - Updated dependencies [08c365a]
90
+ - Updated dependencies [08c365a]
91
+ - Updated dependencies [08c365a]
92
+ - @walkeros/core@3.3.0
93
+
94
+ ## 3.2.0
95
+
96
+ ### Patch Changes
97
+
98
+ - Updated dependencies [eb865e1]
99
+ - Updated dependencies [c0a53f9]
100
+ - Updated dependencies [f007c9f]
101
+ - Updated dependencies [bf2dc5b]
102
+ - Updated dependencies [da0b640]
103
+ - @walkeros/core@3.2.0
104
+
105
+ ## 3.1.1
106
+
107
+ ### Patch Changes
108
+
109
+ - @walkeros/core@3.1.1
110
+
111
+ ## 3.1.0
112
+
113
+ ### Patch Changes
114
+
115
+ - Updated dependencies [dfc6738]
116
+ - Updated dependencies [966342b]
117
+ - Updated dependencies [bee8ba7]
118
+ - Updated dependencies [966342b]
119
+ - Updated dependencies [df990d4]
120
+ - @walkeros/core@3.1.0
121
+
122
+ ## 3.0.2
123
+
124
+ ### Patch Changes
125
+
126
+ - @walkeros/core@3.0.2
127
+
128
+ ## 3.0.1
129
+
130
+ ### Patch Changes
131
+
132
+ - @walkeros/core@3.0.1
133
+
134
+ ## 3.0.0
135
+
136
+ ### Patch Changes
137
+
138
+ - 499e27a: Add sideEffects declarations to all packages for bundler tree-shaking
139
+ support.
140
+ - Updated dependencies [2b259b6]
141
+ - Updated dependencies [2614014]
142
+ - Updated dependencies [6ae0ee3]
143
+ - Updated dependencies [37299a9]
144
+ - Updated dependencies [499e27a]
145
+ - Updated dependencies [0e5eede]
146
+ - Updated dependencies [d11f574]
147
+ - Updated dependencies [d11f574]
148
+ - Updated dependencies [1fe337a]
149
+ - Updated dependencies [5cb84c1]
150
+ - Updated dependencies [23f218a]
151
+ - Updated dependencies [499e27a]
152
+ - Updated dependencies [c83d909]
153
+ - Updated dependencies [b6c8fa8]
154
+ - @walkeros/core@3.0.0
155
+
156
+ ## 2.1.1
157
+
158
+ ### Patch Changes
159
+
160
+ - Updated dependencies [fab477d]
161
+ - @walkeros/core@2.1.1
162
+
163
+ ## 2.1.0
164
+
165
+ ### Patch Changes
166
+
167
+ - Updated dependencies [7fc4cee]
168
+ - Updated dependencies [7fc4cee]
169
+ - Updated dependencies [cb2da05]
170
+ - Updated dependencies [2bbe8c8]
171
+ - Updated dependencies [3eb6416]
172
+ - Updated dependencies [02a7958]
173
+ - Updated dependencies [97df0b2]
174
+ - Updated dependencies [97df0b2]
175
+ - Updated dependencies [026c412]
176
+ - Updated dependencies [7d38d9d]
177
+ - @walkeros/core@2.1.0
178
+
179
+ ## 2.0.1
180
+
181
+ ## 2.0.0
182
+
183
+ ### Patch Changes
184
+
185
+ - Updated dependencies [7b2d750]
186
+ - @walkeros/core@1.4.0
187
+
188
+ ## 1.0.5
189
+
190
+ ### Patch Changes
191
+
192
+ - Updated dependencies [a4cc1ea]
193
+ - @walkeros/core@1.3.0
194
+
195
+ ## 1.0.4
196
+
197
+ ### Patch Changes
198
+
199
+ - Updated dependencies [7ad6cfb]
200
+ - @walkeros/core@1.2.2
201
+
202
+ ## 1.0.3
203
+
204
+ ### Patch Changes
205
+
206
+ - Updated dependencies [6256c12]
207
+ - @walkeros/core@1.2.1
208
+
209
+ ## 1.0.2
210
+
211
+ ### Patch Changes
212
+
213
+ - Updated dependencies [f39d9fb]
214
+ - Updated dependencies [888bbdf]
215
+ - @walkeros/core@1.2.0
216
+
217
+ ## 1.0.1
218
+
219
+ ### Patch Changes
220
+
221
+ - Updated dependencies [b65b773]
222
+ - Updated dependencies [20eca6e]
223
+ - @walkeros/core@1.1.0
224
+
225
+ ## 1.0.0
226
+
227
+ ### Major Changes
228
+
229
+ - 67c9e1d: Hello World! walkerOS v1.0.0
230
+
231
+ Open-source event data collection. Collect event data for digital analytics in
232
+ a unified and privacy-centric way.
233
+
234
+ ### Patch Changes
235
+
236
+ - Updated dependencies [67c9e1d]
237
+ - @walkeros/core@1.0.0
package/README.md CHANGED
@@ -4,268 +4,38 @@
4
4
  </a>
5
5
  </p>
6
6
 
7
- # Server Core Utilities for walkerOS
7
+ # @walkeros/server-core
8
8
 
9
- [Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/server/core)
10
- &bull; [NPM Package](https://www.npmjs.com/package/@walkeros/server-core)
9
+ Node.js-specific utilities for server-side walkerOS implementations, covering
10
+ HTTP communication and cryptographic hashing for backend event processing.
11
11
 
12
- Server core utilities are Node.js-specific functions designed for server-side
13
- walkerOS implementations. These utilities handle server communication,
14
- cryptographic hashing, and other backend operations.
12
+ [Documentation](https://www.walkeros.io/docs/sources/server) &bull;
13
+ [NPM Package](https://www.npmjs.com/package/@walkeros/server-core) &bull;
14
+ [Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/server/core)
15
15
 
16
16
  ## Installation
17
17
 
18
- Import server utilities from the `@walkeros/server-core` package:
19
-
20
- ```ts
21
- import { sendServer, getHashServer } from '@walkeros/server-core';
22
- ```
23
-
24
- ## Server Communication
25
-
26
- ### sendServer
27
-
28
- `sendServer(url: string, data?: SendDataValue, options?: SendServerOptions): Promise<SendResponse>`
29
- sends HTTP requests using Node.js built-in modules (`http`/`https`).
30
-
31
- ```js
32
- // Simple POST request
33
- const response = await sendServer('https://api.example.com/events', {
34
- name: 'page view',
35
- data: { url: '/home' },
36
- });
37
-
38
- // With custom options
39
- const response = await sendServer(url, data, {
40
- method: 'PUT',
41
- headers: {
42
- Authorization: 'Bearer token',
43
- 'Content-Type': 'application/json',
44
- },
45
- timeout: 10000, // 10 seconds
46
- });
47
-
48
- if (response.ok) {
49
- console.log('Data sent successfully:', response.data);
50
- } else {
51
- console.error('Send failed:', response.error);
52
- }
53
- ```
54
-
55
- #### SendServerOptions
56
-
57
- ```ts
58
- interface SendServerOptions {
59
- headers?: Record<string, string>; // Custom HTTP headers
60
- method?: string; // HTTP method (default: 'POST')
61
- timeout?: number; // Request timeout in milliseconds (default: 5000)
62
- }
18
+ ```bash
19
+ npm install @walkeros/server-core
63
20
  ```
64
21
 
65
- #### SendResponse
22
+ ## Quick start
66
23
 
67
24
  ```ts
68
- interface SendResponse {
69
- ok: boolean; // Indicates if the request was successful (2xx status)
70
- data?: unknown; // Parsed response data (if available)
71
- error?: string; // Error message (if request failed)
72
- }
73
- ```
74
-
75
- ## Cryptographic Operations
76
-
77
- ### getHashServer
78
-
79
- `getHashServer(str: string, length?: number): Promise<string>` generates SHA-256
80
- hashes using Node.js crypto module.
81
-
82
- ```js
83
- // Generate full SHA-256 hash
84
- const fullHash = await getHashServer('user123@example.com');
85
- // Returns full 64-character hash
86
-
87
- // Generate shortened hash for anonymization
88
- const userFingerprint = await getHashServer(
89
- userAgent + language + ipAddress + date.getDate(),
90
- 16,
91
- );
92
- // Returns 16-character hash like '47e0bdd10f04ef13'
93
-
94
- // User identification while preserving privacy
95
- const anonymousId = await getHashServer(`${userEmail}${deviceId}${salt}`, 12);
96
- ```
97
-
98
- This function is commonly used for:
99
-
100
- - **User Anonymization**: Creating privacy-safe user identifiers
101
- - **Fingerprinting**: Generating device/session fingerprints
102
- - **Data Deduplication**: Creating consistent identifiers
103
- - **Privacy Compliance**: Hashing PII for GDPR/CCPA compliance
104
-
105
- ## Usage Examples
106
-
107
- ### Event Processing Pipeline
108
-
109
- ```js
110
25
  import { sendServer, getHashServer } from '@walkeros/server-core';
111
26
 
112
- async function processUserEvent(event, userInfo) {
113
- // Anonymize user identification
114
- const anonymousUserId = await getHashServer(
115
- `${userInfo.email}${userInfo.deviceId}`,
116
- 16,
117
- );
118
-
119
- // Prepare event with anonymized data
120
- const processedEvent = {
121
- ...event,
122
- user: {
123
- ...event.user,
124
- id: anonymousUserId,
125
- },
126
- };
127
-
128
- // Send to analytics service
129
- const result = await sendServer(
130
- 'https://analytics.example.com/collect',
131
- processedEvent,
132
- {
133
- headers: {
134
- 'X-API-Key': process.env.ANALYTICS_API_KEY,
135
- },
136
- timeout: 8000,
137
- },
138
- );
139
-
140
- return result;
141
- }
142
- ```
143
-
144
- ### Privacy-Safe Session Tracking
145
-
146
- ```js
147
- async function createSessionId(request) {
148
- const fingerprint = [
149
- request.headers['user-agent'],
150
- request.ip.replace(/\.\d+$/, '.0'), // Anonymize IP
151
- new Date().toDateString(), // Daily rotation
152
- ].join('|');
153
-
154
- return await getHashServer(fingerprint, 20);
155
- }
156
- ```
157
-
158
- ## Error Handling
159
-
160
- Server utilities include comprehensive error handling:
161
-
162
- ```js
163
- try {
164
- const response = await sendServer(url, data, { timeout: 5000 });
165
-
166
- if (response.ok) {
167
- // Success - response.data contains the result
168
- console.log('Success:', response.data);
169
- } else {
170
- // Request completed but with error status
171
- console.warn('Request failed:', response.error);
172
- }
173
- } catch (error) {
174
- // Network error, timeout, or other exception
175
- console.error('Network error:', error.message);
176
- }
177
- ```
178
-
179
- ## Performance Considerations
180
-
181
- ### Timeout Configuration
182
-
183
- Configure appropriate timeouts based on your use case:
184
-
185
- ```js
186
- // Fast analytics endpoint
187
- await sendServer(url, data, { timeout: 2000 });
188
-
189
- // Critical business data
190
- await sendServer(url, data, { timeout: 15000 });
191
- ```
192
-
193
- ### Batch Processing
194
-
195
- For high-volume scenarios, consider batching:
27
+ const anonymousId = await getHashServer('user123@example.com', 16);
196
28
 
197
- ```js
198
- const events = [
199
- /* ... multiple events ... */
200
- ];
201
-
202
- const response = await sendServer(
203
- '/api/events/batch',
204
- {
205
- events,
206
- timestamp: Date.now(),
207
- },
208
- {
209
- timeout: 10000,
210
- },
211
- );
212
- ```
213
-
214
- ### Connection Reuse
215
-
216
- The underlying Node.js HTTP agent automatically reuses connections for better
217
- performance with multiple requests to the same host.
218
-
219
- ## Security Notes
220
-
221
- - **HTTPS Only**: Use HTTPS URLs in production for encrypted transmission
222
- - **API Keys**: Store sensitive credentials in environment variables
223
- - **Timeout Limits**: Set reasonable timeouts to prevent hanging requests
224
- - **Hash Salting**: Use application-specific salts when hashing sensitive data
225
-
226
- ```js
227
- // Good security practices
228
- const apiKey = process.env.ANALYTICS_API_KEY;
229
- const saltedHash = await getHashServer(`${userData}${process.env.HASH_SALT}`);
230
-
231
- await sendServer('https://secure-api.example.com/events', data, {
232
- headers: {
233
- Authorization: `Bearer ${apiKey}`,
234
- 'Content-Type': 'application/json',
235
- },
236
- timeout: 5000,
29
+ const response = await sendServer('https://api.example.com/events', {
30
+ name: 'page view',
31
+ data: { url: '/home', userId: anonymousId },
237
32
  });
238
33
  ```
239
34
 
240
- ## Integration with Core
241
-
242
- Server utilities work seamlessly with
243
- [Core Utilities](https://www.walkeros.io/docs/core):
244
-
245
- ```js
246
- import { getMappingValue, anonymizeIP } from '@walkeros/core';
247
- import { sendServer, getHashServer } from '@walkeros/server-core';
248
-
249
- async function processServerSideEvent(rawEvent, clientIP) {
250
- // Use core utilities for data processing
251
- const processedData = await getMappingValue(rawEvent, mappingConfig);
252
- const safeIP = anonymizeIP(clientIP);
253
-
254
- // Use server utilities for transmission
255
- const sessionId = await getHashServer(`${safeIP}${userAgent}`, 16);
256
-
257
- return await sendServer(endpoint, {
258
- ...processedData,
259
- sessionId,
260
- ip: safeIP,
261
- });
262
- }
263
- ```
264
-
265
- ---
35
+ ## Documentation
266
36
 
267
- For platform-agnostic utilities, see
268
- [Core Utilities](https://www.walkeros.io/docs/core).
37
+ Full configuration, mapping, and examples live in the docs:
38
+ **https://www.walkeros.io/docs/sources/server**
269
39
 
270
40
  ## Contribute
271
41
 
@@ -276,4 +46,4 @@ Feel free to contribute by submitting an
276
46
 
277
47
  ## License
278
48
 
279
- This project is licensed under the MIT License.
49
+ MIT
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/server-core",
3
3
  "description": "Server-specific utilities for walkerOS",
4
- "version": "4.1.0-next-1778668930820",
4
+ "version": "4.1.0",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -14,7 +14,8 @@
14
14
  }
15
15
  },
16
16
  "files": [
17
- "dist/**"
17
+ "dist/**",
18
+ "CHANGELOG.md"
18
19
  ],
19
20
  "scripts": {
20
21
  "build": "tsup --silent",
@@ -26,8 +27,8 @@
26
27
  "update": "npx npm-check-updates -u && npm update"
27
28
  },
28
29
  "devDependencies": {
29
- "@walkeros/collector": "4.1.0-next-1778668930820",
30
- "@walkeros/core": "4.1.0-next-1778668930820"
30
+ "@walkeros/collector": "4.1.0",
31
+ "@walkeros/core": "4.1.0"
31
32
  },
32
33
  "repository": {
33
34
  "url": "git+https://github.com/elbwalker/walkerOS.git",
@@ -51,6 +52,6 @@
51
52
  }
52
53
  ],
53
54
  "dependencies": {
54
- "@walkeros/core": "4.1.0-next-1778668930820"
55
+ "@walkeros/core": "4.1.0"
55
56
  }
56
57
  }