@walkeros/core 4.8.1 → 4.8.3-next-1793115089237
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 +96 -3
- package/dist/dev.d.mts +934 -53
- package/dist/dev.d.ts +934 -53
- 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 +562 -147
- package/dist/index.d.ts +562 -147
- 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 +129 -14
- package/dist/node.d.ts +129 -14
- package/dist/node.js +1 -1
- package/dist/node.js.map +1 -1
- package/dist/node.mjs +1 -1
- package/dist/node.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
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. */
|
|
@@ -366,7 +378,7 @@ declare function observeFromEnv(env: Record<string, string | undefined>): Observ
|
|
|
366
378
|
* for inEvent/outEvent).
|
|
367
379
|
*/
|
|
368
380
|
type FlowStatePhase = 'init' | 'in' | 'out' | 'error' | 'skip' | 'flush';
|
|
369
|
-
type FlowStepType =
|
|
381
|
+
type FlowStepType = StepKind;
|
|
370
382
|
interface FlowStateBatch {
|
|
371
383
|
size: number;
|
|
372
384
|
index: number;
|
|
@@ -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
|
-
/**
|
|
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,8 +463,59 @@ 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
|
+
|
|
508
|
+
/**
|
|
509
|
+
* The types of a step package (`walkerOS.type` in its package.json). A step
|
|
510
|
+
* package publishes an exports list, empty when it declares none, and a
|
|
511
|
+
* settings schema; the build checks both.
|
|
512
|
+
*/
|
|
513
|
+
declare const STEP_TYPES: readonly ["source", "transformer", "destination", "store"];
|
|
514
|
+
|
|
515
|
+
/** The kind of a step package: one of `STEP_TYPES`. */
|
|
516
|
+
type StepType = (typeof STEP_TYPES)[number];
|
|
448
517
|
/** Identifies which kind of step a stepId belongs to. */
|
|
449
|
-
type StepKind = 'collector' |
|
|
518
|
+
type StepKind = 'collector' | StepType;
|
|
450
519
|
/**
|
|
451
520
|
* Build a stepId for use as a key in `Status.dropped` /
|
|
452
521
|
* `Status.connectionErrors` (and future status maps). The collector-level
|
|
@@ -457,7 +526,7 @@ type StepKind = 'collector' | 'source' | 'transformer' | 'destination' | 'store'
|
|
|
457
526
|
* log messages ("collector.queue overflow", "destination.dlq overflow").
|
|
458
527
|
*/
|
|
459
528
|
declare function stepId(kind: 'collector'): 'collector';
|
|
460
|
-
declare function stepId(kind:
|
|
529
|
+
declare function stepId(kind: StepType, id: string): string;
|
|
461
530
|
/**
|
|
462
531
|
* Drop counters at a single step. Each buffer is optional: a step kind
|
|
463
532
|
* may have only `queue` (collector), only `dlq`, both (destinations
|
|
@@ -509,6 +578,14 @@ interface Config$6 {
|
|
|
509
578
|
* destination backfill. Overflow drops oldest (FIFO). Default 1000.
|
|
510
579
|
*/
|
|
511
580
|
queueMax?: number;
|
|
581
|
+
/**
|
|
582
|
+
* What a destination does with an event whose required consent is not
|
|
583
|
+
* granted: `'queue'` (default) keeps it in the destination's `queuePush`
|
|
584
|
+
* until consent is granted; `'skip'` skips it (counted in
|
|
585
|
+
* `status.destinations[id].skipped`, a DEBUG line), for a server collector
|
|
586
|
+
* that never receives a later grant for an event's own consent.
|
|
587
|
+
*/
|
|
588
|
+
consentDenied?: 'queue' | 'skip';
|
|
512
589
|
/** Flow name; keys this flow's entry in event.source.release and the observer flowId. */
|
|
513
590
|
name?: string;
|
|
514
591
|
/** Config release id stamped into event.source.release for this flow. */
|
|
@@ -547,11 +624,14 @@ interface InitConfig extends Partial<Config$6> {
|
|
|
547
624
|
/**
|
|
548
625
|
* Observation session connect config, wired by `startFlow` before the run
|
|
549
626
|
* command. The server form attaches a telemetry poster directly from its
|
|
550
|
-
* config trio; the web form
|
|
551
|
-
*
|
|
552
|
-
* advisory: nothing on this
|
|
627
|
+
* config trio; the web form reads its credential through `slot`
|
|
628
|
+
* (`pageObserveSlot()` from `@walkeros/web-core`) and attaches only when
|
|
629
|
+
* one is present and its binding matches. Purely advisory: nothing on this
|
|
630
|
+
* path can affect event processing.
|
|
553
631
|
*/
|
|
554
|
-
observe?:
|
|
632
|
+
observe?: (ObserveWeb & {
|
|
633
|
+
slot: ObserveSlot;
|
|
634
|
+
}) | ObserveServer;
|
|
555
635
|
/**
|
|
556
636
|
* Caller-supplied observers, added verbatim to `collector.observers` by
|
|
557
637
|
* `startFlow`. Escape hatch for custom emit targets; same advisory
|
|
@@ -658,6 +738,11 @@ interface SourceStatus {
|
|
|
658
738
|
interface DestinationStatus {
|
|
659
739
|
count: number;
|
|
660
740
|
failed: number;
|
|
741
|
+
/**
|
|
742
|
+
* Events deliberately not sent: a consent-denied event under
|
|
743
|
+
* `consentDenied: 'skip'`, or an event a mapping rule `ignore`s.
|
|
744
|
+
*/
|
|
745
|
+
skipped?: number;
|
|
661
746
|
lastAt?: number;
|
|
662
747
|
duration: number;
|
|
663
748
|
/** Current size of the destination's queuePush buffer (point-in-time). */
|
|
@@ -684,7 +769,7 @@ interface Transformers$1 {
|
|
|
684
769
|
interface Stores$1 {
|
|
685
770
|
[id: string]: Instance$1;
|
|
686
771
|
}
|
|
687
|
-
type CommandType = 'action' | 'config' | 'consent' | 'context' | 'destination' | 'elb' | 'globals' | 'hook' | 'init' | 'link' | 'run' | 'user' | 'walker' | string;
|
|
772
|
+
type CommandType = 'action' | 'config' | 'consent' | 'context' | 'destination' | 'elb' | 'flush' | 'globals' | 'hook' | 'init' | 'link' | 'run' | 'shutdown' | 'user' | 'walker' | string;
|
|
688
773
|
/**
|
|
689
774
|
* Options passed to collector.push() from sources.
|
|
690
775
|
* NOT a Context - just push metadata.
|
|
@@ -775,6 +860,12 @@ interface Instance$6 {
|
|
|
775
860
|
*/
|
|
776
861
|
observeLevel?: () => 'off' | 'standard' | 'trace';
|
|
777
862
|
logger: Instance$3;
|
|
863
|
+
/**
|
|
864
|
+
* The collector's one cause log: every failure line goes through it, one
|
|
865
|
+
* line per (step, cause code, status) per minute. Set by `startFlow`;
|
|
866
|
+
* optional only so hand-built test collectors keep compiling.
|
|
867
|
+
*/
|
|
868
|
+
causeLog?: CauseLog;
|
|
778
869
|
on: OnConfig;
|
|
779
870
|
queue: Events;
|
|
780
871
|
/**
|
|
@@ -877,9 +968,10 @@ type collector_SourceStatus = SourceStatus;
|
|
|
877
968
|
type collector_Sources = Sources;
|
|
878
969
|
type collector_Status = Status;
|
|
879
970
|
type collector_StepKind = StepKind;
|
|
971
|
+
type collector_StepType = StepType;
|
|
880
972
|
declare const collector_stepId: typeof stepId;
|
|
881
973
|
declare namespace collector {
|
|
882
|
-
export { type collector_BreakerState as BreakerState, type collector_Cascade as Cascade, type collector_CommandFn as CommandFn, type collector_CommandType as CommandType, type Config$6 as Config, type collector_DestinationStatus as DestinationStatus, type Destinations$1 as Destinations, type collector_DroppedCounters as DroppedCounters, type collector_InitConfig as InitConfig, type collector_InitConfigOf as InitConfigOf, type Instance$6 as Instance, type PushFn$1 as PushFn, type collector_PushOptions as PushOptions, type collector_SessionData as SessionData, type collector_SourceStatus as SourceStatus, type collector_Sources as Sources, type collector_Status as Status, type collector_StepKind as StepKind, type Stores$1 as Stores, type Transformers$1 as Transformers, collector_stepId as stepId };
|
|
974
|
+
export { type collector_BreakerState as BreakerState, type collector_Cascade as Cascade, type collector_CommandFn as CommandFn, type collector_CommandType as CommandType, type Config$6 as Config, type collector_DestinationStatus as DestinationStatus, type Destinations$1 as Destinations, type collector_DroppedCounters as DroppedCounters, type collector_InitConfig as InitConfig, type collector_InitConfigOf as InitConfigOf, type Instance$6 as Instance, type PushFn$1 as PushFn, type collector_PushOptions as PushOptions, type collector_SessionData as SessionData, type collector_SourceStatus as SourceStatus, type collector_Sources as Sources, type collector_Status as Status, type collector_StepKind as StepKind, type collector_StepType as StepType, type Stores$1 as Stores, type Transformers$1 as Transformers, collector_stepId as stepId };
|
|
883
975
|
}
|
|
884
976
|
|
|
885
977
|
/**
|
|
@@ -1007,6 +1099,66 @@ declare namespace lifecycle {
|
|
|
1007
1099
|
export type { lifecycle_DestroyContext as DestroyContext, lifecycle_DestroyFn as DestroyFn, lifecycle_LifecycleContext as LifecycleContext, lifecycle_SetupFn as SetupFn };
|
|
1008
1100
|
}
|
|
1009
1101
|
|
|
1102
|
+
/**
|
|
1103
|
+
* Options of a {@link StepError}: the failure code, and what decides whether
|
|
1104
|
+
* a retry can help (`status`, an explicit `retryable`).
|
|
1105
|
+
*/
|
|
1106
|
+
interface StepErrorOptions {
|
|
1107
|
+
code: string;
|
|
1108
|
+
status?: number;
|
|
1109
|
+
retryable?: boolean;
|
|
1110
|
+
/** The response body: kept on the error, never in its message or a log line. */
|
|
1111
|
+
body?: unknown;
|
|
1112
|
+
cause?: unknown;
|
|
1113
|
+
}
|
|
1114
|
+
/** Why a push failed, as a push result and the logs carry it. Never a body. */
|
|
1115
|
+
type FailureReason = {
|
|
1116
|
+
code: string;
|
|
1117
|
+
message: string;
|
|
1118
|
+
retryable: boolean;
|
|
1119
|
+
status?: number;
|
|
1120
|
+
};
|
|
1121
|
+
/** Why an event waits instead of being delivered now. */
|
|
1122
|
+
type QueueReason = 'consent' | 'batch' | 'held';
|
|
1123
|
+
type QueuedReason = {
|
|
1124
|
+
code: QueueReason;
|
|
1125
|
+
message: string;
|
|
1126
|
+
};
|
|
1127
|
+
/**
|
|
1128
|
+
* The error a step throws when it cannot do its work: a missing setting
|
|
1129
|
+
* (`config`), a refused request (`transport` with its `status`), a vendor
|
|
1130
|
+
* that is not there. The collector reads `code` and `retryable` instead of
|
|
1131
|
+
* the message.
|
|
1132
|
+
*/
|
|
1133
|
+
declare class StepError extends Error {
|
|
1134
|
+
code: string;
|
|
1135
|
+
status?: number;
|
|
1136
|
+
retryable: boolean;
|
|
1137
|
+
body?: unknown;
|
|
1138
|
+
cause?: unknown;
|
|
1139
|
+
constructor(message: string, options: StepErrorOptions);
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Runs one vendor or SDK call, sync or async, and waits for it. A
|
|
1143
|
+
* `StepError` it throws passes through unchanged (the step's own code wins);
|
|
1144
|
+
* anything else becomes a `StepError` with `code` and `message`, the
|
|
1145
|
+
* original kept as `cause` and never in the message, which a vendor can fill
|
|
1146
|
+
* with the values it was sent.
|
|
1147
|
+
*/
|
|
1148
|
+
declare function stepCall<T>(call: () => T | PromiseLike<T>, code: string, message: string): Promise<Awaited<T>>;
|
|
1149
|
+
/**
|
|
1150
|
+
* The reason of any thrown value: a `StepError` keeps its code, status and
|
|
1151
|
+
* `retryable`; anything else is a `transport` failure. The message is capped
|
|
1152
|
+
* at 300 characters; the body never leaves the error.
|
|
1153
|
+
*/
|
|
1154
|
+
declare function toFailureReason(err: unknown): FailureReason;
|
|
1155
|
+
/**
|
|
1156
|
+
* A network error's message with its cause code (`ECONNREFUSED`, `ENOTFOUND`),
|
|
1157
|
+
* which runtimes keep on `cause` (Node's fetch says only `fetch failed`): the
|
|
1158
|
+
* code only, never the cause's message, which carries addresses and URLs.
|
|
1159
|
+
*/
|
|
1160
|
+
declare function networkErrorMessage(error: unknown): string;
|
|
1161
|
+
|
|
1010
1162
|
/**
|
|
1011
1163
|
* Package-internal type helpers. Not re-exported from `types/index.ts`.
|
|
1012
1164
|
*/
|
|
@@ -1159,9 +1311,20 @@ type Credentials$2<T extends TypesGeneric$3 = Types$4> = T['credentials'];
|
|
|
1159
1311
|
* Inference helper: Extract Types from Instance
|
|
1160
1312
|
*/
|
|
1161
1313
|
type TypesOf$3<I> = I extends Instance$5<infer T> ? T : never;
|
|
1314
|
+
/**
|
|
1315
|
+
* An event waiting in a destination's `queuePush`, with why it waits:
|
|
1316
|
+
* `consent` (its required consent is not granted) or `held` (a state
|
|
1317
|
+
* delivery to the destination is running or failed). An entry seeded from
|
|
1318
|
+
* the collector's replay buffer has no reason yet. The entry object keeps its
|
|
1319
|
+
* identity across drain and requeue; the event inside is copied.
|
|
1320
|
+
*/
|
|
1321
|
+
interface Queued {
|
|
1322
|
+
event: Event;
|
|
1323
|
+
reason?: 'consent' | 'held';
|
|
1324
|
+
}
|
|
1162
1325
|
interface Instance$5<T extends TypesGeneric$3 = Types$4> {
|
|
1163
1326
|
config: Config$5<T>;
|
|
1164
|
-
queuePush?:
|
|
1327
|
+
queuePush?: Queued[];
|
|
1165
1328
|
queueOn?: Array<{
|
|
1166
1329
|
type: Types$2;
|
|
1167
1330
|
data?: unknown;
|
|
@@ -1347,7 +1510,7 @@ interface PushBatchContext<T extends TypesGeneric$3 = Types$4> extends Context$5
|
|
|
1347
1510
|
ingest: Ingest;
|
|
1348
1511
|
rule?: Rule<Mapping$1<T>>;
|
|
1349
1512
|
}
|
|
1350
|
-
type InitFn$2<T extends TypesGeneric$3 = Types$4> = (context: Context$5<T>) => PromiseOrValue<void |
|
|
1513
|
+
type InitFn$2<T extends TypesGeneric$3 = Types$4> = (context: Context$5<T>) => PromiseOrValue<void | Config$5<T>>;
|
|
1351
1514
|
type PushFn<T extends TypesGeneric$3 = Types$4> = (event: Event, context: PushContext<T>) => PromiseOrValue<void | unknown>;
|
|
1352
1515
|
/**
|
|
1353
1516
|
* Per-row outcome for a single failed batch entry.
|
|
@@ -1426,20 +1589,35 @@ interface BatchRegistry<Mapping> {
|
|
|
1426
1589
|
batchFn: () => void;
|
|
1427
1590
|
/**
|
|
1428
1591
|
* Force a flush of the current batch immediately. Used by shutdown
|
|
1429
|
-
* drain and by tests for deterministic flushing without
|
|
1430
|
-
* advancement. Resolves after the underlying `pushBatch` settles
|
|
1592
|
+
* drain, `walker flush` and by tests for deterministic flushing without
|
|
1593
|
+
* timer advancement. Resolves after the underlying `pushBatch` settles,
|
|
1594
|
+
* with what that flush did (nothing when the batch was empty).
|
|
1431
1595
|
*/
|
|
1432
|
-
flush: () => Promise<void>;
|
|
1596
|
+
flush: () => Promise<BatchFlushOutcome | void>;
|
|
1433
1597
|
};
|
|
1434
1598
|
}
|
|
1599
|
+
/**
|
|
1600
|
+
* What one batch flush did: entries delivered and failed, and the reason of
|
|
1601
|
+
* a failure when any entry failed.
|
|
1602
|
+
*/
|
|
1603
|
+
interface BatchFlushOutcome {
|
|
1604
|
+
delivered: number;
|
|
1605
|
+
failed: number;
|
|
1606
|
+
reason?: FailureReason;
|
|
1607
|
+
}
|
|
1435
1608
|
type Data = Property | undefined | Array<Property | undefined>;
|
|
1436
1609
|
interface Ref {
|
|
1437
1610
|
type: string;
|
|
1438
1611
|
data?: unknown;
|
|
1439
1612
|
error?: unknown;
|
|
1613
|
+
/**
|
|
1614
|
+
* Why the destination did not deliver now: a `FailureReason` under
|
|
1615
|
+
* `failed`, a `QueuedReason` under `queued`.
|
|
1616
|
+
*/
|
|
1617
|
+
reason?: FailureReason | QueuedReason;
|
|
1440
1618
|
}
|
|
1441
1619
|
type Push$1 = {
|
|
1442
|
-
queuePush?:
|
|
1620
|
+
queuePush?: Queued[];
|
|
1443
1621
|
error?: unknown;
|
|
1444
1622
|
};
|
|
1445
1623
|
type DLQ = Array<[Event, unknown]>;
|
|
@@ -1466,6 +1644,7 @@ declare function getDestination<T extends TypesGeneric$3 = Types$4>(collector: {
|
|
|
1466
1644
|
type destination_Batch<Mapping> = Batch<Mapping>;
|
|
1467
1645
|
type destination_BatchEntry<Mapping = unknown> = BatchEntry<Mapping>;
|
|
1468
1646
|
type destination_BatchFailure = BatchFailure;
|
|
1647
|
+
type destination_BatchFlushOutcome = BatchFlushOutcome;
|
|
1469
1648
|
type destination_BatchOptions = BatchOptions;
|
|
1470
1649
|
type destination_BatchOutcome = BatchOutcome;
|
|
1471
1650
|
type destination_BatchRegistry<Mapping> = BatchRegistry<Mapping>;
|
|
@@ -1484,10 +1663,11 @@ type destination_PushContext<T extends TypesGeneric$3 = Types$4> = PushContext<T
|
|
|
1484
1663
|
type destination_PushEvent<Mapping = unknown> = PushEvent<Mapping>;
|
|
1485
1664
|
type destination_PushEvents<Mapping = unknown> = PushEvents<Mapping>;
|
|
1486
1665
|
type destination_PushFn<T extends TypesGeneric$3 = Types$4> = PushFn<T>;
|
|
1666
|
+
type destination_Queued = Queued;
|
|
1487
1667
|
type destination_Ref = Ref;
|
|
1488
1668
|
declare const destination_getDestination: typeof getDestination;
|
|
1489
1669
|
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 };
|
|
1670
|
+
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
1671
|
}
|
|
1492
1672
|
|
|
1493
1673
|
interface EventFn<R = Promise<PushResult>> {
|
|
@@ -1529,8 +1709,18 @@ interface PushResult {
|
|
|
1529
1709
|
dropped?: boolean;
|
|
1530
1710
|
/** Event was rejected as invalid input: a client/producer fault, not a pipeline failure. */
|
|
1531
1711
|
invalid?: boolean;
|
|
1532
|
-
/**
|
|
1712
|
+
/**
|
|
1713
|
+
* Human-readable message when the event was rejected or a step before the
|
|
1714
|
+
* destinations failed. A destination's own failure is in `failed`, under
|
|
1715
|
+
* its id with a `reason`, and leaves this unset.
|
|
1716
|
+
*/
|
|
1533
1717
|
error?: string;
|
|
1718
|
+
/**
|
|
1719
|
+
* Why the push failed when `ok` is false without a `failed` entry: a full
|
|
1720
|
+
* pre-run queue (`queue-full`), a transformer that threw (`transformer`)
|
|
1721
|
+
* or is not ready, a rule `condition` that threw (`mapping`).
|
|
1722
|
+
*/
|
|
1723
|
+
reason?: FailureReason;
|
|
1534
1724
|
}
|
|
1535
1725
|
type Layer = Array<IArguments | DeepPartialEvent | unknown[]>;
|
|
1536
1726
|
|
|
@@ -1667,6 +1857,12 @@ interface Config$4<T extends TypesGeneric$2 = Types$3> {
|
|
|
1667
1857
|
state?: State | State[];
|
|
1668
1858
|
init?: boolean;
|
|
1669
1859
|
disabled?: boolean;
|
|
1860
|
+
/**
|
|
1861
|
+
* Timeout in ms (default 10000) for `init` and for each `push`: one that
|
|
1862
|
+
* does not settle within this window fails the push with code `timeout`;
|
|
1863
|
+
* the next push retries the init.
|
|
1864
|
+
*/
|
|
1865
|
+
timeout?: number;
|
|
1670
1866
|
/** Return this value instead of calling push(). Global mock for all chains. */
|
|
1671
1867
|
mock?: unknown;
|
|
1672
1868
|
/** Path-specific mock values keyed by chain path (e.g., "destination.ga4.before"). Takes precedence over global mock. */
|
|
@@ -1727,8 +1923,10 @@ interface ChainCopy<E = DeepPartialEvent> {
|
|
|
1727
1923
|
* with the ingest it finished with. The next position goes on with each
|
|
1728
1924
|
* pair.
|
|
1729
1925
|
*
|
|
1730
|
-
* - dropped (a transformer returned `false`
|
|
1731
|
-
*
|
|
1926
|
+
* - dropped (a transformer returned `false`): `copies` empty, `droppedBy`
|
|
1927
|
+
* names the transformer.
|
|
1928
|
+
* - failed (a transformer threw, or its `init` threw or returned `false`):
|
|
1929
|
+
* `failure` names it and carries the reason; not a drop.
|
|
1732
1930
|
* - route `stop`: `copies` empty, `stopped: true`; `droppedBy` names the
|
|
1733
1931
|
* transformer whose route stopped it, absent for the start route.
|
|
1734
1932
|
* - `cache.stop: true` HIT: `copies` holds the cached copy, `stopped: true`.
|
|
@@ -1741,6 +1939,17 @@ interface ChainResult {
|
|
|
1741
1939
|
stopped?: true;
|
|
1742
1940
|
/** Transformer that dropped or stopped the chain. */
|
|
1743
1941
|
droppedBy?: string;
|
|
1942
|
+
/**
|
|
1943
|
+
* A transformer that threw or could not start: the failed copy ends (not
|
|
1944
|
+
* a drop), and the position answers `ok: false` with this reason. Other
|
|
1945
|
+
* copies of a fork still go on in `copies`.
|
|
1946
|
+
*/
|
|
1947
|
+
failure?: ChainFailure;
|
|
1948
|
+
}
|
|
1949
|
+
/** A transformer in a chain that failed: its id and why. */
|
|
1950
|
+
interface ChainFailure {
|
|
1951
|
+
by: string;
|
|
1952
|
+
reason: FailureReason;
|
|
1744
1953
|
}
|
|
1745
1954
|
/**
|
|
1746
1955
|
* The main transformer function.
|
|
@@ -1762,10 +1971,10 @@ type Fn$2<T extends TypesGeneric$2 = Types$3, E = DeepPartialEvent> = (event: E,
|
|
|
1762
1971
|
*
|
|
1763
1972
|
* @param context - Transformer context
|
|
1764
1973
|
* @returns void - initialization successful
|
|
1765
|
-
* @
|
|
1974
|
+
* @throws StepError - initialization failed; the push fails
|
|
1766
1975
|
* @returns Config<T> - return updated config
|
|
1767
1976
|
*/
|
|
1768
|
-
type InitFn$1<T extends TypesGeneric$2 = Types$3> = (context: Context$4<T>) => PromiseOrValue<void |
|
|
1977
|
+
type InitFn$1<T extends TypesGeneric$2 = Types$3> = (context: Context$4<T>) => PromiseOrValue<void | Config$4<T>>;
|
|
1769
1978
|
/**
|
|
1770
1979
|
* Transformer instance returned by Init function.
|
|
1771
1980
|
*/
|
|
@@ -1847,6 +2056,7 @@ declare function getTransformer<T extends TypesGeneric$2 = Types$3>(collector: {
|
|
|
1847
2056
|
}, id: string): Instance$4<T>;
|
|
1848
2057
|
|
|
1849
2058
|
type transformer_ChainCopy<E = DeepPartialEvent> = ChainCopy<E>;
|
|
2059
|
+
type transformer_ChainFailure = ChainFailure;
|
|
1850
2060
|
type transformer_ChainResult = ChainResult;
|
|
1851
2061
|
type transformer_InitTransformer<T extends TypesGeneric$2 = Types$3> = InitTransformer<T>;
|
|
1852
2062
|
type transformer_InitTransformerEntry<T extends TypesGeneric$2> = InitTransformerEntry<T>;
|
|
@@ -1862,7 +2072,7 @@ type transformer_RouteStopConfig = RouteStopConfig;
|
|
|
1862
2072
|
type transformer_Transformers = Transformers;
|
|
1863
2073
|
declare const transformer_getTransformer: typeof getTransformer;
|
|
1864
2074
|
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 };
|
|
2075
|
+
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
2076
|
}
|
|
1867
2077
|
|
|
1868
2078
|
/**
|
|
@@ -2213,6 +2423,12 @@ declare namespace Flow {
|
|
|
2213
2423
|
type?: string;
|
|
2214
2424
|
/** Optional "$code:..." init function. */
|
|
2215
2425
|
init?: string;
|
|
2426
|
+
/** Optional "$code:..." batch push function (destinations). */
|
|
2427
|
+
pushBatch?: string;
|
|
2428
|
+
/** Optional "$code:..." event handler (`on('consent')` and others). */
|
|
2429
|
+
on?: string;
|
|
2430
|
+
/** Optional "$code:..." destroy function. */
|
|
2431
|
+
destroy?: string;
|
|
2216
2432
|
}
|
|
2217
2433
|
/**
|
|
2218
2434
|
* Source reference with inline package syntax.
|
|
@@ -2236,7 +2452,7 @@ declare namespace Flow {
|
|
|
2236
2452
|
/**
|
|
2237
2453
|
* Inline code definition (object form only).
|
|
2238
2454
|
*
|
|
2239
|
-
* Object: `{push, type?, init?}` for inline code definition.
|
|
2455
|
+
* Object: `{push, type?, init?, pushBatch?, on?, destroy?}` for inline code definition.
|
|
2240
2456
|
* For named-export selection from a package, use the `import` field with `package`.
|
|
2241
2457
|
*/
|
|
2242
2458
|
code?: Code;
|
|
@@ -2289,7 +2505,8 @@ declare namespace Flow {
|
|
|
2289
2505
|
* Name of the transformer to execute after this source captures an event.
|
|
2290
2506
|
* Creates a pre-collector transformer chain. Chain ends at the collector.
|
|
2291
2507
|
* If omitted, events route directly to the collector.
|
|
2292
|
-
* Can be an array
|
|
2508
|
+
* Can be an array: its members run in order, and each member's own `next`
|
|
2509
|
+
* runs right after that member.
|
|
2293
2510
|
*/
|
|
2294
2511
|
next?: Route;
|
|
2295
2512
|
/** Cache configuration for this source. */
|
|
@@ -2319,7 +2536,7 @@ declare namespace Flow {
|
|
|
2319
2536
|
/**
|
|
2320
2537
|
* Inline code definition (object form only).
|
|
2321
2538
|
*
|
|
2322
|
-
* Object: `{push, type?, init?}` for inline code definition.
|
|
2539
|
+
* Object: `{push, type?, init?, pushBatch?, on?, destroy?}` for inline code definition.
|
|
2323
2540
|
* For named-export selection from a package, use the `import` field with `package`.
|
|
2324
2541
|
*/
|
|
2325
2542
|
code?: Code;
|
|
@@ -2383,7 +2600,7 @@ declare namespace Flow {
|
|
|
2383
2600
|
/**
|
|
2384
2601
|
* Inline code definition (object form only).
|
|
2385
2602
|
*
|
|
2386
|
-
* Object: `{push, type?, init?}` for inline code definition.
|
|
2603
|
+
* Object: `{push, type?, init?, pushBatch?, on?, destroy?}` for inline code definition.
|
|
2387
2604
|
* For named-export selection from a package, use the `import` field with `package`.
|
|
2388
2605
|
*/
|
|
2389
2606
|
code?: Code;
|
|
@@ -2452,7 +2669,7 @@ declare namespace Flow {
|
|
|
2452
2669
|
/**
|
|
2453
2670
|
* Inline code definition (object form only).
|
|
2454
2671
|
*
|
|
2455
|
-
* Object: `{push, type?, init?}` for inline code definition.
|
|
2672
|
+
* Object: `{push, type?, init?, pushBatch?, on?, destroy?}` for inline code definition.
|
|
2456
2673
|
* For named-export selection from a package, use the `import` field with `package`.
|
|
2457
2674
|
*/
|
|
2458
2675
|
code?: Code;
|
|
@@ -2572,6 +2789,46 @@ declare namespace Flow {
|
|
|
2572
2789
|
type StepEffect = readonly [callable: string, ...args: unknown[]];
|
|
2573
2790
|
/** The effects a step produces, in execution order. Empty = no observable effect (filtered, passthrough). */
|
|
2574
2791
|
type StepOut = readonly StepEffect[];
|
|
2792
|
+
/** How a kit boundary answers one request. */
|
|
2793
|
+
interface StepAnswer {
|
|
2794
|
+
status?: number;
|
|
2795
|
+
body?: unknown;
|
|
2796
|
+
/** The status text, which failure answers use to echo a canary. */
|
|
2797
|
+
statusText?: string;
|
|
2798
|
+
/** A network error, or no answer at all. */
|
|
2799
|
+
error?: 'network' | 'timeout';
|
|
2800
|
+
/** Answer one macrotask late (the floating-send check). */
|
|
2801
|
+
late?: boolean;
|
|
2802
|
+
}
|
|
2803
|
+
/** Records one request at the kit boundary; returns its answer and marks it settled. */
|
|
2804
|
+
type StepRecord = (effect: StepEffect) => {
|
|
2805
|
+
answer: StepAnswer;
|
|
2806
|
+
settle: () => void;
|
|
2807
|
+
};
|
|
2808
|
+
/**
|
|
2809
|
+
* The browser page a web step runs on in the conformance kit and the
|
|
2810
|
+
* examples runner. `@walkeros/web-core/dev` implements it as `page`.
|
|
2811
|
+
*/
|
|
2812
|
+
interface StepPage {
|
|
2813
|
+
open(record: StepRecord): StepPageSession;
|
|
2814
|
+
}
|
|
2815
|
+
/** One run on the page, from `open` to `close`. */
|
|
2816
|
+
interface StepPageSession {
|
|
2817
|
+
/** Page globals merged over an examples env's `push` (the document). */
|
|
2818
|
+
globals: Record<string, unknown>;
|
|
2819
|
+
/**
|
|
2820
|
+
* Scripts added since `open`, with and without the loadVendor marker.
|
|
2821
|
+
* A marked script loads (`load`, once) unless `failScripts` fails it.
|
|
2822
|
+
*/
|
|
2823
|
+
scripts(): {
|
|
2824
|
+
marked: number;
|
|
2825
|
+
unmarked: number;
|
|
2826
|
+
};
|
|
2827
|
+
/** Fire `error` on every marked script, loaded or not (kit item 2, vendor-global). */
|
|
2828
|
+
failScripts(): void;
|
|
2829
|
+
/** Restore the stubs and remove the scripts added since `open`. */
|
|
2830
|
+
close(): void;
|
|
2831
|
+
}
|
|
2575
2832
|
/**
|
|
2576
2833
|
* Named example pair for a step.
|
|
2577
2834
|
* `in` is the input to the step, `out` is the expected output.
|
|
@@ -2589,7 +2846,10 @@ declare namespace Flow {
|
|
|
2589
2846
|
* Whether this example is meant for public consumption (docs, UI, MCP default output).
|
|
2590
2847
|
* Defaults to `true`. Set to `false` for test-only fixtures that should stay out of
|
|
2591
2848
|
* user-facing surfaces but still run in test suites and remain available to
|
|
2592
|
-
* `flow_simulate` / CLI `--simulate`.
|
|
2849
|
+
* `flow_simulate` / CLI `--simulate`. A failure example (`public: false`
|
|
2850
|
+
* with an `outcome`) is still listed on the docs page under "When it
|
|
2851
|
+
* fails", by its title, description and outcome; its fixture `in` is
|
|
2852
|
+
* never shown.
|
|
2593
2853
|
*/
|
|
2594
2854
|
public?: boolean;
|
|
2595
2855
|
in?: unknown;
|
|
@@ -2608,9 +2868,93 @@ declare namespace Flow {
|
|
|
2608
2868
|
* When absent (default), `in` is pushed as a regular event.
|
|
2609
2869
|
*/
|
|
2610
2870
|
command?: StepCommand;
|
|
2871
|
+
/**
|
|
2872
|
+
* The reported outcome of a failure or queue example (`public: false`):
|
|
2873
|
+
* the step's status in the push result and its reason code. Absent means
|
|
2874
|
+
* the step must not fail. The docs page lists every example with an
|
|
2875
|
+
* outcome under "When it fails" by title, description and outcome, so it
|
|
2876
|
+
* needs a reader-facing `description` (the docs build fails without one);
|
|
2877
|
+
* its fixture `in` is never shown.
|
|
2878
|
+
*/
|
|
2879
|
+
outcome?: StepOutcome;
|
|
2880
|
+
/** What the boundary answers for this example (a failure fixture). */
|
|
2881
|
+
respond?: StepRespond;
|
|
2882
|
+
}
|
|
2883
|
+
/** How a failure or queue example is reported in the push result. */
|
|
2884
|
+
interface StepOutcome {
|
|
2885
|
+
status: 'failed' | 'queued';
|
|
2886
|
+
code: string;
|
|
2887
|
+
retryable?: boolean;
|
|
2888
|
+
}
|
|
2889
|
+
/**
|
|
2890
|
+
* The boundary's answer to the request an example makes: an HTTP status and
|
|
2891
|
+
* body, or a network error or a timeout instead of a response.
|
|
2892
|
+
*/
|
|
2893
|
+
interface StepRespond {
|
|
2894
|
+
status?: number;
|
|
2895
|
+
body?: unknown;
|
|
2896
|
+
error?: 'network' | 'timeout';
|
|
2611
2897
|
}
|
|
2612
2898
|
/** Named step examples keyed by scenario name. */
|
|
2613
2899
|
type StepExamples = Record<string, StepExample>;
|
|
2900
|
+
/**
|
|
2901
|
+
* The settings a package needs to deliver, published as `examples.minimal`
|
|
2902
|
+
* (for a package with several exports, as `exportExamples.<export>.minimal`).
|
|
2903
|
+
* `composeQuickstart` turns it into the install line, the integrated code
|
|
2904
|
+
* and a complete flow; the conformance kit runs it.
|
|
2905
|
+
*/
|
|
2906
|
+
interface MinimalExample {
|
|
2907
|
+
/**
|
|
2908
|
+
* Only the settings the schema requires, plus any that `init` refuses to
|
|
2909
|
+
* start without under `config`. A secret holds a placeholder value that
|
|
2910
|
+
* satisfies the schema; generated code never shows it.
|
|
2911
|
+
*/
|
|
2912
|
+
settings: Record<string, unknown>;
|
|
2913
|
+
/**
|
|
2914
|
+
* Server destinations: settings keys that hold credentials, mapped to the
|
|
2915
|
+
* secret name the reader sets (`A-Z`, `0-9` and `_`), for example
|
|
2916
|
+
* `{ accessToken: 'META_ACCESS_TOKEN' }`. Generated code reads them as
|
|
2917
|
+
* `process.env.<NAME>` (integrated) and `$secret.<NAME>` (flow). A web
|
|
2918
|
+
* destination holds no secret.
|
|
2919
|
+
*/
|
|
2920
|
+
secrets?: Record<string, string>;
|
|
2921
|
+
/**
|
|
2922
|
+
* Destination config the package needs to deliver beyond its settings:
|
|
2923
|
+
* `loadScript` for a web destination that loads its vendor script only
|
|
2924
|
+
* when asked to.
|
|
2925
|
+
*/
|
|
2926
|
+
config?: Pick<Config$5, 'loadScript'>;
|
|
2927
|
+
}
|
|
2928
|
+
/** The `$meta` of a package's walkerOS.json, as its build writes it. */
|
|
2929
|
+
interface PackageMeta {
|
|
2930
|
+
package: string;
|
|
2931
|
+
version: string;
|
|
2932
|
+
/** Step type: `source`, `transformer`, `destination` or `store`. */
|
|
2933
|
+
type?: string;
|
|
2934
|
+
platform?: string[];
|
|
2935
|
+
renderer?: string;
|
|
2936
|
+
/** Declared exports, export name to description. */
|
|
2937
|
+
exports?: Record<string, string>;
|
|
2938
|
+
docs?: string;
|
|
2939
|
+
source?: string;
|
|
2940
|
+
}
|
|
2941
|
+
/** A package's quickstart, composed from its `$meta` and minimal example. */
|
|
2942
|
+
interface Quickstart {
|
|
2943
|
+
/** The install command. */
|
|
2944
|
+
install: string;
|
|
2945
|
+
/** TypeScript source that starts a flow with the package. */
|
|
2946
|
+
integrated: string;
|
|
2947
|
+
/** A complete flow with the package as its only step of its type. */
|
|
2948
|
+
flow: Json;
|
|
2949
|
+
/**
|
|
2950
|
+
* What the conformance kit runs with: the settings (secrets as their
|
|
2951
|
+
* placeholders) and the minimal example's config.
|
|
2952
|
+
*/
|
|
2953
|
+
run: {
|
|
2954
|
+
settings: Record<string, unknown>;
|
|
2955
|
+
config?: Pick<Config$5, 'loadScript'>;
|
|
2956
|
+
};
|
|
2957
|
+
}
|
|
2614
2958
|
}
|
|
2615
2959
|
|
|
2616
2960
|
type AnyFunction$1<P extends unknown[] = never[], R = unknown> = (...args: P) => R;
|
|
@@ -2661,8 +3005,8 @@ interface LogContext {
|
|
|
2661
3005
|
*/
|
|
2662
3006
|
type LogFn = (message: string | Error, context?: unknown | Error) => void;
|
|
2663
3007
|
/**
|
|
2664
|
-
* Throw function signature
|
|
2665
|
-
*
|
|
3008
|
+
* Throw function signature: throws an Error with the message, never logs
|
|
3009
|
+
* (the catching collector logs the failure once). Returns never.
|
|
2666
3010
|
*/
|
|
2667
3011
|
type ThrowFn = (message: string | Error, context?: unknown) => never;
|
|
2668
3012
|
/**
|
|
@@ -2696,8 +3040,8 @@ interface Instance$3 {
|
|
|
2696
3040
|
*/
|
|
2697
3041
|
debug: LogFn;
|
|
2698
3042
|
/**
|
|
2699
|
-
*
|
|
2700
|
-
*
|
|
3043
|
+
* Throw an Error with the message. Does not log: the collector's catch
|
|
3044
|
+
* writes the one line for the failure.
|
|
2701
3045
|
*/
|
|
2702
3046
|
throw: ThrowFn;
|
|
2703
3047
|
/**
|
|
@@ -2711,6 +3055,12 @@ interface Instance$3 {
|
|
|
2711
3055
|
*/
|
|
2712
3056
|
scope: (name: string) => Instance$3;
|
|
2713
3057
|
}
|
|
3058
|
+
/**
|
|
3059
|
+
* Output format of a server terminal logger: one text line per call, or one
|
|
3060
|
+
* JSON object per line (`severity`, `message`, `scope`, `context`, `time`),
|
|
3061
|
+
* which Cloud Run, Loki and Datadog read as structured entries.
|
|
3062
|
+
*/
|
|
3063
|
+
type Format = 'text' | 'json';
|
|
2714
3064
|
/**
|
|
2715
3065
|
* Logger configuration options
|
|
2716
3066
|
*/
|
|
@@ -2720,6 +3070,13 @@ interface Config$3 {
|
|
|
2720
3070
|
* @default Level.ERROR
|
|
2721
3071
|
*/
|
|
2722
3072
|
level?: Level | keyof typeof Level;
|
|
3073
|
+
/**
|
|
3074
|
+
* Output format of a server flow's log lines (`@walkeros/core/node`'s
|
|
3075
|
+
* terminal logger, used by `runneros`). Web flows log to the browser
|
|
3076
|
+
* console and reject it.
|
|
3077
|
+
* @default 'text'
|
|
3078
|
+
*/
|
|
3079
|
+
format?: Format;
|
|
2723
3080
|
/**
|
|
2724
3081
|
* Custom log handler function
|
|
2725
3082
|
* Receives originalHandler to preserve default behavior
|
|
@@ -2745,6 +3102,7 @@ type Factory = (config?: Config$3) => Instance$3;
|
|
|
2745
3102
|
type logger_DefaultHandler = DefaultHandler;
|
|
2746
3103
|
type logger_ErrorContext = ErrorContext;
|
|
2747
3104
|
type logger_Factory = Factory;
|
|
3105
|
+
type logger_Format = Format;
|
|
2748
3106
|
type logger_Handler = Handler;
|
|
2749
3107
|
type logger_InternalConfig = InternalConfig;
|
|
2750
3108
|
type logger_Level = Level;
|
|
@@ -2753,7 +3111,7 @@ type logger_LogContext = LogContext;
|
|
|
2753
3111
|
type logger_LogFn = LogFn;
|
|
2754
3112
|
type logger_ThrowFn = ThrowFn;
|
|
2755
3113
|
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 };
|
|
3114
|
+
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
3115
|
}
|
|
2758
3116
|
|
|
2759
3117
|
/** Collector state mapping for the `on` actions. */
|
|
@@ -2964,7 +3322,7 @@ interface Config$1<T extends TypesGeneric$1 = Types$1> extends Config$7<Mapping<
|
|
|
2964
3322
|
async?: boolean | Record<string, boolean>;
|
|
2965
3323
|
/** Mark as primary source; its push function becomes the exported `elb` from startFlow. */
|
|
2966
3324
|
primary?: boolean;
|
|
2967
|
-
/**
|
|
3325
|
+
/** Collector events (e.g., `['consent']`) that must fire before the source receives on() calls; init and event capture are not delayed. */
|
|
2968
3326
|
require?: string[];
|
|
2969
3327
|
/**
|
|
2970
3328
|
* Provisioning options for `walkeros setup`. `boolean | object`.
|
|
@@ -3269,7 +3627,7 @@ interface Instance$1<T extends TypesGeneric = Types> {
|
|
|
3269
3627
|
destroy?: DestroyFn<Config<T>, Env<T>>;
|
|
3270
3628
|
}
|
|
3271
3629
|
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 |
|
|
3630
|
+
type InitFn<T extends TypesGeneric = Types> = (context: Context<T>) => PromiseOrValue<void | Config<T>>;
|
|
3273
3631
|
type InitStore<T extends TypesGeneric = Types> = {
|
|
3274
3632
|
code: Init<T>;
|
|
3275
3633
|
config?: Partial<Config<T>>;
|
|
@@ -3698,10 +4056,13 @@ type SendDataValue = Property | Properties;
|
|
|
3698
4056
|
type SendHeaders = {
|
|
3699
4057
|
[key: string]: string;
|
|
3700
4058
|
};
|
|
4059
|
+
/**
|
|
4060
|
+
* What a transport helper (`sendWeb`, `sendServer`) resolves on success: the
|
|
4061
|
+
* response body, parsed as JSON where it parses. A failure throws a
|
|
4062
|
+
* `StepError` (code, status, retryable, body) instead.
|
|
4063
|
+
*/
|
|
3701
4064
|
interface SendResponse {
|
|
3702
|
-
ok: boolean;
|
|
3703
4065
|
data?: unknown;
|
|
3704
|
-
error?: string;
|
|
3705
4066
|
}
|
|
3706
4067
|
|
|
3707
4068
|
/**
|
|
@@ -3822,12 +4183,9 @@ interface JourneyBranch {
|
|
|
3822
4183
|
/** Wall-clock duration of the branch, when measured. */
|
|
3823
4184
|
durationMs?: number;
|
|
3824
4185
|
/** Skip discriminator when the branch was skipped. */
|
|
3825
|
-
skipReason?: '
|
|
4186
|
+
skipReason?: FlowState['skipReason'];
|
|
3826
4187
|
/** Error info when the branch failed. */
|
|
3827
|
-
error?:
|
|
3828
|
-
name?: string;
|
|
3829
|
-
message: string;
|
|
3830
|
-
};
|
|
4188
|
+
error?: FlowState['error'];
|
|
3831
4189
|
/** Outbound payload of the branch, when captured. */
|
|
3832
4190
|
out?: unknown;
|
|
3833
4191
|
/** Vendor calls recorded on the branch's out record, when captured. */
|
|
@@ -3864,12 +4222,9 @@ interface JourneyHop {
|
|
|
3864
4222
|
/** Outbound event/payload for the hop, when captured (trace level). */
|
|
3865
4223
|
out?: unknown;
|
|
3866
4224
|
/** Error info when the hop's terminal phase is error. */
|
|
3867
|
-
error?:
|
|
3868
|
-
name?: string;
|
|
3869
|
-
message: string;
|
|
3870
|
-
};
|
|
4225
|
+
error?: FlowState['error'];
|
|
3871
4226
|
/** Skip discriminator when the hop's terminal phase is skip. */
|
|
3872
|
-
skipReason?: '
|
|
4227
|
+
skipReason?: FlowState['skipReason'];
|
|
3873
4228
|
/** Matched mapping rule, when one matched. */
|
|
3874
4229
|
mappingKey?: string;
|
|
3875
4230
|
/** Matched contract rule, when one matched. */
|
|
@@ -4045,11 +4400,11 @@ declare const SECRET_MARKER_PREFIX = "__WALKEROS_SECRET:";
|
|
|
4045
4400
|
interface ResolveOptions {
|
|
4046
4401
|
deferred?: boolean;
|
|
4047
4402
|
/**
|
|
4048
|
-
* The only source for non-deferred `$env` references
|
|
4049
|
-
*
|
|
4050
|
-
*
|
|
4051
|
-
*
|
|
4052
|
-
*
|
|
4403
|
+
* The only source for non-deferred `$env` references: `$env.NAME` reads
|
|
4404
|
+
* this map, then the inline `:default`, and never the ambient environment
|
|
4405
|
+
* (`process.env`). Without it, a non-deferred `$env.NAME` takes its default
|
|
4406
|
+
* or throws `FlowReferenceError`. A runtime that means its own environment
|
|
4407
|
+
* passes it explicitly (`{ env: process.env }`).
|
|
4053
4408
|
*/
|
|
4054
4409
|
env?: Readonly<Record<string, string | undefined>>;
|
|
4055
4410
|
/**
|
|
@@ -4264,6 +4619,11 @@ declare function createDestination<I extends Instance$5>(baseDestination: I, con
|
|
|
4264
4619
|
*/
|
|
4265
4620
|
declare function deepMerge<T extends Record<string, unknown>>(target: T, source: Record<string, unknown>): T;
|
|
4266
4621
|
|
|
4622
|
+
/**
|
|
4623
|
+
* Names `getEvent` knows: the standard events plus the generic default
|
|
4624
|
+
* `entity action`. Any other name does not compile.
|
|
4625
|
+
*/
|
|
4626
|
+
type StandardEventName = 'entity action' | 'cart view' | 'checkout start' | 'order complete' | 'page view' | 'product add' | 'product view' | 'product visible' | 'promotion visible' | 'session start';
|
|
4267
4627
|
/**
|
|
4268
4628
|
* Creates a complete event with default values.
|
|
4269
4629
|
* Used for testing and debugging.
|
|
@@ -4277,14 +4637,18 @@ declare function deepMerge<T extends Record<string, unknown>>(target: T, source:
|
|
|
4277
4637
|
*/
|
|
4278
4638
|
declare function createEvent(props?: DeepPartialEvent): Event;
|
|
4279
4639
|
/**
|
|
4280
|
-
* Creates a complete event with default values based on
|
|
4640
|
+
* Creates a complete standard event with default values based on its name.
|
|
4281
4641
|
* Used for testing and debugging.
|
|
4282
4642
|
*
|
|
4283
|
-
*
|
|
4643
|
+
* The output is stable: the timestamp is fixed and the id is derived from the
|
|
4644
|
+
* name (16 lowercase hex characters), so the same name gives the same event on
|
|
4645
|
+
* every call, run and day. Events with other names use `createEvent`.
|
|
4646
|
+
*
|
|
4647
|
+
* @param name - The standard event to create.
|
|
4284
4648
|
* @param props - Properties to override the default values.
|
|
4285
4649
|
* @returns A complete event.
|
|
4286
4650
|
*/
|
|
4287
|
-
declare function getEvent(name?:
|
|
4651
|
+
declare function getEvent(name?: StandardEventName, props?: DeepPartialEvent): Event;
|
|
4288
4652
|
|
|
4289
4653
|
declare function getId(length?: number, charset?: string): string;
|
|
4290
4654
|
|
|
@@ -4446,13 +4810,6 @@ declare function isCommand(entity: string): entity is "walker";
|
|
|
4446
4810
|
* @returns True if the value is defined, false otherwise.
|
|
4447
4811
|
*/
|
|
4448
4812
|
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
4813
|
/**
|
|
4457
4814
|
* Checks if a value is a function.
|
|
4458
4815
|
*
|
|
@@ -4832,7 +5189,10 @@ declare function tryCatchAsync<P extends unknown[], R>(fn: (...args: P) => R, on
|
|
|
4832
5189
|
* violations or explicit fail-stop signals.
|
|
4833
5190
|
*/
|
|
4834
5191
|
declare class FatalError extends Error {
|
|
4835
|
-
|
|
5192
|
+
cause?: unknown;
|
|
5193
|
+
constructor(message: string, options?: {
|
|
5194
|
+
cause?: unknown;
|
|
5195
|
+
});
|
|
4836
5196
|
}
|
|
4837
5197
|
|
|
4838
5198
|
/**
|
|
@@ -4846,6 +5206,21 @@ declare class InvalidEventError extends Error {
|
|
|
4846
5206
|
constructor(message: string);
|
|
4847
5207
|
}
|
|
4848
5208
|
|
|
5209
|
+
/**
|
|
5210
|
+
* Default per-destination delivery timeout in ms. Applied when a destination's
|
|
5211
|
+
* `config.timeout` is `0` or undefined. A hung delivery is converted into a
|
|
5212
|
+
* counted DLQ failure after this window so one slow destination never wedges
|
|
5213
|
+
* the collector push.
|
|
5214
|
+
*/
|
|
5215
|
+
declare const DEFAULT_DESTINATION_TIMEOUT_MS = 10000;
|
|
5216
|
+
/**
|
|
5217
|
+
* Resolve the effective delivery timeout for a destination. A positive number
|
|
5218
|
+
* wins; `0` or undefined falls back to {@link DEFAULT_DESTINATION_TIMEOUT_MS}.
|
|
5219
|
+
* The collector races deliveries with it and `loadVendor` measures its vendor
|
|
5220
|
+
* deadline with it, so both use one definition.
|
|
5221
|
+
*/
|
|
5222
|
+
declare function resolveDestinationTimeout(timeout?: number): number;
|
|
5223
|
+
|
|
4849
5224
|
/**
|
|
4850
5225
|
* A utility function that wraps a function with hooks.
|
|
4851
5226
|
*
|
|
@@ -5071,7 +5446,7 @@ type VerifyParams = VerifyAudience & {
|
|
|
5071
5446
|
source: 'url' | 'storage';
|
|
5072
5447
|
/** Epoch milliseconds. Injected so tests and the server control the clock. */
|
|
5073
5448
|
now: number;
|
|
5074
|
-
/** Defaults to
|
|
5449
|
+
/** Defaults to the global crypto. Injectable for jsdom/node tests. */
|
|
5075
5450
|
crypto?: PreviewCrypto;
|
|
5076
5451
|
};
|
|
5077
5452
|
/** A grant handed over in a URL is only accepted this long after `iat`. */
|
|
@@ -5101,29 +5476,6 @@ declare const MAX_SESSION_MS: number;
|
|
|
5101
5476
|
* only ever decides which rejection reason comes back.
|
|
5102
5477
|
*/
|
|
5103
5478
|
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
5479
|
/**
|
|
5128
5480
|
* Storage slot for the observe ingest credential companion (`obsw_...`), a
|
|
5129
5481
|
* plaintext bearer credential riding the activation URL. The web arm never
|
|
@@ -5134,18 +5486,6 @@ declare const SESSION_STORAGE_KEY = "elbPreviewSession";
|
|
|
5134
5486
|
* stored activation clears.
|
|
5135
5487
|
*/
|
|
5136
5488
|
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
5489
|
|
|
5150
5490
|
/** Where a Tag Mode script comes from and whose message may request it. */
|
|
5151
5491
|
interface MoinTarget {
|
|
@@ -5157,14 +5497,6 @@ interface MoinTarget {
|
|
|
5157
5497
|
/** The link parameter that arms the loader; its value is ignored. */
|
|
5158
5498
|
declare const MOIN_PARAM = "elbMoin";
|
|
5159
5499
|
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
5500
|
|
|
5169
5501
|
/**
|
|
5170
5502
|
* Pure assembly of raw `FlowState` records into cross-runtime journeys, one per
|
|
@@ -5435,11 +5767,9 @@ interface ExampleSummary {
|
|
|
5435
5767
|
name: string;
|
|
5436
5768
|
description?: string;
|
|
5437
5769
|
}
|
|
5438
|
-
interface WalkerOSPackageMeta {
|
|
5770
|
+
interface WalkerOSPackageMeta extends Pick<Flow.PackageMeta, 'version' | 'type'> {
|
|
5439
5771
|
packageName: string;
|
|
5440
|
-
version: string;
|
|
5441
5772
|
description?: string;
|
|
5442
|
-
type?: string;
|
|
5443
5773
|
platform?: string | string[];
|
|
5444
5774
|
}
|
|
5445
5775
|
interface WalkerOSPackageInfo {
|
|
@@ -5477,6 +5807,11 @@ declare function fetchPackage(packageName: string, options?: {
|
|
|
5477
5807
|
baseUrl?: string;
|
|
5478
5808
|
client?: string;
|
|
5479
5809
|
}): Promise<WalkerOSPackage>;
|
|
5810
|
+
/**
|
|
5811
|
+
* The walkerOS metadata of a package, parsed from its walkerOS.json the same
|
|
5812
|
+
* way for every source: a CDN release or a local package on disk.
|
|
5813
|
+
*/
|
|
5814
|
+
declare function parseWalkerOSJson(walkerOSJson: Record<string, unknown>): Omit<WalkerOSPackage, 'packageName' | 'version' | 'description'>;
|
|
5480
5815
|
/**
|
|
5481
5816
|
* @deprecated Use fetchPackage instead.
|
|
5482
5817
|
* Still used by: entry.ts (validator), package-schemas.ts (MCP resource).
|
|
@@ -5488,6 +5823,15 @@ declare function fetchPackageSchema(packageName: string, options?: {
|
|
|
5488
5823
|
client?: string;
|
|
5489
5824
|
}): Promise<WalkerOSPackageInfo>;
|
|
5490
5825
|
|
|
5826
|
+
/**
|
|
5827
|
+
* The keys a named contract rule may carry, one list for the flow schema and
|
|
5828
|
+
* validate; `config-drift.test-d.ts` fails the build when it and
|
|
5829
|
+
* `Flow.ContractRule` drift apart. Sections such as `globals` or `consent`
|
|
5830
|
+
* are not among them: nothing enforces them, so a rule on those event parts
|
|
5831
|
+
* goes into `schema`. A plain literal, so a bundle that does not use it drops
|
|
5832
|
+
* it.
|
|
5833
|
+
*/
|
|
5834
|
+
declare const CONTRACT_RULE_KEYS: readonly ["extend", "tagging", "description", "events", "schema"];
|
|
5491
5835
|
/** Options for {@link resolveContracts}. */
|
|
5492
5836
|
interface ResolveContractsOptions {
|
|
5493
5837
|
/**
|
|
@@ -5715,14 +6059,27 @@ declare function toEventList(body: unknown): DeepPartialEvent[];
|
|
|
5715
6059
|
*/
|
|
5716
6060
|
declare function isBatchBody(body: unknown): boolean;
|
|
5717
6061
|
/**
|
|
5718
|
-
* The
|
|
6062
|
+
* The answer text when a resend could still deliver the event. The step and
|
|
6063
|
+
* its error stay in the collector's cause line.
|
|
6064
|
+
*/
|
|
6065
|
+
declare const EVENT_NOT_PROCESSED = "Event was not processed";
|
|
6066
|
+
/**
|
|
6067
|
+
* The answer text of a fault that threw, the push included. Its message can
|
|
6068
|
+
* carry paths, dependency names or config details, so it goes to the log only.
|
|
6069
|
+
*/
|
|
6070
|
+
declare const INTERNAL_SERVER_ERROR = "Internal server error";
|
|
6071
|
+
/**
|
|
6072
|
+
* The outcome of delivering one event, as a producer is answered.
|
|
5719
6073
|
*
|
|
5720
6074
|
* `id` is present when the event was accepted and minted one. `error` is
|
|
5721
|
-
* present when it was not accepted
|
|
6075
|
+
* present when it was not accepted, with the HTTP `status` a single event is
|
|
6076
|
+
* answered with: 400 for invalid input, 500 when a resend could still
|
|
6077
|
+
* deliver it. A batch answers through `batchResponse`.
|
|
5722
6078
|
*/
|
|
5723
6079
|
interface EventOutcome {
|
|
5724
6080
|
id?: string;
|
|
5725
6081
|
error?: string;
|
|
6082
|
+
status?: 400 | 500;
|
|
5726
6083
|
}
|
|
5727
6084
|
/** A batch response: the status to answer with, and the body to send. */
|
|
5728
6085
|
interface BatchResponse {
|
|
@@ -5751,19 +6108,33 @@ interface BatchResponse {
|
|
|
5751
6108
|
*/
|
|
5752
6109
|
declare function batchResponse(outcomes: EventOutcome[]): BatchResponse;
|
|
5753
6110
|
/**
|
|
5754
|
-
* Maps a
|
|
6111
|
+
* Maps a push result onto the outcome a producer is answered with, the one
|
|
6112
|
+
* place an HTTP source decides it (`acknowledge`):
|
|
6113
|
+
* - `ack`: accepted, with the event id. This includes a failure a resend
|
|
6114
|
+
* cannot fix: the event is in the DLQ and its cause line is logged.
|
|
6115
|
+
* - `retry`: 500 with a fixed text. The step and its error stay in the
|
|
6116
|
+
* collector's cause line; a public client cannot act on them.
|
|
6117
|
+
* - `reject`: 400 with the reason, which describes the producer's own input.
|
|
5755
6118
|
*
|
|
5756
|
-
* @param result The push result
|
|
6119
|
+
* @param result The push result.
|
|
5757
6120
|
* @returns The outcome for this event.
|
|
5758
6121
|
*/
|
|
5759
|
-
declare function pushResultToOutcome(result:
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
6122
|
+
declare function pushResultToOutcome(result: PushResult): EventOutcome;
|
|
6123
|
+
/** What a producer does with the message that carried a push. */
|
|
6124
|
+
type Acknowledgement = 'ack' | 'retry' | 'reject';
|
|
6125
|
+
/**
|
|
6126
|
+
* Decides from a push result whether a producer acks, retries or rejects the
|
|
6127
|
+
* message that carried it: invalid input is `reject`, a delivered or queued
|
|
6128
|
+
* event `ack`. A failure is `retry` when any of its reasons is retryable and
|
|
6129
|
+
* `ack` when every reason is deterministic (a redelivery cannot fix a missing
|
|
6130
|
+
* setting or a 4xx; the event is in the DLQ and its cause line is logged). A
|
|
6131
|
+
* failure without any reason is `retry`, so an unclassified failure never
|
|
6132
|
+
* deletes a message. Only `retryable` is read, never an error text.
|
|
6133
|
+
*
|
|
6134
|
+
* @param result The push result.
|
|
6135
|
+
* @returns `ack`, `retry` or `reject`.
|
|
6136
|
+
*/
|
|
6137
|
+
declare function acknowledge(result: PushResult): Acknowledgement;
|
|
5767
6138
|
|
|
5768
6139
|
/**
|
|
5769
6140
|
* Compiles a match expression into a closure for fast runtime evaluation.
|
|
@@ -6020,7 +6391,13 @@ interface CacheResult {
|
|
|
6020
6391
|
*/
|
|
6021
6392
|
declare function createMappingRoot(ingest?: Record<string, unknown>, event?: DeepPartialEvent): Root;
|
|
6022
6393
|
declare function compileCache(cache: Cache<EventCacheRule>): CompiledCache;
|
|
6023
|
-
|
|
6394
|
+
/**
|
|
6395
|
+
* Look a cache rule's key up in its store. A read that throws (a refused or
|
|
6396
|
+
* failed request, not a miss) is a MISS for that event, reported once per
|
|
6397
|
+
* cause under the store's step through the collector's cause log. Without a
|
|
6398
|
+
* collector there is nowhere to report, and the throw propagates.
|
|
6399
|
+
*/
|
|
6400
|
+
declare function checkCache(compiled: CompiledCache, store: Instance$1, context: Record<string, unknown>, namespace?: string, collector?: Instance$6): Promise<CacheResult | null>;
|
|
6024
6401
|
declare function storeCache(store: Instance$1, key: string, value: unknown, ttlSeconds: number): void;
|
|
6025
6402
|
declare function applyUpdate(value: unknown, update: Record<string, unknown> | undefined, context: Record<string, unknown>, collector: Instance$6): Promise<unknown>;
|
|
6026
6403
|
|
|
@@ -6072,16 +6449,6 @@ declare function readCacheEnvelope(stored: StoreValue | undefined, now?: () => n
|
|
|
6072
6449
|
expired: true;
|
|
6073
6450
|
} | undefined;
|
|
6074
6451
|
|
|
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
6452
|
/**
|
|
6086
6453
|
* Recursive type guard: the restored value is structurally a `StoreValue`.
|
|
6087
6454
|
* The single restore walk (`fromSerializableWith`) is JSON-derived plus
|
|
@@ -6096,15 +6463,6 @@ declare class StoreCodecError extends Error {
|
|
|
6096
6463
|
* `undefined`; this only mirrors what survives serialization.
|
|
6097
6464
|
*/
|
|
6098
6465
|
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
6466
|
|
|
6109
6467
|
/**
|
|
6110
6468
|
* Resolve a store by id. An `undefined` id falls back to the default
|
|
@@ -6135,8 +6493,11 @@ declare function compileState(state: State | State[]): State[];
|
|
|
6135
6493
|
* Each entry is fail-open: a store or resolution error is logged and the
|
|
6136
6494
|
* event is left unmutated, the chain continues. An unknown store logs an
|
|
6137
6495
|
* error and a `file: true` store is skipped with a warning. A key that does
|
|
6138
|
-
* not resolve
|
|
6139
|
-
* `
|
|
6496
|
+
* not resolve is reported at ERROR (the enrichment is lost); a store miss is
|
|
6497
|
+
* silent. A read that throws is a miss for that event (a `get` applies its
|
|
6498
|
+
* fallbacks) and is reported once per cause; a merge whose read throws skips
|
|
6499
|
+
* its write, since a blind overwrite would drop the stored fields. Only
|
|
6500
|
+
* `FatalError` rethrows (via `getMappingValue`).
|
|
6140
6501
|
*/
|
|
6141
6502
|
declare function applyState<E extends DeepPartialEvent>(states: State[], getStore: GetStore, event: E, collector: Instance$6, ingest: Record<string, unknown> | undefined): Promise<E>;
|
|
6142
6503
|
|
|
@@ -6212,6 +6573,14 @@ declare function getStepRuntimeProps(step: object, kind: Flow.StepKind): Record<
|
|
|
6212
6573
|
declare const STEP_OPERATIVE_FIELDS: {
|
|
6213
6574
|
readonly [K in Flow.StepKind]: readonly StepField<K>[];
|
|
6214
6575
|
};
|
|
6576
|
+
type StepFunctionKey = Exclude<keyof Flow.Code, 'type'>;
|
|
6577
|
+
/**
|
|
6578
|
+
* The functions inline `code` defines, each a `$code:` string. One list for
|
|
6579
|
+
* `Flow.Code`, the flow schema's `CodeSchema`, the bundler's emitter and
|
|
6580
|
+
* validate. `config-drift.test-d.ts` fails the build when it and `Flow.Code`
|
|
6581
|
+
* drift apart. A plain literal, so a bundle that does not use it drops it.
|
|
6582
|
+
*/
|
|
6583
|
+
declare const STEP_FUNCTION_KEYS: readonly ["push", "pushBatch", "init", "on", "destroy"];
|
|
6215
6584
|
type StepEntryErrorCode = 'UNKNOWN_KEY' | 'CONFLICT' | 'MISSING_PACKAGE' | 'OBSOLETE_CODE_STRING' | 'INVALID_IMPORT' | 'INVALID_CODE_SHAPE';
|
|
6216
6585
|
interface StepEntryValidation {
|
|
6217
6586
|
ok: boolean;
|
|
@@ -6220,6 +6589,11 @@ interface StepEntryValidation {
|
|
|
6220
6589
|
key?: string;
|
|
6221
6590
|
}
|
|
6222
6591
|
declare function validateStepEntry(entry: Record<string, unknown>, kind: Flow.StepKind): StepEntryValidation;
|
|
6592
|
+
/**
|
|
6593
|
+
* Every top-level key of a step entry the runtime does not know, in entry
|
|
6594
|
+
* order: the keys {@link validateStepEntry} rejects as `UNKNOWN_KEY`.
|
|
6595
|
+
*/
|
|
6596
|
+
declare function getUnknownStepKeys(entry: Record<string, unknown>, kind: Flow.StepKind): string[];
|
|
6223
6597
|
declare function isPathStepEntry(entry: Record<string, unknown>, kind: Flow.StepKind): boolean;
|
|
6224
6598
|
|
|
6225
6599
|
/**
|
|
@@ -6251,6 +6625,39 @@ declare function getTransformerMapping<M>(entry: TransformerMappingEntry<M>): M
|
|
|
6251
6625
|
*/
|
|
6252
6626
|
declare function getTransformerMappingWarnings(entry: TransformerMappingEntry): string[];
|
|
6253
6627
|
|
|
6628
|
+
/** A position a mapping runs at. */
|
|
6629
|
+
type MappingPosition = 'source' | 'transformer' | 'destination';
|
|
6630
|
+
/**
|
|
6631
|
+
* Mapping fields that do nothing at a position, one table for the three.
|
|
6632
|
+
* - transformer: the mapping only mutates the event; config `policy` and a
|
|
6633
|
+
* rule's `condition`, `policy`, `name` and `ignore` apply.
|
|
6634
|
+
* - source: only the edited event goes on; config `consent`, `policy` and a
|
|
6635
|
+
* rule's `condition`, `policy`, `name` and `ignore` apply. A rule's
|
|
6636
|
+
* `consent` is not listed here.
|
|
6637
|
+
* - destination: a rule's `extend` is merged only by a package onto its own
|
|
6638
|
+
* shipped rules (`@walkeros/transformer-ga4`'s `settings.mapping`).
|
|
6639
|
+
*/
|
|
6640
|
+
declare const MAPPING_NO_OPS: Record<MappingPosition, {
|
|
6641
|
+
config: ReadonlyArray<keyof Config$7>;
|
|
6642
|
+
rule: ReadonlyArray<keyof Rule>;
|
|
6643
|
+
}>;
|
|
6644
|
+
/**
|
|
6645
|
+
* Dotted paths of the fields in `mapping` that do nothing at `position`,
|
|
6646
|
+
* rooted at `field`. Rules in array form are indexed.
|
|
6647
|
+
*/
|
|
6648
|
+
declare function getMappingNoOpPaths(position: MappingPosition, mapping: unknown, field: string): string[];
|
|
6649
|
+
/**
|
|
6650
|
+
* Dotted paths of the `keys` set in a step config, rooted at `field`:
|
|
6651
|
+
* config-level keys (any config key, `batch` included), then each mapping
|
|
6652
|
+
* rule's keys. Rules in array form are indexed.
|
|
6653
|
+
*/
|
|
6654
|
+
declare function getMappingKeyPaths(mapping: unknown, field: string, keys: {
|
|
6655
|
+
config: ReadonlyArray<string>;
|
|
6656
|
+
rule: ReadonlyArray<keyof Rule>;
|
|
6657
|
+
}): string[];
|
|
6658
|
+
/** The message naming no-op paths at a position and what applies there. */
|
|
6659
|
+
declare function getMappingNoOpMessage(position: MappingPosition, paths: string[]): string;
|
|
6660
|
+
|
|
6254
6661
|
type StepOut = Flow.StepOut;
|
|
6255
6662
|
/**
|
|
6256
6663
|
* Format a step example's `out` as readable code for docs/app rendering.
|
|
@@ -6283,8 +6690,16 @@ declare const REF_VAR_FULL: RegExp;
|
|
|
6283
6690
|
declare const REF_VAR_INLINE: RegExp;
|
|
6284
6691
|
declare const REF_ENV: RegExp;
|
|
6285
6692
|
declare const REF_CONTRACT: RegExp;
|
|
6693
|
+
/**
|
|
6694
|
+
* Regex source (a string, not a RegExp) of the flow name a `$flow`
|
|
6695
|
+
* reference can carry: a letter or `_`, then letters, digits, `_` or `-`
|
|
6696
|
+
* (`tracking-server`). Every `$flow` pattern is built from it.
|
|
6697
|
+
*/
|
|
6698
|
+
declare const REF_FLOW_NAME = "[a-zA-Z_][a-zA-Z0-9_-]*";
|
|
6286
6699
|
/** Whole-string `$flow.<name>(.<path>)?`: cross-flow value reference. */
|
|
6287
6700
|
declare const REF_FLOW: RegExp;
|
|
6701
|
+
/** Global inline: every `$flow.<name>(.<path>)?` inside a larger string. */
|
|
6702
|
+
declare const REF_FLOW_INLINE: RegExp;
|
|
6288
6703
|
declare const REF_STORE: RegExp;
|
|
6289
6704
|
declare const REF_SECRET: RegExp;
|
|
6290
6705
|
declare const REF_CODE_PREFIX = "$code:";
|
|
@@ -6296,4 +6711,4 @@ declare const REF_CODE_PREFIX = "$code:";
|
|
|
6296
6711
|
*/
|
|
6297
6712
|
declare function scanFlowRefs(value: unknown, into?: Set<string>): Set<string>;
|
|
6298
6713
|
|
|
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,
|
|
6714
|
+
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 StepType, 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, parseWalkerOSJson, 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 };
|