@sgedda/mockifyer-fetch 1.8.85 → 1.8.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,17 @@
1
1
  /**
2
2
  * Metro terminal keys for Mockifyer:
3
- * - `a` (default): start/stop Atlas capture (stop generates HTML)
3
+ * - `t` (default): start/stop Atlas capture (stop generates HTML)
4
4
  * - `m` (default): open the Mockifyer dashboard in the browser
5
5
  *
6
6
  * Opening `mockifyer-atlas` (SSE `/mockifyer-network-events/stream`) auto-starts
7
- * capture when idle — then press `a` once to stop & generate.
7
+ * capture when idle — then press `t` once to stop & generate.
8
8
  *
9
+ * `a` is reserved by Metro for Android (`i` iOS, `r` reload, `d` Dev Menu, `j` DevTools).
9
10
  * Disable Atlas with `atlasKey: false`, dashboard with `dashboardKey: false`.
10
11
  */
11
12
  import * as readline from "readline";
12
- export declare const DEFAULT_METRO_ATLAS_KEY = "a";
13
+ /** `t` — `a` launches Android in the Metro / RN CLI. */
14
+ export declare const DEFAULT_METRO_ATLAS_KEY = "t";
13
15
  export declare const DEFAULT_METRO_DASHBOARD_KEY = "m";
14
16
  export declare const DEFAULT_METRO_DASHBOARD_URL = "http://localhost:3002";
15
17
  export type AtlasKeyOption = string | false;
@@ -17,8 +19,8 @@ export type MetroAtlasSessionPhase = "idle" | "capturing" | "rendering";
17
19
  export type MetroAtlasSessionStartReason = "key" | "stream";
