@walkeros/core 4.0.0-next-1777463920154 → 4.0.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 +3 -1
- package/dist/dev.d.mts +77 -56
- package/dist/dev.d.ts +77 -56
- package/dist/index.d.mts +116 -128
- package/dist/index.d.ts +116 -128
- 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
|
@@ -62,7 +62,7 @@ type ValueType = string | ValueConfig;
|
|
|
62
62
|
interface ValueConfig {
|
|
63
63
|
condition?: Condition;
|
|
64
64
|
consent?: Consent;
|
|
65
|
-
fn?: Fn$
|
|
65
|
+
fn?: Fn$4;
|
|
66
66
|
key?: string;
|
|
67
67
|
loop?: Loop;
|
|
68
68
|
map?: Map;
|
|
@@ -70,18 +70,21 @@ interface ValueConfig {
|
|
|
70
70
|
validate?: Validate;
|
|
71
71
|
value?: PropertyType;
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
interface Context$6 {
|
|
74
|
+
event: DeepPartialEvent;
|
|
75
|
+
/** The surrounding mapping config: a Value (value-level) or a Rule (rule-level). */
|
|
76
|
+
mapping: Value | Rule;
|
|
77
|
+
collector: Instance$6;
|
|
78
|
+
logger: Instance$4;
|
|
79
|
+
consent?: Consent;
|
|
80
|
+
}
|
|
81
|
+
type Fn$4 = (value: unknown, context: Context$6) => PromiseOrValue<Property | unknown>;
|
|
82
|
+
type Condition = (value: unknown, context: Context$6) => PromiseOrValue<boolean>;
|
|
83
|
+
type Validate = (value: unknown, context: Context$6) => PromiseOrValue<boolean>;
|
|
75
84
|
type Loop = [Value, Value];
|
|
76
85
|
type Map = {
|
|
77
86
|
[key: string]: Value;
|
|
78
87
|
};
|
|
79
|
-
interface Options$1 {
|
|
80
|
-
consent?: Consent;
|
|
81
|
-
collector?: Instance$6;
|
|
82
|
-
props?: unknown;
|
|
83
|
-
}
|
|
84
|
-
type Validate = (value?: unknown) => PromiseOrValue<boolean>;
|
|
85
88
|
|
|
86
89
|
type mapping_Condition = Condition;
|
|
87
90
|
type mapping_Loop = Loop;
|
|
@@ -94,7 +97,7 @@ type mapping_ValueConfig = ValueConfig;
|
|
|
94
97
|
type mapping_ValueType = ValueType;
|
|
95
98
|
type mapping_Values = Values;
|
|
96
99
|
declare namespace mapping {
|
|
97
|
-
export type { mapping_Condition as Condition, Config$7 as Config, Data$1 as Data, Fn$
|
|
100
|
+
export type { mapping_Condition as Condition, Config$7 as Config, Context$6 as Context, Data$1 as Data, Fn$4 as Fn, mapping_Loop as Loop, mapping_Map as Map, Policy$1 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 };
|
|
98
101
|
}
|
|
99
102
|
|
|
100
103
|
interface CacheRule {
|
|
@@ -277,7 +280,7 @@ interface CommandFn {
|
|
|
277
280
|
(command: 'consent', consent: Consent): Promise<PushResult>;
|
|
278
281
|
<T extends Types$4>(command: 'destination', destination: Init$3<T> | Instance$5<T>, config?: Config$5<T>): Promise<PushResult>;
|
|
279
282
|
<K extends keyof Functions>(command: 'hook', name: K, hookFn: Functions[K]): Promise<PushResult>;
|
|
280
|
-
(command: 'on', type: Types$3, rules: SingleOrArray<
|
|
283
|
+
(command: 'on', type: Types$3, rules: SingleOrArray<Subscription>): Promise<PushResult>;
|
|
281
284
|
(command: 'user', user: User): Promise<PushResult>;
|
|
282
285
|
(command: 'run', runState?: {
|
|
283
286
|
consent?: Consent;
|
|
@@ -563,14 +566,14 @@ interface EventFn<R = Promise<PushResult>> {
|
|
|
563
566
|
(event: string): R;
|
|
564
567
|
(event: string, data: Properties): R;
|
|
565
568
|
}
|
|
566
|
-
interface Fn$
|
|
569
|
+
interface Fn$3<R = Promise<PushResult>, Config = unknown> extends EventFn<R>, WalkerCommands<R, Config> {
|
|
567
570
|
}
|
|
568
571
|
interface WalkerCommands<R = Promise<PushResult>, Config = unknown> {
|
|
569
572
|
(event: 'walker config', config: Partial<Config>): R;
|
|
570
573
|
(event: 'walker consent', consent: Consent): R;
|
|
571
574
|
<T extends Types$4>(event: 'walker destination', destination: Init$3<T> | Instance$5<T>, config?: Config$5<T>): R;
|
|
572
575
|
<K extends keyof Functions>(event: 'walker hook', name: K, hookFn: Functions[K]): R;
|
|
573
|
-
(event: 'walker on', type: Types$3, rules: SingleOrArray<
|
|
576
|
+
(event: 'walker on', type: Types$3, rules: SingleOrArray<Subscription>): R;
|
|
574
577
|
(event: 'walker user', user: User): R;
|
|
575
578
|
(event: 'walker run', runState: {
|
|
576
579
|
consent?: Consent;
|
|
@@ -596,7 +599,7 @@ type elb_PushData<Config = unknown> = PushData<Config>;
|
|
|
596
599
|
type elb_PushResult = PushResult;
|
|
597
600
|
type elb_WalkerCommands<R = Promise<PushResult>, Config = unknown> = WalkerCommands<R, Config>;
|
|
598
601
|
declare namespace elb {
|
|
599
|
-
export type { Event$1 as Event, elb_EventFn as EventFn, Fn$
|
|
602
|
+
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 };
|
|
600
603
|
}
|
|
601
604
|
|
|
602
605
|
/**
|
|
@@ -1299,83 +1302,95 @@ declare namespace logger {
|
|
|
1299
1302
|
export { type Config$4 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 };
|
|
1300
1303
|
}
|
|
1301
1304
|
|
|
1305
|
+
/** Collector state mapping for the `on` actions. */
|
|
1302
1306
|
type Config$3 = {
|
|
1303
|
-
config?: Array<
|
|
1304
|
-
consent?: Array<
|
|
1305
|
-
custom?: Array<
|
|
1306
|
-
globals?: Array<
|
|
1307
|
-
ready?: Array<
|
|
1308
|
-
run?: Array<
|
|
1309
|
-
session?: Array<
|
|
1310
|
-
user?: Array<
|
|
1307
|
+
config?: Array<GenericFn>;
|
|
1308
|
+
consent?: Array<ConsentRule>;
|
|
1309
|
+
custom?: Array<GenericFn>;
|
|
1310
|
+
globals?: Array<GenericFn>;
|
|
1311
|
+
ready?: Array<ReadyFn>;
|
|
1312
|
+
run?: Array<RunFn>;
|
|
1313
|
+
session?: Array<SessionFn>;
|
|
1314
|
+
user?: Array<UserFn>;
|
|
1311
1315
|
};
|
|
1316
|
+
/** Allow arbitrary string events via `(string & {})`. */
|
|
1312
1317
|
type Types$3 = keyof Config$3 | (string & {});
|
|
1313
|
-
|
|
1318
|
+
/** Map each event type to its expected data payload type. */
|
|
1319
|
+
interface EventDataMap {
|
|
1314
1320
|
config: Partial<Config$6>;
|
|
1315
1321
|
consent: Consent;
|
|
1316
1322
|
custom: Properties;
|
|
1317
1323
|
globals: Properties;
|
|
1318
|
-
ready:
|
|
1319
|
-
run:
|
|
1320
|
-
session: SessionData;
|
|
1324
|
+
ready: void;
|
|
1325
|
+
run: void;
|
|
1326
|
+
session: SessionData | undefined;
|
|
1321
1327
|
user: User;
|
|
1322
1328
|
}
|
|
1323
|
-
type
|
|
1324
|
-
type
|
|
1329
|
+
/** Extract the data type for a specific event. */
|
|
1330
|
+
type EventData<T extends keyof EventDataMap> = EventDataMap[T];
|
|
1331
|
+
/** Union of all possible data types. */
|
|
1332
|
+
type AnyEventData = EventDataMap[keyof EventDataMap];
|
|
1333
|
+
/**
|
|
1334
|
+
* Context provided to every `on` callback.
|
|
1335
|
+
* Same posture as Mapping.Context: collector + logger only;
|
|
1336
|
+
* subscriptions are a collector-level concern, not a stage-level one.
|
|
1337
|
+
*/
|
|
1325
1338
|
interface Context$4 {
|
|
1326
|
-
|
|
1327
|
-
|
|
1339
|
+
collector: Instance$6;
|
|
1340
|
+
logger: Instance$4;
|
|
1328
1341
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1342
|
+
/** Unified subscription callback shape. */
|
|
1343
|
+
type Fn$2<TData = unknown> = (data: TData, context: Context$4) => PromiseOrValue<void>;
|
|
1344
|
+
/** Typed-data variants for readability and IntelliSense. All reduce to Fn<TData>. */
|
|
1345
|
+
type ConsentFn = Fn$2<Consent>;
|
|
1346
|
+
type GenericFn = Fn$2<unknown>;
|
|
1347
|
+
type ReadyFn = Fn$2<void>;
|
|
1348
|
+
type RunFn = Fn$2<void>;
|
|
1349
|
+
type SessionFn = Fn$2<SessionData | undefined>;
|
|
1350
|
+
type UserFn = Fn$2<User>;
|
|
1351
|
+
/**
|
|
1352
|
+
* Consent rule: a record of `{ [consentKey]: ConsentFn }`.
|
|
1353
|
+
* Only the consent action uses this shape (per-key handler dispatch).
|
|
1354
|
+
*/
|
|
1355
|
+
interface ConsentRule {
|
|
1331
1356
|
[key: string]: ConsentFn;
|
|
1332
1357
|
}
|
|
1333
|
-
|
|
1334
|
-
type
|
|
1335
|
-
type GenericFn = (collector: Instance$6, data: unknown) => void;
|
|
1336
|
-
type ReadyConfig = ReadyFn;
|
|
1337
|
-
type ReadyFn = (collector: Instance$6) => void;
|
|
1338
|
-
type RunConfig = RunFn;
|
|
1339
|
-
type RunFn = (collector: Instance$6) => void;
|
|
1340
|
-
type SessionConfig = SessionFn;
|
|
1341
|
-
type SessionFn = (collector: Instance$6, session?: unknown) => void;
|
|
1342
|
-
type UserConfig = UserFn;
|
|
1343
|
-
type UserFn = (collector: Instance$6, user: User) => void;
|
|
1358
|
+
/** Anything registerable via `walker.on(action, X)`: a typed callback or a consent rule record. */
|
|
1359
|
+
type Subscription = ConsentRule | GenericFn | ReadyFn | RunFn | SessionFn | UserFn;
|
|
1344
1360
|
interface OnConfig {
|
|
1345
|
-
config?:
|
|
1346
|
-
consent?:
|
|
1347
|
-
custom?:
|
|
1348
|
-
globals?:
|
|
1349
|
-
ready?:
|
|
1350
|
-
run?:
|
|
1351
|
-
session?:
|
|
1352
|
-
user?:
|
|
1353
|
-
[key: string]:
|
|
1361
|
+
config?: GenericFn[];
|
|
1362
|
+
consent?: ConsentRule[];
|
|
1363
|
+
custom?: GenericFn[];
|
|
1364
|
+
globals?: GenericFn[];
|
|
1365
|
+
ready?: ReadyFn[];
|
|
1366
|
+
run?: RunFn[];
|
|
1367
|
+
session?: SessionFn[];
|
|
1368
|
+
user?: UserFn[];
|
|
1369
|
+
[key: string]: ConsentRule[] | GenericFn[] | ReadyFn[] | RunFn[] | SessionFn[] | UserFn[] | undefined;
|
|
1354
1370
|
}
|
|
1371
|
+
/**
|
|
1372
|
+
* Destination `on` handler: receives the action type and a destination context.
|
|
1373
|
+
* Already context-style; kept for compatibility with the destination interface.
|
|
1374
|
+
*/
|
|
1355
1375
|
type OnFn<T extends TypesGeneric$3 = Types$4> = (type: Types$3, context: Context$5<T>) => PromiseOrValue<void>;
|
|
1356
1376
|
type OnFnRuntime = (type: Types$3, context: Context$5) => PromiseOrValue<void>;
|
|
1357
1377
|
|
|
1358
|
-
type
|
|
1359
|
-
type on_ConsentConfig = ConsentConfig;
|
|
1378
|
+
type on_AnyEventData = AnyEventData;
|
|
1360
1379
|
type on_ConsentFn = ConsentFn;
|
|
1361
|
-
type
|
|
1362
|
-
type
|
|
1363
|
-
type
|
|
1380
|
+
type on_ConsentRule = ConsentRule;
|
|
1381
|
+
type on_EventData<T extends keyof EventDataMap> = EventData<T>;
|
|
1382
|
+
type on_EventDataMap = EventDataMap;
|
|
1364
1383
|
type on_GenericFn = GenericFn;
|
|
1365
1384
|
type on_OnConfig = OnConfig;
|
|
1366
1385
|
type on_OnFn<T extends TypesGeneric$3 = Types$4> = OnFn<T>;
|
|
1367
1386
|
type on_OnFnRuntime = OnFnRuntime;
|
|
1368
|
-
type on_Options = Options;
|
|
1369
|
-
type on_ReadyConfig = ReadyConfig;
|
|
1370
1387
|
type on_ReadyFn = ReadyFn;
|
|
1371
|
-
type on_RunConfig = RunConfig;
|
|
1372
1388
|
type on_RunFn = RunFn;
|
|
1373
|
-
type on_SessionConfig = SessionConfig;
|
|
1374
1389
|
type on_SessionFn = SessionFn;
|
|
1375
|
-
type
|
|
1390
|
+
type on_Subscription = Subscription;
|
|
1376
1391
|
type on_UserFn = UserFn;
|
|
1377
1392
|
declare namespace on {
|
|
1378
|
-
export type {
|
|
1393
|
+
export type { on_AnyEventData as AnyEventData, Config$3 as Config, on_ConsentFn as ConsentFn, on_ConsentRule as ConsentRule, Context$4 as Context, on_EventData as EventData, on_EventDataMap as EventDataMap, Fn$2 as Fn, on_GenericFn as GenericFn, on_OnConfig as OnConfig, on_OnFn as OnFn, on_OnFnRuntime as OnFnRuntime, on_ReadyFn as ReadyFn, on_RunFn as RunFn, on_SessionFn as SessionFn, on_Subscription as Subscription, Types$3 as Types, on_UserFn as UserFn };
|
|
1379
1394
|
}
|
|
1380
1395
|
|
|
1381
1396
|
interface NextRule {
|
|
@@ -1575,7 +1590,7 @@ interface BaseEnv$1 {
|
|
|
1575
1590
|
push: PushFn$1;
|
|
1576
1591
|
command: CommandFn;
|
|
1577
1592
|
sources?: Sources;
|
|
1578
|
-
elb: Fn$
|
|
1593
|
+
elb: Fn$3;
|
|
1579
1594
|
logger: Instance$4;
|
|
1580
1595
|
}
|
|
1581
1596
|
/**
|
|
@@ -1588,7 +1603,7 @@ interface BaseEnv$1 {
|
|
|
1588
1603
|
* @template E - Environment dependencies type
|
|
1589
1604
|
* @template I - InitSettings configuration type (user input)
|
|
1590
1605
|
*/
|
|
1591
|
-
interface Types$1<S = unknown, M = unknown, P = Fn$
|
|
1606
|
+
interface Types$1<S = unknown, M = unknown, P = Fn$3, E = BaseEnv$1, I = S> {
|
|
1592
1607
|
settings: S;
|
|
1593
1608
|
initSettings: I;
|
|
1594
1609
|
mapping: M;
|
|
@@ -1794,7 +1809,7 @@ interface FlowHandle {
|
|
|
1794
1809
|
/** The collector instance created by startFlow. */
|
|
1795
1810
|
collector: Instance$6;
|
|
1796
1811
|
/** The elb push function for direct event injection. */
|
|
1797
|
-
elb: Fn$
|
|
1812
|
+
elb: Fn$3;
|
|
1798
1813
|
}
|
|
1799
1814
|
/** What createTrigger returns — a flow handle (lazy) and a trigger function. */
|
|
1800
1815
|
interface Instance<TContent = unknown, TResult = unknown> {
|
|
@@ -1862,7 +1877,7 @@ declare namespace trigger {
|
|
|
1862
1877
|
}
|
|
1863
1878
|
|
|
1864
1879
|
type AnyObject<T = unknown> = Record<string, T>;
|
|
1865
|
-
type Elb = Fn$
|
|
1880
|
+
type Elb = Fn$3;
|
|
1866
1881
|
type AnyFunction = (...args: unknown[]) => unknown;
|
|
1867
1882
|
type SingleOrArray<T> = T | Array<T>;
|
|
1868
1883
|
type Events = Array<Event>;
|
|
@@ -2492,9 +2507,10 @@ declare function createLogger(config?: Config$4): Instance$4;
|
|
|
2492
2507
|
*
|
|
2493
2508
|
* @param event The event to get the mapping for (can be partial or full).
|
|
2494
2509
|
* @param mapping The mapping rules.
|
|
2510
|
+
* @param collector Required to evaluate rule-level conditions against the unified Context. Legacy callers may omit; rule-level conditions then run with `undefined as never` (defensive).
|
|
2495
2511
|
* @returns The mapping result.
|
|
2496
2512
|
*/
|
|
2497
|
-
declare function getMappingEvent(event: DeepPartialEvent | PartialEvent | Event, mapping?: Rules): Promise<Result$2>;
|
|
2513
|
+
declare function getMappingEvent(event: DeepPartialEvent | PartialEvent | Event, mapping?: Rules, collector?: Instance$6): Promise<Result$2>;
|
|
2498
2514
|
/**
|
|
2499
2515
|
* Gets a value from a mapping.
|
|
2500
2516
|
*
|
|
@@ -2503,7 +2519,7 @@ declare function getMappingEvent(event: DeepPartialEvent | PartialEvent | Event,
|
|
|
2503
2519
|
* @param options The mapping options.
|
|
2504
2520
|
* @returns The mapped value.
|
|
2505
2521
|
*/
|
|
2506
|
-
declare function getMappingValue(value: DeepPartialEvent | unknown | undefined, data?: Data$1,
|
|
2522
|
+
declare function getMappingValue(value: DeepPartialEvent | unknown | undefined, data?: Data$1, context?: Partial<Context$6>): Promise<Property | undefined>;
|
|
2507
2523
|
/**
|
|
2508
2524
|
* Processes an event through mapping configuration.
|
|
2509
2525
|
*
|
|
@@ -2821,82 +2837,52 @@ declare function getDeviceType(userAgent: string): string | undefined;
|
|
|
2821
2837
|
/**
|
|
2822
2838
|
* Inline Code Wrapping Utilities
|
|
2823
2839
|
*
|
|
2824
|
-
* Converts inline code strings to executable functions
|
|
2825
|
-
*
|
|
2840
|
+
* Converts inline code strings to executable functions for the three mapping
|
|
2841
|
+
* callbacks: condition, fn, validate. All three share a single signature:
|
|
2842
|
+
*
|
|
2843
|
+
* (value, context) => result
|
|
2844
|
+
*
|
|
2845
|
+
* Inside the inline body, the available bindings are:
|
|
2846
|
+
* - value: unknown - the value being mapped/validated/checked
|
|
2847
|
+
* - context: Mapping.Context with these fields:
|
|
2848
|
+
* event: WalkerOS.DeepPartialEvent
|
|
2849
|
+
* mapping: Mapping.Value | Mapping.Rule
|
|
2850
|
+
* collector: Collector.Instance
|
|
2851
|
+
* logger: Logger.Instance
|
|
2852
|
+
* consent?: WalkerOS.Consent
|
|
2853
|
+
*
|
|
2854
|
+
* If the body has no explicit `return`, it is auto-wrapped with `return`.
|
|
2826
2855
|
*
|
|
2827
2856
|
* @packageDocumentation
|
|
2828
2857
|
*/
|
|
2829
2858
|
|
|
2830
2859
|
/**
|
|
2831
|
-
* Wrap inline code
|
|
2832
|
-
*
|
|
2833
|
-
* @param code - Inline code string
|
|
2834
|
-
* @returns Condition function matching Mapping.Condition signature
|
|
2835
|
-
*
|
|
2836
|
-
* @remarks
|
|
2837
|
-
* Available parameters in code:
|
|
2838
|
-
* - `value` - The event or partial event being processed
|
|
2839
|
-
* - `mapping` - Current mapping configuration
|
|
2840
|
-
* - `collector` - Collector instance
|
|
2841
|
-
*
|
|
2842
|
-
* If code has no explicit return, it's auto-wrapped with `return`.
|
|
2860
|
+
* Wrap inline code as a Mapping.Condition.
|
|
2843
2861
|
*
|
|
2844
2862
|
* @example
|
|
2845
|
-
* ```
|
|
2846
|
-
*
|
|
2847
|
-
*
|
|
2848
|
-
* fn(event, mapping, collector); // returns boolean
|
|
2849
|
-
*
|
|
2850
|
-
* // Multi-statement (explicit return)
|
|
2851
|
-
* const fn = wrapCondition('const threshold = 100; return value.data.total > threshold');
|
|
2863
|
+
* ```ts
|
|
2864
|
+
* const c = wrapCondition('context.consent?.marketing === true');
|
|
2865
|
+
* c(value, context); // boolean
|
|
2852
2866
|
* ```
|
|
2853
2867
|
*/
|
|
2854
2868
|
declare function wrapCondition(code: string): Condition;
|
|
2855
2869
|
/**
|
|
2856
|
-
* Wrap inline code
|
|
2857
|
-
*
|
|
2858
|
-
* @param code - Inline code string
|
|
2859
|
-
* @returns Fn function matching Mapping.Fn signature
|
|
2860
|
-
*
|
|
2861
|
-
* @remarks
|
|
2862
|
-
* Available parameters in code:
|
|
2863
|
-
* - `value` - The event or partial event being processed
|
|
2864
|
-
* - `mapping` - Current mapping configuration
|
|
2865
|
-
* - `options` - Options object with consent and collector
|
|
2866
|
-
*
|
|
2867
|
-
* If code has no explicit return, it's auto-wrapped with `return`.
|
|
2870
|
+
* Wrap inline code as a Mapping.Fn.
|
|
2868
2871
|
*
|
|
2869
2872
|
* @example
|
|
2870
|
-
* ```
|
|
2871
|
-
* // One-liner (auto-wrapped)
|
|
2873
|
+
* ```ts
|
|
2872
2874
|
* const fn = wrapFn('value.user.email.split("@")[1]');
|
|
2873
|
-
* fn(
|
|
2874
|
-
*
|
|
2875
|
-
* // Multi-statement (explicit return)
|
|
2876
|
-
* const fn = wrapFn('const parts = value.user.email.split("@"); return parts[1].toUpperCase()');
|
|
2875
|
+
* fn(value, context); // domain
|
|
2877
2876
|
* ```
|
|
2878
2877
|
*/
|
|
2879
|
-
declare function wrapFn(code: string): Fn$
|
|
2878
|
+
declare function wrapFn(code: string): Fn$4;
|
|
2880
2879
|
/**
|
|
2881
|
-
* Wrap inline code
|
|
2882
|
-
*
|
|
2883
|
-
* @param code - Inline code string
|
|
2884
|
-
* @returns Validate function matching Mapping.Validate signature
|
|
2885
|
-
*
|
|
2886
|
-
* @remarks
|
|
2887
|
-
* Available parameters in code:
|
|
2888
|
-
* - `value` - The current value being validated
|
|
2889
|
-
*
|
|
2890
|
-
* If code has no explicit return, it's auto-wrapped with `return`.
|
|
2880
|
+
* Wrap inline code as a Mapping.Validate.
|
|
2891
2881
|
*
|
|
2892
2882
|
* @example
|
|
2893
|
-
* ```
|
|
2894
|
-
*
|
|
2895
|
-
*
|
|
2896
|
-
* fn('hello'); // returns true
|
|
2897
|
-
*
|
|
2898
|
-
* // Multi-statement (explicit return)
|
|
2899
|
-
* const fn = wrapValidate('if (!value) return false; return value.length > 0');
|
|
2883
|
+
* ```ts
|
|
2884
|
+
* const v = wrapValidate('typeof value === "string" && value.length > 0');
|
|
2885
|
+
* v(value, context); // boolean
|
|
2900
2886
|
* ```
|
|
2901
2887
|
*/
|
|
2902
2888
|
declare function wrapValidate(code: string): Validate;
|
|
@@ -3030,7 +3016,7 @@ declare function buildCacheContext(ingest?: unknown, event?: unknown): Record<st
|
|
|
3030
3016
|
declare function compileCache(cache: Cache): CompiledCache;
|
|
3031
3017
|
declare function checkCache(compiled: CompiledCache, store: Instance$1, context: Record<string, unknown>, namespace: string): CacheResult | null;
|
|
3032
3018
|
declare function storeCache(store: Instance$1, key: string, value: unknown, ttlSeconds: number): void;
|
|
3033
|
-
declare function applyUpdate(value: unknown, update: Record<string, unknown> | undefined, context: Record<string, unknown
|
|
3019
|
+
declare function applyUpdate(value: unknown, update: Record<string, unknown> | undefined, context: Record<string, unknown>, collector: Instance$6): Promise<unknown>;
|
|
3034
3020
|
|
|
3035
3021
|
type StepOut = Flow.StepOut;
|
|
3036
3022
|
/**
|
|
@@ -3064,8 +3050,10 @@ declare const REF_VAR: RegExp;
|
|
|
3064
3050
|
declare const REF_DEF: RegExp;
|
|
3065
3051
|
declare const REF_ENV: RegExp;
|
|
3066
3052
|
declare const REF_CONTRACT: RegExp;
|
|
3053
|
+
/** Whole-string `$flow.<name>(.<path>)?`: cross-flow value reference. */
|
|
3054
|
+
declare const REF_FLOW: RegExp;
|
|
3067
3055
|
declare const REF_STORE: RegExp;
|
|
3068
3056
|
declare const REF_SECRET: RegExp;
|
|
3069
3057
|
declare const REF_CODE_PREFIX = "$code:";
|
|
3070
3058
|
|
|
3071
|
-
export { cache as Cache, type CacheResult, type ClickIdEntry, collector as Collector, type CompiledCache, type CompiledNext, type CompiledRoute, Const, context as Context, destination as Destination, ENV_MARKER_PREFIX, elb as Elb, type ExampleSummary, Flow, type FlowConfigResolver, hint as Hint, hooks as Hooks, type Ingest, type IngestMeta, Level, lifecycle as Lifecycle, logger as Logger, mapping as Mapping, type MarketingParameters, matcher as Matcher, type MockLogger, on as On, REF_CODE_PREFIX, REF_CONTRACT, REF_DEF, REF_ENV, REF_SECRET, REF_STORE, REF_VAR, 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, applyUpdate, assign, branch, buildCacheContext, castToProperty, castValue, checkCache, clone, compileCache, compileMatcher, compileNext, createDestination, createEvent, createIngest, createLogger, createMockContext, createMockLogger, createRespond, debounce, deepMerge, defaultClickIds, fetchPackage, fetchPackageSchema, filterValues, flattenIncludeSections, formatOut, getBrowser, getBrowserVersion, getByPath, getDeviceType, getEvent, getFlowSettings, getGrantedConsent, getHeaders, getId, getMappingEvent, getMappingValue, getMarketingParameters, getOS, getOSVersion, getPlatform, getSpanId, isArguments, isArray, isBoolean, isCommand, isDefined, isElementOrDocument, isFunction, isNumber, isObject, isPropertyType, isRouteArray, isSameType, isString, mcpError, mcpResult, mergeContractSchemas, mockEnv, packageNameToVariable, parseUserAgent, processEventMapping, requestToData, requestToParameter, resolveContracts, resolveNext, setByPath, storeCache, throttle, throwError, transformData, traverseEnv, trim, tryCatch, tryCatchAsync, useHooks, walkPath, wrapCondition, wrapFn, wrapValidate };
|
|
3059
|
+
export { cache as Cache, type CacheResult, type ClickIdEntry, collector as Collector, type CompiledCache, type CompiledNext, type CompiledRoute, Const, context as Context, destination as Destination, ENV_MARKER_PREFIX, elb as Elb, type ExampleSummary, Flow, type FlowConfigResolver, hint as Hint, hooks as Hooks, type Ingest, type IngestMeta, Level, lifecycle as Lifecycle, logger as Logger, mapping as Mapping, type MarketingParameters, matcher as Matcher, type MockLogger, on as On, REF_CODE_PREFIX, REF_CONTRACT, REF_DEF, REF_ENV, REF_FLOW, REF_SECRET, REF_STORE, REF_VAR, 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, applyUpdate, assign, branch, buildCacheContext, castToProperty, castValue, checkCache, clone, compileCache, compileMatcher, compileNext, createDestination, createEvent, createIngest, createLogger, createMockContext, createMockLogger, createRespond, debounce, deepMerge, defaultClickIds, fetchPackage, fetchPackageSchema, filterValues, flattenIncludeSections, formatOut, getBrowser, getBrowserVersion, getByPath, getDeviceType, getEvent, getFlowSettings, getGrantedConsent, getHeaders, getId, getMappingEvent, getMappingValue, getMarketingParameters, getOS, getOSVersion, getPlatform, getSpanId, isArguments, isArray, isBoolean, isCommand, isDefined, isElementOrDocument, isFunction, isNumber, isObject, isPropertyType, isRouteArray, isSameType, isString, mcpError, mcpResult, mergeContractSchemas, mockEnv, packageNameToVariable, parseUserAgent, processEventMapping, requestToData, requestToParameter, resolveContracts, resolveNext, setByPath, storeCache, throttle, throwError, transformData, traverseEnv, trim, tryCatch, tryCatchAsync, useHooks, walkPath, wrapCondition, wrapFn, wrapValidate };
|