@walkeros/core 4.6.1 → 4.7.0-next-1790245733116
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 +67 -0
- package/dist/dev.d.mts +637 -60
- package/dist/dev.d.ts +637 -60
- 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 +500 -74
- package/dist/index.d.ts +500 -74
- 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/dist/node.d.mts +244 -0
- package/dist/node.d.ts +244 -0
- package/dist/node.js +1 -0
- package/dist/node.js.map +1 -0
- package/dist/node.mjs +1 -0
- package/dist/node.mjs.map +1 -0
- package/package.json +6 -1
package/dist/index.d.mts
CHANGED
|
@@ -99,6 +99,18 @@ interface ValueConfig {
|
|
|
99
99
|
validate?: Validate;
|
|
100
100
|
value?: PropertyType;
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Resolution root for paths that can address both the event and the
|
|
104
|
+
* pipeline ingest: state, cache keys and route matchers. Paths name their
|
|
105
|
+
* side explicitly, `event.data.id` or `ingest.site`. Every route resolves
|
|
106
|
+
* with the event its position holds. `event` is absent only for the
|
|
107
|
+
* request-scoped source cache key (one check per request, before per-event
|
|
108
|
+
* work) and in static tooling that has no event.
|
|
109
|
+
*/
|
|
110
|
+
type Root = {
|
|
111
|
+
event?: DeepPartialEvent;
|
|
112
|
+
ingest: Record<string, unknown>;
|
|
113
|
+
};
|
|
102
114
|
interface Context$6 {
|
|
103
115
|
event: DeepPartialEvent;
|
|
104
116
|
/** The surrounding mapping config: a Value (value-level) or a Rule (rule-level). */
|
|
@@ -118,6 +130,7 @@ type Map = {
|
|
|
118
130
|
type mapping_Condition = Condition;
|
|
119
131
|
type mapping_Loop = Loop;
|
|
120
132
|
type mapping_Map = Map;
|
|
133
|
+
type mapping_Root = Root;
|
|
121
134
|
type mapping_Rule<Settings = unknown> = Rule<Settings>;
|
|
122
135
|
type mapping_RulePatch<Settings = unknown> = RulePatch<Settings>;
|
|
123
136
|
type mapping_Rules<T = Rule> = Rules<T>;
|
|
@@ -127,7 +140,7 @@ type mapping_ValueConfig = ValueConfig;
|
|
|
127
140
|
type mapping_ValueType = ValueType;
|
|
128
141
|
type mapping_Values = Values;
|
|
129
142
|
declare namespace mapping {
|
|
130
|
-
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_RulePatch as RulePatch, mapping_Rules as Rules, mapping_Validate as Validate, mapping_Value as Value, mapping_ValueConfig as ValueConfig, mapping_ValueType as ValueType, mapping_Values as Values };
|
|
143
|
+
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_Root as Root, mapping_Rule as Rule, mapping_RulePatch as RulePatch, mapping_Rules as Rules, mapping_Validate as Validate, mapping_Value as Value, mapping_ValueConfig as ValueConfig, mapping_ValueType as ValueType, mapping_Values as Values };
|
|
131
144
|
}
|
|
132
145
|
|
|
133
146
|
interface BaseCacheRule {
|
|
@@ -366,7 +379,7 @@ interface FlowState {
|
|
|
366
379
|
/** For phase === 'flush', the batch size + entry index. */
|
|
367
380
|
batch?: FlowStateBatch;
|
|
368
381
|
/** Discriminator when phase === 'skip'. */
|
|
369
|
-
skipReason?: 'consent' | 'cache_hit' | 'sampled_out' | 'disabled' | 'unknown';
|
|
382
|
+
skipReason?: 'consent' | 'cache_hit' | 'sampled_out' | 'disabled' | 'dropped' | 'unknown';
|
|
370
383
|
/** Free-form metadata: store key/value, cached: true, etc. */
|
|
371
384
|
meta?: Record<string, unknown>;
|
|
372
385
|
}
|
|
@@ -448,6 +461,14 @@ interface Config$6 {
|
|
|
448
461
|
name?: string;
|
|
449
462
|
/** Config release id stamped into event.source.release for this flow. */
|
|
450
463
|
release?: string;
|
|
464
|
+
/**
|
|
465
|
+
* The collector's own transformer chain. Runs once per completed event,
|
|
466
|
+
* after enrichment and before the destination fan-out, with the full route
|
|
467
|
+
* grammar. A `stop` (or a transformer returning `false`) drops the event for
|
|
468
|
+
* every destination; per-destination filtering belongs on
|
|
469
|
+
* `destination.before`. Swappable at runtime via `walker config`.
|
|
470
|
+
*/
|
|
471
|
+
next?: Route;
|
|
451
472
|
}
|
|
452
473
|
/**
|
|
453
474
|
* Initialization configuration that extends Config with initial state
|
|
@@ -601,7 +622,11 @@ interface PushOptions {
|
|
|
601
622
|
ingest?: Ingest;
|
|
602
623
|
respond?: RespondFn;
|
|
603
624
|
mapping?: Config$7;
|
|
604
|
-
|
|
625
|
+
/**
|
|
626
|
+
* Pre-collector chain (the source's `next` route, or a continuation of
|
|
627
|
+
* it). Resolved hop by hop by the chain runner with `{ ingest, event }`.
|
|
628
|
+
*/
|
|
629
|
+
preChain?: Route;
|
|
605
630
|
include?: string[];
|
|
606
631
|
exclude?: string[];
|
|
607
632
|
}
|
|
@@ -848,18 +873,21 @@ type Credential<T> = string | T;
|
|
|
848
873
|
|
|
849
874
|
/**
|
|
850
875
|
* Declarative store operation. Replaces `$code:` for simple fetch/stash.
|
|
851
|
-
* key
|
|
876
|
+
* key names the store slot, value the event or ingest side, mode the
|
|
877
|
+
* direction. Paths resolve against `{ event, ingest }`: `event.user.session`,
|
|
878
|
+
* `ingest.site`.
|
|
852
879
|
*/
|
|
853
880
|
interface State {
|
|
854
881
|
/** Direction. 'delete' is reserved for a later release. */
|
|
855
882
|
mode: 'get' | 'set';
|
|
856
883
|
/** Store id; defaults to the in-memory `__cache` store when omitted. */
|
|
857
884
|
store?: string;
|
|
858
|
-
/** Resolves against
|
|
885
|
+
/** Resolves against `{ event, ingest }` to the store key. */
|
|
859
886
|
key: Value;
|
|
860
887
|
/**
|
|
861
|
-
* set: resolves to the payload to store.
|
|
862
|
-
* get: its
|
|
888
|
+
* set: resolves against `{ event, ingest }` to the payload to store.
|
|
889
|
+
* get: its string path (or `key`) is the write target, `event.` onto the
|
|
890
|
+
* event or `ingest.` into the ingest.
|
|
863
891
|
* Optional at the type level to keep a future `delete` mode non-breaking;
|
|
864
892
|
* validation requires it for get/set.
|
|
865
893
|
*/
|
|
@@ -1028,7 +1056,7 @@ interface Config$5<T extends TypesGeneric$3 = Types$4> {
|
|
|
1028
1056
|
mapping?: Rules<Rule<Mapping$1<T>>>;
|
|
1029
1057
|
/** Pre-processing rules applied to all events before mapping; modifies events in-place. */
|
|
1030
1058
|
policy?: Policy;
|
|
1031
|
-
/** Whether
|
|
1059
|
+
/** Whether a destination added after events were pushed receives the current run's earlier events (from `collector.queue`); defaults to true. Consent-denied events are queued regardless. */
|
|
1032
1060
|
queue?: boolean;
|
|
1033
1061
|
/** Defer destination initialization until these collector events fire (e.g., `['consent']`). */
|
|
1034
1062
|
require?: string[];
|
|
@@ -1347,46 +1375,70 @@ declare namespace elb {
|
|
|
1347
1375
|
/**
|
|
1348
1376
|
* Unified route grammar for Flow v4. A `Route` is one of:
|
|
1349
1377
|
* - a transformer ID string (`"redact"`)
|
|
1350
|
-
* - a sequence of routes (`["a", "b", "c"]
|
|
1351
|
-
* - a `RouteConfig
|
|
1378
|
+
* - a sequence of routes (`["a", "b", "c"]`, run in order)
|
|
1379
|
+
* - a `RouteConfig`: a gated / dispatching node.
|
|
1352
1380
|
*
|
|
1353
|
-
*
|
|
1354
|
-
* `
|
|
1355
|
-
*
|
|
1356
|
-
*
|
|
1381
|
+
* Exception: an array made only of route configs (no id, no nested array)
|
|
1382
|
+
* is an implicit `one`, first match wins (`[gateA, gateB]` runs at most one
|
|
1383
|
+
* of them). Write `{ one: [...] }` to say so, or add an id to make it a
|
|
1384
|
+
* sequence (`["x", gateA, gateB]` evaluates both gates in order).
|
|
1385
|
+
*
|
|
1386
|
+
* `RouteConfig` is a disjoint union: set exactly one of `next`, `one`,
|
|
1387
|
+
* `many`, `stop`, or none of them (pure gate). The disjointness is enforced
|
|
1388
|
+
* by `never` sibling properties at the type level and `z.strictObject` at the
|
|
1389
|
+
* schema level.
|
|
1357
1390
|
*
|
|
1358
1391
|
* Operators:
|
|
1359
1392
|
* - `next`: single continuation.
|
|
1360
1393
|
* - `one`: first-match dispatch (walk entries, first whose match passes wins).
|
|
1361
|
-
* - `many`: all-match
|
|
1362
|
-
*
|
|
1363
|
-
*
|
|
1394
|
+
* - `many`: all-match fan-out. Every matching entry is its own copy of the
|
|
1395
|
+
* event that finishes the rest of the path on its own. Valid in every chain
|
|
1396
|
+
* field.
|
|
1397
|
+
* - `stop`: ends the running copy of the event (optionally gated by `match`).
|
|
1398
|
+
*
|
|
1399
|
+
* Sequences resolve lazily: a conditional segment is evaluated only when its
|
|
1400
|
+
* position is reached, so it sees what earlier steps wrote.
|
|
1364
1401
|
*/
|
|
1365
1402
|
type Route = string | Route[] | RouteConfig;
|
|
1366
|
-
type RouteConfig = RouteNextConfig | RouteOneConfig | RouteManyConfig | RouteGateConfig;
|
|
1403
|
+
type RouteConfig = RouteNextConfig | RouteOneConfig | RouteManyConfig | RouteStopConfig | RouteGateConfig;
|
|
1367
1404
|
interface RouteNextConfig {
|
|
1368
1405
|
match?: MatchExpression;
|
|
1369
1406
|
next: Route;
|
|
1370
1407
|
one?: never;
|
|
1371
1408
|
many?: never;
|
|
1409
|
+
stop?: never;
|
|
1372
1410
|
}
|
|
1373
1411
|
interface RouteOneConfig {
|
|
1374
1412
|
match?: MatchExpression;
|
|
1375
1413
|
one: Route[];
|
|
1376
1414
|
next?: never;
|
|
1377
1415
|
many?: never;
|
|
1416
|
+
stop?: never;
|
|
1378
1417
|
}
|
|
1379
1418
|
interface RouteManyConfig {
|
|
1380
1419
|
match?: MatchExpression;
|
|
1381
1420
|
many: Route[];
|
|
1382
1421
|
next?: never;
|
|
1383
1422
|
one?: never;
|
|
1423
|
+
stop?: never;
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* Ends the running copy of the event. Without `match` the stop is
|
|
1427
|
+
* unconditional; with `match` a failing match falls through like a gate.
|
|
1428
|
+
*/
|
|
1429
|
+
interface RouteStopConfig {
|
|
1430
|
+
match?: MatchExpression;
|
|
1431
|
+
stop: true;
|
|
1432
|
+
next?: never;
|
|
1433
|
+
one?: never;
|
|
1434
|
+
many?: never;
|
|
1384
1435
|
}
|
|
1385
1436
|
interface RouteGateConfig {
|
|
1386
1437
|
match: MatchExpression;
|
|
1387
1438
|
next?: never;
|
|
1388
1439
|
one?: never;
|
|
1389
1440
|
many?: never;
|
|
1441
|
+
stop?: never;
|
|
1390
1442
|
}
|
|
1391
1443
|
/**
|
|
1392
1444
|
* Base environment interface for walkerOS transformers.
|
|
@@ -1486,21 +1538,36 @@ interface Result$1<E = DeepPartialEvent> {
|
|
|
1486
1538
|
respond?: RespondFn;
|
|
1487
1539
|
next?: Route;
|
|
1488
1540
|
}
|
|
1541
|
+
/**
|
|
1542
|
+
* One finished copy of a chain run: its event and its own ingest. `E`
|
|
1543
|
+
* narrows the event where the copy is known complete (a full event after
|
|
1544
|
+
* `collector.next`).
|
|
1545
|
+
*/
|
|
1546
|
+
interface ChainCopy<E = DeepPartialEvent> {
|
|
1547
|
+
event: E;
|
|
1548
|
+
ingest: Ingest;
|
|
1549
|
+
}
|
|
1489
1550
|
/**
|
|
1490
1551
|
* Result of running a transformer chain.
|
|
1491
|
-
* Returns the processed event (singular, fan-out array, or null if dropped)
|
|
1492
|
-
* alongside the potentially wrapped respond function.
|
|
1493
1552
|
*
|
|
1494
|
-
* `
|
|
1495
|
-
*
|
|
1496
|
-
*
|
|
1497
|
-
*
|
|
1553
|
+
* `copies` is the one carrier of the outcome: every finished copy that
|
|
1554
|
+
* continues downstream (one without a fork, one per surviving fork), each
|
|
1555
|
+
* with the ingest it finished with. The next position goes on with each
|
|
1556
|
+
* pair.
|
|
1557
|
+
*
|
|
1558
|
+
* - dropped (a transformer returned `false` or threw): `copies` empty,
|
|
1559
|
+
* `droppedBy` names the transformer.
|
|
1560
|
+
* - route `stop`: `copies` empty, `stopped: true`; `droppedBy` names the
|
|
1561
|
+
* transformer whose route stopped it, absent for the start route.
|
|
1562
|
+
* - `cache.stop: true` HIT: `copies` holds the cached copy, `stopped: true`.
|
|
1563
|
+
* The caller MUST NOT propagate it further downstream than its position
|
|
1564
|
+
* allows (pipeline halt).
|
|
1498
1565
|
*/
|
|
1499
1566
|
interface ChainResult {
|
|
1500
|
-
|
|
1567
|
+
copies: ChainCopy[];
|
|
1501
1568
|
respond?: RespondFn;
|
|
1502
1569
|
stopped?: true;
|
|
1503
|
-
/** Transformer that stopped the chain
|
|
1570
|
+
/** Transformer that dropped or stopped the chain. */
|
|
1504
1571
|
droppedBy?: string;
|
|
1505
1572
|
}
|
|
1506
1573
|
/**
|
|
@@ -1600,6 +1667,7 @@ declare function getTransformer<T extends TypesGeneric$2 = Types$3>(collector: {
|
|
|
1600
1667
|
};
|
|
1601
1668
|
}, id: string): Instance$4<T>;
|
|
1602
1669
|
|
|
1670
|
+
type transformer_ChainCopy<E = DeepPartialEvent> = ChainCopy<E>;
|
|
1603
1671
|
type transformer_ChainResult = ChainResult;
|
|
1604
1672
|
type transformer_InitTransformer<T extends TypesGeneric$2 = Types$3> = InitTransformer<T>;
|
|
1605
1673
|
type transformer_InitTransformers = InitTransformers;
|
|
@@ -1609,10 +1677,11 @@ type transformer_RouteGateConfig = RouteGateConfig;
|
|
|
1609
1677
|
type transformer_RouteManyConfig = RouteManyConfig;
|
|
1610
1678
|
type transformer_RouteNextConfig = RouteNextConfig;
|
|
1611
1679
|
type transformer_RouteOneConfig = RouteOneConfig;
|
|
1680
|
+
type transformer_RouteStopConfig = RouteStopConfig;
|
|
1612
1681
|
type transformer_Transformers = Transformers;
|
|
1613
1682
|
declare const transformer_getTransformer: typeof getTransformer;
|
|
1614
1683
|
declare namespace transformer {
|
|
1615
|
-
export { type BaseEnv$2 as BaseEnv, type transformer_ChainResult as ChainResult, type Config$4 as Config, type Context$4 as Context, type Env$2 as Env, type Fn$2 as Fn, type Init$2 as Init, type InitFn$1 as InitFn, type InitSettings$2 as InitSettings, type transformer_InitTransformer as InitTransformer, type transformer_InitTransformers as InitTransformers, type Instance$4 as Instance, type Result$1 as Result, type transformer_Route as Route, type transformer_RouteConfig as RouteConfig, type transformer_RouteGateConfig as RouteGateConfig, type transformer_RouteManyConfig as RouteManyConfig, type transformer_RouteNextConfig as RouteNextConfig, type transformer_RouteOneConfig as RouteOneConfig, type Settings$2 as Settings, type transformer_Transformers as Transformers, type Types$3 as Types, type TypesGeneric$2 as TypesGeneric, type TypesOf$2 as TypesOf, transformer_getTransformer as getTransformer };
|
|
1684
|
+
export { type BaseEnv$2 as BaseEnv, type transformer_ChainCopy as ChainCopy, type transformer_ChainResult as ChainResult, type Config$4 as Config, type Context$4 as Context, type Env$2 as Env, type Fn$2 as Fn, type Init$2 as Init, type InitFn$1 as InitFn, type InitSettings$2 as InitSettings, type transformer_InitTransformer as InitTransformer, type transformer_InitTransformers as InitTransformers, type Instance$4 as Instance, type Result$1 as Result, type transformer_Route as Route, type transformer_RouteConfig as RouteConfig, type transformer_RouteGateConfig as RouteGateConfig, type transformer_RouteManyConfig as RouteManyConfig, type transformer_RouteNextConfig as RouteNextConfig, type transformer_RouteOneConfig as RouteOneConfig, type transformer_RouteStopConfig as RouteStopConfig, type Settings$2 as Settings, type transformer_Transformers as Transformers, type Types$3 as Types, type TypesGeneric$2 as TypesGeneric, type TypesOf$2 as TypesOf, transformer_getTransformer as getTransformer };
|
|
1616
1685
|
}
|
|
1617
1686
|
|
|
1618
1687
|
/**
|
|
@@ -1647,20 +1716,24 @@ type ValidateEvents = Record<string, Record<string, JsonSchema>>;
|
|
|
1647
1716
|
* Sources use `before` for consent-exempt pre-source preprocessing
|
|
1648
1717
|
* (decode, validate, authenticate raw input before the source.next chain).
|
|
1649
1718
|
*
|
|
1650
|
-
*
|
|
1719
|
+
* The collector uses `next` for its own chain: it runs once per completed
|
|
1720
|
+
* event, before the destination fan-out, so a `stop` there drops the event
|
|
1721
|
+
* for every destination.
|
|
1722
|
+
*
|
|
1723
|
+
* Destinations use `before` to connect to transformers (per-destination chain).
|
|
1651
1724
|
* Destinations use `next` for post-push processing.
|
|
1652
1725
|
*
|
|
1653
1726
|
* Transformers use `next` to chain to other transformers. The same transformer
|
|
1654
1727
|
* pool is shared by both pre-collector and post-collector chains.
|
|
1655
1728
|
*
|
|
1656
|
-
* The collector is
|
|
1657
|
-
*
|
|
1729
|
+
* The collector is never referenced as a target in connections. It sits
|
|
1730
|
+
* between the source chain and the destination chains automatically.
|
|
1658
1731
|
*
|
|
1659
|
-
* Circular `next` references are
|
|
1660
|
-
*
|
|
1732
|
+
* Circular member `next` references are cut at runtime by the chain
|
|
1733
|
+
* runner's cycle guard (`advanceChain`) and bounded by its path cap.
|
|
1661
1734
|
*
|
|
1662
1735
|
* ```
|
|
1663
|
-
* Source → [before → Preprocessing] → [next → Transformer chain] → Collector → [before → Transformer chain] → Destination → [next → Post-push]
|
|
1736
|
+
* Source → [before → Preprocessing] → [next → Transformer chain] → Collector → [collector.next → Transformer chain] → [before → Transformer chain] → Destination → [next → Post-push]
|
|
1664
1737
|
* ```
|
|
1665
1738
|
*
|
|
1666
1739
|
* @packageDocumentation
|
|
@@ -1707,9 +1780,10 @@ interface Flow {
|
|
|
1707
1780
|
/**
|
|
1708
1781
|
* Transformer configurations (event transformation).
|
|
1709
1782
|
*
|
|
1710
|
-
* Pre-collector (source.next)
|
|
1783
|
+
* Pre-collector (source.next), collector-level (collector.next, once per
|
|
1784
|
+
* event for every destination) or per destination (destination.before).
|
|
1711
1785
|
*
|
|
1712
|
-
* Key = unique transformer identifier (referenced by
|
|
1786
|
+
* Key = unique transformer identifier (referenced by any chain field)
|
|
1713
1787
|
* Value = transformer reference with package and config
|
|
1714
1788
|
*/
|
|
1715
1789
|
transformers?: Record<string, Flow.Transformer>;
|
|
@@ -1917,6 +1991,23 @@ declare namespace Flow {
|
|
|
1917
1991
|
* Server flows only.
|
|
1918
1992
|
*/
|
|
1919
1993
|
traceInclude?: string[];
|
|
1994
|
+
/**
|
|
1995
|
+
* Declared build-time values for web `$env` references.
|
|
1996
|
+
*
|
|
1997
|
+
* Web flows resolve `$env.NAME` when the bundle is built and inline the
|
|
1998
|
+
* value. This map is the declared set the build resolves against, so the
|
|
1999
|
+
* same config bundles identically wherever it is built. A local CLI build
|
|
2000
|
+
* layers it over the shell environment; a hosted build uses it alone.
|
|
2001
|
+
* Server flows ignore it: their `$env` references are read at runtime.
|
|
2002
|
+
*
|
|
2003
|
+
* Values are inlined into public web bundles. Never put secrets here.
|
|
2004
|
+
*
|
|
2005
|
+
* @example
|
|
2006
|
+
* ```json
|
|
2007
|
+
* { "GA4_MEASUREMENT_ID": "G-XXXXXXX" }
|
|
2008
|
+
* ```
|
|
2009
|
+
*/
|
|
2010
|
+
env?: Record<string, string>;
|
|
1920
2011
|
}
|
|
1921
2012
|
/**
|
|
1922
2013
|
* Single bundle package entry.
|
|
@@ -2021,6 +2112,8 @@ declare namespace Flow {
|
|
|
2021
2112
|
next?: Route;
|
|
2022
2113
|
/** Cache configuration for this source. */
|
|
2023
2114
|
cache?: Cache<EventCacheRule>;
|
|
2115
|
+
/** Declarative store get/set. Paths resolve against `{ event, ingest }`. */
|
|
2116
|
+
state?: State | State[];
|
|
2024
2117
|
/**
|
|
2025
2118
|
* Source-level variables (highest priority in cascade).
|
|
2026
2119
|
* Overrides flow and root variables.
|
|
@@ -2069,7 +2162,7 @@ declare namespace Flow {
|
|
|
2069
2162
|
/** Destination environment configuration, merged with default destination environment. */
|
|
2070
2163
|
env?: unknown;
|
|
2071
2164
|
/**
|
|
2072
|
-
* First transformer in
|
|
2165
|
+
* First transformer in this destination's chain.
|
|
2073
2166
|
*
|
|
2074
2167
|
* Name of the transformer to execute before sending events to this destination.
|
|
2075
2168
|
* If omitted, events are sent directly from the collector.
|
|
@@ -2086,6 +2179,8 @@ declare namespace Flow {
|
|
|
2086
2179
|
next?: Route;
|
|
2087
2180
|
/** Cache configuration for this destination. */
|
|
2088
2181
|
cache?: Cache<EventCacheRule>;
|
|
2182
|
+
/** Declarative store get/set. Paths resolve against `{ event, ingest }`. */
|
|
2183
|
+
state?: State | State[];
|
|
2089
2184
|
/** Destination-level variables (highest priority in cascade). */
|
|
2090
2185
|
variables?: Variables;
|
|
2091
2186
|
/**
|
|
@@ -2137,14 +2232,23 @@ declare namespace Flow {
|
|
|
2137
2232
|
*
|
|
2138
2233
|
* Name of the next transformer to execute after this one.
|
|
2139
2234
|
* In a pre-collector chain (source.next), terminates at the collector.
|
|
2140
|
-
* In
|
|
2235
|
+
* In collector.next, terminates at the destination fan-out.
|
|
2236
|
+
* In a destination chain (destination.before), terminates at the destination.
|
|
2141
2237
|
* If omitted, the chain ends and control passes to the next pipeline stage.
|
|
2142
|
-
* Array values define an explicit chain
|
|
2143
|
-
* are
|
|
2238
|
+
* Array values define an explicit chain; a member's own `next` is
|
|
2239
|
+
* inserted right after it. Circular references are cut at runtime by the
|
|
2240
|
+
* chain runner's cycle guard (`advanceChain`).
|
|
2144
2241
|
*/
|
|
2145
2242
|
next?: Route;
|
|
2146
2243
|
/** Cache configuration for this transformer. */
|
|
2147
2244
|
cache?: Cache<EventCacheRule>;
|
|
2245
|
+
/** Declarative store get/set. Paths resolve against `{ event, ingest }`. */
|
|
2246
|
+
state?: State | State[];
|
|
2247
|
+
/**
|
|
2248
|
+
* Event mapping for a code-free transformer. The collector synthesizes a
|
|
2249
|
+
* push that applies it to the event (a rule with `ignore: true` drops it).
|
|
2250
|
+
*/
|
|
2251
|
+
mapping?: Config$7;
|
|
2148
2252
|
/** Transformer-level variables (highest priority in cascade). */
|
|
2149
2253
|
variables?: Variables;
|
|
2150
2254
|
/**
|
|
@@ -3478,7 +3582,7 @@ interface JourneyBranch {
|
|
|
3478
3582
|
/** Wall-clock duration of the branch, when measured. */
|
|
3479
3583
|
durationMs?: number;
|
|
3480
3584
|
/** Skip discriminator when the branch was skipped. */
|
|
3481
|
-
skipReason?: 'consent' | 'cache_hit' | 'sampled_out' | 'disabled' | 'unknown';
|
|
3585
|
+
skipReason?: 'consent' | 'cache_hit' | 'sampled_out' | 'disabled' | 'dropped' | 'unknown';
|
|
3482
3586
|
/** Error info when the branch failed. */
|
|
3483
3587
|
error?: {
|
|
3484
3588
|
name?: string;
|
|
@@ -3525,7 +3629,7 @@ interface JourneyHop {
|
|
|
3525
3629
|
message: string;
|
|
3526
3630
|
};
|
|
3527
3631
|
/** Skip discriminator when the hop's terminal phase is skip. */
|
|
3528
|
-
skipReason?: 'consent' | 'cache_hit' | 'sampled_out' | 'disabled' | 'unknown';
|
|
3632
|
+
skipReason?: 'consent' | 'cache_hit' | 'sampled_out' | 'disabled' | 'dropped' | 'unknown';
|
|
3529
3633
|
/** Matched mapping rule, when one matched. */
|
|
3530
3634
|
mappingKey?: string;
|
|
3531
3635
|
/** Matched contract rule, when one matched. */
|
|
@@ -3652,7 +3756,10 @@ interface JourneyAssembly {
|
|
|
3652
3756
|
declare function branch(event: DeepPartialEvent, next: Route): Result$1;
|
|
3653
3757
|
|
|
3654
3758
|
/**
|
|
3655
|
-
* Anonymizes an
|
|
3759
|
+
* Anonymizes an IP address: IPv4 keeps its /24, IPv6 its /48.
|
|
3760
|
+
*
|
|
3761
|
+
* An IPv4-mapped IPv6 address (`::ffff:1.2.3.4`, what a dual-stack listener
|
|
3762
|
+
* reports for an IPv4 client) is treated as the IPv4 address it carries.
|
|
3656
3763
|
*
|
|
3657
3764
|
* @param ip The IP address to anonymize.
|
|
3658
3765
|
* @returns The anonymized IP address or an empty string if the IP is invalid.
|
|
@@ -3667,12 +3774,32 @@ declare function anonymizeIP(ip: string): string;
|
|
|
3667
3774
|
* @packageDocumentation
|
|
3668
3775
|
*/
|
|
3669
3776
|
|
|
3777
|
+
/**
|
|
3778
|
+
* A `$env` or `$secret` reference that cannot resolve for a build. Carries a
|
|
3779
|
+
* code and the referenced NAME (never a value), so build tooling can report
|
|
3780
|
+
* the failure structurally instead of matching message text.
|
|
3781
|
+
* - `MISSING_ENV`: `$env.NAME` with no value in the build env and no default.
|
|
3782
|
+
* - `WEB_SECRET_REF`: `$secret.NAME` in a web (non-deferred) flow.
|
|
3783
|
+
*/
|
|
3784
|
+
declare class FlowReferenceError extends Error {
|
|
3785
|
+
readonly code: 'MISSING_ENV' | 'WEB_SECRET_REF';
|
|
3786
|
+
readonly reference: string;
|
|
3787
|
+
constructor(code: 'MISSING_ENV' | 'WEB_SECRET_REF', reference: string, message: string);
|
|
3788
|
+
}
|
|
3670
3789
|
/** Sentinel prefix for deferred $env resolution. Shared with CLI bundler. */
|
|
3671
3790
|
declare const ENV_MARKER_PREFIX = "__WALKEROS_ENV:";
|
|
3672
3791
|
/** Sentinel prefix for deferred $secret resolution. Shared with CLI bundler. */
|
|
3673
3792
|
declare const SECRET_MARKER_PREFIX = "__WALKEROS_SECRET:";
|
|
3674
3793
|
interface ResolveOptions {
|
|
3675
3794
|
deferred?: boolean;
|
|
3795
|
+
/**
|
|
3796
|
+
* The only source for non-deferred `$env` references. When set, `$env.NAME`
|
|
3797
|
+
* reads this map (then the inline `:default`) and never `process.env`.
|
|
3798
|
+
* Build tooling passes it so a web bundle cannot pick up whatever happens
|
|
3799
|
+
* to be in the building process's environment. When omitted, `process.env`
|
|
3800
|
+
* is used.
|
|
3801
|
+
*/
|
|
3802
|
+
env?: Readonly<Record<string, string | undefined>>;
|
|
3676
3803
|
/**
|
|
3677
3804
|
* When false, unresolved `$flow.X.Y` refs (unknown flow, missing key,
|
|
3678
3805
|
* empty value) trigger {@link onWarning} and the original `$flow…` string
|
|
@@ -3805,9 +3932,18 @@ declare function getByPath(event: unknown, key?: string, defaultValue?: unknown)
|
|
|
3805
3932
|
* @param obj - The object to set the value in.
|
|
3806
3933
|
* @param key - The dot-notation string.
|
|
3807
3934
|
* @param value - The value to set.
|
|
3808
|
-
* @
|
|
3935
|
+
* @param options.mutable - Write into `obj` in place instead of a clone. For
|
|
3936
|
+
* shared mutable context such as ingest, where later steps must see the
|
|
3937
|
+
* write. Returns `obj` itself.
|
|
3938
|
+
* @returns A new object with the updated value, or `obj` when mutable.
|
|
3939
|
+
*
|
|
3940
|
+
* Setting `undefined` removes the key instead, and creates nothing on a
|
|
3941
|
+
* missing path. An own key holding `undefined` is a state walkerOS never
|
|
3942
|
+
* produces, because JSON and JSON Schema treat it as absent.
|
|
3809
3943
|
*/
|
|
3810
|
-
declare function setByPath<T = unknown>(obj: T, key: string, value: unknown
|
|
3944
|
+
declare function setByPath<T = unknown>(obj: T, key: string, value: unknown, options?: {
|
|
3945
|
+
mutable?: boolean;
|
|
3946
|
+
}): T;
|
|
3811
3947
|
/**
|
|
3812
3948
|
* Deletes a value in an object by a dot-notation string.
|
|
3813
3949
|
* Returns a new object; the input is not mutated. No-op when the path is
|
|
@@ -3906,6 +4042,14 @@ declare function getId(length?: number, charset?: string): string;
|
|
|
3906
4042
|
*/
|
|
3907
4043
|
declare function getSpanId(): string;
|
|
3908
4044
|
|
|
4045
|
+
/**
|
|
4046
|
+
* Deterministic child span id: 16 lowercase hex characters (the shape of
|
|
4047
|
+
* `getSpanId`), derived from the parent id and the child's position. The
|
|
4048
|
+
* same inputs always give the same id, different positions or parents give
|
|
4049
|
+
* different ids, so forks of one event never collapse on `event.id`.
|
|
4050
|
+
*/
|
|
4051
|
+
declare function deriveSpanId(parentId: string, position: number | string): string;
|
|
4052
|
+
|
|
3909
4053
|
/**
|
|
3910
4054
|
* W3C trace_id: 16 random bytes encoded as 32 lowercase hex characters.
|
|
3911
4055
|
* Shared by every event of a collector run. Reference: W3C Trace Context.
|
|
@@ -4969,6 +5113,27 @@ declare function wrapFn(code: string): Fn$4;
|
|
|
4969
5113
|
*/
|
|
4970
5114
|
declare function wrapValidate(code: string): Validate;
|
|
4971
5115
|
|
|
5116
|
+
/**
|
|
5117
|
+
* Timer utilities for measuring execution time
|
|
5118
|
+
*/
|
|
5119
|
+
interface Timer {
|
|
5120
|
+
start: () => void;
|
|
5121
|
+
end: () => number;
|
|
5122
|
+
getElapsed: () => number;
|
|
5123
|
+
format: () => string;
|
|
5124
|
+
}
|
|
5125
|
+
/**
|
|
5126
|
+
* Create a high-precision timer
|
|
5127
|
+
*/
|
|
5128
|
+
declare function createTimer(): Timer;
|
|
5129
|
+
|
|
5130
|
+
/**
|
|
5131
|
+
* Extract error message from unknown error type
|
|
5132
|
+
* @param error - Unknown error object
|
|
5133
|
+
* @returns Error message as string
|
|
5134
|
+
*/
|
|
5135
|
+
declare function getErrorMessage(error: unknown): string;
|
|
5136
|
+
|
|
4972
5137
|
interface ExampleSummary {
|
|
4973
5138
|
name: string;
|
|
4974
5139
|
description?: string;
|
|
@@ -5259,32 +5424,228 @@ declare function pushResultToOutcome(result: {
|
|
|
5259
5424
|
*/
|
|
5260
5425
|
declare function compileMatcher(expr: MatchExpression | '*' | undefined): CompiledMatcher;
|
|
5261
5426
|
|
|
5427
|
+
/** Position inside a raw route spec, e.g. `['one', 0, 'next']`. */
|
|
5428
|
+
type RoutePath = (string | number)[];
|
|
5429
|
+
/**
|
|
5430
|
+
* Where a compiled id or stop came from: the nearest enclosing decision
|
|
5431
|
+
* (`one` / `many` entry or gated `next` / `stop`) with its SOURCE match
|
|
5432
|
+
* expression, or, outside any decision, the plain position of the segment.
|
|
5433
|
+
* Kept beside the compiled matcher so enumerations can label branches.
|
|
5434
|
+
*/
|
|
5435
|
+
interface RouteDecision {
|
|
5436
|
+
kind: 'next' | 'one' | 'many' | 'sequence';
|
|
5437
|
+
path: RoutePath;
|
|
5438
|
+
match?: MatchExpression;
|
|
5439
|
+
catchAll?: true;
|
|
5440
|
+
}
|
|
5441
|
+
/**
|
|
5442
|
+
* A decision label plus `outer`, the enclosing decision whose match must
|
|
5443
|
+
* also have held to reach this one (a gate inside a `one` entry, a `one`
|
|
5444
|
+
* inside a gate, ...). The chain of `outer` links lists every decision on
|
|
5445
|
+
* the way from the route's head.
|
|
5446
|
+
*/
|
|
5447
|
+
interface RouteLabel extends RouteDecision {
|
|
5448
|
+
outer?: RouteLabel;
|
|
5449
|
+
}
|
|
5450
|
+
/**
|
|
5451
|
+
* Internal: compiled route data. Not exported from the package's public
|
|
5452
|
+
* surface (`@walkeros/core`), but exported here so adjacent files inside the
|
|
5453
|
+
* core package can probe compilation.
|
|
5454
|
+
*/
|
|
5455
|
+
interface CompiledRoute {
|
|
5456
|
+
match: CompiledMatcher;
|
|
5457
|
+
source?: MatchExpression;
|
|
5458
|
+
next: CompiledNext;
|
|
5459
|
+
}
|
|
5460
|
+
type CompiledIdNode = {
|
|
5461
|
+
type: 'static';
|
|
5462
|
+
value: string;
|
|
5463
|
+
label: RouteLabel;
|
|
5464
|
+
} | {
|
|
5465
|
+
type: 'chain';
|
|
5466
|
+
value: string[];
|
|
5467
|
+
label: RouteLabel;
|
|
5468
|
+
};
|
|
5469
|
+
type CompiledStopNode = {
|
|
5470
|
+
type: 'stop';
|
|
5471
|
+
label: RouteLabel;
|
|
5472
|
+
};
|
|
5473
|
+
type CompiledGateNode = {
|
|
5474
|
+
type: 'gate';
|
|
5475
|
+
match: CompiledMatcher;
|
|
5476
|
+
source: MatchExpression;
|
|
5477
|
+
next: CompiledNext;
|
|
5478
|
+
};
|
|
5479
|
+
type CompiledNext = CompiledIdNode | CompiledStopNode | CompiledGateNode | {
|
|
5480
|
+
type: 'one';
|
|
5481
|
+
routes: CompiledRoute[];
|
|
5482
|
+
} | {
|
|
5483
|
+
type: 'many';
|
|
5484
|
+
routes: CompiledRoute[];
|
|
5485
|
+
} | {
|
|
5486
|
+
type: 'sequence';
|
|
5487
|
+
value: CompiledNext[];
|
|
5488
|
+
};
|
|
5489
|
+
/**
|
|
5490
|
+
* The unresolved remainder of a route: compiled segments still to walk,
|
|
5491
|
+
* followed by the remainder of every enclosing level (`tail`). Treat it as
|
|
5492
|
+
* opaque: only `getNextSteps` (and the chain helpers built on it) read it.
|
|
5493
|
+
* It references the cached compiled nodes, so resuming never recompiles.
|
|
5494
|
+
*/
|
|
5495
|
+
interface RouteContinuation {
|
|
5496
|
+
readonly type: 'continuation';
|
|
5497
|
+
readonly segments: readonly CompiledNext[];
|
|
5498
|
+
readonly at: number;
|
|
5499
|
+
readonly tail?: RouteContinuation;
|
|
5500
|
+
}
|
|
5501
|
+
/**
|
|
5502
|
+
* Result of resolving a route against one root.
|
|
5503
|
+
*
|
|
5504
|
+
* - `{ ids }`: run these ids in order. `ids: []` without `then` means the
|
|
5505
|
+
* route resolved to nothing (gate failed, no `one` entry matched, empty or
|
|
5506
|
+
* undefined spec): the caller continues with whatever follows the route.
|
|
5507
|
+
* - `{ ids, then }`: run `ids`, then resolve `then` against the root as the
|
|
5508
|
+
* last of those steps left it (lazy sequences).
|
|
5509
|
+
* - `{ ids: [], stop: true }`: a `stop` matched; the running copy ends.
|
|
5510
|
+
* - `{ ids: [], forks }`: a `many` matched two or more entries. Each fork is
|
|
5511
|
+
* an independent copy that resolves its own continuation (which already
|
|
5512
|
+
* includes the rest of the enclosing sequence).
|
|
5513
|
+
*/
|
|
5514
|
+
type NextSteps = {
|
|
5515
|
+
ids: string[];
|
|
5516
|
+
then?: RouteContinuation;
|
|
5517
|
+
stop?: never;
|
|
5518
|
+
forks?: never;
|
|
5519
|
+
} | {
|
|
5520
|
+
ids: [];
|
|
5521
|
+
stop: true;
|
|
5522
|
+
then?: never;
|
|
5523
|
+
forks?: never;
|
|
5524
|
+
} | {
|
|
5525
|
+
ids: [];
|
|
5526
|
+
forks: RouteContinuation[];
|
|
5527
|
+
stop?: never;
|
|
5528
|
+
then?: never;
|
|
5529
|
+
};
|
|
5262
5530
|
declare function isRouteConfigEntry(entry: unknown): boolean;
|
|
5263
5531
|
/**
|
|
5264
|
-
* Pure RouteConfig array
|
|
5532
|
+
* Pure RouteConfig array: every element is a RouteConfig object.
|
|
5265
5533
|
* Used to detect the legacy first-match shape (treated as implicit `one`).
|
|
5266
5534
|
*/
|
|
5267
5535
|
declare function isRouteArray(next: Route): next is RouteConfig[];
|
|
5536
|
+
declare function isRouteContinuation(spec: Route | RouteContinuation): spec is RouteContinuation;
|
|
5537
|
+
/**
|
|
5538
|
+
* The one route resolver. Resolves `spec` (a Route or a continuation handed
|
|
5539
|
+
* back by an earlier call) against the resolution root `{ ingest, event }`
|
|
5540
|
+
* of the position that is running.
|
|
5541
|
+
*
|
|
5542
|
+
* Deterministic for the SUPPLIED root only. Static tooling that needs every
|
|
5543
|
+
* possible target uses `getRouteGraph`, the enumeration over the same
|
|
5544
|
+
* compiled form.
|
|
5545
|
+
*/
|
|
5546
|
+
declare function getNextSteps(spec: Route | RouteContinuation | undefined, root: Root): NextSteps;
|
|
5547
|
+
|
|
5548
|
+
/**
|
|
5549
|
+
* One level of the continuation stack.
|
|
5550
|
+
*
|
|
5551
|
+
* - `ids` frame: resolved ids still to run, `at` is the next one.
|
|
5552
|
+
* - `route` frame: a route (or a route continuation) not resolved yet. It is
|
|
5553
|
+
* resolved only when popped, i.e. with the root as the preceding step left
|
|
5554
|
+
* it. A member's own `next` is pushed as a route frame right after the
|
|
5555
|
+
* member runs.
|
|
5556
|
+
*
|
|
5557
|
+
* `ancestry` lists the members whose own `next` inserted this frame (outer
|
|
5558
|
+
* first). A member already in its frame's ancestry is not run again: that is
|
|
5559
|
+
* the cycle guard for member-next insertion. Frames of the explicit start
|
|
5560
|
+
* route have an empty ancestry, so a step listed twice runs twice.
|
|
5561
|
+
*/
|
|
5562
|
+
type ChainFrame = {
|
|
5563
|
+
ids: readonly string[];
|
|
5564
|
+
at: number;
|
|
5565
|
+
ancestry: readonly string[];
|
|
5566
|
+
} | {
|
|
5567
|
+
route: Route | RouteContinuation;
|
|
5568
|
+
ancestry: readonly string[];
|
|
5569
|
+
};
|
|
5570
|
+
/**
|
|
5571
|
+
* Immutable continuation stack, top first. A fork copies it, so every copy
|
|
5572
|
+
* carries the continuation of every enclosing level.
|
|
5573
|
+
*/
|
|
5574
|
+
type ChainContinuation = readonly ChainFrame[];
|
|
5268
5575
|
/**
|
|
5269
|
-
*
|
|
5270
|
-
*
|
|
5271
|
-
*
|
|
5272
|
-
*
|
|
5273
|
-
*
|
|
5274
|
-
*
|
|
5275
|
-
*
|
|
5276
|
-
*
|
|
5277
|
-
*
|
|
5278
|
-
*
|
|
5279
|
-
*
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5576
|
+
* What to do next.
|
|
5577
|
+
*
|
|
5578
|
+
* - `run`: run step `id`, then advance `rest` with the root the step left.
|
|
5579
|
+
* `rest` already carries the member's own `next` on top (unresolved).
|
|
5580
|
+
* `ancestry` is that frame's ancestry (member included), for a caller that
|
|
5581
|
+
* pushes a further route on behalf of the member.
|
|
5582
|
+
* - `fork`: run every branch to its end as an independent copy.
|
|
5583
|
+
* - `stop`: this copy ends. `owner` is the member whose own route (its
|
|
5584
|
+
* `next`, or a route pushed on its behalf) resolved the stop; absent when
|
|
5585
|
+
* the stop came from the start route itself.
|
|
5586
|
+
* - `done`: the path is finished.
|
|
5587
|
+
*/
|
|
5588
|
+
type ChainStep = {
|
|
5589
|
+
kind: 'run';
|
|
5590
|
+
id: string;
|
|
5591
|
+
rest: ChainContinuation;
|
|
5592
|
+
ancestry: readonly string[];
|
|
5593
|
+
} | {
|
|
5594
|
+
kind: 'fork';
|
|
5595
|
+
branches: ChainContinuation[];
|
|
5596
|
+
} | {
|
|
5597
|
+
kind: 'stop';
|
|
5598
|
+
owner?: string;
|
|
5599
|
+
} | {
|
|
5600
|
+
kind: 'done';
|
|
5601
|
+
};
|
|
5602
|
+
/** Continuation stack for a chain field (`next`, `before`, ...). */
|
|
5603
|
+
declare function startChain(spec: Route | undefined): ChainContinuation;
|
|
5604
|
+
/**
|
|
5605
|
+
* Tells a continuation stack apart from a Route. Route arrays hold ids,
|
|
5606
|
+
* nested routes and route configs, never frames; an empty array means
|
|
5607
|
+
* "nothing to run" either way.
|
|
5608
|
+
*/
|
|
5609
|
+
declare function isChainContinuation(value: Route | ChainContinuation): value is ChainContinuation;
|
|
5610
|
+
/**
|
|
5611
|
+
* Advances the continuation stack to the next thing to do. Pure: no I/O and
|
|
5612
|
+
* no transformer execution. Route frames are resolved through
|
|
5613
|
+
* `getNextSteps` with `root`, only when popped.
|
|
5614
|
+
*/
|
|
5615
|
+
declare function advanceChain(stack: ChainContinuation, root: Root, transformers: Transformers): ChainStep;
|
|
5616
|
+
/**
|
|
5617
|
+
* One branch of the route graph: `targets` run in order right after `from`
|
|
5618
|
+
* (the position's head when `from` is absent). A branch ending in a `stop`
|
|
5619
|
+
* has `stop: true`.
|
|
5620
|
+
*
|
|
5621
|
+
* - `kind`, `match`, `catchAll`: the decision that selected the branch, with
|
|
5622
|
+
* the SOURCE match expression (for labels and matcher path checks).
|
|
5623
|
+
* - `path`: position of that decision (or plain segment) inside the raw
|
|
5624
|
+
* route; the route is the given spec, or `transformers[owner].config.next`
|
|
5625
|
+
* when `owner` is set (an inserted member `next`).
|
|
5626
|
+
* - `via`: the enclosing decisions (outer first) that must also have held
|
|
5627
|
+
* to reach this branch, e.g. the `one` entry around a nested gate. Absent
|
|
5628
|
+
* when the branch sits directly under the route's head.
|
|
5629
|
+
*/
|
|
5630
|
+
interface RouteGraphNode {
|
|
5631
|
+
from?: string;
|
|
5632
|
+
targets: string[];
|
|
5633
|
+
kind: RouteLabel['kind'];
|
|
5634
|
+
match?: MatchExpression;
|
|
5635
|
+
stop?: true;
|
|
5636
|
+
catchAll?: true;
|
|
5637
|
+
path: (string | number)[];
|
|
5638
|
+
owner?: string;
|
|
5639
|
+
via?: RouteDecision[];
|
|
5640
|
+
}
|
|
5641
|
+
/**
|
|
5642
|
+
* Enumerates every branch of a route over the same compiled form and the
|
|
5643
|
+
* same continuation stack as `advanceChain`: every `one` and `many` entry,
|
|
5644
|
+
* both sides of a gate, sequence segments in order, stops marked. With
|
|
5645
|
+
* `transformers`, each member's own `next` is drawn where it is inserted,
|
|
5646
|
+
* and each fork continues through the rest of the path.
|
|
5647
|
+
*/
|
|
5648
|
+
declare function getRouteGraph(spec: Route | undefined, transformers?: Transformers): RouteGraphNode[];
|
|
5288
5649
|
|
|
5289
5650
|
interface CompiledCacheRule {
|
|
5290
5651
|
match: CompiledMatcher;
|
|
@@ -5305,10 +5666,11 @@ interface CacheResult {
|
|
|
5305
5666
|
rule: CompiledCacheRule;
|
|
5306
5667
|
}
|
|
5307
5668
|
/**
|
|
5308
|
-
* Builds
|
|
5309
|
-
*
|
|
5669
|
+
* Builds the `{ event, ingest }` resolution root. Ingest defaults to `{}`.
|
|
5670
|
+
* `event` is omitted when undefined, because `before` chains route on ingest
|
|
5671
|
+
* before an event exists.
|
|
5310
5672
|
*/
|
|
5311
|
-
declare function
|
|
5673
|
+
declare function createMappingRoot(ingest?: Record<string, unknown>, event?: DeepPartialEvent): Root;
|
|
5312
5674
|
declare function compileCache(cache: Cache<EventCacheRule>): CompiledCache;
|
|
5313
5675
|
declare function checkCache(compiled: CompiledCache, store: Instance$1, context: Record<string, unknown>, namespace?: string): Promise<CacheResult | null>;
|
|
5314
5676
|
declare function storeCache(store: Instance$1, key: string, value: unknown, ttlSeconds: number): void;
|
|
@@ -5405,13 +5767,21 @@ type GetStore = (id: string | undefined) => Instance$1 | undefined;
|
|
|
5405
5767
|
declare function compileState(state: State | State[]): State[];
|
|
5406
5768
|
/**
|
|
5407
5769
|
* Apply declarative store operations against an event, in array order,
|
|
5408
|
-
* sequentially.
|
|
5409
|
-
*
|
|
5410
|
-
*
|
|
5411
|
-
*
|
|
5770
|
+
* sequentially.
|
|
5771
|
+
*
|
|
5772
|
+
* `key` and `value` resolve against `{ event, ingest }`, so every path names
|
|
5773
|
+
* its side: `event.user.session`, `ingest.site`. `get` reads from the store
|
|
5774
|
+
* and writes the fetched value to its `value` path: `event.x` onto the event
|
|
5775
|
+
* (immutably), `ingest.x` into the ingest in place. An ingest write is shared
|
|
5776
|
+
* by every event in the scope, so at a fan-out it loses per-event
|
|
5777
|
+
* attribution. `set` writes the resolved value to the store.
|
|
5778
|
+
*
|
|
5779
|
+
* Each entry is fail-open: a store or resolution error is logged and the
|
|
5780
|
+
* event is left unmutated, the chain continues. A key that does not resolve
|
|
5781
|
+
* warns; a store miss is silent. Only `FatalError` rethrows (via
|
|
5412
5782
|
* `getMappingValue`).
|
|
5413
5783
|
*/
|
|
5414
|
-
declare function applyState<E extends DeepPartialEvent>(states: State[], getStore: GetStore, event: E, collector: Instance$6): Promise<E>;
|
|
5784
|
+
declare function applyState<E extends DeepPartialEvent>(states: State[], getStore: GetStore, event: E, collector: Instance$6, ingest: Record<string, unknown> | undefined): Promise<E>;
|
|
5415
5785
|
|
|
5416
5786
|
/**
|
|
5417
5787
|
* Single source of truth for step-entry validation across all four kinds.
|
|
@@ -5428,7 +5798,63 @@ declare function applyState<E extends DeepPartialEvent>(states: State[], getStor
|
|
|
5428
5798
|
* - INVALID_IMPORT `import` is set but is not a valid JS identifier
|
|
5429
5799
|
* - INVALID_CODE_SHAPE `code` is present but is neither an object nor a string
|
|
5430
5800
|
*/
|
|
5431
|
-
|
|
5801
|
+
/**
|
|
5802
|
+
* The Flow step interface for each step kind.
|
|
5803
|
+
*/
|
|
5804
|
+
interface StepByKind {
|
|
5805
|
+
Source: Flow.Source;
|
|
5806
|
+
Transformer: Flow.Transformer;
|
|
5807
|
+
Destination: Flow.Destination;
|
|
5808
|
+
Store: Flow.Store;
|
|
5809
|
+
}
|
|
5810
|
+
/** A declared field name of the Flow step interface for `K`. */
|
|
5811
|
+
type StepField<K extends Flow.StepKind> = keyof StepByKind[K] & string;
|
|
5812
|
+
/**
|
|
5813
|
+
* Lifecycle role of a declared step field.
|
|
5814
|
+
*
|
|
5815
|
+
* - `reference`: selects the implementation (`code`, `package`, `import`).
|
|
5816
|
+
* The bundler turns it into the emitted `code` value; it is never emitted
|
|
5817
|
+
* as-is.
|
|
5818
|
+
* - `resolve`: consumed by flow resolution (the variable cascade). Kept on the
|
|
5819
|
+
* resolved flow, never emitted into a bundle.
|
|
5820
|
+
* - `docs`: consumed by validate/simulate/test tooling. Stripped at flow
|
|
5821
|
+
* resolution, never emitted.
|
|
5822
|
+
* - `runtime`: must reach the collector unchanged, on every emission path
|
|
5823
|
+
* (package step, inline code step, code-free path step).
|
|
5824
|
+
*/
|
|
5825
|
+
type StepFieldRole = 'reference' | 'resolve' | 'docs' | 'runtime';
|
|
5826
|
+
/**
|
|
5827
|
+
* Single source of truth for what happens to each declared step field between
|
|
5828
|
+
* the flow file and the running collector. Flow resolution (`getFlowSettings`)
|
|
5829
|
+
* and the CLI bundler both derive their field handling from this table instead
|
|
5830
|
+
* of hand-written field lists.
|
|
5831
|
+
*
|
|
5832
|
+
* Each entry is typed as a complete map over the Flow step interface, so adding
|
|
5833
|
+
* a field to `Flow.Source` / `Flow.Transformer` / `Flow.Destination` /
|
|
5834
|
+
* `Flow.Store` is a compile error here until the field is classified.
|
|
5835
|
+
*/
|
|
5836
|
+
declare const STEP_FIELD_ROLES: {
|
|
5837
|
+
readonly [K in Flow.StepKind]: Readonly<Record<StepField<K>, StepFieldRole>>;
|
|
5838
|
+
};
|
|
5839
|
+
/**
|
|
5840
|
+
* Role of `field` on a step of `kind`, or `undefined` when the field is not a
|
|
5841
|
+
* declared Flow step field.
|
|
5842
|
+
*/
|
|
5843
|
+
declare function getStepFieldRole(kind: Flow.StepKind, field: string): StepFieldRole | undefined;
|
|
5844
|
+
/**
|
|
5845
|
+
* The runtime fields of a step entry: every declared field classified as
|
|
5846
|
+
* `runtime` whose value is set. This is what the bundler must emit for the
|
|
5847
|
+
* step, whatever its emission path.
|
|
5848
|
+
*/
|
|
5849
|
+
declare function getStepRuntimeProps(step: object, kind: Flow.StepKind): Record<string, unknown>;
|
|
5850
|
+
/**
|
|
5851
|
+
* Fields whose presence makes an entry operative (a real step rather than an
|
|
5852
|
+
* empty no-op). Each is a declared Flow step field; see `STEP_FIELD_ROLES` for
|
|
5853
|
+
* its lifecycle.
|
|
5854
|
+
*/
|
|
5855
|
+
declare const STEP_OPERATIVE_FIELDS: {
|
|
5856
|
+
readonly [K in Flow.StepKind]: readonly StepField<K>[];
|
|
5857
|
+
};
|
|
5432
5858
|
type StepEntryErrorCode = 'UNKNOWN_KEY' | 'CONFLICT' | 'MISSING_PACKAGE' | 'OBSOLETE_CODE_STRING' | 'INVALID_IMPORT' | 'INVALID_CODE_SHAPE';
|
|
5433
5859
|
interface StepEntryValidation {
|
|
5434
5860
|
ok: boolean;
|
|
@@ -5484,4 +5910,4 @@ declare const REF_CODE_PREFIX = "$code:";
|
|
|
5484
5910
|
*/
|
|
5485
5911
|
declare function scanFlowRefs(value: unknown, into?: Set<string>): Set<string>;
|
|
5486
5912
|
|
|
5487
|
-
export { type ActivationGrant, type AssembleJourneysOptions, type BatchResponse, type BatchedPosterOptions, type BreakerState, CLOCK_SKEW_MS, cache as Cache, type CacheEnvelope, type CacheResult, type ClickIdEntry, collector as Collector, type CompiledCache, Const, context as Context, type Credential, type Debounced, destination as Destination, type DestroyContext, type DestroyFn, type DroppedCounters, ENV_MARKER_PREFIX, elb as Elb, type EmitFn, type EventOutcome, type ExampleSummary, FatalError, Flow, type FlowConfigResolver, type FlowState, type FlowStateBatch, type FlowStatePhase, type FlowStepType, type GetStore, hint as Hint, hooks as Hooks, type Ingest, type IngestEnvelope, type IngestMeta, InvalidEventError, type Journey, type JourneyAssembly, type JourneyBranch, type JourneyCorrelation, type JourneyEntry, type JourneyGap, type JourneyHop, type JourneyHopStatus, type JourneyPlatform, type JourneyStatus, type JourneyTopology, type JourneyTopologyNode, type JourneyUnattributed, type JsonSchema, Level, lifecycle as Lifecycle, type LifecycleContext, logger as Logger, MAX_SESSION_MS, mapping as Mapping, type MarketingParameters, matcher as Matcher, type MockLogger, type NodeLikeRequest, OBSERVE_ENV_KEY, OBSERVE_STORAGE_KEY, type Observe, type ObserveCredential, type ObserveServer, type ObserveWeb, type ObserverFn, on as On, type ParsedGrant, type ParsedTraceparent, type PosterFetch, type PosterResponse, type PreviewCrypto, type PreviewFailure, type PreviewKey, type PreviewSubtle, REF_CODE_PREFIX, REF_CONTRACT, REF_ENV, REF_FLOW, REF_SECRET, REF_STORE, REF_VAR_FULL, REF_VAR_INLINE, request as Request, type ResolveContractsOptions, type ResolveOptions, type RespondFn, type RespondOptions, SECRET_MARKER_PREFIX, SESSION_STORAGE_KEY, STEP_OPERATIVE_FIELDS, type ScheduleOptions, type SendDataValue, type SendHeaders, type SendResponse, type ServiceAccount, type SetupFn, simulation as Simulation, source as Source, type State, type StepEntryErrorCode, type StepEntryValidation, type StepKind, type StorageType, store as Store, StoreCodecError, type SwapActivatorConfig, type TelemetryLevel, type TelemetryOptions, type TelemetryOptionsSupplier, transformer as Transformer, trigger as Trigger, URL_WINDOW_MS, type ValidateEvents, type VerifyParams, type VerifyResult, walkeros as WalkerOS, type WalkerOSPackage, type WalkerOSPackageInfo, type WalkerOSPackageMeta, anonymizeIP, applyState, applyUpdate, assembleJourneys, assign, batchResponse, branch, browserSwapActivator,
|
|
5913
|
+
export { type ActivationGrant, type AssembleJourneysOptions, type BatchResponse, type BatchedPosterOptions, type BreakerState, CLOCK_SKEW_MS, cache as Cache, type CacheEnvelope, type CacheResult, type ChainContinuation, type ChainFrame, type ChainStep, type ClickIdEntry, collector as Collector, type CompiledCache, Const, context as Context, type Credential, type Debounced, destination as Destination, type DestroyContext, type DestroyFn, type DroppedCounters, ENV_MARKER_PREFIX, elb as Elb, type EmitFn, type EventOutcome, type ExampleSummary, FatalError, Flow, type FlowConfigResolver, FlowReferenceError, type FlowState, type FlowStateBatch, type FlowStatePhase, type FlowStepType, type GetStore, hint as Hint, hooks as Hooks, type Ingest, type IngestEnvelope, type IngestMeta, InvalidEventError, type Journey, type JourneyAssembly, type JourneyBranch, type JourneyCorrelation, type JourneyEntry, type JourneyGap, type JourneyHop, type JourneyHopStatus, type JourneyPlatform, type JourneyStatus, type JourneyTopology, type JourneyTopologyNode, type JourneyUnattributed, type JsonSchema, Level, lifecycle as Lifecycle, type LifecycleContext, logger as Logger, MAX_SESSION_MS, mapping as Mapping, type MarketingParameters, matcher as Matcher, type MockLogger, type NextSteps, type NodeLikeRequest, OBSERVE_ENV_KEY, OBSERVE_STORAGE_KEY, type Observe, type ObserveCredential, type ObserveServer, type ObserveWeb, type ObserverFn, on as On, type ParsedGrant, type ParsedTraceparent, type PosterFetch, type PosterResponse, type PreviewCrypto, type PreviewFailure, type PreviewKey, type PreviewSubtle, REF_CODE_PREFIX, REF_CONTRACT, REF_ENV, REF_FLOW, REF_SECRET, REF_STORE, REF_VAR_FULL, REF_VAR_INLINE, request as Request, type ResolveContractsOptions, type ResolveOptions, type RespondFn, type RespondOptions, type RouteContinuation, type RouteDecision, type RouteGraphNode, type RouteLabel, SECRET_MARKER_PREFIX, SESSION_STORAGE_KEY, STEP_FIELD_ROLES, STEP_OPERATIVE_FIELDS, type ScheduleOptions, type SendDataValue, type SendHeaders, type SendResponse, type ServiceAccount, type SetupFn, simulation as Simulation, source as Source, type State, type StepEntryErrorCode, type StepEntryValidation, type StepField, type StepFieldRole, type StepKind, type StorageType, store as Store, StoreCodecError, type SwapActivatorConfig, type TelemetryLevel, type TelemetryOptions, type TelemetryOptionsSupplier, type Timer, transformer as Transformer, trigger as Trigger, URL_WINDOW_MS, type ValidateEvents, type VerifyParams, type VerifyResult, walkeros as WalkerOS, type WalkerOSPackage, type WalkerOSPackageInfo, type WalkerOSPackageMeta, advanceChain, anonymizeIP, applyState, applyUpdate, assembleJourneys, assign, batchResponse, branch, browserSwapActivator, buildScopeFromNodeRequest, castToProperty, castValue, checkCache, clone, compileCache, compileMatcher, compileState, createBatchedPoster, createDestination, createEvent, createIngest, createLogger, createMappingRoot, createMockContext, createMockLogger, createRespond, createTelemetryObserver, createTimer, debounce, deepMerge, defaultClickIds, deleteByPath, deriveSpanId, deserializeStoreValue, emitStep, fetchPackage, fetchPackageSchema, filterValues, flattenIncludeSections, formatOut, getBrowser, getBrowserVersion, getByPath, getDeviceType, getErrorMessage, getEvent, getFlowSettings, getGrantedConsent, getHeaders, getId, getMappingEvent, getMappingValue, getMarketingParameters, getNextSteps, getOS, getOSVersion, getPlatform, getRouteGraph, getSpanId, getStepFieldRole, getStepRuntimeProps, getTraceId, getTraceUntil, isArguments, isArray, isBatchBody, isBoolean, isChainContinuation, isCommand, isDefined, isElementOrDocument, isEnvObserve, isFunction, isNumber, isObject, isPathStepEntry, isPropertyType, isRouteArray, isRouteConfigEntry, isRouteContinuation, isSameType, isSampled, isScope, isStoreValue, isString, mcpError, mcpResult, mergeContractSchemas, mergeMappingRule, mockEnv, normalizeBody, normalizeHeaders, normalizeQuery, observeFromEnv, packageNameToVariable, parseCallPath, parseGrant, parseObserveCredential, parseTraceparent, parseUserAgent, processEventMapping, pushResultToOutcome, readCacheEnvelope, requestToData, requestToParameter, resolveContracts, resolveSetup, resolveTelemetryOptions, scanFlowRefs, serializeStoreValue, setByPath, setTraceUntil, startChain, stepId, storeCache, throttle, throwError, toEventList, transformData, traverseEnv, trim, tryCatch, tryCatchAsync, useHooks, validateStepEntry, verifyActivation, walkPath, wrapCacheEnvelope, wrapCondition, wrapFn, wrapValidate };
|