@sgedda/mockifyer-fetch 1.8.87 → 1.8.96

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sgedda/mockifyer-fetch",
3
- "version": "1.8.87",
3
+ "version": "1.8.96",
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.162"
52
+ "@sgedda/mockifyer-core": "^1.10.176"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/node": "^20.11.24",
package/src/index.ts CHANGED
@@ -77,11 +77,13 @@ import {
77
77
  unwrapAndMergeInlineTraceEnvelope,
78
78
  unwrapInlineTraceEnvelopeEmittingNetworkEvents,
79
79
  resolveNetworkLogIncludeTraceOptions,
80
+ resolveNetworkLogIncludeTraceOptionsAsync,
80
81
  getInlineTraceEnvelopeBusinessBody,
81
82
  resolveRecordResponses,
82
83
  applyOutboundRequestCorrelation,
83
84
  adoptStoredOutboundRequestId,
84
85
  resolvePersistedHopIds,
86
+ applyPersistedHopIds,
85
87
  attachMockifyerRequestIdToError,
86
88
  resolveMockifyerRequestIdForError,
87
89
  configureFlightRecorder,
@@ -97,6 +99,8 @@ import {
97
99
  resolveRuntimeEnabledStorage,
98
100
  savePersistedRuntimeEnabled,
99
101
  type MockifyerRuntimeEnabledStorage,
102
+ outboundHeadersToRecord,
103
+ appendParamsToUrl,
100
104
  } from '@sgedda/mockifyer-core';
101
105
  import { logger, setLogLevel } from '@sgedda/mockifyer-core';
102
106
  import {
@@ -178,13 +182,26 @@ class MockifyerClass {
178
182
  });
179
183
  }
180
184
 
