@servicetitan/journey 4.0.0 → 4.2.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.
Files changed (66) hide show
  1. package/README.md +35 -0
  2. package/dist/__tests__/integrations/request-correlation.test.d.ts +2 -0
  3. package/dist/__tests__/integrations/request-correlation.test.d.ts.map +1 -0
  4. package/dist/__tests__/sinks/datadog-links.test.d.ts +2 -0
  5. package/dist/__tests__/sinks/datadog-links.test.d.ts.map +1 -0
  6. package/dist/__tests__/sinks/kibana.test.d.ts +2 -0
  7. package/dist/__tests__/sinks/kibana.test.d.ts.map +1 -0
  8. package/dist/core/index.d.ts +1 -1
  9. package/dist/core/index.d.ts.map +1 -1
  10. package/dist/core/index.js.map +1 -1
  11. package/dist/core/request-correlation.d.ts +8 -0
  12. package/dist/core/request-correlation.d.ts.map +1 -0
  13. package/dist/core/request-correlation.js +23 -0
  14. package/dist/core/request-correlation.js.map +1 -0
  15. package/dist/core/runtime.d.ts.map +1 -1
  16. package/dist/core/runtime.js +18 -2
  17. package/dist/core/runtime.js.map +1 -1
  18. package/dist/core/sanitize.d.ts.map +1 -1
  19. package/dist/core/sanitize.js +35 -2
  20. package/dist/core/sanitize.js.map +1 -1
  21. package/dist/core/types.d.ts +17 -0
  22. package/dist/core/types.d.ts.map +1 -1
  23. package/dist/core/types.js.map +1 -1
  24. package/dist/index.d.ts +1 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/integrations/axios.d.ts.map +1 -1
  28. package/dist/integrations/axios.js +2 -1
  29. package/dist/integrations/axios.js.map +1 -1
  30. package/dist/integrations/http-report.d.ts +2 -0
  31. package/dist/integrations/http-report.d.ts.map +1 -1
  32. package/dist/integrations/http-report.js +17 -2
  33. package/dist/integrations/http-report.js.map +1 -1
  34. package/dist/integrations/jquery/instrument.d.ts +2 -0
  35. package/dist/integrations/jquery/instrument.d.ts.map +1 -1
  36. package/dist/integrations/jquery/instrument.js +31 -4
  37. package/dist/integrations/jquery/instrument.js.map +1 -1
  38. package/dist/integrations/request-correlation.d.ts +5 -0
  39. package/dist/integrations/request-correlation.d.ts.map +1 -0
  40. package/dist/integrations/request-correlation.js +64 -0
  41. package/dist/integrations/request-correlation.js.map +1 -0
  42. package/dist/sinks/datadog.d.ts.map +1 -1
  43. package/dist/sinks/datadog.js +26 -0
  44. package/dist/sinks/datadog.js.map +1 -1
  45. package/dist/sinks/kibana.d.ts +11 -0
  46. package/dist/sinks/kibana.d.ts.map +1 -0
  47. package/dist/sinks/kibana.js +92 -0
  48. package/dist/sinks/kibana.js.map +1 -0
  49. package/package.json +2 -2
  50. package/src/__tests__/integrations/axios.test.ts +38 -1
  51. package/src/__tests__/integrations/jquery.test.ts +94 -1
  52. package/src/__tests__/integrations/request-correlation.test.ts +383 -0
  53. package/src/__tests__/sinks/datadog-links.test.ts +58 -0
  54. package/src/__tests__/sinks/kibana.test.ts +267 -0
  55. package/src/core/index.ts +1 -0
  56. package/src/core/request-correlation.ts +51 -0
  57. package/src/core/runtime.ts +7 -0
  58. package/src/core/sanitize.ts +39 -2
  59. package/src/core/types.ts +18 -0
  60. package/src/index.ts +1 -1
  61. package/src/integrations/axios.ts +1 -0
  62. package/src/integrations/http-report.ts +33 -14
  63. package/src/integrations/jquery/instrument.ts +37 -5
  64. package/src/integrations/request-correlation.ts +93 -0
  65. package/src/sinks/datadog.ts +21 -0
  66. package/src/sinks/kibana.ts +140 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/sanitize.ts"],"sourcesContent":["import { isUnsafeKey, MAX_ATTRIBUTE_KEYS, MAX_TAG_KEYS, MAX_TAG_VALUE_LEN } from './limits';\nimport type { JourneyEvent, JourneyStepEvent, TagValue } from './types';\n\nconst SANITIZED_EVENT = Symbol.for('st.journey.sanitized');\n\n/** Match Datadog metric-tag value rules so RUM attributes / globals join derived SLO tags. */\nexport function normalizeTagValue(value: string): string {\n return value\n .toLowerCase()\n .replace(/[^a-z0-9_\\-:./]/g, '_')\n .replace(/_+/g, '_')\n .slice(0, MAX_TAG_VALUE_LEN)\n .replace(/_+$/, '');\n}\n\nexport function emptyRecord(): Record<string, TagValue> {\n return Object.create(null) as Record<string, TagValue>;\n}\n\nfunction asTagValue(value: unknown): TagValue | undefined {\n if (typeof value === 'string') {\n return normalizeTagValue(value);\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return value;\n }\n return undefined;\n}\n\nexport interface CopyRecordOptions {\n maxKeys: number;\n /** When true, keys are run through {@link normalizeTagValue} (sink / wire). */\n normalizeKeys?: boolean;\n /** When true (default), string values are normalized. */\n normalizeStringValues?: boolean;\n}\n\n/**\n * Own-key copy onto a null-prototype object. Skips unsafe keys and excess keys.\n */\nexport function copyRecord(\n src: Record<string, unknown> | undefined,\n options: CopyRecordOptions\n): Record<string, TagValue> {\n const out = emptyRecord();\n if (src == null || typeof src !== 'object') {\n return out;\n }\n const normalizeKeys = options.normalizeKeys === true;\n const normalizeStringValues = options.normalizeStringValues !== false;\n for (const key of Object.keys(src)) {\n if (isUnsafeKey(key)) {\n continue;\n }\n const destKey = normalizeKeys ? normalizeTagValue(key) : key;\n if (!destKey || isUnsafeKey(destKey)) {\n continue;\n }\n const raw = src[key];\n const value = normalizeStringValues\n ? asTagValue(raw)\n : typeof raw === 'string' || typeof raw === 'number' || typeof raw === 'boolean'\n ? raw\n : undefined;\n if (value === undefined) {\n continue;\n }\n if (Object.prototype.hasOwnProperty.call(out, destKey)) {\n out[destKey] = value;\n continue;\n }\n if (Object.keys(out).length >= options.maxKeys) {\n continue;\n }\n out[destKey] = value;\n }\n return out;\n}\n\n/** Merge `src` into `target` (null-prototype), honouring caps and unsafe-key skips. */\nexport function assignRecord(\n target: Record<string, TagValue>,\n src: Record<string, unknown> | undefined,\n maxKeys: number\n): void {\n if (src == null || typeof src !== 'object') {\n return;\n }\n let room = maxKeys - Object.keys(target).length;\n for (const key of Object.keys(src)) {\n if (isUnsafeKey(key)) {\n continue;\n }\n const raw = src[key];\n if (typeof raw !== 'string' && typeof raw !== 'number' && typeof raw !== 'boolean') {\n continue;\n }\n const exists = Object.prototype.hasOwnProperty.call(target, key);\n if (!exists && room <= 0) {\n continue;\n }\n if (!exists) {\n room -= 1;\n }\n target[key] = raw;\n }\n}\n\nexport function setSafeAttribute(\n attributes: Record<string, TagValue>,\n key: string,\n value: string | number | boolean\n): void {\n if (isUnsafeKey(key)) {\n return;\n }\n const exists = Object.prototype.hasOwnProperty.call(attributes, key);\n if (!exists && Object.keys(attributes).length >= MAX_ATTRIBUTE_KEYS) {\n return;\n }\n const next = asTagValue(value);\n if (next !== undefined) {\n attributes[key] = next;\n }\n}\n\nfunction sanitizeStep(step: JourneyStepEvent): JourneyStepEvent {\n const name = normalizeTagValue(step.name);\n return {\n ...step,\n name: name || step.name,\n ...(step.reason ? { reason: normalizeTagValue(step.reason) } : {}),\n ...(step.attributes\n ? {\n attributes: copyRecord(step.attributes, {\n maxKeys: MAX_ATTRIBUTE_KEYS,\n normalizeKeys: true,\n }),\n }\n : {}),\n };\n}\n\n/** Default-sink payload: normalized keys/names, capped maps, no unsafe keys. */\nexport function sanitizeJourneyEvent(event: JourneyEvent): JourneyEvent {\n const j = event.journey;\n const expected = j.expected?.map(name => normalizeTagValue(name)).filter(name => name !== '');\n const tags = j.tags\n ? copyRecord(j.tags, { maxKeys: MAX_TAG_KEYS, normalizeKeys: true })\n : undefined;\n const tagKeys = tags ? Object.keys(tags) : [];\n const sanitized: JourneyEvent = {\n journey: {\n name: normalizeTagValue(j.name),\n team: normalizeTagValue(j.team),\n group: normalizeTagValue(j.group),\n service: normalizeTagValue(j.service),\n outcome: j.outcome,\n ...(j.reason ? { reason: normalizeTagValue(j.reason) } : {}),\n durationMs: j.durationMs,\n steps: j.steps.map(sanitizeStep),\n ...(expected?.length ? { expected } : {}),\n ...(tagKeys.length ? { tags } : {}),\n },\n };\n Object.defineProperty(sanitized, SANITIZED_EVENT, {\n value: true,\n enumerable: false,\n configurable: false,\n });\n return sanitized;\n}\n\n/** True when payload already passed through sanitizeJourneyEvent. */\nexport function isSanitizedJourneyEvent(event: JourneyEvent): boolean {\n return (event as unknown as Record<PropertyKey, unknown>)[SANITIZED_EVENT] === true;\n}\n"],"names":["isUnsafeKey","MAX_ATTRIBUTE_KEYS","MAX_TAG_KEYS","MAX_TAG_VALUE_LEN","SANITIZED_EVENT","Symbol","for","normalizeTagValue","value","toLowerCase","replace","slice","emptyRecord","Object","create","asTagValue","undefined","copyRecord","src","options","out","normalizeKeys","normalizeStringValues","key","keys","destKey","raw","prototype","hasOwnProperty","call","length","maxKeys","assignRecord","target","room","exists","setSafeAttribute","attributes","next","sanitizeStep","step","name","reason","sanitizeJourneyEvent","event","j","journey","expected","map","filter","tags","tagKeys","sanitized","team","group","service","outcome","durationMs","steps","defineProperty","enumerable","configurable","isSanitizedJourneyEvent"],"mappings":"AAAA,SAASA,WAAW,EAAEC,kBAAkB,EAAEC,YAAY,EAAEC,iBAAiB,QAAQ,WAAW;AAG5F,MAAMC,kBAAkBC,OAAOC,GAAG,CAAC;AAEnC,4FAA4F,GAC5F,OAAO,SAASC,kBAAkBC,KAAa;IAC3C,OAAOA,MACFC,WAAW,GACXC,OAAO,CAAC,oBAAoB,KAC5BA,OAAO,CAAC,OAAO,KACfC,KAAK,CAAC,GAAGR,mBACTO,OAAO,CAAC,OAAO;AACxB;AAEA,OAAO,SAASE;IACZ,OAAOC,OAAOC,MAAM,CAAC;AACzB;AAEA,SAASC,WAAWP,KAAc;IAC9B,IAAI,OAAOA,UAAU,UAAU;QAC3B,OAAOD,kBAAkBC;IAC7B;IACA,IAAI,OAAOA,UAAU,YAAY,OAAOA,UAAU,WAAW;QACzD,OAAOA;IACX;IACA,OAAOQ;AACX;AAUA;;CAEC,GACD,OAAO,SAASC,WACZC,GAAwC,EACxCC,OAA0B;IAE1B,MAAMC,MAAMR;IACZ,IAAIM,OAAO,QAAQ,OAAOA,QAAQ,UAAU;QACxC,OAAOE;IACX;IAC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AAC0B,QAAQ,EAAE;IAC7C,MAAME,YAA0B;QAC5BN,SAAS;YACLL,MAAMlC,kBAAkBsC,EAAEJ,IAAI;YAC9BY,MAAM9C,kBAAkBsC,EAAEQ,IAAI;YAC9BC,OAAO/C,kBAAkBsC,EAAES,KAAK;YAChCC,SAAShD,kBAAkBsC,EAAEU,OAAO;YACpCC,SAASX,EAAEW,OAAO;YAClB,GAAIX,EAAEH,MAAM,GAAG;gBAAEA,QAAQnC,kBAAkBsC,EAAEH,MAAM;YAAE,IAAI,CAAC,CAAC;YAC3De,YAAYZ,EAAEY,UAAU;YACxBC,OAAOb,EAAEa,KAAK,CAACV,GAAG,CAACT;YACnB,GAAIQ,CAAAA,qBAAAA,+BAAAA,SAAUjB,MAAM,IAAG;gBAAEiB;YAAS,IAAI,CAAC,CAAC;YACxC,GAAII,QAAQrB,MAAM,GAAG;gBAAEoB;YAAK,IAAI,CAAC,CAAC;QACtC;IACJ;IACArC,OAAO8C,cAAc,CAACP,WAAWhD,iBAAiB;QAC9CI,OAAO;QACPoD,YAAY;QACZC,cAAc;IAClB;IACA,OAAOT;AACX;AAEA,mEAAmE,GACnE,OAAO,SAASU,wBAAwBlB,KAAmB;IACvD,OAAO,AAACA,KAAiD,CAACxC,gBAAgB,KAAK;AACnF"}
