@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/README.md
CHANGED
|
@@ -224,9 +224,11 @@ getId(10); // Returns 10-character string
|
|
|
224
224
|
|
|
225
225
|
#### getMappingValue
|
|
226
226
|
|
|
227
|
-
`getMappingValue(event: WalkerOS.Event, mapping: Mapping.Data,
|
|
227
|
+
`getMappingValue(event: WalkerOS.Event, mapping: Mapping.Data, context?: Partial<Mapping.Context>): Promise<WalkerOS.Property | undefined>`
|
|
228
228
|
extracts values from events using
|
|
229
229
|
[mapping configurations](https://www.walkeros.io/docs/destinations/event-mapping).
|
|
230
|
+
The `context` argument requires at least `{ collector }`; `event`, `logger`, and
|
|
231
|
+
`consent` are derived or optional.
|
|
230
232
|
|
|
231
233
|
```ts
|
|
232
234
|
// Simple path mapping
|
package/dist/dev.d.mts
CHANGED
|
@@ -5368,7 +5368,7 @@ interface CommandFn {
|
|
|
5368
5368
|
(command: 'consent', consent: Consent): Promise<PushResult>;
|
|
5369
5369
|
<T extends Types$4>(command: 'destination', destination: Init$3<T> | Instance$4<T>, config?: Config$6<T>): Promise<PushResult>;
|
|
5370
5370
|
<K extends keyof Functions>(command: 'hook', name: K, hookFn: Functions[K]): Promise<PushResult>;
|
|
5371
|
-
(command: 'on', type: Types$3, rules: SingleOrArray<
|
|
5371
|
+
(command: 'on', type: Types$3, rules: SingleOrArray<Subscription>): Promise<PushResult>;
|
|
5372
5372
|
(command: 'user', user: User): Promise<PushResult>;
|
|
5373
5373
|
(command: 'run', runState?: {
|
|
5374
5374
|
consent?: Consent;
|
|
@@ -5551,19 +5551,19 @@ interface InitDestinations {
|
|
|
5551
5551
|
* Context provided to destination functions.
|
|
5552
5552
|
* Extends base context with destination-specific properties.
|
|
5553
5553
|
*/
|
|
5554
|
-
interface Context$
|
|
5554
|
+
interface Context$5<T extends TypesGeneric$3 = Types$4> extends Base<Config$6<T>, Env$3<T>> {
|
|
5555
5555
|
id: string;
|
|
5556
5556
|
data?: Data$1;
|
|
5557
5557
|
}
|
|
5558
|
-
interface PushContext<T extends TypesGeneric$3 = Types$4> extends Context$
|
|
5558
|
+
interface PushContext<T extends TypesGeneric$3 = Types$4> extends Context$5<T> {
|
|
5559
5559
|
ingest: Ingest;
|
|
5560
5560
|
rule?: Rule<Mapping$1<T>>;
|
|
5561
5561
|
}
|
|
5562
|
-
interface PushBatchContext<T extends TypesGeneric$3 = Types$4> extends Context$
|
|
5562
|
+
interface PushBatchContext<T extends TypesGeneric$3 = Types$4> extends Context$5<T> {
|
|
5563
5563
|
ingest: Ingest;
|
|
5564
5564
|
rule?: Rule<Mapping$1<T>>;
|
|
5565
5565
|
}
|
|
5566
|
-
type InitFn$1<T extends TypesGeneric$3 = Types$4> = (context: Context$
|
|
5566
|
+
type InitFn$1<T extends TypesGeneric$3 = Types$4> = (context: Context$5<T>) => PromiseOrValue<void | false | Config$6<T>>;
|
|
5567
5567
|
type PushFn<T extends TypesGeneric$3 = Types$4> = (event: Event, context: PushContext<T>) => PromiseOrValue<void | unknown>;
|
|
5568
5568
|
type PushBatchFn<T extends TypesGeneric$3 = Types$4> = (batch: Batch<Mapping$1<T>>, context: PushBatchContext<T>) => void;
|
|
5569
5569
|
interface Batch<Mapping> {
|
|
@@ -5591,14 +5591,14 @@ interface EventFn<R = Promise<PushResult>> {
|
|
|
5591
5591
|
(event: string): R;
|
|
5592
5592
|
(event: string, data: Properties): R;
|
|
5593
5593
|
}
|
|
5594
|
-
interface Fn$
|
|
5594
|
+
interface Fn$3<R = Promise<PushResult>, Config = unknown> extends EventFn<R>, WalkerCommands<R, Config> {
|
|
5595
5595
|
}
|
|
5596
5596
|
interface WalkerCommands<R = Promise<PushResult>, Config = unknown> {
|
|
5597
5597
|
(event: 'walker config', config: Partial<Config>): R;
|
|
5598
5598
|
(event: 'walker consent', consent: Consent): R;
|
|
5599
5599
|
<T extends Types$4>(event: 'walker destination', destination: Init$3<T> | Instance$4<T>, config?: Config$6<T>): R;
|
|
5600
5600
|
<K extends keyof Functions>(event: 'walker hook', name: K, hookFn: Functions[K]): R;
|
|
5601
|
-
(event: 'walker on', type: Types$3, rules: SingleOrArray<
|
|
5601
|
+
(event: 'walker on', type: Types$3, rules: SingleOrArray<Subscription>): R;
|
|
5602
5602
|
(event: 'walker user', user: User): R;
|
|
5603
5603
|
(event: 'walker run', runState: {
|
|
5604
5604
|
consent?: Consent;
|
|
@@ -5720,44 +5720,62 @@ interface Config$5 {
|
|
|
5720
5720
|
jsonHandler?: (data: unknown) => void;
|
|
5721
5721
|
}
|
|
5722
5722
|
|
|
5723
|
+
/** Collector state mapping for the `on` actions. */
|
|
5723
5724
|
type Config$4 = {
|
|
5724
|
-
config?: Array<
|
|
5725
|
-
consent?: Array<
|
|
5726
|
-
custom?: Array<
|
|
5727
|
-
globals?: Array<
|
|
5728
|
-
ready?: Array<
|
|
5729
|
-
run?: Array<
|
|
5730
|
-
session?: Array<
|
|
5731
|
-
user?: Array<
|
|
5725
|
+
config?: Array<GenericFn>;
|
|
5726
|
+
consent?: Array<ConsentRule>;
|
|
5727
|
+
custom?: Array<GenericFn>;
|
|
5728
|
+
globals?: Array<GenericFn>;
|
|
5729
|
+
ready?: Array<ReadyFn>;
|
|
5730
|
+
run?: Array<RunFn>;
|
|
5731
|
+
session?: Array<SessionFn>;
|
|
5732
|
+
user?: Array<UserFn>;
|
|
5732
5733
|
};
|
|
5734
|
+
/** Allow arbitrary string events via `(string & {})`. */
|
|
5733
5735
|
type Types$3 = keyof Config$4 | (string & {});
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
+
/**
|
|
5737
|
+
* Context provided to every `on` callback.
|
|
5738
|
+
* Same posture as Mapping.Context: collector + logger only;
|
|
5739
|
+
* subscriptions are a collector-level concern, not a stage-level one.
|
|
5740
|
+
*/
|
|
5741
|
+
interface Context$4 {
|
|
5742
|
+
collector: Instance$5;
|
|
5743
|
+
logger: Instance$3;
|
|
5744
|
+
}
|
|
5745
|
+
/** Unified subscription callback shape. */
|
|
5746
|
+
type Fn$2<TData = unknown> = (data: TData, context: Context$4) => PromiseOrValue<void>;
|
|
5747
|
+
/** Typed-data variants for readability and IntelliSense. All reduce to Fn<TData>. */
|
|
5748
|
+
type ConsentFn = Fn$2<Consent>;
|
|
5749
|
+
type GenericFn = Fn$2<unknown>;
|
|
5750
|
+
type ReadyFn = Fn$2<void>;
|
|
5751
|
+
type RunFn = Fn$2<void>;
|
|
5752
|
+
type SessionFn = Fn$2<SessionData | undefined>;
|
|
5753
|
+
type UserFn = Fn$2<User>;
|
|
5754
|
+
/**
|
|
5755
|
+
* Consent rule: a record of `{ [consentKey]: ConsentFn }`.
|
|
5756
|
+
* Only the consent action uses this shape (per-key handler dispatch).
|
|
5757
|
+
*/
|
|
5758
|
+
interface ConsentRule {
|
|
5736
5759
|
[key: string]: ConsentFn;
|
|
5737
5760
|
}
|
|
5738
|
-
|
|
5739
|
-
type
|
|
5740
|
-
type GenericFn = (collector: Instance$5, data: unknown) => void;
|
|
5741
|
-
type ReadyConfig = ReadyFn;
|
|
5742
|
-
type ReadyFn = (collector: Instance$5) => void;
|
|
5743
|
-
type RunConfig = RunFn;
|
|
5744
|
-
type RunFn = (collector: Instance$5) => void;
|
|
5745
|
-
type SessionConfig = SessionFn;
|
|
5746
|
-
type SessionFn = (collector: Instance$5, session?: unknown) => void;
|
|
5747
|
-
type UserConfig = UserFn;
|
|
5748
|
-
type UserFn = (collector: Instance$5, user: User) => void;
|
|
5761
|
+
/** Anything registerable via `walker.on(action, X)`: a typed callback or a consent rule record. */
|
|
5762
|
+
type Subscription = ConsentRule | GenericFn | ReadyFn | RunFn | SessionFn | UserFn;
|
|
5749
5763
|
interface OnConfig {
|
|
5750
|
-
config?:
|
|
5751
|
-
consent?:
|
|
5752
|
-
custom?:
|
|
5753
|
-
globals?:
|
|
5754
|
-
ready?:
|
|
5755
|
-
run?:
|
|
5756
|
-
session?:
|
|
5757
|
-
user?:
|
|
5758
|
-
[key: string]:
|
|
5764
|
+
config?: GenericFn[];
|
|
5765
|
+
consent?: ConsentRule[];
|
|
5766
|
+
custom?: GenericFn[];
|
|
5767
|
+
globals?: GenericFn[];
|
|
5768
|
+
ready?: ReadyFn[];
|
|
5769
|
+
run?: RunFn[];
|
|
5770
|
+
session?: SessionFn[];
|
|
5771
|
+
user?: UserFn[];
|
|
5772
|
+
[key: string]: ConsentRule[] | GenericFn[] | ReadyFn[] | RunFn[] | SessionFn[] | UserFn[] | undefined;
|
|
5759
5773
|
}
|
|
5760
|
-
|
|
5774
|
+
/**
|
|
5775
|
+
* Destination `on` handler: receives the action type and a destination context.
|
|
5776
|
+
* Already context-style; kept for compatibility with the destination interface.
|
|
5777
|
+
*/
|
|
5778
|
+
type OnFn<T extends TypesGeneric$3 = Types$4> = (type: Types$3, context: Context$5<T>) => PromiseOrValue<void>;
|
|
5761
5779
|
|
|
5762
5780
|
interface NextRule {
|
|
5763
5781
|
match: MatchExpression | '*';
|
|
@@ -5823,7 +5841,7 @@ interface Config$3<T extends TypesGeneric$2 = Types$2> {
|
|
|
5823
5841
|
* Context provided to transformer functions.
|
|
5824
5842
|
* Extends base context with transformer-specific properties.
|
|
5825
5843
|
*/
|
|
5826
|
-
interface Context$
|
|
5844
|
+
interface Context$3<T extends TypesGeneric$2 = Types$2> extends Base<Config$3<T>, Env$2<T>> {
|
|
5827
5845
|
id: string;
|
|
5828
5846
|
ingest: Ingest;
|
|
5829
5847
|
}
|
|
@@ -5853,7 +5871,7 @@ interface Result<E = DeepPartialEvent> {
|
|
|
5853
5871
|
* @returns void - continue with current event unchanged (passthrough)
|
|
5854
5872
|
* @returns false - stop chain, cancel further processing
|
|
5855
5873
|
*/
|
|
5856
|
-
type Fn$1<T extends TypesGeneric$2 = Types$2, E = DeepPartialEvent> = (event: E, context: Context$
|
|
5874
|
+
type Fn$1<T extends TypesGeneric$2 = Types$2, E = DeepPartialEvent> = (event: E, context: Context$3<T>) => PromiseOrValue<Result<E> | Result<E>[] | false | void>;
|
|
5857
5875
|
/**
|
|
5858
5876
|
* Optional initialization function.
|
|
5859
5877
|
* Called once before first push.
|
|
@@ -5863,7 +5881,7 @@ type Fn$1<T extends TypesGeneric$2 = Types$2, E = DeepPartialEvent> = (event: E,
|
|
|
5863
5881
|
* @returns false - initialization failed, skip this transformer
|
|
5864
5882
|
* @returns Config<T> - return updated config
|
|
5865
5883
|
*/
|
|
5866
|
-
type InitFn<T extends TypesGeneric$2 = Types$2> = (context: Context$
|
|
5884
|
+
type InitFn<T extends TypesGeneric$2 = Types$2> = (context: Context$3<T>) => PromiseOrValue<void | false | Config$3<T>>;
|
|
5867
5885
|
/**
|
|
5868
5886
|
* Transformer instance returned by Init function.
|
|
5869
5887
|
*/
|
|
@@ -5878,7 +5896,7 @@ interface Instance$2<T extends TypesGeneric$2 = Types$2> {
|
|
|
5878
5896
|
* Transformer initialization function.
|
|
5879
5897
|
* Creates a transformer instance from context.
|
|
5880
5898
|
*/
|
|
5881
|
-
type Init$2<T extends TypesGeneric$2 = Types$2> = (context: Context$
|
|
5899
|
+
type Init$2<T extends TypesGeneric$2 = Types$2> = (context: Context$3<Types$2<Partial<Settings$1<T>>, Env$2<T>, InitSettings$2<T>>>) => Instance$2<T> | Promise<Instance$2<T>>;
|
|
5882
5900
|
/**
|
|
5883
5901
|
* Configuration for initializing a transformer.
|
|
5884
5902
|
* Used in collector registration.
|
|
@@ -5910,7 +5928,7 @@ interface BaseEnv$1 {
|
|
|
5910
5928
|
push: PushFn$1;
|
|
5911
5929
|
command: CommandFn;
|
|
5912
5930
|
sources?: Sources;
|
|
5913
|
-
elb: Fn$
|
|
5931
|
+
elb: Fn$3;
|
|
5914
5932
|
logger: Instance$3;
|
|
5915
5933
|
}
|
|
5916
5934
|
/**
|
|
@@ -5923,7 +5941,7 @@ interface BaseEnv$1 {
|
|
|
5923
5941
|
* @template E - Environment dependencies type
|
|
5924
5942
|
* @template I - InitSettings configuration type (user input)
|
|
5925
5943
|
*/
|
|
5926
|
-
interface Types$1<S = unknown, M = unknown, P = Fn$
|
|
5944
|
+
interface Types$1<S = unknown, M = unknown, P = Fn$3, E = BaseEnv$1, I = S> {
|
|
5927
5945
|
settings: S;
|
|
5928
5946
|
initSettings: I;
|
|
5929
5947
|
mapping: M;
|
|
@@ -5984,7 +6002,7 @@ interface Instance$1<T extends TypesGeneric$1 = Types$1> {
|
|
|
5984
6002
|
* Context provided to source init function.
|
|
5985
6003
|
* Extends base context with source-specific properties.
|
|
5986
6004
|
*/
|
|
5987
|
-
interface Context$
|
|
6005
|
+
interface Context$2<T extends TypesGeneric$1 = Types$1> extends Base<Partial<Config$2<T>>, Env$1<T>> {
|
|
5988
6006
|
id: string;
|
|
5989
6007
|
/**
|
|
5990
6008
|
* Sets ingest metadata for the current request.
|
|
@@ -5997,7 +6015,7 @@ interface Context$1<T extends TypesGeneric$1 = Types$1> extends Base<Partial<Con
|
|
|
5997
6015
|
/** Sets respond function for the current request. Called by source per-request. */
|
|
5998
6016
|
setRespond: (fn: RespondFn | undefined) => void;
|
|
5999
6017
|
}
|
|
6000
|
-
type Init$1<T extends TypesGeneric$1 = Types$1> = (context: Context$
|
|
6018
|
+
type Init$1<T extends TypesGeneric$1 = Types$1> = (context: Context$2<T>) => Instance$1<T> | Promise<Instance$1<T>>;
|
|
6001
6019
|
type InitSource<T extends TypesGeneric$1 = Types$1> = {
|
|
6002
6020
|
code: Init$1<T>;
|
|
6003
6021
|
config?: Partial<Config$2<T>>;
|
|
@@ -6037,7 +6055,7 @@ interface Config$1<T extends TypesGeneric = Types> {
|
|
|
6037
6055
|
id?: string;
|
|
6038
6056
|
logger?: Config$5;
|
|
6039
6057
|
}
|
|
6040
|
-
interface Context<T extends TypesGeneric = Types> extends Base<Config$1<T>, Env<T>> {
|
|
6058
|
+
interface Context$1<T extends TypesGeneric = Types> extends Base<Config$1<T>, Env<T>> {
|
|
6041
6059
|
id: string;
|
|
6042
6060
|
}
|
|
6043
6061
|
type GetFn<T = unknown> = (key: string) => T | undefined | Promise<T | undefined>;
|
|
@@ -6051,7 +6069,7 @@ interface Instance<T extends TypesGeneric = Types> {
|
|
|
6051
6069
|
delete: DeleteFn;
|
|
6052
6070
|
destroy?: DestroyFn<Config$1<T>, Env<T>>;
|
|
6053
6071
|
}
|
|
6054
|
-
type Init<T extends TypesGeneric = Types> = (context: Context<Types<Partial<Settings<T>>, Env<T>, InitSettings<T>>>) => Instance<T> | Promise<Instance<T>>;
|
|
6072
|
+
type Init<T extends TypesGeneric = Types> = (context: Context$1<Types<Partial<Settings<T>>, Env<T>, InitSettings<T>>>) => Instance<T> | Promise<Instance<T>>;
|
|
6055
6073
|
type InitStore<T extends TypesGeneric = Types> = {
|
|
6056
6074
|
code: Init<T>;
|
|
6057
6075
|
config?: Partial<Config$1<T>>;
|
|
@@ -6194,18 +6212,21 @@ interface ValueConfig {
|
|
|
6194
6212
|
validate?: Validate;
|
|
6195
6213
|
value?: PropertyType;
|
|
6196
6214
|
}
|
|
6197
|
-
|
|
6198
|
-
|
|
6215
|
+
interface Context {
|
|
6216
|
+
event: DeepPartialEvent;
|
|
6217
|
+
/** The surrounding mapping config: a Value (value-level) or a Rule (rule-level). */
|
|
6218
|
+
mapping: Value | Rule;
|
|
6219
|
+
collector: Instance$5;
|
|
6220
|
+
logger: Instance$3;
|
|
6221
|
+
consent?: Consent;
|
|
6222
|
+
}
|
|
6223
|
+
type Fn = (value: unknown, context: Context) => PromiseOrValue<Property | unknown>;
|
|
6224
|
+
type Condition = (value: unknown, context: Context) => PromiseOrValue<boolean>;
|
|
6225
|
+
type Validate = (value: unknown, context: Context) => PromiseOrValue<boolean>;
|
|
6199
6226
|
type Loop = [Value, Value];
|
|
6200
6227
|
type Map = {
|
|
6201
6228
|
[key: string]: Value;
|
|
6202
6229
|
};
|
|
6203
|
-
interface Options {
|
|
6204
|
-
consent?: Consent;
|
|
6205
|
-
collector?: Instance$5;
|
|
6206
|
-
props?: unknown;
|
|
6207
|
-
}
|
|
6208
|
-
type Validate = (value?: unknown) => PromiseOrValue<boolean>;
|
|
6209
6230
|
|
|
6210
6231
|
interface CacheRule {
|
|
6211
6232
|
match: MatchExpression | '*';
|
package/dist/dev.d.ts
CHANGED
|
@@ -5368,7 +5368,7 @@ interface CommandFn {
|
|
|
5368
5368
|
(command: 'consent', consent: Consent): Promise<PushResult>;
|
|
5369
5369
|
<T extends Types$4>(command: 'destination', destination: Init$3<T> | Instance$4<T>, config?: Config$6<T>): Promise<PushResult>;
|
|
5370
5370
|
<K extends keyof Functions>(command: 'hook', name: K, hookFn: Functions[K]): Promise<PushResult>;
|
|
5371
|
-
(command: 'on', type: Types$3, rules: SingleOrArray<
|
|
5371
|
+
(command: 'on', type: Types$3, rules: SingleOrArray<Subscription>): Promise<PushResult>;
|
|
5372
5372
|
(command: 'user', user: User): Promise<PushResult>;
|
|
5373
5373
|
(command: 'run', runState?: {
|
|
5374
5374
|
consent?: Consent;
|
|
@@ -5551,19 +5551,19 @@ interface InitDestinations {
|
|
|
5551
5551
|
* Context provided to destination functions.
|
|
5552
5552
|
* Extends base context with destination-specific properties.
|
|
5553
5553
|
*/
|
|
5554
|
-
interface Context$
|
|
5554
|
+
interface Context$5<T extends TypesGeneric$3 = Types$4> extends Base<Config$6<T>, Env$3<T>> {
|
|
5555
5555
|
id: string;
|
|
5556
5556
|
data?: Data$1;
|
|
5557
5557
|
}
|
|
5558
|
-
interface PushContext<T extends TypesGeneric$3 = Types$4> extends Context$
|
|
5558
|
+
interface PushContext<T extends TypesGeneric$3 = Types$4> extends Context$5<T> {
|
|
5559
5559
|
ingest: Ingest;
|
|
5560
5560
|
rule?: Rule<Mapping$1<T>>;
|
|
5561
5561
|
}
|
|
5562
|
-
interface PushBatchContext<T extends TypesGeneric$3 = Types$4> extends Context$
|
|
5562
|
+
interface PushBatchContext<T extends TypesGeneric$3 = Types$4> extends Context$5<T> {
|
|
5563
5563
|
ingest: Ingest;
|
|
5564
5564
|
rule?: Rule<Mapping$1<T>>;
|
|
5565
5565
|
}
|
|
5566
|
-
type InitFn$1<T extends TypesGeneric$3 = Types$4> = (context: Context$
|
|
5566
|
+
type InitFn$1<T extends TypesGeneric$3 = Types$4> = (context: Context$5<T>) => PromiseOrValue<void | false | Config$6<T>>;
|
|
5567
5567
|
type PushFn<T extends TypesGeneric$3 = Types$4> = (event: Event, context: PushContext<T>) => PromiseOrValue<void | unknown>;
|
|
5568
5568
|
type PushBatchFn<T extends TypesGeneric$3 = Types$4> = (batch: Batch<Mapping$1<T>>, context: PushBatchContext<T>) => void;
|
|
5569
5569
|
interface Batch<Mapping> {
|
|
@@ -5591,14 +5591,14 @@ interface EventFn<R = Promise<PushResult>> {
|
|
|
5591
5591
|
(event: string): R;
|
|
5592
5592
|
(event: string, data: Properties): R;
|
|
5593
5593
|
}
|
|
5594
|
-
interface Fn$
|
|
5594
|
+
interface Fn$3<R = Promise<PushResult>, Config = unknown> extends EventFn<R>, WalkerCommands<R, Config> {
|
|
5595
5595
|
}
|
|
5596
5596
|
interface WalkerCommands<R = Promise<PushResult>, Config = unknown> {
|
|
5597
5597
|
(event: 'walker config', config: Partial<Config>): R;
|
|
5598
5598
|
(event: 'walker consent', consent: Consent): R;
|
|
5599
5599
|
<T extends Types$4>(event: 'walker destination', destination: Init$3<T> | Instance$4<T>, config?: Config$6<T>): R;
|
|
5600
5600
|
<K extends keyof Functions>(event: 'walker hook', name: K, hookFn: Functions[K]): R;
|
|
5601
|
-
(event: 'walker on', type: Types$3, rules: SingleOrArray<
|
|
5601
|
+
(event: 'walker on', type: Types$3, rules: SingleOrArray<Subscription>): R;
|
|
5602
5602
|
(event: 'walker user', user: User): R;
|
|
5603
5603
|
(event: 'walker run', runState: {
|
|
5604
5604
|
consent?: Consent;
|
|
@@ -5720,44 +5720,62 @@ interface Config$5 {
|
|
|
5720
5720
|
jsonHandler?: (data: unknown) => void;
|
|
5721
5721
|
}
|
|
5722
5722
|
|
|
5723
|
+
/** Collector state mapping for the `on` actions. */
|
|
5723
5724
|
type Config$4 = {
|
|
5724
|
-
config?: Array<
|
|
5725
|
-
consent?: Array<
|
|
5726
|
-
custom?: Array<
|
|
5727
|
-
globals?: Array<
|
|
5728
|
-
ready?: Array<
|
|
5729
|
-
run?: Array<
|
|
5730
|
-
session?: Array<
|
|
5731
|
-
user?: Array<
|
|
5725
|
+
config?: Array<GenericFn>;
|
|
5726
|
+
consent?: Array<ConsentRule>;
|
|
5727
|
+
custom?: Array<GenericFn>;
|
|
5728
|
+
globals?: Array<GenericFn>;
|
|
5729
|
+
ready?: Array<ReadyFn>;
|
|
5730
|
+
run?: Array<RunFn>;
|
|
5731
|
+
session?: Array<SessionFn>;
|
|
5732
|
+
user?: Array<UserFn>;
|
|
5732
5733
|
};
|
|
5734
|
+
/** Allow arbitrary string events via `(string & {})`. */
|
|
5733
5735
|
type Types$3 = keyof Config$4 | (string & {});
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
+
/**
|
|
5737
|
+
* Context provided to every `on` callback.
|
|
5738
|
+
* Same posture as Mapping.Context: collector + logger only;
|
|
5739
|
+
* subscriptions are a collector-level concern, not a stage-level one.
|
|
5740
|
+
*/
|
|
5741
|
+
interface Context$4 {
|
|
5742
|
+
collector: Instance$5;
|
|
5743
|
+
logger: Instance$3;
|
|
5744
|
+
}
|
|
5745
|
+
/** Unified subscription callback shape. */
|
|
5746
|
+
type Fn$2<TData = unknown> = (data: TData, context: Context$4) => PromiseOrValue<void>;
|
|
5747
|
+
/** Typed-data variants for readability and IntelliSense. All reduce to Fn<TData>. */
|
|
5748
|
+
type ConsentFn = Fn$2<Consent>;
|
|
5749
|
+
type GenericFn = Fn$2<unknown>;
|
|
5750
|
+
type ReadyFn = Fn$2<void>;
|
|
5751
|
+
type RunFn = Fn$2<void>;
|
|
5752
|
+
type SessionFn = Fn$2<SessionData | undefined>;
|
|
5753
|
+
type UserFn = Fn$2<User>;
|
|
5754
|
+
/**
|
|
5755
|
+
* Consent rule: a record of `{ [consentKey]: ConsentFn }`.
|
|
5756
|
+
* Only the consent action uses this shape (per-key handler dispatch).
|
|
5757
|
+
*/
|
|
5758
|
+
interface ConsentRule {
|
|
5736
5759
|
[key: string]: ConsentFn;
|
|
5737
5760
|
}
|
|
5738
|
-
|
|
5739
|
-
type
|
|
5740
|
-
type GenericFn = (collector: Instance$5, data: unknown) => void;
|
|
5741
|
-
type ReadyConfig = ReadyFn;
|
|
5742
|
-
type ReadyFn = (collector: Instance$5) => void;
|
|
5743
|
-
type RunConfig = RunFn;
|
|
5744
|
-
type RunFn = (collector: Instance$5) => void;
|
|
5745
|
-
type SessionConfig = SessionFn;
|
|
5746
|
-
type SessionFn = (collector: Instance$5, session?: unknown) => void;
|
|
5747
|
-
type UserConfig = UserFn;
|
|
5748
|
-
type UserFn = (collector: Instance$5, user: User) => void;
|
|
5761
|
+
/** Anything registerable via `walker.on(action, X)`: a typed callback or a consent rule record. */
|
|
5762
|
+
type Subscription = ConsentRule | GenericFn | ReadyFn | RunFn | SessionFn | UserFn;
|
|
5749
5763
|
interface OnConfig {
|
|
5750
|
-
config?:
|
|
5751
|
-
consent?:
|
|
5752
|
-
custom?:
|
|
5753
|
-
globals?:
|
|
5754
|
-
ready?:
|
|
5755
|
-
run?:
|
|
5756
|
-
session?:
|
|
5757
|
-
user?:
|
|
5758
|
-
[key: string]:
|
|
5764
|
+
config?: GenericFn[];
|
|
5765
|
+
consent?: ConsentRule[];
|
|
5766
|
+
custom?: GenericFn[];
|
|
5767
|
+
globals?: GenericFn[];
|
|
5768
|
+
ready?: ReadyFn[];
|
|
5769
|
+
run?: RunFn[];
|
|
5770
|
+
session?: SessionFn[];
|
|
5771
|
+
user?: UserFn[];
|
|
5772
|
+
[key: string]: ConsentRule[] | GenericFn[] | ReadyFn[] | RunFn[] | SessionFn[] | UserFn[] | undefined;
|
|
5759
5773
|
}
|
|
5760
|
-
|
|
5774
|
+
/**
|
|
5775
|
+
* Destination `on` handler: receives the action type and a destination context.
|
|
5776
|
+
* Already context-style; kept for compatibility with the destination interface.
|
|
5777
|
+
*/
|
|
5778
|
+
type OnFn<T extends TypesGeneric$3 = Types$4> = (type: Types$3, context: Context$5<T>) => PromiseOrValue<void>;
|
|
5761
5779
|
|
|
5762
5780
|
interface NextRule {
|
|
5763
5781
|
match: MatchExpression | '*';
|
|
@@ -5823,7 +5841,7 @@ interface Config$3<T extends TypesGeneric$2 = Types$2> {
|
|
|
5823
5841
|
* Context provided to transformer functions.
|
|
5824
5842
|
* Extends base context with transformer-specific properties.
|
|
5825
5843
|
*/
|
|
5826
|
-
interface Context$
|
|
5844
|
+
interface Context$3<T extends TypesGeneric$2 = Types$2> extends Base<Config$3<T>, Env$2<T>> {
|
|
5827
5845
|
id: string;
|
|
5828
5846
|
ingest: Ingest;
|
|
5829
5847
|
}
|
|
@@ -5853,7 +5871,7 @@ interface Result<E = DeepPartialEvent> {
|
|
|
5853
5871
|
* @returns void - continue with current event unchanged (passthrough)
|
|
5854
5872
|
* @returns false - stop chain, cancel further processing
|
|
5855
5873
|
*/
|
|
5856
|
-
type Fn$1<T extends TypesGeneric$2 = Types$2, E = DeepPartialEvent> = (event: E, context: Context$
|
|
5874
|
+
type Fn$1<T extends TypesGeneric$2 = Types$2, E = DeepPartialEvent> = (event: E, context: Context$3<T>) => PromiseOrValue<Result<E> | Result<E>[] | false | void>;
|
|
5857
5875
|
/**
|
|
5858
5876
|
* Optional initialization function.
|
|
5859
5877
|
* Called once before first push.
|
|
@@ -5863,7 +5881,7 @@ type Fn$1<T extends TypesGeneric$2 = Types$2, E = DeepPartialEvent> = (event: E,
|
|
|
5863
5881
|
* @returns false - initialization failed, skip this transformer
|
|
5864
5882
|
* @returns Config<T> - return updated config
|
|
5865
5883
|
*/
|
|
5866
|
-
type InitFn<T extends TypesGeneric$2 = Types$2> = (context: Context$
|
|
5884
|
+
type InitFn<T extends TypesGeneric$2 = Types$2> = (context: Context$3<T>) => PromiseOrValue<void | false | Config$3<T>>;
|
|
5867
5885
|
/**
|
|
5868
5886
|
* Transformer instance returned by Init function.
|
|
5869
5887
|
*/
|
|
@@ -5878,7 +5896,7 @@ interface Instance$2<T extends TypesGeneric$2 = Types$2> {
|
|
|
5878
5896
|
* Transformer initialization function.
|
|
5879
5897
|
* Creates a transformer instance from context.
|
|
5880
5898
|
*/
|
|
5881
|
-
type Init$2<T extends TypesGeneric$2 = Types$2> = (context: Context$
|
|
5899
|
+
type Init$2<T extends TypesGeneric$2 = Types$2> = (context: Context$3<Types$2<Partial<Settings$1<T>>, Env$2<T>, InitSettings$2<T>>>) => Instance$2<T> | Promise<Instance$2<T>>;
|
|
5882
5900
|
/**
|
|
5883
5901
|
* Configuration for initializing a transformer.
|
|
5884
5902
|
* Used in collector registration.
|
|
@@ -5910,7 +5928,7 @@ interface BaseEnv$1 {
|
|
|
5910
5928
|
push: PushFn$1;
|
|
5911
5929
|
command: CommandFn;
|
|
5912
5930
|
sources?: Sources;
|
|
5913
|
-
elb: Fn$
|
|
5931
|
+
elb: Fn$3;
|
|
5914
5932
|
logger: Instance$3;
|
|
5915
5933
|
}
|
|
5916
5934
|
/**
|
|
@@ -5923,7 +5941,7 @@ interface BaseEnv$1 {
|
|
|
5923
5941
|
* @template E - Environment dependencies type
|
|
5924
5942
|
* @template I - InitSettings configuration type (user input)
|
|
5925
5943
|
*/
|
|
5926
|
-
interface Types$1<S = unknown, M = unknown, P = Fn$
|
|
5944
|
+
interface Types$1<S = unknown, M = unknown, P = Fn$3, E = BaseEnv$1, I = S> {
|
|
5927
5945
|
settings: S;
|
|
5928
5946
|
initSettings: I;
|
|
5929
5947
|
mapping: M;
|
|
@@ -5984,7 +6002,7 @@ interface Instance$1<T extends TypesGeneric$1 = Types$1> {
|
|
|
5984
6002
|
* Context provided to source init function.
|
|
5985
6003
|
* Extends base context with source-specific properties.
|
|
5986
6004
|
*/
|
|
5987
|
-
interface Context$
|
|
6005
|
+
interface Context$2<T extends TypesGeneric$1 = Types$1> extends Base<Partial<Config$2<T>>, Env$1<T>> {
|
|
5988
6006
|
id: string;
|
|
5989
6007
|
/**
|
|
5990
6008
|
* Sets ingest metadata for the current request.
|
|
@@ -5997,7 +6015,7 @@ interface Context$1<T extends TypesGeneric$1 = Types$1> extends Base<Partial<Con
|
|
|
5997
6015
|
/** Sets respond function for the current request. Called by source per-request. */
|
|
5998
6016
|
setRespond: (fn: RespondFn | undefined) => void;
|
|
5999
6017
|
}
|
|
6000
|
-
type Init$1<T extends TypesGeneric$1 = Types$1> = (context: Context$
|
|
6018
|
+
type Init$1<T extends TypesGeneric$1 = Types$1> = (context: Context$2<T>) => Instance$1<T> | Promise<Instance$1<T>>;
|
|
6001
6019
|
type InitSource<T extends TypesGeneric$1 = Types$1> = {
|
|
6002
6020
|
code: Init$1<T>;
|
|
6003
6021
|
config?: Partial<Config$2<T>>;
|
|
@@ -6037,7 +6055,7 @@ interface Config$1<T extends TypesGeneric = Types> {
|
|
|
6037
6055
|
id?: string;
|
|
6038
6056
|
logger?: Config$5;
|
|
6039
6057
|
}
|
|
6040
|
-
interface Context<T extends TypesGeneric = Types> extends Base<Config$1<T>, Env<T>> {
|
|
6058
|
+
interface Context$1<T extends TypesGeneric = Types> extends Base<Config$1<T>, Env<T>> {
|
|
6041
6059
|
id: string;
|
|
6042
6060
|
}
|
|
6043
6061
|
type GetFn<T = unknown> = (key: string) => T | undefined | Promise<T | undefined>;
|
|
@@ -6051,7 +6069,7 @@ interface Instance<T extends TypesGeneric = Types> {
|
|
|
6051
6069
|
delete: DeleteFn;
|
|
6052
6070
|
destroy?: DestroyFn<Config$1<T>, Env<T>>;
|
|
6053
6071
|
}
|
|
6054
|
-
type Init<T extends TypesGeneric = Types> = (context: Context<Types<Partial<Settings<T>>, Env<T>, InitSettings<T>>>) => Instance<T> | Promise<Instance<T>>;
|
|
6072
|
+
type Init<T extends TypesGeneric = Types> = (context: Context$1<Types<Partial<Settings<T>>, Env<T>, InitSettings<T>>>) => Instance<T> | Promise<Instance<T>>;
|
|
6055
6073
|
type InitStore<T extends TypesGeneric = Types> = {
|
|
6056
6074
|
code: Init<T>;
|
|
6057
6075
|
config?: Partial<Config$1<T>>;
|
|
@@ -6194,18 +6212,21 @@ interface ValueConfig {
|
|
|
6194
6212
|
validate?: Validate;
|
|
6195
6213
|
value?: PropertyType;
|
|
6196
6214
|
}
|
|
6197
|
-
|
|
6198
|
-
|
|
6215
|
+
interface Context {
|
|
6216
|
+
event: DeepPartialEvent;
|
|
6217
|
+
/** The surrounding mapping config: a Value (value-level) or a Rule (rule-level). */
|
|
6218
|
+
mapping: Value | Rule;
|
|
6219
|
+
collector: Instance$5;
|
|
6220
|
+
logger: Instance$3;
|
|
6221
|
+
consent?: Consent;
|
|
6222
|
+
}
|
|
6223
|
+
type Fn = (value: unknown, context: Context) => PromiseOrValue<Property | unknown>;
|
|
6224
|
+
type Condition = (value: unknown, context: Context) => PromiseOrValue<boolean>;
|
|
6225
|
+
type Validate = (value: unknown, context: Context) => PromiseOrValue<boolean>;
|
|
6199
6226
|
type Loop = [Value, Value];
|
|
6200
6227
|
type Map = {
|
|
6201
6228
|
[key: string]: Value;
|
|
6202
6229
|
};
|
|
6203
|
-
interface Options {
|
|
6204
|
-
consent?: Consent;
|
|
6205
|
-
collector?: Instance$5;
|
|
6206
|
-
props?: unknown;
|
|
6207
|
-
}
|
|
6208
|
-
type Validate = (value?: unknown) => PromiseOrValue<boolean>;
|
|
6209
6230
|
|
|
6210
6231
|
interface CacheRule {
|
|
6211
6232
|
match: MatchExpression | '*';
|