181
- private applyOutboundCorrelation(config: unknown): RequestCorrelationContext {
185
+ private async applyOutboundCorrelation(config: unknown): Promise<RequestCorrelationContext> {
182
186
  return applyOutboundRequestCorrelation(
183
187
  config as { headers?: unknown; url?: unknown; method?: unknown },
184
- resolveNetworkLogIncludeTraceOptions(this.config)
188
+ await resolveNetworkLogIncludeTraceOptionsAsync(this.config)
185
189
  );
186
190
  }
187
191
 
192
+ /**
193
+ * Full outbound URL including `params` — hop logs / Atlas curl / include-trace
194
+ * must not drop the query string (fetch splits search into `config.params`).
195
+ */
196
+ private resolveLoggedRequestUrl(
197
+ config?: { url?: string; params?: Record<string, unknown> } | null,
198
+ fallbackUrl?: string,
199
+ ): string {
200
+ const raw = (fallbackUrl || config?.url || '').trim();
201
+ if (!raw) return '';
202
+ return appendParamsToUrl(raw, config?.params);
203
+ }
204
+
188
205
  /** Best-effort dashboard network log. */
189
206
  private logNetworkEvent(
190
207
  partial: Parameters<typeof emitMockifyerNetworkEvent>[0]['event'] & {
@@ -193,7 +210,9 @@ class MockifyerClass {
193
210
  requestBody?: unknown;
194
211
  responseBody?: unknown;
195
212
  },
196
- correlation?: RequestCorrelationContext
213
+ correlation?: RequestCorrelationContext,
214
+ /** Final outbound header bag (after auth interceptors). */
215
+ requestHeadersSource?: unknown
197
216
  ): void {
198
217
  const scenario =
199
218
  this.config.proxy?.scenario?.trim() ||
@@ -201,6 +220,8 @@ class MockifyerClass {
201
220
 
202
221
  const { requestBody, responseBody, ...eventPartial } = partial;
203
222
  const businessResponseBody = getInlineTraceEnvelopeBusinessBody(responseBody);
223
+ const requestHeaders =
224
+ eventPartial.requestHeaders ?? outboundHeadersToRecord(requestHeadersSource);
204
225
 
205
226
  if (!this.config.proxy?.baseUrl) {
206
227
  recordInlineTraceHopFromExchange({
@@ -214,6 +235,7 @@ class MockifyerClass {
214
235
  durationMs: eventPartial.durationMs,
215
236
  clientId: this.config.clientId ?? eventPartial.clientId ?? null,
216
237
  errorMessage: eventPartial.errorMessage,
238
+ requestHeaders,
217
239
  requestBody,
218
240
  responseBody,
219
241
  });
@@ -231,6 +253,7 @@ class MockifyerClass {
231
253
  transport: eventPartial.transport ?? 'fetch',
232
254
  requestId: correlation?.requestId ?? eventPartial.requestId,
233
255
  parentRequestId: correlation?.parentRequestId ?? eventPartial.parentRequestId,
256
+ requestHeaders,
234
257
  requestBodyPreview: eventPartial.requestBodyPreview,
235
258
  responseBodyPreview: eventPartial.responseBodyPreview,
236
259
  },
@@ -841,7 +864,7 @@ class MockifyerClass {
841
864
  useProxyLane: { proxyBaseUrl: this.config.proxy?.baseUrl, resolvedClientId: this.config.clientId },
842
865
  })
843
866
  ) {
844
- this.applyOutboundCorrelation(config);
867
+ await this.applyOutboundCorrelation(config);
845
868
  (config as any).__mockifyer_bypass = true;
846
869
  return config;
847
870
  }
@@ -854,7 +877,7 @@ class MockifyerClass {
854
877
  return config;
855
878
  }
856
879
 
857
- let correlation = this.applyOutboundCorrelation(config);
880
+ let correlation = await this.applyOutboundCorrelation(config);
858
881
  this.stashRequestCorrelation(config, correlation);
859
882
 
860
883
  // Normalize empty params: treat {} the same as undefined for consistent matching
@@ -921,14 +944,15 @@ class MockifyerClass {
921
944
  this.logNetworkEvent(
922
945
  {
923
946
  method: (request.method || 'GET').toUpperCase(),
924
- url: request.url,
947
+ url: this.resolveLoggedRequestUrl(config, request.url),
925
948
  source: 'mock-hit',
926
949
  status: mockData.response.status,
927
950
  requestHash: networkEventHashFromRequestKey(requestKey),
928
951
  requestBody: request.data,
929
952
  responseBody: mockResponseBody,
930
953
  },
931
- correlation
954
+ correlation,
955
+ request.headers ?? config.headers
932
956
  );
933
957
  const responseHeaders = {
934
958
  ...mockData.response.headers,
@@ -1090,7 +1114,7 @@ class MockifyerClass {
1090
1114
  const shouldLogMockOrLimit =
1091
1115
  isLimitReached || (isMocked && this.usesDashboardProxy());
1092
1116
  if (shouldLogMockOrLimit) {
1093
- const reqUrl = response.config?.url || url;
1117
+ const reqUrl = this.resolveLoggedRequestUrl(response.config, url);
1094
1118
  const reqMethod = (response.config?.method || 'GET').toUpperCase();
1095
1119
  const startTime = (response.config as any).__mockifyer_startTime;
1096
1120
  const durationMs = startTime ? Date.now() - startTime : undefined;
@@ -1115,9 +1139,13 @@ class MockifyerClass {
1115
1139
  }
1116
1140
  : {}),
1117
1141
  },
1118
- this.readRequestCorrelation(response.config)
1142
+ this.readRequestCorrelation(response.config),
1143
+ response.config?.headers
1119
1144
  );
1120
1145
  }
1146
+ // Mock hits return before the upstream path. Still emit nested service
1147
+ // hops and strip mockifyerTrace so the caller sees the business body.
1148
+ this.unwrapResponseInlineTrace(response);
1121
1149
  return response;
1122
1150
  }
1123
1151
 
@@ -1130,9 +1158,9 @@ class MockifyerClass {
1130
1158
  const startTime = (response.config as any).__mockifyer_startTime;
1131
1159
  const durationMs = startTime ? Date.now() - startTime : undefined;
1132
1160
 
1133
- const reqUrl = response.config?.url || url;
1161
+ const reqUrl = this.resolveLoggedRequestUrl(response.config, url);
1134
1162
  const reqMethod = (response.config?.method || 'GET').toUpperCase();
1135
- // Parent hop first, then unwrap nested mockifyerTrace from downstream services.
1163
+ // Parent hop first, then unwrap nested service hops from downstream services.
1136
1164
  this.logNetworkEvent(
1137
1165
  {
1138
1166
  method: reqMethod,
@@ -1143,7 +1171,8 @@ class MockifyerClass {
1143
1171
  requestBody: response.config?.data,
1144
1172
  responseBody: response.data,
1145
1173
  },
1146
- this.readRequestCorrelation(response.config)
1174
+ this.readRequestCorrelation(response.config),
1175
+ response.config?.headers
1147
1176
  );
1148
1177
  this.unwrapResponseInlineTrace(response);
1149
1178
 
@@ -1184,7 +1213,7 @@ class MockifyerClass {
1184
1213
  return response;
1185
1214
  }
1186
1215
 
1187
- const reqUrl = response.config?.url || url;
1216
+ const reqUrl = this.resolveLoggedRequestUrl(response.config, url);
1188
1217
  const reqMethod = (response.config?.method || 'GET').toUpperCase();
1189
1218
  this.logNetworkEvent(
1190
1219
  {
@@ -1199,7 +1228,8 @@ class MockifyerClass {
1199
1228
  requestBody: response.config?.data,
1200
1229
  responseBody: response.data,
1201
1230
  },
1202
- this.readRequestCorrelation(response.config)
1231
+ this.readRequestCorrelation(response.config),
1232
+ response.config?.headers
1203
1233
  );
1204
1234
  this.unwrapResponseInlineTrace(response);
1205
1235
 
@@ -1216,7 +1246,7 @@ class MockifyerClass {
1216
1246
  if (requestKey) {
1217
1247
  this.processingRequests.delete(requestKey);
1218
1248
  }
1219
- const reqUrl = error.config?.url || '';
1249
+ const reqUrl = this.resolveLoggedRequestUrl(error.config);
1220
1250
  if (reqUrl) {
1221
1251
  this.logNetworkEvent(
1222
1252
  {
@@ -1228,7 +1258,8 @@ class MockifyerClass {
1228
1258
  requestBody: error.config?.data,
1229
1259
  responseBody: error.response?.data,
1230
1260
  },
1231
- this.readRequestCorrelation(error.config)
1261
+ this.readRequestCorrelation(error.config),
1262
+ error.config?.headers
1232
1263
  );
1233
1264
  }
1234
1265
  this.throwWithMockifyerRequestId(error);
@@ -1462,6 +1493,7 @@ class MockifyerClass {
1462
1493
  : this.currentSessionId,
1463
1494
  requestId: hopIds.requestId,
1464
1495
  parentRequestId: hopIds.parentRequestId,
1496
+ parentRequestIds: hopIds.parentRequestIds,
1465
1497
  ...(newRecordingUsesAlwaysUseRealApi() ? { alwaysUseRealApi: true as const } : {}),
1466
1498
  };
1467
1499
 
@@ -1526,15 +1558,7 @@ class MockifyerClass {
1526
1558
  liveCorrelation?: RequestCorrelationContext
1527
1559
  ): Promise<void> {
1528
1560
  const updated = buildMockDataAfterLiveCapture(cachedMock.mockData, capturedResponse, durationMs);
1529
- const hopIds = resolvePersistedHopIds(cachedMock.mockData, liveCorrelation);
1530
- if (hopIds.requestId) {
1531
- updated.requestId = hopIds.requestId;
1532
- }
1533
- if (hopIds.parentRequestId) {
1534
- updated.parentRequestId = hopIds.parentRequestId;
1535
- } else {
1536
- delete updated.parentRequestId;
1537
- }
1561
+ applyPersistedHopIds(updated, resolvePersistedHopIds(cachedMock.mockData, liveCorrelation));
1538
1562
 
1539
1563
  if (this.databaseProvider) {
1540
1564
  await this.databaseProvider.save(updated);
@@ -1,17 +1,24 @@
1
1
  /**
2
2
  * Metro terminal keys for Mockifyer:
3
- * - `t` (default): start/stop Atlas capture (stop generates HTML)
4
- * - `m` (default): open the Mockifyer dashboard in the browser
3
+ * - `t` (default): start/stop Atlas capture (start opens the live stream page
4
+ * and signals the app to call `enableMockifyer()` for `runtimeMode: 'manual'`;
5
+ * stop ends capture — generate HTML from the live page “Render docs” button)
6
+ * - dashboard key is off unless `dashboardKey` is set (for example `"m"`)
5
7
  *
6
- * Opening `mockifyer-atlas` (SSE `/mockifyer-network-events/stream`) auto-starts
7
- * capture when idle — then press `t` once to stop & generate.
8
+ * Capture starts only when `t` is pressed. Opening the live page or connecting
9
+ * the SSE stream does not start it. Press `t` again to stop, or use Render docs
10
+ * on the live page without stopping.
8
11
  *
9
12
  * `a` is reserved by Metro for Android (`i` iOS, `r` reload, `d` Dev Menu, `j` DevTools).
10
- * Disable Atlas with `atlasKey: false`, dashboard with `dashboardKey: false`.
13
+ * Disable Atlas with `atlasKey: false`.
11
14
  */
12
15
  import * as readline from "readline";
13
16
  import { spawn } from "child_process";
14
- import { logger } from "@sgedda/mockifyer-core";
17
+ import {
18
+ ATLAS_LIVE_STREAM_PATH,
19
+ logger,
20
+ resolveMetroNetworkStreamPort,
21
+ } from "@sgedda/mockifyer-core";
15
22
 
16
23
  /**
17
24
  * Keys already used by @react-native/community-cli-plugin (avoid stealing).
@@ -46,8 +53,8 @@ export interface AttachMetroAtlasKeyHandlerOptions {
46
53
  */
47
54
  atlasKey?: AtlasKeyOption;
48
55
  /**
49
- * Key that opens the dashboard in the browser (default `"m"`).
50
- * Pass `false` to disable.
56
+ * Key that opens the dashboard in the browser.
57
+ * Off unless set (for example `"m"`). Pass `false` to keep it off.
51
58
  */
52
59
  dashboardKey?: AtlasKeyOption;
53
60
  /**
@@ -55,9 +62,9 @@ export interface AttachMetroAtlasKeyHandlerOptions {
55
62
  * Mount prefix from `MOCKIFYER_DASHBOARD_BASE` is appended when set.
56
63
  */
57
64
  dashboardUrl?: string;
58
- /** Called on session start (clear hop buffer, etc.). Required when Atlas key is enabled. */
59
- onSessionStart?: () => void;
60
- /** Called on session stop — generate Atlas HTML. Required when Atlas key is enabled. */
65
+ /** Called when capture starts. Only the Atlas key (`t`) starts a session. */
66
+ onSessionStart?: (reason: MetroAtlasSessionStartReason) => void;
67
+ /** Called on session stop — end capture (HTML is rendered from the live page). */
61
68
  onSessionStop?: () => void | Promise<void>;
62
69
  /** Override stdin (tests). */
63
70
  stdin?: NodeJS.ReadStream;
@@ -74,6 +81,8 @@ export interface AttachedMetroAtlasKeyHandler {
74
81
  dashboardKey: string | null;
75
82
  /** Resolved dashboard browse URL. */
76
83
  dashboardUrl: string | null;
84
+ /** Live Atlas stream page opened when capture starts via the Atlas key. */
85
+ liveUrl: string | null;
77
86
  /** Detach listener and clear module attach flag. */
78
87
  detach: () => void;
79
88
  }
@@ -82,7 +91,8 @@ interface SessionCallbacks {
82
91
  key: string | null;
83
92
  dashboardKey: string | null;
84
93
  dashboardUrl: string | null;
85
- onSessionStart?: () => void;
94
+ liveUrl: string | null;
95
+ onSessionStart?: (reason: MetroAtlasSessionStartReason) => void;
86
96
  onSessionStop?: () => void | Promise<void>;
87
97
  openUrl: (url: string) => void;
88
98
  }
@@ -122,11 +132,13 @@ export function resolveAtlasKeyOption(
122
132
  }
123
133
 
124
134
  /**
125
- * Normalize `dashboardKey` option: default `"m"`, `false` → disabled.
135
+ * Normalize `dashboardKey`. Omitted or `false` → disabled.
136
+ * An explicit letter (for example `"m"`) opens the dashboard.
126
137
  */
127
138
  export function resolveDashboardKeyOption(
128
139
  dashboardKey?: AtlasKeyOption,
129
140
  ): string | null {
141
+ if (dashboardKey === undefined || dashboardKey === false) return null;
130
142
  return resolveKeyOption(dashboardKey, DEFAULT_METRO_DASHBOARD_KEY);
131
143
  }
132
144
 
@@ -155,6 +167,21 @@ export function resolveMetroDashboardUrl(explicit?: string): string {
155
167
  return `${base}${mount.startsWith("/") ? mount : `/${mount}`}`;
156
168
  }
157
169
 
170
+ /**
171
+ * Browser URL for the Metro live Atlas hop stream page.
172
+ * Uses `MOCKIFYER_METRO_URL` when set, otherwise `http://localhost:<METRO_PORT|8081>`.
173
+ */
174
+ export function resolveMetroAtlasLiveUrl(explicitBase?: string): string {
175
+ const fromExplicit = typeof explicitBase === "string" ? explicitBase.trim() : "";
176
+ const fromEnv =
177
+ typeof process !== "undefined" ? process.env.MOCKIFYER_METRO_URL?.trim() : "";
178
+ const base = (fromExplicit || fromEnv || `http://localhost:${resolveMetroNetworkStreamPort()}`).replace(
179
+ /\/+$/,
180
+ "",
181
+ );
182
+ return `${base}${ATLAS_LIVE_STREAM_PATH}`;
183
+ }
184
+
158
185
  /**
159
186
  * Open a URL with the OS default handler (browser / file).
160
187
  */
@@ -226,7 +253,7 @@ export function startMetroAtlasSession(
226
253
  sessionPhase = "capturing";
227
254
  sessionStartedAt = Date.now();
228
255
  try {
229
- onSessionStart();
256
+ onSessionStart(reason);
230
257
  } catch (err) {
231
258
  sessionPhase = "idle";
232
259
  sessionStartedAt = null;
@@ -237,19 +264,37 @@ export function startMetroAtlasSession(
237
264
 
238
265
  if (reason === "stream") {
239
266
  console.log(
240
- `[Mockifyer] Atlas capture started (stream connected) — press ${key} to stop & generate HTML.`,
267
+ `[Mockifyer] Atlas capture started (stream connected) — Mockifyer activated (turns off again on stop if it was off). Press ${key} to stop, or Render docs on the live page.`,
241
268
  );
242
269
  } else {
243
270
  console.log(
244
- `[Mockifyer] Atlas capture started — press ${key} again to stop & generate HTML.`,
271
+ `[Mockifyer] Atlas capture started — Mockifyer activated (turns off again on stop if it was off). Press ${key} again to stop, or Render docs on the live page.`,
245
272
  );
273
+ openMetroAtlasLivePage();
274
+ }
275
+ return true;
276
+ }
277
+
278
+ /** Open the live hop stream page in the browser (Atlas key start). */
279
+ export function openMetroAtlasLivePage(): boolean {
280
+ const url = sessionCallbacks?.liveUrl;
281
+ if (!url || !sessionCallbacks?.openUrl) {
282
+ return false;
283
+ }
284
+ console.log(`[Mockifyer] Opening Atlas live stream → ${url}`);
285
+ try {
286
+ sessionCallbacks.openUrl(url);
287
+ } catch (err) {
288
+ const message = err instanceof Error ? err.message : String(err);
289
+ console.error(`[Mockifyer] Could not open Atlas live stream: ${message}`);
290
+ return false;
246
291
  }
247
292
  return true;
248
293
  }
249
294
 
250
295
  /**
251
- * Stop capture and generate Atlas HTML when capturing.
252
- * @returns true if stop/render was kicked off
296
+ * Stop capture when capturing (does not write Atlas HTML — use live page Render docs).
297
+ * @returns true if stop was kicked off
253
298
  */
254
299
  export function stopMetroAtlasSession(): boolean {
255
300
  if (!sessionCallbacks?.onSessionStop) return false;
@@ -260,13 +305,13 @@ export function stopMetroAtlasSession(): boolean {
260
305
  const duration = formatSessionDuration(startedAt);
261
306
  sessionPhase = "rendering";
262
307
  console.log(
263
- `[Mockifyer] Atlas capture stopped (${duration}) — generating HTML…`,
308
+ `[Mockifyer] Atlas capture stopped (${duration}) — Mockifyer turns off again if it was off before press t.`,
264
309
  );
265
310
  Promise.resolve()
266
311
  .then(() => onSessionStop())
267
312
  .catch((err: unknown) => {
268
313
  const message = err instanceof Error ? err.message : String(err);
269
- console.error(`[Mockifyer] Atlas render failed: ${message}`);
314
+ console.error(`[Mockifyer] Atlas session stop failed: ${message}`);
270
315
  })
271
316
  .finally(() => {
272
317
  sessionPhase = "idle";
@@ -293,17 +338,15 @@ export function openMetroDashboard(): boolean {
293
338
  }
294
339
 
295
340
  /**
296
- * First SSE client for `/mockifyer-network-events/stream` auto-starts capture.
341
+ * SSE client connected to `/mockifyer-network-events/stream`.
342
+ * Does not start capture — that happens only when the Atlas key (`t`) is pressed.
297
343
  */
298
344
  export function notifyMetroAtlasStreamClientConnected(): void {
299
345
  streamSubscriberCount += 1;
300
- if (streamSubscriberCount === 1) {
301
- startMetroAtlasSession("stream");
302
- }
303
346
  }
304
347
 
305
348
  /**
306
- * SSE client disconnected — capture stays open until Metro `a` (or explicit stop).
349
+ * SSE client disconnected — capture stays open until the Atlas key is pressed again.
307
350
  */
308
351
  export function notifyMetroAtlasStreamClientDisconnected(): void {
309
352
  streamSubscriberCount = Math.max(0, streamSubscriberCount - 1);
@@ -369,6 +412,7 @@ export function attachMetroAtlasKeyHandler(
369
412
  key: null,
370
413
  dashboardKey: null,
371
414
  dashboardUrl: null,
415
+ liveUrl: null,
372
416
  detach: () => undefined,
373
417
  };
374
418
  }
@@ -389,10 +433,13 @@ export function attachMetroAtlasKeyHandler(
389
433
  const effectiveDashboardKey =
390
434
  atlasKey != null && dashboardKey === atlasKey ? null : dashboardKey;
391
435
 
436
+ const liveUrl = atlasKey != null ? resolveMetroAtlasLiveUrl() : null;
437
+
392
438
  sessionCallbacks = {
393
439
  key: atlasKey,
394
440
  dashboardKey: effectiveDashboardKey,
395
441
  dashboardUrl: effectiveDashboardKey != null ? dashboardUrl : null,
442
+ liveUrl,
396
443
  onSessionStart: options.onSessionStart,
397
444
  onSessionStop: options.onSessionStop,
398
445
  openUrl: options.openUrl ?? openMetroBrowseUrl,
@@ -403,6 +450,7 @@ export function attachMetroAtlasKeyHandler(
403
450
  key: atlasKey,
404
451
  dashboardKey: effectiveDashboardKey,
405
452
  dashboardUrl: sessionCallbacks.dashboardUrl,
453
+ liveUrl,
406
454
  detach: detachMetroAtlasKeyHandler,
407
455
  };
408
456
  }
@@ -434,7 +482,7 @@ export function attachMetroAtlasKeyHandler(
434
482
  if (!atlasKey || !matchesAtlasKey(str, keyObj, atlasKey)) return;
435
483
 
436
484
  if (sessionPhase === "rendering") {
437
- console.log("[Mockifyer] Atlas render already in progress…");
485
+ console.log("[Mockifyer] Atlas stop already in progress…");
438
486
  return;
439
487
  }
440
488
 
@@ -481,12 +529,9 @@ export function attachMetroAtlasKeyHandler(
481
529
  const parts: string[] = [];
482
530
  if (atlasKey) {
483
531
  parts.push(
484
- `Press ${atlasKey} to start/stop Atlas capture (stop generates HTML; stream auto-starts)`,
532
+ `Press ${atlasKey} to start/stop Atlas capture (activates Mockifyer if off, restores off on stop; start opens live stream; Render docs on the page writes HTML)`,
485
533
  );
486
534
  }
487
- if (effectiveDashboardKey && dashboardUrl) {
488
- parts.push(`Press ${effectiveDashboardKey} to open dashboard (${dashboardUrl})`);
489
- }
490
535
  if (parts.length > 0) {
491
536
  console.log(`[Mockifyer] info ${parts.join(". ")}.`);
492
537
  }
@@ -510,6 +555,7 @@ export function attachMetroAtlasKeyHandler(
510
555
  key: atlasKey,
511
556
  dashboardKey: effectiveDashboardKey,
512
557
  dashboardUrl: sessionCallbacks.dashboardUrl,
558
+ liveUrl,
513
559
  detach: detachMetroAtlasKeyHandler,
514
560
  };
515
561
  }
@@ -171,8 +171,8 @@ export interface ConfigureMetroOptions {
171
171
  * syncMiddleware: {
172
172
  * projectRoot: __dirname,
173
173
  * mockDataPath: './mock-data',
174
- * // atlasKey: 't' (default) — Metro terminal: start/stop Atlas capture (stop → HTML). `a` is Android.
175
- * // dashboardKey: 'm' (default) — open dashboard in browser
174
+ * // atlasKey: 't' (default) — Metro terminal: start/stop Atlas (start opens live stream; stop → HTML). `a` is Android.
175
+ * // dashboardKey: 'm' — optional; off unless set. Opens the dashboard in the browser
176
176
  * // dashboardUrl: 'http://localhost:3002' — or MOCKIFYER_DASHBOARD_URL
177
177
  * },
178
178
  * });