@sgedda/mockifyer-fetch 1.8.39 → 1.8.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -41,10 +41,23 @@ const fetch_client_1 = require("./clients/fetch-client");
41
41
  class MockifyerClass {
42
42
  /** Best-effort dashboard network log (skipped when traffic goes through `proxy.baseUrl`). */
43
43
  logNetworkEvent(partial, correlation) {
44
+ // Dashboard proxy hops are recorded in performDashboardProxyRequest (shared axios/fetch path).
44
45
  if (this.config.proxy?.baseUrl)
45
46
  return;
46
47
  const scenario = this.config.proxy?.scenario?.trim() ||
47
48
  (0, mockifyer_core_1.getCurrentScenario)(this.config.mockDataPath);
49
+ (0, mockifyer_core_1.recordInlineTraceHopFromExchange)({
50
+ method: partial.method,
51
+ url: partial.url,
52
+ status: partial.status,
53
+ source: partial.source,
54
+ transport: partial.transport ?? 'fetch',
55
+ requestId: correlation?.requestId ?? partial.requestId ?? null,
56
+ parentRequestId: correlation?.parentRequestId ?? partial.parentRequestId ?? null,
57
+ durationMs: partial.durationMs,
58
+ clientId: this.config.clientId ?? partial.clientId ?? null,
59
+ errorMessage: partial.errorMessage,
60
+ });
48
61
  (0, mockifyer_core_1.emitMockifyerNetworkEvent)({
49
62
  config: this.config,
50
63
  scenario,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sgedda/mockifyer-fetch",
3
- "version": "1.8.39",
3
+ "version": "1.8.40",
4
4
  "description": "Mockifyer for Fetch - API mocking and logging utility for storing and replaying API responses",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "license": "MIT",
51
51
  "dependencies": {
52
- "@sgedda/mockifyer-core": "^1.10.15"
52
+ "@sgedda/mockifyer-core": "^1.10.17"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/node": "^20.11.24",
package/src/index.ts CHANGED
@@ -68,6 +68,7 @@ import {
68
68
  type MockifyerActivationMode,
69
69
  emitMockifyerNetworkEvent,
70
70
  networkEventHashFromRequestKey,
71
+ recordInlineTraceHopFromExchange,
71
72
  resolveRecordResponses,
72
73
  applyOutboundRequestCorrelation,
73
74
  type RequestCorrelationContext,
@@ -116,10 +117,26 @@ class MockifyerClass {
116
117
  partial: Parameters<typeof emitMockifyerNetworkEvent>[0]['event'] & { transport?: 'fetch' },
117
118
  correlation?: RequestCorrelationContext
118
119
  ): void {
120
+ // Dashboard proxy hops are recorded in performDashboardProxyRequest (shared axios/fetch path).
119
121
  if (this.config.proxy?.baseUrl) return;
122
+
120
123
  const scenario =
121
124
  this.config.proxy?.scenario?.trim() ||
122
125
  getCurrentScenario(this.config.mockDataPath);
126
+
127
+ recordInlineTraceHopFromExchange({
128
+ method: partial.method,
129
+ url: partial.url,
130
+ status: partial.status,
131
+ source: partial.source,
132
+ transport: partial.transport ?? 'fetch',
133
+ requestId: correlation?.requestId ?? partial.requestId ?? null,
134
+ parentRequestId: correlation?.parentRequestId ?? partial.parentRequestId ?? null,
135
+ durationMs: partial.durationMs,
136
+ clientId: this.config.clientId ?? partial.clientId ?? null,
137
+ errorMessage: partial.errorMessage,
138
+ });
139
+
123
140
  emitMockifyerNetworkEvent({
124
141
  config: this.config,
125
142
  scenario,