1
+ {"version":3,"sources":["../../src/core/sanitize.ts"],"sourcesContent":["import { isUnsafeKey, MAX_ATTRIBUTE_KEYS, MAX_TAG_KEYS, MAX_TAG_VALUE_LEN } from './limits';\nimport type { JourneyEvent, JourneyStepEvent, TagValue } from './types';\nimport {\n MAX_CORRELATED_REQUESTS,\n MAX_JOURNEY_CORRELATED_REQUESTS,\n sanitizeRequestCorrelation,\n} from './request-correlation';\n\nconst SANITIZED_EVENT = Symbol.for('st.journey.sanitized');\n\n/** Match Datadog metric-tag value rules so RUM attributes / globals join derived SLO tags. */\nexport function normalizeTagValue(value: string): string {\n return value\n .toLowerCase()\n .replace(/[^a-z0-9_\\-:./]/g, '_')\n .replace(/_+/g, '_')\n .slice(0, MAX_TAG_VALUE_LEN)\n .replace(/_+$/, '');\n}\n\nexport function emptyRecord(): Record<string, TagValue> {\n return Object.create(null) as Record<string, TagValue>;\n}\n\nfunction asTagValue(value: unknown): TagValue | undefined {\n if (typeof value === 'string') {\n return normalizeTagValue(value);\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return value;\n }\n return undefined;\n}\n\nexport interface CopyRecordOptions {\n maxKeys: number;\n /** When true, keys are run through {@link normalizeTagValue} (sink / wire). */\n normalizeKeys?: boolean;\n /** When true (default), string values are normalized. */\n normalizeStringValues?: boolean;\n}\n\n/**\n * Own-key copy onto a null-prototype object. Skips unsafe keys and excess keys.\n */\nexport function copyRecord(\n src: Record<string, unknown> | undefined,\n options: CopyRecordOptions\n): Record<string, TagValue> {\n const out = emptyRecord();\n if (src == null || typeof src !== 'object') {\n return out;\n }\n const normalizeKeys = options.normalizeKeys === true;\n const normalizeStringValues = options.normalizeStringValues !== false;\n for (const key of Object.keys(src)) {\n if (isUnsafeKey(key)) {\n continue;\n }\n const destKey = normalizeKeys ? normalizeTagValue(key) : key;\n if (!destKey || isUnsafeKey(destKey)) {\n continue;\n }\n const raw = src[key];\n const value = normalizeStringValues\n ? asTagValue(raw)\n : typeof raw === 'string' || typeof raw === 'number' || typeof raw === 'boolean'\n ? raw\n : undefined;\n if (value === undefined) {\n continue;\n }\n if (Object.prototype.hasOwnProperty.call(out, destKey)) {\n out[destKey] = value;\n continue;\n }\n if (Object.keys(out).length >= options.maxKeys) {\n continue;\n }\n out[destKey] = value;\n }\n return out;\n}\n\n/** Merge `src` into `target` (null-prototype), honouring caps and unsafe-key skips. */\nexport function assignRecord(\n target: Record<string, TagValue>,\n src: Record<string, unknown> | undefined,\n maxKeys: number\n): void {\n if (src == null || typeof src !== 'object') {\n return;\n }\n let room = maxKeys - Object.keys(target).length;\n for (const key of Object.keys(src)) {\n if (isUnsafeKey(key)) {\n continue;\n }\n const raw = src[key];\n if (typeof raw !== 'string' && typeof raw !== 'number' && typeof raw !== 'boolean') {\n continue;\n }\n const exists = Object.prototype.hasOwnProperty.call(target, key);\n if (!exists && room <= 0) {\n continue;\n }\n if (!exists) {\n room -= 1;\n }\n target[key] = raw;\n }\n}\n\nexport function setSafeAttribute(\n attributes: Record<string, TagValue>,\n key: string,\n value: string | number | boolean\n): void {\n if (isUnsafeKey(key)) {\n return;\n }\n const exists = Object.prototype.hasOwnProperty.call(attributes, key);\n if (!exists && Object.keys(attributes).length >= MAX_ATTRIBUTE_KEYS) {\n return;\n }\n const next = asTagValue(value);\n if (next !== undefined) {\n attributes[key] = next;\n }\n}\n\nfunction sanitizeStep(step: JourneyStepEvent): JourneyStepEvent {\n const { requests: rawRequests, requestsTruncated, ...rest } = step;\n const requests = Array.isArray(rawRequests)\n ? rawRequests\n .slice(0, MAX_CORRELATED_REQUESTS)\n .map(sanitizeRequestCorrelation)\n .filter(request => request !== undefined)\n : [];\n const name = normalizeTagValue(step.name);\n return {\n ...rest,\n ...(requests.length ? { requests } : {}),\n ...(requestsTruncated === true ? { requestsTruncated: true } : {}),\n name: name || step.name,\n ...(step.reason ? { reason: normalizeTagValue(step.reason) } : {}),\n ...(step.attributes\n ? {\n attributes: copyRecord(step.attributes, {\n maxKeys: MAX_ATTRIBUTE_KEYS,\n normalizeKeys: true,\n }),\n }\n : {}),\n };\n}\n\n/** Default-sink payload: normalized keys/names, capped maps, no unsafe keys. */\nexport function sanitizeJourneyEvent(event: JourneyEvent): JourneyEvent {\n const j = event.journey;\n const expected = j.expected?.map(name => normalizeTagValue(name)).filter(name => name !== '');\n const tags = j.tags\n ? copyRecord(j.tags, { maxKeys: MAX_TAG_KEYS, normalizeKeys: true })\n : undefined;\n const tagKeys = tags ? Object.keys(tags) : [];\n const steps = j.steps.map(sanitizeStep);\n // Prefer recently started steps at the cap; failedRequest preserves the scoring request separately.\n let requestBudget = MAX_JOURNEY_CORRELATED_REQUESTS;\n for (let index = steps.length - 1; index >= 0; index--) {\n const step = steps[index];\n if (!step.requests) {\n continue;\n }\n if (step.requests.length > requestBudget) {\n step.requestsTruncated = true;\n if (requestBudget === 0) {\n delete step.requests;\n } else {\n step.requests = step.requests.slice(-requestBudget);\n }\n }\n requestBudget -= step.requests?.length ?? 0;\n }\n const failedRequest =\n j.outcome === 'bad' && j.failedRequest\n ? sanitizeRequestCorrelation(j.failedRequest)\n : undefined;\n const sanitized: JourneyEvent = {\n journey: {\n name: normalizeTagValue(j.name),\n team: normalizeTagValue(j.team),\n group: normalizeTagValue(j.group),\n service: normalizeTagValue(j.service),\n outcome: j.outcome,\n ...(failedRequest ? { failedRequest } : {}),\n ...(j.reason ? { reason: normalizeTagValue(j.reason) } : {}),\n durationMs: j.durationMs,\n steps,\n ...(expected?.length ? { expected } : {}),\n ...(tagKeys.length ? { tags } : {}),\n },\n };\n Object.defineProperty(sanitized, SANITIZED_EVENT, {\n value: true,\n enumerable: false,\n configurable: false,\n });\n return sanitized;\n}\n\n/** True when payload already passed through sanitizeJourneyEvent. */\nexport function isSanitizedJourneyEvent(event: JourneyEvent): boolean {\n return (event as unknown as Record<PropertyKey, unknown>)[SANITIZED_EVENT] === true;\n}\n"],"names":["isUnsafeKey","MAX_ATTRIBUTE_KEYS","MAX_TAG_KEYS","MAX_TAG_VALUE_LEN","MAX_CORRELATED_REQUESTS","MAX_JOURNEY_CORRELATED_REQUESTS","sanitizeRequestCorrelation","SANITIZED_EVENT","Symbol","for","normalizeTagValue","value","toLowerCase","replace","slice","emptyRecord","Object","create","asTagValue","undefined","copyRecord","src","options","out","normalizeKeys","normalizeStringValues","key","keys","destKey","raw","prototype","hasOwnProperty","call","length","maxKeys","assignRecord","target","room","exists","setSafeAttribute","attributes","next","sanitizeStep","step","requests","rawRequests","requestsTruncated","rest","Array","isArray","map","filter","request","name","reason","sanitizeJourneyEvent","event","j","journey","expected","tags","tagKeys","steps","requestBudget","index","failedRequest","outcome","sanitized","team","group","service","durationMs","defineProperty","enumerable","configurable","isSanitizedJourneyEvent"],"mapp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CI,OAAO;QACP8D,YAAY;QACZC,cAAc;IAClB;IACA,OAAOP;AACX;AAEA,mEAAmE,GACnE,OAAO,SAASQ,wBAAwBnB,KAAmB;IACvD,OAAO,AAACA,KAAiD,CAACjD,gBAAgB,KAAK;AACnF"}
@@ -123,6 +123,15 @@ export interface JourneyState {
123
123
  /** Frozen snapshot taken at start — not the caller's original object. */
124
124
  config: JourneyDef;
125
125
  [JOURNEY_ENGINE]?: JourneyEngine;
126
+ /** Present only during synchronous HTTP scoring, so finish can identify the causing request. */
127
+ scoringRequest?: JourneyRequestEvent;
128
+ }
129
+ /** Response correlation for production monolith logs. Never a metric tag. */
130
+ export interface JourneyRequestEvent {
131
+ rayId: string;
132
+ startedAtEpoch: number;
133
+ durationMs: number;
134
+ status: number;
126
135
  }
