@servicetitan/journey 2.1.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/__test-utils__/test-runtime.d.ts.map +1 -1
- package/dist/__test-utils__/test-runtime.js +9 -2
- package/dist/__test-utils__/test-runtime.js.map +1 -1
- package/dist/__tests__/core/sanitize.test.d.ts +2 -0
- package/dist/__tests__/core/sanitize.test.d.ts.map +1 -0
- package/dist/__tests__/hardening.test.d.ts +2 -0
- package/dist/__tests__/hardening.test.d.ts.map +1 -0
- package/dist/__tests__/integrations/host-mfe.test.d.ts +2 -0
- package/dist/__tests__/integrations/host-mfe.test.d.ts.map +1 -0
- package/dist/__tests__/integrations/use-journey-step.test.d.ts +2 -0
- package/dist/__tests__/integrations/use-journey-step.test.d.ts.map +1 -0
- package/dist/config.d.ts +57 -13
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +87 -24
- package/dist/config.js.map +1 -1
- package/dist/core/abort-error.d.ts +4 -0
- package/dist/core/abort-error.d.ts.map +1 -0
- package/dist/core/abort-error.js +22 -0
- package/dist/core/abort-error.js.map +1 -0
- package/dist/core/api.d.ts +22 -9
- package/dist/core/api.d.ts.map +1 -1
- package/dist/core/api.js +77 -30
- package/dist/core/api.js.map +1 -1
- package/dist/core/endpoint-policy.d.ts +14 -4
- package/dist/core/endpoint-policy.d.ts.map +1 -1
- package/dist/core/endpoint-policy.js +32 -1
- package/dist/core/endpoint-policy.js.map +1 -1
- package/dist/core/index.d.ts +4 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/limits.d.ts +29 -0
- package/dist/core/limits.d.ts.map +1 -0
- package/dist/core/limits.js +63 -0
- package/dist/core/limits.js.map +1 -0
- package/dist/core/request-policy.d.ts +39 -0
- package/dist/core/request-policy.d.ts.map +1 -0
- package/dist/core/request-policy.js +18 -0
- package/dist/core/request-policy.js.map +1 -0
- package/dist/core/runtime.d.ts +65 -15
- package/dist/core/runtime.d.ts.map +1 -1
- package/dist/core/runtime.js +403 -126
- package/dist/core/runtime.js.map +1 -1
- package/dist/core/sanitize.d.ts +23 -0
- package/dist/core/sanitize.d.ts.map +1 -0
- package/dist/core/sanitize.js +143 -0
- package/dist/core/sanitize.js.map +1 -0
- package/dist/core/step-tag.d.ts +25 -6
- package/dist/core/step-tag.d.ts.map +1 -1
- package/dist/core/step-tag.js +56 -10
- package/dist/core/step-tag.js.map +1 -1
- package/dist/core/types.d.ts +73 -25
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +4 -1
- package/dist/core/types.js.map +1 -1
- package/dist/global.d.ts +91 -13
- package/dist/global.d.ts.map +1 -1
- package/dist/global.js +235 -25
- package/dist/global.js.map +1 -1
- package/dist/index.d.ts +7 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/dist/integrations/axios.d.ts +5 -1
- package/dist/integrations/axios.d.ts.map +1 -1
- package/dist/integrations/axios.js +146 -34
- package/dist/integrations/axios.js.map +1 -1
- package/dist/integrations/fetch.d.ts +3 -2
- package/dist/integrations/fetch.d.ts.map +1 -1
- package/dist/integrations/fetch.js +105 -26
- package/dist/integrations/fetch.js.map +1 -1
- package/dist/integrations/http-report.d.ts +27 -0
- package/dist/integrations/http-report.d.ts.map +1 -0
- package/dist/integrations/http-report.js +123 -0
- package/dist/integrations/http-report.js.map +1 -0
- package/dist/integrations/jquery/index.d.ts +8 -4
- package/dist/integrations/jquery/index.d.ts.map +1 -1
- package/dist/integrations/jquery/index.js +26 -8
- package/dist/integrations/jquery/index.js.map +1 -1
- package/dist/integrations/jquery/instrument.d.ts +14 -5
- package/dist/integrations/jquery/instrument.d.ts.map +1 -1
- package/dist/integrations/jquery/instrument.js +111 -29
- package/dist/integrations/jquery/instrument.js.map +1 -1
- package/dist/integrations/react/context.d.ts +4 -1
- package/dist/integrations/react/context.d.ts.map +1 -1
- package/dist/integrations/react/context.js +4 -1
- package/dist/integrations/react/context.js.map +1 -1
- package/dist/integrations/react/scope.d.ts +14 -3
- package/dist/integrations/react/scope.d.ts.map +1 -1
- package/dist/integrations/react/scope.js +46 -8
- package/dist/integrations/react/scope.js.map +1 -1
- package/dist/integrations/react/stable-config-keys.d.ts +6 -0
- package/dist/integrations/react/stable-config-keys.d.ts.map +1 -0
- package/dist/integrations/react/stable-config-keys.js +21 -0
- package/dist/integrations/react/stable-config-keys.js.map +1 -0
- package/dist/integrations/react/use-journey-step.d.ts +11 -0
- package/dist/integrations/react/use-journey-step.d.ts.map +1 -0
- package/dist/integrations/react/use-journey-step.js +19 -0
- package/dist/integrations/react/use-journey-step.js.map +1 -0
- package/dist/integrations/request-key.d.ts +8 -3
- package/dist/integrations/request-key.d.ts.map +1 -1
- package/dist/integrations/request-key.js +10 -9
- package/dist/integrations/request-key.js.map +1 -1
- package/dist/integrations/soft-skip.d.ts +7 -0
- package/dist/integrations/soft-skip.d.ts.map +1 -0
- package/dist/integrations/soft-skip.js +30 -0
- package/dist/integrations/soft-skip.js.map +1 -0
- package/dist/sinks/console.d.ts.map +1 -1
- package/dist/sinks/console.js +2 -1
- package/dist/sinks/console.js.map +1 -1
- package/dist/sinks/datadog.d.ts +2 -2
- package/dist/sinks/datadog.d.ts.map +1 -1
- package/dist/sinks/datadog.js +18 -28
- package/dist/sinks/datadog.js.map +1 -1
- package/package.json +2 -4
- package/src/__test-utils__/test-runtime.ts +9 -2
- package/src/__tests__/config.test.ts +150 -31
- package/src/__tests__/core/ambient.test.ts +16 -10
- package/src/__tests__/core/api.test.ts +7 -7
- package/src/__tests__/core/define-journey.test.ts +28 -11
- package/src/__tests__/core/requests.test.ts +49 -31
- package/src/__tests__/core/runtime.test.ts +67 -20
- package/src/__tests__/core/sanitize.test.ts +69 -0
- package/src/__tests__/core/step.test.ts +132 -36
- package/src/__tests__/core/timeouts.test.ts +69 -4
- package/src/__tests__/global.test.ts +44 -3
- package/src/__tests__/hardening.test.ts +613 -0
- package/src/__tests__/integrations/axios.test.ts +247 -27
- package/src/__tests__/integrations/expose-app-journey.test.ts +9 -3
- package/src/__tests__/integrations/fetch.test.ts +153 -19
- package/src/__tests__/integrations/host-mfe.test.ts +548 -0
- package/src/__tests__/integrations/jquery.test.ts +209 -34
- package/src/__tests__/integrations/scope.test.tsx +160 -2
- package/src/__tests__/integrations/use-journey-step.test.tsx +43 -0
- package/src/__tests__/sinks/console.test.ts +9 -4
- package/src/__tests__/sinks/datadog.test.ts +48 -15
- package/src/config.ts +162 -38
- package/src/core/abort-error.ts +24 -0
- package/src/core/api.ts +83 -33
- package/src/core/endpoint-policy.ts +46 -4
- package/src/core/index.ts +12 -4
- package/src/core/limits.ts +73 -0
- package/src/core/request-policy.ts +66 -0
- package/src/core/runtime.ts +507 -133
- package/src/core/sanitize.ts +177 -0
- package/src/core/step-tag.ts +82 -12
- package/src/core/types.ts +79 -25
- package/src/global.ts +312 -42
- package/src/index.ts +17 -17
- package/src/integrations/axios.ts +183 -45
- package/src/integrations/fetch.ts +125 -39
- package/src/integrations/http-report.ts +184 -0
- package/src/integrations/jquery/index.ts +34 -10
- package/src/integrations/jquery/instrument.ts +126 -42
- package/src/integrations/react/context.ts +4 -1
- package/src/integrations/react/scope.tsx +59 -9
- package/src/integrations/react/stable-config-keys.ts +28 -0
- package/src/integrations/react/use-journey-step.ts +31 -0
- package/src/integrations/request-key.ts +18 -10
- package/src/integrations/soft-skip.ts +35 -0
- package/src/sinks/console.ts +2 -1
- package/src/sinks/datadog.ts +35 -41
package/dist/core/types.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { EndpointPolicy } from './endpoint-policy';
|
|
2
|
+
import type { JourneyHttpScore, JourneyStampOptions, RequestPolicyConfig } from './request-policy';
|
|
3
|
+
import type { JourneyStepStamp } from './step-tag';
|
|
2
4
|
/** Arbitrary tag values a developer can attach. */
|
|
3
5
|
export type TagValue = string | number | boolean;
|
|
4
6
|
/** Config for one journey — supplied by the caller (typically `<JourneyScope>` props). */
|
|
5
7
|
export interface JourneyDef {
|
|
6
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Journey name — lifecycle key, event field, and concurrency map key.
|
|
10
|
+
* Must be unique among concurrently open journeys on the same runtime
|
|
11
|
+
* (a second start with the same name restarts / excludes the previous).
|
|
12
|
+
*/
|
|
7
13
|
name: string;
|
|
8
14
|
/** Owner team (required tag). */
|
|
9
15
|
team: string;
|
|
@@ -11,16 +17,23 @@ export interface JourneyDef {
|
|
|
11
17
|
group: string;
|
|
12
18
|
/** Business component label, e.g. "checkout" — not the Datadog RUM service. */
|
|
13
19
|
service: string;
|
|
14
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Whole-journey timeout in ms.
|
|
22
|
+
* - Omit to use the runtime idle timeout default (15m unless overridden)
|
|
23
|
+
* - Set `0` to disable the journey countdown
|
|
24
|
+
* - Set `N > 0` to enforce an explicit SLO budget
|
|
25
|
+
*/
|
|
15
26
|
timeoutMs?: number;
|
|
16
27
|
/** Default per-step timeout in ms; per-call option overrides. Omit / 0 to disable. */
|
|
17
28
|
stepTimeoutMs?: number;
|
|
18
|
-
/** Slow-request threshold for this journey;
|
|
19
|
-
|
|
29
|
+
/** Slow-request threshold for this journey; omit to fall through. `0` disables latency scoring. */
|
|
30
|
+
slowRequestMs?: number;
|
|
20
31
|
/** Per-endpoint overrides for this journey (longest prefix wins over app-wide). */
|
|
21
32
|
endpoints?: readonly EndpointPolicy[];
|
|
22
|
-
/** Optional expected step names (
|
|
23
|
-
|
|
33
|
+
/** Optional expected happy-path step names (copied onto the event as `expected`). */
|
|
34
|
+
expected?: readonly string[];
|
|
35
|
+
/** Cap recorded steps for this journey; falls back to the runtime default (50). */
|
|
36
|
+
maxSteps?: number;
|
|
24
37
|
/** Custom tags on every event of this journey. */
|
|
25
38
|
tags?: Record<string, TagValue>;
|
|
26
39
|
}
|
|
@@ -28,29 +41,33 @@ export type Outcome = 'good' | 'bad' | 'excluded';
|
|
|
28
41
|
/** Handle passed to each step function. */
|
|
29
42
|
export interface StepHandle {
|
|
30
43
|
/** Resolved journey name for this step, or null if untraced. */
|
|
31
|
-
readonly
|
|
44
|
+
readonly journeyName: string | null;
|
|
32
45
|
setAttribute(key: string, value: string | number | boolean): void;
|
|
33
46
|
/** Journey-level tags without closing. */
|
|
34
47
|
setTags(tags: Record<string, TagValue>): void;
|
|
35
|
-
/** Apply optional tags then
|
|
36
|
-
|
|
37
|
-
/** Soft business Bad without throw. No-op if
|
|
38
|
-
|
|
48
|
+
/** Apply optional tags then complete the whole journey. No-op if journeyName is null. */
|
|
49
|
+
completeJourney(tags?: Record<string, TagValue>): void;
|
|
50
|
+
/** Soft business Bad without throw. Closes the whole journey. No-op if journeyName is null. */
|
|
51
|
+
failJourney(reason: string): void;
|
|
39
52
|
/**
|
|
40
|
-
* Bind this step to a request explicitly
|
|
41
|
-
* jQuery ajax settings
|
|
42
|
-
*
|
|
53
|
+
* Bind this step to a request explicitly. Pass as `{ stamp: step.stamp() }` on
|
|
54
|
+
* axios config / fetch init / jQuery ajax settings. Needed when requests fire
|
|
55
|
+
* after an await, while steps overlap, or when `autoAttributeRequests` is false.
|
|
56
|
+
* Untraced (noop) steps return `undefined`.
|
|
43
57
|
*
|
|
44
|
-
*
|
|
58
|
+
* Pass `score` (or `{ score, ignore }`) to score or skip this stamped request.
|
|
59
|
+
* Auto-attributed requests never run a score function and never set ignore.
|
|
60
|
+
*
|
|
61
|
+
* The value is a non-plain {@link JourneyStepStamp} so jQuery/axios deep-merge will
|
|
45
62
|
* not recurse into the circular StepRecord graph.
|
|
46
63
|
*/
|
|
47
|
-
|
|
48
|
-
journeyStep?: unknown;
|
|
49
|
-
};
|
|
64
|
+
stamp(scoreOrOpts?: JourneyHttpScore | JourneyStampOptions): JourneyStepStamp | undefined;
|
|
50
65
|
}
|
|
51
|
-
/** A journey name,
|
|
66
|
+
/** A journey name, a config object, or a handle (`handle.config.name`). */
|
|
52
67
|
export type JourneyNameLike = string | {
|
|
53
68
|
readonly name: string;
|
|
69
|
+
} | {
|
|
70
|
+
readonly config: JourneyDef;
|
|
54
71
|
};
|
|
55
72
|
/** First argument to journeyStep / journeyMountStep. */
|
|
56
73
|
export type JourneyStepTarget = JourneyNameLike | null | readonly JourneyNameLike[];
|
|
@@ -59,6 +76,24 @@ export interface JourneyStepOptions {
|
|
|
59
76
|
/** Timeout for this step in ms; overrides journey stepTimeoutMs. Omit / 0 to disable. */
|
|
60
77
|
timeoutMs?: number;
|
|
61
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* @internal Cross-bundle key for the engine that created a {@link JourneyState}.
|
|
81
|
+
* Host adapters read this off an MFE `step.stamp()` so abort/4xx/5xx close the owning copy.
|
|
82
|
+
*/
|
|
83
|
+
export declare const JOURNEY_ENGINE: unique symbol;
|
|
84
|
+
/**
|
|
85
|
+
* @internal Bound fail/exclude/report hooks for a journey's creating engine.
|
|
86
|
+
* Name lookup on another package copy cannot see this journey.
|
|
87
|
+
*/
|
|
88
|
+
export interface JourneyEngine {
|
|
89
|
+
/** Close this journey as bad on the creating engine — not a by-name lookup. */
|
|
90
|
+
failJourney(reason: string): void;
|
|
91
|
+
exclude(): void;
|
|
92
|
+
shouldIgnoreRequest(key: string): boolean;
|
|
93
|
+
reportBackendRequest(step: StepRecord, status: number | undefined, durationMs: number, requestKey: string): void;
|
|
94
|
+
getHttpAbortedRequestsPolicy(): RequestPolicyConfig;
|
|
95
|
+
getHttpClientErrorRequestsPolicy(): RequestPolicyConfig;
|
|
96
|
+
}
|
|
62
97
|
/** @internal Engine open-journey record — not part of the supported public API. */
|
|
63
98
|
export interface JourneyState {
|
|
64
99
|
name: string;
|
|
@@ -68,6 +103,8 @@ export interface JourneyState {
|
|
|
68
103
|
verdict: Outcome;
|
|
69
104
|
startedAt: number;
|
|
70
105
|
timeoutMs: number;
|
|
106
|
+
/** True when JourneyDef.timeoutMs was explicitly provided by caller. */
|
|
107
|
+
timeoutExplicit: boolean;
|
|
71
108
|
stepTimeoutMs?: number;
|
|
72
109
|
/**
|
|
73
110
|
* Why the journey closed as bad, else null.
|
|
@@ -78,10 +115,14 @@ export interface JourneyState {
|
|
|
78
115
|
steps: StepRecord[];
|
|
79
116
|
expected: string[] | null;
|
|
80
117
|
tags: Record<string, TagValue>;
|
|
81
|
-
|
|
118
|
+
slowRequestMs?: number;
|
|
82
119
|
endpoints?: readonly EndpointPolicy[];
|
|
83
120
|
timer: ReturnType<typeof setTimeout> | null;
|
|
84
121
|
closed: boolean;
|
|
122
|
+
maxSteps?: number;
|
|
123
|
+
/** Frozen snapshot taken at start — not the caller's original object. */
|
|
124
|
+
config: JourneyDef;
|
|
125
|
+
[JOURNEY_ENGINE]?: JourneyEngine;
|
|
85
126
|
}
|
|
86
127
|
/** @internal Engine in-flight / completed step record — not part of the supported public API. */
|
|
87
128
|
export interface StepRecord {
|
|
@@ -93,9 +134,11 @@ export interface StepRecord {
|
|
|
93
134
|
httpStatus?: number;
|
|
94
135
|
attributes: Record<string, string | number | boolean>;
|
|
95
136
|
journey: JourneyState;
|
|
137
|
+
/** True after onHttpComplete handled an abort for this step (including ignore). */
|
|
138
|
+
onHttpAborted?: boolean;
|
|
139
|
+
/** @internal Request keys attributed while this step was in flight (debug). */
|
|
140
|
+
attributedRequestKeys?: string[];
|
|
96
141
|
}
|
|
97
|
-
/** Opaque handle to a step, captured at request initiation for response attribution. */
|
|
98
|
-
export type JourneyStepRef = StepRecord;
|
|
99
142
|
export interface JourneyStepEvent {
|
|
100
143
|
name: string;
|
|
101
144
|
/** Offset from the journey start, ms. */
|
|
@@ -123,9 +166,14 @@ export interface JourneyEvent {
|
|
|
123
166
|
}
|
|
124
167
|
/** Destination for a terminal journey event. */
|
|
125
168
|
export type JourneySink = (event: JourneyEvent) => void;
|
|
126
|
-
/** Callable journey — config plus lifecycle helpers
|
|
127
|
-
export interface JourneyHandle
|
|
128
|
-
/**
|
|
169
|
+
/** Callable journey — `config` plus lifecycle helpers. Prefer this over free helpers. */
|
|
170
|
+
export interface JourneyHandle {
|
|
171
|
+
/** Same config object passed to `defineJourney` / used to start. */
|
|
172
|
+
readonly config: JourneyDef;
|
|
173
|
+
/**
|
|
174
|
+
* Always opens a new instance. If this name is already open, the previous
|
|
175
|
+
* instance is finished (Bad if it had breached, else Excluded).
|
|
176
|
+
*/
|
|
129
177
|
start(tags?: Record<string, TagValue>): void;
|
|
130
178
|
/**
|
|
131
179
|
* Record a step. Opens the journey first when it isn't already open
|
package/dist/core/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,mDAAmD;AACnD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEjD,0FAA0F;AAC1F,MAAM,WAAW,UAAU;IACvB;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mGAAmG;IACnG,aAAa,CAAC,EAAE,MAAM,CAAC;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Cross-bundle key for the engine that created a {@link JourneyState}.
|
|
3
|
+
* Host adapters read this off an MFE `step.stamp()` so abort/4xx/5xx close the owning copy.
|
|
4
|
+
*/ export const JOURNEY_ENGINE = Symbol.for('st.journey.engine');
|
|
2
5
|
|
|
3
6
|
//# sourceMappingURL=types.js.map
|
package/dist/core/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/types.ts"],"sourcesContent":["import type { EndpointPolicy } from './endpoint-policy';\n\n/** Arbitrary tag values a developer can attach. */\nexport type TagValue = string | number | boolean;\n\n/** Config for one journey — supplied by the caller (typically `<JourneyScope>` props). */\nexport interface JourneyDef {\n
|
|
1
|
+
{"version":3,"sources":["../../src/core/types.ts"],"sourcesContent":["import type { EndpointPolicy } from './endpoint-policy';\nimport type { JourneyHttpScore, JourneyStampOptions, RequestPolicyConfig } from './request-policy';\nimport type { JourneyStepStamp } from './step-tag';\n\n/** Arbitrary tag values a developer can attach. */\nexport type TagValue = string | number | boolean;\n\n/** Config for one journey — supplied by the caller (typically `<JourneyScope>` props). */\nexport interface JourneyDef {\n /**\n * Journey name — lifecycle key, event field, and concurrency map key.\n * Must be unique among concurrently open journeys on the same runtime\n * (a second start with the same name restarts / excludes the previous).\n */\n name: string;\n /** Owner team (required tag). */\n team: string;\n /** Functional area, e.g. \"sales\" (required tag). */\n group: string;\n /** Business component label, e.g. \"checkout\" — not the Datadog RUM service. */\n service: string;\n /**\n * Whole-journey timeout in ms.\n * - Omit to use the runtime idle timeout default (15m unless overridden)\n * - Set `0` to disable the journey countdown\n * - Set `N > 0` to enforce an explicit SLO budget\n */\n timeoutMs?: number;\n /** Default per-step timeout in ms; per-call option overrides. Omit / 0 to disable. */\n stepTimeoutMs?: number;\n /** Slow-request threshold for this journey; omit to fall through. `0` disables latency scoring. */\n slowRequestMs?: number;\n /** Per-endpoint overrides for this journey (longest prefix wins over app-wide). */\n endpoints?: readonly EndpointPolicy[];\n /** Optional expected happy-path step names (copied onto the event as `expected`). */\n expected?: readonly string[];\n /** Cap recorded steps for this journey; falls back to the runtime default (50). */\n maxSteps?: number;\n /** Custom tags on every event of this journey. */\n tags?: Record<string, TagValue>;\n}\n\nexport type Outcome = 'good' | 'bad' | 'excluded';\n\n/** Handle passed to each step function. */\nexport interface StepHandle {\n /** Resolved journey name for this step, or null if untraced. */\n readonly journeyName: string | null;\n setAttribute(key: string, value: string | number | boolean): void;\n /** Journey-level tags without closing. */\n setTags(tags: Record<string, TagValue>): void;\n /** Apply optional tags then complete the whole journey. No-op if journeyName is null. */\n completeJourney(tags?: Record<string, TagValue>): void;\n /** Soft business Bad without throw. Closes the whole journey. No-op if journeyName is null. */\n failJourney(reason: string): void;\n /**\n * Bind this step to a request explicitly. Pass as `{ stamp: step.stamp() }` on\n * axios config / fetch init / jQuery ajax settings. Needed when requests fire\n * after an await, while steps overlap, or when `autoAttributeRequests` is false.\n * Untraced (noop) steps return `undefined`.\n *\n * Pass `score` (or `{ score, ignore }`) to score or skip this stamped request.\n * Auto-attributed requests never run a score function and never set ignore.\n *\n * The value is a non-plain {@link JourneyStepStamp} so jQuery/axios deep-merge will\n * not recurse into the circular StepRecord graph.\n */\n stamp(scoreOrOpts?: JourneyHttpScore | JourneyStampOptions): JourneyStepStamp | undefined;\n}\n\n/** A journey name, a config object, or a handle (`handle.config.name`). */\nexport type JourneyNameLike = string | { readonly name: string } | { readonly config: JourneyDef };\n\n/** First argument to journeyStep / journeyMountStep. */\nexport type JourneyStepTarget = JourneyNameLike | null | readonly JourneyNameLike[];\n\n/** Per-call options for journeyStep. */\nexport interface JourneyStepOptions {\n /** Timeout for this step in ms; overrides journey stepTimeoutMs. Omit / 0 to disable. */\n timeoutMs?: number;\n}\n\n/**\n * @internal Cross-bundle key for the engine that created a {@link JourneyState}.\n * Host adapters read this off an MFE `step.stamp()` so abort/4xx/5xx close the owning copy.\n */\nexport const JOURNEY_ENGINE = Symbol.for('st.journey.engine');\n\n/**\n * @internal Bound fail/exclude/report hooks for a journey's creating engine.\n * Name lookup on another package copy cannot see this journey.\n */\nexport interface JourneyEngine {\n /** Close this journey as bad on the creating engine — not a by-name lookup. */\n failJourney(reason: string): void;\n exclude(): void;\n shouldIgnoreRequest(key: string): boolean;\n reportBackendRequest(\n step: StepRecord,\n status: number | undefined,\n durationMs: number,\n requestKey: string\n ): void;\n getHttpAbortedRequestsPolicy(): RequestPolicyConfig;\n getHttpClientErrorRequestsPolicy(): RequestPolicyConfig;\n}\n\n/** @internal Engine open-journey record — not part of the supported public API. */\nexport interface JourneyState {\n name: string;\n team: string;\n group: string;\n service: string;\n verdict: Outcome;\n startedAt: number;\n timeoutMs: number;\n /** True when JourneyDef.timeoutMs was explicitly provided by caller. */\n timeoutExplicit: boolean;\n stepTimeoutMs?: number;\n /**\n * Why the journey closed as bad, else null.\n * Engine: request-error | request-latency | journey-timeout | step-timeout | step-error.\n * Also any custom business reason (e.g. call-not-associated).\n */\n reason: string | null;\n steps: StepRecord[];\n expected: string[] | null;\n tags: Record<string, TagValue>;\n slowRequestMs?: number;\n endpoints?: readonly EndpointPolicy[];\n timer: ReturnType<typeof setTimeout> | null;\n closed: boolean;\n maxSteps?: number;\n /** Frozen snapshot taken at start — not the caller's original object. */\n config: JourneyDef;\n [JOURNEY_ENGINE]?: JourneyEngine;\n}\n\n/** @internal Engine in-flight / completed step record — not part of the supported public API. */\nexport interface StepRecord {\n name: string;\n startedAt: number;\n durationMs: number;\n outcome: 'good' | 'bad';\n reason?: string;\n httpStatus?: number;\n attributes: Record<string, string | number | boolean>;\n journey: JourneyState;\n /** True after onHttpComplete handled an abort for this step (including ignore). */\n onHttpAborted?: boolean;\n /** @internal Request keys attributed while this step was in flight (debug). */\n attributedRequestKeys?: string[];\n}\n\nexport interface JourneyStepEvent {\n name: string;\n /** Offset from the journey start, ms. */\n startMs: number;\n durationMs: number;\n outcome: 'good' | 'bad';\n reason?: string;\n httpStatus?: number;\n attributes?: Record<string, TagValue>;\n}\n\n/** Neutral journey event payload (journey-specific fields only; session context is host RUM globals). */\nexport interface JourneyEvent {\n journey: {\n name: string;\n team: string;\n group: string;\n service: string;\n outcome: Outcome;\n reason?: string;\n durationMs: number;\n steps: JourneyStepEvent[];\n expected?: string[];\n tags?: Record<string, TagValue>;\n };\n}\n\n/** Destination for a terminal journey event. */\nexport type JourneySink = (event: JourneyEvent) => void;\n\n/** Callable journey — `config` plus lifecycle helpers. Prefer this over free helpers. */\nexport interface JourneyHandle {\n /** Same config object passed to `defineJourney` / used to start. */\n readonly config: JourneyDef;\n /**\n * Always opens a new instance. If this name is already open, the previous\n * instance is finished (Bad if it had breached, else Excluded).\n */\n start(tags?: Record<string, TagValue>): void;\n /**\n * Record a step. Opens the journey first when it isn't already open\n * (one-shot store actions); no-op start when a `<JourneyScope>` already opened it.\n */\n step<T>(\n stepName: string,\n fn: (step: StepHandle) => T | Promise<T>,\n opts?: JourneyStepOptions\n ): Promise<T>;\n /**\n * Like `step`, deferred one microtask for mount-effect use under `<JourneyScope>`\n * (React runs child effects before parent). Also auto-starts if not already open.\n */\n mountStep<T>(\n stepName: string,\n fn: (step: StepHandle) => T | Promise<T>,\n opts?: JourneyStepOptions\n ): Promise<T>;\n complete(tags?: Record<string, TagValue>): void;\n fail(reason: string): void;\n exclude(): void;\n setTags(tags: Record<string, TagValue>): void;\n}\n"],"names":["JOURNEY_ENGINE","Symbol","for"],"mappings":"AAkFA;;;CAGC,GACD,OAAO,MAAMA,iBAAiBC,OAAOC,GAAG,CAAC,qBAAqB"}
|
package/dist/global.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { SlowRequestConfig } from './core/endpoint-policy';
|
|
2
|
+
import { type RequestPolicyConfig } from './core/request-policy';
|
|
1
3
|
import type { JourneyRuntime, JourneyRuntimeDebugSnapshot } from './core/runtime';
|
|
2
4
|
/** Force-enable journey host wiring outside go* hosts (`__stJourney.enable()`). */
|
|
3
5
|
export declare const JOURNEY_ENABLED_STORAGE_KEY = "st:journey:enabled";
|
|
@@ -5,19 +7,40 @@ export declare const JOURNEY_ENABLED_STORAGE_KEY = "st:journey:enabled";
|
|
|
5
7
|
export declare const JOURNEY_DEBUG_STORAGE_KEY = "st:journey:debug";
|
|
6
8
|
/** @internal Shared cross-bundle bag on globalThis (`rum` fallback + DevTools helpers). */
|
|
7
9
|
export declare const ST_JOURNEY_GLOBAL_KEY = "__stJourney";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
10
|
+
/** Bump when shared bag shape / policy semantics change incompatibly. */
|
|
11
|
+
export declare const ST_JOURNEY_SCHEMA_VERSION = 2;
|
|
11
12
|
export interface JourneyDebugState {
|
|
12
|
-
/**
|
|
13
|
+
/** Host default or force-enable (`isJourneyEnabled()`). */
|
|
13
14
|
enabled: boolean;
|
|
14
15
|
/** Console-logging flag (`st:journey:debug`). */
|
|
15
16
|
debug: boolean;
|
|
16
17
|
hasRum: boolean;
|
|
17
|
-
runtimes:
|
|
18
|
+
runtimes: JourneyRuntimeDebugSnapshot[];
|
|
19
|
+
}
|
|
20
|
+
/** Shared host policies visible to every package copy on the page. */
|
|
21
|
+
export interface JourneySharedPolicies {
|
|
22
|
+
slowRequests?: SlowRequestConfig;
|
|
23
|
+
/** Whether shared slowRequests were explicitly set via configureJourney. */
|
|
24
|
+
slowRequestsConfigured: boolean;
|
|
25
|
+
httpAbortedRequests: RequestPolicyConfig;
|
|
26
|
+
httpClientErrorRequests: RequestPolicyConfig;
|
|
27
|
+
autoAttributeRequests: boolean;
|
|
28
|
+
/** True after the first configureJourney that set any shared policy knob. */
|
|
29
|
+
locked: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** DevTools registration — `{ id, getSnapshot }` so older package copies can still list runtimes. */
|
|
32
|
+
export interface RuntimeRegistration {
|
|
33
|
+
id: string;
|
|
34
|
+
getSnapshot: () => JourneyRuntimeDebugSnapshot;
|
|
35
|
+
teardown?: () => void;
|
|
36
|
+
}
|
|
37
|
+
/** @internal Restore/dispose record for HTTP instrumentation. */
|
|
38
|
+
export interface InstrumentRecord {
|
|
39
|
+
disposed: boolean;
|
|
40
|
+
restore?: () => void;
|
|
18
41
|
}
|
|
19
42
|
/**
|
|
20
|
-
*
|
|
43
|
+
* Cross-bundle surface on `globalThis.__stJourney`.
|
|
21
44
|
* Prefer importing `isJourneyEnabled` / `isJourneyDebugEnabled` from the package in app code.
|
|
22
45
|
*/
|
|
23
46
|
export interface StJourneyGlobal {
|
|
@@ -26,6 +49,24 @@ export interface StJourneyGlobal {
|
|
|
26
49
|
* Prefer `DD_RUM` (ST host: `datadogGuard`).
|
|
27
50
|
*/
|
|
28
51
|
rum?: unknown;
|
|
52
|
+
/** Shared bag schema; mismatched copies warn but continue. */
|
|
53
|
+
schemaVersion?: number;
|
|
54
|
+
/** Host default enable (e.g. RUM active). Set via `setJourneyDefaultEnabled`. */
|
|
55
|
+
defaultEnabled?: boolean;
|
|
56
|
+
/** Shared configureJourney policies. */
|
|
57
|
+
policies: JourneySharedPolicies;
|
|
58
|
+
/**
|
|
59
|
+
* Bundle runtimes registered for DevTools `getDebugState()`.
|
|
60
|
+
* `{ id, getSnapshot }` so mixed package copies can list each other.
|
|
61
|
+
*/
|
|
62
|
+
runtimeRegistrations: RuntimeRegistration[];
|
|
63
|
+
/** @internal Cross-bundle instrumented axios/fetch/jquery targets. */
|
|
64
|
+
instrumentedAxios: WeakSet<object>;
|
|
65
|
+
instrumentedFetch: WeakSet<object>;
|
|
66
|
+
instrumentedJquery: WeakSet<object>;
|
|
67
|
+
/** @internal Active instrument records for teardown. */
|
|
68
|
+
instrumentRecords: InstrumentRecord[];
|
|
69
|
+
fetchRestore?: () => void;
|
|
29
70
|
enable(): void;
|
|
30
71
|
disable(): void;
|
|
31
72
|
isEnabled(): boolean;
|
|
@@ -38,25 +79,56 @@ export interface StJourneyGlobal {
|
|
|
38
79
|
*/
|
|
39
80
|
getDebugState(): JourneyDebugState;
|
|
40
81
|
}
|
|
41
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Host default for journey wiring (e.g. RUM initialized). Stored on `__stJourney` so
|
|
84
|
+
* MFEs see the same value without importing Datadog. Call once after RUM init.
|
|
85
|
+
*/
|
|
86
|
+
export declare function setJourneyDefaultEnabled(enabled: boolean): void;
|
|
87
|
+
/**
|
|
88
|
+
* True when the host default is on or force-enable is set
|
|
89
|
+
* (`st:journey:enabled` / `__stJourney.enable()`).
|
|
90
|
+
*/
|
|
42
91
|
export declare function isJourneyEnabled(): boolean;
|
|
43
92
|
/** Set the force-enable flag. Reload after calling from DevTools. */
|
|
44
93
|
export declare function enableJourney(): void;
|
|
45
94
|
/** Clear the force-enable flag. Reload after calling from DevTools. */
|
|
46
95
|
export declare function disableJourney(): void;
|
|
47
|
-
/** True when `
|
|
96
|
+
/** True when `sessionStorage['st:journey:debug'] === 'true'`. */
|
|
48
97
|
export declare function isJourneyDebugEnabled(): boolean;
|
|
49
98
|
/** Set the console-debug flag. Reload after calling from DevTools. */
|
|
50
99
|
export declare function enableJourneyDebugging(): void;
|
|
51
100
|
/** Clear the console-debug flag. Reload after calling from DevTools. */
|
|
52
101
|
export declare function disableJourneyDebugging(): void;
|
|
102
|
+
/** @internal Shared policies bag. */
|
|
103
|
+
export declare function getSharedPolicies(): JourneySharedPolicies;
|
|
104
|
+
export declare function areSharedPoliciesLocked(): boolean;
|
|
53
105
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
106
|
+
* First writer: merge `patch` into the shared bag and freeze it.
|
|
107
|
+
* Returns false when already locked (caller should overlay locally instead).
|
|
56
108
|
*/
|
|
57
|
-
export declare function
|
|
58
|
-
|
|
59
|
-
export declare function
|
|
109
|
+
export declare function seedSharedPolicies(patch: Partial<Omit<JourneySharedPolicies, 'locked'>>): boolean;
|
|
110
|
+
export declare function getAutoAttributeRequests(): boolean;
|
|
111
|
+
export declare function getHttpAbortedRequestsPolicy(): RequestPolicyConfig;
|
|
112
|
+
export declare function getHttpClientErrorRequestsPolicy(): RequestPolicyConfig;
|
|
113
|
+
export declare function getSharedSlowRequests(): SlowRequestConfig | undefined;
|
|
114
|
+
export declare function areSharedSlowRequestsConfigured(): boolean;
|
|
115
|
+
/** One-time warn when transports are wired without explicit slowRequests. */
|
|
116
|
+
export declare function warnIfSlowRequestsUnset(): void;
|
|
117
|
+
/** @internal Reset shared policies (tests / teardown). */
|
|
118
|
+
export declare function resetSharedPolicies(): void;
|
|
119
|
+
export declare function getInstrumentedAxiosSet(): WeakSet<object>;
|
|
120
|
+
export declare function getInstrumentedFetchSet(): WeakSet<object>;
|
|
121
|
+
export declare function getInstrumentedJquerySet(): WeakSet<object>;
|
|
122
|
+
export declare function registerInstrumentRecord(record: InstrumentRecord): void;
|
|
123
|
+
export declare function setFetchRestore(restore: (() => void) | undefined): void;
|
|
124
|
+
/**
|
|
125
|
+
* @internal Register this bundle's engine on `__stJourney` so DevTools can list
|
|
126
|
+
* every host/MFE copy on the page. Auto-assigns `runtime-N` when `runtime.id` is empty.
|
|
127
|
+
* Replaces an existing registration with the same id (HMR / test re-register).
|
|
128
|
+
*/
|
|
129
|
+
export declare function registerJourneyRuntime(runtime: JourneyRuntime, options?: {
|
|
130
|
+
teardown?: () => void;
|
|
131
|
+
}): void;
|
|
60
132
|
/**
|
|
61
133
|
* @internal Store a fallback RUM instance on `__stJourney.rum` when `DD_RUM` is absent.
|
|
62
134
|
* Used by `setJourneyRum`.
|
|
@@ -64,4 +136,10 @@ export declare function installJourneyGlobal(): void;
|
|
|
64
136
|
export declare function setJourneyRumFallback(rum: unknown): void;
|
|
65
137
|
/** @internal Read `__stJourney.rum` (setJourneyRum fallback). */
|
|
66
138
|
export declare function getJourneyRumFallback(): unknown;
|
|
139
|
+
/**
|
|
140
|
+
* Dispose HTTP instrumentation hooks and reset registered engines that supplied a
|
|
141
|
+
* teardown callback. Intended for tests (e.g. afterEach). Prefer `resetJourney`
|
|
142
|
+
* when you only need this bundle's engine state.
|
|
143
|
+
*/
|
|
144
|
+
export declare function teardownJourney(): void;
|
|
67
145
|
//# sourceMappingURL=global.d.ts.map
|
package/dist/global.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAElF,mFAAmF;AACnF,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAEhE,wEAAwE;AACxE,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAE5D,2FAA2F;AAC3F,eAAO,MAAM,qBAAqB,gBAAgB,CAAC;AAEnD,MAAM,
|
|
1
|
+
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAElF,mFAAmF;AACnF,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAEhE,wEAAwE;AACxE,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAE5D,2FAA2F;AAC3F,eAAO,MAAM,qBAAqB,gBAAgB,CAAC;AAEnD,yEAAyE;AACzE,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,MAAM,WAAW,iBAAiB;IAC9B,2DAA2D;IAC3D,OAAO,EAAE,OAAO,CAAC;IACjB,iDAAiD;IACjD,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,2BAA2B,EAAE,CAAC;CAC3C;AAED,sEAAsE;AACtE,MAAM,WAAW,qBAAqB;IAClC,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,4EAA4E;IAC5E,sBAAsB,EAAE,OAAO,CAAC;IAChC,mBAAmB,EAAE,mBAAmB,CAA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