@walkeros/core 0.0.7 → 0.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/README.md CHANGED
@@ -1,108 +1,313 @@
1
1
  <p align="left">
2
2
  <a href="https://elbwalker.com">
3
- <img title="elbwalker" src='https://www.elbwalker.com/img/elbwalker_logo.png' width="256px"/>
3
+ <img title="elbwalker" src="https://www.elbwalker.com/img/elbwalker_logo.png" width="256px"/>
4
4
  </a>
5
5
  </p>
6
6
 
7
7
  # Core Types & Utilities for walkerOS
8
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.
9
+ [Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/core)
10
+ &bull; [NPM Package](https://www.npmjs.com/package/@walkeros/core)
13
11
 
14
- ## Role in walkerOS Ecosystem
12
+ Core utilities are a collection of platform-agnostic functions that can be used
13
+ across all walkerOS environments. They provide standardized building blocks for
14
+ data manipulation, validation, mapping, and more.
15
15
 
16
- walkerOS follows a **source → collector → destination** architecture:
16
+ ## Installation
17
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)
18
+ Import the core utilities directly from the `@walkeros/core` package:
23
19
 
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.
20
+ ```ts
21
+ import { assign, anonymizeIP, getMappingValue } from '@walkeros/core';
22
+ ```
27
23
 
28
- ## Installation
24
+ ## Core Utilities
25
+
26
+ ### Data Manipulation
27
+
28
+ #### assign
29
+
30
+ `assign<T, U>(target: T, source: U, options?): T & U` merges two objects with
31
+ advanced merging capabilities. It has special behavior for arrays: when merging,
32
+ it concatenates arrays from both objects, removing duplicates.
33
+
34
+ ```ts
35
+ interface AssignOptions {
36
+ merge?: boolean; // Merge array properties (default: true)
37
+ shallow?: boolean; // Create shallow copy (default: true)
38
+ extend?: boolean; // Extend with new properties (default: true)
39
+ }
40
+
41
+ const obj1 = { a: 1, b: [1, 2] };
42
+ const obj2 = { b: [2, 3], c: 3 };
43
+
44
+ assign(obj1, obj2); // Returns { a: 1, b: [1, 2, 3], c: 3 }
45
+ assign(obj1, obj2, { merge: false }); // Returns { a: 1, b: [2, 3], c: 3 }
46
+ ```
47
+
48
+ #### Path Operations
49
+
50
+ ##### getByPath
51
+
52
+ `getByPath(object: unknown, path: string, defaultValue?: unknown): unknown`
53
+ accesses nested properties using dot notation. Supports wildcard `*` for array
54
+ iteration.
55
+
56
+ ```js
57
+ getByPath({ data: { id: 'wow' } }, 'data.id'); // Returns "wow"
58
+ getByPath({ nested: [1, 2, { id: 'cool' }] }, 'nested.*.id'); // Returns ['', '', 'cool']
59
+ getByPath({ arr: ['foo', 'bar'] }, 'arr.1'); // Returns "bar"
60
+ ```
61
+
62
+ ##### setByPath
63
+
64
+ `setByPath(object: WalkerOS.Event, path: string, value: unknown): WalkerOS.Event`
65
+ sets nested values using dot notation, returning a new object with the updated
66
+ value.
67
+
68
+ ```js
69
+ const updatedEvent = setByPath(event, 'data.id', 'new-value');
70
+ // Returns a new event with data.id set to 'new-value'
71
+ ```
72
+
73
+ #### clone
74
+
75
+ `clone<T>(original: T): T` creates a deep copy of objects/arrays with circular
76
+ reference handling.
29
77
 