18
20
  export interface AttachMetroAtlasKeyHandlerOptions {
19
21
  /**
20
- * Key that toggles Atlas capture (default `"a"`).
21
- * Pass `false` to disable.
22
+ * Key that toggles Atlas capture (default `"t"`).
23
+ * Pass `false` to disable. `a` is reserved by Metro for Android.
22
24
  */
23
25
  atlasKey?: AtlasKeyOption;
24
26
  /**
@@ -57,7 +59,7 @@ export interface AttachedMetroAtlasKeyHandler {
57
59
  */
58
60
  export declare function resolveKeyOption(value: AtlasKeyOption | undefined, defaultKey: string): string | null;
59
61
  /**
60
- * Normalize `atlasKey` option: default `"a"`, `false` → disabled, else single char.
62
+ * Normalize `atlasKey` option: default `"t"`, `false` → disabled, else single char.
61
63
  */
62
64
  export declare function resolveAtlasKeyOption(atlasKey?: AtlasKeyOption): string | null;
63
65
  /**
@@ -51,20 +51,31 @@ exports.detachMetroAtlasKeyHandler = detachMetroAtlasKeyHandler;
51
51
  exports.attachMetroAtlasKeyHandler = attachMetroAtlasKeyHandler;
52
52
  /**
53
53
  * Metro terminal keys for Mockifyer:
54
- * - `a` (default): start/stop Atlas capture (stop generates HTML)
54
+ * - `t` (default): start/stop Atlas capture (stop generates HTML)
55
55
  * - `m` (default): open the Mockifyer dashboard in the browser
56
56
  *
57
57
  * Opening `mockifyer-atlas` (SSE `/mockifyer-network-events/stream`) auto-starts
58
- * capture when idle — then press `a` once to stop & generate.
58
+ * capture when idle — then press `t` once to stop & generate.
59
59
  *
60
+ * `a` is reserved by Metro for Android (`i` iOS, `r` reload, `d` Dev Menu, `j` DevTools).
60
61
  * Disable Atlas with `atlasKey: false`, dashboard with `dashboardKey: false`.
61
62
  */
62
63
  const readline = __importStar(require("readline"));
63
64
  const child_process_1 = require("child_process");
64
65
  const mockifyer_core_1 = require("@sgedda/mockifyer-core");
65
- /** Keys already used by @react-native/community-cli-plugin (avoid stealing). */
66
- const RESERVED_METRO_KEYS = new Set(["r", "d", "j", "i"]);
67
- exports.DEFAULT_METRO_ATLAS_KEY = "a";
66
+ /**
67
+ * Keys already used by @react-native/community-cli-plugin (avoid stealing).
68
+ * Value is the short reason shown when a binding collides.
69
+ */
70
+ const RESERVED_METRO_KEYS = new Map([
71
+ ["a", "Android"],
72
+ ["d", "the Dev Menu"],
73
+ ["i", "iOS"],
74
+ ["j", "DevTools"],
75
+ ["r", "reload"],
76
+ ]);
77
+ /** `t` — `a` launches Android in the Metro / RN CLI. */
78
+ exports.DEFAULT_METRO_ATLAS_KEY = "t";
68
79
  exports.DEFAULT_METRO_DASHBOARD_KEY = "m";
69
80
  exports.DEFAULT_METRO_DASHBOARD_URL = "http://localhost:3002";
70
81
  /** Delay so RN/Expo CLI can own raw-mode stdin first. */
@@ -91,7 +102,7 @@ function resolveKeyOption(value, defaultKey) {
91
102
  return key || null;
92
103
  }
93
104
  /**
94
- * Normalize `atlasKey` option: default `"a"`, `false` → disabled, else single char.
105
+ * Normalize `atlasKey` option: default `"t"`, `false` → disabled, else single char.
95
106
  */
96
107
  function resolveAtlasKeyOption(atlasKey) {
97
108
  return resolveKeyOption(atlasKey, exports.DEFAULT_METRO_ATLAS_KEY);
@@ -296,8 +307,9 @@ function detachMetroAtlasKeyHandler() {
296
307
  streamSubscriberCount = 0;
297
308
  }
298
309
  function warnIfReserved(key, label) {
299
- if (RESERVED_METRO_KEYS.has(key)) {
300
- mockifyer_core_1.logger.warn(`[Mockifyer] ${label} "${key}" conflicts with Metro/RN CLI — pick another letter`);
310
+ const reason = RESERVED_METRO_KEYS.get(key);
311
+ if (reason) {
312
+ mockifyer_core_1.logger.warn(`[Mockifyer] ${label} "${key}" is reserved for ${reason} — pick another letter`);
301
313
  }
302
314
  }
303
315
  /**
@@ -108,7 +108,7 @@ export interface ConfigureMetroOptions {
108
108
  * syncMiddleware: {
109
109
  * projectRoot: __dirname,
110
110
  * mockDataPath: './mock-data',
111
- * // atlasKey: 'a' (default) — Metro terminal: start/stop Atlas capture (stop → HTML)
111
+ * // atlasKey: 't' (default) — Metro terminal: start/stop Atlas capture (stop → HTML). `a` is Android.
112
112
  * // dashboardKey: 'm' (default) — open dashboard in browser
113
113
  * // dashboardUrl: 'http://localhost:3002' — or MOCKIFYER_DASHBOARD_URL
114
114
  * },
@@ -127,7 +127,7 @@ function resolveMockifyerCoreReactNativeEntry(moduleName, platform) {
127
127
  * syncMiddleware: {
128
128
  * projectRoot: __dirname,
129
129
  * mockDataPath: './mock-data',
130
- * // atlasKey: 'a' (default) — Metro terminal: start/stop Atlas capture (stop → HTML)
130
+ * // atlasKey: 't' (default) — Metro terminal: start/stop Atlas capture (stop → HTML). `a` is Android.
131
131
  * // dashboardKey: 'm' (default) — open dashboard in browser
132
132
  * // dashboardUrl: 'http://localhost:3002' — or MOCKIFYER_DASHBOARD_URL
133
133
  * },
@@ -19,7 +19,7 @@
19
19
  * 15. POST /mockifyer-network-events/snapshot — write hops JSON/NDJSON under atlas-html/
20
20
  * 16. POST /mockifyer-network-events/render — render Atlas HTML from buffer hops
21
21
  * 17. POST /mockifyer-network-events/clear — clear ring buffer
22
- * 18. Metro terminal key `a` — start/stop Atlas capture (stop generates HTML; stream auto-starts; `atlasKey: false` to disable)
22
+ * 18. Metro terminal key `t` — start/stop Atlas capture (stop generates HTML; stream auto-starts; `atlasKey: false` to disable). `a` is reserved for Android.
23
23
  * 19. Metro terminal key `m` — open Mockifyer dashboard in the browser (`dashboardKey: false` to disable)
24
24
  *
25
25
  * The Hybrid Provider (recommended) uses POST /mockifyer-save for instant file sync.
@@ -34,9 +34,9 @@ export interface MetroSyncMiddlewareOptions {
34
34
  /** Path to mock data directory relative to project root (default: 'mock-data') */
35
35
  mockDataPath?: string;
36
36
  /**
37
- * Metro terminal key that starts/stops Atlas capture (default `"a"`).
37
+ * Metro terminal key that starts/stops Atlas capture (default `"t"`).
38
38
  * Start clears the hop buffer; stop generates HTML (same as `POST /mockifyer-network-events/render`).
39
- * Pass `false` to disable.
39
+ * Pass `false` to disable. `a` is reserved by Metro for Android.
40
40
  */
41
41
  atlasKey?: AtlasKeyOption;
42
42
  /**
@@ -20,7 +20,7 @@
20
20
  * 15. POST /mockifyer-network-events/snapshot — write hops JSON/NDJSON under atlas-html/
21
21
  * 16. POST /mockifyer-network-events/render — render Atlas HTML from buffer hops
22
22
  * 17. POST /mockifyer-network-events/clear — clear ring buffer
23
- * 18. Metro terminal key `a` — start/stop Atlas capture (stop generates HTML; stream auto-starts; `atlasKey: false` to disable)
23
+ * 18. Metro terminal key `t` — start/stop Atlas capture (stop generates HTML; stream auto-starts; `atlasKey: false` to disable). `a` is reserved for Android.
24
24
  * 19. Metro terminal key `m` — open Mockifyer dashboard in the browser (`dashboardKey: false` to disable)
25
25
  *
26
26
  * The Hybrid Provider (recommended) uses POST /mockifyer-save for instant file sync.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sgedda/mockifyer-fetch",
3
- "version": "1.8.85",
3
+ "version": "1.8.86",
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",
@@ -1,21 +1,32 @@
1
1
  /**
2
2
  * Metro terminal keys for Mockifyer:
3
- * - `a` (default): start/stop Atlas capture (stop generates HTML)
3
+ * - `t` (default): start/stop Atlas capture (stop generates HTML)
4
4
  * - `m` (default): open the Mockifyer dashboard in the browser
5
5
  *
6
6
  * Opening `mockifyer-atlas` (SSE `/mockifyer-network-events/stream`) auto-starts
7
- * capture when idle — then press `a` once to stop & generate.
7
+ * capture when idle — then press `t` once to stop & generate.
8
8
  *
9
+ * `a` is reserved by Metro for Android (`i` iOS, `r` reload, `d` Dev Menu, `j` DevTools).
9
10
  * Disable Atlas with `atlasKey: false`, dashboard with `dashboardKey: false`.
10
11
  */
11
12
  import * as readline from "readline";
12
13
  import { spawn } from "child_process";
13
14
  import { logger } from "@sgedda/mockifyer-core";
14
15
 
15
- /** Keys already used by @react-native/community-cli-plugin (avoid stealing). */
16
- const RESERVED_METRO_KEYS = new Set(["r", "d", "j", "i"]);
17
-
18
- export const DEFAULT_METRO_ATLAS_KEY = "a";
16
+ /**
17
+ * Keys already used by @react-native/community-cli-plugin (avoid stealing).
18
+ * Value is the short reason shown when a binding collides.
19
+ */
20
+ const RESERVED_METRO_KEYS: ReadonlyMap<string, string> = new Map([
21
+ ["a", "Android"],
22
+ ["d", "the Dev Menu"],
23
+ ["i", "iOS"],
24
+ ["j", "DevTools"],
25
+ ["r", "reload"],
26
+ ]);
27
+
28
+ /** `t` — `a` launches Android in the Metro / RN CLI. */
29
+ export const DEFAULT_METRO_ATLAS_KEY = "t";
19
30
  export const DEFAULT_METRO_DASHBOARD_KEY = "m";
20
31
  export const DEFAULT_METRO_DASHBOARD_URL = "http://localhost:3002";
21
32
 
@@ -30,8 +41,8 @@ export type MetroAtlasSessionStartReason = "key" | "stream";
30
41
 
31
42
  export interface AttachMetroAtlasKeyHandlerOptions {
32
43
  /**
33
- * Key that toggles Atlas capture (default `"a"`).
34
- * Pass `false` to disable.
44
+ * Key that toggles Atlas capture (default `"t"`).
45
+ * Pass `false` to disable. `a` is reserved by Metro for Android.
35
46
  */
36
47
  atlasKey?: AtlasKeyOption;
37
48
  /**
@@ -102,7 +113,7 @@ export function resolveKeyOption(
102
113
  }
103
114
 
104
115
  /**
105
- * Normalize `atlasKey` option: default `"a"`, `false` → disabled, else single char.
116
+ * Normalize `atlasKey` option: default `"t"`, `false` → disabled, else single char.
106
117
  */
107
118
  export function resolveAtlasKeyOption(
108
119
  atlasKey?: AtlasKeyOption,
@@ -331,9 +342,10 @@ export function detachMetroAtlasKeyHandler(): void {
331
342
  }
332
343
 
333
344
  function warnIfReserved(key: string, label: string): void {
334
- if (RESERVED_METRO_KEYS.has(key)) {
345
+ const reason = RESERVED_METRO_KEYS.get(key);
346
+ if (reason) {
335
347
  logger.warn(
336
- `[Mockifyer] ${label} "${key}" conflicts with Metro/RN CLI — pick another letter`,
348
+ `[Mockifyer] ${label} "${key}" is reserved for ${reason} — pick another letter`,
337
349
  );
338
350
  }
339
351
  }
@@ -171,7 +171,7 @@ export interface ConfigureMetroOptions {
171
171
  * syncMiddleware: {
172
172
  * projectRoot: __dirname,
173
173
  * mockDataPath: './mock-data',
174
- * // atlasKey: 'a' (default) — Metro terminal: start/stop Atlas capture (stop → HTML)
174
+ * // atlasKey: 't' (default) — Metro terminal: start/stop Atlas capture (stop → HTML). `a` is Android.
175
175
  * // dashboardKey: 'm' (default) — open dashboard in browser
176
176
  * // dashboardUrl: 'http://localhost:3002' — or MOCKIFYER_DASHBOARD_URL
177
177
  * },
@@ -19,7 +19,7 @@
19
19
  * 15. POST /mockifyer-network-events/snapshot — write hops JSON/NDJSON under atlas-html/
20
20
  * 16. POST /mockifyer-network-events/render — render Atlas HTML from buffer hops
21
21
  * 17. POST /mockifyer-network-events/clear — clear ring buffer
22
- * 18. Metro terminal key `a` — start/stop Atlas capture (stop generates HTML; stream auto-starts; `atlasKey: false` to disable)
22
+ * 18. Metro terminal key `t` — start/stop Atlas capture (stop generates HTML; stream auto-starts; `atlasKey: false` to disable). `a` is reserved for Android.
23
23
  * 19. Metro terminal key `m` — open Mockifyer dashboard in the browser (`dashboardKey: false` to disable)
24
24
  *
25
25
  * The Hybrid Provider (recommended) uses POST /mockifyer-save for instant file sync.
@@ -77,9 +77,9 @@ export interface MetroSyncMiddlewareOptions {
77
77
  /** Path to mock data directory relative to project root (default: 'mock-data') */
78
78
  mockDataPath?: string;
79
79
  /**
80
- * Metro terminal key that starts/stops Atlas capture (default `"a"`).
80
+ * Metro terminal key that starts/stops Atlas capture (default `"t"`).
81
81
  * Start clears the hop buffer; stop generates HTML (same as `POST /mockifyer-network-events/render`).
82
- * Pass `false` to disable.
82
+ * Pass `false` to disable. `a` is reserved by Metro for Android.
83
83
  */
84
84
  atlasKey?: AtlasKeyOption;
85
85
  /**