@walkeros/collector 4.6.0 → 4.7.0-next-1790187973605
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/CHANGELOG.md +50 -0
- package/dist/index.d.mts +64 -48
- package/dist/index.d.ts +64 -48
- 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 +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# @walkeros/collector
|
|
2
2
|
|
|
3
|
+
## 4.7.0-next-1790187973605
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f5a1cfd: New `collector.next`: a transformer chain that runs once per event,
|
|
8
|
+
before the event is handed to the destinations. Everything it produces reaches
|
|
9
|
+
every destination, and a `stop` in it drops the event for all of them;
|
|
10
|
+
per-destination filtering stays on `destination.before`. The explorer flow map
|
|
11
|
+
draws this chain, and the MCP guidance describes it.
|
|
12
|
+
- f5a1cfd: Inside an array, a transformer's own `next` now runs right after it,
|
|
13
|
+
then the array continues. `many` works in every chain field: each match
|
|
14
|
+
becomes its own copy with a derived `event.id` that finishes the rest of the
|
|
15
|
+
path. Unknown transformer ids log a warning and the chain continues.
|
|
16
|
+
`@walkeros/collector` no longer exports `walkChain` or
|
|
17
|
+
`extractTransformerNextMap`.
|
|
18
|
+
- f5a1cfd: Routes can drop an event with `{ stop: true }`, optionally gated by
|
|
19
|
+
`match`, in every chain field. A route `match` now reads `{ ingest, event }`
|
|
20
|
+
and resolves only when the event reaches it, so it sees values earlier steps
|
|
21
|
+
loaded. `getNextSteps(spec, root)` now requires that root and returns
|
|
22
|
+
`NextSteps`; the new `getRouteGraph` lists every branch.
|
|
23
|
+
- 2aebc53: `state` paths now resolve against `{ event, ingest }` and need an
|
|
24
|
+
`event.` or `ingest.` prefix, so a store can be keyed by request context. A
|
|
25
|
+
`get` can write into `ingest`, keeping the value off the event. An
|
|
26
|
+
unresolvable key logs a warning instead of failing silently.
|
|
27
|
+
`buildCacheContext` is renamed `createMappingRoot`.
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- 2aebc53: A transformer whose `push` throws still stops the chain and drops the
|
|
32
|
+
event, and is now also counted in `status.failed`, so diagnostics and health
|
|
33
|
+
checks show the failure instead of only a log line.
|
|
34
|
+
- Updated dependencies [57788bc]
|
|
35
|
+
- Updated dependencies [f5a1cfd]
|
|
36
|
+
- Updated dependencies [ef02916]
|
|
37
|
+
- Updated dependencies [ef02916]
|
|
38
|
+
- Updated dependencies [2aebc53]
|
|
39
|
+
- Updated dependencies [f5a1cfd]
|
|
40
|
+
- Updated dependencies [f5a1cfd]
|
|
41
|
+
- Updated dependencies [2aebc53]
|
|
42
|
+
- Updated dependencies [8f8aea6]
|
|
43
|
+
- Updated dependencies [2aebc53]
|
|
44
|
+
- Updated dependencies [2aebc53]
|
|
45
|
+
- @walkeros/core@4.7.0-next-1790187973605
|
|
46
|
+
|
|
47
|
+
## 4.6.1
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- @walkeros/core@4.6.1
|
|
52
|
+
|
|
3
53
|
## 4.6.0
|
|
4
54
|
|
|
5
55
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _walkeros_core from '@walkeros/core';
|
|
2
|
-
import { Collector, WalkerOS, Elb, Mapping, Destination, On, StepKind, Logger, Context as Context$1, BreakerState,
|
|
2
|
+
import { Collector, WalkerOS, Elb, Mapping, Destination, On, Transformer, RespondFn, Ingest, StepKind, Logger, Context as Context$1, BreakerState, Source, ChainContinuation, Simulation, CompiledCache, Store } from '@walkeros/core';
|
|
3
3
|
|
|
4
4
|
interface RunState {
|
|
5
5
|
consent?: WalkerOS.Consent;
|
|
@@ -73,6 +73,38 @@ declare function processConsent(collector: Collector.Instance, data: WalkerOS.Co
|
|
|
73
73
|
update: WalkerOS.Consent;
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
+
/** What `collector.next` hands to the destination fan-out. */
|
|
77
|
+
interface CollectorNextResult {
|
|
78
|
+
/**
|
|
79
|
+
* Every finished copy, in order, with its own ingest; each event is
|
|
80
|
+
* completed to a full event. One copy without a fork, one per surviving
|
|
81
|
+
* fork after a `many` or a `Result[]` return, and none when the chain
|
|
82
|
+
* dropped or halted the event.
|
|
83
|
+
*/
|
|
84
|
+
copies: Transformer.ChainCopy<WalkerOS.Event>[];
|
|
85
|
+
/** The respond in scope after the chain (a wrapped one if the chain set it). */
|
|
86
|
+
respond?: RespondFn;
|
|
87
|
+
/** Set when a route stop or a transformer ended every copy. */
|
|
88
|
+
dropped?: true;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Runs the collector's own chain (`collector.config.next`) for one completed
|
|
92
|
+
* event, through the one chain runner. Called once per event by
|
|
93
|
+
* `pushToDestinations`, before the event enters `collector.queue` and the
|
|
94
|
+
* destination fan-out, so consent replay and late-destination backfill
|
|
95
|
+
* deliver post-chain events and never run it again.
|
|
96
|
+
*
|
|
97
|
+
* A drop (route `stop` or a transformer returning `false`) on every copy
|
|
98
|
+
* emits one `collector.push` `skip` / `dropped` record and counts the event
|
|
99
|
+
* in; a `cache.stop` HIT halts delivery without a drop record, as at
|
|
100
|
+
* `source.next`.
|
|
101
|
+
*/
|
|
102
|
+
declare function runCollectorNext(collector: Collector.Instance, event: WalkerOS.Event, meta?: {
|
|
103
|
+
id?: string;
|
|
104
|
+
ingest?: Ingest;
|
|
105
|
+
respond?: RespondFn;
|
|
106
|
+
}): Promise<CollectorNextResult>;
|
|
107
|
+
|
|
76
108
|
declare function startFlow<ElbPush extends Elb.Fn = Elb.Fn>(initConfig?: Collector.InitConfig): Promise<StartFlow<ElbPush>>;
|
|
77
109
|
|
|
78
110
|
/**
|
|
@@ -192,6 +224,11 @@ declare function addDestination(collector: Collector.Instance, data: Destination
|
|
|
192
224
|
/**
|
|
193
225
|
* Pushes an event to all or a subset of destinations.
|
|
194
226
|
*
|
|
227
|
+
* A completed event first runs the collector's own chain
|
|
228
|
+
* (`collector.config.next`), once, and every copy it hands back is delivered.
|
|
229
|
+
* A flush call (no event) delivers what the destinations have queued and
|
|
230
|
+
* never runs the chain: queued events are already post-chain.
|
|
231
|
+
*
|
|
195
232
|
* @param collector - The walkerOS collector instance.
|
|
196
233
|
* @param event - The event to push.
|
|
197
234
|
* @param meta - Optional metadata with id and ingest.
|
|
@@ -201,7 +238,7 @@ declare function addDestination(collector: Collector.Instance, data: Destination
|
|
|
201
238
|
declare function pushToDestinations(collector: Collector.Instance, event?: WalkerOS.Event, meta?: {
|
|
202
239
|
id?: string;
|
|
203
240
|
ingest?: Ingest;
|
|
204
|
-
respond?:
|
|
241
|
+
respond?: RespondFn;
|
|
205
242
|
}, destinations?: Collector.Destinations): Promise<Elb.PushResult>;
|
|
206
243
|
declare function destinationInit<Destination extends Destination.Instance>(collector: Collector.Instance, destination: Destination, destId: string, allowed?: boolean): Promise<boolean>;
|
|
207
244
|
/**
|
|
@@ -265,13 +302,21 @@ declare function commonHandleCommand(collector: Collector.Instance, action: stri
|
|
|
265
302
|
*/
|
|
266
303
|
declare function prepareEvent(collector: Collector.Instance, event: WalkerOS.DeepPartialEvent): WalkerOS.PartialEvent;
|
|
267
304
|
/**
|
|
268
|
-
* Creates a full event from a partial event
|
|
305
|
+
* Creates a full event from a partial event, floored with the collector's
|
|
306
|
+
* current state (globals, user, consent).
|
|
269
307
|
*
|
|
270
308
|
* @param collector The walkerOS collector instance.
|
|
271
309
|
* @param partialEvent The partial event to transform.
|
|
272
310
|
* @returns The full event.
|
|
273
311
|
*/
|
|
274
312
|
declare function createEvent(collector: Collector.Instance, partialEvent: WalkerOS.PartialEvent, ingest?: Ingest): WalkerOS.Event;
|
|
313
|
+
/**
|
|
314
|
+
* Completes an event that was already created and then edited by a chain
|
|
315
|
+
* (`collector.next`): fills only the fields that are missing, never floors
|
|
316
|
+
* globals, user or consent again, so a step that removed one keeps it
|
|
317
|
+
* removed.
|
|
318
|
+
*/
|
|
319
|
+
declare function completeEvent(collector: Collector.Instance, event: WalkerOS.DeepPartialEvent, ingest?: Ingest): WalkerOS.Event;
|
|
275
320
|
/**
|
|
276
321
|
* Enriches a partial event into a full event by applying the collector defaults
|
|
277
322
|
* (`prepareEvent`) and then building the complete event (`createEvent`). This is
|
|
@@ -440,46 +485,6 @@ declare function initSource(collector: Collector.Instance, sourceId: string, sou
|
|
|
440
485
|
*/
|
|
441
486
|
declare function initSources(collector: Collector.Instance, sources?: Source.InitSources): Promise<Collector.Sources>;
|
|
442
487
|
|
|
443
|
-
/**
|
|
444
|
-
* Extracts transformer next configuration for chain walking.
|
|
445
|
-
* Maps transformer instances to their config.next values.
|
|
446
|
-
*
|
|
447
|
-
* This is the single source of truth for extracting chain links.
|
|
448
|
-
* Used by both source.ts (pre-collector chains) and destination.ts (post-collector chains).
|
|
449
|
-
*
|
|
450
|
-
* @param transformers - Map of transformer instances
|
|
451
|
-
* @returns Map of transformer IDs to their next configuration
|
|
452
|
-
*/
|
|
453
|
-
declare function extractTransformerNextMap(transformers: Transformer.Transformers): Record<string, {
|
|
454
|
-
next?: string | string[];
|
|
455
|
-
}>;
|
|
456
|
-
/**
|
|
457
|
-
* Walks a transformer chain starting from a given transformer ID.
|
|
458
|
-
* Returns ordered array of transformer IDs in the chain.
|
|
459
|
-
*
|
|
460
|
-
* Used for on-demand chain resolution:
|
|
461
|
-
* - Called from destination.ts with destination.config.before
|
|
462
|
-
* - Called from source.ts with source.config.next
|
|
463
|
-
*
|
|
464
|
-
* @param startId - First transformer in chain, or explicit array of transformer IDs
|
|
465
|
-
* @param transformers - Available transformer configs with optional `next` field
|
|
466
|
-
* @returns Ordered array of transformer IDs to execute
|
|
467
|
-
*
|
|
468
|
-
* @example
|
|
469
|
-
* // Single transformer
|
|
470
|
-
* walkChain('redact', { redact: {} }) // ['redact']
|
|
471
|
-
*
|
|
472
|
-
* @example
|
|
473
|
-
* // Chain via next
|
|
474
|
-
* walkChain('a', { a: { next: 'b' }, b: { next: 'c' }, c: {} }) // ['a', 'b', 'c']
|
|
475
|
-
*
|
|
476
|
-
* @example
|
|
477
|
-
* // Explicit array
|
|
478
|
-
* walkChain(['x', 'y'], {}) // ['x', 'y']
|
|
479
|
-
*/
|
|
480
|
-
declare function walkChain(startId: string | string[] | undefined, transformers?: Record<string, {
|
|
481
|
-
next?: string | string[];
|
|
482
|
-
}>): string[];
|
|
483
488
|
/**
|
|
484
489
|
* Initializes a transformer if it hasn't been initialized yet.
|
|
485
490
|
* Called lazily before first push.
|
|
@@ -502,16 +507,27 @@ declare function transformerInit(collector: Collector.Instance, transformer: Tra
|
|
|
502
507
|
*/
|
|
503
508
|
declare function transformerPush(collector: Collector.Instance, transformer: Transformer.Instance, transformerId: string, event: WalkerOS.DeepPartialEvent, ingest?: Ingest, respond?: _walkeros_core.RespondFn): Promise<Transformer.Result | Transformer.Result[] | false | void>;
|
|
504
509
|
/**
|
|
505
|
-
* Runs an event through a chain
|
|
510
|
+
* Runs an event through a chain: the one chain runner.
|
|
506
511
|
*
|
|
507
512
|
* @param collector - The collector instance with transformers
|
|
508
513
|
* @param transformers - Map of transformer instances
|
|
509
|
-
* @param
|
|
514
|
+
* @param start - The route to run (a chain field such as `source.next`), or
|
|
515
|
+
* a continuation of one; `undefined` runs nothing
|
|
510
516
|
* @param event - The event to process
|
|
511
517
|
* @param ingest - Mutable ingest context flowing through the pipeline
|
|
512
|
-
* @
|
|
518
|
+
* @param respond - The respond function in scope
|
|
519
|
+
* @param chainContext - Chain path (e.g. `destination.ga4.before`), recorded
|
|
520
|
+
* as `ingest._meta.chainPath` and keying `chainMocks`
|
|
521
|
+
* @returns Every finished copy with its own ingest (`copies`, empty when
|
|
522
|
+
* dropped or stopped) and the respond in scope afterwards
|
|
523
|
+
*/
|
|
524
|
+
declare function runTransformerChain(collector: Collector.Instance, transformers: Transformer.Transformers, start: Transformer.Route | ChainContinuation | undefined, event: WalkerOS.DeepPartialEvent, ingest?: Ingest, respond?: RespondFn, chainContext?: string): Promise<Transformer.ChainResult>;
|
|
525
|
+
/**
|
|
526
|
+
* Runs a transformer's `before` chain: the one implementation, used by the
|
|
527
|
+
* chain runner for every member and by the CLI simulation. A `stop` that
|
|
528
|
+
* the before route itself resolved is attributed to the transformer.
|
|
513
529
|
*/
|
|
514
|
-
declare function
|
|
530
|
+
declare function runTransformerBefore(collector: Collector.Instance, transformers: Transformer.Transformers, transformerId: string, event: WalkerOS.DeepPartialEvent, ingest?: Ingest, respond?: RespondFn, chainContext?: string): Promise<Transformer.ChainResult>;
|
|
515
531
|
|
|
516
532
|
interface WrapResult {
|
|
517
533
|
/** Env with tracked paths wrapped by recording functions */
|
|
@@ -548,4 +564,4 @@ declare function wrapEnv(env: Record<string, unknown> & {
|
|
|
548
564
|
*/
|
|
549
565
|
declare function getCacheStore(compiled: CompiledCache, collector: Collector.Instance): Store.Instance | undefined;
|
|
550
566
|
|
|
551
|
-
export { type BreakerConfig, code as Code, type CommandTypes, Commands, Const, type CreateCollector, DEFAULT_BREAKER_COOLDOWN_MS, DEFAULT_BREAKER_THRESHOLD, DEFAULT_DLQ_MAX, type HandleCommandFn, type RunState, type StartFlow, type StepOutcome, type StorageType, addDestination, buildReportError, bumpDropped, callDestinationOn, commonHandleCommand, createEvent, createPush, createPushResult, destinationInit, destinationPush, enrichEvent, ensureDestStatus, enterCascade, errorMeta,
|
|
567
|
+
export { type BreakerConfig, code as Code, type CollectorNextResult, type CommandTypes, Commands, Const, type CreateCollector, DEFAULT_BREAKER_COOLDOWN_MS, DEFAULT_BREAKER_THRESHOLD, DEFAULT_DLQ_MAX, type HandleCommandFn, type RunState, type StartFlow, type StepOutcome, type StorageType, addDestination, buildReportError, bumpDropped, callDestinationOn, commonHandleCommand, completeEvent, createEvent, createPush, createPushResult, destinationInit, destinationPush, enrichEvent, ensureDestStatus, enterCascade, errorMeta, fireCallbacks, flushSourceQueueOn, getCacheStore, initDestinations, initSource, initSources, isBreakerProbePermitted, isRequireSatisfied, isSourceStarted, isStateDelivery, isStatePresent, mergeEnvironments, on, onApply, prepareEvent, processConsent, pushToDestinations, redeliverStateAtRun, registerDestination, resolveBreakerConfig, runCollector, runCollectorNext, runTransformerBefore, runTransformerChain, setMark, shouldDeliver, startFlow, transformerInit, transformerPush, wrapEnv };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _walkeros_core from '@walkeros/core';
|
|
2
|
-
import { Collector, WalkerOS, Elb, Mapping, Destination, On, StepKind, Logger, Context as Context$1, BreakerState,
|
|
2
|
+
import { Collector, WalkerOS, Elb, Mapping, Destination, On, Transformer, RespondFn, Ingest, StepKind, Logger, Context as Context$1, BreakerState, Source, ChainContinuation, Simulation, CompiledCache, Store } from '@walkeros/core';
|
|
3
3
|
|
|
4
4
|
interface RunState {
|
|
5
5
|
consent?: WalkerOS.Consent;
|
|
@@ -73,6 +73,38 @@ declare function processConsent(collector: Collector.Instance, data: WalkerOS.Co
|
|
|
73
73
|
update: WalkerOS.Consent;
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
+
/** What `collector.next` hands to the destination fan-out. */
|
|
77
|
+
interface CollectorNextResult {
|
|
78
|
+
/**
|
|
79
|
+
* Every finished copy, in order, with its own ingest; each event is
|
|
80
|
+
* completed to a full event. One copy without a fork, one per surviving
|
|
81
|
+
* fork after a `many` or a `Result[]` return, and none when the chain
|
|
82
|
+
* dropped or halted the event.
|
|
83
|
+
*/
|
|
84
|
+
copies: Transformer.ChainCopy<WalkerOS.Event>[];
|
|
85
|
+
/** The respond in scope after the chain (a wrapped one if the chain set it). */
|
|
86
|
+
respond?: RespondFn;
|
|
87
|
+
/** Set when a route stop or a transformer ended every copy. */
|
|
88
|
+
dropped?: true;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Runs the collector's own chain (`collector.config.next`) for one completed
|
|
92
|
+
* event, through the one chain runner. Called once per event by
|
|
93
|
+
* `pushToDestinations`, before the event enters `collector.queue` and the
|
|
94
|
+
* destination fan-out, so consent replay and late-destination backfill
|
|
95
|
+
* deliver post-chain events and never run it again.
|
|
96
|
+
*
|
|
97
|
+
* A drop (route `stop` or a transformer returning `false`) on every copy
|
|
98
|
+
* emits one `collector.push` `skip` / `dropped` record and counts the event
|
|
99
|
+
* in; a `cache.stop` HIT halts delivery without a drop record, as at
|
|
100
|
+
* `source.next`.
|
|
101
|
+
*/
|
|
102
|
+
declare function runCollectorNext(collector: Collector.Instance, event: WalkerOS.Event, meta?: {
|
|
103
|
+
id?: string;
|
|
104
|
+
ingest?: Ingest;
|
|
105
|
+
respond?: RespondFn;
|
|
106
|
+
}): Promise<CollectorNextResult>;
|
|
107
|
+
|
|
76
108
|
declare function startFlow<ElbPush extends Elb.Fn = Elb.Fn>(initConfig?: Collector.InitConfig): Promise<StartFlow<ElbPush>>;
|
|
77
109
|
|
|
78
110
|
/**
|
|
@@ -192,6 +224,11 @@ declare function addDestination(collector: Collector.Instance, data: Destination
|
|
|
192
224
|
/**
|
|
193
225
|
* Pushes an event to all or a subset of destinations.
|
|
194
226
|
*
|
|
227
|
+
* A completed event first runs the collector's own chain
|
|
228
|
+
* (`collector.config.next`), once, and every copy it hands back is delivered.
|
|
229
|
+
* A flush call (no event) delivers what the destinations have queued and
|
|
230
|
+
* never runs the chain: queued events are already post-chain.
|
|
231
|
+
*
|
|
195
232
|
* @param collector - The walkerOS collector instance.
|
|
196
233
|
* @param event - The event to push.
|
|
197
234
|
* @param meta - Optional metadata with id and ingest.
|
|
@@ -201,7 +238,7 @@ declare function addDestination(collector: Collector.Instance, data: Destination
|
|
|
201
238
|
declare function pushToDestinations(collector: Collector.Instance, event?: WalkerOS.Event, meta?: {
|
|
202
239
|
id?: string;
|
|
203
240
|
ingest?: Ingest;
|
|
204
|
-
respond?:
|
|
241
|
+
respond?: RespondFn;
|
|
205
242
|
}, destinations?: Collector.Destinations): Promise<Elb.PushResult>;
|
|
206
243
|
declare function destinationInit<Destination extends Destination.Instance>(collector: Collector.Instance, destination: Destination, destId: string, allowed?: boolean): Promise<boolean>;
|
|
207
244
|
/**
|
|
@@ -265,13 +302,21 @@ declare function commonHandleCommand(collector: Collector.Instance, action: stri
|
|
|
265
302
|
*/
|
|
266
303
|
declare function prepareEvent(collector: Collector.Instance, event: WalkerOS.DeepPartialEvent): WalkerOS.PartialEvent;
|
|
267
304
|
/**
|
|
268
|
-
* Creates a full event from a partial event
|
|
305
|
+
* Creates a full event from a partial event, floored with the collector's
|
|
306
|
+
* current state (globals, user, consent).
|
|
269
307
|
*
|
|
270
308
|
* @param collector The walkerOS collector instance.
|
|
271
309
|
* @param partialEvent The partial event to transform.
|
|
272
310
|
* @returns The full event.
|
|
273
311
|
*/
|
|
274
312
|
declare function createEvent(collector: Collector.Instance, partialEvent: WalkerOS.PartialEvent, ingest?: Ingest): WalkerOS.Event;
|
|
313
|
+
/**
|
|
314
|
+
* Completes an event that was already created and then edited by a chain
|
|
315
|
+
* (`collector.next`): fills only the fields that are missing, never floors
|
|
316
|
+
* globals, user or consent again, so a step that removed one keeps it
|
|
317
|
+
* removed.
|
|
318
|
+
*/
|
|
319
|
+
declare function completeEvent(collector: Collector.Instance, event: WalkerOS.DeepPartialEvent, ingest?: Ingest): WalkerOS.Event;
|
|
275
320
|
/**
|
|
276
321
|
* Enriches a partial event into a full event by applying the collector defaults
|
|
277
322
|
* (`prepareEvent`) and then building the complete event (`createEvent`). This is
|
|
@@ -440,46 +485,6 @@ declare function initSource(collector: Collector.Instance, sourceId: string, sou
|
|
|
440
485
|
*/
|
|
441
486
|
declare function initSources(collector: Collector.Instance, sources?: Source.InitSources): Promise<Collector.Sources>;
|
|
442
487
|
|
|
443
|
-
/**
|
|
444
|
-
* Extracts transformer next configuration for chain walking.
|
|
445
|
-
* Maps transformer instances to their config.next values.
|
|
446
|
-
*
|
|
447
|
-
* This is the single source of truth for extracting chain links.
|
|
448
|
-
* Used by both source.ts (pre-collector chains) and destination.ts (post-collector chains).
|
|
449
|
-
*
|
|
450
|
-
* @param transformers - Map of transformer instances
|
|
451
|
-
* @returns Map of transformer IDs to their next configuration
|
|
452
|
-
*/
|
|
453
|
-
declare function extractTransformerNextMap(transformers: Transformer.Transformers): Record<string, {
|
|
454
|
-
next?: string | string[];
|
|
455
|
-
}>;
|
|
456
|
-
/**
|
|
457
|
-
* Walks a transformer chain starting from a given transformer ID.
|
|
458
|
-
* Returns ordered array of transformer IDs in the chain.
|
|
459
|
-
*
|
|
460
|
-
* Used for on-demand chain resolution:
|
|
461
|
-
* - Called from destination.ts with destination.config.before
|
|
462
|
-
* - Called from source.ts with source.config.next
|
|
463
|
-
*
|
|
464
|
-
* @param startId - First transformer in chain, or explicit array of transformer IDs
|
|
465
|
-
* @param transformers - Available transformer configs with optional `next` field
|
|
466
|
-
* @returns Ordered array of transformer IDs to execute
|
|
467
|
-
*
|
|
468
|
-
* @example
|
|
469
|
-
* // Single transformer
|
|
470
|
-
* walkChain('redact', { redact: {} }) // ['redact']
|
|
471
|
-
*
|
|
472
|
-
* @example
|
|
473
|
-
* // Chain via next
|
|
474
|
-
* walkChain('a', { a: { next: 'b' }, b: { next: 'c' }, c: {} }) // ['a', 'b', 'c']
|
|
475
|
-
*
|
|
476
|
-
* @example
|
|
477
|
-
* // Explicit array
|
|
478
|
-
* walkChain(['x', 'y'], {}) // ['x', 'y']
|
|
479
|
-
*/
|
|
480
|
-
declare function walkChain(startId: string | string[] | undefined, transformers?: Record<string, {
|
|
481
|
-
next?: string | string[];
|
|
482
|
-
}>): string[];
|
|
483
488
|
/**
|
|
484
489
|
* Initializes a transformer if it hasn't been initialized yet.
|
|
485
490
|
* Called lazily before first push.
|
|
@@ -502,16 +507,27 @@ declare function transformerInit(collector: Collector.Instance, transformer: Tra
|
|
|
502
507
|
*/
|
|
503
508
|
declare function transformerPush(collector: Collector.Instance, transformer: Transformer.Instance, transformerId: string, event: WalkerOS.DeepPartialEvent, ingest?: Ingest, respond?: _walkeros_core.RespondFn): Promise<Transformer.Result | Transformer.Result[] | false | void>;
|
|
504
509
|
/**
|
|
505
|
-
* Runs an event through a chain
|
|
510
|
+
* Runs an event through a chain: the one chain runner.
|
|
506
511
|
*
|
|
507
512
|
* @param collector - The collector instance with transformers
|
|
508
513
|
* @param transformers - Map of transformer instances
|
|
509
|
-
* @param
|
|
514
|
+
* @param start - The route to run (a chain field such as `source.next`), or
|
|
515
|
+
* a continuation of one; `undefined` runs nothing
|
|
510
516
|
* @param event - The event to process
|
|
511
517
|
* @param ingest - Mutable ingest context flowing through the pipeline
|
|
512
|
-
* @
|
|
518
|
+
* @param respond - The respond function in scope
|
|
519
|
+
* @param chainContext - Chain path (e.g. `destination.ga4.before`), recorded
|
|
520
|
+
* as `ingest._meta.chainPath` and keying `chainMocks`
|
|
521
|
+
* @returns Every finished copy with its own ingest (`copies`, empty when
|
|
522
|
+
* dropped or stopped) and the respond in scope afterwards
|
|
523
|
+
*/
|
|
524
|
+
declare function runTransformerChain(collector: Collector.Instance, transformers: Transformer.Transformers, start: Transformer.Route | ChainContinuation | undefined, event: WalkerOS.DeepPartialEvent, ingest?: Ingest, respond?: RespondFn, chainContext?: string): Promise<Transformer.ChainResult>;
|
|
525
|
+
/**
|
|
526
|
+
* Runs a transformer's `before` chain: the one implementation, used by the
|
|
527
|
+
* chain runner for every member and by the CLI simulation. A `stop` that
|
|
528
|
+
* the before route itself resolved is attributed to the transformer.
|
|
513
529
|
*/
|
|
514
|
-
declare function
|
|
530
|
+
declare function runTransformerBefore(collector: Collector.Instance, transformers: Transformer.Transformers, transformerId: string, event: WalkerOS.DeepPartialEvent, ingest?: Ingest, respond?: RespondFn, chainContext?: string): Promise<Transformer.ChainResult>;
|
|
515
531
|
|
|
516
532
|
interface WrapResult {
|
|
517
533
|
/** Env with tracked paths wrapped by recording functions */
|
|
@@ -548,4 +564,4 @@ declare function wrapEnv(env: Record<string, unknown> & {
|
|
|
548
564
|
*/
|
|
549
565
|
declare function getCacheStore(compiled: CompiledCache, collector: Collector.Instance): Store.Instance | undefined;
|
|
550
566
|
|
|
551
|
-
export { type BreakerConfig, code as Code, type CommandTypes, Commands, Const, type CreateCollector, DEFAULT_BREAKER_COOLDOWN_MS, DEFAULT_BREAKER_THRESHOLD, DEFAULT_DLQ_MAX, type HandleCommandFn, type RunState, type StartFlow, type StepOutcome, type StorageType, addDestination, buildReportError, bumpDropped, callDestinationOn, commonHandleCommand, createEvent, createPush, createPushResult, destinationInit, destinationPush, enrichEvent, ensureDestStatus, enterCascade, errorMeta,
|
|
567
|
+
export { type BreakerConfig, code as Code, type CollectorNextResult, type CommandTypes, Commands, Const, type CreateCollector, DEFAULT_BREAKER_COOLDOWN_MS, DEFAULT_BREAKER_THRESHOLD, DEFAULT_DLQ_MAX, type HandleCommandFn, type RunState, type StartFlow, type StepOutcome, type StorageType, addDestination, buildReportError, bumpDropped, callDestinationOn, commonHandleCommand, completeEvent, createEvent, createPush, createPushResult, destinationInit, destinationPush, enrichEvent, ensureDestStatus, enterCascade, errorMeta, fireCallbacks, flushSourceQueueOn, getCacheStore, initDestinations, initSource, initSources, isBreakerProbePermitted, isRequireSatisfied, isSourceStarted, isStateDelivery, isStatePresent, mergeEnvironments, on, onApply, prepareEvent, processConsent, pushToDestinations, redeliverStateAtRun, registerDestination, resolveBreakerConfig, runCollector, runCollectorNext, runTransformerBefore, runTransformerChain, setMark, shouldDeliver, startFlow, transformerInit, transformerPush, wrapEnv };
|