@walkeros/core 4.8.1-next-1792019907609 → 4.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -325,6 +325,18 @@ interface ObserveServer {
325
325
  sample?: number;
326
326
  }
327
327
  type Observe = ObserveWeb | ObserveServer;
328
+ /** Where a web arm finds its credential: the page, from `@walkeros/web-core`. */
329
+ interface ObserveSlot {
330
+ /** The URL credential if present, else the stored one; null when absent. */
331
+ read(): {
332
+ raw: string;
333
+ fromUrl: boolean;
334
+ } | null;
335
+ /** Persist `raw`; when it came from the URL, strip it from the address bar. */
336
+ keep(raw: string, fromUrl: boolean): void;
337
+ /** Clear the stored credential only while it still equals `raw`. */
338
+ clear(raw: string): void;
339
+ }
328
340
  /** Claims carried by a parsed `obsw_` web credential. */
329
341
  interface ObserveCredential {
330
342
  /** Project binding. Must match the value baked into the host bundle. */
@@ -413,10 +425,16 @@ interface FlowState {
413
425
  inEvent?: unknown;
414
426
  /** Outbound walker event/payload for this hop. Only populated when level === 'trace' or includeOut === true. */
415
427
  outEvent?: unknown;
416
- /** Error info when phase === 'error'. */
428
+ /**
429
+ * Error info when phase === 'error'. A delivery failure also carries its
430
+ * failure `code`, whether a retry can help and the HTTP `status`.
431
+ */
417
432
  error?: {
418
433
  name?: string;
419
434
  message: string;
435
+ code?: string;
436
+ retryable?: boolean;
437
+ status?: number;
420
438
  };
421
439
  /** The mapping rule that matched, when one matched. */
422
440
  mappingKey?: string;
@@ -431,7 +449,7 @@ interface FlowState {
431
449
  /** For phase === 'flush', the batch size + entry index. */
432
450
  batch?: FlowStateBatch;
433
451
  /** Discriminator when phase === 'skip'. */
434
- skipReason?: 'consent' | 'cache_hit' | 'sampled_out' | 'disabled' | 'dropped' | 'unknown';
452
+ skipReason?: 'consent' | 'cache_hit' | 'sampled_out' | 'disabled' | 'dropped' | 'ignored' | 'unknown';
435
453
  /** Free-form metadata: store key/value, cached: true, etc. */
436
454
  meta?: Record<string, unknown>;
437
455
  }
@@ -445,6 +463,48 @@ interface FlowState {
445
463
  */
446
464
  type ObserverFn = (state: FlowState) => void;
447
465
 
466
+ /** What a failure line is about: the step, the cause code and the HTTP status. */
467
+ interface CauseKey {
468
+ step: string;
469
+ code: string;
470
+ status?: number;
471
+ }
472
+ /** Where cause lines go; `Logger.Instance` fits, and so does a test recorder. */
473
+ interface CauseLogger {
474
+ error(message: string, context: Record<string, unknown>): void;
475
+ warn(message: string, context: Record<string, unknown>): void;
476
+ }
477
+ /**
478
+ * One line per cause: the first occurrence of a key is logged at once,
479
+ * repeats within the window are counted and printed as `suppressed: <n>`
480
+ * with the next line of that key or at `flush`.
481
+ */
482
+ interface CauseLog {
483
+ report(key: CauseKey, message: string, context: Record<string, unknown>, level?: 'error' | 'warn'): void;
484
+ /** Print the pending `suppressed` counts (server shutdown). */
485
+ flush(): void;
486
+ /** Number of keys held. */
487
+ size(): number;
488
+ }
489
+ interface CauseLogOptions {
490
+ windowMs?: number;
491
+ maxKeys?: number;
492
+ now?: () => number;
493
+ }
494
+ /**
495
+ * Creates the cause log of one collector. Rate limit per (step, code,
496
+ * status): one line per window, repeats counted. At most `maxKeys` keys are
497
+ * held; a key beyond the cap is logged on every occurrence, never dropped
498
+ * and never suppressed. No timers: windows are checked on report.
499
+ */
500
+ declare function createCauseLog(logger: CauseLogger, options?: CauseLogOptions): CauseLog;
501
+ /**
502
+ * The one entry for every failure line: through the collector's cause log,
503
+ * or, without one (a hand-built collector), one filtered line through
504
+ * `logger`.
505
+ */
506
+ declare function reportCause(collector: Instance$6 | undefined, logger: CauseLogger, key: CauseKey, message: string, context: Record<string, unknown>, level?: 'error' | 'warn'): void;
507
+
448
508
  /** Identifies which kind of step a stepId belongs to. */
449
509
  type StepKind = 'collector' | 'source' | 'transformer' | 'destination' | 'store';
450
510
  /**
@@ -509,6 +569,14 @@ interface Config$6 {
509
569
  * destination backfill. Overflow drops oldest (FIFO). Default 1000.
510
570
  */
511
571
  queueMax?: number;
572
+ /**
573
+ * What a destination does with an event whose required consent is not
574
+ * granted: `'queue'` (default) keeps it in the destination's `queuePush`
575
+ * until consent is granted; `'skip'` skips it (counted in
576
+ * `status.destinations[id].skipped`, a DEBUG line), for a server collector
577
+ * that never receives a later grant for an event's own consent.
578
+ */
579
+ consentDenied?: 'queue' | 'skip';
512
580
  /** Flow name; keys this flow's entry in event.source.release and the observer flowId. */
513
581
  name?: string;
514
582
  /** Config release id stamped into event.source.release for this flow. */
@@ -547,11 +615,14 @@ interface InitConfig extends Partial<Config$6> {
547
615
  /**
548
616
  * Observation session connect config, wired by `startFlow` before the run
549
617
  * command. The server form attaches a telemetry poster directly from its
550
- * config trio; the web form attaches only when an `elbObserve` credential
551
- * is present (URL param or storage slot) and its binding matches. Purely
552
- * advisory: nothing on this path can affect event processing.
618
+ * config trio; the web form reads its credential through `slot`
619
+ * (`pageObserveSlot()` from `@walkeros/web-core`) and attaches only when
620
+ * one is present and its binding matches. Purely advisory: nothing on this
621
+ * path can affect event processing.
553
622
  */
554
- observe?: Observe;
623
+ observe?: (ObserveWeb & {
624
+ slot: ObserveSlot;
625
+ }) | ObserveServer;
555
626
  /**
556
627
  * Caller-supplied observers, added verbatim to `collector.observers` by
557
628
  * `startFlow`. Escape hatch for custom emit targets; same advisory
@@ -658,6 +729,11 @@ interface SourceStatus {
658
729
  interface DestinationStatus {
659
730
  count: number;
660
731
  failed: number;
732
+ /**
733
+ * Events deliberately not sent: a consent-denied event under
734
+ * `consentDenied: 'skip'`, or an event a mapping rule `ignore`s.
735
+ */
736
+ skipped?: number;
661
737
  lastAt?: number;
662
738
  duration: number;
663
739
  /** Current size of the destination's queuePush buffer (point-in-time). */
@@ -684,7 +760,7 @@ interface Transformers$1 {
684
760
  interface Stores$1 {
685
761
  [id: string]: Instance$1;
686
762
  }
687
- type CommandType = 'action' | 'config' | 'consent' | 'context' | 'destination' | 'elb' | 'globals' | 'hook' | 'init' | 'link' | 'run' | 'user' | 'walker' | string;
763
+ type CommandType = 'action' | 'config' | 'consent' | 'context' | 'destination' | 'elb' | 'flush' | 'globals' | 'hook' | 'init' | 'link' | 'run' | 'shutdown' | 'user' | 'walker' | string;
688
764
  /**
689
765
  * Options passed to collector.push() from sources.
690
766
  * NOT a Context - just push metadata.
@@ -775,6 +851,12 @@ interface Instance$6 {
775
851
  */
776
852
  observeLevel?: () => 'off' | 'standard' | 'trace';
777
853
  logger: Instance$3;
854
+ /**
855
+ * The collector's one cause log: every failure line goes through it, one
856
+ * line per (step, cause code, status) per minute. Set by `startFlow`;
857
+ * optional only so hand-built test collectors keep compiling.
858
+ */
859
+ causeLog?: CauseLog;
778
860
  on: OnConfig;
779
861
  queue: Events;
780
862
  /**
@@ -1007,6 +1089,66 @@ declare namespace lifecycle {
1007
1089
  export type { lifecycle_DestroyContext as DestroyContext, lifecycle_DestroyFn as DestroyFn, lifecycle_LifecycleContext as LifecycleContext, lifecycle_SetupFn as SetupFn };
1008
1090
  }
1009
1091
 
1092
+ /**
1093
+ * Options of a {@link StepError}: the failure code, and what decides whether
1094
+ * a retry can help (`status`, an explicit `retryable`).
1095
+ */
1096
+ interface StepErrorOptions {
1097
+ code: string;
1098
+ status?: number;
1099
+ retryable?: boolean;
1100
+ /** The response body: kept on the error, never in its message or a log line. */
1101
+ body?: unknown;
1102
+ cause?: unknown;
1103
+ }
1104
+ /** Why a push failed, as a push result and the logs carry it. Never a body. */
1105
+ type FailureReason = {
1106
+ code: string;
1107
+ message: string;
1108
+ retryable: boolean;
1109
+ status?: number;
1110
+ };
1111
+ /** Why an event waits instead of being delivered now. */
1112
+ type QueueReason = 'consent' | 'batch' | 'held';
1113
+ type QueuedReason = {
1114
+ code: QueueReason;
1115
+ message: string;
1116
+ };
1117
+ /**
1118
+ * The error a step throws when it cannot do its work: a missing setting
1119
+ * (`config`), a refused request (`transport` with its `status`), a vendor
1120
+ * that is not there. The collector reads `code` and `retryable` instead of
1121
+ * the message.
1122
+ */
1123
+ declare class StepError extends Error {
1124
+ code: string;
1125
+ status?: number;
1126
+ retryable: boolean;
1127
+ body?: unknown;
1128
+ cause?: unknown;
1129
+ constructor(message: string, options: StepErrorOptions);
1130
+ }
1131
+ /**
1132
+ * Runs one vendor or SDK call, sync or async, and waits for it. A
1133
+ * `StepError` it throws passes through unchanged (the step's own code wins);
1134
+ * anything else becomes a `StepError` with `code` and `message`, the
1135
+ * original kept as `cause` and never in the message, which a vendor can fill
1136
+ * with the values it was sent.
1137
+ */
1138
+ declare function stepCall<T>(call: () => T | PromiseLike<T>, code: string, message: string): Promise<Awaited<T>>;
1139
+ /**
1140
+ * The reason of any thrown value: a `StepError` keeps its code, status and
1141
+ * `retryable`; anything else is a `transport` failure. The message is capped
1142
+ * at 300 characters; the body never leaves the error.
1143
+ */
1144
+ declare function toFailureReason(err: unknown): FailureReason;
1145
+ /**
1146
+ * A network error's message with its cause code (`ECONNREFUSED`, `ENOTFOUND`),
1147
+ * which runtimes keep on `cause` (Node's fetch says only `fetch failed`): the
1148
+ * code only, never the cause's message, which carries addresses and URLs.
1149
+ */
1150
+ declare function networkErrorMessage(error: unknown): string;
1151
+
1010
1152
  /**
1011
1153
  * Package-internal type helpers. Not re-exported from `types/index.ts`.
1012
1154
  */
@@ -1159,9 +1301,20 @@ type Credentials$2<T extends TypesGeneric$3 = Types$4> = T['credentials'];
1159
1301
  * Inference helper: Extract Types from Instance
1160
1302
  */
1161
1303
  type TypesOf$3<I> = I extends Instance$5<infer T> ? T : never;
1304
+ /**
1305
+ * An event waiting in a destination's `queuePush`, with why it waits:
1306
+ * `consent` (its required consent is not granted) or `held` (a state
1307
+ * delivery to the destination is running or failed). An entry seeded from
1308
+ * the collector's replay buffer has no reason yet. The entry object keeps its
1309
+ * identity across drain and requeue; the event inside is copied.
1310
+ */
1311
+ interface Queued {
1312
+ event: Event;
1313
+ reason?: 'consent' | 'held';
1314
+ }
1162
1315
  interface Instance$5<T extends TypesGeneric$3 = Types$4> {
1163
1316
  config: Config$5<T>;
1164
- queuePush?: Events;
1317
+ queuePush?: Queued[];
1165
1318
  queueOn?: Array<{
1166
1319
  type: Types$2;
1167
1320
  data?: unknown;
@@ -1347,7 +1500,7 @@ interface PushBatchContext<T extends TypesGeneric$3 = Types$4> extends Context$5
1347
1500
  ingest: Ingest;
1348
1501
  rule?: Rule<Mapping$1<T>>;
1349
1502
  }
1350
- type InitFn$2<T extends TypesGeneric$3 = Types$4> = (context: Context$5<T>) => PromiseOrValue<void | false | Config$5<T>>;
1503
+ type InitFn$2<T extends TypesGeneric$3 = Types$4> = (context: Context$5<T>) => PromiseOrValue<void | Config$5<T>>;
1351
1504
  type PushFn<T extends TypesGeneric$3 = Types$4> = (event: Event, context: PushContext<T>) => PromiseOrValue<void | unknown>;
1352
1505
  /**
1353
1506
  * Per-row outcome for a single failed batch entry.
@@ -1426,20 +1579,35 @@ interface BatchRegistry<Mapping> {
1426
1579
  batchFn: () => void;
1427
1580
  /**
1428
1581
  * Force a flush of the current batch immediately. Used by shutdown
1429
- * drain and by tests for deterministic flushing without timer
1430
- * advancement. Resolves after the underlying `pushBatch` settles.
1582
+ * drain, `walker flush` and by tests for deterministic flushing without
1583
+ * timer advancement. Resolves after the underlying `pushBatch` settles,
1584
+ * with what that flush did (nothing when the batch was empty).
1431
1585
  */
1432
- flush: () => Promise<void>;
1586
+ flush: () => Promise<BatchFlushOutcome | void>;
1433
1587
  };
1434
1588
  }
1589
+ /**
1590
+ * What one batch flush did: entries delivered and failed, and the reason of
1591
+ * a failure when any entry failed.
1592
+ */
1593
+ interface BatchFlushOutcome {
1594
+ delivered: number;
1595
+ failed: number;
1596
+ reason?: FailureReason;
1597
+ }
1435
1598
  type Data = Property | undefined | Array<Property | undefined>;
1436
1599
  interface Ref {
1437
1600
  type: string;
1438
1601
  data?: unknown;
1439
1602
  error?: unknown;
1603
+ /**
1604
+ * Why the destination did not deliver now: a `FailureReason` under
1605
+ * `failed`, a `QueuedReason` under `queued`.
1606
+ */
1607
+ reason?: FailureReason | QueuedReason;
1440
1608
  }
1441
1609
  type Push$1 = {
1442
- queuePush?: Events;
1610
+ queuePush?: Queued[];
1443
1611
  error?: unknown;
1444
1612
  };
1445
1613
  type DLQ = Array<[Event, unknown]>;
@@ -1466,6 +1634,7 @@ declare function getDestination<T extends TypesGeneric$3 = Types$4>(collector: {
1466
1634
  type destination_Batch<Mapping> = Batch<Mapping>;
1467
1635
  type destination_BatchEntry<Mapping = unknown> = BatchEntry<Mapping>;
1468
1636
  type destination_BatchFailure = BatchFailure;
1637
+ type destination_BatchFlushOutcome = BatchFlushOutcome;
1469
1638
  type destination_BatchOptions = BatchOptions;
1470
1639
  type destination_BatchOutcome = BatchOutcome;
1471
1640
  type destination_BatchRegistry<Mapping> = BatchRegistry<Mapping>;
@@ -1484,10 +1653,11 @@ type destination_PushContext<T extends TypesGeneric$3 = Types$4> = PushContext<T
1484
1653
  type destination_PushEvent<Mapping = unknown> = PushEvent<Mapping>;
1485
1654
  type destination_PushEvents<Mapping = unknown> = PushEvents<Mapping>;
1486
1655
  type destination_PushFn<T extends TypesGeneric$3 = Types$4> = PushFn<T>;
1656
+ type destination_Queued = Queued;
1487
1657
  type destination_Ref = Ref;
1488
1658
  declare const destination_getDestination: typeof getDestination;
1489
1659
  declare namespace destination {
1490
- export { type BaseEnv$3 as BaseEnv, type destination_Batch as Batch, type destination_BatchEntry as BatchEntry, type destination_BatchFailure as BatchFailure, type destination_BatchOptions as BatchOptions, type destination_BatchOutcome as BatchOutcome, type destination_BatchRegistry as BatchRegistry, type destination_BreakerOptions as BreakerOptions, type Code$1 as Code, type Config$5 as Config, type Context$5 as Context, type Credentials$2 as Credentials, type destination_DLQ as DLQ, type destination_Data as Data, type destination_Destinations as Destinations, type Env$3 as Env, type destination_EnvObserve as EnvObserve, type Init$3 as Init, type destination_InitDestinationEntry as InitDestinationEntry, type destination_InitDestinations as InitDestinations, type destination_InitDestinationsOf as InitDestinationsOf, type InitFn$2 as InitFn, type InitSettings$3 as InitSettings, type Instance$5 as Instance, type Mapping$1 as Mapping, type PartialConfig$2 as PartialConfig, type destination_Policy as Policy, type Push$1 as Push, type destination_PushBatchContext as PushBatchContext, type destination_PushBatchFn as PushBatchFn, type destination_PushContext as PushContext, type destination_PushEvent as PushEvent, type destination_PushEvents as PushEvents, type destination_PushFn as PushFn, type destination_Ref as Ref, type Settings$3 as Settings, type SetupOptions$2 as SetupOptions, type Types$4 as Types, type TypesGeneric$3 as TypesGeneric, type TypesOf$3 as TypesOf, destination_getDestination as getDestination };
1660
+ export { type BaseEnv$3 as BaseEnv, type destination_Batch as Batch, type destination_BatchEntry as BatchEntry, type destination_BatchFailure as BatchFailure, type destination_BatchFlushOutcome as BatchFlushOutcome, type destination_BatchOptions as BatchOptions, type destination_BatchOutcome as BatchOutcome, type destination_BatchRegistry as BatchRegistry, type destination_BreakerOptions as BreakerOptions, type Code$1 as Code, type Config$5 as Config, type Context$5 as Context, type Credentials$2 as Credentials, type destination_DLQ as DLQ, type destination_Data as Data, type destination_Destinations as Destinations, type Env$3 as Env, type destination_EnvObserve as EnvObserve, type Init$3 as Init, type destination_InitDestinationEntry as InitDestinationEntry, type destination_InitDestinations as InitDestinations, type destination_InitDestinationsOf as InitDestinationsOf, type InitFn$2 as InitFn, type InitSettings$3 as InitSettings, type Instance$5 as Instance, type Mapping$1 as Mapping, type PartialConfig$2 as PartialConfig, type destination_Policy as Policy, type Push$1 as Push, type destination_PushBatchContext as PushBatchContext, type destination_PushBatchFn as PushBatchFn, type destination_PushContext as PushContext, type destination_PushEvent as PushEvent, type destination_PushEvents as PushEvents, type destination_PushFn as PushFn, type destination_Queued as Queued, type destination_Ref as Ref, type Settings$3 as Settings, type SetupOptions$2 as SetupOptions, type Types$4 as Types, type TypesGeneric$3 as TypesGeneric, type TypesOf$3 as TypesOf, destination_getDestination as getDestination };
1491
1661
  }
1492
1662
 
1493
1663
  interface EventFn<R = Promise<PushResult>> {
@@ -1531,6 +1701,12 @@ interface PushResult {
1531
1701
  invalid?: boolean;
1532
1702
  /** Human-readable failure reason when ok is false. */
1533
1703
  error?: string;
1704
+ /**
1705
+ * Why the push failed when `ok` is false without a `failed` entry: a full
1706
+ * pre-run queue (`queue-full`), a transformer that threw (`transformer`)
1707
+ * or is not ready, a rule `condition` that threw (`mapping`).
1708
+ */
1709
+ reason?: FailureReason;
1534
1710
  }
1535
1711
  type Layer = Array<IArguments | DeepPartialEvent | unknown[]>;
1536
1712
 
@@ -1667,6 +1843,12 @@ interface Config$4<T extends TypesGeneric$2 = Types$3> {
1667
1843
  state?: State | State[];
1668
1844
  init?: boolean;
1669
1845
  disabled?: boolean;
1846
+ /**
1847
+ * Timeout in ms (default 10000) for `init` and for each `push`: one that
1848
+ * does not settle within this window fails the push with code `timeout`;
1849
+ * the next push retries the init.
1850
+ */
1851
+ timeout?: number;
1670
1852
  /** Return this value instead of calling push(). Global mock for all chains. */
1671
1853
  mock?: unknown;
1672
1854
  /** Path-specific mock values keyed by chain path (e.g., "destination.ga4.before"). Takes precedence over global mock. */
@@ -1727,8 +1909,10 @@ interface ChainCopy<E = DeepPartialEvent> {
1727
1909
  * with the ingest it finished with. The next position goes on with each
1728
1910
  * pair.
1729
1911
  *
1730
- * - dropped (a transformer returned `false` or threw): `copies` empty,
1731
- * `droppedBy` names the transformer.
1912
+ * - dropped (a transformer returned `false`): `copies` empty, `droppedBy`
1913
+ * names the transformer.
1914
+ * - failed (a transformer threw, or its `init` threw or returned `false`):
1915
+ * `failure` names it and carries the reason; not a drop.
1732
1916
  * - route `stop`: `copies` empty, `stopped: true`; `droppedBy` names the
1733
1917
  * transformer whose route stopped it, absent for the start route.
1734
1918
  * - `cache.stop: true` HIT: `copies` holds the cached copy, `stopped: true`.
@@ -1741,6 +1925,17 @@ interface ChainResult {
1741
1925
  stopped?: true;
1742
1926
  /** Transformer that dropped or stopped the chain. */
1743
1927
  droppedBy?: string;
1928
+ /**
1929
+ * A transformer that threw or could not start: the failed copy ends (not
1930
+ * a drop), and the position answers `ok: false` with this reason. Other
1931
+ * copies of a fork still go on in `copies`.
1932
+ */
1933
+ failure?: ChainFailure;
1934
+ }
1935
+ /** A transformer in a chain that failed: its id and why. */
1936
+ interface ChainFailure {
1937
+ by: string;
1938
+ reason: FailureReason;
1744
1939
  }
1745
1940
  /**
1746
1941
  * The main transformer function.
@@ -1762,10 +1957,10 @@ type Fn$2<T extends TypesGeneric$2 = Types$3, E = DeepPartialEvent> = (event: E,
1762
1957
  *
1763
1958
  * @param context - Transformer context
1764
1959
  * @returns void - initialization successful
1765
- * @returns false - initialization failed, skip this transformer
1960
+ * @throws StepError - initialization failed; the push fails
1766
1961
  * @returns Config<T> - return updated config
1767
1962
  */
1768
- type InitFn$1<T extends TypesGeneric$2 = Types$3> = (context: Context$4<T>) => PromiseOrValue<void | false | Config$4<T>>;
1963
+ type InitFn$1<T extends TypesGeneric$2 = Types$3> = (context: Context$4<T>) => PromiseOrValue<void | Config$4<T>>;
1769
1964
  /**
1770
1965
  * Transformer instance returned by Init function.
1771
1966
  */
@@ -1847,6 +2042,7 @@ declare function getTransformer<T extends TypesGeneric$2 = Types$3>(collector: {
1847
2042
  }, id: string): Instance$4<T>;
1848
2043
 
1849
2044
  type transformer_ChainCopy<E = DeepPartialEvent> = ChainCopy<E>;
2045
+ type transformer_ChainFailure = ChainFailure;
1850
2046
  type transformer_ChainResult = ChainResult;
1851
2047
  type transformer_InitTransformer<T extends TypesGeneric$2 = Types$3> = InitTransformer<T>;
1852
2048
  type transformer_InitTransformerEntry<T extends TypesGeneric$2> = InitTransformerEntry<T>;
@@ -1862,7 +2058,7 @@ type transformer_RouteStopConfig = RouteStopConfig;
1862
2058
  type transformer_Transformers = Transformers;
1863
2059
  declare const transformer_getTransformer: typeof getTransformer;
1864
2060
  declare namespace transformer {
1865
- 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_InitTransformerEntry as InitTransformerEntry, type transformer_InitTransformers as InitTransformers, type transformer_InitTransformersOf as InitTransformersOf, 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 };
2061
+ export { type BaseEnv$2 as BaseEnv, type transformer_ChainCopy as ChainCopy, type transformer_ChainFailure as ChainFailure, 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_InitTransformerEntry as InitTransformerEntry, type transformer_InitTransformers as InitTransformers, type transformer_InitTransformersOf as InitTransformersOf, 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 };
1866
2062
  }
1867
2063
 
1868
2064
  /**
@@ -2213,6 +2409,12 @@ declare namespace Flow {
2213
2409
  type?: string;
2214
2410
  /** Optional "$code:..." init function. */
2215
2411
  init?: string;
2412
+ /** Optional "$code:..." batch push function (destinations). */
2413
+ pushBatch?: string;
2414
+ /** Optional "$code:..." event handler (`on('consent')` and others). */
2415
+ on?: string;
2416
+ /** Optional "$code:..." destroy function. */
2417
+ destroy?: string;
2216
2418
  }
2217
2419
  /**
2218
2420
  * Source reference with inline package syntax.
@@ -2236,7 +2438,7 @@ declare namespace Flow {
2236
2438
  /**
2237
2439
  * Inline code definition (object form only).
2238
2440
  *
2239
- * Object: `{push, type?, init?}` for inline code definition.
2441
+ * Object: `{push, type?, init?, pushBatch?, on?, destroy?}` for inline code definition.
2240
2442
  * For named-export selection from a package, use the `import` field with `package`.
2241
2443
  */
2242
2444
  code?: Code;
@@ -2319,7 +2521,7 @@ declare namespace Flow {
2319
2521
  /**
2320
2522
  * Inline code definition (object form only).
2321
2523
  *
2322
- * Object: `{push, type?, init?}` for inline code definition.
2524
+ * Object: `{push, type?, init?, pushBatch?, on?, destroy?}` for inline code definition.
2323
2525
  * For named-export selection from a package, use the `import` field with `package`.
2324
2526
  */
2325
2527
  code?: Code;
@@ -2383,7 +2585,7 @@ declare namespace Flow {
2383
2585
  /**
2384
2586
  * Inline code definition (object form only).
2385
2587
  *
2386
- * Object: `{push, type?, init?}` for inline code definition.
2588
+ * Object: `{push, type?, init?, pushBatch?, on?, destroy?}` for inline code definition.
2387
2589
  * For named-export selection from a package, use the `import` field with `package`.
2388
2590
  */
2389
2591
  code?: Code;
@@ -2452,7 +2654,7 @@ declare namespace Flow {
2452
2654
  /**
2453
2655
  * Inline code definition (object form only).
2454
2656
  *
2455
- * Object: `{push, type?, init?}` for inline code definition.
2657
+ * Object: `{push, type?, init?, pushBatch?, on?, destroy?}` for inline code definition.
2456
2658
  * For named-export selection from a package, use the `import` field with `package`.
2457
2659
  */
2458
2660
  code?: Code;
@@ -2572,6 +2774,43 @@ declare namespace Flow {
2572
2774
  type StepEffect = readonly [callable: string, ...args: unknown[]];
2573
2775
  /** The effects a step produces, in execution order. Empty = no observable effect (filtered, passthrough). */
2574
2776
  type StepOut = readonly StepEffect[];
2777
+ /** How a kit boundary answers one request. */
2778
+ interface StepAnswer {
2779
+ status?: number;
2780
+ body?: unknown;
2781
+ /** The status text, which failure answers use to echo a canary. */
2782
+ statusText?: string;
2783
+ /** A network error, or no answer at all. */
2784
+ error?: 'network' | 'timeout';
2785
+ /** Answer one macrotask late (the floating-send check). */
2786
+ late?: boolean;
2787
+ }
2788
+ /** Records one request at the kit boundary; returns its answer and marks it settled. */
2789
+ type StepRecord = (effect: StepEffect) => {
2790
+ answer: StepAnswer;
2791
+ settle: () => void;
2792
+ };
2793
+ /**
2794
+ * The browser page a web step runs on in the conformance kit and the
2795
+ * examples runner. `@walkeros/web-core/dev` implements it as `page`.
2796
+ */
2797
+ interface StepPage {
2798
+ open(record: StepRecord): StepPageSession;
2799
+ }
2800
+ /** One run on the page, from `open` to `close`. */
2801
+ interface StepPageSession {
2802
+ /** Page globals merged over an examples env's `push` (the document). */
2803
+ globals: Record<string, unknown>;
2804
+ /** Scripts added since `open`, with and without the loadVendor marker. */
2805
+ scripts(): {
2806
+ marked: number;
2807
+ unmarked: number;
2808
+ };
2809
+ /** Fire `error` on every marked script (kit item 2, vendor-global). */
2810
+ failScripts(): void;
2811
+ /** Restore the stubs and remove the scripts added since `open`. */
2812
+ close(): void;
2813
+ }
2575
2814
  /**
2576
2815
  * Named example pair for a step.
2577
2816
  * `in` is the input to the step, `out` is the expected output.
@@ -2608,6 +2847,29 @@ declare namespace Flow {
2608
2847
  * When absent (default), `in` is pushed as a regular event.
2609
2848
  */
2610
2849
  command?: StepCommand;
2850
+ /**
2851
+ * The reported outcome of a failure or queue example (`public: false`):
2852
+ * the step's status in the push result and its reason code. Absent means
2853
+ * the step must not fail.
2854
+ */
2855
+ outcome?: StepOutcome;
2856
+ /** What the boundary answers for this example (a failure fixture). */
2857
+ respond?: StepRespond;
2858
+ }
2859
+ /** How a failure or queue example is reported in the push result. */
2860
+ interface StepOutcome {
2861
+ status: 'failed' | 'queued';
2862
+ code: string;
2863
+ retryable?: boolean;
2864
+ }
2865
+ /**
2866
+ * The boundary's answer to the request an example makes: an HTTP status and
2867
+ * body, or a network error or a timeout instead of a response.
2868
+ */
2869
+ interface StepRespond {
2870
+ status?: number;
2871
+ body?: unknown;
2872
+ error?: 'network' | 'timeout';
2611
2873
  }
2612
2874
  /** Named step examples keyed by scenario name. */
2613
2875
  type StepExamples = Record<string, StepExample>;
@@ -2661,8 +2923,8 @@ interface LogContext {
2661
2923
  */
2662
2924
  type LogFn = (message: string | Error, context?: unknown | Error) => void;
2663
2925
  /**
2664
- * Throw function signature - logs error then throws
2665
- * Returns never as it always throws
2926
+ * Throw function signature: throws an Error with the message, never logs
2927
+ * (the catching collector logs the failure once). Returns never.
2666
2928
  */
2667
2929
  type ThrowFn = (message: string | Error, context?: unknown) => never;
2668
2930
  /**
@@ -2696,8 +2958,8 @@ interface Instance$3 {
2696
2958
  */
2697
2959
  debug: LogFn;
2698
2960
  /**
2699
- * Log an error message and throw an Error
2700
- * Combines logging and throwing in one call
2961
+ * Throw an Error with the message. Does not log: the collector's catch
2962
+ * writes the one line for the failure.
2701
2963
  */
2702
2964
  throw: ThrowFn;
2703
2965
  /**
@@ -2711,6 +2973,12 @@ interface Instance$3 {
2711
2973
  */
2712
2974
  scope: (name: string) => Instance$3;
2713
2975
  }
2976
+ /**
2977
+ * Output format of a server terminal logger: one text line per call, or one
2978
+ * JSON object per line (`severity`, `message`, `scope`, `context`, `time`),
2979
+ * which Cloud Run, Loki and Datadog read as structured entries.
2980
+ */
2981
+ type Format = 'text' | 'json';
2714
2982
  /**
2715
2983
  * Logger configuration options
2716
2984
  */
@@ -2720,6 +2988,13 @@ interface Config$3 {
2720
2988
  * @default Level.ERROR
2721
2989
  */
2722
2990
  level?: Level | keyof typeof Level;
2991
+ /**
2992
+ * Output format of a server flow's log lines (`@walkeros/core/node`'s
2993
+ * terminal logger, used by `runneros`). Web flows log to the browser
2994
+ * console and reject it.
2995
+ * @default 'text'
2996
+ */
2997
+ format?: Format;
2723
2998
  /**
2724
2999
  * Custom log handler function
2725
3000
  * Receives originalHandler to preserve default behavior
@@ -2745,6 +3020,7 @@ type Factory = (config?: Config$3) => Instance$3;
2745
3020
  type logger_DefaultHandler = DefaultHandler;
2746
3021
  type logger_ErrorContext = ErrorContext;
2747
3022
  type logger_Factory = Factory;
3023
+ type logger_Format = Format;
2748
3024
  type logger_Handler = Handler;
2749
3025
  type logger_InternalConfig = InternalConfig;
2750
3026
  type logger_Level = Level;
@@ -2753,7 +3029,7 @@ type logger_LogContext = LogContext;
2753
3029
  type logger_LogFn = LogFn;
2754
3030
  type logger_ThrowFn = ThrowFn;
2755
3031
  declare namespace logger {
2756
- export { type Config$3 as Config, type logger_DefaultHandler as DefaultHandler, type logger_ErrorContext as ErrorContext, type logger_Factory as Factory, type logger_Handler as Handler, type Instance$3 as Instance, type logger_InternalConfig as InternalConfig, logger_Level as Level, type logger_LogContext as LogContext, type logger_LogFn as LogFn, type logger_ThrowFn as ThrowFn };
3032
+ export { type Config$3 as Config, type logger_DefaultHandler as DefaultHandler, type logger_ErrorContext as ErrorContext, type logger_Factory as Factory, type logger_Format as Format, type logger_Handler as Handler, type Instance$3 as Instance, type logger_InternalConfig as InternalConfig, logger_Level as Level, type logger_LogContext as LogContext, type logger_LogFn as LogFn, type logger_ThrowFn as ThrowFn };
2757
3033
  }
2758
3034
 
2759
3035
  /** Collector state mapping for the `on` actions. */
@@ -3269,7 +3545,7 @@ interface Instance$1<T extends TypesGeneric = Types> {
3269
3545
  destroy?: DestroyFn<Config<T>, Env<T>>;
3270
3546
  }
3271
3547
  type Init<T extends TypesGeneric = Types> = (context: Context<Types<Partial<Settings<T>>, Env<T>, InitSettings<T>>>) => Instance$1<T> | Promise<Instance$1<T>>;
3272
- type InitFn<T extends TypesGeneric = Types> = (context: Context<T>) => PromiseOrValue<void | false | Config<T>>;
3548
+ type InitFn<T extends TypesGeneric = Types> = (context: Context<T>) => PromiseOrValue<void | Config<T>>;
3273
3549
  type InitStore<T extends TypesGeneric = Types> = {
3274
3550
  code: Init<T>;
3275
3551
  config?: Partial<Config<T>>;
@@ -3698,10 +3974,13 @@ type SendDataValue = Property | Properties;
3698
3974
  type SendHeaders = {
3699
3975
  [key: string]: string;
3700
3976
  };
3977
+ /**
3978
+ * What a transport helper (`sendWeb`, `sendServer`) resolves on success: the
3979
+ * response body, parsed as JSON where it parses. A failure throws a
3980
+ * `StepError` (code, status, retryable, body) instead.
3981
+ */
3701
3982
  interface SendResponse {
3702
- ok: boolean;
3703
3983
  data?: unknown;
3704
- error?: string;
3705
3984
  }
3706
3985
 
3707
3986
  /**
@@ -3822,12 +4101,9 @@ interface JourneyBranch {
3822
4101
  /** Wall-clock duration of the branch, when measured. */
3823
4102
  durationMs?: number;
3824
4103
  /** Skip discriminator when the branch was skipped. */
3825
- skipReason?: 'consent' | 'cache_hit' | 'sampled_out' | 'disabled' | 'dropped' | 'unknown';
4104
+ skipReason?: FlowState['skipReason'];
3826
4105
  /** Error info when the branch failed. */
3827
- error?: {
3828
- name?: string;
3829
- message: string;
3830
- };
4106
+ error?: FlowState['error'];
3831
4107
  /** Outbound payload of the branch, when captured. */
3832
4108
  out?: unknown;
3833
4109
  /** Vendor calls recorded on the branch's out record, when captured. */
@@ -3864,12 +4140,9 @@ interface JourneyHop {
3864
4140
  /** Outbound event/payload for the hop, when captured (trace level). */
3865
4141
  out?: unknown;
3866
4142
  /** Error info when the hop's terminal phase is error. */
3867
- error?: {
3868
- name?: string;
3869
- message: string;
3870
- };
4143
+ error?: FlowState['error'];
3871
4144
  /** Skip discriminator when the hop's terminal phase is skip. */
3872
- skipReason?: 'consent' | 'cache_hit' | 'sampled_out' | 'disabled' | 'dropped' | 'unknown';
4145
+ skipReason?: FlowState['skipReason'];
3873
4146
  /** Matched mapping rule, when one matched. */
3874
4147
  mappingKey?: string;
3875
4148
  /** Matched contract rule, when one matched. */
@@ -4045,11 +4318,11 @@ declare const SECRET_MARKER_PREFIX = "__WALKEROS_SECRET:";
4045
4318
  interface ResolveOptions {
4046
4319
  deferred?: boolean;
4047
4320
  /**
4048
- * The only source for non-deferred `$env` references. When set, `$env.NAME`
4049
- * reads this map (then the inline `:default`) and never `process.env`.
4050
- * Build tooling passes it so a web bundle cannot pick up whatever happens
4051
- * to be in the building process's environment. When omitted, `process.env`
4052
- * is used.
4321
+ * The only source for non-deferred `$env` references: `$env.NAME` reads
4322
+ * this map, then the inline `:default`, and never the ambient environment
4323
+ * (`process.env`). Without it, a non-deferred `$env.NAME` takes its default
4324
+ * or throws `FlowReferenceError`. A runtime that means its own environment
4325
+ * passes it explicitly (`{ env: process.env }`).
4053
4326
  */
4054
4327
  env?: Readonly<Record<string, string | undefined>>;
4055
4328
  /**
@@ -4264,6 +4537,11 @@ declare function createDestination<I extends Instance$5>(baseDestination: I, con
4264
4537
  */
4265
4538
  declare function deepMerge<T extends Record<string, unknown>>(target: T, source: Record<string, unknown>): T;
4266
4539
 
4540
+ /**
4541
+ * Names `getEvent` knows: the standard events plus the generic default
4542
+ * `entity action`. Any other name does not compile.
4543
+ */
4544
+ type StandardEventName = 'entity action' | 'cart view' | 'checkout view' | 'order complete' | 'page view' | 'product add' | 'product view' | 'product visible' | 'promotion visible' | 'session start';
4267
4545
  /**
4268
4546
  * Creates a complete event with default values.
4269
4547
  * Used for testing and debugging.
@@ -4277,14 +4555,18 @@ declare function deepMerge<T extends Record<string, unknown>>(target: T, source:
4277
4555
  */
4278
4556
  declare function createEvent(props?: DeepPartialEvent): Event;
4279
4557
  /**
4280
- * Creates a complete event with default values based on the event name.
4558
+ * Creates a complete standard event with default values based on its name.
4281
4559
  * Used for testing and debugging.
4282
4560
  *
4283
- * @param name - The name of the event to create.
4561
+ * The output is stable: the timestamp is fixed and the id is derived from the
4562
+ * name (16 lowercase hex characters), so the same name gives the same event on
4563
+ * every call, run and day. Events with other names use `createEvent`.
4564
+ *
4565
+ * @param name - The standard event to create.
4284
4566
  * @param props - Properties to override the default values.
4285
4567
  * @returns A complete event.
4286
4568
  */
4287
- declare function getEvent(name?: string, props?: DeepPartialEvent): Event;
4569
+ declare function getEvent(name?: StandardEventName, props?: DeepPartialEvent): Event;
4288
4570
 
4289
4571
  declare function getId(length?: number, charset?: string): string;
4290
4572
 
@@ -4446,13 +4728,6 @@ declare function isCommand(entity: string): entity is "walker";
4446
4728
  * @returns True if the value is defined, false otherwise.
4447
4729
  */
4448
4730
  declare function isDefined<T>(val: T | undefined): val is T;
4449
- /**
4450
- * Checks if a value is an element or the document.
4451
- *
4452
- * @param elem The value to check.
4453
- * @returns True if the value is an element or the document, false otherwise.
4454
- */
4455
- declare function isElementOrDocument(elem: unknown): elem is Element;
4456
4731
  /**
4457
4732
  * Checks if a value is a function.
4458
4733
  *
@@ -4832,7 +5107,10 @@ declare function tryCatchAsync<P extends unknown[], R>(fn: (...args: P) => R, on
4832
5107
  * violations or explicit fail-stop signals.
4833
5108
  */
4834
5109
  declare class FatalError extends Error {
4835
- constructor(message: string, options?: ErrorOptions);
5110
+ cause?: unknown;
5111
+ constructor(message: string, options?: {
5112
+ cause?: unknown;
5113
+ });
4836
5114
  }
4837
5115
 
4838
5116
  /**
@@ -4846,6 +5124,21 @@ declare class InvalidEventError extends Error {
4846
5124
  constructor(message: string);
4847
5125
  }
4848
5126
 
5127
+ /**
5128
+ * Default per-destination delivery timeout in ms. Applied when a destination's
5129
+ * `config.timeout` is `0` or undefined. A hung delivery is converted into a
5130
+ * counted DLQ failure after this window so one slow destination never wedges
5131
+ * the collector push.
5132
+ */
5133
+ declare const DEFAULT_DESTINATION_TIMEOUT_MS = 10000;
5134
+ /**
5135
+ * Resolve the effective delivery timeout for a destination. A positive number
5136
+ * wins; `0` or undefined falls back to {@link DEFAULT_DESTINATION_TIMEOUT_MS}.
5137
+ * The collector races deliveries with it and `loadVendor` measures its vendor
5138
+ * deadline with it, so both use one definition.
5139
+ */
5140
+ declare function resolveDestinationTimeout(timeout?: number): number;
5141
+
4849
5142
  /**
4850
5143
  * A utility function that wraps a function with hooks.
4851
5144
  *
@@ -5071,7 +5364,7 @@ type VerifyParams = VerifyAudience & {
5071
5364
  source: 'url' | 'storage';
5072
5365
  /** Epoch milliseconds. Injected so tests and the server control the clock. */
5073
5366
  now: number;
5074
- /** Defaults to globalThis.crypto. Injectable for jsdom/node tests. */
5367
+ /** Defaults to the global crypto. Injectable for jsdom/node tests. */
5075
5368
  crypto?: PreviewCrypto;
5076
5369
  };
5077
5370
  /** A grant handed over in a URL is only accepted this long after `iat`. */
@@ -5101,29 +5394,6 @@ declare const MAX_SESSION_MS: number;
5101
5394
  * only ever decides which rejection reason comes back.
5102
5395
  */
5103
5396
  declare function verifyActivation(raw: string, params: VerifyParams): Promise<VerifyResult>;
5104
- interface SwapActivatorConfig {
5105
- keyring: PreviewKey[];
5106
- iss: string;
5107
- /** This bundle's project binding. Absent on demo hosts (see acceptForeign). */
5108
- pb?: string;
5109
- acceptForeign?: boolean;
5110
- demoAllowlist?: string[];
5111
- /** Bare CDN hostname, e.g. 'cdn.walkeros.io'. */
5112
- previewOrigin: string;
5113
- /** Injectable for tests. */
5114
- now?: () => number;
5115
- crypto?: PreviewCrypto;
5116
- }
5117
- /**
5118
- * Storage slot for the session-forwarding companion grant. The web arm never
5119
- * verifies it (it is session-bound by design; the session container is its
5120
- * verifier) — the activator only ferries it from the activation URL into
5121
- * storage, where the seamed preview artifact reads it to stamp the
5122
- * `X-Walkeros-Preview` header. It lives and dies with the activation state:
5123
- * set (or cleared) whenever a URL activation succeeds, cleared whenever the
5124
- * stored activation clears.
5125
- */
5126
- declare const SESSION_STORAGE_KEY = "elbPreviewSession";
5127
5397
  /**
5128
5398
  * Storage slot for the observe ingest credential companion (`obsw_...`), a
5129
5399
  * plaintext bearer credential riding the activation URL. The web arm never
@@ -5134,18 +5404,6 @@ declare const SESSION_STORAGE_KEY = "elbPreviewSession";
5134
5404
  * stored activation clears.
5135
5405
  */
5136
5406
  declare const OBSERVE_STORAGE_KEY = "elbObserve";
5137
- /**
5138
- * Decide whether a preview bundle should boot in place of this bundle's own flow.
5139
- *
5140
- * Returns true iff a preview took over, in which case the caller must not boot
5141
- * the production flow. Every failure path deterministically returns false: the
5142
- * loader never throws, never retries, and never leaves a page without a walker.
5143
- *
5144
- * Anti-griefing invariant: a rejected URL grant never touches stored state,
5145
- * the activator falls back to the stored grant instead. Only a failing stored
5146
- * grant clears storage (self-heal), plus `off` and `swap-failed`.
5147
- */
5148
- declare function browserSwapActivator(cfg: SwapActivatorConfig): Promise<boolean>;
5149
5407
 
5150
5408
  /** Where a Tag Mode script comes from and whose message may request it. */
5151
5409
  interface MoinTarget {
@@ -5157,14 +5415,6 @@ interface MoinTarget {
5157
5415
  /** The link parameter that arms the loader; its value is ignored. */
5158
5416
  declare const MOIN_PARAM = "elbMoin";
5159
5417
  declare const MOIN_PRODUCTION: MoinTarget;
5160
- /**
5161
- * The Tag Mode loader. Armed only by `?elbMoin` or the tab flag it leaves in
5162
- * sessionStorage, and only in the top frame; it then waits for one message
5163
- * from `target.app` naming a script by its hash, and loads that script from
5164
- * `target.base` with the same hash as its integrity. Not armed, it adds no
5165
- * listener, makes no request and writes nothing.
5166
- */
5167
- declare function moin(target?: MoinTarget): void;
5168
5418
 
5169
5419
  /**
5170
5420
  * Pure assembly of raw `FlowState` records into cross-runtime journeys, one per
@@ -5488,6 +5738,15 @@ declare function fetchPackageSchema(packageName: string, options?: {
5488
5738
  client?: string;
5489
5739
  }): Promise<WalkerOSPackageInfo>;
5490
5740
 
5741
+ /**
5742
+ * The keys a named contract rule may carry, one list for the flow schema and
5743
+ * validate; `config-drift.test-d.ts` fails the build when it and
5744
+ * `Flow.ContractRule` drift apart. Sections such as `globals` or `consent`
5745
+ * are not among them: nothing enforces them, so a rule on those event parts
5746
+ * goes into `schema`. A plain literal, so a bundle that does not use it drops
5747
+ * it.
5748
+ */
5749
+ declare const CONTRACT_RULE_KEYS: readonly ["extend", "tagging", "description", "events", "schema"];
5491
5750
  /** Options for {@link resolveContracts}. */
5492
5751
  interface ResolveContractsOptions {
5493
5752
  /**
@@ -5715,14 +5974,27 @@ declare function toEventList(body: unknown): DeepPartialEvent[];
5715
5974
  */
5716
5975
  declare function isBatchBody(body: unknown): boolean;
5717
5976
  /**
5718
- * The outcome of delivering one event of a batch.
5977
+ * The answer text when a resend could still deliver the event. The step and
5978
+ * its error stay in the collector's cause line.
5979
+ */
5980
+ declare const EVENT_NOT_PROCESSED = "Event was not processed";
5981
+ /**
5982
+ * The answer text of a fault that threw, the push included. Its message can
5983
+ * carry paths, dependency names or config details, so it goes to the log only.
5984
+ */
5985
+ declare const INTERNAL_SERVER_ERROR = "Internal server error";
5986
+ /**
5987
+ * The outcome of delivering one event, as a producer is answered.
5719
5988
  *
5720
5989
  * `id` is present when the event was accepted and minted one. `error` is
5721
- * present when it was not accepted.
5990
+ * present when it was not accepted, with the HTTP `status` a single event is
5991
+ * answered with: 400 for invalid input, 500 when a resend could still
5992
+ * deliver it. A batch answers through `batchResponse`.
5722
5993
  */
5723
5994
  interface EventOutcome {
5724
5995
  id?: string;
5725
5996
  error?: string;
5997
+ status?: 400 | 500;
5726
5998
  }
5727
5999
  /** A batch response: the status to answer with, and the body to send. */
5728
6000
  interface BatchResponse {
@@ -5751,19 +6023,33 @@ interface BatchResponse {
5751
6023
  */
5752
6024
  declare function batchResponse(outcomes: EventOutcome[]): BatchResponse;
5753
6025
  /**
5754
- * Maps a collector push result onto a batch event outcome.
6026
+ * Maps a push result onto the outcome a producer is answered with, the one
6027
+ * place an HTTP source decides it (`acknowledge`):
6028
+ * - `ack`: accepted, with the event id. This includes a failure a resend
6029
+ * cannot fix: the event is in the DLQ and its cause line is logged.
6030
+ * - `retry`: 500 with a fixed text. The step and its error stay in the
6031
+ * collector's cause line; a public client cannot act on them.
6032
+ * - `reject`: 400 with the reason, which describes the producer's own input.
5755
6033
  *
5756
- * @param result The push result, or undefined when the push returned none.
6034
+ * @param result The push result.
5757
6035
  * @returns The outcome for this event.
5758
6036
  */
5759
- declare function pushResultToOutcome(result: {
5760
- ok?: boolean;
5761
- invalid?: boolean;
5762
- error?: string;
5763
- event?: {
5764
- id?: string;
5765
- };
5766
- }): EventOutcome;
6037
+ declare function pushResultToOutcome(result: PushResult): EventOutcome;
6038
+ /** What a producer does with the message that carried a push. */
6039
+ type Acknowledgement = 'ack' | 'retry' | 'reject';
6040
+ /**
6041
+ * Decides from a push result whether a producer acks, retries or rejects the
6042
+ * message that carried it: invalid input is `reject`, a delivered or queued
6043
+ * event `ack`. A failure is `retry` when any of its reasons is retryable and
6044
+ * `ack` when every reason is deterministic (a redelivery cannot fix a missing
6045
+ * setting or a 4xx; the event is in the DLQ and its cause line is logged). A
6046
+ * failure without any reason is `retry`, so an unclassified failure never
6047
+ * deletes a message. Only `retryable` is read, never an error text.
6048
+ *
6049
+ * @param result The push result.
6050
+ * @returns `ack`, `retry` or `reject`.
6051
+ */
6052
+ declare function acknowledge(result: PushResult): Acknowledgement;
5767
6053
 
5768
6054
  /**
5769
6055
  * Compiles a match expression into a closure for fast runtime evaluation.
@@ -6020,7 +6306,13 @@ interface CacheResult {
6020
6306
  */
6021
6307
  declare function createMappingRoot(ingest?: Record<string, unknown>, event?: DeepPartialEvent): Root;
6022
6308
  declare function compileCache(cache: Cache<EventCacheRule>): CompiledCache;
6023
- declare function checkCache(compiled: CompiledCache, store: Instance$1, context: Record<string, unknown>, namespace?: string): Promise<CacheResult | null>;
6309
+ /**
6310
+ * Look a cache rule's key up in its store. A read that throws (a refused or
6311
+ * failed request, not a miss) is a MISS for that event, reported once per
6312
+ * cause under the store's step through the collector's cause log. Without a
6313
+ * collector there is nowhere to report, and the throw propagates.
6314
+ */
6315
+ declare function checkCache(compiled: CompiledCache, store: Instance$1, context: Record<string, unknown>, namespace?: string, collector?: Instance$6): Promise<CacheResult | null>;
6024
6316
  declare function storeCache(store: Instance$1, key: string, value: unknown, ttlSeconds: number): void;
6025
6317
  declare function applyUpdate(value: unknown, update: Record<string, unknown> | undefined, context: Record<string, unknown>, collector: Instance$6): Promise<unknown>;
6026
6318
 
@@ -6072,16 +6364,6 @@ declare function readCacheEnvelope(stored: StoreValue | undefined, now?: () => n
6072
6364
  expired: true;
6073
6365
  } | undefined;
6074
6366
 
6075
- /**
6076
- * Thrown when a value cannot be serialized (e.g. a cyclic structure that
6077
- * `JSON.stringify` rejects). Catchable and distinguishable from a raw
6078
- * `TypeError` leaking out of the platform JSON implementation.
6079
- */
6080
- declare class StoreCodecError extends Error {
6081
- constructor(message: string, options?: {
6082
- cause?: unknown;
6083
- });
6084
- }
6085
6367
  /**
6086
6368
  * Recursive type guard: the restored value is structurally a `StoreValue`.
6087
6369
  * The single restore walk (`fromSerializableWith`) is JSON-derived plus
@@ -6096,15 +6378,6 @@ declare class StoreCodecError extends Error {
6096
6378
  * `undefined`; this only mirrors what survives serialization.
6097
6379
  */
6098
6380
  declare function isStoreValue(value: unknown): value is StoreValue;
6099
- /**
6100
- * Serialize a `StoreValue` to its UTF-8 JSON byte payload. Throws
6101
- * `StoreCodecError` if the value cannot be encoded (e.g. a cyclic structure).
6102
- */
6103
- declare function serializeStoreValue(value: StoreValue): Uint8Array;
6104
- /**
6105
- * Restore a `StoreValue` from its UTF-8 JSON byte payload (or a JSON string).
6106
- */
6107
- declare function deserializeStoreValue(raw: Uint8Array | string): StoreValue;
6108
6381
 
6109
6382
  /**
6110
6383
  * Resolve a store by id. An `undefined` id falls back to the default
@@ -6135,8 +6408,11 @@ declare function compileState(state: State | State[]): State[];
6135
6408
  * Each entry is fail-open: a store or resolution error is logged and the
6136
6409
  * event is left unmutated, the chain continues. An unknown store logs an
6137
6410
  * error and a `file: true` store is skipped with a warning. A key that does
6138
- * not resolve warns; a store miss is silent. Only `FatalError` rethrows (via
6139
- * `getMappingValue`).
6411
+ * not resolve is reported at ERROR (the enrichment is lost); a store miss is
6412
+ * silent. A read that throws is a miss for that event (a `get` applies its
6413
+ * fallbacks) and is reported once per cause; a merge whose read throws skips
6414
+ * its write, since a blind overwrite would drop the stored fields. Only
6415
+ * `FatalError` rethrows (via `getMappingValue`).
6140
6416
  */
6141
6417
  declare function applyState<E extends DeepPartialEvent>(states: State[], getStore: GetStore, event: E, collector: Instance$6, ingest: Record<string, unknown> | undefined): Promise<E>;
6142
6418
 
@@ -6212,6 +6488,14 @@ declare function getStepRuntimeProps(step: object, kind: Flow.StepKind): Record<
6212
6488
  declare const STEP_OPERATIVE_FIELDS: {
6213
6489
  readonly [K in Flow.StepKind]: readonly StepField<K>[];
6214
6490
  };
6491
+ type StepFunctionKey = Exclude<keyof Flow.Code, 'type'>;
6492
+ /**
6493
+ * The functions inline `code` defines, each a `$code:` string. One list for
6494
+ * `Flow.Code`, the flow schema's `CodeSchema`, the bundler's emitter and
6495
+ * validate. `config-drift.test-d.ts` fails the build when it and `Flow.Code`
6496
+ * drift apart. A plain literal, so a bundle that does not use it drops it.
6497
+ */
6498
+ declare const STEP_FUNCTION_KEYS: readonly ["push", "pushBatch", "init", "on", "destroy"];
6215
6499
  type StepEntryErrorCode = 'UNKNOWN_KEY' | 'CONFLICT' | 'MISSING_PACKAGE' | 'OBSOLETE_CODE_STRING' | 'INVALID_IMPORT' | 'INVALID_CODE_SHAPE';
6216
6500
  interface StepEntryValidation {
6217
6501
  ok: boolean;
@@ -6220,6 +6504,11 @@ interface StepEntryValidation {
6220
6504
  key?: string;
6221
6505
  }
6222
6506
  declare function validateStepEntry(entry: Record<string, unknown>, kind: Flow.StepKind): StepEntryValidation;
6507
+ /**
6508
+ * Every top-level key of a step entry the runtime does not know, in entry
6509
+ * order: the keys {@link validateStepEntry} rejects as `UNKNOWN_KEY`.
6510
+ */
6511
+ declare function getUnknownStepKeys(entry: Record<string, unknown>, kind: Flow.StepKind): string[];
6223
6512
  declare function isPathStepEntry(entry: Record<string, unknown>, kind: Flow.StepKind): boolean;
6224
6513
 
6225
6514
  /**
@@ -6251,6 +6540,39 @@ declare function getTransformerMapping<M>(entry: TransformerMappingEntry<M>): M
6251
6540
  */
6252
6541
  declare function getTransformerMappingWarnings(entry: TransformerMappingEntry): string[];
6253
6542
 
6543
+ /** A position a mapping runs at. */
6544
+ type MappingPosition = 'source' | 'transformer' | 'destination';
6545
+ /**
6546
+ * Mapping fields that do nothing at a position, one table for the three.
6547
+ * - transformer: the mapping only mutates the event; config `policy` and a
6548
+ * rule's `condition`, `policy`, `name` and `ignore` apply.
6549
+ * - source: only the edited event goes on; config `consent`, `policy` and a
6550
+ * rule's `condition`, `policy`, `name` and `ignore` apply. A rule's
6551
+ * `consent` is not listed here.
6552
+ * - destination: a rule's `extend` is merged only by a package onto its own
6553
+ * shipped rules (`@walkeros/transformer-ga4`'s `settings.mapping`).
6554
+ */
6555
+ declare const MAPPING_NO_OPS: Record<MappingPosition, {
6556
+ config: ReadonlyArray<keyof Config$7>;
6557
+ rule: ReadonlyArray<keyof Rule>;
6558
+ }>;
6559
+ /**
6560
+ * Dotted paths of the fields in `mapping` that do nothing at `position`,
6561
+ * rooted at `field`. Rules in array form are indexed.
6562
+ */
6563
+ declare function getMappingNoOpPaths(position: MappingPosition, mapping: unknown, field: string): string[];
6564
+ /**
6565
+ * Dotted paths of the `keys` set in a step config, rooted at `field`:
6566
+ * config-level keys (any config key, `batch` included), then each mapping
6567
+ * rule's keys. Rules in array form are indexed.
6568
+ */
6569
+ declare function getMappingKeyPaths(mapping: unknown, field: string, keys: {
6570
+ config: ReadonlyArray<string>;
6571
+ rule: ReadonlyArray<keyof Rule>;
6572
+ }): string[];
6573
+ /** The message naming no-op paths at a position and what applies there. */
6574
+ declare function getMappingNoOpMessage(position: MappingPosition, paths: string[]): string;
6575
+
6254
6576
  type StepOut = Flow.StepOut;
6255
6577
  /**
6256
6578
  * Format a step example's `out` as readable code for docs/app rendering.
@@ -6283,8 +6605,16 @@ declare const REF_VAR_FULL: RegExp;
6283
6605
  declare const REF_VAR_INLINE: RegExp;
6284
6606
  declare const REF_ENV: RegExp;
6285
6607
  declare const REF_CONTRACT: RegExp;
6608
+ /**
6609
+ * Regex source (a string, not a RegExp) of the flow name a `$flow`
6610
+ * reference can carry: a letter or `_`, then letters, digits, `_` or `-`
6611
+ * (`tracking-server`). Every `$flow` pattern is built from it.
6612
+ */
6613
+ declare const REF_FLOW_NAME = "[a-zA-Z_][a-zA-Z0-9_-]*";
6286
6614
  /** Whole-string `$flow.<name>(.<path>)?`: cross-flow value reference. */
6287
6615
  declare const REF_FLOW: RegExp;
6616
+ /** Global inline: every `$flow.<name>(.<path>)?` inside a larger string. */
6617
+ declare const REF_FLOW_INLINE: RegExp;
6288
6618
  declare const REF_STORE: RegExp;
6289
6619
  declare const REF_SECRET: RegExp;
6290
6620
  declare const REF_CODE_PREFIX = "$code:";
@@ -6296,4 +6626,4 @@ declare const REF_CODE_PREFIX = "$code:";
6296
6626
  */
6297
6627
  declare function scanFlowRefs(value: unknown, into?: Set<string>): Set<string>;
6298
6628
 
6299
- export { type ActivationGrant, type AssembleJourneysOptions, type BatchResponse, type BatchedPosterOptions, type BreakerState, type BuildFlag, 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, FlowCycleError, 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, MOIN_PARAM, MOIN_PRODUCTION, mapping as Mapping, type MarketingParameters, matcher as Matcher, type MockLogger, type MoinTarget, type NextSteps, type NodeLikeRequest, OBSERVE_ENV_KEY, OBSERVE_STORAGE_KEY, type Observe, type ObserveCredential, type ObserveServer, type ObserveWeb, type ObservedEnv, 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, RESERVED_WINDOW_GLOBALS, 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, type TransformerMappingEntry, trigger as Trigger, URL_WINDOW_MS, type ValidateEvents, type VerifyParams, type VerifyResult, walkeros as WalkerOS, type WalkerOSPackage, type WalkerOSPackageInfo, type WalkerOSPackageMeta, type WindowCollectorCheck, advanceChain, anonymizeIP, applyState, applyUpdate, assembleJourneys, assign, batchResponse, branch, browserSwapActivator, buildScopeFromNodeRequest, castToProperty, castValue, checkCache, checkWindowCollector, 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, getTransformerMapping, getTransformerMappingWarnings, isArguments, isArray, isBatchBody, isBoolean, isChainContinuation, isCommand, isDefined, isElementOrDocument, isEnvObserve, isFunction, isNumber, isObject, isPathStepEntry, isPropertyType, isRouteArray, isRouteConfigEntry, isRouteContinuation, isSameType, isSampled, isScope, isStoreValue, isString, isThenable, mcpError, mcpResult, mergeContractSchemas, mergeMappingRule, mockEnv, moin, normalizeBody, normalizeHeaders, normalizeQuery, observeEnv, 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 };
6629
+ export { type Acknowledgement, type ActivationGrant, type AssembleJourneysOptions, type BatchResponse, type BatchedPosterOptions, type BreakerState, type BuildFlag, CLOCK_SKEW_MS, CONTRACT_RULE_KEYS, cache as Cache, type CacheEnvelope, type CacheResult, type CauseKey, type CauseLog, type CauseLogOptions, type CauseLogger, type ChainContinuation, type ChainFrame, type ChainStep, type ClickIdEntry, collector as Collector, type CompiledCache, Const, context as Context, type Credential, DEFAULT_DESTINATION_TIMEOUT_MS, type Debounced, destination as Destination, type DestroyContext, type DestroyFn, type DroppedCounters, ENV_MARKER_PREFIX, EVENT_NOT_PROCESSED, elb as Elb, type EmitFn, type EventOutcome, type ExampleSummary, type FailureReason, FatalError, Flow, type FlowConfigResolver, FlowCycleError, FlowReferenceError, type FlowState, type FlowStateBatch, type FlowStatePhase, type FlowStepType, type GetStore, hint as Hint, hooks as Hooks, INTERNAL_SERVER_ERROR, 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, MAPPING_NO_OPS, MAX_SESSION_MS, MOIN_PARAM, MOIN_PRODUCTION, mapping as Mapping, type MappingPosition, type MarketingParameters, matcher as Matcher, type MockLogger, type MoinTarget, type NextSteps, type NodeLikeRequest, OBSERVE_ENV_KEY, OBSERVE_STORAGE_KEY, type Observe, type ObserveCredential, type ObserveServer, type ObserveSlot, type ObserveWeb, type ObservedEnv, type ObserverFn, on as On, type ParsedGrant, type ParsedTraceparent, type PosterFetch, type PosterResponse, type PreviewCrypto, type PreviewFailure, type PreviewKey, type PreviewSubtle, type QueueReason, type QueuedReason, REF_CODE_PREFIX, REF_CONTRACT, REF_ENV, REF_FLOW, REF_FLOW_INLINE, REF_FLOW_NAME, REF_SECRET, REF_STORE, REF_VAR_FULL, REF_VAR_INLINE, RESERVED_WINDOW_GLOBALS, request as Request, type ResolveContractsOptions, type ResolveOptions, type RespondFn, type RespondOptions, type RouteContinuation, type RouteDecision, type RouteGraphNode, type RouteLabel, SECRET_MARKER_PREFIX, STEP_FIELD_ROLES, STEP_FUNCTION_KEYS, STEP_OPERATIVE_FIELDS, type ScheduleOptions, type SendDataValue, type SendHeaders, type SendResponse, type ServiceAccount, type SetupFn, simulation as Simulation, source as Source, type StandardEventName, type State, type StepEntryErrorCode, type StepEntryValidation, StepError, type StepErrorOptions, type StepField, type StepFieldRole, type StepFunctionKey, type StepKind, type StorageType, store as Store, type TelemetryLevel, type TelemetryOptions, type TelemetryOptionsSupplier, type Timer, transformer as Transformer, type TransformerMappingEntry, trigger as Trigger, URL_WINDOW_MS, type ValidateEvents, type VerifyParams, type VerifyResult, walkeros as WalkerOS, type WalkerOSPackage, type WalkerOSPackageInfo, type WalkerOSPackageMeta, type WindowCollectorCheck, acknowledge, advanceChain, anonymizeIP, applyState, applyUpdate, assembleJourneys, assign, batchResponse, branch, buildScopeFromNodeRequest, castToProperty, castValue, checkCache, checkWindowCollector, clone, compileCache, compileMatcher, compileState, createBatchedPoster, createCauseLog, createDestination, createEvent, createIngest, createLogger, createMappingRoot, createMockContext, createMockLogger, createRespond, createTelemetryObserver, createTimer, debounce, deepMerge, defaultClickIds, deleteByPath, deriveSpanId, emitStep, fetchPackage, fetchPackageSchema, filterValues, flattenIncludeSections, formatOut, getBrowser, getBrowserVersion, getByPath, getDeviceType, getErrorMessage, getEvent, getFlowSettings, getGrantedConsent, getHeaders, getId, getMappingEvent, getMappingKeyPaths, getMappingNoOpMessage, getMappingNoOpPaths, getMappingValue, getMarketingParameters, getNextSteps, getOS, getOSVersion, getPlatform, getRouteGraph, getSpanId, getStepFieldRole, getStepRuntimeProps, getTraceId, getTraceUntil, getTransformerMapping, getTransformerMappingWarnings, getUnknownStepKeys, isArguments, isArray, isBatchBody, isBoolean, isChainContinuation, isCommand, isDefined, isEnvObserve, isFunction, isNumber, isObject, isPathStepEntry, isPropertyType, isRouteArray, isRouteConfigEntry, isRouteContinuation, isSameType, isSampled, isScope, isStoreValue, isString, isThenable, mcpError, mcpResult, mergeContractSchemas, mergeMappingRule, mockEnv, networkErrorMessage, normalizeBody, normalizeHeaders, normalizeQuery, observeEnv, observeFromEnv, packageNameToVariable, parseCallPath, parseGrant, parseObserveCredential, parseTraceparent, parseUserAgent, processEventMapping, pushResultToOutcome, readCacheEnvelope, reportCause, requestToData, requestToParameter, resolveContracts, resolveDestinationTimeout, resolveSetup, resolveTelemetryOptions, scanFlowRefs, setByPath, setTraceUntil, startChain, stepCall, stepId, storeCache, throttle, throwError, toEventList, toFailureReason, transformData, traverseEnv, trim, tryCatch, tryCatchAsync, useHooks, validateStepEntry, verifyActivation, walkPath, wrapCacheEnvelope, wrapCondition, wrapFn, wrapValidate };