30
- ```sh
31
- npm install @walkeros/core
78
+ ```js
79
+ const original = { foo: true, arr: ['a', 'b'] };
80
+ const cloned = clone(original);
81
+ original.foo = false; // cloned.foo remains true
32
82
  ```
33
83
 
34
- ## Usage
84
+ #### castValue
35
85
 
36
- The core package exports essential types and utilities:
86
+ `castValue(value: unknown): WalkerOS.PropertyType` converts string values to
87
+ appropriate types (number, boolean).
37
88
 
38
- ```typescript
39
- import {
40
- // Core event types
41
- WalkerOS,
89
+ ```js
90
+ castValue('123'); // Returns 123 (number)
91
+ castValue('true'); // Returns true (boolean)
92
+ castValue('hello'); // Returns 'hello' (unchanged)
93
+ ```
94
+
95
+ ### Privacy & Security
96
+
97
+ #### anonymizeIP
98
+
99
+ `anonymizeIP(ip: string): string` anonymizes IPv4 addresses by setting the last
100
+ oclet to zero.
101
+
102
+ ```js
103
+ anonymizeIP('192.168.1.100'); // Returns '192.168.1.0'
104
+ ```
105
+
106
+ #### Hashing
107
+
108
+ `getId(length?: number): string` generates random alphanumeric strings for
109
+ unique identifiers.
110
+
111
+ ```js
112
+ getId(); // Returns random 6-char string like 'a1b2c3'
113
+ getId(10); // Returns 10-character string
114
+ ```
115
+
116
+ ### Event Processing
42
117
 
43
- // Utility functions
44
- assign,
45
- clone,
46
- validateEvent,
118
+ #### getMappingValue
47
119
 
48
- // Consent management
49
- Consent,
120
+ `getMappingValue(event: WalkerOS.Event, mapping: Mapping.Data, options?: Mapping.Options): Promise<WalkerOS.Property | undefined>`
121
+ extracts values from events using
122
+ [mapping configurations](https://www.elbwalker.com/docs/destinations/event-mapping).
50
123
 
51
- // Mapping utilities
52
- byPath,
53
- mapping,
54
- } from '@walkeros/core';
124
+ ```ts
125
+ // Simple path mapping
126
+ await getMappingValue(event, 'data.productId');
55
127
 
56
- // Example: Validate an event
57
- const event: WalkerOS.Event = {
58
- event: 'order complete',
59
- data: { value: 9001 },
60
- // ... other properties
128
+ // Complex mapping with conditions and loops
129
+ const mapping = {
130
+ map: {
131
+ orderId: 'data.id',
132
+ products: {
133
+ loop: [
134
+ 'nested',
135
+ {
136
+ condition: (entity) => entity.entity === 'product',
137
+ map: { id: 'data.id', name: 'data.name' },
138
+ },
139
+ ],
140
+ },
141
+ },
61
142
  };
143
+ await getMappingValue(event, mapping);
144
+ ```
62
145
 
63
- if (validateEvent(event)) {
64
- console.log('Event is valid!');
65
- }
146
+ #### getMappingEvent
147
+
148
+ `getMappingEvent(event: WalkerOS.PartialEvent, mapping?: Mapping.Rules): Promise<Mapping.Result>`
149
+ finds the appropriate mapping rule for an event.
150
+
151
+ ### Marketing & Analytics
152
+
153
+ #### getMarketingParameters
154
+
155
+ `getMarketingParameters(url: URL, custom?: MarketingParameters): WalkerOS.Properties`
156
+ extracts UTM and click ID parameters from URLs.
157
+
158
+ ```js
159
+ getMarketingParameters(
160
+ new URL('https://example.com/?utm_source=docs&gclid=123'),
161
+ );
162
+ // Returns { source: "docs", gclid: "123", clickId: "gclid" }
163
+
164
+ // With custom parameters
165
+ getMarketingParameters(url, { utm_custom: 'custom', partner: 'partnerId' });
66
166
  ```
67
167
 
68
- ## Event Naming Convention
168
+ ### Type Validation
169
+
170
+ #### Type Checkers
171
+
172
+ A comprehensive set of type checking functions:
173
+
174
+ - `isString(value)`, `isNumber(value)`, `isBoolean(value)`
175
+ - `isArray(value)`, `isObject(value)`, `isFunction(value)`
176
+ - `isDefined(value)`, `isSameType(a, b)`
177
+ - `isPropertyType(value)` - Checks if value is valid walkerOS property
69
178
 
70
- walkerOS follows a strict **"entity action"** naming convention for events:
179
+ #### Property Utilities
71
180
 
72
- **Correct**: Use spaces to separate entity and action
181
+ - `castToProperty(value)` - Casts to valid property type
182
+ - `filterValues(object)` - Filters object to valid properties only
183
+ - `isPropertyType(value)` - Type guard for property validation
73
184
 
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' });
185
+ ### Request Handling
186
+
187
+ #### requestToData
188
+
189
+ `requestToData(parameter: unknown): WalkerOS.AnyObject | undefined` converts
190
+ query strings to JavaScript objects with type casting.
191
+
192
+ ```js
193
+ requestToData('a=1&b=true&c=hello&arr[0]=x&arr[1]=y');
194
+ // Returns { a: 1, b: true, c: 'hello', arr: ['x', 'y'] }
195
+ ```
196
+
197
+ #### requestToParameter
198
+
199
+ `requestToParameter(data: WalkerOS.AnyObject): string` converts objects to
200
+ URL-encoded query strings.
201
+
202
+ ```js
203
+ requestToParameter({ a: 1, b: true, arr: ['x', 'y'] });
204
+ // Returns 'a=1&b=true&arr[0]=x&arr[1]=y'
205
+ ```
206
+
207
+ ### User Agent Parsing
208
+
209
+ #### parseUserAgent
210
+
211
+ `parseUserAgent(userAgent?: string): WalkerOS.User` extracts browser, OS, and
212
+ device information.
213
+
214
+ ```js
215
+ parseUserAgent(navigator.userAgent);
216
+ // Returns { browser: 'Chrome', browserVersion: '91.0', os: 'Windows', ... }
79
217
  ```
80
218
 
81
- **Incorrect**: Do not use underscores or other separators
219
+ Individual functions are also available:
220
+
221
+ - `getBrowser(userAgent)` - Returns browser name
222
+ - `getBrowserVersion(userAgent)` - Returns browser version
223
+ - `getOS(userAgent)` - Returns operating system
224
+ - `getOSVersion(userAgent)` - Returns OS version
225
+ - `getDeviceType(userAgent)` - Returns 'Desktop', 'Tablet', or 'Mobile'
226
+
227
+ ### Error Handling
82
228
 
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
229
+ #### tryCatch
230
+
231
+ `tryCatch(tryFn: Function, catchFn?: Function, finallyFn?: Function)` wraps
232
+ functions with error handling.
233
+
234
+ ```js
235
+ const safeParse = tryCatch(JSON.parse, () => ({}));
236
+ safeParse('{"valid": "json"}'); // Parses successfully
237
+ safeParse('invalid'); // Returns {} instead of throwing
88
238
  ```
89
239
 
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.
240
+ #### tryCatchAsync
241
+
242
+ `tryCatchAsync(tryFn: Function, catchFn?: Function, finallyFn?: Function)` for
243
+ async operations.
244
+
245
+ ```js
246
+ const safeAsyncCall = tryCatchAsync(
247
+ () => fetchUserData(),
248
+ (error) => ({ error: 'Failed to load user' }),
249
+ );
250
+ ```
251
+
252
+ ### Performance Optimization
253
+
254
+ #### debounce
255
+
256
+ `debounce(fn: Function, wait?: number)` delays function execution until after
257
+ the wait time.
258
+
259
+ ```js
260
+ const debouncedSearch = debounce(searchFunction, 300);
261
+ // Only executes after 300ms of inactivity
262
+ ```
263
+
264
+ #### throttle
265
+
266
+ `throttle(fn: Function, wait?: number)` limits function execution frequency.
267
+
268
+ ```js
269
+ const throttledScroll = throttle(scrollHandler, 100);
270
+ // Executes at most every 100ms
271
+ ```
272
+
273
+ ### Utilities
274
+
275
+ #### trim
276
+
277
+ `trim(str: string): string` removes whitespace from string ends.
278
+
279
+ #### throwError
280
+
281
+ `throwError(message: string)` throws descriptive errors.
282
+
283
+ #### onLog
284
+
285
+ `onLog(message: unknown, verbose?: boolean)` provides consistent logging.
286
+
287
+ ```js
288
+ onLog('Debug info', true); // Logs message
289
+ onLog('Silent message'); // No output
290
+ ```
291
+
292
+ ### Validation
293
+
294
+ #### validateEvent
295
+
296
+ `validateEvent(obj: unknown, customContracts?: Schema.Contracts): WalkerOS.Event | never`
297
+ validates event structure and throws on invalid events.
298
+
299
+ #### validateProperty
300
+
301
+ Validates that values conform to walkerOS property types.
302
+
303
+ ---
94
304
 
95
- ## Core Features
305
+ For platform-specific utilities, see:
96
306
 
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
307
+ - [Web Core](https://www.elbwalker.com/docs/core/web) - Browser-specific
308
+ functions
309
+ - [Server Core](https://www.elbwalker.com/docs/core/server) - Node.js server
310
+ functions
106
311
 
107
312
  ## Contribute
108
313
 
package/dist/index.d.mts CHANGED
@@ -2,8 +2,6 @@
2
2
  * Core collector configuration interface
3
3
  */
4
4
  interface Config$4 {
5
- /** Run in dry mode without executing events */
6
- dryRun: boolean;
7
5
  /** Whether to run collector automatically */
8
6
  run?: boolean;
9
7
  /** Initial consent state */
@@ -56,7 +54,7 @@ interface CollectorSource {
56
54
  }
57
55
  type CommandType = 'action' | 'config' | 'consent' | 'context' | 'destination' | 'elb' | 'globals' | 'hook' | 'init' | 'link' | 'run' | 'user' | 'walker' | string;
58
56
  interface Instance$2 {
59
- push: Fn$2;
57
+ push: Fn$1;
60
58
  allowed: boolean;
61
59
  config: Config$4;
62
60
  consent: Consent;
@@ -141,6 +139,7 @@ interface Instance$1<Settings = unknown, Mapping = unknown> {
141
139
  queue?: Events;
142
140
  dlq?: DLQ;
143
141
  type?: string;
142
+ env?: Environment;
144
143
  init?: InitFn<Settings, Mapping>;
145
144
  push: PushFn<Settings, Mapping>;
146
145
  pushBatch?: PushBatchFn<Settings, Mapping>;
@@ -149,16 +148,15 @@ interface Config$3<Settings = unknown, Mapping = unknown> {
149
148
  consent?: Consent;
150
149
  settings?: Settings;
151
150
  data?: Value | Values;
152
- dryRun?: boolean;
151
+ env?: Environment;
153
152
  id?: string;
154
153
  init?: boolean;
155
154
  loadScript?: boolean;
156
155
  mapping?: Rules<Rule<Mapping>>;
157
- on?: Config$2;
156
+ on?: Config$1;
158
157
  policy?: Policy;
159
158
  queue?: boolean;
160
159
  verbose?: boolean;
161
- wrapper?: Config;
162
160
  onError?: Error;
163
161
  onLog?: Log;
164
162
  }
@@ -180,7 +178,7 @@ interface Context$1<Settings = unknown, Mapping = unknown> {
180
178
  collector: Instance$2;
181
179
  config: Config$3<Settings, Mapping>;
182
180
  data?: Data$1;
183
- wrap: Wrap;
181
+ env: Environment;
184
182
  }
185
183
  interface PushContext<Settings = unknown, Mapping = unknown> extends Context$1<Settings, Mapping> {
186
184
  mapping?: Rule<Mapping>;
@@ -217,10 +215,25 @@ type Result$1 = {
217
215
  queued: Array<Ref>;
218
216
  failed: Array<Ref>;
219
217
  };
218
+ /**
219
+ * Base environment requirements interface for walkerOS destinations
220
+ *
221
+ * This defines the core interface that destinations can use to declare
222
+ * their runtime environment requirements. Platform-specific extensions
223
+ * should extend this interface.
224
+ */
225
+ interface Environment {
226
+ /**
227
+ * Generic global properties that destinations may require
228
+ * Platform-specific implementations can extend this interface
229
+ */
230
+ [key: string]: unknown;
231
+ }
220
232
 
221
233
  type destination_Batch<Mapping> = Batch<Mapping>;
222
234
  type destination_DLQ = DLQ;
223
235
  type destination_Destinations = Destinations;
236
+ type destination_Environment = Environment;
224
237
  type destination_InitDestination<Settings = unknown, Mapping = unknown> = InitDestination<Settings, Mapping>;
225
238
  type destination_InitDestinations = InitDestinations;
226
239
  type destination_InitFn<Settings, Mapping> = InitFn<Settings, Mapping>;
@@ -235,7 +248,7 @@ type destination_PushEvents<Mapping = unknown> = PushEvents<Mapping>;
235
248
  type destination_PushFn<Settings, Mapping> = PushFn<Settings, Mapping>;
236
249
  type destination_Ref = Ref;
237
250
  declare namespace destination {
238
- export type { destination_Batch as Batch, Config$3 as Config, Context$1 as Context, destination_DLQ as DLQ, Data$1 as Data, destination_Destinations as Destinations, Init$1 as Init, destination_InitDestination as InitDestination, destination_InitDestinations as InitDestinations, destination_InitFn as InitFn, Instance$1 as Instance, destination_PartialConfig as PartialConfig, destination_Policy as Policy, destination_Push as Push, destination_PushBatchContext as PushBatchContext, destination_PushBatchFn as PushBatchFn, destination_PushContext as PushContext, destination_PushEvent as PushEvent, destination_PushEvents as PushEvents, destination_PushFn as PushFn, destination_Ref as Ref, Result$1 as Result };
251
+ export type { destination_Batch as Batch, Config$3 as Config, Context$1 as Context, destination_DLQ as DLQ, Data$1 as Data, destination_Destinations as Destinations, destination_Environment as Environment, Init$1 as Init, destination_InitDestination as InitDestination, destination_InitDestinations as InitDestinations, destination_InitFn as InitFn, Instance$1 as Instance, destination_PartialConfig as PartialConfig, destination_Policy as Policy, destination_Push as Push, destination_PushBatchContext as PushBatchContext, destination_PushBatchFn as PushBatchFn, destination_PushContext as PushContext, destination_PushEvent as PushEvent, destination_PushEvents as PushEvents, destination_PushFn as PushFn, destination_Ref as Ref, Result$1 as Result };
239
252
  }
240
253
 
241
254
  interface EventFn<R = Promise<PushResult>> {
@@ -243,7 +256,7 @@ interface EventFn<R = Promise<PushResult>> {
243
256
  (event: string): R;
244
257
  (event: string, data: Properties): R;
245
258
  }
246
- interface Fn$2<R = Promise<PushResult>, Config = unknown> extends EventFn<R>, WalkerCommands<R, Config> {
259
+ interface Fn$1<R = Promise<PushResult>, Config = unknown> extends EventFn<R>, WalkerCommands<R, Config> {
247
260
  }
248
261
  interface WalkerCommands<R = Promise<PushResult>, Config = unknown> {
249
262
  (event: 'walker config', config: Partial<Config>): R;
@@ -277,7 +290,22 @@ type elb_PushResult = PushResult;
277
290
  type elb_RegisterDestination<Destination, Config> = RegisterDestination<Destination, Config>;
278
291
  type elb_WalkerCommands<R = Promise<PushResult>, Config = unknown> = WalkerCommands<R, Config>;
279
292
  declare namespace elb {
280
- export type { Event$1 as Event, elb_EventFn as EventFn, Fn$2 as Fn, elb_Layer as Layer, elb_PushData as PushData, elb_PushResult as PushResult, elb_RegisterDestination as RegisterDestination, elb_WalkerCommands as WalkerCommands };
293
+ export type { Event$1 as Event, elb_EventFn as EventFn, Fn$1 as Fn, elb_Layer as Layer, elb_PushData as PushData, elb_PushResult as PushResult, elb_RegisterDestination as RegisterDestination, elb_WalkerCommands as WalkerCommands };
294
+ }
295
+
296
+ /**
297
+ * Flow configuration interface for dynamic walkerOS setup
298
+ * Used by bundlers and other tools to configure walkerOS dynamically
299
+ */
300
+ interface Config$2 {
301
+ /** Collector configuration - uses existing Collector.Config from core */
302
+ collector: Config$4;
303
+ /** NPM packages required for this configuration */
304
+ packages: Record<string, string>;
305
+ }
306
+
307
+ declare namespace flow {
308
+ export type { Config$2 as Config };
281
309
  }
282
310
 
283
311
  type Error = (error: unknown, state?: unknown) => void;
@@ -330,7 +358,7 @@ type ValueType = string | ValueConfig;
330
358
  interface ValueConfig {
331
359
  condition?: Condition;
332
360
  consent?: Consent;
333
- fn?: Fn$1;
361
+ fn?: Fn;
334
362
  key?: string;
335
363
  loop?: Loop;
336
364
  map?: Map;
@@ -339,7 +367,7 @@ interface ValueConfig {
339
367
  value?: PropertyType;
340
368
  }
341
369
  type Condition = (value: DeepPartialEvent | unknown, mapping?: Value, collector?: Instance$2) => PromiseOrValue<boolean>;
342
- type Fn$1 = (value: DeepPartialEvent | unknown, mapping: Value, options: Options$1) => PromiseOrValue<Property | unknown>;
370
+ type Fn = (value: DeepPartialEvent | unknown, mapping: Value, options: Options$1) => PromiseOrValue<Property | unknown>;
343
371
  type Loop = [Value, Value];
344
372
  type Map = {
345
373
  [key: string]: Value;
@@ -353,6 +381,7 @@ type Validate = (value?: unknown) => PromiseOrValue<boolean>;
353
381
 
354
382
  type mapping_Condition = Condition;
355
383
  type mapping_Data = Data;
384
+ type mapping_Fn = Fn;
356
385
  type mapping_Loop = Loop;
357
386
  type mapping_Map = Map;
358
387
  type mapping_Result = Result;
@@ -364,16 +393,16 @@ type mapping_ValueConfig = ValueConfig;
364
393
  type mapping_ValueType = ValueType;
365
394
  type mapping_Values = Values;
366
395
  declare namespace mapping {
367
- export type { mapping_Condition as Condition, mapping_Data as Data, Fn$1 as Fn, mapping_Loop as Loop, mapping_Map as Map, Options$1 as Options, mapping_Result as Result, mapping_Rule as Rule, mapping_Rules as Rules, mapping_Validate as Validate, mapping_Value as Value, mapping_ValueConfig as ValueConfig, mapping_ValueType as ValueType, mapping_Values as Values };
396
+ export type { mapping_Condition as Condition, mapping_Data as Data, mapping_Fn as Fn, mapping_Loop as Loop, mapping_Map as Map, Options$1 as Options, mapping_Result as Result, mapping_Rule as Rule, mapping_Rules as Rules, mapping_Validate as Validate, mapping_Value as Value, mapping_ValueConfig as ValueConfig, mapping_ValueType as ValueType, mapping_Values as Values };
368
397
  }
369
398
 
370
- type Config$2 = {
399
+ type Config$1 = {
371
400
  consent?: Array<ConsentConfig>;
372
401
  ready?: Array<ReadyConfig>;
373
402
  run?: Array<RunConfig>;
374
403
  session?: Array<SessionConfig>;
375
404
  };
376
- type Types = keyof Config$2;
405
+ type Types = keyof Config$1;
377
406
  type Options = ConsentConfig | ReadyConfig | RunConfig | SessionConfig;
378
407
  interface ConsentConfig {
379
408
  [key: string]: ConsentFn;
@@ -405,7 +434,7 @@ type on_SessionConfig = SessionConfig;
405
434
  type on_SessionFn = SessionFn;
406
435
  type on_Types = Types;
407
436
  declare namespace on {
408
- export type { Config$2 as Config, on_ConsentConfig as ConsentConfig, on_ConsentFn as ConsentFn, on_OnConfig as OnConfig, on_Options as Options, on_ReadyConfig as ReadyConfig, on_ReadyFn as ReadyFn, on_RunConfig as RunConfig, on_RunFn as RunFn, on_SessionConfig as SessionConfig, on_SessionFn as SessionFn, on_Types as Types };
437
+ export type { Config$1 as Config, on_ConsentConfig as ConsentConfig, on_ConsentFn as ConsentFn, on_OnConfig as OnConfig, on_Options as Options, on_ReadyConfig as ReadyConfig, on_ReadyFn as ReadyFn, on_RunConfig as RunConfig, on_RunFn as RunFn, on_SessionConfig as SessionConfig, on_SessionFn as SessionFn, on_Types as Types };
409
438
  }
410
439
 
411
440
  interface Context {
@@ -454,34 +483,35 @@ declare namespace schema {
454
483
  export type { schema_Contract as Contract, schema_Contracts as Contracts, Properties$1 as Properties, Property$1 as Property };
455
484
  }
456
485
 
457
- interface Config$1 {
486
+ interface Config {
458
487
  type: string;
459
488
  id?: string;
460
489
  disabled?: boolean;
461
490
  settings: AnyObject;
462
491
  onError?: AnyFunction;
463
492
  }
464
- type InitConfig = Partial<Config$1>;
465
- interface Init<T extends Config$1 = Config$1, E = AnyFunction> {
493
+ type InitConfig = Partial<Config>;
494
+ interface Init<T extends Config = Config, E = AnyFunction> {
466
495
  (collector: Instance$2, config: T): CreateSource<T, E> | Promise<CreateSource<T, E>>;
467
496
  }
468
- interface CreateSource<T extends Config$1 = Config$1, E = AnyFunction> {
497
+ interface CreateSource<T extends Config = Config, E = AnyFunction> {
469
498
  source?: Instance<T>;
470
499
  elb?: E;
471
500
  }
472
- interface Instance<T extends Config$1 = Config$1> {
501
+ interface Instance<T extends Config = Config> {
473
502
  type: string;
474
503
  config: T;
475
504
  collector: Instance$2;
476
505
  destroy?(): void | Promise<void>;
477
506
  }
478
507
 
479
- type source_CreateSource<T extends Config$1 = Config$1, E = AnyFunction> = CreateSource<T, E>;
480
- type source_Init<T extends Config$1 = Config$1, E = AnyFunction> = Init<T, E>;
508
+ type source_Config = Config;
509
+ type source_CreateSource<T extends Config = Config, E = AnyFunction> = CreateSource<T, E>;
510
+ type source_Init<T extends Config = Config, E = AnyFunction> = Init<T, E>;
481
511
  type source_InitConfig = InitConfig;
482
- type source_Instance<T extends Config$1 = Config$1> = Instance<T>;
512
+ type source_Instance<T extends Config = Config> = Instance<T>;
483
513
  declare namespace source {
484
- export type { Config$1 as Config, source_CreateSource as CreateSource, source_Init as Init, source_InitConfig as InitConfig, source_Instance as Instance };
514
+ export type { source_Config as Config, source_CreateSource as CreateSource, source_Init as Init, source_InitConfig as InitConfig, source_Instance as Instance };
485
515
  }
486
516
 
487
517
  type AnyObject<T = unknown> = Record<string, T>;
@@ -490,7 +520,7 @@ type AnyFunction = (...args: unknown[]) => unknown;
490
520
  type SingleOrArray<T> = T | Array<T>;
491
521
  declare global {
492
522
  namespace WalkerOS {
493
- interface Elb extends Fn$2 {
523
+ interface Elb extends Fn$1 {
494
524
  }
495
525
  }
496
526
  }
@@ -498,7 +528,7 @@ type Events = Array<Event>;
498
528
  type PartialEvent = Partial<Event>;
499
529
  type DeepPartialEvent = DeepPartial<Event>;
500
530
  interface Event {
501
- event: string;
531
+ name: string;
502
532
  data: Properties;
503
533
  context: OrderedProperties;
504
534
  globals: Properties;
@@ -566,7 +596,7 @@ interface OrderedProperties {
566
596
  }
567
597
  type Entities = Array<Entity>;
568
598
  interface Entity {
569
- type: string;
599
+ entity: string;
570
600
  data: Properties;
571
601
  nested: Entities;
572
602
  context: OrderedProperties;
@@ -605,26 +635,6 @@ declare namespace walkeros {
605
635
  export type { walkeros_ActionHandler as ActionHandler, walkeros_AnyFunction as AnyFunction, walkeros_AnyObject as AnyObject, walkeros_Consent as Consent, walkeros_ConsentHandler as ConsentHandler, walkeros_DeepPartial as DeepPartial, walkeros_DeepPartialEvent as DeepPartialEvent, walkeros_Elb as Elb, walkeros_Entities as Entities, walkeros_Entity as Entity, walkeros_Event as Event, walkeros_Events as Events, walkeros_OrderedProperties as OrderedProperties, walkeros_PartialEvent as PartialEvent, walkeros_PromiseOrValue as PromiseOrValue, walkeros_Properties as Properties, walkeros_Property as Property, walkeros_PropertyType as PropertyType, walkeros_SingleOrArray as SingleOrArray, walkeros_Source as Source, walkeros_SourceType as SourceType, walkeros_User as User, walkeros_Version as Version };
606
636
  }
607
637
 
608
- interface Fn {
609
- name: string;
610
- type?: string;
611
- }
612
- type OnCall = (context: Fn, args: unknown[]) => void;
613
- interface Config {
614
- dryRun?: boolean;
615
- mockReturn?: unknown;
616
- onCall?: OnCall;
617
- }
618
- type Wrap = <T>(name: string, originalFn: T) => T;
619
-
620
- type wrapper_Config = Config;
621
- type wrapper_Fn = Fn;
622
- type wrapper_OnCall = OnCall;
623
- type wrapper_Wrap = Wrap;
624
- declare namespace wrapper {
625
- export type { wrapper_Config as Config, wrapper_Fn as Fn, wrapper_OnCall as OnCall, wrapper_Wrap as Wrap };
626
- }
627
-
628
638
  type StorageType = 'local' | 'session' | 'cookie';
629
639
  declare const Const: {
630
640
  readonly Utils: {
@@ -778,7 +788,7 @@ declare function createDestination<Settings = unknown, Mapping = unknown>(baseDe
778
788
  * });
779
789
  * ```
780
790
  */
781
- declare function createSource<T extends Config$1, E = unknown>(source: Init<T, E>, config: Partial<T>): Init<T, E>;
791
+ declare function createSource<T extends Config, E = unknown>(source: Init<T, E>, config: Partial<T>): Init<T, E>;
782
792
 
783
793
  /**
784
794
  * Creates a complete event with default values.
@@ -1110,13 +1120,4 @@ declare function validateEvent(obj: unknown, customContracts?: Contracts): Event
1110
1120
  */
1111
1121
  declare function validateProperty(obj: AnyObject, key: string, value: unknown, schema: Property$1): Property | never;
1112
1122
 
1113
- /**
1114
- * Creates a wrapper function that can be used to wrap other functions.
1115
- *
1116
- * @param type The type of the wrapper.
1117
- * @param config The configuration for the wrapper.
1118
- * @returns A wrapper function.
1119
- */
1120
- declare function createWrapper(type?: string, { dryRun, mockReturn, onCall }?: Config): Wrap;
1121
-
1122
- export { collector as Collector, Const, data as Data, destination as Destination, elb as Elb, handler as Handler, hooks as Hooks, mapping as Mapping, type MarketingParameters, on as On, request as Request, schema as Schema, type SendDataValue, type SendHeaders, type SendResponse, source as Source, type StorageType, walkeros as WalkerOS, wrapper as Wrapper, anonymizeIP, assign, castToProperty, castValue, clone, createDestination, createEvent, createSource, createWrapper, debounce, filterValues, getBrowser, getBrowserVersion, getByPath, getDeviceType, getEvent, getGrantedConsent, getHeaders, getId, getMappingEvent, getMappingValue, getMarketingParameters, getOS, getOSVersion, isArguments, isArray, isBoolean, isCommand, isDefined, isElementOrDocument, isFunction, isNumber, isObject, isPropertyType, isSameType, isString, onLog, parseUserAgent, requestToData, requestToParameter, setByPath, throttle, throwError, transformData, trim, tryCatch, tryCatchAsync, useHooks, validateEvent, validateProperty };
1123
+ export { collector as Collector, Const, data as Data, destination as Destination, elb as Elb, flow as Flow, handler as Handler, hooks as Hooks, mapping as Mapping, type MarketingParameters, on as On, request as Request, schema as Schema, type SendDataValue, type SendHeaders, type SendResponse, source as Source, type StorageType, walkeros as WalkerOS, anonymizeIP, assign, castToProperty, castValue, clone, createDestination, createEvent, createSource, debounce, filterValues, getBrowser, getBrowserVersion, getByPath, getDeviceType, getEvent, getGrantedConsent, getHeaders, getId, getMappingEvent, getMappingValue, getMarketingParameters, getOS, getOSVersion, isArguments, isArray, isBoolean, isCommand, isDefined, isElementOrDocument, isFunction, isNumber, isObject, isPropertyType, isSameType, isString, onLog, parseUserAgent, requestToData, requestToParameter, setByPath, throttle, throwError, transformData, trim, tryCatch, tryCatchAsync, useHooks, validateEvent, validateProperty };