@servicetitan/journey 3.0.0 → 4.0.0

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/runtime.ts"],"sourcesContent":["import {\n getAutoAttributeRequests as getSharedAutoAttributeRequests,\n getHttpAbortedRequestsPolicy as getSharedHttpAbortedRequestsPolicy,\n getHttpClientErrorRequestsPolicy as getSharedHttpClientErrorRequestsPolicy,\n getSharedSlowRequests,\n isJourneyDebugEnabled,\n} from '../global';\nimport { isCanceledError } from './abort-error';\nimport {\n resolveEndpointPolicy,\n sortEndpointsByLongestMatch,\n type SlowRequestConfig,\n} from './endpoint-policy';\nimport {\n clampMaxSteps,\n DEFAULT_MAX_STEPS,\n DEFAULT_JOURNEY_IDLE_MS,\n finiteSlowRequestMs,\n finiteTimeoutMs,\n MAX_ATTRIBUTED_REQUEST_KEYS,\n MAX_TAG_KEYS,\n resolveJourneyTimeoutMs,\n} from './limits';\nimport { assignRecord, emptyRecord, sanitizeJourneyEvent, setSafeAttribute } from './sanitize';\nimport { JourneyStepStamp, resolveStampOpts } from './step-tag';\nimport type { RequestPolicyConfig } from './request-policy';\nimport {\n JOURNEY_ENGINE,\n type JourneyDef,\n type JourneyEngine,\n type JourneyEvent,\n type JourneyNameLike,\n type JourneySink,\n type JourneyState,\n type JourneyStepEvent,\n type JourneyStepOptions,\n type JourneyStepTarget,\n type Outcome,\n type StepHandle,\n type StepRecord,\n type TagValue,\n} from './types';\n\nconst DEFAULT_SLOW_REQUESTS: SlowRequestConfig = { defaultMs: 4_000, endpoints: [] };\n\nconst noopStep: StepHandle = {\n journeyName: null,\n setAttribute() {},\n setTags() {},\n completeJourney() {},\n failJourney() {},\n stamp: () => undefined,\n};\n\nfunction toName(target: JourneyNameLike): string {\n if (typeof target === 'string') {\n return target;\n }\n return 'config' in target ? target.config.name : target.name;\n}\n\n/** @internal Private — not part of the public package API. */\nexport interface JourneyRuntimeOptions {\n /**\n * DevTools label for this engine copy (`__stJourney.getDebugState().runtimes`).\n * Auto-assigned `runtime-N` from the current `__stJourney` registration count\n * when omitted at `registerJourneyRuntime`.\n */\n id?: string;\n /** Initial sinks. Defaults to `[]` — package bootstrap installs Datadog on the module runtime. */\n sinks?: readonly JourneySink[];\n slowRequests?: SlowRequestConfig;\n /** Cap recorded steps; default 50. */\n maxSteps?: number;\n /** Default timeout when JourneyDef.timeoutMs is omitted. 0 disables idle countdown. */\n defaultJourneyIdleMs?: number;\n}\n\n/** @internal Read-only snapshot for DevTools (`__stJourney.getDebugState`; empty unless debugging). */\nexport interface JourneyRuntimeDebugSnapshot {\n id: string;\n openJourneys: readonly {\n name: string;\n team: string;\n group: string;\n service: string;\n verdict: Outcome;\n reason: string | null;\n tags: Record<string, TagValue>;\n stepsInFlight: readonly string[];\n steps: readonly {\n name: string;\n outcome: 'good' | 'bad';\n durationMs: number;\n reason?: string;\n attributedRequestKeys?: readonly string[];\n }[];\n }[];\n activeStep: { journey: string; name: string } | null;\n /** Which shared policy knobs this runtime overrode (false = inherit global). */\n policyOverlay: {\n slowRequests: boolean;\n httpAbortedRequests: boolean;\n httpClientErrorRequests: boolean;\n autoAttributeRequests: boolean;\n };\n}\n\nfunction freezeJourneyDef(config: JourneyDef, tags: Record<string, TagValue>): JourneyDef {\n const endpoints = sortEndpointsByLongestMatch(config.endpoints);\n return Object.freeze({\n ...config,\n timeoutMs: config.timeoutMs !== undefined ? finiteTimeoutMs(config.timeoutMs) : undefined,\n stepTimeoutMs:\n config.stepTimeoutMs !== undefined ? finiteTimeoutMs(config.stepTimeoutMs) : undefined,\n slowRequestMs: finiteSlowRequestMs(config.slowRequestMs),\n maxSteps: config.maxSteps !== undefined ? clampMaxSteps(config.maxSteps) : undefined,\n endpoints: endpoints ? Object.freeze([...endpoints]) : undefined,\n expected: config.expected ? Object.freeze([...config.expected]) : undefined,\n tags: Object.freeze({ ...tags }),\n });\n}\n\n/**\n * @internal Private — not part of the public package API.\n * Isolated journey engine (open journeys, ambient steps, sinks, request thresholds).\n * App code should keep using free helpers (`defineJourney`, `journeyStep`, …) — they\n * bind to the module runtime. Prefer `resetJourney()` in tests.\n */\nexport interface JourneyRuntime {\n /** DevTools id for this engine copy. Auto `runtime-N` when registered without an id. */\n readonly id: string;\n getSlowRequests(): SlowRequestConfig;\n setSlowRequests(next: SlowRequestConfig): void;\n getMaxSteps(): number;\n setMaxSteps(next: number): void;\n getDefaultJourneyIdleMs(): number;\n setDefaultJourneyIdleMs(next: number): void;\n\n setSinks(next: readonly JourneySink[]): void;\n /** First `configureJourney({ sinks })` on this runtime wins. Returns false if already set. */\n trySetConfiguredSinks(next: readonly JourneySink[]): boolean;\n addSink(sink: JourneySink): void;\n emit(payload: JourneyEvent): void;\n\n setPolicyOverlay(next: {\n slowRequests?: SlowRequestConfig;\n httpAbortedRequests?: RequestPolicyConfig;\n httpClientErrorRequests?: RequestPolicyConfig;\n autoAttributeRequests?: boolean;\n }): void;\n getAutoAttributeRequests(): boolean;\n getHttpAbortedRequestsPolicy(): RequestPolicyConfig;\n getHttpClientErrorRequestsPolicy(): RequestPolicyConfig;\n\n getOpenJourney(name: string): JourneyState | undefined;\n /** @internal DevTools snapshot of open journeys / ambient step. */\n getDebugSnapshot(): JourneyRuntimeDebugSnapshot;\n firstOpenJourneyName(names: readonly string[]): string | null;\n setJourneyTags(name: string | null, tags: Record<string, TagValue>): void;\n startJourney(config: JourneyDef): void;\n failJourney(journey: JourneyState, reason: string): void;\n completeJourney(name: string | null, tags?: Record<string, TagValue>): void;\n completeJourneyState(journey: JourneyState, tags?: Record<string, TagValue>): void;\n excludeJourney(journey: JourneyState): void;\n updateOpenJourney(config: JourneyDef): void;\n\n activeJourneyStep(): StepRecord | null;\n journeyStep<T>(\n journey: JourneyStepTarget,\n stepName: string,\n fn: (step: StepHandle) => T | Promise<T>,\n opts?: JourneyStepOptions\n ): Promise<T>;\n journeyMountStep<T>(\n journey: JourneyStepTarget,\n stepName: string,\n fn: (step: StepHandle) => T | Promise<T>,\n opts?: JourneyStepOptions\n ): Promise<T>;\n\n reportBackendRequest(\n step: StepRecord | undefined,\n status: number | undefined,\n durationMs: number,\n requestKey: string\n ): void;\n /** True when this request key is ignored for the step's journey (never changes verdict). */\n shouldIgnoreRequest(journey: JourneyState, key: string): boolean;\n\n /** Close open journeys, clear ambient steps, restore default timeouts/sinks. */\n reset(options?: JourneyRuntimeOptions): void;\n}\n\nfunction bindJourneyEngine(\n api: JourneyRuntime,\n journey: JourneyState,\n shouldIgnoreRequest: (target: JourneyState, key: string) => boolean\n): JourneyEngine {\n return {\n failJourney(reason) {\n api.failJourney(journey, reason);\n },\n exclude() {\n api.excludeJourney(journey);\n },\n shouldIgnoreRequest(key) {\n return shouldIgnoreRequest(journey, key);\n },\n reportBackendRequest(step, status, durationMs, requestKey) {\n api.reportBackendRequest(step, status, durationMs, requestKey);\n },\n getHttpAbortedRequestsPolicy() {\n return api.getHttpAbortedRequestsPolicy();\n },\n getHttpClientErrorRequestsPolicy() {\n return api.getHttpClientErrorRequestsPolicy();\n },\n };\n}\n\n/**\n * @internal Private — not part of the public package API.\n * Build an isolated engine. Rarely needed — apps use the default via free helpers.\n */\nexport function createJourneyRuntime(options: JourneyRuntimeOptions = {}): JourneyRuntime {\n let id = typeof options.id === 'string' && options.id !== '' ? options.id : '';\n const journeys = new Map<string, JourneyState>();\n const inFlight = new Set<StepRecord>();\n let sinks: JourneySink[] = [...(options.sinks ?? [])];\n let sinksConfigured = false;\n let overlay: {\n slowRequests?: SlowRequestConfig;\n httpAbortedRequests?: RequestPolicyConfig;\n httpClientErrorRequests?: RequestPolicyConfig;\n autoAttributeRequests?: boolean;\n } = {};\n let slowRequests: SlowRequestConfig = {\n defaultMs: options.slowRequests?.defaultMs ?? DEFAULT_SLOW_REQUESTS.defaultMs,\n endpoints: sortEndpointsByLongestMatch(\n options.slowRequests?.endpoints ?? DEFAULT_SLOW_REQUESTS.endpoints\n ),\n };\n let maxSteps = clampMaxSteps(options.maxSteps ?? DEFAULT_MAX_STEPS);\n let defaultJourneyIdleMs = finiteTimeoutMs(\n options.defaultJourneyIdleMs ?? DEFAULT_JOURNEY_IDLE_MS\n );\n\n function getInFlightSteps(journey: JourneyState): StepRecord[] {\n const out: StepRecord[] = [];\n for (const step of inFlight) {\n if (step.journey === journey) {\n out.push(step);\n }\n }\n return out;\n }\n\n function enterStep(step: StepRecord): void {\n inFlight.add(step);\n }\n\n function leaveStep(step: StepRecord): void {\n inFlight.delete(step);\n }\n\n function releaseInFlightSteps(journey: JourneyState): void {\n for (const step of [...inFlight]) {\n if (step.journey !== journey) {\n continue;\n }\n if (step.durationMs === 0) {\n step.durationMs = Math.round(globalThis.performance.now() - step.startedAt);\n }\n inFlight.delete(step);\n }\n }\n\n function clearCountdown(journey: JourneyState): void {\n if (journey.timer != null) {\n clearTimeout(journey.timer);\n journey.timer = null;\n }\n }\n\n function emit(payload: JourneyEvent): void {\n const safePayload = sanitizeJourneyEvent(payload);\n for (const sink of sinks) {\n try {\n sink(safePayload);\n } catch {\n // One sinking throw must not block the remaining sinks.\n }\n }\n }\n\n function finish(journey: JourneyState, outcome: Outcome, reason?: string): void {\n if (journey.closed) {\n return;\n }\n journey.closed = true;\n if (journeys.get(journey.name) === journey) {\n journeys.delete(journey.name);\n }\n clearCountdown(journey);\n releaseInFlightSteps(journey);\n\n let finalReason = journey.reason ?? reason;\n let finalOutcome = outcome;\n const durationMs = Math.round(globalThis.performance.now() - journey.startedAt);\n if (journey.timeoutExplicit && journey.timeoutMs > 0 && durationMs > journey.timeoutMs) {\n finalOutcome = 'bad';\n finalReason = finalReason ?? 'journey-timeout';\n }\n\n const steps: JourneyStepEvent[] = journey.steps.map(s => ({\n name: s.name,\n startMs: Math.round(s.startedAt - journey.startedAt),\n durationMs: s.durationMs,\n outcome: s.outcome,\n ...(s.reason ? { reason: s.reason } : {}),\n ...(s.httpStatus !== undefined ? { httpStatus: s.httpStatus } : {}),\n ...(Object.keys(s.attributes).length ? { attributes: { ...s.attributes } } : {}),\n }));\n\n emit({\n journey: {\n name: journey.name,\n team: journey.team,\n group: journey.group,\n service: journey.service,\n outcome: finalOutcome,\n ...(finalReason ? { reason: finalReason } : {}),\n durationMs,\n steps,\n ...(journey.expected ? { expected: journey.expected } : {}),\n ...(Object.keys(journey.tags).length ? { tags: { ...journey.tags } } : {}),\n },\n });\n }\n\n function armCountdown(journey: JourneyState, delayMs: number = journey.timeoutMs): void {\n if (delayMs <= 0) {\n return;\n }\n journey.timer = setTimeout(() => {\n if (journey.timeoutExplicit) {\n finish(journey, 'bad', 'journey-timeout');\n return;\n }\n finish(journey, journey.verdict === 'bad' ? 'bad' : 'excluded', 'journey-idle-timeout');\n }, delayMs);\n }\n\n function effectiveSlowRequests(): SlowRequestConfig {\n return overlay.slowRequests ?? getSharedSlowRequests() ?? slowRequests;\n }\n\n function shouldIgnoreRequest(journey: JourneyState, key: string): boolean {\n return resolveEndpointPolicy(journey, effectiveSlowRequests(), key).ignore;\n }\n\n function trackAttributedKey(step: StepRecord, requestKey: string): void {\n if (!requestKey) {\n return;\n }\n step.attributedRequestKeys ??= [];\n if (step.attributedRequestKeys.length >= MAX_ATTRIBUTED_REQUEST_KEYS) {\n return;\n }\n if (!step.attributedRequestKeys.includes(requestKey)) {\n step.attributedRequestKeys.push(requestKey);\n }\n }\n\n function resolveJourneyName(journey: JourneyStepTarget): string | null {\n if (journey == null) {\n return null;\n }\n if (typeof journey === 'string' || !Array.isArray(journey)) {\n return toName(journey as JourneyNameLike);\n }\n return api.firstOpenJourneyName(journey.map(toName));\n }\n\n function configFromTarget(target: JourneyNameLike): JourneyDef | undefined {\n if (typeof target === 'string') {\n return undefined;\n }\n if ('config' in target && target.config != null && typeof target.config === 'object') {\n return target.config;\n }\n const rec = target as {\n name?: unknown;\n team?: unknown;\n group?: unknown;\n service?: unknown;\n };\n if (\n typeof rec.name === 'string' &&\n typeof rec.team === 'string' &&\n typeof rec.group === 'string' &&\n typeof rec.service === 'string'\n ) {\n return target as JourneyDef;\n }\n return undefined;\n }\n\n function maybeAutoStart(target: JourneyStepTarget): void {\n if (target == null || typeof target === 'string' || Array.isArray(target)) {\n return;\n }\n const def = configFromTarget(target as JourneyNameLike);\n if (def && !api.getOpenJourney(def.name)) {\n api.startJourney(def);\n }\n }\n\n function createStepHandle(journeyName: string, step: StepRecord): StepHandle {\n return {\n journeyName,\n setAttribute(key, value) {\n setSafeAttribute(step.attributes, key, value);\n },\n setTags(tags) {\n if (step.journey.closed) {\n return;\n }\n assignRecord(step.journey.tags, tags, MAX_TAG_KEYS);\n },\n completeJourney(tags) {\n api.completeJourneyState(step.journey, tags);\n },\n failJourney(reason) {\n api.failJourney(step.journey, reason);\n },\n // Box in JourneyStepStamp — raw StepRecord is circular and blows jQuery/axios deep-merge.\n stamp: scoreOrOpts => new JourneyStepStamp(step, resolveStampOpts(scoreOrOpts)),\n };\n }\n\n const api: JourneyRuntime = {\n get id() {\n return id;\n },\n set id(next: string) {\n id = next;\n },\n getSlowRequests() {\n return effectiveSlowRequests();\n },\n\n setSlowRequests(next) {\n slowRequests = {\n ...next,\n endpoints: sortEndpointsByLongestMatch(next.endpoints),\n };\n },\n\n getMaxSteps() {\n return maxSteps;\n },\n\n setMaxSteps(next) {\n maxSteps = clampMaxSteps(next);\n },\n\n getDefaultJourneyIdleMs() {\n return defaultJourneyIdleMs;\n },\n\n setDefaultJourneyIdleMs(next) {\n defaultJourneyIdleMs = finiteTimeoutMs(next);\n },\n\n setSinks(next) {\n sinks = [...next];\n },\n\n trySetConfiguredSinks(next) {\n if (sinksConfigured) {\n return false;\n }\n sinks = [...next];\n sinksConfigured = true;\n return true;\n },\n\n addSink(sink) {\n sinks.push(sink);\n },\n\n emit,\n\n setPolicyOverlay(next) {\n overlay = { ...overlay, ...next };\n },\n\n getAutoAttributeRequests() {\n if (overlay.autoAttributeRequests !== undefined) {\n return overlay.autoAttributeRequests;\n }\n return getSharedAutoAttributeRequests();\n },\n\n getHttpAbortedRequestsPolicy() {\n return overlay.httpAbortedRequests ?? getSharedHttpAbortedRequestsPolicy();\n },\n\n getHttpClientErrorRequestsPolicy() {\n return overlay.httpClientErrorRequests ?? getSharedHttpClientErrorRequestsPolicy();\n },\n\n getOpenJourney(name) {\n return journeys.get(name);\n },\n\n getDebugSnapshot() {\n const active = api.activeJourneyStep();\n return {\n id: api.id,\n openJourneys: [...journeys.values()].map(journey => ({\n name: journey.name,\n team: journey.team,\n group: journey.group,\n service: journey.service,\n verdict: journey.verdict,\n reason: journey.reason,\n tags: { ...journey.tags },\n stepsInFlight: getInFlightSteps(journey).map(step => step.name),\n steps: journey.steps.map(step => ({\n name: step.name,\n outcome: step.outcome,\n durationMs: step.durationMs,\n ...(step.reason ? { reason: step.reason } : {}),\n ...(step.attributedRequestKeys?.length\n ? { attributedRequestKeys: [...step.attributedRequestKeys] }\n : {}),\n })),\n })),\n activeStep: active ? { journey: active.journey.name, name: active.name } : null,\n policyOverlay: {\n slowRequests: overlay.slowRequests != null,\n httpAbortedRequests: overlay.httpAbortedRequests != null,\n httpClientErrorRequests: overlay.httpClientErrorRequests != null,\n autoAttributeRequests: overlay.autoAttributeRequests != null,\n },\n };\n },\n\n firstOpenJourneyName(names) {\n for (const name of names) {\n if (journeys.has(name)) {\n return name;\n }\n }\n return null;\n },\n\n setJourneyTags(name, tags) {\n const journey = name ? journeys.get(name) : undefined;\n if (journey) {\n assignRecord(journey.tags, tags, MAX_TAG_KEYS);\n }\n },\n\n startJourney(config) {\n const existing = journeys.get(config.name);\n if (existing) {\n finish(existing, existing.verdict === 'bad' ? 'bad' : 'excluded');\n }\n\n const tags = emptyRecord();\n assignRecord(tags, config.tags, MAX_TAG_KEYS);\n const snapshot = freezeJourneyDef(config, tags);\n const timeout = resolveJourneyTimeoutMs(snapshot.timeoutMs, defaultJourneyIdleMs);\n const journey: JourneyState = {\n config: snapshot,\n name: snapshot.name,\n team: snapshot.team,\n group: snapshot.group,\n service: snapshot.service,\n verdict: 'good',\n startedAt: globalThis.performance.now(),\n timeoutMs: timeout.ms,\n timeoutExplicit: timeout.explicit,\n stepTimeoutMs:\n snapshot.stepTimeoutMs !== undefined\n ? finiteTimeoutMs(snapshot.stepTimeoutMs)\n : undefined,\n reason: null,\n steps: [],\n expected: snapshot.expected ? [...snapshot.expected] : null,\n tags,\n slowRequestMs: finiteSlowRequestMs(snapshot.slowRequestMs),\n endpoints: snapshot.endpoints,\n timer: null,\n closed: false,\n maxSteps:\n snapshot.maxSteps !== undefined ? clampMaxSteps(snapshot.maxSteps) : undefined,\n };\n journeys.set(config.name, journey);\n journey[JOURNEY_ENGINE] = bindJourneyEngine(api, journey, shouldIgnoreRequest);\n armCountdown(journey);\n },\n\n failJourney(journey, reason) {\n if (journey.closed) {\n return;\n }\n journey.verdict = 'bad';\n journey.reason ??= reason;\n finish(journey, 'bad');\n },\n\n completeJourney(name, tags) {\n if (!name) {\n return;\n }\n const journey = journeys.get(name);\n if (journey) {\n api.completeJourneyState(journey, tags);\n }\n },\n\n completeJourneyState(journey, tags) {\n if (journey.closed) {\n return;\n }\n if (tags) {\n assignRecord(journey.tags, tags, MAX_TAG_KEYS);\n }\n finish(journey, journey.verdict === 'bad' ? 'bad' : 'good');\n },\n\n excludeJourney(journey) {\n if (journey.closed) {\n return;\n }\n finish(journey, journey.verdict === 'bad' ? 'bad' : 'excluded');\n },\n\n updateOpenJourney(config) {\n const journey = journeys.get(config.name);\n if (!journey || journey.closed) {\n return;\n }\n journey.team = config.team;\n journey.group = config.group;\n journey.service = config.service;\n const timeout = resolveJourneyTimeoutMs(config.timeoutMs, defaultJourneyIdleMs);\n journey.timeoutMs = timeout.ms;\n journey.timeoutExplicit = timeout.explicit;\n journey.stepTimeoutMs =\n config.stepTimeoutMs !== undefined\n ? finiteTimeoutMs(config.stepTimeoutMs)\n : undefined;\n journey.slowRequestMs = finiteSlowRequestMs(config.slowRequestMs);\n journey.endpoints = sortEndpointsByLongestMatch(config.endpoints);\n journey.expected = config.expected ? [...config.expected] : null;\n journey.maxSteps =\n config.maxSteps !== undefined ? clampMaxSteps(config.maxSteps) : undefined;\n if (config.tags) {\n assignRecord(journey.tags, config.tags, MAX_TAG_KEYS);\n }\n clearCountdown(journey);\n if (journey.timeoutMs <= 0) {\n return;\n }\n const elapsedMs = globalThis.performance.now() - journey.startedAt;\n const remainingMs = journey.timeoutMs - elapsedMs;\n if (remainingMs <= 0) {\n if (journey.timeoutExplicit) {\n finish(journey, 'bad', 'journey-timeout');\n return;\n }\n finish(\n journey,\n journey.verdict === 'bad' ? 'bad' : 'excluded',\n 'journey-idle-timeout'\n );\n return;\n }\n armCountdown(journey, remainingMs);\n },\n\n activeJourneyStep() {\n if (!api.getAutoAttributeRequests()) {\n return null;\n }\n if (inFlight.size !== 1) {\n return null;\n }\n return inFlight.values().next().value ?? null;\n },\n\n async journeyStep(journey, stepName, fn, opts) {\n maybeAutoStart(journey);\n const journeyName = resolveJourneyName(journey);\n const open = journeyName ? journeys.get(journeyName) : undefined;\n if (!open || !journeyName) {\n if (isJourneyDebugEnabled()) {\n // eslint-disable-next-line no-console -- debug-only untraced hint\n console.debug(`[journey] step \"${stepName}\" ran untraced (no open journey)`);\n }\n return fn(noopStep);\n }\n\n const step: StepRecord = {\n name: stepName,\n startedAt: globalThis.performance.now(),\n durationMs: 0,\n outcome: 'good',\n attributes: emptyRecord(),\n journey: open,\n };\n const cap = open.maxSteps ?? maxSteps;\n if (open.steps.length >= cap) {\n open.tags.steps_truncated = true;\n } else {\n open.steps.push(step);\n }\n\n const handle = createStepHandle(journeyName, step);\n\n const stepTimeoutMs = opts?.timeoutMs ?? open.stepTimeoutMs ?? 0;\n let timeoutTimer: ReturnType<typeof setTimeout> | null = null;\n if (stepTimeoutMs > 0) {\n timeoutTimer = setTimeout(() => {\n if (open.closed) {\n return;\n }\n step.outcome = 'bad';\n step.reason ??= 'step-timeout';\n step.attributes.timeout_ms ??= stepTimeoutMs;\n step.durationMs = Math.round(globalThis.performance.now() - step.startedAt);\n api.failJourney(open, 'step-timeout');\n }, stepTimeoutMs);\n }\n\n enterStep(step);\n try {\n return await fn(handle);\n } catch (err) {\n if (isCanceledError(err)) {\n /*\n * Attributed abort is scored in onHttpComplete. Unattributed /\n * ignored abort throws must not apply policy (empty requestKey).\n */\n } else {\n step.outcome = 'bad';\n step.reason ??= 'step-error';\n api.failJourney(open, 'step-error');\n }\n throw err;\n } finally {\n if (timeoutTimer != null) {\n clearTimeout(timeoutTimer);\n }\n if (step.durationMs === 0) {\n step.durationMs = Math.round(globalThis.performance.now() - step.startedAt);\n }\n leaveStep(step);\n }\n },\n\n async journeyMountStep(journey, stepName, fn, opts) {\n await Promise.resolve();\n return api.journeyStep(journey, stepName, fn, opts);\n },\n\n shouldIgnoreRequest,\n\n reportBackendRequest(step, status, durationMs, requestKey) {\n if (!step?.journey) {\n return;\n }\n const journey = step.journey;\n if (journey.closed) {\n return;\n }\n trackAttributedKey(step, requestKey);\n const endpointPolicy = resolveEndpointPolicy(\n journey,\n effectiveSlowRequests(),\n requestKey\n );\n if (endpointPolicy.ignore) {\n return;\n }\n\n const failed = status === undefined || status >= 500;\n const threshold = endpointPolicy.slowRequestMs;\n const slow = threshold > 0 && durationMs > threshold;\n if (!failed && !slow) {\n return;\n }\n\n const category = failed ? 'request-error' : 'request-latency';\n\n step.outcome = 'bad';\n step.reason ??= category;\n if (failed && status !== undefined) {\n step.httpStatus = status;\n }\n\n api.failJourney(journey, category);\n },\n\n reset(next = {}) {\n for (const journey of [...journeys.values()]) {\n clearCountdown(journey);\n journey.closed = true;\n }\n journeys.clear();\n inFlight.clear();\n overlay = {};\n sinksConfigured = false;\n sinks = [...(next.sinks ?? [])];\n slowRequests = {\n defaultMs: next.slowRequests?.defaultMs ?? DEFAULT_SLOW_REQUESTS.defaultMs,\n endpoints: sortEndpointsByLongestMatch(\n next.slowRequests?.endpoints ?? DEFAULT_SLOW_REQUESTS.endpoints\n ),\n };\n maxSteps =\n next.maxSteps !== undefined ? clampMaxSteps(next.maxSteps) : DEFAULT_MAX_STEPS;\n defaultJourneyIdleMs = finiteTimeoutMs(\n next.defaultJourneyIdleMs ?? DEFAULT_JOURNEY_IDLE_MS\n );\n },\n };\n\n return api;\n}\n\n/**\n * @internal Private — not part of the public package API.\n * Module-scoped engine used by free helpers. App code does not need to touch this.\n * Each host/MFE bundle gets its own copy when the package is duplicated.\n */\nexport const moduleRuntime: JourneyRuntime = createJourneyRuntime();\n\nconst noopEngine: JourneyEngine = {\n failJourney() {},\n exclude() {},\n shouldIgnoreRequest() {\n return false;\n },\n reportBackendRequest() {},\n getHttpAbortedRequestsPolicy() {\n return 'continue';\n },\n getHttpClientErrorRequestsPolicy() {\n return 'continue';\n },\n};\n\n/**\n * True when this bundle can fail/exclude/report the journey: stamped engine, or\n * this runtime's own unstamped object. False for a foreign older-copy journey.\n */\nexport function canRouteHttpToJourney(journey: JourneyState): boolean {\n return (\n journey[JOURNEY_ENGINE] != null || moduleRuntime.getOpenJourney(journey.name) === journey\n );\n}\n\n/**\n * @internal Prefer the creating engine on a journey (MFE `step.stamp()` on a host transport).\n * Falls back to this bundle's module runtime only when this runtime owns the object.\n * Unstamped foreign journeys (older package copies) are a no-op so a same-named\n * host journey is not deleted from this map.\n */\nexport function resolveJourneyEngine(journey: JourneyState): JourneyEngine {\n const stamped = journey[JOURNEY_ENGINE];\n if (stamped) {\n return stamped;\n }\n if (moduleRuntime.getOpenJourney(journey.name) !== journey) {\n return noopEngine;\n }\n return {\n failJourney(reason) {\n moduleRuntime.failJourney(journey, reason);\n },\n exclude() {\n moduleRuntime.excludeJourney(journey);\n },\n shouldIgnoreRequest(key) {\n return moduleRuntime.shouldIgnoreRequest(journey, key);\n },\n reportBackendRequest(step, status, durationMs, requestKey) {\n moduleRuntime.reportBackendRequest(step, status, durationMs, requestKey);\n },\n getHttpAbortedRequestsPolicy() {\n return moduleRuntime.getHttpAbortedRequestsPolicy();\n },\n getHttpClientErrorRequestsPolicy() {\n return moduleRuntime.getHttpClientErrorRequestsPolicy();\n },\n };\n}\n\n/**\n * @internal Reset the module engine (open journeys, ambient steps, sinks, slow-request thresholds).\n * Intended for tests — call in `beforeEach` / `afterEach` instead of manual cleanup.\n */\nexport function resetJourney(options?: JourneyRuntimeOptions): void {\n moduleRuntime.reset(options);\n}\n"],"names":["getAutoAttributeRequests","getSharedAutoAttributeRequests","getHttpAbortedRequestsPolicy","getSharedHttpAbortedRequestsPolicy","getHttpClientErrorRequestsPolicy","getSharedHttpClientErrorRequestsPolicy","getSharedSlowRequests","isJourneyDebugEnabled","isCanceledError","resolveEndpointPolicy","sortEndpointsByLongestMatch","clampMaxSteps","DEFAULT_MAX_STEPS","DEFAULT_JOURNEY_IDLE_MS","finiteSlowRequestMs","finiteTimeoutMs","MAX_ATTRIBUTED_REQUEST_KEYS","MAX_TAG_KEYS","resolveJourneyTimeoutMs","assignRecord","emptyRecord","sanitizeJourneyEvent","setSafeAttribute","JourneyStepStamp","resolveStampOpts","JOURNEY_ENGINE","DEFAULT_SLOW_REQUESTS","defaultMs","endpoints","noopStep","journeyName","setAttribute","setTags","completeJourney","failJourney","stamp","undefined","toName","target","config","name","freezeJourneyDef","tags","Object","freeze","timeoutMs","stepTimeoutMs","slowRequestMs","maxSteps","expected","bindJourneyEngine","api","journey","shouldIgnoreRequest","reason","exclude","excludeJourney","key","reportBackendRequest","step","status","durationMs","requestKey","createJourneyRuntime","options","id","journeys","Map","inFlight","Set","sinks","sinksConfigured","overlay","slowRequests","defaultJourneyIdleMs","getInFlightSteps","out","push","enterStep","add","leaveStep","delete","releaseInFlightSteps","Math","round","globalThis","performance","now","startedAt","clearCountdown","timer","clearTimeout","emit","payload","safePayload","sink","finish","outcome","closed","get","finalReason","finalOutcome","timeoutExplicit","steps","map","s","startMs","httpStatus","keys","attributes","length","team","group","service","armCountdown","delayMs","setTimeout","verdict","effectiveSlowRequests","ignore","trackAttributedKey","attributedRequestKeys","includes","resolveJourneyName","Array","isArray","firstOpenJourneyName","configFromTarget","rec","maybeAutoStart","def","getOpenJourney","startJourney","createStepHandle","value","completeJourneyState","scoreOrOpts","next","getSlowRequests","setSlowRequests","getMaxSteps","setMaxSteps","getDefaultJourneyIdleMs","setDefaultJourneyIdleMs","setSinks","trySetConfiguredSinks","addSink","setPolicyOverlay","autoAttributeRequests","httpAbortedRequests","httpClientErrorRequests","getDebugSnapshot","active","activeJourneyStep","openJourneys","values","stepsInFlight","activeStep","policyOverlay","names","has","setJourneyTags","existing","snapshot","timeout","ms","explicit","set","updateOpenJourney","elapsedMs","remainingMs","size","journeyStep","stepName","fn","opts","open","console","debug","cap","steps_truncated","handle","timeoutTimer","timeout_ms","err","journeyMountStep","Promise","resolve","endpointPolicy","failed","threshold","slow","category","reset","clear","moduleRuntime","noopEngine","canRouteHttpToJourney","resolveJourneyEngine","stamped","resetJourney"],"mappings":"AAAA,SACIA,4BAA4BC,8BAA8B,EAC1DC,gCAAgCC,kCAAkC,EAClEC,oCAAoCC,sCAAsC,EAC1EC,qBAAqB,EACrBC,qBAAqB,QAClB,YAAY;AACnB,SAASC,eAAe,QAAQ,gBAAgB;AAChD,SACIC,qBAAqB,EACrBC,2BAA2B,QAExB,oBAAoB;AAC3B,SACIC,aAAa,EACbC,iBAAiB,EACjBC,uBAAuB,EACvBC,mBAAmB,EACnBC,eAAe,EACfC,2BAA2B,EAC3BC,YAAY,EACZC,uBAAuB,QACpB,WAAW;AAClB,SAASC,YAAY,EAAEC,WAAW,EAAEC,oBAAoB,EAAEC,gBAAgB,QAAQ,aAAa;AAC/F,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,aAAa;AAEhE,SACIC,cAAc,QAcX,UAAU;AAEjB,MAAMC,wBAA2C;IAAEC,WAAW;IAAOC,WAAW,EAAE;AAAC;AAEnF,MAAMC,WAAuB;IACzBC,aAAa;IACbC,iBAAgB;IAChBC,YAAW;IACXC,oBAAmB;IACnBC,gBAAe;IACfC,OAAO,IAAMC;AACjB;AAEA,SAASC,OAAOC,MAAuB;IACnC,IAAI,OAAOA,WAAW,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;;;CAKC,GACD,OAAO,SAASkJ,qBAAqBlJ,OAAqB;IACtD,MAAMmJ,UAAUnJ,OAAO,CAAC3B,eAAe;IACvC,IAAI8K,SAAS;QACT,OAAOA;IACX;IACA,IAAIJ,cAAchE,cAAc,CAAC/E,QAAQZ,IAAI,MAAMY,SAAS;QACxD,OAAOgJ;IACX;IACA,OAAO;QACHlK,aAAYoB,MAAM;YACd6I,cAAcjK,WAAW,CAACkB,SAASE;QACvC;QACAC;YACI4I,cAAc3I,cAAc,CAACJ;QACjC;QACAC,qBAAoBI,GAAG;YACnB,OAAO0I,cAAc9I,mBAAmB,CAACD,SAASK;QACtD;QACAC,sBAAqBC,IAAI,EAAEC,MAAM,EAAEC,UAAU,EAAEC,UAAU;YACrDqI,cAAczI,oBAAoB,CAACC,MAAMC,QAAQC,YAAYC;QACjE;QACA5D;YACI,OAAOiM,cAAcjM,4BAA4B;QACrD;QACAE;YACI,OAAO+L,cAAc/L,gCAAgC;QACzD;IACJ;AACJ;AAEA;;;CAGC,GACD,OAAO,SAASoM,aAAaxI,OAA+B;IACxDmI,cAAcF,KAAK,CAACjI;AACxB"}
1
+ {"version":3,"sources":["../../src/core/runtime.ts"],"sourcesContent":["import {\n getAutoAttributeRequests as getSharedAutoAttributeRequests,\n getHttpAbortedRequestsPolicy as getSharedHttpAbortedRequestsPolicy,\n getHttpClientErrorRequestsPolicy as getSharedHttpClientErrorRequestsPolicy,\n getSharedSlowRequests,\n isJourneyDebugEnabled,\n} from '../global';\nimport { isCanceledError } from './abort-error';\nimport {\n resolveEndpointPolicy,\n sortEndpointsByLongestMatch,\n type SlowRequestConfig,\n} from './endpoint-policy';\nimport { deserializeJourneyState, projectJourneyState } from './persist';\nimport {\n clampMaxSteps,\n DEFAULT_MAX_STEPS,\n DEFAULT_JOURNEY_IDLE_MS,\n finiteSlowRequestMs,\n finiteTimeoutMs,\n MAX_ATTRIBUTED_REQUEST_KEYS,\n MAX_TAG_KEYS,\n resolveJourneyTimeoutMs,\n} from './limits';\nimport { assignRecord, emptyRecord, sanitizeJourneyEvent, setSafeAttribute } from './sanitize';\nimport { JourneyStepStamp, resolveStampOpts } from './step-tag';\nimport type { RequestPolicyConfig } from './request-policy';\nimport {\n JOURNEY_ENGINE,\n type JourneyDef,\n type JourneyEngine,\n type JourneyEvent,\n type JourneyNameLike,\n type JourneySink,\n type JourneyState,\n type JourneyStepEvent,\n type JourneyStepOptions,\n type JourneyStepTarget,\n type Outcome,\n type SerializedJourneyState,\n type StepHandle,\n type StepRecord,\n type TagValue,\n} from './types';\n\nconst DEFAULT_SLOW_REQUESTS: SlowRequestConfig = { defaultMs: 4_000, endpoints: [] };\n\nconst noopStep: StepHandle = {\n journeyName: null,\n setAttribute() {},\n setTags() {},\n completeJourney() {},\n failJourney() {},\n stamp: () => undefined,\n};\n\nfunction toName(target: JourneyNameLike): string {\n if (typeof target === 'string') {\n return target;\n }\n return 'config' in target ? target.config.name : target.name;\n}\n\n/** @internal Private — not part of the public package API. */\nexport interface JourneyRuntimeOptions {\n /**\n * DevTools label for this engine copy (`__stJourney.getDebugState().runtimes`).\n * Auto-assigned `runtime-N` from the current `__stJourney` registration count\n * when omitted at `registerJourneyRuntime`.\n */\n id?: string;\n /** Initial sinks. Defaults to `[]` — package bootstrap installs Datadog on the module runtime. */\n sinks?: readonly JourneySink[];\n slowRequests?: SlowRequestConfig;\n /** Cap recorded steps; default 50. */\n maxSteps?: number;\n /** Default timeout when JourneyDef.timeoutMs is omitted. 0 disables idle countdown. */\n defaultJourneyIdleMs?: number;\n}\n\n/** @internal Read-only snapshot for DevTools (`__stJourney.getDebugState`; empty unless debugging). */\nexport interface JourneyRuntimeDebugSnapshot {\n id: string;\n openJourneys: readonly {\n name: string;\n team: string;\n group: string;\n service: string;\n verdict: Outcome;\n reason: string | null;\n tags: Record<string, TagValue>;\n stepsInFlight: readonly string[];\n steps: readonly {\n name: string;\n outcome: 'good' | 'bad';\n durationMs: number;\n reason?: string;\n attributedRequestKeys?: readonly string[];\n }[];\n }[];\n activeStep: { journey: string; name: string } | null;\n /** Which shared policy knobs this runtime overrode (false = inherit global). */\n policyOverlay: {\n slowRequests: boolean;\n httpAbortedRequests: boolean;\n httpClientErrorRequests: boolean;\n autoAttributeRequests: boolean;\n };\n}\n\n/** @internal Freeze a caller-supplied journey def + tags snapshot. */\nexport function freezeJourneyDef(config: JourneyDef, tags: Record<string, TagValue>): JourneyDef {\n const endpoints = sortEndpointsByLongestMatch(config.endpoints);\n return Object.freeze({\n ...config,\n timeoutMs: config.timeoutMs !== undefined ? finiteTimeoutMs(config.timeoutMs) : undefined,\n stepTimeoutMs:\n config.stepTimeoutMs !== undefined ? finiteTimeoutMs(config.stepTimeoutMs) : undefined,\n slowRequestMs: finiteSlowRequestMs(config.slowRequestMs),\n maxSteps: config.maxSteps !== undefined ? clampMaxSteps(config.maxSteps) : undefined,\n endpoints: endpoints ? Object.freeze([...endpoints]) : undefined,\n expected: config.expected ? Object.freeze([...config.expected]) : undefined,\n tags: Object.freeze({ ...tags }),\n });\n}\n\n/**\n * @internal Private — not part of the public package API.\n * Isolated journey engine (open journeys, ambient steps, sinks, request thresholds).\n * App code should keep using free helpers (`defineJourney`, `journeyStep`, …) — they\n * bind to the module runtime. Prefer `resetJourney()` in tests.\n */\nexport interface JourneyRuntime {\n /** DevTools id for this engine copy. Auto `runtime-N` when registered without an id. */\n readonly id: string;\n getSlowRequests(): SlowRequestConfig;\n setSlowRequests(next: SlowRequestConfig): void;\n getMaxSteps(): number;\n setMaxSteps(next: number): void;\n getDefaultJourneyIdleMs(): number;\n setDefaultJourneyIdleMs(next: number): void;\n\n setSinks(next: readonly JourneySink[]): void;\n /** First `configureJourney({ sinks })` on this runtime wins. Returns false if already set. */\n trySetConfiguredSinks(next: readonly JourneySink[]): boolean;\n addSink(sink: JourneySink): void;\n emit(payload: JourneyEvent): void;\n\n setPolicyOverlay(next: {\n slowRequests?: SlowRequestConfig;\n httpAbortedRequests?: RequestPolicyConfig;\n httpClientErrorRequests?: RequestPolicyConfig;\n autoAttributeRequests?: boolean;\n }): void;\n getAutoAttributeRequests(): boolean;\n getHttpAbortedRequestsPolicy(): RequestPolicyConfig;\n getHttpClientErrorRequestsPolicy(): RequestPolicyConfig;\n\n getOpenJourney(name: string): JourneyState | undefined;\n /** @internal DevTools snapshot of open journeys / ambient step. */\n getDebugSnapshot(): JourneyRuntimeDebugSnapshot;\n firstOpenJourneyName(names: readonly string[]): string | null;\n setJourneyTags(name: string | null, tags: Record<string, TagValue>): void;\n startJourney(config: JourneyDef): void;\n failJourney(journey: JourneyState, reason: string): void;\n completeJourney(name: string | null, tags?: Record<string, TagValue>): void;\n completeJourneyState(journey: JourneyState, tags?: Record<string, TagValue>): void;\n excludeJourney(journey: JourneyState): void;\n updateOpenJourney(config: JourneyDef): void;\n /**\n * @internal Snapshot an open journey for cross-page transfer. Does NOT\n * close the journey. Returns `null` when no journey is open under `name`.\n */\n serializeJourneyState(name: string): SerializedJourneyState | null;\n /**\n * @internal Rehydrate a serialized journey onto this runtime. Returns\n * `null` (after emitting a `bad` `journey-timeout` event) when the journey\n * already exhausted its budget in transit.\n */\n restoreJourney(serialized: SerializedJourneyState, config: JourneyDef): JourneyState | null;\n\n activeJourneyStep(): StepRecord | null;\n journeyStep<T>(\n journey: JourneyStepTarget,\n stepName: string,\n fn: (step: StepHandle) => T | Promise<T>,\n opts?: JourneyStepOptions\n ): Promise<T>;\n journeyMountStep<T>(\n journey: JourneyStepTarget,\n stepName: string,\n fn: (step: StepHandle) => T | Promise<T>,\n opts?: JourneyStepOptions\n ): Promise<T>;\n\n reportBackendRequest(\n step: StepRecord | undefined,\n status: number | undefined,\n durationMs: number,\n requestKey: string\n ): void;\n /** True when this request key is ignored for the step's journey (never changes verdict). */\n shouldIgnoreRequest(journey: JourneyState, key: string): boolean;\n\n /** Close open journeys, clear ambient steps, restore default timeouts/sinks. */\n reset(options?: JourneyRuntimeOptions): void;\n}\n\n/** @internal Bind the fail/exclude/report hooks for a journey's creating engine. */\nexport function bindJourneyEngine(\n api: JourneyRuntime,\n journey: JourneyState,\n shouldIgnoreRequest: (target: JourneyState, key: string) => boolean\n): JourneyEngine {\n return {\n failJourney(reason) {\n api.failJourney(journey, reason);\n },\n exclude() {\n api.excludeJourney(journey);\n },\n shouldIgnoreRequest(key) {\n return shouldIgnoreRequest(journey, key);\n },\n reportBackendRequest(step, status, durationMs, requestKey) {\n api.reportBackendRequest(step, status, durationMs, requestKey);\n },\n getHttpAbortedRequestsPolicy() {\n return api.getHttpAbortedRequestsPolicy();\n },\n getHttpClientErrorRequestsPolicy() {\n return api.getHttpClientErrorRequestsPolicy();\n },\n };\n}\n\n/**\n * @internal Private — not part of the public package API.\n * Build an isolated engine. Rarely needed — apps use the default via free helpers.\n */\nexport function createJourneyRuntime(options: JourneyRuntimeOptions = {}): JourneyRuntime {\n let id = typeof options.id === 'string' && options.id !== '' ? options.id : '';\n const journeys = new Map<string, JourneyState>();\n const inFlight = new Set<StepRecord>();\n let sinks: JourneySink[] = [...(options.sinks ?? [])];\n let sinksConfigured = false;\n let overlay: {\n slowRequests?: SlowRequestConfig;\n httpAbortedRequests?: RequestPolicyConfig;\n httpClientErrorRequests?: RequestPolicyConfig;\n autoAttributeRequests?: boolean;\n } = {};\n let slowRequests: SlowRequestConfig = {\n defaultMs: options.slowRequests?.defaultMs ?? DEFAULT_SLOW_REQUESTS.defaultMs,\n endpoints: sortEndpointsByLongestMatch(\n options.slowRequests?.endpoints ?? DEFAULT_SLOW_REQUESTS.endpoints\n ),\n };\n let maxSteps = clampMaxSteps(options.maxSteps ?? DEFAULT_MAX_STEPS);\n let defaultJourneyIdleMs = finiteTimeoutMs(\n options.defaultJourneyIdleMs ?? DEFAULT_JOURNEY_IDLE_MS\n );\n\n function getInFlightSteps(journey: JourneyState): StepRecord[] {\n const out: StepRecord[] = [];\n for (const step of inFlight) {\n if (step.journey === journey) {\n out.push(step);\n }\n }\n return out;\n }\n\n function enterStep(step: StepRecord): void {\n inFlight.add(step);\n }\n\n function leaveStep(step: StepRecord): void {\n inFlight.delete(step);\n }\n\n function releaseInFlightSteps(journey: JourneyState): void {\n for (const step of [...inFlight]) {\n if (step.journey !== journey) {\n continue;\n }\n if (step.durationMs === 0) {\n step.durationMs = Math.round(globalThis.performance.now() - step.startedAt);\n }\n inFlight.delete(step);\n }\n }\n\n function clearCountdown(journey: JourneyState): void {\n if (journey.timer != null) {\n clearTimeout(journey.timer);\n journey.timer = null;\n }\n }\n\n function emit(payload: JourneyEvent): void {\n const safePayload = sanitizeJourneyEvent(payload);\n for (const sink of sinks) {\n try {\n sink(safePayload);\n } catch {\n // One sinking throw must not block the remaining sinks.\n }\n }\n }\n\n function finish(journey: JourneyState, outcome: Outcome, reason?: string): void {\n if (journey.closed) {\n return;\n }\n journey.closed = true;\n if (journeys.get(journey.name) === journey) {\n journeys.delete(journey.name);\n }\n clearCountdown(journey);\n releaseInFlightSteps(journey);\n\n let finalReason = journey.reason ?? reason;\n let finalOutcome = outcome;\n const durationMs = Math.round(globalThis.performance.now() - journey.startedAt);\n if (journey.timeoutExplicit && journey.timeoutMs > 0 && durationMs > journey.timeoutMs) {\n finalOutcome = 'bad';\n finalReason = finalReason ?? 'journey-timeout';\n }\n\n const steps: JourneyStepEvent[] = journey.steps.map(s => ({\n name: s.name,\n startMs: Math.round(s.startedAt - journey.startedAt),\n durationMs: s.durationMs,\n outcome: s.outcome,\n ...(s.reason ? { reason: s.reason } : {}),\n ...(s.httpStatus !== undefined ? { httpStatus: s.httpStatus } : {}),\n ...(Object.keys(s.attributes).length ? { attributes: { ...s.attributes } } : {}),\n }));\n\n emit({\n journey: {\n name: journey.name,\n team: journey.team,\n group: journey.group,\n service: journey.service,\n outcome: finalOutcome,\n ...(finalReason ? { reason: finalReason } : {}),\n durationMs,\n steps,\n ...(journey.expected ? { expected: journey.expected } : {}),\n ...(Object.keys(journey.tags).length ? { tags: { ...journey.tags } } : {}),\n },\n });\n }\n\n function armCountdown(journey: JourneyState, delayMs: number = journey.timeoutMs): void {\n if (delayMs <= 0) {\n return;\n }\n journey.timer = setTimeout(() => {\n if (journey.timeoutExplicit) {\n finish(journey, 'bad', 'journey-timeout');\n return;\n }\n finish(journey, journey.verdict === 'bad' ? 'bad' : 'excluded', 'journey-idle-timeout');\n }, delayMs);\n }\n\n function effectiveSlowRequests(): SlowRequestConfig {\n return overlay.slowRequests ?? getSharedSlowRequests() ?? slowRequests;\n }\n\n function shouldIgnoreRequest(journey: JourneyState, key: string): boolean {\n return resolveEndpointPolicy(journey, effectiveSlowRequests(), key).ignore;\n }\n\n function trackAttributedKey(step: StepRecord, requestKey: string): void {\n if (!requestKey) {\n return;\n }\n step.attributedRequestKeys ??= [];\n if (step.attributedRequestKeys.length >= MAX_ATTRIBUTED_REQUEST_KEYS) {\n return;\n }\n if (!step.attributedRequestKeys.includes(requestKey)) {\n step.attributedRequestKeys.push(requestKey);\n }\n }\n\n function resolveJourneyName(journey: JourneyStepTarget): string | null {\n if (journey == null) {\n return null;\n }\n if (typeof journey === 'string' || !Array.isArray(journey)) {\n return toName(journey as JourneyNameLike);\n }\n return api.firstOpenJourneyName(journey.map(toName));\n }\n\n function configFromTarget(target: JourneyNameLike): JourneyDef | undefined {\n if (typeof target === 'string') {\n return undefined;\n }\n if ('config' in target && target.config != null && typeof target.config === 'object') {\n return target.config;\n }\n const rec = target as {\n name?: unknown;\n team?: unknown;\n group?: unknown;\n service?: unknown;\n };\n if (\n typeof rec.name === 'string' &&\n typeof rec.team === 'string' &&\n typeof rec.group === 'string' &&\n typeof rec.service === 'string'\n ) {\n return target as JourneyDef;\n }\n return undefined;\n }\n\n function maybeAutoStart(target: JourneyStepTarget): void {\n if (target == null || typeof target === 'string' || Array.isArray(target)) {\n return;\n }\n const def = configFromTarget(target as JourneyNameLike);\n if (def && !api.getOpenJourney(def.name)) {\n api.startJourney(def);\n }\n }\n\n function createStepHandle(journeyName: string, step: StepRecord): StepHandle {\n return {\n journeyName,\n setAttribute(key, value) {\n setSafeAttribute(step.attributes, key, value);\n },\n setTags(tags) {\n if (step.journey.closed) {\n return;\n }\n assignRecord(step.journey.tags, tags, MAX_TAG_KEYS);\n },\n completeJourney(tags) {\n api.completeJourneyState(step.journey, tags);\n },\n failJourney(reason) {\n api.failJourney(step.journey, reason);\n },\n // Box in JourneyStepStamp — raw StepRecord is circular and blows jQuery/axios deep-merge.\n stamp: scoreOrOpts => new JourneyStepStamp(step, resolveStampOpts(scoreOrOpts)),\n };\n }\n\n const api: JourneyRuntime = {\n get id() {\n return id;\n },\n set id(next: string) {\n id = next;\n },\n getSlowRequests() {\n return effectiveSlowRequests();\n },\n\n setSlowRequests(next) {\n slowRequests = {\n ...next,\n endpoints: sortEndpointsByLongestMatch(next.endpoints),\n };\n },\n\n getMaxSteps() {\n return maxSteps;\n },\n\n setMaxSteps(next) {\n maxSteps = clampMaxSteps(next);\n },\n\n getDefaultJourneyIdleMs() {\n return defaultJourneyIdleMs;\n },\n\n setDefaultJourneyIdleMs(next) {\n defaultJourneyIdleMs = finiteTimeoutMs(next);\n },\n\n setSinks(next) {\n sinks = [...next];\n },\n\n trySetConfiguredSinks(next) {\n if (sinksConfigured) {\n return false;\n }\n sinks = [...next];\n sinksConfigured = true;\n return true;\n },\n\n addSink(sink) {\n sinks.push(sink);\n },\n\n emit,\n\n setPolicyOverlay(next) {\n overlay = { ...overlay, ...next };\n },\n\n getAutoAttributeRequests() {\n if (overlay.autoAttributeRequests !== undefined) {\n return overlay.autoAttributeRequests;\n }\n return getSharedAutoAttributeRequests();\n },\n\n getHttpAbortedRequestsPolicy() {\n return overlay.httpAbortedRequests ?? getSharedHttpAbortedRequestsPolicy();\n },\n\n getHttpClientErrorRequestsPolicy() {\n return overlay.httpClientErrorRequests ?? getSharedHttpClientErrorRequestsPolicy();\n },\n\n getOpenJourney(name) {\n return journeys.get(name);\n },\n\n getDebugSnapshot() {\n const active = api.activeJourneyStep();\n return {\n id: api.id,\n openJourneys: [...journeys.values()].map(journey => ({\n name: journey.name,\n team: journey.team,\n group: journey.group,\n service: journey.service,\n verdict: journey.verdict,\n reason: journey.reason,\n tags: { ...journey.tags },\n stepsInFlight: getInFlightSteps(journey).map(step => step.name),\n steps: journey.steps.map(step => ({\n name: step.name,\n outcome: step.outcome,\n durationMs: step.durationMs,\n ...(step.reason ? { reason: step.reason } : {}),\n ...(step.attributedRequestKeys?.length\n ? { attributedRequestKeys: [...step.attributedRequestKeys] }\n : {}),\n })),\n })),\n activeStep: active ? { journey: active.journey.name, name: active.name } : null,\n policyOverlay: {\n slowRequests: overlay.slowRequests != null,\n httpAbortedRequests: overlay.httpAbortedRequests != null,\n httpClientErrorRequests: overlay.httpClientErrorRequests != null,\n autoAttributeRequests: overlay.autoAttributeRequests != null,\n },\n };\n },\n\n firstOpenJourneyName(names) {\n for (const name of names) {\n if (journeys.has(name)) {\n return name;\n }\n }\n return null;\n },\n\n setJourneyTags(name, tags) {\n const journey = name ? journeys.get(name) : undefined;\n if (journey) {\n assignRecord(journey.tags, tags, MAX_TAG_KEYS);\n }\n },\n\n startJourney(config) {\n const existing = journeys.get(config.name);\n if (existing) {\n finish(existing, existing.verdict === 'bad' ? 'bad' : 'excluded');\n }\n\n const tags = emptyRecord();\n assignRecord(tags, config.tags, MAX_TAG_KEYS);\n const snapshot = freezeJourneyDef(config, tags);\n const timeout = resolveJourneyTimeoutMs(snapshot.timeoutMs, defaultJourneyIdleMs);\n const journey: JourneyState = {\n config: snapshot,\n name: snapshot.name,\n team: snapshot.team,\n group: snapshot.group,\n service: snapshot.service,\n verdict: 'good',\n startedAt: globalThis.performance.now(),\n timeoutMs: timeout.ms,\n timeoutExplicit: timeout.explicit,\n stepTimeoutMs:\n snapshot.stepTimeoutMs !== undefined\n ? finiteTimeoutMs(snapshot.stepTimeoutMs)\n : undefined,\n reason: null,\n steps: [],\n expected: snapshot.expected ? [...snapshot.expected] : null,\n tags,\n slowRequestMs: finiteSlowRequestMs(snapshot.slowRequestMs),\n endpoints: snapshot.endpoints,\n timer: null,\n closed: false,\n maxSteps:\n snapshot.maxSteps !== undefined ? clampMaxSteps(snapshot.maxSteps) : undefined,\n };\n journeys.set(config.name, journey);\n journey[JOURNEY_ENGINE] = bindJourneyEngine(api, journey, shouldIgnoreRequest);\n armCountdown(journey);\n },\n\n failJourney(journey, reason) {\n if (journey.closed) {\n return;\n }\n journey.verdict = 'bad';\n journey.reason ??= reason;\n finish(journey, 'bad');\n },\n\n completeJourney(name, tags) {\n if (!name) {\n return;\n }\n const journey = journeys.get(name);\n if (journey) {\n api.completeJourneyState(journey, tags);\n }\n },\n\n completeJourneyState(journey, tags) {\n if (journey.closed) {\n return;\n }\n if (tags) {\n assignRecord(journey.tags, tags, MAX_TAG_KEYS);\n }\n finish(journey, journey.verdict === 'bad' ? 'bad' : 'good');\n },\n\n excludeJourney(journey) {\n if (journey.closed) {\n return;\n }\n finish(journey, journey.verdict === 'bad' ? 'bad' : 'excluded');\n },\n\n updateOpenJourney(config) {\n const journey = journeys.get(config.name);\n if (!journey || journey.closed) {\n return;\n }\n journey.team = config.team;\n journey.group = config.group;\n journey.service = config.service;\n const timeout = resolveJourneyTimeoutMs(config.timeoutMs, defaultJourneyIdleMs);\n journey.timeoutMs = timeout.ms;\n journey.timeoutExplicit = timeout.explicit;\n journey.stepTimeoutMs =\n config.stepTimeoutMs !== undefined\n ? finiteTimeoutMs(config.stepTimeoutMs)\n : undefined;\n journey.slowRequestMs = finiteSlowRequestMs(config.slowRequestMs);\n journey.endpoints = sortEndpointsByLongestMatch(config.endpoints);\n journey.expected = config.expected ? [...config.expected] : null;\n journey.maxSteps =\n config.maxSteps !== undefined ? clampMaxSteps(config.maxSteps) : undefined;\n if (config.tags) {\n assignRecord(journey.tags, config.tags, MAX_TAG_KEYS);\n }\n clearCountdown(journey);\n if (journey.timeoutMs <= 0) {\n return;\n }\n const elapsedMs = globalThis.performance.now() - journey.startedAt;\n const remainingMs = journey.timeoutMs - elapsedMs;\n if (remainingMs <= 0) {\n if (journey.timeoutExplicit) {\n finish(journey, 'bad', 'journey-timeout');\n return;\n }\n finish(\n journey,\n journey.verdict === 'bad' ? 'bad' : 'excluded',\n 'journey-idle-timeout'\n );\n return;\n }\n armCountdown(journey, remainingMs);\n },\n\n serializeJourneyState(name) {\n const journey = journeys.get(name);\n if (!journey || journey.closed) {\n return null;\n }\n return projectJourneyState(journey);\n },\n\n restoreJourney(serialized, config) {\n // Refuse double-registration: leave an existing journey under this name in place.\n if (journeys.has(config.name)) {\n return null;\n }\n\n const journey = deserializeJourneyState(serialized, config, api, defaultJourneyIdleMs);\n\n if (journey.timeoutMs > 0) {\n const elapsedMs = globalThis.performance.now() - journey.startedAt;\n if (elapsedMs >= journey.timeoutMs) {\n // journey not yet in journeys Map — finish() handles unregistered journeys gracefully.\n if (journey.timeoutExplicit) {\n finish(journey, 'bad', 'journey-timeout');\n } else {\n finish(\n journey,\n journey.verdict === 'bad' ? 'bad' : 'excluded',\n 'journey-idle-timeout'\n );\n }\n return null;\n }\n\n journeys.set(config.name, journey);\n\n const remainingMs = journey.timeoutMs - elapsedMs;\n if (remainingMs > 0) {\n armCountdown(journey, remainingMs);\n }\n } else {\n journeys.set(config.name, journey);\n }\n\n return journey;\n },\n\n activeJourneyStep() {\n if (!api.getAutoAttributeRequests()) {\n return null;\n }\n if (inFlight.size !== 1) {\n return null;\n }\n return inFlight.values().next().value ?? null;\n },\n\n async journeyStep(journey, stepName, fn, opts) {\n maybeAutoStart(journey);\n const journeyName = resolveJourneyName(journey);\n const open = journeyName ? journeys.get(journeyName) : undefined;\n if (!open || !journeyName) {\n if (isJourneyDebugEnabled()) {\n // eslint-disable-next-line no-console -- debug-only untraced hint\n console.debug(`[journey] step \"${stepName}\" ran untraced (no open journey)`);\n }\n return fn(noopStep);\n }\n\n const step: StepRecord = {\n name: stepName,\n startedAt: globalThis.performance.now(),\n durationMs: 0,\n outcome: 'good',\n attributes: emptyRecord(),\n journey: open,\n };\n const cap = open.maxSteps ?? maxSteps;\n if (open.steps.length >= cap) {\n open.tags.steps_truncated = true;\n } else {\n open.steps.push(step);\n }\n\n const handle = createStepHandle(journeyName, step);\n\n const stepTimeoutMs = opts?.timeoutMs ?? open.stepTimeoutMs ?? 0;\n let timeoutTimer: ReturnType<typeof setTimeout> | null = null;\n if (stepTimeoutMs > 0) {\n timeoutTimer = setTimeout(() => {\n if (open.closed) {\n return;\n }\n step.outcome = 'bad';\n step.reason ??= 'step-timeout';\n step.attributes.timeout_ms ??= stepTimeoutMs;\n step.durationMs = Math.round(globalThis.performance.now() - step.startedAt);\n api.failJourney(open, 'step-timeout');\n }, stepTimeoutMs);\n }\n\n enterStep(step);\n try {\n return await fn(handle);\n } catch (err) {\n if (isCanceledError(err)) {\n /*\n * Attributed abort is scored in onHttpComplete. Unattributed /\n * ignored abort throws must not apply policy (empty requestKey).\n */\n } else {\n step.outcome = 'bad';\n step.reason ??= 'step-error';\n api.failJourney(open, 'step-error');\n }\n throw err;\n } finally {\n if (timeoutTimer != null) {\n clearTimeout(timeoutTimer);\n }\n if (step.durationMs === 0) {\n step.durationMs = Math.round(globalThis.performance.now() - step.startedAt);\n }\n leaveStep(step);\n }\n },\n\n async journeyMountStep(journey, stepName, fn, opts) {\n await Promise.resolve();\n return api.journeyStep(journey, stepName, fn, opts);\n },\n\n shouldIgnoreRequest,\n\n reportBackendRequest(step, status, durationMs, requestKey) {\n if (!step?.journey) {\n return;\n }\n const journey = step.journey;\n if (journey.closed) {\n return;\n }\n trackAttributedKey(step, requestKey);\n const endpointPolicy = resolveEndpointPolicy(\n journey,\n effectiveSlowRequests(),\n requestKey\n );\n if (endpointPolicy.ignore) {\n return;\n }\n\n const failed = status === undefined || status >= 500;\n const threshold = endpointPolicy.slowRequestMs;\n const slow = threshold > 0 && durationMs > threshold;\n if (!failed && !slow) {\n return;\n }\n\n const category = failed ? 'request-error' : 'request-latency';\n\n step.outcome = 'bad';\n step.reason ??= category;\n if (failed && status !== undefined) {\n step.httpStatus = status;\n }\n\n api.failJourney(journey, category);\n },\n\n reset(next = {}) {\n for (const journey of [...journeys.values()]) {\n clearCountdown(journey);\n journey.closed = true;\n }\n journeys.clear();\n inFlight.clear();\n overlay = {};\n sinksConfigured = false;\n sinks = [...(next.sinks ?? [])];\n slowRequests = {\n defaultMs: next.slowRequests?.defaultMs ?? DEFAULT_SLOW_REQUESTS.defaultMs,\n endpoints: sortEndpointsByLongestMatch(\n next.slowRequests?.endpoints ?? DEFAULT_SLOW_REQUESTS.endpoints\n ),\n };\n maxSteps =\n next.maxSteps !== undefined ? clampMaxSteps(next.maxSteps) : DEFAULT_MAX_STEPS;\n defaultJourneyIdleMs = finiteTimeoutMs(\n next.defaultJourneyIdleMs ?? DEFAULT_JOURNEY_IDLE_MS\n );\n },\n };\n\n return api;\n}\n\n/**\n * @internal Private — not part of the public package API.\n * Module-scoped engine used by free helpers. App code does not need to touch this.\n * Each host/MFE bundle gets its own copy when the package is duplicated.\n */\nexport const moduleRuntime: JourneyRuntime = createJourneyRuntime();\n\nconst noopEngine: JourneyEngine = {\n failJourney() {},\n exclude() {},\n shouldIgnoreRequest() {\n return false;\n },\n reportBackendRequest() {},\n getHttpAbortedRequestsPolicy() {\n return 'continue';\n },\n getHttpClientErrorRequestsPolicy() {\n return 'continue';\n },\n};\n\n/**\n * True when this bundle can fail/exclude/report the journey: stamped engine, or\n * this runtime's own unstamped object. False for a foreign older-copy journey.\n */\nexport function canRouteHttpToJourney(journey: JourneyState): boolean {\n return (\n journey[JOURNEY_ENGINE] != null || moduleRuntime.getOpenJourney(journey.name) === journey\n );\n}\n\n/**\n * @internal Prefer the creating engine on a journey (MFE `step.stamp()` on a host transport).\n * Falls back to this bundle's module runtime only when this runtime owns the object.\n * Unstamped foreign journeys (older package copies) are a no-op so a same-named\n * host journey is not deleted from this map.\n */\nexport function resolveJourneyEngine(journey: JourneyState): JourneyEngine {\n const stamped = journey[JOURNEY_ENGINE];\n if (stamped) {\n return stamped;\n }\n if (moduleRuntime.getOpenJourney(journey.name) !== journey) {\n return noopEngine;\n }\n return {\n failJourney(reason) {\n moduleRuntime.failJourney(journey, reason);\n },\n exclude() {\n moduleRuntime.excludeJourney(journey);\n },\n shouldIgnoreRequest(key) {\n return moduleRuntime.shouldIgnoreRequest(journey, key);\n },\n reportBackendRequest(step, status, durationMs, requestKey) {\n moduleRuntime.reportBackendRequest(step, status, durationMs, requestKey);\n },\n getHttpAbortedRequestsPolicy() {\n return moduleRuntime.getHttpAbortedRequestsPolicy();\n },\n getHttpClientErrorRequestsPolicy() {\n return moduleRuntime.getHttpClientErrorRequestsPolicy();\n },\n };\n}\n\n/**\n * @internal Reset the module engine (open journeys, ambient steps, sinks, slow-request thresholds).\n * Intended for tests — call in `beforeEach` / `afterEach` instead of manual cleanup.\n */\nexport function resetJourney(options?: JourneyRuntimeOptions): void {\n moduleRuntime.reset(options);\n}\n"],"names":["getAutoAttributeRequests","getSharedAutoAttributeRequests","getHttpAbortedRequestsPolicy","getSharedHttpAbortedRequestsPolicy","getHttpClientErrorRequestsPolicy","getSharedHttpClientErrorRequestsPolicy","getSharedSlowRequests","isJourneyDebugEnabled","isCanceledError","resolveEndpointPolicy","sortEndpointsByLongestMatch","deserializeJourneyState","projectJourneyState","clampMaxSteps","DEFAULT_MAX_STEPS","DEFAULT_JOURNEY_IDLE_MS","finiteSlowRequestMs","finiteTimeoutMs","MAX_ATTRIBUTED_REQUEST_KEYS","MAX_TAG_KEYS","resolveJourneyTimeoutMs","assignRecord","emptyRecord","sanitizeJourneyEvent","setSafeAttribute","JourneyStepStamp","resolveStampOpts","JOURNEY_ENGINE","DEFAULT_SLOW_REQUESTS","defaultMs","endpoints","noopStep","journeyName","setAttribute","setTags","completeJourney","failJourney","stamp","undefined","toName","target","config","name","freezeJourneyDef","tags","Object","freeze","timeoutMs","stepTimeoutMs","slowRequestMs","maxSteps","expected","bindJourneyEngine","api","journey","shouldIgnoreRequest","reason","exclude","excludeJourney","key","reportBackendRequest","step","status","durationMs","requestKey","createJourneyRuntime","options","id","journeys","Map","inFlight","Set","sinks","sinksConfigured","overlay","slowRequests","defaultJourneyIdleMs","getInFlightSteps","out","push","enterStep","add","leaveStep","delete","releaseInFlightSteps","Math","round","globalThis","performance","now","startedAt","clearCountdown","timer","clearTimeout","emit","payload","safePayload","sink","finish","outcome","closed","get","finalReason","finalOutcome","timeoutExplicit","steps","map","s","startMs","httpStatus","keys","attributes","length","team","group","service","armCountdown","delayMs","setTimeout","verdict","effectiveSlowRequests","ignore","trackAttributedKey","attributedRequestKeys","includes","resolveJourneyName","Array","isArray","firstOpenJourneyName","configFromTarget","rec","maybeAutoStart","def","getOpenJourney","startJourney","createStepHandle","value","completeJourneyState","scoreOrOpts","next","getSlowRequests","setSlowRequests","getMaxSteps","setMaxSteps","getDefaultJourneyIdleMs","setDefaultJourneyIdleMs","setSinks","trySetConfiguredSinks","addSink","setPolicyOverlay","autoAttributeRequests","httpAbortedRequests","httpClientErrorRequests","getDebugSnapshot","active","activeJourneyStep","openJourneys","values","stepsInFlight","activeStep","policyOverlay","names","has","setJourneyTags","existing","snapshot","timeout","ms","explicit","set","updateOpenJourney","elapsedMs","remainingMs","serializeJourneyState","restoreJourney","serialized","size","journeyStep","stepName","fn","opts","open","console","debug","cap","steps_truncated","handle","timeoutTimer","timeout_ms","err","journeyMountStep","Promise","resolve","endpointPolicy","failed","threshold","slow","category","reset","clear","moduleRuntime","noopEngine","canRouteHttpToJourney","resolveJourneyEngine","stamped","resetJourney"],"mappings":"AAAA,SACIA,4BAA4BC,8BAA8B,EAC1DC,gCAAgCC,kCAAkC,EAClEC,oCAAoCC,sCAAsC,EAC1EC,qBAAqB,EACrBC,qBAAqB,QAClB,YAAY;AACnB,SAASC,eAAe,QAAQ,gBAAgB;AAChD,SACIC,qBAAqB,EACrBC,2BAA2B,QAExB,oBAAoB;AAC3B,SAASC,uBAAuB,EAAEC,mBAAmB,QAAQ,YAAY;AACzE,SACIC,aAAa,EACbC,iBAAiB,EACjBC,uBAAuB,EACvBC,mBAAmB,EACnBC,eAAe,EACfC,2BAA2B,EAC3BC,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AAEA;;;CAGC,GACD,OAAO,SAASsM,sBAAsBpJ,OAAqB;IACvD,OACIA,OAAO,CAAC3B,eAAe,IAAI,QAAQ6K,cAAcnE,cAAc,CAAC/E,QAAQZ,IAAI,MAAMY;AAE1F;AAEA;;;;;CAKC,GACD,OAAO,SAASqJ,qBAAqBrJ,OAAqB;IACtD,MAAMsJ,UAAUtJ,OAAO,CAAC3B,eAAe;IACvC,IAAIiL,SAAS;QACT,OAAOA;IACX;IACA,IAAIJ,cAAcnE,cAAc,CAAC/E,QAAQZ,IAAI,MAAMY,SAAS;QACxD,OAAOmJ;IACX;IACA,OAAO;QACHrK,aAAYoB,MAAM;YACdgJ,cAAcpK,WAAW,CAACkB,SAASE;QACvC;QACAC;YACI+I,cAAc9I,cAAc,CAACJ;QACjC;QACAC,qBAAoBI,GAAG;YACnB,OAAO6I,cAAcjJ,mBAAmB,CAACD,SAASK;QACtD;QACAC,sBAAqBC,IAAI,EAAEC,MAAM,EAAEC,UAAU,EAAEC,UAAU;YACrDwI,cAAc5I,oBAAoB,CAACC,MAAMC,QAAQC,YAAYC;QACjE;QACA9D;YACI,OAAOsM,cAActM,4BAA4B;QACrD;QACAE;YACI,OAAOoM,cAAcpM,gCAAgC;QACzD;IACJ;AACJ;AAEA;;;CAGC,GACD,OAAO,SAASyM,aAAa3I,OAA+B;IACxDsI,cAAcF,KAAK,CAACpI;AACxB"}
@@ -149,6 +149,31 @@ export interface JourneyStepEvent {
149
149
  httpStatus?: number;
150
150
  attributes?: Record<string, TagValue>;
151
151
  }
152
+ /**
153
+ * Snapshot of an open journey that can survive a page navigation. Produced by
154
+ * `serializeJourneyState` and rehydrated by `restoreJourney`. Mirrors the
155
+ * `JourneyStepEvent` projection emitted by `finish()`, plus the wall-clock
156
+ * start time, verdict, reason, and tags needed to re-arm the countdown.
157
+ */
158
+ export interface SerializedJourneyState {
159
+ /** `st_journey_id` tag — cross-page correlation key. Empty string when unset. */
160
+ stJourneyId: string;
161
+ /** Wall-clock epoch (Date.now()) when the journey started. */
162
+ startedAtEpoch: number;
163
+ verdict: 'good' | 'bad';
164
+ reason: string | null;
165
+ steps: {
166
+ name: string;
167
+ /** Offset from the journey start, ms. */
168
+ startMs: number;
169
+ durationMs: number;
170
+ outcome: 'good' | 'bad';
171
+ reason?: string;
172
+ httpStatus?: number;
173
+ attributes?: Record<string, TagValue>;
174
+ }[];
175
+ tags: Record<string, TagValue>;
176
+ }
152
177
  /** Neutral journey event payload (journey-specific fields only; session context is host RUM globals). */
153
178
  export interface JourneyEvent {
154
179
  journey: {
@@ -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;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;IACvB,mFAAmF;IACnF,SAAS,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IACtC,qFAAqF;IACrF,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,mFAAmF;IACnF,QAAQ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gD;AAChD,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;AAExD,yFAAyF;AACzF,MAAM,WAAW,aAAa;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC;IAC7C;;;OAGG;IACH,IAAI,CAAC,CAAC,EACF,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EACxC,IAAI,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,CAAC,CAAC,CAAC;IACd;;;OAGG;IACH,SAAS,CAAC,CAAC,EACP,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EACxC,IAAI,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,CAAC,CAAC,CAAC;IACd,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC;IAChD,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,IAAI,IAAI,CAAC;IAChB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC;CACjD"}
@@ -1 +1 @@
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"}
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/**\n * Snapshot of an open journey that can survive a page navigation. Produced by\n * `serializeJourneyState` and rehydrated by `restoreJourney`. Mirrors the\n * `JourneyStepEvent` projection emitted by `finish()`, plus the wall-clock\n * start time, verdict, reason, and tags needed to re-arm the countdown.\n */\nexport interface SerializedJourneyState {\n /** `st_journey_id` tag — cross-page correlation key. Empty string when unset. */\n stJourneyId: string;\n /** Wall-clock epoch (Date.now()) when the journey started. */\n startedAtEpoch: number;\n verdict: 'good' | 'bad';\n reason: string | null;\n steps: {\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 tags: 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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import './config';
2
- export { defineJourney, completeJourney, excludeJourney, failJourney, journeyStep, setJourneyTags, singleInFlightJourneyStep, resolveStamp, JourneyStepStamp, type JourneyDef, type JourneyHandle, type JourneyNameLike, type JourneyStepOptions, type JourneyStepTarget, type StepHandle, } from './core';
2
+ export { defineJourney, completeJourney, excludeJourney, failJourney, journeyStep, restoreJourney, serializeJourneyState, setJourneyTags, singleInFlightJourneyStep, resolveStamp, JourneyStepStamp, type JourneyDef, type JourneyHandle, type JourneyNameLike, type JourneyStepOptions, type JourneyStepTarget, type SerializedJourneyState, type StepHandle, } from './core';
3
3
  export { configureJourney, type JourneyConfig } from './config';
4
4
  export type { EndpointPolicy, SlowRequestConfig } from './core/endpoint-policy';
5
5
  export type { JourneyHttpPolicyContext, JourneyHttpScore, JourneyHttpScoreContext, JourneyRequestPolicy, JourneyStampOptions, RequestPolicyConfig, } from './core/request-policy';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,UAAU,CAAC;AAElB,OAAO,EAEH,aAAa,EAEb,eAAe,EACf,cAAc,EACd,WAAW,EACX,WAAW,EACX,cAAc,EAEd,yBAAyB,EACzB,YAAY,EACZ,gBAAgB,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,UAAU,GAClB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAChE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChF,YAAY,EACR,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,WAAW,E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ineJourney, // Name-string lifecycle (prefer handle methods when you own the journey).
8
- completeJourney, excludeJourney, failJourney, journeyStep, setJourneyTags, // Custom transport adapters / request attribution.
8
+ completeJourney, excludeJourney, failJourney, journeyStep, restoreJourney, serializeJourneyState, setJourneyTags, // Custom transport adapters / request attribution.
9
9
  singleInFlightJourneyStep, resolveStamp, JourneyStepStamp } from './core';
10
10
  export { configureJourney } from './config';
11
11
  export { instrumentAxios } from './integrations/axios';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*\n * Force-evaluate config so the default Datadog sink registers even when consumers only\n * import core APIs (defineJourney, etc.). Paired with package.json \"sideEffects\" for\n * config — otherwise bundlers with sideEffects:false would drop an unused re-export.\n */\nimport './config';\n\nexport {\n // Preferred app API.\n defineJourney,\n // Name-string lifecycle (prefer handle methods when you own the journey).\n completeJourney,\n excludeJourney,\n failJourney,\n journeyStep,\n setJourneyTags,\n // Custom transport adapters / request attribution.\n singleInFlightJourneyStep,\n resolveStamp,\n JourneyStepStamp,\n type JourneyDef,\n type JourneyHandle,\n type JourneyNameLike,\n type JourneyStepOptions,\n type JourneyStepTarget,\n type StepHandle,\n} from './core';\n\nexport { configureJourney, type JourneyConfig } from './config';\nexport type { EndpointPolicy, SlowRequestConfig } from './core/endpoint-policy';\nexport type {\n JourneyHttpPolicyContext,\n JourneyHttpScore,\n JourneyHttpScoreContext,\n JourneyRequestPolicy,\n JourneyStampOptions,\n RequestPolicyConfig,\n} from './core/request-policy';\n\nexport type { JourneySink } from './core';\n\nexport { instrumentAxios } from './integrations/axios';\nexport { instrumentFetch } from './integrations/fetch';\nexport { exposeAppJourney, instrumentJquery } from './integrations/jquery';\nexport { requestKey, type JourneyTimedMeta } from './integrations/request-key';\nexport { onHttpComplete, type HttpCompleteReport } from './integrations/http-report';\nexport {\n disableJourney,\n disableJourneyDebugging,\n enableJourney,\n enableJourneyDebugging,\n isJourneyDebugEnabled,\n isJourneyEnabled,\n setJourneyDefaultEnabled,\n teardownJourney,\n} from './global';\nexport { sendToConsole } from './sinks/console';\nexport { normalizeTagValue, sendToDatadog, setJourneyRum } from './sinks/datadog';\n\nexport type { JourneyEvent, JourneyStepEvent, TagValue } from './core';\n\nexport { useJourneyName, useOptionalJourneyName } from './integrations/react/context';\nexport { JourneyScope } from './integrations/react/scope';\nexport { useJourneyStep } from './integrations/react/use-journey-step';\n"],"names":["defineJourney","completeJourney","excludeJourney","failJourney","journeyStep","setJourneyTags","singleInFlightJourneyStep","resolveStamp","JourneyStepStamp","configureJourney","instrumentAxios","instrumentFetch","exposeAppJourney","instrumentJquery","requestKey","onHttpComplete","disableJourney","disableJourneyDebugging","enableJourney","enableJourneyDebugging","isJourneyDebugEnabled","isJourneyEnabled","setJourneyDefaultEnabled","teardownJourney","sendToConsole","normalizeTagValue","sendToDatadog","setJourneyRum","useJourneyName","useOptionalJourneyName","JourneyScope","useJourneyStep"],"mappings":"AAAA;;;;CAIC,GACD,OAAO,WAAW;AAElB,SACI,qBAAqB;AACrBA,aAAa,EACb,0EAA0E;AAC1EC,eAAe,EACfC,cAAc,EACdC,WAAW,EACXC,WAAW,EACXC,cAAc,EACd,mDAAmD;AACnDC,yBAAyB,EACzBC,YAAY,EACZC,gBAAgB,QAOb,SAAS;AAEhB,SAASC,gBAAgB,QAA4B,WAAW;AAahE,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,wBAAwB;AAC3E,SAASC,UAAU,QAA+B,6BAA6B;AAC/E,SAASC,cAAc,QAAiC,6BAA6B;AACrF,SACIC,cAAc,EACdC,uBAAuB,EACvBC,aAAa,EACbC,sBAAsB,EACtBC,qBAAqB,EACrBC,gBAAgB,EAChBC,wBAAwB,EACxBC,eAAe,QACZ,WAAW;AAClB,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,iBAAiB,EAAEC,aAAa,EAAEC,aAAa,QAAQ,kBAAkB;AAIlF,SAASC,cAAc,EAAEC,sBAAsB,QAAQ,+BAA+B;AACtF,SAASC,YAAY,QAAQ,6BAA6B;AAC1D,SAASC,cAAc,QAAQ,wCAAwC"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*\n * Force-evaluate config so the default Datadog sink registers even when consumers only\n * import core APIs (defineJourney, etc.). Paired with package.json \"sideEffects\" for\n * config — otherwise bundlers with sideEffects:false would drop an unused re-export.\n */\nimport './config';\n\nexport {\n // Preferred app API.\n defineJourney,\n // Name-string lifecycle (prefer handle methods when you own the journey).\n completeJourney,\n excludeJourney,\n failJourney,\n journeyStep,\n restoreJourney,\n serializeJourneyState,\n setJourneyTags,\n // Custom transport adapters / request attribution.\n singleInFlightJourneyStep,\n resolveStamp,\n JourneyStepStamp,\n type JourneyDef,\n type JourneyHandle,\n type JourneyNameLike,\n type JourneyStepOptions,\n type JourneyStepTarget,\n type SerializedJourneyState,\n type StepHandle,\n} from './core';\n\nexport { configureJourney, type JourneyConfig } from './config';\nexport type { EndpointPolicy, SlowRequestConfig } from './core/endpoint-policy';\nexport type {\n JourneyHttpPolicyContext,\n JourneyHttpScore,\n JourneyHttpScoreContext,\n JourneyRequestPolicy,\n JourneyStampOptions,\n RequestPolicyConfig,\n} from './core/request-policy';\n\nexport type { JourneySink } from './core';\n\nexport { instrumentAxios } from './integrations/axios';\nexport { instrumentFetch } from './integrations/fetch';\nexport { exposeAppJourney, instrumentJquery } from './integrations/jquery';\nexport { requestKey, type JourneyTimedMeta } from './integrations/request-key';\nexport { onHttpComplete, type HttpCompleteReport } from './integrations/http-report';\nexport {\n disableJourney,\n disableJourneyDebugging,\n enableJourney,\n enableJourneyDebugging,\n isJourneyDebugEnabled,\n isJourneyEnabled,\n setJourneyDefaultEnabled,\n teardownJourney,\n} from './global';\nexport { sendToConsole } from './sinks/console';\nexport { normalizeTagValue, sendToDatadog, setJourneyRum } from './sinks/datadog';\n\nexport type { JourneyEvent, JourneyStepEvent, TagValue } from './core';\n\nexport { useJourneyName, useOptionalJourneyName } from './integrations/react/context';\nexport { JourneyScope } from './integrations/react/scope';\nexport { useJourneyStep } from './integrations/react/use-journey-step';\n"],"names":["defineJourney","completeJourney","excludeJourney","failJourney","journeyStep","restoreJourney","serializeJourneyState","setJourneyTags","singleInFlightJourneyStep","resolveStamp","JourneyStepStamp","configureJourney","instrumentAxios","instrumentFetch","exposeAppJourney","instrumentJquery","requestKey","onHttpComplete","disableJourney","disableJourneyDebugging","enableJourney","enableJourneyDebugging","isJourneyDebugEnabled","isJourneyEnabled","setJourneyDefaultEnabled","teardownJourney","sendToConsole","normalizeTagValue","sendToDatadog","setJourneyRum","useJourneyName","useOptionalJourneyName","JourneyScope","useJourneyStep"],"mappings":"AAAA;;;;CAIC,GACD,OAAO,WAAW;AAElB,SACI,qBAAqB;AACrBA,aAAa,EACb,0EAA0E;AAC1EC,eAAe,EACfC,cAAc,EACdC,WAAW,EACXC,WAAW,EACXC,cAAc,EACdC,qBAAqB,EACrBC,cAAc,EACd,mDAAmD;AACnDC,yBAAyB,EACzBC,YAAY,EACZC,gBAAgB,QAQb,SAAS;AAEhB,SAASC,gBAAgB,QAA4B,WAAW;AAahE,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,wBAAwB;AAC3E,SAASC,UAAU,QAA+B,6BAA6B;AAC/E,SAASC,cAAc,QAAiC,6BAA6B;AACrF,SACIC,cAAc,EACdC,uBAAuB,EACvBC,aAAa,EACbC,sBAAsB,EACtBC,qBAAqB,EACrBC,gBAAgB,EAChBC,wBAAwB,EACxBC,eAAe,QACZ,WAAW;AAClB,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,iBAAiB,EAAEC,aAAa,EAAEC,aAAa,QAAQ,kBAAkB;AAIlF,SAASC,cAAc,EAAEC,sBAAsB,QAAQ,+BAA+B;AACtF,SAASC,YAAY,QAAQ,6BAA6B;AAC1D,SAASC,cAAc,QAAQ,wCAAwC"}
@@ -6,7 +6,7 @@ export { normalizeTagValue } from '../core/sanitize';
6
6
  *
7
7
  * Prefer exposing the initialized instance as `globalThis.DD_RUM` (ST host:
8
8
  * `datadogGuard`). `sendToDatadog` resolves `DD_RUM` first, then `__stJourney.rum`
9
- * (this fallback), then the bundle's imported `datadogRum`.
9
+ * (this fallback); with neither present the event is dropped.
10
10
  *
11
11
  * Calling `setJourneyRum` while `globalThis.DD_RUM` is already set logs a warning —
12
12
  * the call is redundant because `sendToDatadog` prefers `DD_RUM`.
@@ -1 +1 @@
1
- {"version":3,"file":"datadog.d.ts","sourceRoot":"","sources":["../../src/sinks/datadog.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAUrD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAQhD;AA2BD,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CA0BzD"}
1
+ {"version":3,"file":"datadog.d.ts","sourceRoot":"","sources":["../../src/sinks/datadog.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAkBrD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAQhD;AAsBD,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAyBzD"}
@@ -1,4 +1,3 @@
1
- import { datadogRum } from '@datadog/browser-rum';
2
1
  import { isSanitizedJourneyEvent, sanitizeJourneyEvent } from '../core/sanitize';
3
2
  import { getJourneyRumFallback, setJourneyRumFallback } from '../global';
4
3
  export { normalizeTagValue } from '../core/sanitize';
@@ -13,7 +12,7 @@ function getDdRum() {
13
12
  *
14
13
  * Prefer exposing the initialized instance as `globalThis.DD_RUM` (ST host:
15
14
  * `datadogGuard`). `sendToDatadog` resolves `DD_RUM` first, then `__stJourney.rum`
16
- * (this fallback), then the bundle's imported `datadogRum`.
15
+ * (this fallback); with neither present the event is dropped.
17
16
  *
18
17
  * Calling `setJourneyRum` while `globalThis.DD_RUM` is already set logs a warning —
19
18
  * the call is redundant because `sendToDatadog` prefers `DD_RUM`.
@@ -25,12 +24,8 @@ function getDdRum() {
25
24
  setJourneyRumFallback(rum);
26
25
  }
27
26
  function resolveRum() {
28
- const ddRum = getDdRum();
29
- if (ddRum) {
30
- return ddRum;
31
- }
32
- const shared = getJourneyRumFallback();
33
- return shared !== null && shared !== void 0 ? shared : datadogRum;
27
+ var _getDdRum;
28
+ return (_getDdRum = getDdRum()) !== null && _getDdRum !== void 0 ? _getDdRum : getJourneyRumFallback();
34
29
  }
35
30
  function toDatadogStep(step) {
36
31
  /* eslint-disable @typescript-eslint/naming-convention -- Datadog RUM wire format (snake_case) */ return {
@@ -51,8 +46,7 @@ function toDatadogStep(step) {
51
46
  /* eslint-enable @typescript-eslint/naming-convention */ }
52
47
  /** Ship one terminal journey as a RUM custom action (`user_journey`). */ export function sendToDatadog(payload) {
53
48
  const rum = resolveRum();
54
- // Skip bad/missing host stubs — uninit RUM still buffers addAction safely.
55
- if (typeof rum.addAction !== 'function') {
49
+ if (!rum || typeof rum.addAction !== 'function') {
56
50
  return;
57
51
  }
58
52
  const j = isSanitizedJourneyEvent(payload) ? payload.journey : sanitizeJourneyEvent(payload).journey;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/sinks/datadog.ts"],"sourcesContent":["import { datadogRum } from '@datadog/browser-rum';\n\nimport { isSanitizedJourneyEvent, sanitizeJourneyEvent } from '../core/sanitize';\nimport { getJourneyRumFallback, setJourneyRumFallback } from '../global';\nimport type { JourneyEvent, JourneyStepEvent } from '../core/types';\n\nexport { normalizeTagValue } from '../core/sanitize';\n\nconst JOURNEY_ACTION = 'user_journey';\n\nconst DD_RUM_KEY = 'DD_RUM';\n\nfunction getDdRum(): typeof datadogRum | undefined {\n return (globalThis as Record<string, unknown>)[DD_RUM_KEY] as typeof datadogRum | undefined;\n}\n\n/**\n * Publish a RUM instance for MFE bundles to share — **only needed if\n * `globalThis.DD_RUM` is not set**.\n *\n * Prefer exposing the initialized instance as `globalThis.DD_RUM` (ST host:\n * `datadogGuard`). `sendToDatadog` resolves `DD_RUM` first, then `__stJourney.rum`\n * (this fallback), then the bundle's imported `datadogRum`.\n *\n * Calling `setJourneyRum` while `globalThis.DD_RUM` is already set logs a warning —\n * the call is redundant because `sendToDatadog` prefers `DD_RUM`.\n */\nexport function setJourneyRum(rum: unknown): void {\n if (getDdRum()) {\n // eslint-disable-next-line no-console -- soft-deprecate redundant bridge use\n console.warn(\n '[journey] setJourneyRum() is unnecessary when globalThis.DD_RUM is set — sendToDatadog already prefers DD_RUM'\n );\n }\n setJourneyRumFallback(rum);\n}\n\nfunction resolveRum(): typeof datadogRum {\n const ddRum = getDdRum();\n if (ddRum) {\n return ddRum;\n }\n const shared = getJourneyRumFallback();\n return (shared as typeof datadogRum | undefined) ?? datadogRum;\n}\n\nfunction toDatadogStep(step: JourneyStepEvent) {\n /* eslint-disable @typescript-eslint/naming-convention -- Datadog RUM wire format (snake_case) */\n return {\n name: step.name,\n start_ms: step.startMs,\n duration_ms: step.durationMs,\n outcome: step.outcome,\n ...(step.reason ? { reason: step.reason } : {}),\n ...(step.httpStatus !== undefined ? { http_status: step.httpStatus } : {}),\n ...(step.attributes && Object.keys(step.attributes).length\n ? { attributes: step.attributes }\n : {}),\n };\n /* eslint-enable @typescript-eslint/naming-convention */\n}\n\n/** Ship one terminal journey as a RUM custom action (`user_journey`). */\nexport function sendToDatadog(payload: JourneyEvent): void {\n const rum = resolveRum();\n // Skip bad/missing host stubs — uninit RUM still buffers addAction safely.\n if (typeof rum.addAction !== 'function') {\n return;\n }\n\n const j = isSanitizedJourneyEvent(payload)\n ? payload.journey\n : sanitizeJourneyEvent(payload).journey;\n /* eslint-disable @typescript-eslint/naming-convention -- Datadog RUM wire format (snake_case) */\n rum.addAction(JOURNEY_ACTION, {\n journey: {\n name: j.name,\n team: j.team,\n group: j.group,\n service: j.service,\n outcome: j.outcome,\n ...(j.reason ? { reason: j.reason } : {}),\n duration_ms: j.durationMs,\n steps: j.steps.map(toDatadogStep),\n ...(j.expected ? { expected: j.expected } : {}),\n ...(j.tags ? { tags: j.tags } : {}),\n },\n });\n /* eslint-enable @typescript-eslint/naming-convention */\n}\n"],"names":["datadogRum","isSanitizedJourneyEvent","sanitizeJourneyEvent","getJourneyRumFallback","setJourneyRumFallback","normalizeTagValue","JOURNEY_ACTION","DD_RUM_KEY","getDdRum","globalThis","setJourneyRum","rum","console","warn","resolveRum","ddRum","shared","toDatadogStep","step","name","start_ms","startMs","duration_ms","durationMs","outcome","reason","httpStatus","undefined","http_status","attributes","Object","keys","length","sendToDatadog","payload","addAction","j","journey","team","group","service","steps","map","expected","tags"],"mappings":"AAAA,SAASA,UAAU,QAAQ,uBAAuB;AAElD,SAASC,uBAAuB,EAAEC,oBAAoB,QAAQ,mBAAmB;AACjF,SAASC,qBAAqB,EAAEC,qBAAqB,QAAQ,YAAY;AAGzE,SAASC,iBAAiB,QAAQ,mBAAmB;AAErD,MAAMC,iBAAiB;AAEvB,MAAMC,aAAa;AAEnB,SAASC;IACL,OAAO,AAACC,UAAsC,CAACF,WAAW;AAC9D;AAEA;;;;;;;;;;CAUC,GACD,OAAO,SAASG,cAAcC,GAAY;IACtC,IAAIH,YAAY;QACZ,6EAA6E;QAC7EI,QAAQC,IAAI,CACR;IAER;IACAT,sBAAsBO;AAC1B;AAEA,SAASG;IACL,MAAMC,QAAQP;IACd,IAAIO,OAAO;QACP,OAAOA;IACX;IACA,MAAMC,SAASb;IACf,OAAQa,mBAAAA,oB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AAEQ,IAAI,GAAG;gBAAEA,MAAMR,EAAEQ,IAAI;YAAC,IAAI,CAAC,CAAC;QACtC;IACJ;AACA,sDAAsD,GAC1D"}
1
+ {"version":3,"sources":["../../src/sinks/datadog.ts"],"sourcesContent":["import { isSanitizedJourneyEvent, sanitizeJourneyEvent } from '../core/sanitize';\nimport { getJourneyRumFallback, setJourneyRumFallback } from '../global';\nimport type { JourneyEvent, JourneyStepEvent } from '../core/types';\n\nexport { normalizeTagValue } from '../core/sanitize';\n\nconst JOURNEY_ACTION = 'user_journey';\n\nconst DD_RUM_KEY = 'DD_RUM';\n\n/**\n * Not imported from @datadog/browser-rum on purpose: importing it sets globalThis.DD_RUM at\n * module load, which lets an MFE bundle replace the host's initialized RUM instance.\n */\ninterface RumLike {\n addAction(name: string, context?: object): void;\n}\n\nfunction getDdRum(): RumLike | undefined {\n return (globalThis as Record<string, unknown>)[DD_RUM_KEY] as RumLike | undefined;\n}\n\n/**\n * Publish a RUM instance for MFE bundles to share — **only needed if\n * `globalThis.DD_RUM` is not set**.\n *\n * Prefer exposing the initialized instance as `globalThis.DD_RUM` (ST host:\n * `datadogGuard`). `sendToDatadog` resolves `DD_RUM` first, then `__stJourney.rum`\n * (this fallback); with neither present the event is dropped.\n *\n * Calling `setJourneyRum` while `globalThis.DD_RUM` is already set logs a warning —\n * the call is redundant because `sendToDatadog` prefers `DD_RUM`.\n */\nexport function setJourneyRum(rum: unknown): void {\n if (getDdRum()) {\n // eslint-disable-next-line no-console -- soft-deprecate redundant bridge use\n console.warn(\n '[journey] setJourneyRum() is unnecessary when globalThis.DD_RUM is set — sendToDatadog already prefers DD_RUM'\n );\n }\n setJourneyRumFallback(rum);\n}\n\nfunction resolveRum(): RumLike | undefined {\n return getDdRum() ?? (getJourneyRumFallback() as RumLike | undefined);\n}\n\nfunction toDatadogStep(step: JourneyStepEvent) {\n /* eslint-disable @typescript-eslint/naming-convention -- Datadog RUM wire format (snake_case) */\n return {\n name: step.name,\n start_ms: step.startMs,\n duration_ms: step.durationMs,\n outcome: step.outcome,\n ...(step.reason ? { reason: step.reason } : {}),\n ...(step.httpStatus !== undefined ? { http_status: step.httpStatus } : {}),\n ...(step.attributes && Object.keys(step.attributes).length\n ? { attributes: step.attributes }\n : {}),\n };\n /* eslint-enable @typescript-eslint/naming-convention */\n}\n\n/** Ship one terminal journey as a RUM custom action (`user_journey`). */\nexport function sendToDatadog(payload: JourneyEvent): void {\n const rum = resolveRum();\n if (!rum || typeof rum.addAction !== 'function') {\n return;\n }\n\n const j = isSanitizedJourneyEvent(payload)\n ? payload.journey\n : sanitizeJourneyEvent(payload).journey;\n /* eslint-disable @typescript-eslint/naming-convention -- Datadog RUM wire format (snake_case) */\n rum.addAction(JOURNEY_ACTION, {\n journey: {\n name: j.name,\n team: j.team,\n group: j.group,\n service: j.service,\n outcome: j.outcome,\n ...(j.reason ? { reason: j.reason } : {}),\n duration_ms: j.durationMs,\n steps: j.steps.map(toDatadogStep),\n ...(j.expected ? { expected: j.expected } : {}),\n ...(j.tags ? { tags: j.tags } : {}),\n },\n });\n /* eslint-enable @typescript-eslint/naming-convention */\n}\n"],"names":["isSanitizedJourneyEvent","sanitizeJourneyEvent","getJourneyRumFallback","setJourneyRumFallback","normalizeTagValue","JOURNEY_ACTION","DD_RUM_KEY","getDdRum","globalThis","setJourneyRum","rum","console","warn","resolveRum","toDatadogStep","step","name","start_ms","startMs","duration_ms","durationMs","outcome","reason","httpStatus","undefined","http_status","attributes","Object","keys","length","sendToDatadog","payload","addAction","j","journey","team","group","service","steps","map","expected","tags"],"mappings":"AAAA,SAASA,uBAAuB,EAAEC,oBAAoB,QAAQ,mBAAmB;AACjF,SAASC,qBAAqB,EAAEC,qBAAqB,QAAQ,YAAY;AAGzE,SAASC,iBAAiB,QAAQ,mBAAmB;AAErD,MAAMC,iBAAiB;AAEvB,MAAMC,aAAa;AAUnB,SAASC;IACL,OAAO,AAACC,UAAsC,CAACF,WAAW;AAC9D;AAEA;;;;;;;;;;CAUC,G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AEb,UAAU;YACzBkB,OAAOL,EAAEK,KAAK,CAACC,GAAG,CAACzB;YACnB,GAAImB,EAAEO,QAAQ,GAAG;gBAAEA,UAAUP,EAAEO,QAAQ;YAAC,IAAI,CAAC,CAAC;YAC9C,GAAIP,EAAEQ,IAAI,GAAG;gBAAEA,MAAMR,EAAEQ,IAAI;YAAC,IAAI,CAAC,CAAC;QACtC;IACJ;AACA,sDAAsD,GAC1D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/journey",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
4
4
  "description": "Critical user journey monitoring — reports good/bad/excluded verdicts to Datadog RUM as a custom action",
5
5
  "homepage": "https://docs.st.dev/docs/frontend/journey",
6
6
  "repository": {
@@ -25,14 +25,12 @@
25
25
  "src"
26
26
  ],
27
27
  "devDependencies": {
28
- "@datadog/browser-rum": "^7.5.0",
29
28
  "@testing-library/jest-dom": "^6.4.2",
30
29
  "@testing-library/react": "^14.2.1",
31
30
  "@types/react": "~18.2.55",
32
31
  "react": "^18.2.0"
33
32
  },
34
33
  "peerDependencies": {
35
- "@datadog/browser-rum": ">=6.19.0",
36
34
  "react": ">=17.0.2"
37
35
  },
38
36
  "publishConfig": {
@@ -41,5 +39,5 @@
41
39
  "cli": {
42
40
  "webpack": false
43
41
  },
44
- "gitHead": "1ebcfc7b65a6b2979cbb89a93d411abe7144ca51"
42
+ "gitHead": "cd7d26dcbb74336efe088749dd930cf31715beed"
45
43
  }