@walkeros/core 0.0.7
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/README.md +116 -0
- package/dist/index.d.mts +1122 -0
- package/dist/index.d.ts +1122 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<p align="left">
|
|
2
|
+
<a href="https://elbwalker.com">
|
|
3
|
+
<img title="elbwalker" src='https://www.elbwalker.com/img/elbwalker_logo.png' width="256px"/>
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
# Core Types & Utilities for walkerOS
|
|
8
|
+
|
|
9
|
+
The walkerOS Core package provides the foundational TypeScript definitions and
|
|
10
|
+
platform-agnostic utilities that power the entire walkerOS ecosystem. It serves
|
|
11
|
+
as the bedrock for type safety and shared functionality across all sources,
|
|
12
|
+
collectors, and destinations.
|
|
13
|
+
|
|
14
|
+
## Role in walkerOS Ecosystem
|
|
15
|
+
|
|
16
|
+
walkerOS follows a **source → collector → destination** architecture:
|
|
17
|
+
|
|
18
|
+
- **Sources**: Capture events from various environments (browser DOM, dataLayer,
|
|
19
|
+
server requests)
|
|
20
|
+
- **Collector**: Processes, validates, and routes events with consent awareness
|
|
21
|
+
- **Destinations**: Send processed events to analytics platforms (GA4, Meta,
|
|
22
|
+
custom APIs)
|
|
23
|
+
|
|
24
|
+
The Core package provides the essential building blocks that all other packages
|
|
25
|
+
depend on, ensuring consistent data structures, type definitions, and utility
|
|
26
|
+
functions across the entire platform.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npm install @walkeros/core
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
The core package exports essential types and utilities:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import {
|
|
40
|
+
// Core event types
|
|
41
|
+
WalkerOS,
|
|
42
|
+
|
|
43
|
+
// Utility functions
|
|
44
|
+
assign,
|
|
45
|
+
clone,
|
|
46
|
+
validateEvent,
|
|
47
|
+
|
|
48
|
+
// Consent management
|
|
49
|
+
Consent,
|
|
50
|
+
|
|
51
|
+
// Mapping utilities
|
|
52
|
+
byPath,
|
|
53
|
+
mapping,
|
|
54
|
+
} from '@walkeros/core';
|
|
55
|
+
|
|
56
|
+
// Example: Validate an event
|
|
57
|
+
const event: WalkerOS.Event = {
|
|
58
|
+
event: 'order complete',
|
|
59
|
+
data: { value: 9001 },
|
|
60
|
+
// ... other properties
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
if (validateEvent(event)) {
|
|
64
|
+
console.log('Event is valid!');
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Event Naming Convention
|
|
69
|
+
|
|
70
|
+
walkerOS follows a strict **"entity action"** naming convention for events:
|
|
71
|
+
|
|
72
|
+
✅ **Correct**: Use spaces to separate entity and action
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
elb('order complete', { value: 99.99 });
|
|
76
|
+
elb('product add', { id: 'abc123' });
|
|
77
|
+
elb('page view', { path: '/home' });
|
|
78
|
+
elb('user register', { email: 'user@example.com' });
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
❌ **Incorrect**: Do not use underscores or other separators
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
// Don't do this
|
|
85
|
+
elb('order_complete', data); // Wrong: underscores
|
|
86
|
+
elb('orderComplete', data); // Wrong: camelCase
|
|
87
|
+
elb('purchase', data); // Wrong: single word
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Why spaces matter**: walkerOS destinations automatically transform your
|
|
91
|
+
semantic event names into platform-specific formats. For example,
|
|
92
|
+
`'order complete'` becomes `'purchase'` for Google Analytics 4, while preserving
|
|
93
|
+
the original meaning in your data model.
|
|
94
|
+
|
|
95
|
+
## Core Features
|
|
96
|
+
|
|
97
|
+
- **TypeScript Definitions**: Complete type system for walkerOS events and
|
|
98
|
+
configurations
|
|
99
|
+
- **Platform-Agnostic Utilities**: Shared functions for data manipulation and
|
|
100
|
+
validation
|
|
101
|
+
- **Consent Types**: Standardized consent management interfaces
|
|
102
|
+
- **Event Validation**: Built-in validation for event structure and data
|
|
103
|
+
integrity
|
|
104
|
+
- **Mapping Utilities**: Tools for transforming data between different formats
|
|
105
|
+
- **Privacy Utilities**: Functions for data anonymization and privacy compliance
|
|
106
|
+
|
|
107
|
+
## Contribute
|
|
108
|
+
|
|
109
|
+
Feel free to contribute by submitting an
|
|
110
|
+
[issue](https://github.com/elbwalker/walkerOS/issues), starting a
|
|
111
|
+
[discussion](https://github.com/elbwalker/walkerOS/discussions), or getting in
|
|
112
|
+
[contact](https://calendly.com/elb-alexander/30min).
|
|
113
|
+
|
|
114
|
+
## License
|
|
115
|
+
|
|
116
|
+
This project is licensed under the MIT License.
|