@walkeros/core 3.0.2 → 3.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/dist/dev.d.mts +329 -12
- package/dist/dev.d.ts +329 -12
- 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/index.d.mts +161 -87
- package/dist/index.d.ts +161 -87
- 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/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -93,16 +93,16 @@ interface DestinationStatus {
|
|
|
93
93
|
duration: number;
|
|
94
94
|
}
|
|
95
95
|
interface Sources {
|
|
96
|
-
[id: string]: Instance$
|
|
96
|
+
[id: string]: Instance$2;
|
|
97
97
|
}
|
|
98
98
|
interface Destinations$1 {
|
|
99
|
-
[id: string]: Instance$
|
|
99
|
+
[id: string]: Instance$5;
|
|
100
100
|
}
|
|
101
101
|
interface Transformers$1 {
|
|
102
|
-
[id: string]: Instance$
|
|
102
|
+
[id: string]: Instance$3;
|
|
103
103
|
}
|
|
104
104
|
interface Stores$1 {
|
|
105
|
-
[id: string]: Instance;
|
|
105
|
+
[id: string]: Instance$1;
|
|
106
106
|
}
|
|
107
107
|
type CommandType = 'action' | 'config' | 'consent' | 'context' | 'destination' | 'elb' | 'globals' | 'hook' | 'init' | 'link' | 'run' | 'user' | 'walker' | string;
|
|
108
108
|
/**
|
|
@@ -128,7 +128,7 @@ interface PushFn$1 {
|
|
|
128
128
|
interface CommandFn {
|
|
129
129
|
(command: 'config', config: Partial<Config$8>): Promise<PushResult>;
|
|
130
130
|
(command: 'consent', consent: Consent): Promise<PushResult>;
|
|
131
|
-
<T extends Types$4>(command: 'destination', destination: Init$3<T> | Instance$
|
|
131
|
+
<T extends Types$4>(command: 'destination', destination: Init$3<T> | Instance$5<T>, config?: Config$7<T>): Promise<PushResult>;
|
|
132
132
|
<K extends keyof Functions>(command: 'hook', name: K, hookFn: Functions[K]): Promise<PushResult>;
|
|
133
133
|
(command: 'on', type: Types$3, rules: SingleOrArray<Options>): Promise<PushResult>;
|
|
134
134
|
(command: 'user', user: User): Promise<PushResult>;
|
|
@@ -140,7 +140,7 @@ interface CommandFn {
|
|
|
140
140
|
}): Promise<PushResult>;
|
|
141
141
|
(command: string, data?: unknown, options?: unknown): Promise<PushResult>;
|
|
142
142
|
}
|
|
143
|
-
interface Instance$
|
|
143
|
+
interface Instance$6 {
|
|
144
144
|
push: PushFn$1;
|
|
145
145
|
command: CommandFn;
|
|
146
146
|
allowed: boolean;
|
|
@@ -155,7 +155,7 @@ interface Instance$5 {
|
|
|
155
155
|
globals: Properties;
|
|
156
156
|
group: string;
|
|
157
157
|
hooks: Functions;
|
|
158
|
-
logger: Instance$
|
|
158
|
+
logger: Instance$4;
|
|
159
159
|
on: OnConfig;
|
|
160
160
|
queue: Events;
|
|
161
161
|
round: number;
|
|
@@ -180,7 +180,7 @@ type collector_SourceStatus = SourceStatus;
|
|
|
180
180
|
type collector_Sources = Sources;
|
|
181
181
|
type collector_Status = Status;
|
|
182
182
|
declare namespace collector {
|
|
183
|
-
export type { collector_CommandFn as CommandFn, collector_CommandType as CommandType, Config$8 as Config, collector_DestinationStatus as DestinationStatus, Destinations$1 as Destinations, collector_InitConfig as InitConfig, Instance$
|
|
183
|
+
export type { collector_CommandFn as CommandFn, collector_CommandType as CommandType, Config$8 as Config, collector_DestinationStatus as DestinationStatus, Destinations$1 as Destinations, collector_InitConfig as InitConfig, Instance$6 as Instance, PushFn$1 as PushFn, collector_PushOptions as PushOptions, collector_SessionData as SessionData, collector_SourceStatus as SourceStatus, collector_Sources as Sources, collector_Status as Status, Stores$1 as Stores, Transformers$1 as Transformers };
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
/**
|
|
@@ -188,8 +188,8 @@ declare namespace collector {
|
|
|
188
188
|
* Sources, Transformers, and Destinations extend this.
|
|
189
189
|
*/
|
|
190
190
|
interface Base<C = unknown, E = unknown> {
|
|
191
|
-
collector: Instance$
|
|
192
|
-
logger: Instance$
|
|
191
|
+
collector: Instance$6;
|
|
192
|
+
logger: Instance$4;
|
|
193
193
|
config: C;
|
|
194
194
|
env: E;
|
|
195
195
|
}
|
|
@@ -214,7 +214,7 @@ interface DestroyContext<C = unknown, E = unknown> {
|
|
|
214
214
|
/** Runtime environment/dependencies (DB clients, auth clients, etc.). */
|
|
215
215
|
env: E;
|
|
216
216
|
/** Scoped logger for this step instance. */
|
|
217
|
-
logger: Instance$
|
|
217
|
+
logger: Instance$4;
|
|
218
218
|
}
|
|
219
219
|
/**
|
|
220
220
|
* Destroy function signature for step lifecycle cleanup.
|
|
@@ -273,8 +273,8 @@ type Env$3<T extends TypesGeneric$3 = Types$4> = T['env'];
|
|
|
273
273
|
/**
|
|
274
274
|
* Inference helper: Extract Types from Instance
|
|
275
275
|
*/
|
|
276
|
-
type TypesOf$3<I> = I extends Instance$
|
|
277
|
-
interface Instance$
|
|
276
|
+
type TypesOf$3<I> = I extends Instance$5<infer T> ? T : never;
|
|
277
|
+
interface Instance$5<T extends TypesGeneric$3 = Types$4> {
|
|
278
278
|
config: Config$7<T>;
|
|
279
279
|
queuePush?: Events;
|
|
280
280
|
queueOn?: Array<{
|
|
@@ -323,7 +323,7 @@ type PartialConfig$1<T extends TypesGeneric$3 = Types$4> = Config$7<Types$4<Part
|
|
|
323
323
|
interface Policy$1 {
|
|
324
324
|
[key: string]: Value;
|
|
325
325
|
}
|
|
326
|
-
type Code$1<T extends TypesGeneric$3 = Types$4> = Instance$
|
|
326
|
+
type Code$1<T extends TypesGeneric$3 = Types$4> = Instance$5<T>;
|
|
327
327
|
type Init$3<T extends TypesGeneric$3 = Types$4> = {
|
|
328
328
|
code: Code$1<T>;
|
|
329
329
|
config?: Partial<Config$7<T>>;
|
|
@@ -334,7 +334,7 @@ interface InitDestinations {
|
|
|
334
334
|
[key: string]: Init$3<any>;
|
|
335
335
|
}
|
|
336
336
|
interface Destinations {
|
|
337
|
-
[key: string]: Instance$
|
|
337
|
+
[key: string]: Instance$5;
|
|
338
338
|
}
|
|
339
339
|
/**
|
|
340
340
|
* Context provided to destination functions.
|
|
@@ -397,7 +397,7 @@ type destination_PushEvents<Mapping = unknown> = PushEvents<Mapping>;
|
|
|
397
397
|
type destination_PushFn<T extends TypesGeneric$3 = Types$4> = PushFn<T>;
|
|
398
398
|
type destination_Ref = Ref;
|
|
399
399
|
declare namespace destination {
|
|
400
|
-
export type { BaseEnv$3 as BaseEnv, destination_Batch as Batch, destination_BatchRegistry as BatchRegistry, Code$1 as Code, Config$7 as Config, Context$5 as Context, destination_DLQ as DLQ, Data$1 as Data, destination_Destinations as Destinations, Env$3 as Env, Init$3 as Init, destination_InitDestinations as InitDestinations, InitFn$2 as InitFn, InitSettings$3 as InitSettings, Instance$
|
|
400
|
+
export type { BaseEnv$3 as BaseEnv, destination_Batch as Batch, destination_BatchRegistry as BatchRegistry, Code$1 as Code, Config$7 as Config, Context$5 as Context, destination_DLQ as DLQ, Data$1 as Data, destination_Destinations as Destinations, Env$3 as Env, Init$3 as Init, destination_InitDestinations as InitDestinations, InitFn$2 as InitFn, InitSettings$3 as InitSettings, Instance$5 as Instance, Mapping$1 as Mapping, PartialConfig$1 as PartialConfig, Policy$1 as Policy, Push$1 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, Settings$4 as Settings, Types$4 as Types, TypesGeneric$3 as TypesGeneric, TypesOf$3 as TypesOf };
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
interface EventFn<R = Promise<PushResult>> {
|
|
@@ -405,12 +405,12 @@ interface EventFn<R = Promise<PushResult>> {
|
|
|
405
405
|
(event: string): R;
|
|
406
406
|
(event: string, data: Properties): R;
|
|
407
407
|
}
|
|
408
|
-
interface Fn$
|
|
408
|
+
interface Fn$3<R = Promise<PushResult>, Config = unknown> extends EventFn<R>, WalkerCommands<R, Config> {
|
|
409
409
|
}
|
|
410
410
|
interface WalkerCommands<R = Promise<PushResult>, Config = unknown> {
|
|
411
411
|
(event: 'walker config', config: Partial<Config>): R;
|
|
412
412
|
(event: 'walker consent', consent: Consent): R;
|
|
413
|
-
<T extends Types$4>(event: 'walker destination', destination: Init$3<T> | Instance$
|
|
413
|
+
<T extends Types$4>(event: 'walker destination', destination: Init$3<T> | Instance$5<T>, config?: Config$7<T>): R;
|
|
414
414
|
<K extends keyof Functions>(event: 'walker hook', name: K, hookFn: Functions[K]): R;
|
|
415
415
|
(event: 'walker on', type: Types$3, rules: SingleOrArray<Options>): R;
|
|
416
416
|
(event: 'walker user', user: User): R;
|
|
@@ -438,7 +438,7 @@ type elb_PushData<Config = unknown> = PushData<Config>;
|
|
|
438
438
|
type elb_PushResult = PushResult;
|
|
439
439
|
type elb_WalkerCommands<R = Promise<PushResult>, Config = unknown> = WalkerCommands<R, Config>;
|
|
440
440
|
declare namespace elb {
|
|
441
|
-
export type { Event$1 as Event, elb_EventFn as EventFn, Fn$
|
|
441
|
+
export type { Event$1 as Event, elb_EventFn as EventFn, Fn$3 as Fn, elb_Layer as Layer, elb_PushData as PushData, elb_PushResult as PushResult, elb_WalkerCommands as WalkerCommands };
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
/**
|
|
@@ -846,6 +846,13 @@ interface Settings$3 {
|
|
|
846
846
|
interface StepExample {
|
|
847
847
|
description?: string;
|
|
848
848
|
in?: unknown;
|
|
849
|
+
/** Trigger metadata for sources — type and options for the trigger call. */
|
|
850
|
+
trigger?: {
|
|
851
|
+
/** Which mechanism to activate (e.g., 'click', 'POST', 'load'). */
|
|
852
|
+
type?: string;
|
|
853
|
+
/** Mechanism-specific options (e.g., CSS selector, threshold). */
|
|
854
|
+
options?: unknown;
|
|
855
|
+
};
|
|
849
856
|
mapping?: unknown;
|
|
850
857
|
out?: unknown;
|
|
851
858
|
}
|
|
@@ -1282,7 +1289,7 @@ type Handler = (level: Level, message: string, context: LogContext, scope: strin
|
|
|
1282
1289
|
* Logger instance with scoping support
|
|
1283
1290
|
* All logs automatically include trace path from scoping
|
|
1284
1291
|
*/
|
|
1285
|
-
interface Instance$
|
|
1292
|
+
interface Instance$4 {
|
|
1286
1293
|
/**
|
|
1287
1294
|
* Log an error message (always visible unless silenced)
|
|
1288
1295
|
*/
|
|
@@ -1313,7 +1320,7 @@ interface Instance$3 {
|
|
|
1313
1320
|
* @param name - Scope name (e.g., destination type, destination key)
|
|
1314
1321
|
* @returns A new logger instance with the scope applied
|
|
1315
1322
|
*/
|
|
1316
|
-
scope: (name: string) => Instance$
|
|
1323
|
+
scope: (name: string) => Instance$4;
|
|
1317
1324
|
}
|
|
1318
1325
|
/**
|
|
1319
1326
|
* Logger configuration options
|
|
@@ -1344,7 +1351,7 @@ interface InternalConfig {
|
|
|
1344
1351
|
/**
|
|
1345
1352
|
* Logger factory function type
|
|
1346
1353
|
*/
|
|
1347
|
-
type Factory = (config?: Config$5) => Instance$
|
|
1354
|
+
type Factory = (config?: Config$5) => Instance$4;
|
|
1348
1355
|
|
|
1349
1356
|
type logger_DefaultHandler = DefaultHandler;
|
|
1350
1357
|
type logger_ErrorContext = ErrorContext;
|
|
@@ -1357,7 +1364,7 @@ type logger_LogContext = LogContext;
|
|
|
1357
1364
|
type logger_LogFn = LogFn;
|
|
1358
1365
|
type logger_ThrowFn = ThrowFn;
|
|
1359
1366
|
declare namespace logger {
|
|
1360
|
-
export { type Config$5 as Config, type logger_DefaultHandler as DefaultHandler, type logger_ErrorContext as ErrorContext, type logger_Factory as Factory, type logger_Handler as Handler, type Instance$
|
|
1367
|
+
export { type Config$5 as Config, type logger_DefaultHandler as DefaultHandler, type logger_ErrorContext as ErrorContext, type logger_Factory as Factory, type logger_Handler as Handler, type Instance$4 as Instance, type logger_InternalConfig as InternalConfig, logger_Level as Level, type logger_LogContext as LogContext, type logger_LogFn as LogFn, type logger_ThrowFn as ThrowFn };
|
|
1361
1368
|
}
|
|
1362
1369
|
|
|
1363
1370
|
/**
|
|
@@ -1378,7 +1385,7 @@ interface Rules<T = Rule> {
|
|
|
1378
1385
|
}
|
|
1379
1386
|
interface Rule<Settings = unknown> {
|
|
1380
1387
|
batch?: number;
|
|
1381
|
-
batchFn?: (destination: Instance$
|
|
1388
|
+
batchFn?: (destination: Instance$5, collector: Instance$6) => void;
|
|
1382
1389
|
batched?: Batch<Settings>;
|
|
1383
1390
|
condition?: Condition;
|
|
1384
1391
|
consent?: Consent;
|
|
@@ -1399,7 +1406,7 @@ type ValueType = string | ValueConfig;
|
|
|
1399
1406
|
interface ValueConfig {
|
|
1400
1407
|
condition?: Condition;
|
|
1401
1408
|
consent?: Consent;
|
|
1402
|
-
fn?: Fn$
|
|
1409
|
+
fn?: Fn$2;
|
|
1403
1410
|
key?: string;
|
|
1404
1411
|
loop?: Loop;
|
|
1405
1412
|
map?: Map;
|
|
@@ -1407,15 +1414,15 @@ interface ValueConfig {
|
|
|
1407
1414
|
validate?: Validate;
|
|
1408
1415
|
value?: PropertyType;
|
|
1409
1416
|
}
|
|
1410
|
-
type Condition = (value: DeepPartialEvent | unknown, mapping?: Value, collector?: Instance$
|
|
1411
|
-
type Fn$
|
|
1417
|
+
type Condition = (value: DeepPartialEvent | unknown, mapping?: Value, collector?: Instance$6) => PromiseOrValue<boolean>;
|
|
1418
|
+
type Fn$2 = (value: DeepPartialEvent | unknown, mapping: Value, options: Options$1) => PromiseOrValue<Property | unknown>;
|
|
1412
1419
|
type Loop = [Value, Value];
|
|
1413
1420
|
type Map = {
|
|
1414
1421
|
[key: string]: Value;
|
|
1415
1422
|
};
|
|
1416
1423
|
interface Options$1 {
|
|
1417
1424
|
consent?: Consent;
|
|
1418
|
-
collector?: Instance$
|
|
1425
|
+
collector?: Instance$6;
|
|
1419
1426
|
props?: unknown;
|
|
1420
1427
|
}
|
|
1421
1428
|
type Validate = (value?: unknown) => PromiseOrValue<boolean>;
|
|
@@ -1433,7 +1440,7 @@ type mapping_ValueConfig = ValueConfig;
|
|
|
1433
1440
|
type mapping_ValueType = ValueType;
|
|
1434
1441
|
type mapping_Values = Values;
|
|
1435
1442
|
declare namespace mapping {
|
|
1436
|
-
export type { mapping_Condition as Condition, Config$4 as Config, mapping_Data as Data, Fn$
|
|
1443
|
+
export type { mapping_Condition as Condition, Config$4 as Config, mapping_Data as Data, Fn$2 as Fn, mapping_Loop as Loop, mapping_Map as Map, Options$1 as Options, mapping_Policy as Policy, Result$2 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 };
|
|
1437
1444
|
}
|
|
1438
1445
|
|
|
1439
1446
|
type Config$3 = {
|
|
@@ -1467,17 +1474,17 @@ type Options = ConsentConfig | GenericConfig | ReadyConfig | RunConfig | Session
|
|
|
1467
1474
|
interface ConsentConfig {
|
|
1468
1475
|
[key: string]: ConsentFn;
|
|
1469
1476
|
}
|
|
1470
|
-
type ConsentFn = (collector: Instance$
|
|
1477
|
+
type ConsentFn = (collector: Instance$6, consent: Consent) => void;
|
|
1471
1478
|
type GenericConfig = GenericFn;
|
|
1472
|
-
type GenericFn = (collector: Instance$
|
|
1479
|
+
type GenericFn = (collector: Instance$6, data: unknown) => void;
|
|
1473
1480
|
type ReadyConfig = ReadyFn;
|
|
1474
|
-
type ReadyFn = (collector: Instance$
|
|
1481
|
+
type ReadyFn = (collector: Instance$6) => void;
|
|
1475
1482
|
type RunConfig = RunFn;
|
|
1476
|
-
type RunFn = (collector: Instance$
|
|
1483
|
+
type RunFn = (collector: Instance$6) => void;
|
|
1477
1484
|
type SessionConfig = SessionFn;
|
|
1478
|
-
type SessionFn = (collector: Instance$
|
|
1485
|
+
type SessionFn = (collector: Instance$6, session?: unknown) => void;
|
|
1479
1486
|
type UserConfig = UserFn;
|
|
1480
|
-
type UserFn = (collector: Instance$
|
|
1487
|
+
type UserFn = (collector: Instance$6, user: User) => void;
|
|
1481
1488
|
interface OnConfig {
|
|
1482
1489
|
config?: GenericConfig[];
|
|
1483
1490
|
consent?: ConsentConfig[];
|
|
@@ -1556,7 +1563,7 @@ type Env$2<T extends TypesGeneric$2 = Types$2> = T['env'];
|
|
|
1556
1563
|
/**
|
|
1557
1564
|
* Inference helper: Extract Types from Instance.
|
|
1558
1565
|
*/
|
|
1559
|
-
type TypesOf$2<I> = I extends Instance$
|
|
1566
|
+
type TypesOf$2<I> = I extends Instance$3<infer T> ? T : never;
|
|
1560
1567
|
/**
|
|
1561
1568
|
* Transformer configuration.
|
|
1562
1569
|
*/
|
|
@@ -1599,7 +1606,7 @@ interface Result$1 {
|
|
|
1599
1606
|
* @returns void - continue with current event unchanged (passthrough)
|
|
1600
1607
|
* @returns false - stop chain, cancel further processing
|
|
1601
1608
|
*/
|
|
1602
|
-
type Fn<T extends TypesGeneric$2 = Types$2> = (event: DeepPartialEvent, context: Context$3<T>) => PromiseOrValue<Result$1 | false | void>;
|
|
1609
|
+
type Fn$1<T extends TypesGeneric$2 = Types$2> = (event: DeepPartialEvent, context: Context$3<T>) => PromiseOrValue<Result$1 | false | void>;
|
|
1603
1610
|
/**
|
|
1604
1611
|
* Optional initialization function.
|
|
1605
1612
|
* Called once before first push.
|
|
@@ -1613,10 +1620,10 @@ type InitFn$1<T extends TypesGeneric$2 = Types$2> = (context: Context$3<T>) => P
|
|
|
1613
1620
|
/**
|
|
1614
1621
|
* Transformer instance returned by Init function.
|
|
1615
1622
|
*/
|
|
1616
|
-
interface Instance$
|
|
1623
|
+
interface Instance$3<T extends TypesGeneric$2 = Types$2> {
|
|
1617
1624
|
type: string;
|
|
1618
1625
|
config: Config$2<T>;
|
|
1619
|
-
push: Fn<T>;
|
|
1626
|
+
push: Fn$1<T>;
|
|
1620
1627
|
init?: InitFn$1<T>;
|
|
1621
1628
|
destroy?: DestroyFn<Config$2<T>, Env$2<T>>;
|
|
1622
1629
|
}
|
|
@@ -1624,7 +1631,7 @@ interface Instance$2<T extends TypesGeneric$2 = Types$2> {
|
|
|
1624
1631
|
* Transformer initialization function.
|
|
1625
1632
|
* Creates a transformer instance from context.
|
|
1626
1633
|
*/
|
|
1627
|
-
type Init$2<T extends TypesGeneric$2 = Types$2> = (context: Context$3<Types$2<Partial<Settings$2<T>>, Env$2<T>, InitSettings$2<T>>>) => Instance$
|
|
1634
|
+
type Init$2<T extends TypesGeneric$2 = Types$2> = (context: Context$3<Types$2<Partial<Settings$2<T>>, Env$2<T>, InitSettings$2<T>>>) => Instance$3<T> | Promise<Instance$3<T>>;
|
|
1628
1635
|
/**
|
|
1629
1636
|
* Configuration for initializing a transformer.
|
|
1630
1637
|
* Used in collector registration.
|
|
@@ -1646,16 +1653,15 @@ interface InitTransformers {
|
|
|
1646
1653
|
* Active transformer instances registry.
|
|
1647
1654
|
*/
|
|
1648
1655
|
interface Transformers {
|
|
1649
|
-
[transformerId: string]: Instance$
|
|
1656
|
+
[transformerId: string]: Instance$3;
|
|
1650
1657
|
}
|
|
1651
1658
|
|
|
1652
|
-
type transformer_Fn<T extends TypesGeneric$2 = Types$2> = Fn<T>;
|
|
1653
1659
|
type transformer_InitTransformer<T extends TypesGeneric$2 = Types$2> = InitTransformer<T>;
|
|
1654
1660
|
type transformer_InitTransformers = InitTransformers;
|
|
1655
1661
|
type transformer_Next = Next;
|
|
1656
1662
|
type transformer_Transformers = Transformers;
|
|
1657
1663
|
declare namespace transformer {
|
|
1658
|
-
export type { BaseEnv$2 as BaseEnv, Config$2 as Config, Context$3 as Context, Env$2 as Env,
|
|
1664
|
+
export type { BaseEnv$2 as BaseEnv, Config$2 as Config, Context$3 as Context, Env$2 as Env, Fn$1 as Fn, Init$2 as Init, InitFn$1 as InitFn, InitSettings$2 as InitSettings, transformer_InitTransformer as InitTransformer, transformer_InitTransformers as InitTransformers, Instance$3 as Instance, transformer_Next as Next, Result$1 as Result, Settings$2 as Settings, transformer_Transformers as Transformers, Types$2 as Types, TypesGeneric$2 as TypesGeneric, TypesOf$2 as TypesOf };
|
|
1659
1665
|
}
|
|
1660
1666
|
|
|
1661
1667
|
interface Context$2 {
|
|
@@ -1686,8 +1692,8 @@ interface BaseEnv$1 {
|
|
|
1686
1692
|
push: PushFn$1;
|
|
1687
1693
|
command: CommandFn;
|
|
1688
1694
|
sources?: Sources;
|
|
1689
|
-
elb: Fn$
|
|
1690
|
-
logger: Instance$
|
|
1695
|
+
elb: Fn$3;
|
|
1696
|
+
logger: Instance$4;
|
|
1691
1697
|
}
|
|
1692
1698
|
/**
|
|
1693
1699
|
* Type bundle for source generics.
|
|
@@ -1699,7 +1705,7 @@ interface BaseEnv$1 {
|
|
|
1699
1705
|
* @template E - Environment dependencies type
|
|
1700
1706
|
* @template I - InitSettings configuration type (user input)
|
|
1701
1707
|
*/
|
|
1702
|
-
interface Types$1<S = unknown, M = unknown, P = Fn$
|
|
1708
|
+
interface Types$1<S = unknown, M = unknown, P = Fn$3, E = BaseEnv$1, I = S> {
|
|
1703
1709
|
settings: S;
|
|
1704
1710
|
initSettings: I;
|
|
1705
1711
|
mapping: M;
|
|
@@ -1727,7 +1733,7 @@ type Env$1<T extends TypesGeneric$1 = Types$1> = T['env'];
|
|
|
1727
1733
|
/**
|
|
1728
1734
|
* Inference helper: Extract Types from Instance
|
|
1729
1735
|
*/
|
|
1730
|
-
type TypesOf$1<I> = I extends Instance$
|
|
1736
|
+
type TypesOf$1<I> = I extends Instance$2<infer T> ? T : never;
|
|
1731
1737
|
interface Config$1<T extends TypesGeneric$1 = Types$1> extends Config$4<Mapping<T>> {
|
|
1732
1738
|
/** Implementation-specific configuration passed to the init function. */
|
|
1733
1739
|
settings?: InitSettings$1<T>;
|
|
@@ -1756,7 +1762,7 @@ interface Config$1<T extends TypesGeneric$1 = Types$1> extends Config$4<Mapping<
|
|
|
1756
1762
|
ingest?: Data;
|
|
1757
1763
|
}
|
|
1758
1764
|
type PartialConfig<T extends TypesGeneric$1 = Types$1> = Config$1<Types$1<Partial<Settings$1<T>> | Settings$1<T>, Partial<Mapping<T>> | Mapping<T>, Push<T>, Env$1<T>>>;
|
|
1759
|
-
interface Instance$
|
|
1765
|
+
interface Instance$2<T extends TypesGeneric$1 = Types$1> {
|
|
1760
1766
|
type: string;
|
|
1761
1767
|
config: Config$1<T>;
|
|
1762
1768
|
push: Push<T>;
|
|
@@ -1780,7 +1786,7 @@ interface Context$1<T extends TypesGeneric$1 = Types$1> extends Base<Partial<Con
|
|
|
1780
1786
|
/** Sets respond function for the current request. Called by source per-request. */
|
|
1781
1787
|
setRespond: (fn: RespondFn | undefined) => void;
|
|
1782
1788
|
}
|
|
1783
|
-
type Init$1<T extends TypesGeneric$1 = Types$1> = (context: Context$1<T>) => Instance$
|
|
1789
|
+
type Init$1<T extends TypesGeneric$1 = Types$1> = (context: Context$1<T>) => Instance$2<T> | Promise<Instance$2<T>>;
|
|
1784
1790
|
type InitSource<T extends TypesGeneric$1 = Types$1> = {
|
|
1785
1791
|
code: Init$1<T>;
|
|
1786
1792
|
config?: Partial<Config$1<T>>;
|
|
@@ -1801,26 +1807,6 @@ interface InitSources {
|
|
|
1801
1807
|
* - 'codebox': Source uses a JSON/code editor (default)
|
|
1802
1808
|
*/
|
|
1803
1809
|
type Renderer = 'browser' | 'codebox';
|
|
1804
|
-
/**
|
|
1805
|
-
* Minimal environment contract for source simulation.
|
|
1806
|
-
* Both JSDOM and iframe satisfy this interface.
|
|
1807
|
-
*/
|
|
1808
|
-
interface SimulationEnv {
|
|
1809
|
-
window: Window & typeof globalThis;
|
|
1810
|
-
document: Document;
|
|
1811
|
-
localStorage: Storage;
|
|
1812
|
-
[key: string]: unknown;
|
|
1813
|
-
}
|
|
1814
|
-
/**
|
|
1815
|
-
* Setup function for source simulation.
|
|
1816
|
-
* Runs BEFORE startFlow() to prepare the environment
|
|
1817
|
-
* (dataLayer arrays, localStorage, window globals).
|
|
1818
|
-
*
|
|
1819
|
-
* Return void for sources that need no post-init action.
|
|
1820
|
-
* Return a () => void trigger for sources that dispatch
|
|
1821
|
-
* events AFTER startFlow() (e.g., usercentrics CustomEvent).
|
|
1822
|
-
*/
|
|
1823
|
-
type SetupFn = (input: unknown, env: SimulationEnv) => void | (() => void);
|
|
1824
1810
|
|
|
1825
1811
|
type source_InitSource<T extends TypesGeneric$1 = Types$1> = InitSource<T>;
|
|
1826
1812
|
type source_InitSources = InitSources;
|
|
@@ -1828,10 +1814,8 @@ type source_Mapping<T extends TypesGeneric$1 = Types$1> = Mapping<T>;
|
|
|
1828
1814
|
type source_PartialConfig<T extends TypesGeneric$1 = Types$1> = PartialConfig<T>;
|
|
1829
1815
|
type source_Push<T extends TypesGeneric$1 = Types$1> = Push<T>;
|
|
1830
1816
|
type source_Renderer = Renderer;
|
|
1831
|
-
type source_SetupFn = SetupFn;
|
|
1832
|
-
type source_SimulationEnv = SimulationEnv;
|
|
1833
1817
|
declare namespace source {
|
|
1834
|
-
export type { BaseEnv$1 as BaseEnv, Config$1 as Config, Context$1 as Context, Env$1 as Env, Init$1 as Init, InitSettings$1 as InitSettings, source_InitSource as InitSource, source_InitSources as InitSources, Instance$
|
|
1818
|
+
export type { BaseEnv$1 as BaseEnv, Config$1 as Config, Context$1 as Context, Env$1 as Env, Init$1 as Init, InitSettings$1 as InitSettings, source_InitSource as InitSource, source_InitSources as InitSources, Instance$2 as Instance, source_Mapping as Mapping, source_PartialConfig as PartialConfig, source_Push as Push, source_Renderer as Renderer, Settings$1 as Settings, Types$1 as Types, TypesGeneric$1 as TypesGeneric, TypesOf$1 as TypesOf };
|
|
1835
1819
|
}
|
|
1836
1820
|
|
|
1837
1821
|
interface BaseEnv {
|
|
@@ -1850,7 +1834,7 @@ type TypesGeneric = {
|
|
|
1850
1834
|
type Settings<T extends TypesGeneric = Types> = T['settings'];
|
|
1851
1835
|
type InitSettings<T extends TypesGeneric = Types> = T['initSettings'];
|
|
1852
1836
|
type Env<T extends TypesGeneric = Types> = T['env'];
|
|
1853
|
-
type TypesOf<I> = I extends Instance<infer T> ? T : never;
|
|
1837
|
+
type TypesOf<I> = I extends Instance$1<infer T> ? T : never;
|
|
1854
1838
|
interface Config<T extends TypesGeneric = Types> {
|
|
1855
1839
|
settings?: InitSettings<T>;
|
|
1856
1840
|
env?: Env<T>;
|
|
@@ -1863,7 +1847,7 @@ interface Context<T extends TypesGeneric = Types> extends Base<Config<T>, Env<T>
|
|
|
1863
1847
|
type GetFn<T = unknown> = (key: string) => T | undefined | Promise<T | undefined>;
|
|
1864
1848
|
type SetFn<T = unknown> = (key: string, value: T, ttl?: number) => void | Promise<void>;
|
|
1865
1849
|
type DeleteFn = (key: string) => void | Promise<void>;
|
|
1866
|
-
interface Instance<T extends TypesGeneric = Types> {
|
|
1850
|
+
interface Instance$1<T extends TypesGeneric = Types> {
|
|
1867
1851
|
type: string;
|
|
1868
1852
|
config: Config<T>;
|
|
1869
1853
|
get: GetFn;
|
|
@@ -1871,7 +1855,7 @@ interface Instance<T extends TypesGeneric = Types> {
|
|
|
1871
1855
|
delete: DeleteFn;
|
|
1872
1856
|
destroy?: DestroyFn<Config<T>, Env<T>>;
|
|
1873
1857
|
}
|
|
1874
|
-
type Init<T extends TypesGeneric = Types> = (context: Context<Types<Partial<Settings<T>>, Env<T>, InitSettings<T>>>) => Instance<T> | Promise<Instance<T>>;
|
|
1858
|
+
type Init<T extends TypesGeneric = Types> = (context: Context<Types<Partial<Settings<T>>, Env<T>, InitSettings<T>>>) => Instance$1<T> | Promise<Instance$1<T>>;
|
|
1875
1859
|
type InitFn<T extends TypesGeneric = Types> = (context: Context<T>) => PromiseOrValue<void | false | Config<T>>;
|
|
1876
1860
|
type InitStore<T extends TypesGeneric = Types> = {
|
|
1877
1861
|
code: Init<T>;
|
|
@@ -1882,7 +1866,7 @@ interface InitStores {
|
|
|
1882
1866
|
[storeId: string]: InitStore<any>;
|
|
1883
1867
|
}
|
|
1884
1868
|
interface Stores {
|
|
1885
|
-
[storeId: string]: Instance;
|
|
1869
|
+
[storeId: string]: Instance$1;
|
|
1886
1870
|
}
|
|
1887
1871
|
|
|
1888
1872
|
type store_BaseEnv = BaseEnv;
|
|
@@ -1896,7 +1880,6 @@ type store_InitFn<T extends TypesGeneric = Types> = InitFn<T>;
|
|
|
1896
1880
|
type store_InitSettings<T extends TypesGeneric = Types> = InitSettings<T>;
|
|
1897
1881
|
type store_InitStore<T extends TypesGeneric = Types> = InitStore<T>;
|
|
1898
1882
|
type store_InitStores = InitStores;
|
|
1899
|
-
type store_Instance<T extends TypesGeneric = Types> = Instance<T>;
|
|
1900
1883
|
type store_SetFn<T = unknown> = SetFn<T>;
|
|
1901
1884
|
type store_Settings<T extends TypesGeneric = Types> = Settings<T>;
|
|
1902
1885
|
type store_Stores = Stores;
|
|
@@ -1904,11 +1887,95 @@ type store_Types<S = unknown, E = BaseEnv, I = S> = Types<S, E, I>;
|
|
|
1904
1887
|
type store_TypesGeneric = TypesGeneric;
|
|
1905
1888
|
type store_TypesOf<I> = TypesOf<I>;
|
|
1906
1889
|
declare namespace store {
|
|
1907
|
-
export type { store_BaseEnv as BaseEnv, store_Config as Config, store_Context as Context, store_DeleteFn as DeleteFn, store_Env as Env, store_GetFn as GetFn, store_Init as Init, store_InitFn as InitFn, store_InitSettings as InitSettings, store_InitStore as InitStore, store_InitStores as InitStores,
|
|
1890
|
+
export type { store_BaseEnv as BaseEnv, store_Config as Config, store_Context as Context, store_DeleteFn as DeleteFn, store_Env as Env, store_GetFn as GetFn, store_Init as Init, store_InitFn as InitFn, store_InitSettings as InitSettings, store_InitStore as InitStore, store_InitStores as InitStores, Instance$1 as Instance, store_SetFn as SetFn, store_Settings as Settings, store_Stores as Stores, store_Types as Types, store_TypesGeneric as TypesGeneric, store_TypesOf as TypesOf };
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
/**
|
|
1894
|
+
* Trigger — unified interface for invoking any walkerOS step in simulation
|
|
1895
|
+
* and testing. Every package exports a `createTrigger` factory from its
|
|
1896
|
+
* examples that conforms to `Trigger.CreateFn`.
|
|
1897
|
+
*
|
|
1898
|
+
* Usage:
|
|
1899
|
+
* const { flow, trigger } = await createTrigger(initConfig);
|
|
1900
|
+
* const result = await trigger(type?, options?)(content);
|
|
1901
|
+
*
|
|
1902
|
+
* @packageDocumentation
|
|
1903
|
+
*/
|
|
1904
|
+
|
|
1905
|
+
/** Flow access handle returned by createTrigger. */
|
|
1906
|
+
interface FlowHandle {
|
|
1907
|
+
/** The collector instance created by startFlow. */
|
|
1908
|
+
collector: Instance$6;
|
|
1909
|
+
/** The elb push function for direct event injection. */
|
|
1910
|
+
elb: Fn$3;
|
|
1911
|
+
}
|
|
1912
|
+
/** What createTrigger returns — a flow handle (lazy) and a trigger function. */
|
|
1913
|
+
interface Instance<TContent = unknown, TResult = unknown> {
|
|
1914
|
+
/** Flow handle — undefined until first trigger() call, then stable. */
|
|
1915
|
+
readonly flow: FlowHandle | undefined;
|
|
1916
|
+
trigger: Fn<TContent, TResult>;
|
|
1917
|
+
}
|
|
1918
|
+
/**
|
|
1919
|
+
* Curried trigger function — always async.
|
|
1920
|
+
*
|
|
1921
|
+
* First call selects mechanism (type) and configures it (options).
|
|
1922
|
+
* Second call fires with content and returns result.
|
|
1923
|
+
*
|
|
1924
|
+
* @example
|
|
1925
|
+
* // Browser source — click trigger
|
|
1926
|
+
* trigger('click', 'button.cta')('<button data-elb="cta">Sign Up</button>')
|
|
1927
|
+
*
|
|
1928
|
+
* // Express source — POST request
|
|
1929
|
+
* trigger('POST')({ path: '/collect', body: { name: 'page view' } })
|
|
1930
|
+
*
|
|
1931
|
+
* // DataLayer — default mechanism
|
|
1932
|
+
* trigger()(['event', 'purchase', { value: 25.42 }])
|
|
1933
|
+
*/
|
|
1934
|
+
type Fn<TContent = unknown, TResult = unknown> = (type?: string, options?: unknown) => (content: TContent) => Promise<TResult>;
|
|
1935
|
+
/**
|
|
1936
|
+
* Factory function exported by each package's examples.
|
|
1937
|
+
*
|
|
1938
|
+
* Receives full Collector.InitConfig. Does NOT call startFlow eagerly —
|
|
1939
|
+
* startFlow is deferred to the first trigger() invocation (lazy init).
|
|
1940
|
+
* The flow property uses a getter to read the closure variable live.
|
|
1941
|
+
* createTrigger itself stays async for consistency (other packages may
|
|
1942
|
+
* need await during setup). Config is passed through UNMODIFIED —
|
|
1943
|
+
* validation is startFlow's job.
|
|
1944
|
+
*
|
|
1945
|
+
* @example
|
|
1946
|
+
* // Package exports:
|
|
1947
|
+
* export const createTrigger: Trigger.CreateFn<HTMLContent, void> = async (config) => {
|
|
1948
|
+
* let flow: Trigger.FlowHandle | undefined;
|
|
1949
|
+
*
|
|
1950
|
+
* const trigger: Trigger.Fn<HTMLContent, void> = (type?, options?) => async (content) => {
|
|
1951
|
+
* // Pre-startFlow work (e.g., inject HTML for browser source)
|
|
1952
|
+
* // ...
|
|
1953
|
+
*
|
|
1954
|
+
* // Lazy init — only on first call
|
|
1955
|
+
* if (!flow) flow = await startFlow(config);
|
|
1956
|
+
*
|
|
1957
|
+
* // Post-startFlow work (e.g., dispatch click event)
|
|
1958
|
+
* // ...
|
|
1959
|
+
* };
|
|
1960
|
+
*
|
|
1961
|
+
* return {
|
|
1962
|
+
* get flow() { return flow; },
|
|
1963
|
+
* trigger,
|
|
1964
|
+
* };
|
|
1965
|
+
* };
|
|
1966
|
+
*/
|
|
1967
|
+
type CreateFn<TContent = unknown, TResult = unknown> = (config: InitConfig, options?: unknown) => Promise<Instance<TContent, TResult>>;
|
|
1968
|
+
|
|
1969
|
+
type trigger_CreateFn<TContent = unknown, TResult = unknown> = CreateFn<TContent, TResult>;
|
|
1970
|
+
type trigger_FlowHandle = FlowHandle;
|
|
1971
|
+
type trigger_Fn<TContent = unknown, TResult = unknown> = Fn<TContent, TResult>;
|
|
1972
|
+
type trigger_Instance<TContent = unknown, TResult = unknown> = Instance<TContent, TResult>;
|
|
1973
|
+
declare namespace trigger {
|
|
1974
|
+
export type { trigger_CreateFn as CreateFn, trigger_FlowHandle as FlowHandle, trigger_Fn as Fn, trigger_Instance as Instance };
|
|
1908
1975
|
}
|
|
1909
1976
|
|
|
1910
1977
|
type AnyObject<T = unknown> = Record<string, T>;
|
|
1911
|
-
type Elb = Fn$
|
|
1978
|
+
type Elb = Fn$3;
|
|
1912
1979
|
type AnyFunction = (...args: unknown[]) => unknown;
|
|
1913
1980
|
type SingleOrArray<T> = T | Array<T>;
|
|
1914
1981
|
type Events = Array<Event>;
|
|
@@ -2297,7 +2364,7 @@ declare function getGrantedConsent(required: Consent | undefined, state?: Consen
|
|
|
2297
2364
|
* }));
|
|
2298
2365
|
* ```
|
|
2299
2366
|
*/
|
|
2300
|
-
declare function createDestination<I extends Instance$
|
|
2367
|
+
declare function createDestination<I extends Instance$5>(baseDestination: I, config: Partial<Config$7<TypesOf$3<I>>>): I;
|
|
2301
2368
|
|
|
2302
2369
|
/**
|
|
2303
2370
|
* Creates a complete event with default values.
|
|
@@ -2459,7 +2526,7 @@ declare function isString(value: unknown): value is string;
|
|
|
2459
2526
|
* // TODO: Consider compile-time stripping of debug logs in production builds
|
|
2460
2527
|
* // e.g., if (__DEV__) { logger.debug(...) }
|
|
2461
2528
|
*/
|
|
2462
|
-
declare function createLogger(config?: Config$5): Instance$
|
|
2529
|
+
declare function createLogger(config?: Config$5): Instance$4;
|
|
2463
2530
|
|
|
2464
2531
|
/**
|
|
2465
2532
|
* Gets the mapping for an event.
|
|
@@ -2497,7 +2564,7 @@ declare function getMappingValue(value: DeepPartialEvent | unknown | undefined,
|
|
|
2497
2564
|
* @param collector - Collector instance for context
|
|
2498
2565
|
* @returns Object with transformed event, data, mapping rule, and ignore flag
|
|
2499
2566
|
*/
|
|
2500
|
-
declare function processEventMapping<T extends DeepPartialEvent | Event>(event: T, config: Config$4, collector: Instance$
|
|
2567
|
+
declare function processEventMapping<T extends DeepPartialEvent | Event>(event: T, config: Config$4, collector: Instance$6): Promise<{
|
|
2501
2568
|
event: T;
|
|
2502
2569
|
data?: Property;
|
|
2503
2570
|
mapping?: Rule;
|
|
@@ -2576,7 +2643,7 @@ declare function traverseEnv<T extends object>(env: T, replacer: (value: unknown
|
|
|
2576
2643
|
* Includes all logger methods as jest.fn() plus tracking of scoped loggers
|
|
2577
2644
|
* Extends Instance to ensure type compatibility
|
|
2578
2645
|
*/
|
|
2579
|
-
interface MockLogger extends Instance$
|
|
2646
|
+
interface MockLogger extends Instance$4 {
|
|
2580
2647
|
error: jest.Mock;
|
|
2581
2648
|
warn: jest.Mock;
|
|
2582
2649
|
info: jest.Mock;
|
|
@@ -2813,7 +2880,7 @@ declare function wrapCondition(code: string): Condition;
|
|
|
2813
2880
|
* const fn = wrapFn('const parts = value.user.email.split("@"); return parts[1].toUpperCase()');
|
|
2814
2881
|
* ```
|
|
2815
2882
|
*/
|
|
2816
|
-
declare function wrapFn(code: string): Fn$
|
|
2883
|
+
declare function wrapFn(code: string): Fn$2;
|
|
2817
2884
|
/**
|
|
2818
2885
|
* Wrap inline code string as Validate function.
|
|
2819
2886
|
*
|
|
@@ -2847,13 +2914,13 @@ interface WalkerOSPackageMeta {
|
|
|
2847
2914
|
version: string;
|
|
2848
2915
|
description?: string;
|
|
2849
2916
|
type?: string;
|
|
2850
|
-
platform?: string;
|
|
2917
|
+
platform?: string | string[];
|
|
2851
2918
|
}
|
|
2852
2919
|
interface WalkerOSPackageInfo {
|
|
2853
2920
|
packageName: string;
|
|
2854
2921
|
version: string;
|
|
2855
2922
|
type?: string;
|
|
2856
|
-
platform?: string;
|
|
2923
|
+
platform?: string | string[];
|
|
2857
2924
|
schemas: Record<string, unknown>;
|
|
2858
2925
|
examples: Record<string, unknown>;
|
|
2859
2926
|
hints?: Record<string, unknown>;
|
|
@@ -2920,4 +2987,11 @@ declare function mcpError(error: unknown, hint?: string): {
|
|
|
2920
2987
|
*/
|
|
2921
2988
|
declare function compileMatcher(expr: MatchExpression | '*'): CompiledMatcher;
|
|
2922
2989
|
|
|
2923
|
-
|
|
2990
|
+
type PackageType = 'source' | 'destination' | 'transformer' | 'store';
|
|
2991
|
+
interface PackageSchemas {
|
|
2992
|
+
settings?: Record<string, unknown>;
|
|
2993
|
+
[key: string]: unknown;
|
|
2994
|
+
}
|
|
2995
|
+
declare function mergeConfigSchema(type: PackageType, packageSchemas: PackageSchemas): Record<string, unknown>;
|
|
2996
|
+
|
|
2997
|
+
export { collector as Collector, Const, context as Context, destination as Destination, ENV_MARKER_PREFIX, elb as Elb, type ExampleSummary, flow as Flow, hint as Hint, hooks as Hooks, Level, lifecycle as Lifecycle, logger as Logger, mapping as Mapping, type MarketingParameters, matcher as Matcher, type MockLogger, on as On, request as Request, type ResolveOptions, type RespondFn, type RespondOptions, type SendDataValue, type SendHeaders, type SendResponse, simulation as Simulation, source as Source, type StorageType, store as Store, transformer as Transformer, trigger as Trigger, walkeros as WalkerOS, type WalkerOSPackage, type WalkerOSPackageInfo, type WalkerOSPackageMeta, anonymizeIP, assign, branch, castToProperty, castValue, clone, compileMatcher, createDestination, createEvent, createLogger, createMockLogger, createRespond, debounce, fetchPackage, fetchPackageSchema, filterValues, getBrowser, getBrowserVersion, getByPath, getDeviceType, getEvent, getFlowSettings, getGrantedConsent, getHeaders, getId, getMappingEvent, getMappingValue, getMarketingParameters, getOS, getOSVersion, getPlatform, isArguments, isArray, isBoolean, isCommand, isDefined, isElementOrDocument, isFunction, isNumber, isObject, isPropertyType, isSameType, isString, mcpError, mcpResult, mergeConfigSchema, mergeContractSchemas, mockEnv, packageNameToVariable, parseUserAgent, processEventMapping, requestToData, requestToParameter, resolveContracts, setByPath, throttle, throwError, transformData, traverseEnv, trim, tryCatch, tryCatchAsync, useHooks, walkPath, wrapCondition, wrapFn, wrapValidate };
|