127
136
  /** @internal Engine in-flight / completed step record — not part of the supported public API. */
128
137
  export interface StepRecord {
@@ -138,6 +147,9 @@ export interface StepRecord {
138
147
  onHttpAborted?: boolean;
139
148
  /** @internal Request keys attributed while this step was in flight (debug). */
140
149
  attributedRequestKeys?: string[];
150
+ /** Bounded response metadata; no URLs, bodies, or other headers. */
151
+ requests?: JourneyRequestEvent[];
152
+ requestsTruncated?: boolean;
141
153
  }
142
154
  export interface JourneyStepEvent {
143
155
  name: string;
@@ -148,6 +160,9 @@ export interface JourneyStepEvent {
148
160
  reason?: string;
149
161
  httpStatus?: number;
150
162
  attributes?: Record<string, TagValue>;
163
+ /** Correlated requests on bad journeys, not necessarily the cause of a business error. */
164
+ requests?: JourneyRequestEvent[];
165
+ requestsTruncated?: boolean;
151
166
  }
152
167
  /**
153
168
  * Snapshot of an open journey that can survive a page navigation. Produced by
@@ -185,6 +200,8 @@ export interface JourneyEvent {
185
200
  reason?: string;
186
201
  durationMs: number;
187
202
  steps: JourneyStepEvent[];
203
+ /** Present only when a correlated HTTP report synchronously closed the journey as bad. */
204
+ failedRequest?: JourneyRequestEvent;
188
205
  expected?: string[];
189
206
  tags?: Record<string, TagValue>;
190
207
  };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ACd;;;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/**\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"}
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 /** Present only during synchronous HTTP scoring, so finish can identify the causing request. */\n scoringRequest?: JourneyRequestEvent;\n}\n\n/** Response correlation for production monolith logs. Never a metric tag. */\nexport interface JourneyRequestEvent {\n rayId: string;\n startedAtEpoch: number;\n durationMs: number;\n status: number;\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 /** Bounded response metadata; no URLs, bodies, or other headers. */\n requests?: JourneyRequestEvent[];\n requestsTruncated?: boolean;\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 /** Correlated requests on bad journeys, not necessarily the cause of a business error. */\n requests?: JourneyRequestEvent[];\n requestsTruncated?: boolean;\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 /** Present only when a correlated HTTP report synchronously closed the journey as bad. */\n failedRequest?: JourneyRequestEvent;\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
@@ -12,7 +12,7 @@ export { onHttpComplete, type HttpCompleteReport } from './integrations/http-rep
12
12
  export { disableJourney, disableJourneyDebugging, enableJourney, enableJourneyDebugging, isJourneyDebugEnabled, isJourneyEnabled, setJourneyDefaultEnabled, teardownJourney, } from './global';
13
13
  export { sendToConsole } from './sinks/console';
14
14
  export { normalizeTagValue, sendToDatadog, setJourneyRum } from './sinks/datadog';
15
- export type { JourneyEvent, JourneyStepEvent, TagValue } from './core';
15
+ export type { JourneyEvent, JourneyRequestEvent, JourneyStepEvent, TagValue } from './core';
16
16
  export { useJourneyName, useOptionalJourneyName } from './integrations/react/context';
17
17
  export { JourneyScope } from './integrations/react/scope';
18
18
  export { useJourneyStep } from './integrations/react/use-journey-step';
@@ -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,EACd,qBAAqB,EACrB,cAAc,EAEd,yBAAyB,EACzB,YAAY,EACZ,gBAAgB,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,UAAU,GAClB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,gBA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Q,EAAE,MAAM,QAAQ,CAAC;AAE5F,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC"}
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 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"}
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, JourneyRequestEvent, 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"}
@@ -1 +1 @@
1
- {"version":3,"file":"axios.d.ts","sourceRoot":"","sources":["../../src/integrations/axios.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,YAAY,EAAE;QACV,OAAO,EAAE;YACL,GAAG,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,GAAG,OAAO,CAAC;YAChD,KAAK,CAAC,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAAC;SAC7B,CAAC;QACF,QAAQ,EAAE;YACN,GAAG,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,GAAG,EAAE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,GAAG,OAAO,CAAC;YACpF,KAAK,CAAC,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAAC;SAC7B,CAAC;KACL,CAAC;CACL;AAwED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,IAAI,CAqH1F"}
1
+ {"version":3,"file":"axios.d.ts","sourceRoot":"","sources":["../../src/integrations/axios.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,YAAY,EAAE;QACV,OAAO,EAAE;YACL,GAAG,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,GAAG,OAAO,CAAC;YAChD,KAAK,CAAC,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAAC;SAC7B,CAAC;QACF,QAAQ,EAAE;YACN,GAAG,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,GAAG,EAAE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,GAAG,OAAO,CAAC;YACpF,KAAK,CAAC,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAAC;SAC7B,CAAC;KACL,CAAC;CACL;AAyED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,IAAI,CAqH1F"}
@@ -13,7 +13,7 @@ function stampFromConfig(config) {
13
13
  return (_axiosStamps_get = axiosStamps.get(config)) !== null && _axiosStamps_get !== void 0 ? _axiosStamps_get : adoptJourneyStepStamp(config.stamp);
14
14
  }
15
15
  function reportTiming(instance, config, status, aborted, extras) {
16
- var _config_journeyStart, _ref;
16
+ var _config_journeyStart, _config_baseURL, _ref;
17
17
  if (!config || config.ignore === true) {
18
18
  return;
19
19
  }
@@ -30,6 +30,7 @@ function reportTiming(instance, config, status, aborted, extras) {
30
30
  requestKey: key,
31
31
  aborted,
32
32
  url: config.url,
33
+ baseURL: (_config_baseURL = config.baseURL) !== null && _config_baseURL !== void 0 ? _config_baseURL : instance.defaults.baseURL,
33
34
  method: config.method,
34
35
  meta: config,
35
36
  request: (_ref = extras === null || extras === void 0 ? void 0 : extras.request) !== null && _ref !== void 0 ? _ref : config,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/integrations/axios.ts"],"sourcesContent":["import { resolveStamp } from '../core';\nimport { adoptJourneyStepStamp, type JourneyStepStamp } from '../core/step-tag';\nimport {\n getInstrumentedAxiosSet,\n registerInstrumentRecord,\n type InstrumentRecord,\n} from '../global';\nimport { isCanceledError, onHttpComplete } from './http-report';\nimport { requestKey, type JourneyTimedMeta } from './request-key';\nimport { acceptInstrumentTarget } from './soft-skip';\n\n/**\n * Minimal structural axios surface. No axios dependency — works across 0.31 and 1.x.\n */\nexport interface AxiosLikeInstance {\n defaults: { baseURL?: string };\n interceptors: {\n request: {\n use(onFulfilled: (config: any) => any): unknown;\n eject?(id: unknown): void;\n };\n response: {\n use(onFulfilled: (response: any) => any, onRejected?: (error: any) => any): unknown;\n eject?(id: unknown): void;\n };\n };\n}\n\ntype TimedConfig = JourneyTimedMeta & { url?: string; baseURL?: string; method?: string };\n\nconst axiosStamps = new WeakMap<object, JourneyStepStamp>();\n\nfunction stampFromConfig(config: TimedConfig | undefined): JourneyStepStamp | undefined {\n if (!config) {\n return undefined;\n }\n return axiosStamps.get(config) ?? adoptJourneyStepStamp(config.stamp);\n}\n\nfunction reportTiming(\n instance: AxiosLikeInstance,\n config: TimedConfig | undefined,\n status: number | undefined,\n aborted: boolean,\n extras?: { request?: unknown; response?: unknown; error?: unknown }\n): void {\n if (!config || config.ignore === true) {\n return;\n }\n const stamp = stampFromConfig(config);\n if (!stamp || stamp.ignore) {\n return;\n }\n const start = config.journeyStart ?? globalThis.performance.now();\n const key = requestKey(config.url, config.baseURL, instance.defaults.baseURL);\n onHttpComplete({\n stamp,\n status,\n durationMs: globalThis.performance.now() - start,\n requestKey: key,\n aborted,\n url: config.url,\n method: config.method,\n meta: config,\n request: extras?.request ?? config,\n response: extras?.response,\n error: extras?.error,\n });\n}\n\nfunction isAxiosLikeInstance(value: unknown): value is AxiosLikeInstance {\n if (value == null || (typeof value !== 'object' && typeof value !== 'function')) {\n return false;\n }\n const instance = value as AxiosLikeInstance;\n return (\n instance.defaults != null &&\n typeof instance.defaults === 'object' &&\n typeof instance.interceptors?.request?.use === 'function' &&\n typeof instance.interceptors?.response?.use === 'function'\n );\n}\n\nfunction ejectInterceptor(\n interceptors: { eject?: (id: unknown) => void } | undefined,\n id: unknown\n): boolean {\n if (id === undefined || typeof interceptors?.eject !== 'function') {\n return false;\n }\n try {\n interceptors.eject(id);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Wire an axios instance into the journey engine (observation-only).\n * Call once per instance (idempotent). Register any async request interceptors\n * (e.g. auth) before this call so this one runs first.\n * Soft-skips when `instance` is missing or not axios-like — hosts can pass axios as-is.\n * Returns a restore function that disposes handlers (they no-op after restore).\n */\nexport function instrumentAxios(instance: AxiosLikeInstance | null | undefined): () => void {\n const axios = acceptInstrumentTarget('Axios', instance, isAxiosLikeInstance);\n const instrumented = getInstrumentedAxiosSet();\n if (!axios || instrumented.has(axios as object)) {\n return () => {};\n }\n\n const record: InstrumentRecord = { disposed: false };\n let requestId: unknown;\n let responseId: unknown;\n let requestAdded = false;\n let responseAdded = false;\n\n try {\n requestId = axios.interceptors.request.use(config => {\n if (record.disposed) {\n return config;\n }\n const timed = config as TimedConfig;\n if (timed.ignore === true) {\n return config;\n }\n const stamp = resolveStamp(timed.stamp);\n if (stamp) {\n axiosStamps.set(timed, stamp);\n /*\n * Keep config.stamp so later interceptors that clone/spread config\n * still carry attribution. JourneyStepStamp.toJSON keeps this safe\n * for AxiosError serialization.\n */\n }\n if (stamp?.ignore === true) {\n return config;\n }\n if (stamp) {\n timed.journeyStart = globalThis.performance.now();\n }\n return config;\n });\n requestAdded = true;\n\n responseId = axios.interceptors.response.use(\n response => {\n if (!record.disposed) {\n reportTiming(\n axios,\n response?.config as TimedConfig | undefined,\n response?.status,\n false,\n { request: response?.config, response }\n );\n }\n return response;\n },\n (error: unknown) => {\n if (!record.disposed) {\n const axiosError = error as {\n config?: TimedConfig;\n response?: { status?: number };\n };\n reportTiming(\n axios,\n axiosError?.config,\n axiosError?.response?.status,\n isCanceledError(error),\n {\n request: axiosError?.config,\n response: axiosError?.response,\n error,\n }\n );\n }\n /*\n * Passthrough original reason (AxiosError or test doubles). Do not wrap —\n * callers match on .response / AxiosError identity.\n */\n return Promise.reject(error as Error);\n }\n );\n responseAdded = true;\n instrumented.add(axios as object);\n } catch (err) {\n const unwound =\n (!responseAdded || ejectInterceptor(axios.interceptors.response, responseId)) &&\n (!requestAdded || ejectInterceptor(axios.interceptors.request, requestId));\n if (!unwound) {\n /*\n * Interceptors may still be registered and cannot be ejected. Mark disposed\n * and keep the WeakSet slot, but register a restore so teardownJourney can\n * unmark and a later retry can proceed.\n */\n record.disposed = true;\n instrumented.add(axios as object);\n const restore = () => {\n record.disposed = true;\n instrumented.delete(axios as object);\n };\n record.restore = restore;\n registerInstrumentRecord(record);\n // eslint-disable-next-line no-console -- soft-fail host wiring\n console.error('[journey] instrumentAxios failed', err);\n return restore;\n }\n // eslint-disable-next-line no-console -- soft-fail host wiring\n console.error('[journey] instrumentAxios failed', err);\n return () => {};\n }\n\n const restore = () => {\n record.disposed = true;\n ejectInterceptor(axios.interceptors.request, requestId);\n ejectInterceptor(axios.interceptors.response, responseId);\n instrumented.delete(axios as object);\n };\n record.restore = restore;\n registerInstrumentRecord(record);\n return restore;\n}\n"],"names":["resolveStamp","adoptJourneyStepStamp","getInstrumentedAxiosSet","registerInstrumentRecord","isCanceledError","onHttpComplete","requestKey","acceptInstrumentTarget","axiosStamps","WeakMap","stampFromConfig","config","undefined","get","stamp","reportTiming","instance","status","aborted","extras","ignore","start","journeyStart","globalThis","performance","now","key","url","baseURL","defaults","durationMs","method","meta","request","response","error","isAxiosLikeInstance","value","interceptors","use","ejectInterceptor","id","eject","instrumentAxios","axios","instrumented","has","record","disposed","requestId","responseId","requestAdded","responseAdded","timed","set","axiosError","Promise","reject","add","err","unwound","restore","delete","console"],"mappings":"AAAA,SAASA,YAAY,QAAQ,UAAU;AACvC,SAASC,qBAAqB,QAA+B,mBAAmB;AAChF,SACIC,uBAAuB,EACvBC,wBAAwB,QAErB,YAAY;AACnB,SAASC,eAAe,EAAEC,cAAc,QAAQ,gBAAgB;AAChE,SAASC,UAAU,QAA+B,gBAAgB;AAClE,SAASC,sBAAsB,QAAQ,cAAc;AAqBrD,MAAMC,cAAc,IAAIC;AAExB,SAASC,gBAAgBC,MAA+B;QAI7CH;IAHP,IAAI,CAACG,QAAQ;QACT,OAAOC;IACX;IACA,QAAOJ,mBAAAA,YAAYK,GAAG,CAACF,qBAAhBH,8BAAAA,mBAA2BP,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AO,KAAO;IAClB;IAEA,MAAME,UAAU;QACZd,OAAOC,QAAQ,GAAG;QAClBR,iBAAiBI,MAAMN,YAAY,CAACL,OAAO,EAAEgB;QAC7CT,iBAAiBI,MAAMN,YAAY,CAACJ,QAAQ,EAAEgB;QAC9CL,aAAaiB,MAAM,CAAClB;IACxB;IACAG,OAAOc,OAAO,GAAGA;IACjB1D,yBAAyB4C;IACzB,OAAOc;AACX"}
1
+ {"version":3,"sources":["../../src/integrations/axios.ts"],"sourcesContent":["import { resolveStamp } from '../core';\nimport { adoptJourneyStepStamp, type JourneyStepStamp } from '../core/step-tag';\nimport {\n getInstrumentedAxiosSet,\n registerInstrumentRecord,\n type InstrumentRecord,\n} from '../global';\nimport { isCanceledError, onHttpComplete } from './http-report';\nimport { requestKey, type JourneyTimedMeta } from './request-key';\nimport { acceptInstrumentTarget } from './soft-skip';\n\n/**\n * Minimal structural axios surface. No axios dependency — works across 0.31 and 1.x.\n */\nexport interface AxiosLikeInstance {\n defaults: { baseURL?: string };\n interceptors: {\n request: {\n use(onFulfilled: (config: any) => any): unknown;\n eject?(id: unknown): void;\n };\n response: {\n use(onFulfilled: (response: any) => any, onRejected?: (error: any) => any): unknown;\n eject?(id: unknown): void;\n };\n };\n}\n\ntype TimedConfig = JourneyTimedMeta & { url?: string; baseURL?: string; method?: string };\n\nconst axiosStamps = new WeakMap<object, JourneyStepStamp>();\n\nfunction stampFromConfig(config: TimedConfig | undefined): JourneyStepStamp | undefined {\n if (!config) {\n return undefined;\n }\n return axiosStamps.get(config) ?? adoptJourneyStepStamp(config.stamp);\n}\n\nfunction reportTiming(\n instance: AxiosLikeInstance,\n config: TimedConfig | undefined,\n status: number | undefined,\n aborted: boolean,\n extras?: { request?: unknown; response?: unknown; error?: unknown }\n): void {\n if (!config || config.ignore === true) {\n return;\n }\n const stamp = stampFromConfig(config);\n if (!stamp || stamp.ignore) {\n return;\n }\n const start = config.journeyStart ?? globalThis.performance.now();\n const key = requestKey(config.url, config.baseURL, instance.defaults.baseURL);\n onHttpComplete({\n stamp,\n status,\n durationMs: globalThis.performance.now() - start,\n requestKey: key,\n aborted,\n url: config.url,\n baseURL: config.baseURL ?? instance.defaults.baseURL,\n method: config.method,\n meta: config,\n request: extras?.request ?? config,\n response: extras?.response,\n error: extras?.error,\n });\n}\n\nfunction isAxiosLikeInstance(value: unknown): value is AxiosLikeInstance {\n if (value == null || (typeof value !== 'object' && typeof value !== 'function')) {\n return false;\n }\n const instance = value as AxiosLikeInstance;\n return (\n instance.defaults != null &&\n typeof instance.defaults === 'object' &&\n typeof instance.interceptors?.request?.use === 'function' &&\n typeof instance.interceptors?.response?.use === 'function'\n );\n}\n\nfunction ejectInterceptor(\n interceptors: { eject?: (id: unknown) => void } | undefined,\n id: unknown\n): boolean {\n if (id === undefined || typeof interceptors?.eject !== 'function') {\n return false;\n }\n try {\n interceptors.eject(id);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Wire an axios instance into the journey engine (observation-only).\n * Call once per instance (idempotent). Register any async request interceptors\n * (e.g. auth) before this call so this one runs first.\n * Soft-skips when `instance` is missing or not axios-like — hosts can pass axios as-is.\n * Returns a restore function that disposes handlers (they no-op after restore).\n */\nexport function instrumentAxios(instance: AxiosLikeInstance | null | undefined): () => void {\n const axios = acceptInstrumentTarget('Axios', instance, isAxiosLikeInstance);\n const instrumented = getInstrumentedAxiosSet();\n if (!axios || instrumented.has(axios as object)) {\n return () => {};\n }\n\n const record: InstrumentRecord = { disposed: false };\n let requestId: unknown;\n let responseId: unknown;\n let requestAdded = false;\n let responseAdded = false;\n\n try {\n requestId = axios.interceptors.request.use(config => {\n if (record.disposed) {\n return config;\n }\n const timed = config as TimedConfig;\n if (timed.ignore === true) {\n return config;\n }\n const stamp = resolveStamp(timed.stamp);\n if (stamp) {\n axiosStamps.set(timed, stamp);\n /*\n * Keep config.stamp so later interceptors that clone/spread config\n * still carry attribution. JourneyStepStamp.toJSON keeps this safe\n * for AxiosError serialization.\n */\n }\n if (stamp?.ignore === true) {\n return config;\n }\n if (stamp) {\n timed.journeyStart = globalThis.performance.now();\n }\n return config;\n });\n requestAdded = true;\n\n responseId = axios.interceptors.response.use(\n response => {\n if (!record.disposed) {\n reportTiming(\n axios,\n response?.config as TimedConfig | undefined,\n response?.status,\n false,\n { request: response?.config, response }\n );\n }\n return response;\n },\n (error: unknown) => {\n if (!record.disposed) {\n const axiosError = error as {\n config?: TimedConfig;\n response?: { status?: number };\n };\n reportTiming(\n axios,\n axiosError?.config,\n axiosError?.response?.status,\n isCanceledError(error),\n {\n request: axiosError?.config,\n response: axiosError?.response,\n error,\n }\n );\n }\n /*\n * Passthrough original reason (AxiosError or test doubles). Do not wrap —\n * callers match on .response / AxiosError identity.\n */\n return Promise.reject(error as Error);\n }\n );\n responseAdded = true;\n instrumented.add(axios as object);\n } catch (err) {\n const unwound =\n (!responseAdded || ejectInterceptor(axios.interceptors.response, responseId)) &&\n (!requestAdded || ejectInterceptor(axios.interceptors.request, requestId));\n if (!unwound) {\n /*\n * Interceptors may still be registered and cannot be ejected. Mark disposed\n * and keep the WeakSet slot, but register a restore so teardownJourney can\n * unmark and a later retry can proceed.\n */\n record.disposed = true;\n instrumented.add(axios as object);\n const restore = () => {\n record.disposed = true;\n instrumented.delete(axios as object);\n };\n record.restore = restore;\n registerInstrumentRecord(record);\n // eslint-disable-next-line no-console -- soft-fail host wiring\n console.error('[journey] instrumentAxios failed', err);\n return restore;\n }\n // eslint-disable-next-line no-console -- soft-fail host wiring\n console.error('[journey] instrumentAxios failed', err);\n return () => {};\n }\n\n const restore = () => {\n record.disposed = true;\n ejectInterceptor(axios.interceptors.request, requestId);\n ejectInterceptor(axios.interceptors.response, responseId);\n instrumented.delete(axios as object);\n };\n record.restore = restore;\n registerInstrumentRecord(record);\n return restore;\n}\n"],"names":["resolveStamp","adoptJourneyStepStamp","getInstrumentedAxiosSet","registerInstrumentRecord","isCanceledError","onHttpComplete","requestKey","acceptInstrumentTarget","axiosStamps","WeakMap","stampFromConfig","config","undefined","get","stamp","reportTiming","instance","status","aborted","extras","ignore","start","journeyStart","globalThis","performance","now","key","url","baseURL","defaults","durationMs","method","meta","request","response","error","isAxiosLikeInstance","value","interceptors","use","ejectInterceptor","id","eject","instrumentAxios","axios","instrumented","has","record","disposed","requestId","responseId","requestAdded","responseAdded","timed","set","axiosError","Promise","reject","add","err","unwound","restore","delete","console"],"mappings":"AAAA,SAASA,YAAY,QAAQ,UAAU;AACvC,SAASC,qBAAqB,QAA+B,mBAAmB;AAChF,SACIC,uBAAuB,EACvBC,wBAAwB,QAErB,YAAY;AACnB,SAASC,eAAe,EAAEC,cAAc,QAAQ,gBAAgB;AAChE,SAASC,UAAU,QAA+B,gBAAgB;AAClE,SAASC,sBAAsB,QAAQ,cAAc;AAqBrD,MAAMC,cAAc,IAAIC;AAExB,SAASC,gBAAgBC,MAA+B;QAI7CH;IAHP,IAAI,CAACG,QAAQ;QACT,OAAOC;IACX;IACA,QAAOJ,mBAAAA,YAAYK,GAAG,CAACF,qBAAhBH,8BAAAA,mBAA2BP,sBAAsBU,OAAOG,KAAK;AACxE;AAEA,SAASC,aACLC,QAA2B,EAC3BL,MAA+B,EAC/BM,MAA0B,EAC1BC,OAAgB,EAChBC,MAAmE;QASrDR,sBASDA;IAhBb,IAAI,CAACA,UAAUA,OAAOS,MAAM,KAAK,MAAM;QACnC;IACJ;IACA,MAAMN,QAAQJ,gBAAgBC;IAC9B,IAAI,CAACG,SAASA,MAAMM,MAAM,EAAE;QACxB;IACJ;IACA,MAAMC,SAAQV,uBAAAA,OAAOW,YAAY,cAAnBX,kCAAAA,uBAAuBY,WAAWC,WAAW,CAACC,GAAG;IAC/D,MAAMC,MAAMpB,WAAWK,OAAOgB,GAAG,EAAEhB,OAAOiB,OAAO,EAAEZ,SAASa,QAAQ,CAACD,OAAO;IAC5EvB,eAAe;QACXS;QACAG;QACAa,YAAYP,WAAWC,WAAW,CAACC,GAAG,KAAKJ;QAC3Cf,YAAYoB;QACZR;QACAS,KAAKh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AY5C,MAAM;oBAC3BuB,QAAQ,EAAEqB,uBAAAA,iCAAAA,WAAYrB,QAAQ;oBAC9BC;gBACJ;YAER;YACA;;;iBAGC,GACD,OAAOqB,QAAQC,MAAM,CAACtB;QAC1B;QAEJiB,gBAAgB;QAChBP,aAAaa,GAAG,CAACd;IACrB,EAAE,OAAOe,KAAK;QACV,MAAMC,UACF,AAAC,CAAA,CAACR,iBAAiBZ,iBAAiBI,MAAMN,YAAY,CAACJ,QAAQ,EAAEgB,WAAU,KAC1E,CAAA,CAACC,gBAAgBX,iBAAiBI,MAAMN,YAAY,CAACL,OAAO,EAAEgB,UAAS;QAC5E,IAAI,CAACW,SAAS;YACV;;;;aAIC,GACDb,OAAOC,QAAQ,GAAG;YAClBH,aAAaa,GAAG,CAACd;YACjB,MAAMiB,UAAU;gBACZd,OAAOC,QAAQ,GAAG;gBAClBH,aAAaiB,MAAM,CAAClB;YACxB;YACAG,OAAOc,OAAO,GAAGA;YACjB1D,yBAAyB4C;YACzB,+DAA+D;YAC/DgB,QAAQ5B,KAAK,CAAC,oCAAoCwB;YAClD,OAAOE;QACX;QACA,+DAA+D;QAC/DE,QAAQ5B,KAAK,CAAC,oCAAoCwB;QAClD,OAAO,KAAO;IAClB;IAEA,MAAME,UAAU;QACZd,OAAOC,QAAQ,GAAG;QAClBR,iBAAiBI,MAAMN,YAAY,CAACL,OAAO,EAAEgB;QAC7CT,iBAAiBI,MAAMN,YAAY,CAACJ,QAAQ,EAAEgB;QAC9CL,aAAaiB,MAAM,CAAClB;IACxB;IACAG,OAAOc,OAAO,GAAGA;IACjB1D,yBAAyB4C;IACzB,OAAOc;AACX"}
@@ -7,6 +7,8 @@ export interface HttpCompleteReport {
7
7
  requestKey: string;
8
8
  aborted?: boolean;
9
9
  url?: string;
10
+ /** Actual request base, used only to validate the log-correlation origin. */
11
+ baseURL?: string;
10
12
  method?: string;
11
13
  /** Per-request literal overrides from JourneyTimedMeta. */
12
14
  meta?: JourneyTimedMeta;
@@ -1 +1 @@
1
- {"version":3,"file":"http-report.d.ts","sourceRoot":"","sources":["../../src/integrations/http-report.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAwCD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CA2G/D;AAED,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"http-report.d.ts","sourceRoot":"","sources":["../../src/integrations/http-report.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAwCD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAkD/D;AA2ED,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
@@ -2,6 +2,7 @@ import { MAX_ATTRIBUTED_REQUEST_KEYS } from '../core/limits';
2
2
  import { isJourneyRequestPolicy, resolveRequestPolicy } from '../core/request-policy';
3
3
  import { reportBackendRequest } from '../core/api';
4
4
  import { canRouteHttpToJourney, resolveJourneyEngine } from '../core/runtime';
5
+ import { captureRequestCorrelation } from './request-correlation';
5
6
  function applyPolicy(policy, step, reason, status) {
6
7
  var _step, _reason;
7
8
  if (policy === 'continue') {
@@ -39,7 +40,7 @@ function httpScoreReason(report) {
39
40
  * Ignored endpoint prefixes never change the journey verdict.
40
41
  * 4xx with policy `'continue'` (default) still scores latency.
41
42
  */ export function onHttpComplete(report) {
42
- const { stamp, status, durationMs, requestKey, aborted, url, method, meta, request, response, error } = report;
43
+ const { stamp, requestKey, aborted, meta } = report;
43
44
  if (!stamp) {
44
45
  return;
45
46
  }
@@ -70,6 +71,20 @@ function httpScoreReason(report) {
70
71
  if (requestKey && engine.shouldIgnoreRequest(requestKey)) {
71
72
  return;
72
73
  }
74
+ // Capture before a policy/latency breach synchronously emits the terminal event.
75
+ const correlation = captureRequestCorrelation(report);
76
+ const previous = step.journey.scoringRequest;
77
+ // Scope this pointer to scoring. Later JS/business failures must not blame the last request.
78
+ step.journey.scoringRequest = correlation;
79
+ try {
80
+ scoreHttpComplete(report, step);
81
+ } finally{
82
+ step.journey.scoringRequest = previous;
83
+ }
84
+ }
85
+ function scoreHttpComplete(report, step) {
86
+ const { stamp, status, durationMs, requestKey, aborted, url, method, meta, request, response, error } = report;
87
+ const engine = resolveJourneyEngine(step.journey);
73
88
  const ctx = {
74
89
  requestKey,
75
90
  status,
@@ -79,7 +94,7 @@ function httpScoreReason(report) {
79
94
  journeyName: step.journey.name,
80
95
  stepName: step.name
81
96
  };
82
- const score = stamp.score;
97
+ const score = stamp === null || stamp === void 0 ? void 0 : stamp.score;
83
98
  if (score) {
84
99
  let policy;
85
100
  try {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/integrations/http-report.ts"],"sourcesContent":["import { MAX_ATTRIBUTED_REQUEST_KEYS } from '../core/limits';\nimport {\n isJourneyRequestPolicy,\n resolveRequestPolicy,\n type JourneyHttpPolicyContext,\n type JourneyRequestPolicy,\n} from '../core/request-policy';\nimport { reportBackendRequest } from '../core/api';\nimport { canRouteHttpToJourney, resolveJourneyEngine } from '../core/runtime';\nimport type { JourneyStepStamp } from '../core/step-tag';\nimport type { StepRecord } from '../core/types';\nimport type { JourneyTimedMeta } from './request-key';\n\nexport interface HttpCompleteReport {\n stamp: JourneyStepStamp | undefined;\n status?: number;\n durationMs: number;\n requestKey: string;\n aborted?: boolean;\n url?: string;\n method?: string;\n /** Per-request literal overrides from JourneyTimedMeta. */\n meta?: JourneyTimedMeta;\n /** Transport request (axios config, fetch input/init, jQuery settings). */\n request?: unknown;\n /** Transport response (axios response, fetch Response, jqXHR). */\n response?: unknown;\n /** Rejection reason when the transport failed. */\n error?: unknown;\n}\n\nfunction applyPolicy(\n policy: JourneyRequestPolicy,\n step: StepRecord,\n reason: string,\n status?: number\n): void {\n if (policy === 'continue') {\n return;\n }\n const journey = step.journey;\n if (!journey || journey.closed) {\n return;\n }\n const engine = resolveJourneyEngine(journey);\n if (policy === 'exclude') {\n engine.exclude();\n return;\n }\n // 'bad'\n step.outcome = 'bad';\n step.reason ??= reason;\n if (status !== undefined) {\n step.httpStatus = status;\n }\n engine.failJourney(reason);\n}\n\nfunction httpScoreReason(report: HttpCompleteReport): string {\n if (report.aborted) {\n return 'request-aborted';\n }\n const status = report.status;\n if (status !== undefined && status >= 400 && status < 500) {\n return 'request-client-error';\n }\n return 'request-error';\n}\n\n/**\n * Attribute a finished HTTP call: abort / 4xx policies, else 5xx+latency via reportBackendRequest.\n * Ignored endpoint prefixes never change the journey verdict.\n * 4xx with policy `'continue'` (default) still scores latency.\n */\nexport function onHttpComplete(report: HttpCompleteReport): void {\n const {\n stamp,\n status,\n durationMs,\n requestKey,\n aborted,\n url,\n method,\n meta,\n request,\n response,\n error,\n } = report;\n if (!stamp) {\n return;\n }\n const step = stamp.step;\n if (!step?.journey) {\n return;\n }\n /*\n * Unstamped foreign journeys (older package copies) cannot be closed from\n * this bundle — do not write onHttpAborted / step.outcome on them.\n */\n if (!canRouteHttpToJourney(step.journey)) {\n return;\n }\n const engine = resolveJourneyEngine(step.journey);\n\n if (meta?.ignore === true || stamp.ignore === true) {\n return;\n }\n\n if (aborted) {\n step.onHttpAborted = true;\n }\n\n if (requestKey) {\n step.attributedRequestKeys ??= [];\n if (\n step.attributedRequestKeys.length < MAX_ATTRIBUTED_REQUEST_KEYS &&\n !step.attributedRequestKeys.includes(requestKey)\n ) {\n step.attributedRequestKeys.push(requestKey);\n }\n }\n\n if (requestKey && engine.shouldIgnoreRequest(requestKey)) {\n return;\n }\n\n const ctx: JourneyHttpPolicyContext = {\n requestKey,\n status,\n aborted: aborted === true,\n url,\n method,\n journeyName: step.journey.name,\n stepName: step.name,\n };\n\n const score = stamp.score;\n if (score) {\n let policy: JourneyRequestPolicy | undefined;\n try {\n const scored = score({\n ...ctx,\n durationMs,\n request,\n response,\n error,\n });\n if (isJourneyRequestPolicy(scored)) {\n policy = scored;\n }\n } catch {\n policy = undefined;\n }\n if (policy !== undefined) {\n applyPolicy(policy, step, httpScoreReason(report), status);\n return;\n }\n }\n\n if (aborted) {\n const override = meta?.httpAbortedRequests;\n const policy = isJourneyRequestPolicy(override)\n ? override\n : resolveRequestPolicy(engine.getHttpAbortedRequestsPolicy(), 'continue', ctx);\n applyPolicy(policy, step, 'request-aborted');\n return;\n }\n\n if (status !== undefined && status >= 400 && status < 500) {\n const override = meta?.httpClientErrorRequests;\n const policy = isJourneyRequestPolicy(override)\n ? override\n : resolveRequestPolicy(engine.getHttpClientErrorRequestsPolicy(), 'continue', ctx);\n if (policy !== 'continue') {\n applyPolicy(policy, step, 'request-client-error', status);\n return;\n }\n // 'continue' does not count 4xx as an error; still score latency below.\n }\n\n reportBackendRequest(step, status, durationMs, requestKey);\n}\n\nexport { isAbortError, isCanceledError } from '../core/abort-error';\n"],"names":["MAX_ATTRIBUTED_REQUEST_KEYS","isJourneyRequestPolicy","resolveRequestPolicy","reportBackendRequest","canRouteHttpToJourney","resolveJourneyEngine","applyPolicy","policy","step","reason","status","journey","closed","engine","exclude","outcome","undefined","httpStatus","failJourney","httpScoreReason","report","aborted","onHttpComplete","stamp","durationMs","requestKey","url","method","meta","request","response","error","ignore","onHttpAborted","attributedRequestKeys","length","includes","push","shouldIgnoreRequest","ctx","journeyName","name","stepName","score","scored","override","httpAbortedRequests","getHttpAbortedRequestsPolicy","httpClientErrorRequests","getHttpClientErrorRequestsPolicy","isAbortError","isCanceledError"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,iBAAiB;AAC7D,SACIC,sBAAsB,EACtBC,oBAAoB,QAGjB,yBAAyB;AAChC,SAASC,oBAAoB,QAAQ,cAAc;AACnD,SAASC,qBAAqB,EAAEC,oBAAoB,QAAQ,kBAAkB;AAuB9E,SAASC,YACLC,MAA4B,EAC5BC,IAAgB,EAChBC,MAAc,EACdC,MAAe;QAgBfF,OAAAA;IAdA,IAAID,WAAW,YAAY;QACvB;IACJ;IACA,MAAMI,UAAUH,KAAKG,OAAO;IAC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ClD;QACJ;IACA,wEAAwE;IAC5E;IAEAP,qBAAqBK,MAAME,QAAQc,YAAYC;AACnD;AAEA,SAASyB,YAAY,EAAEC,eAAe,QAAQ,sBAAsB"}
1
+ {"version":3,"sources":["../../src/integrations/http-report.ts"],"sourcesContent":["import { MAX_ATTRIBUTED_REQUEST_KEYS } from '../core/limits';\nimport {\n isJourneyRequestPolicy,\n resolveRequestPolicy,\n type JourneyHttpPolicyContext,\n type JourneyRequestPolicy,\n} from '../core/request-policy';\nimport { reportBackendRequest } from '../core/api';\nimport { canRouteHttpToJourney, resolveJourneyEngine } from '../core/runtime';\nimport type { JourneyStepStamp } from '../core/step-tag';\nimport type { StepRecord } from '../core/types';\nimport type { JourneyTimedMeta } from './request-key';\nimport { captureRequestCorrelation } from './request-correlation';\n\nexport interface HttpCompleteReport {\n stamp: JourneyStepStamp | undefined;\n status?: number;\n durationMs: number;\n requestKey: string;\n aborted?: boolean;\n url?: string;\n /** Actual request base, used only to validate the log-correlation origin. */\n baseURL?: string;\n method?: string;\n /** Per-request literal overrides from JourneyTimedMeta. */\n meta?: JourneyTimedMeta;\n /** Transport request (axios config, fetch input/init, jQuery settings). */\n request?: unknown;\n /** Transport response (axios response, fetch Response, jqXHR). */\n response?: unknown;\n /** Rejection reason when the transport failed. */\n error?: unknown;\n}\n\nfunction applyPolicy(\n policy: JourneyRequestPolicy,\n step: StepRecord,\n reason: string,\n status?: number\n): void {\n if (policy === 'continue') {\n return;\n }\n const journey = step.journey;\n if (!journey || journey.closed) {\n return;\n }\n const engine = resolveJourneyEngine(journey);\n if (policy === 'exclude') {\n engine.exclude();\n return;\n }\n // 'bad'\n step.outcome = 'bad';\n step.reason ??= reason;\n if (status !== undefined) {\n step.httpStatus = status;\n }\n engine.failJourney(reason);\n}\n\nfunction httpScoreReason(report: HttpCompleteReport): string {\n if (report.aborted) {\n return 'request-aborted';\n }\n const status = report.status;\n if (status !== undefined && status >= 400 && status < 500) {\n return 'request-client-error';\n }\n return 'request-error';\n}\n\n/**\n * Attribute a finished HTTP call: abort / 4xx policies, else 5xx+latency via reportBackendRequest.\n * Ignored endpoint prefixes never change the journey verdict.\n * 4xx with policy `'continue'` (default) still scores latency.\n */\nexport function onHttpComplete(report: HttpCompleteReport): void {\n const { stamp, requestKey, aborted, meta } = report;\n if (!stamp) {\n return;\n }\n const step = stamp.step;\n if (!step?.journey) {\n return;\n }\n /*\n * Unstamped foreign journeys (older package copies) cannot be closed from\n * this bundle — do not write onHttpAborted / step.outcome on them.\n */\n if (!canRouteHttpToJourney(step.journey)) {\n return;\n }\n const engine = resolveJourneyEngine(step.journey);\n\n if (meta?.ignore === true || stamp.ignore === true) {\n return;\n }\n\n if (aborted) {\n step.onHttpAborted = true;\n }\n\n if (requestKey) {\n step.attributedRequestKeys ??= [];\n if (\n step.attributedRequestKeys.length < MAX_ATTRIBUTED_REQUEST_KEYS &&\n !step.attributedRequestKeys.includes(requestKey)\n ) {\n step.attributedRequestKeys.push(requestKey);\n }\n }\n\n if (requestKey && engine.shouldIgnoreRequest(requestKey)) {\n return;\n }\n\n // Capture before a policy/latency breach synchronously emits the terminal event.\n const correlation = captureRequestCorrelation(report);\n const previous = step.journey.scoringRequest;\n // Scope this pointer to scoring. Later JS/business failures must not blame the last request.\n step.journey.scoringRequest = correlation;\n try {\n scoreHttpComplete(report, step);\n } finally {\n step.journey.scoringRequest = previous;\n }\n}\n\nfunction scoreHttpComplete(report: HttpCompleteReport, step: StepRecord): void {\n const {\n stamp,\n status,\n durationMs,\n requestKey,\n aborted,\n url,\n method,\n meta,\n request,\n response,\n error,\n } = report;\n const engine = resolveJourneyEngine(step.journey);\n\n const ctx: JourneyHttpPolicyContext = {\n requestKey,\n status,\n aborted: aborted === true,\n url,\n method,\n journeyName: step.journey.name,\n stepName: step.name,\n };\n\n const score = stamp?.score;\n if (score) {\n let policy: JourneyRequestPolicy | undefined;\n try {\n const scored = score({\n ...ctx,\n durationMs,\n request,\n response,\n error,\n });\n if (isJourneyRequestPolicy(scored)) {\n policy = scored;\n }\n } catch {\n policy = undefined;\n }\n if (policy !== undefined) {\n applyPolicy(policy, step, httpScoreReason(report), status);\n return;\n }\n }\n\n if (aborted) {\n const override = meta?.httpAbortedRequests;\n const policy = isJourneyRequestPolicy(override)\n ? override\n : resolveRequestPolicy(engine.getHttpAbortedRequestsPolicy(), 'continue', ctx);\n applyPolicy(policy, step, 'request-aborted');\n return;\n }\n\n if (status !== undefined && status >= 400 && status < 500) {\n const override = meta?.httpClientErrorRequests;\n const policy = isJourneyRequestPolicy(override)\n ? override\n : resolveRequestPolicy(engine.getHttpClientErrorRequestsPolicy(), 'continue', ctx);\n if (policy !== 'continue') {\n applyPolicy(policy, step, 'request-client-error', status);\n return;\n }\n // 'continue' does not count 4xx as an error; still score latency below.\n }\n\n reportBackendRequest(step, status, durationMs, requestKey);\n}\n\nexport { isAbortError, isCanceledError } from '../core/abort-error';\n"],"names":["MAX_ATTRIBUTED_REQUEST_KEYS","isJourneyRequestPolicy","resolveRequestPolicy","reportBackendRequest","canRouteHttpToJourney","resolveJourneyEngine","captureRequestCorrelation","applyPolicy","policy","step","reason","status","journey","closed","engine","exclude","outcome","undefined","httpStatus","failJourney","httpScoreReason","report","aborted","onHttpComplete","stamp","requestKey","meta","ignore","onHttpAborted","attributedRequestKeys","length","includes","push","shouldIgnoreRequest","correlation","previous","scoringRequest","scoreHttpComplete","durationMs","url","method","request","response","error","ctx","journeyName","name","stepName","score","scored","override","httpAbortedRequests","getHttpAbortedRequestsPolicy","httpClientErrorRequests","getHttpClientErrorRequestsPolicy","isAbortError","isCanceledError"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,iBAAiB;AAC7D,SACIC,sBAAsB,EACtBC,oBAAoB,QAGjB,yBAAyB;AAChC,SAASC,oBAAoB,QAAQ,cAAc;AACnD,SAASC,qBAAqB,EAAEC,oBAAoB,QAAQ,kBAAkB;AAI9E,SAASC,yBAAyB,QAAQ,wBAAwB;AAsBlE,SAASC,YACLC,MAA4B,EAC5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C,SAASS;QACb;QACA,IAAIT,WAAWS,WAAW;YACtBV,YAAYC,QAAQC,MAAMW,gBAAgBC,SAASV;YACnD;QACJ;IACJ;IAEA,IAAIW,SAAS;QACT,MAAM4B,WAAWxB,iBAAAA,2BAAAA,KAAMyB,mBAAmB;QAC1C,MAAM3C,SAASP,uBAAuBiD,YAChCA,WACAhD,qBAAqBY,OAAOsC,4BAA4B,IAAI,YAAYR;QAC9ErC,YAAYC,QAAQC,MAAM;QAC1B;IACJ;IAEA,IAAIE,WAAWM,aAAaN,UAAU,OAAOA,SAAS,KAAK;QACvD,MAAMuC,WAAWxB,iBAAAA,2BAAAA,KAAM2B,uBAAuB;QAC9C,MAAM7C,SAASP,uBAAuBiD,YAChCA,WACAhD,qBAAqBY,OAAOwC,gCAAgC,IAAI,YAAYV;QAClF,IAAIpC,WAAW,YAAY;YACvBD,YAAYC,QAAQC,MAAM,wBAAwBE;YAClD;QACJ;IACA,wEAAwE;IAC5E;IAEAR,qBAAqBM,MAAME,QAAQ2B,YAAYb;AACnD;AAEA,SAAS8B,YAAY,EAAEC,eAAe,QAAQ,sBAAsB"}
@@ -4,6 +4,8 @@ export interface JqueryXHR {
4
4
  statusText?: string;
5
5
  stamp?: unknown;
6
6
  journeyStart?: number;
7
+ getResponseHeader?(name: string): string | null;
8
+ always?(callback: () => void): unknown;
7
9
  }
8
10
  export interface JqueryAjaxSettings extends JourneyTimedMeta {
9
11
  url?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"instrument.d.ts","sourceRoot":"","sources":["../../../src/integrations/jquery/instrument.ts"],"names":[],"mappings":"AAQA,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGnE,MAAM,WAAW,SAAS;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,k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,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAID,MAAM,WAAW,YAAY;IACzB,aAAa,CACT,OAAO,EAAE,CACL,OAAO,EAAE,kBAAkB,EAC3B,eAAe,EAAE,kBAAkB,EACnC,KAAK,EAAE,SAAS,KACf,IAAI,GACV,IAAI,CAAC;IACR,CAAC,QAAQ,EAAE,QAAQ,GAAG;QAClB,YAAY,CACR,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,kBAAkB,KAAK,IAAI,GAClF,IAAI,CAAC;KACX,CAAC;CACL;AAkCD,wDAAwD;AACxD,wBAAgB,mBAAmB,IAAI,YAAY,GAAG,IAAI,GAAG,SAAS,CAGrE;AAuBD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,IAAI,CA2F/E"}
@@ -2,10 +2,11 @@ import { resolveStamp } from '../../core';
2
2
  import { adoptJourneyStepStamp } from '../../core/step-tag';
3
3
  import { getInstrumentedJquerySet, registerInstrumentRecord } from '../../global';
4
4
  import { onHttpComplete } from '../http-report';
5
+ import { captureRequestCorrelation } from '../request-correlation';
5
6
  import { requestKey } from '../request-key';
6
7
  import { acceptInstrumentTarget } from '../soft-skip';
7
8
  const jqueryStamps = new WeakMap();
8
- function reportTiming(jqXHR, settings) {
9
+ function timingReport(jqXHR, settings) {
9
10
  var _jqueryStamps_get, _jqXHR_journeyStart, _settings_type;
10
11
  const stamp = (_jqueryStamps_get = jqueryStamps.get(jqXHR)) !== null && _jqueryStamps_get !== void 0 ? _jqueryStamps_get : adoptJourneyStepStamp(jqXHR.stamp);
11
12
  if (!stamp || stamp.ignore || settings.ignore === true) {
@@ -15,7 +16,7 @@ function reportTiming(jqXHR, settings) {
15
16
  const aborted = jqXHR.statusText === 'abort';
16
17
  // jQuery uses status 0 for network / abort failures — treat like a missing status.
17
18
  const status = aborted || jqXHR.status === 0 ? undefined : jqXHR.status;
18
- onHttpComplete({
19
+ return {
19
20
  stamp,
20
21
  status,
21
22
  durationMs: globalThis.performance.now() - start,
@@ -26,7 +27,7 @@ function reportTiming(jqXHR, settings) {
26
27
  meta: settings,
27
28
  request: settings,
28
29
  response: jqXHR
29
- });
30
+ };
30
31
  }
31
32
  function isJqueryStatic(value) {
32
33
  return typeof value === 'function' && typeof value.ajaxPrefilter === 'function';
@@ -76,6 +77,29 @@ function stampAjax(jqXHR, options) {
76
77
  return;
77
78
  }
78
79
  stampAjax(jqXHR, options);
80
+ /*
81
+ * Prefilters run before application success/error callbacks; ajaxComplete runs after.
82
+ * Capture headers here, but keep verdict scoring in ajaxComplete as before.
83
+ */ try {
84
+ if (jqueryStamps.has(jqXHR)) {
85
+ var _jqXHR_always;
86
+ (_jqXHR_always = jqXHR.always) === null || _jqXHR_always === void 0 ? void 0 : _jqXHR_always.call(jqXHR, ()=>{
87
+ if (current.disposed) {
88
+ return;
89
+ }
90
+ try {
91
+ const report = timingReport(jqXHR, options);
92
+ if (report) {
93
+ captureRequestCorrelation(report);
94
+ }
95
+ } catch (unused) {
96
+ // This observer must never interrupt application callbacks.
97
+ }
98
+ });
99
+ }
100
+ } catch (unused) {
101
+ // Partial jQuery-compatible clients may not support response observers.
102
+ }
79
103
  });
80
104
  jqueryPrefiltersInstalled.add(key);
81
105
  }
@@ -85,7 +109,10 @@ function stampAjax(jqXHR, options) {
85
109
  if (!current || current.disposed) {
86
110
  return;
87
111
  }
88
- reportTiming(jqXHR, settings);
112
+ const report = timingReport(jqXHR, settings);
113
+ if (report) {
114
+ onHttpComplete(report);
115
+ }
89
116
  });
90
117
  jqueryCompletesInstalled.add(key);
91
118
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/integrations/jquery/instrument.ts"],"sourcesContent":["import { resolveStamp } from '../../core';\nimport { adoptJourneyStepStamp, type JourneyStepStamp } from '../../core/step-tag';\nimport {\n getInstrumentedJquerySet,\n registerInstrumentRecord,\n type InstrumentRecord,\n} from '../../global';\nimport { onHttpComplete } from '../http-report';\nimport { requestKey, type JourneyTimedMeta } from '../request-key';\nimport { acceptInstrumentTarget } from '../soft-skip';\n\nexport interface JqueryXHR {\n status: number;\n statusText?: string;\n stamp?: unknown;\n journeyStart?: number;\n}\n\nexport interface JqueryAjaxSettings extends JourneyTimedMeta {\n url?: string;\n type?: string;\n method?: string;\n}\n\nconst jqueryStamps = new WeakMap<object, JourneyStepStamp>();\n\nexport interface JqueryStatic {\n ajaxPrefilter(\n handler: (\n options: JqueryAjaxSettings,\n originalOptions: JqueryAjaxSettings,\n jqXHR: JqueryXHR\n ) => void\n ): void;\n (selector: Document): {\n ajaxComplete(\n handler: (event: unknown, jqXHR: JqueryXHR, settings: JqueryAjaxSettings) => void\n ): void;\n };\n}\n\nfunction reportTiming(jqXHR: JqueryXHR, settings: JqueryAjaxSettings): void {\n const stamp = jqueryStamps.get(jqXHR) ?? adoptJourneyStepStamp(jqXHR.stamp);\n if (!stamp || stamp.ignore || settings.ignore === true) {\n return;\n }\n const start = jqXHR.journeyStart ?? globalThis.performance.now();\n const aborted = jqXHR.statusText === 'abort';\n // jQuery uses status 0 for network / abort failures — treat like a missing status.\n const status = aborted || jqXHR.status === 0 ? undefined : jqXHR.status;\n onHttpComplete({\n stamp,\n status,\n durationMs: globalThis.performance.now() - start,\n requestKey: requestKey(settings.url, undefined, undefined),\n aborted,\n url: settings.url,\n method: settings.type ?? settings.method,\n meta: settings,\n request: settings,\n response: jqXHR,\n });\n}\n\nfunction isJqueryStatic(value: unknown): value is JqueryStatic {\n return (\n typeof value === 'function' && typeof (value as JqueryStatic).ajaxPrefilter === 'function'\n );\n}\n\n/** Resolve `globalThis.$`, then `globalThis.jQuery`. */\nexport function resolveGlobalJquery(): JqueryStatic | null | undefined {\n const g = globalThis as typeof globalThis & { $?: unknown; jQuery?: unknown };\n return (g.$ ?? g.jQuery) as JqueryStatic | null | undefined;\n}\n\n/** Live record per $ — handlers look this up so restore+rewire does not stack prefilters. */\nconst jqueryLiveRecords = new WeakMap<object, InstrumentRecord>();\n/** jQuery cannot unregister these; track each so a partial-wire retry does not stack. */\nconst jqueryPrefiltersInstalled = new WeakSet<object>();\nconst jqueryCompletesInstalled = new WeakSet<object>();\n\nfunction stampAjax(jqXHR: JqueryXHR, options: JqueryAjaxSettings): void {\n if (options.ignore === true) {\n return;\n }\n const stamp = resolveStamp(jqXHR.stamp ?? options.stamp);\n if (stamp) {\n jqueryStamps.set(jqXHR, stamp);\n delete jqXHR.stamp;\n delete options.stamp;\n }\n if (stamp && !stamp.ignore) {\n jqXHR.journeyStart = globalThis.performance.now();\n }\n}\n\n/**\n * Wire a jQuery static into the journey engine. Call once per $ (idempotent). Observation-only.\n * Soft-skips when `$` is missing or not a real jQuery (no `ajaxPrefilter`) so hosts can pass `$` as-is.\n * Returns a restore that disposes handlers (they no-op after restore).\n */\nexport function instrumentJquery($: JqueryStatic | null | undefined): () => void {\n const jquery = acceptInstrumentTarget('Jquery', $, isJqueryStatic);\n const instrumented = getInstrumentedJquerySet();\n if (!jquery || instrumented.has(jquery as object)) {\n return () => {};\n }\n\n const key = jquery as object;\n const record: InstrumentRecord = { disposed: false };\n\n try {\n if (!jqueryPrefiltersInstalled.has(key)) {\n jquery.ajaxPrefilter((options, _originalOptions, jqXHR) => {\n const current = jqueryLiveRecords.get(key);\n if (!current || current.disposed) {\n return;\n }\n stampAjax(jqXHR, options);\n });\n jqueryPrefiltersInstalled.add(key);\n }\n if (!jqueryCompletesInstalled.has(key)) {\n jquery(document).ajaxComplete((_event, jqXHR, settings) => {\n const current = jqueryLiveRecords.get(key);\n if (!current || current.disposed) {\n return;\n }\n reportTiming(jqXHR, settings);\n });\n jqueryCompletesInstalled.add(key);\n }\n jqueryLiveRecords.set(key, record);\n instrumented.add(key);\n } catch (err) {\n /*\n * Keep per-handler installed flags so a retry cannot double-register\n * prefilters. Restore deletes the shared instrumented slot so teardown /\n * retry can finish whichever handler never succeeded.\n */\n record.disposed = true;\n instrumented.add(key);\n const restore = () => {\n record.disposed = true;\n if (jqueryLiveRecords.get(key) === record) {\n jqueryLiveRecords.delete(key);\n }\n instrumented.delete(key);\n };\n record.restore = restore;\n registerInstrumentRecord(record);\n // eslint-disable-next-line no-console -- soft-fail host wiring\n console.error('[journey] instrumentJquery failed', err);\n return restore;\n }\n\n const restore = () => {\n record.disposed = true;\n if (jqueryLiveRecords.get(key) === record) {\n jqueryLiveRecords.delete(key);\n }\n instrumented.delete(key);\n };\n record.restore = restore;\n registerInstrumentRecord(record);\n return restore;\n}\n"],"names":["resolveStamp","adoptJourneyStepStamp","getInstrumentedJquerySet","registerInstrumentRecord","onHttpComplete","requestKey","acceptInstrumentTarget","jqueryStamps","WeakMap","reportTiming","jqXHR","settings","stamp","get","ignore","start","journeyStart","globalThis","performance","now","aborted","statusText","status","undefined","durationMs","url","method","type","meta","request","response","isJqueryStatic","value","ajaxPrefilter","resolveGlobalJquery","g","$","jQuery","jqueryLiveRecords","jqueryPrefiltersInstalled","WeakSet","jqueryCompletesInstalled","stampAjax","options","set","instrumentJquery","jquery","instrumented","has","key","record","disposed","_originalOptions","current","add","document","ajaxComplete","_event","err","restore","delete","console","error"],"mappings":"AAAA,SAASA,YAAY,QAAQ,aAAa;AAC1C,SAASC,qBAAqB,QAA+B,sBAAsB;AACnF,SACIC,wBAAwB,EACxBC,wBAAwB,QAErB,eAAe;AACtB,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,UAAU,QAA+B,iBAAiB;AACnE,SAASC,sBAAsB,QAAQ,eAAe;AAetD,MAAMC,eAAe,IAAIC;AAiBzB,SAASC,aAAaC,KAAgB,EAAEC,QAA4B;QAClDJ,mBAIAG,qBAWFC;IAfZ,MAAMC,SAAQL,oBAAAA,aAAaM,GAAG,CAACH,oBAAjBH,+BAAAA,oBAA2BN,sBAAsBS,MAAME,KAAK;IAC1E,IAAI,CAACA,SAASA,MAAME,MAAM,IAAIH,SAASG,MAAM,KAAK,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GAAGA;QACjBxD,yBAAyB+C;QACzB,+DAA+D;QAC/DW,QAAQC,KAAK,CAAC,qCAAqCJ;QACnD,OAAOC;IACX;IAEA,MAAMA,UAAU;QACZT,OAAOC,QAAQ,GAAG;QAClB,IAAIb,kBAAkBzB,GAAG,CAACoC,SAASC,QAAQ;YACvCZ,kBAAkBsB,MAAM,CAACX;QAC7B;QACAF,aAAaa,MAAM,CAACX;IACxB;IACAC,OAAOS,OAAO,GAAGA;IACjBxD,yBAAyB+C;IACzB,OAAOS;AACX"}
1
+ {"version":3,"sources":["../../../src/integrations/jquery/instrument.ts"],"sourcesContent":["import { resolveStamp } from '../../core';\nimport { adoptJourneyStepStamp, type JourneyStepStamp } from '../../core/step-tag';\nimport {\n getInstrumentedJquerySet,\n registerInstrumentRecord,\n type InstrumentRecord,\n} from '../../global';\nimport { onHttpComplete, type HttpCompleteReport } from '../http-report';\nimport { captureRequestCorrelation } from '../request-correlation';\nimport { requestKey, type JourneyTimedMeta } from '../request-key';\nimport { acceptInstrumentTarget } from '../soft-skip';\n\nexport interface JqueryXHR {\n status: number;\n statusText?: string;\n stamp?: unknown;\n journeyStart?: number;\n getResponseHeader?(name: string): string | null;\n always?(callback: () => void): unknown;\n}\n\nexport interface JqueryAjaxSettings extends JourneyTimedMeta {\n url?: string;\n type?: string;\n method?: string;\n}\n\nconst jqueryStamps = new WeakMap<object, JourneyStepStamp>();\n\nexport interface JqueryStatic {\n ajaxPrefilter(\n handler: (\n options: JqueryAjaxSettings,\n originalOptions: JqueryAjaxSettings,\n jqXHR: JqueryXHR\n ) => void\n ): void;\n (selector: Document): {\n ajaxComplete(\n handler: (event: unknown, jqXHR: JqueryXHR, settings: JqueryAjaxSettings) => void\n ): void;\n };\n}\n\nfunction timingReport(\n jqXHR: JqueryXHR,\n settings: JqueryAjaxSettings\n): HttpCompleteReport | undefined {\n const stamp = jqueryStamps.get(jqXHR) ?? adoptJourneyStepStamp(jqXHR.stamp);\n if (!stamp || stamp.ignore || settings.ignore === true) {\n return;\n }\n const start = jqXHR.journeyStart ?? globalThis.performance.now();\n const aborted = jqXHR.statusText === 'abort';\n // jQuery uses status 0 for network / abort failures — treat like a missing status.\n const status = aborted || jqXHR.status === 0 ? undefined : jqXHR.status;\n return {\n stamp,\n status,\n durationMs: globalThis.performance.now() - start,\n requestKey: requestKey(settings.url, undefined, undefined),\n aborted,\n url: settings.url,\n method: settings.type ?? settings.method,\n meta: settings,\n request: settings,\n response: jqXHR,\n };\n}\n\nfunction isJqueryStatic(value: unknown): value is JqueryStatic {\n return (\n typeof value === 'function' && typeof (value as JqueryStatic).ajaxPrefilter === 'function'\n );\n}\n\n/** Resolve `globalThis.$`, then `globalThis.jQuery`. */\nexport function resolveGlobalJquery(): JqueryStatic | null | undefined {\n const g = globalThis as typeof globalThis & { $?: unknown; jQuery?: unknown };\n return (g.$ ?? g.jQuery) as JqueryStatic | null | undefined;\n}\n\n/** Live record per $ — handlers look this up so restore+rewire does not stack prefilters. */\nconst jqueryLiveRecords = new WeakMap<object, InstrumentRecord>();\n/** jQuery cannot unregister these; track each so a partial-wire retry does not stack. */\nconst jqueryPrefiltersInstalled = new WeakSet<object>();\nconst jqueryCompletesInstalled = new WeakSet<object>();\n\nfunction stampAjax(jqXHR: JqueryXHR, options: JqueryAjaxSettings): void {\n if (options.ignore === true) {\n return;\n }\n const stamp = resolveStamp(jqXHR.stamp ?? options.stamp);\n if (stamp) {\n jqueryStamps.set(jqXHR, stamp);\n delete jqXHR.stamp;\n delete options.stamp;\n }\n if (stamp && !stamp.ignore) {\n jqXHR.journeyStart = globalThis.performance.now();\n }\n}\n\n/**\n * Wire a jQuery static into the journey engine. Call once per $ (idempotent). Observation-only.\n * Soft-skips when `$` is missing or not a real jQuery (no `ajaxPrefilter`) so hosts can pass `$` as-is.\n * Returns a restore that disposes handlers (they no-op after restore).\n */\nexport function instrumentJquery($: JqueryStatic | null | undefined): () => void {\n const jquery = acceptInstrumentTarget('Jquery', $, isJqueryStatic);\n const instrumented = getInstrumentedJquerySet();\n if (!jquery || instrumented.has(jquery as object)) {\n return () => {};\n }\n\n const key = jquery as object;\n const record: InstrumentRecord = { disposed: false };\n\n try {\n if (!jqueryPrefiltersInstalled.has(key)) {\n jquery.ajaxPrefilter((options, _originalOptions, jqXHR) => {\n const current = jqueryLiveRecords.get(key);\n if (!current || current.disposed) {\n return;\n }\n stampAjax(jqXHR, options);\n /*\n * Prefilters run before application success/error callbacks; ajaxComplete runs after.\n * Capture headers here, but keep verdict scoring in ajaxComplete as before.\n */\n try {\n if (jqueryStamps.has(jqXHR)) {\n jqXHR.always?.(() => {\n if (current.disposed) {\n return;\n }\n try {\n const report = timingReport(jqXHR, options);\n if (report) {\n captureRequestCorrelation(report);\n }\n } catch {\n // This observer must never interrupt application callbacks.\n }\n });\n }\n } catch {\n // Partial jQuery-compatible clients may not support response observers.\n }\n });\n jqueryPrefiltersInstalled.add(key);\n }\n if (!jqueryCompletesInstalled.has(key)) {\n jquery(document).ajaxComplete((_event, jqXHR, settings) => {\n const current = jqueryLiveRecords.get(key);\n if (!current || current.disposed) {\n return;\n }\n const report = timingReport(jqXHR, settings);\n if (report) {\n onHttpComplete(report);\n }\n });\n jqueryCompletesInstalled.add(key);\n }\n jqueryLiveRecords.set(key, record);\n instrumented.add(key);\n } catch (err) {\n /*\n * Keep per-handler installed flags so a retry cannot double-register\n * prefilters. Restore deletes the shared instrumented slot so teardown /\n * retry can finish whichever handler never succeeded.\n */\n record.disposed = true;\n instrumented.add(key);\n const restore = () => {\n record.disposed = true;\n if (jqueryLiveRecords.get(key) === record) {\n jqueryLiveRecords.delete(key);\n }\n instrumented.delete(key);\n };\n record.restore = restore;\n registerInstrumentRecord(record);\n // eslint-disable-next-line no-console -- soft-fail host wiring\n console.error('[journey] instrumentJquery failed', err);\n return restore;\n }\n\n const restore = () => {\n record.disposed = true;\n if (jqueryLiveRecords.get(key) === record) {\n jqueryLiveRecords.delete(key);\n }\n instrumented.delete(key);\n };\n record.restore = restore;\n registerInstrumentRecord(record);\n return restore;\n}\n"],"names":["resolveStamp","adoptJourneyStepStamp","getInstrumentedJquerySet","registerInstrumentRecord","onHttpComplete","captureRequestCorrelation","requestKey","acceptInstrumentTarget","jqueryStamps","WeakMap","timingReport","jqXHR","settings","stamp","get","ignore","start","journeyStart","globalThis","performance","now","aborted","statusText","status","undefined","durationMs","url","method","type","meta","request","response","isJqueryStatic","value","ajaxPrefilter","resolveGlobalJquery","g","$","jQuery","jqueryLiveRecords","jqueryPrefiltersInstalled","WeakSet","jqueryCompletesInstalled","stampAjax","options","set","instrumentJquery","jquery","instrumented","has","key","record","disposed","_originalOptions","current","always","report","add","document","ajaxComplete","_event","err","restore","delete","console","error"],"mappings":"AAAA,SAASA,YAAY,QAAQ,aAAa;AAC1C,SAASC,qBAAqB,QAA+B,sBAAsB;AACnF,SACIC,wBAAwB,EACxBC,wBAAwB,QAErB,eAAe;AACtB,SAASC,cAAc,QAAiC,iBAAiB;AACzE,SAASC,yBAAyB,QAAQ,yBAAyB;AACnE,SAASC,UAAU,QAA+B,iBAAiB;AACnE,SAASC,sBAAsB,QAAQ,eAAe;AAiBtD,MAAMC,eAAe,IAAIC;AAiBzB,SAASC,aACLC,KAAgB,EAChBC,QAA4B;QAEdJ,mBAIAG,qBAWFC;IAfZ,MAAMC,SAAQL,oBAAAA,aAAaM,GAAG,CAACH,oBAAjBH,+BAAAA,oBAA2BP,sBAAsBU,MAAME,KAAK;IAC1E,IAAI,CAACA,SAASA,MAAME,MAAM,IAAIH,SAASG,MAAM,KAAK,MAAM;QACpD;IACJ;IACA,MAAMC,SAAQL,sBAAAA,MAAMM,YAAY,cAAlBN,iCAAAA,sBAAsBO,WAAWC,WAAW,CAACC,GAAG;IAC9D,MAAMC,UAAUV,MAAMW,UAAU,KAAK;IACrC,mFAAmF;IACnF,MAAMC,SAASF,WAAWV,MAAMY,MAAM,KAAK,IAAIC,YAAYb,MAAMY,MAAM;IACvE,OAAO;QACHV;QACAU;QACAE,YAAYP,WAAWC,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OAAOC,QAAQ,GAAG;YAClB,IAAIb,kBAAkBzB,GAAG,CAACoC,SAASC,QAAQ;gBACvCZ,kBAAkBwB,MAAM,CAACb;YAC7B;YACAF,aAAae,MAAM,CAACb;QACxB;QACAC,OAAOW,OAAO,GAAGA;QACjB3D,yBAAyBgD;QACzB,+DAA+D;QAC/Da,QAAQC,KAAK,CAAC,qCAAqCJ;QACnD,OAAOC;IACX;IAEA,MAAMA,UAAU;QACZX,OAAOC,QAAQ,GAAG;QAClB,IAAIb,kBAAkBzB,GAAG,CAACoC,SAASC,QAAQ;YACvCZ,kBAAkBwB,MAAM,CAACb;QAC7B;QACAF,aAAae,MAAM,CAACb;IACxB;IACAC,OAAOW,OAAO,GAAGA;IACjB3D,yBAAyBgD;IACzB,OAAOW;AACX"}
@@ -0,0 +1,5 @@
1
+ import type { HttpCompleteReport } from './http-report';
2
+ import type { JourneyRequestEvent } from '../core/types';
3
+ /** Observation only. Safe to run before jQuery invokes application callbacks. */
4
+ export declare function captureRequestCorrelation(report: HttpCompleteReport): JourneyRequestEvent | undefined;
5
+ //# sourceMappingURL=request-correlation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-correlation.d.ts","sourceRoot":"","sources":["../../src/integrations/request-correlation.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAYzD,iFAAiF;AACjF,wBAAgB,yBAAyB,CACrC,MAAM,EAAE,kBAAkB,GAC3B,mBAAmB,GAAG,SAAS,CAsEjC"}