procsi 0.5.0 → 0.6.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.
- package/dist/cli/commands/on.d.ts.map +1 -1
- package/dist/cli/commands/on.js +1 -0
- package/dist/cli/commands/on.js.map +1 -1
- package/dist/cli/commands/request.d.ts.map +1 -1
- package/dist/cli/commands/request.js +97 -2
- package/dist/cli/commands/request.js.map +1 -1
- package/dist/cli/tui/App.d.ts.map +1 -1
- package/dist/cli/tui/App.js +39 -31
- package/dist/cli/tui/App.js.map +1 -1
- package/dist/cli/tui/components/HelpModal.d.ts +6 -2
- package/dist/cli/tui/components/HelpModal.d.ts.map +1 -1
- package/dist/cli/tui/components/HelpModal.js +19 -47
- package/dist/cli/tui/components/HelpModal.js.map +1 -1
- package/dist/cli/tui/components/StatusBar.d.ts +2 -9
- package/dist/cli/tui/components/StatusBar.d.ts.map +1 -1
- package/dist/cli/tui/components/StatusBar.js +6 -13
- package/dist/cli/tui/components/StatusBar.js.map +1 -1
- package/dist/cli/tui/hooks/useExport.d.ts +10 -2
- package/dist/cli/tui/hooks/useExport.d.ts.map +1 -1
- package/dist/cli/tui/hooks/useExport.js +33 -8
- package/dist/cli/tui/hooks/useExport.js.map +1 -1
- package/dist/cli/tui/hooks/useStdoutDimensions.d.ts +4 -0
- package/dist/cli/tui/hooks/useStdoutDimensions.d.ts.map +1 -1
- package/dist/cli/tui/hooks/useStdoutDimensions.js +20 -10
- package/dist/cli/tui/hooks/useStdoutDimensions.js.map +1 -1
- package/dist/cli/tui/utils/curl.d.ts.map +1 -1
- package/dist/cli/tui/utils/curl.js +6 -13
- package/dist/cli/tui/utils/curl.js.map +1 -1
- package/dist/cli/tui/utils/export-shared.d.ts +9 -0
- package/dist/cli/tui/utils/export-shared.d.ts.map +1 -0
- package/dist/cli/tui/utils/export-shared.js +15 -0
- package/dist/cli/tui/utils/export-shared.js.map +1 -0
- package/dist/cli/tui/utils/fetch.d.ts +9 -0
- package/dist/cli/tui/utils/fetch.d.ts.map +1 -0
- package/dist/cli/tui/utils/fetch.js +77 -0
- package/dist/cli/tui/utils/fetch.js.map +1 -0
- package/dist/cli/tui/utils/httpie.d.ts +9 -0
- package/dist/cli/tui/utils/httpie.d.ts.map +1 -0
- package/dist/cli/tui/utils/httpie.js +78 -0
- package/dist/cli/tui/utils/httpie.js.map +1 -0
- package/dist/cli/tui/utils/python-requests.d.ts +19 -0
- package/dist/cli/tui/utils/python-requests.d.ts.map +1 -0
- package/dist/cli/tui/utils/python-requests.js +101 -0
- package/dist/cli/tui/utils/python-requests.js.map +1 -0
- package/dist/cli/tui/utils/terminal-size.d.ts +20 -0
- package/dist/cli/tui/utils/terminal-size.d.ts.map +1 -0
- package/dist/cli/tui/utils/terminal-size.js +100 -0
- package/dist/cli/tui/utils/terminal-size.js.map +1 -0
- package/dist/daemon/control.d.ts.map +1 -1
- package/dist/daemon/control.js +51 -7
- package/dist/daemon/control.js.map +1 -1
- package/dist/daemon/storage.d.ts +4 -0
- package/dist/daemon/storage.d.ts.map +1 -1
- package/dist/daemon/storage.js +20 -0
- package/dist/daemon/storage.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +16 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/shared/regex-filter.d.ts.map +1 -1
- package/dist/shared/regex-filter.js +6 -1
- package/dist/shared/regex-filter.js.map +1 -1
- package/dist/shared/types.d.ts +1 -1
- package/dist/shared/types.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text, useInput } from "ink";
|
|
3
|
+
import { buildProxyInfo } from "../../../shared/proxy-info.js";
|
|
3
4
|
const HELP_SECTIONS = [
|
|
4
5
|
{
|
|
5
6
|
title: "Navigation",
|
|
6
7
|
entries: [
|
|
7
8
|
{ key: "j / ↓", description: "Move down" },
|
|
8
9
|
{ key: "k / ↑", description: "Move up" },
|
|
9
|
-
{ key: "g", description: "
|
|
10
|
-
{ key: "G", description: "Jump to last item" },
|
|
10
|
+
{ key: "g / G", description: "First / last item" },
|
|
11
11
|
{ key: "Ctrl+u / Ctrl+d", description: "Half page up / down" },
|
|
12
12
|
{ key: "Ctrl+f / Ctrl+b", description: "Full page down / up" },
|
|
13
|
-
{ key: "Tab", description: "Next panel
|
|
14
|
-
{ key: "Shift+Tab", description: "Previous panel/section" },
|
|
13
|
+
{ key: "Tab / Shift+Tab", description: "Next / prev panel" },
|
|
15
14
|
{ key: "1-5", description: "Jump to section" },
|
|
16
15
|
],
|
|
17
16
|
},
|
|
@@ -19,64 +18,37 @@ const HELP_SECTIONS = [
|
|
|
19
18
|
title: "Actions",
|
|
20
19
|
entries: [
|
|
21
20
|
{ key: "Enter", description: "View body content" },
|
|
22
|
-
{ key: "
|
|
23
|
-
{ key: "R", description: "Replay request
|
|
24
|
-
{ key: "H", description: "Export HAR" },
|
|
21
|
+
{ key: "e", description: "Export: cURL / Fetch / Python / HTTPie / HAR" },
|
|
22
|
+
{ key: "R", description: "Replay request" },
|
|
25
23
|
{ key: "y", description: "Copy body to clipboard" },
|
|
26
24
|
{ key: "s", description: "Export body content" },
|
|
27
25
|
{ key: "b", description: "Toggle bookmark" },
|
|
28
|
-
{ key: "x/D", description: "Clear requests" },
|
|
26
|
+
{ key: "x / D", description: "Clear requests" },
|
|
29
27
|
{ key: "u", description: "Toggle full URL" },
|
|
30
|
-
{ key: "/", description: "Filter
|
|
28
|
+
{ key: "/", description: "Filter (URL, /regex/, body:req:…)" },
|
|
31
29
|
{ key: "r", description: "Refresh" },
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
title: "JSON Explorer",
|
|
36
|
-
entries: [
|
|
37
|
-
{ key: "j / k", description: "Navigate tree" },
|
|
38
|
-
{ key: "Ctrl+u / Ctrl+d", description: "Half page up / down" },
|
|
39
|
-
{ key: "Ctrl+f / Ctrl+b", description: "Full page down / up" },
|
|
40
|
-
{ key: "Enter / l", description: "Toggle node" },
|
|
41
|
-
{ key: "h", description: "Collapse node" },
|
|
42
|
-
{ key: "e / c", description: "Expand / collapse all" },
|
|
43
|
-
{ key: "/", description: "Filter by path" },
|
|
44
|
-
{ key: "n / N", description: "Next / previous match" },
|
|
45
|
-
{ key: "y", description: "Copy value" },
|
|
46
|
-
{ key: "q / Esc", description: "Close explorer" },
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
title: "Text Viewer",
|
|
51
|
-
entries: [
|
|
52
|
-
{ key: "j / k", description: "Scroll line by line" },
|
|
53
|
-
{ key: "Ctrl+u / Ctrl+d", description: "Scroll half page" },
|
|
54
|
-
{ key: "Ctrl+f / Ctrl+b", description: "Full page down / up" },
|
|
55
|
-
{ key: "Space", description: "Page down" },
|
|
56
|
-
{ key: "g / G", description: "Jump to top / bottom" },
|
|
57
|
-
{ key: "/", description: "Search text" },
|
|
58
|
-
{ key: "n / N", description: "Next / previous match" },
|
|
59
|
-
{ key: "y", description: "Copy to clipboard" },
|
|
60
|
-
{ key: "q / Esc", description: "Close viewer" },
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
title: "General",
|
|
65
|
-
entries: [
|
|
66
30
|
{ key: "L", description: "Interceptor events" },
|
|
67
|
-
{ key: "i", description: "Proxy connection info" },
|
|
68
31
|
{ key: "?", description: "Toggle help" },
|
|
69
32
|
{ key: "q", description: "Quit" },
|
|
70
33
|
],
|
|
71
34
|
},
|
|
72
35
|
];
|
|
73
|
-
const KEY_COLUMN_WIDTH =
|
|
74
|
-
export function HelpModal({ width, height, onClose, isActive = true, }) {
|
|
36
|
+
const KEY_COLUMN_WIDTH = 20;
|
|
37
|
+
export function HelpModal({ width, height, onClose, isActive = true, proxyPort, caCertPath, }) {
|
|
75
38
|
useInput((_input, key) => {
|
|
76
39
|
if (_input === "?" || key.escape) {
|
|
77
40
|
onClose();
|
|
78
41
|
}
|
|
79
42
|
}, { isActive });
|
|
80
|
-
|
|
43
|
+
// Fixed-width inner container, centred on screen
|
|
44
|
+
const innerWidth = Math.min(64, width - 4);
|
|
45
|
+
return (_jsx(Box, { flexDirection: "column", width: width, height: height, alignItems: "center", justifyContent: "center", children: _jsxs(Box, { flexDirection: "column", width: innerWidth, children: [_jsx(Box, { marginBottom: 1, justifyContent: "center", children: _jsx(Text, { color: "cyan", bold: true, children: "Keyboard Shortcuts" }) }), HELP_SECTIONS.map((section) => (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { bold: true, color: "yellow", children: section.title }), section.entries.map((entry) => (_jsxs(Box, { children: [_jsx(Box, { width: KEY_COLUMN_WIDTH, flexShrink: 0, children: _jsx(Text, { color: "cyan", children: entry.key }) }), _jsx(Text, { children: entry.description })] }, entry.key)))] }, section.title))), _jsx(ConnectionInfoSection, { proxyPort: proxyPort, caCertPath: caCertPath }), _jsx(Box, { marginTop: 1, justifyContent: "center", children: _jsx(Text, { dimColor: true, children: "Press ? or Escape to close" }) })] }) }));
|
|
46
|
+
}
|
|
47
|
+
function ConnectionInfoSection({ proxyPort, caCertPath }) {
|
|
48
|
+
if (proxyPort === undefined) {
|
|
49
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { bold: true, color: "yellow", children: "Connection Info" }), _jsx(Text, { color: "yellow", children: "Proxy is not running" })] }));
|
|
50
|
+
}
|
|
51
|
+
const info = buildProxyInfo(proxyPort, caCertPath ?? "");
|
|
52
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { bold: true, color: "yellow", children: "Connection Info" }), _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Proxy " }), _jsx(Text, { color: "green", children: info.proxyUrl })] }), _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "CA " }), _jsx(Text, { color: "green", children: info.caCertPath })] })] }));
|
|
81
53
|
}
|
|
82
54
|
//# sourceMappingURL=HelpModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpModal.js","sourceRoot":"","sources":["../../../../src/cli/tui/components/HelpModal.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"HelpModal.js","sourceRoot":"","sources":["../../../../src/cli/tui/components/HelpModal.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAuB/D,MAAM,aAAa,GAAkB;IACnC;QACE,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE;YACP,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE;YAC1C,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE;YACxC,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE;YAClD,EAAE,GAAG,EAAE,iBAAiB,EAAE,WAAW,EAAE,qBAAqB,EAAE;YAC9D,EAAE,GAAG,EAAE,iBAAiB,EAAE,WAAW,EAAE,qBAAqB,EAAE;YAC9D,EAAE,GAAG,EAAE,iBAAiB,EAAE,WAAW,EAAE,mBAAmB,EAAE;YAC5D,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE;SAC/C;KACF;IACD;QACE,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE;YACP,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE;YAClD,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,8CAA8C,EAAE;YACzE,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,gBAAgB,EAAE;YAC3C,EAAE,GAAG,EAAE,GAAG,EAAE,WA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AAQ,gCAAuB,EAChD,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,qCAA4B,IAC5C,CACP,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,cAAc,CAAC,SAAS,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC;IAEzD,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC,aACzC,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,QAAQ,gCAAuB,EAChD,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,IAAI,8BAAe,EACzB,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,YAAE,IAAI,CAAC,QAAQ,GAAQ,IACrC,EACP,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,IAAI,8BAAe,EACzB,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,YAAE,IAAI,CAAC,UAAU,GAAQ,IACvC,IACH,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -5,12 +5,9 @@
|
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { type HintItem } from "./HintContent.js";
|
|
7
7
|
interface StatusBarContext {
|
|
8
|
-
activePanel: "list" | "accordion";
|
|
9
8
|
hasSelection: boolean;
|
|
10
9
|
hasRequests: boolean;
|
|
11
|
-
onBodySection: boolean;
|
|
12
10
|
onViewableBodySection: boolean;
|
|
13
|
-
hasEvents: boolean;
|
|
14
11
|
}
|
|
15
12
|
interface KeyHint extends HintItem {
|
|
16
13
|
visible?: (ctx: StatusBarContext) => boolean;
|
|
@@ -20,17 +17,13 @@ export interface StatusBarProps {
|
|
|
20
17
|
filterActive?: boolean;
|
|
21
18
|
/** When true the filter bar is open and capturing input, so main-view hints are suppressed. */
|
|
22
19
|
filterOpen?: boolean;
|
|
23
|
-
activePanel?: "list" | "accordion";
|
|
24
20
|
hasSelection?: boolean;
|
|
25
21
|
hasRequests?: boolean;
|
|
26
|
-
onBodySection?: boolean;
|
|
27
22
|
onViewableBodySection?: boolean;
|
|
28
23
|
/** Number of active interceptors; shown as a badge when > 0. */
|
|
29
24
|
interceptorCount?: number;
|
|
30
25
|
/** Number of interceptor error events; shown as a red badge when > 0. */
|
|
31
26
|
interceptorErrorCount?: number;
|
|
32
|
-
/** Whether any interceptor events exist (gates L hint visibility). */
|
|
33
|
-
hasEvents?: boolean;
|
|
34
27
|
/** Terminal width in columns — used to constrain the hint bar. */
|
|
35
28
|
width?: number;
|
|
36
29
|
}
|
|
@@ -38,7 +31,7 @@ export interface StatusBarProps {
|
|
|
38
31
|
* Returns hints visible for the given context. All new props default to true
|
|
39
32
|
* so the component remains backwards-compatible when no context is passed.
|
|
40
33
|
*/
|
|
41
|
-
export declare function getVisibleHints({
|
|
42
|
-
export declare function StatusBar({ message, filterActive, filterOpen,
|
|
34
|
+
export declare function getVisibleHints({ hasSelection, hasRequests, onViewableBodySection, }: Pick<StatusBarProps, "hasSelection" | "hasRequests" | "onViewableBodySection">): KeyHint[];
|
|
35
|
+
export declare function StatusBar({ message, filterActive, filterOpen, hasSelection, hasRequests, onViewableBodySection, interceptorCount, interceptorErrorCount, width, }: StatusBarProps): React.ReactElement;
|
|
43
36
|
export {};
|
|
44
37
|
//# sourceMappingURL=StatusBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBar.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/components/StatusBar.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAe,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE9D,UAAU,gBAAgB;IACxB,
|
|
1
|
+
{"version":3,"file":"StatusBar.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/components/StatusBar.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAe,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE9D,UAAU,gBAAgB;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAED,UAAU,OAAQ,SAAQ,QAAQ;IAChC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,OAAO,CAAC;CAC9C;AAgBD,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,+FAA+F;IAC/F,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yEAAyE;IACzE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,YAAmB,EACnB,WAAkB,EAClB,qBAA6B,GAC9B,EAAE,IAAI,CAAC,cAAc,EAAE,cAAc,GAAG,aAAa,GAAG,uBAAuB,CAAC,GAAG,OAAO,EAAE,CAG5F;AAKD,wBAAgB,SAAS,CAAC,EACxB,OAAO,EACP,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,GACN,EAAE,cAAc,GAAG,KAAK,CAAC,YAAY,CAoErC"}
|
|
@@ -7,22 +7,15 @@ import { useMemo } from "react";
|
|
|
7
7
|
import { Box, Text } from "ink";
|
|
8
8
|
import { HintContent } from "./HintContent.js";
|
|
9
9
|
const KEY_HINTS = [
|
|
10
|
-
{ key: "j/k
|
|
11
|
-
{ key: "^f/^b", action: "page", visible: (ctx) => ctx.activePanel === "list" },
|
|
10
|
+
{ key: "j/k", action: "nav" },
|
|
12
11
|
{ key: "Tab", action: "panel" },
|
|
13
|
-
{ key: "1-5", action: "section" },
|
|
14
12
|
{ key: "Enter", action: "view", visible: (ctx) => ctx.onViewableBodySection },
|
|
15
|
-
{ key: "
|
|
13
|
+
{ key: "e", action: "export", visible: (ctx) => ctx.hasSelection },
|
|
16
14
|
{ key: "R", action: "replay", visible: (ctx) => ctx.hasSelection },
|
|
17
|
-
{ key: "H", action: "HAR", visible: (ctx) => ctx.hasRequests },
|
|
18
|
-
{ key: "y", action: "yank", visible: (ctx) => ctx.onBodySection },
|
|
19
|
-
{ key: "s", action: "export", visible: (ctx) => ctx.onBodySection },
|
|
20
15
|
{ key: "b", action: "bookmark", visible: (ctx) => ctx.hasSelection },
|
|
21
16
|
{ key: "x", action: "clear", visible: (ctx) => ctx.hasRequests },
|
|
22
17
|
{ key: "u", action: "URL" },
|
|
23
18
|
{ key: "/", action: "filter" },
|
|
24
|
-
{ key: "L", action: "events", visible: (ctx) => ctx.hasEvents },
|
|
25
|
-
{ key: "i", action: "info" },
|
|
26
19
|
{ key: "?", action: "help" },
|
|
27
20
|
{ key: "q", action: "quit" },
|
|
28
21
|
];
|
|
@@ -30,14 +23,14 @@ const KEY_HINTS = [
|
|
|
30
23
|
* Returns hints visible for the given context. All new props default to true
|
|
31
24
|
* so the component remains backwards-compatible when no context is passed.
|
|
32
25
|
*/
|
|
33
|
-
export function getVisibleHints({
|
|
34
|
-
const ctx = {
|
|
26
|
+
export function getVisibleHints({ hasSelection = true, hasRequests = true, onViewableBodySection = false, }) {
|
|
27
|
+
const ctx = { hasSelection, hasRequests, onViewableBodySection };
|
|
35
28
|
return KEY_HINTS.filter((hint) => !hint.visible || hint.visible(ctx));
|
|
36
29
|
}
|
|
37
30
|
const SEPARATOR_WIDTH = 3; // " │ "
|
|
38
31
|
const PADDING_WIDTH = 2; // paddingX={1} each side
|
|
39
|
-
export function StatusBar({ message, filterActive, filterOpen,
|
|
40
|
-
const visibleHints = useMemo(() => getVisibleHints({
|
|
32
|
+
export function StatusBar({ message, filterActive, filterOpen, hasSelection, hasRequests, onViewableBodySection, interceptorCount, interceptorErrorCount, width, }) {
|
|
33
|
+
const visibleHints = useMemo(() => getVisibleHints({ hasSelection, hasRequests, onViewableBodySection }), [hasSelection, hasRequests, onViewableBodySection]);
|
|
41
34
|
// Calculate available width for hints, accounting for prefix badges
|
|
42
35
|
const hintsAvailableWidth = useMemo(() => {
|
|
43
36
|
if (!width)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBar.js","sourceRoot":"","sources":["../../../../src/cli/tui/components/StatusBar.tsx"],"names":[],"mappings":";AAAA;;;GAGG;AAEH,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,WAAW,EAAiB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"StatusBar.js","sourceRoot":"","sources":["../../../../src/cli/tui/components/StatusBar.tsx"],"names":[],"mappings":";AAAA;;;GAGG;AAEH,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,WAAW,EAAiB,MAAM,kBAAkB,CAAC;AAY9D,MAAM,SAAS,GAAc;IAC3B,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;IAC7B,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE;IAC/B,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,qBAAqB,EAAE;IAC7E,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,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for exporting captured requests to various formats.
|
|
3
3
|
*/
|
|
4
4
|
import type { CapturedRequest } from "../../../shared/types.js";
|
|
5
|
+
export type ExportFormat = "curl" | "fetch" | "python" | "httpie";
|
|
5
6
|
export interface ExportResult {
|
|
6
7
|
success: boolean;
|
|
7
8
|
message: string;
|
|
8
9
|
}
|
|
9
10
|
interface UseExportResult {
|
|
10
|
-
|
|
11
|
+
exportFormat: (request: CapturedRequest, format: ExportFormat) => Promise<ExportResult>;
|
|
11
12
|
exportHar: (requests: CapturedRequest[], filename?: string) => ExportResult;
|
|
12
13
|
}
|
|
14
|
+
/** Human-readable labels for status messages. */
|
|
15
|
+
export declare const FORMAT_LABELS: Record<ExportFormat, string>;
|
|
13
16
|
/**
|
|
14
|
-
* Generate
|
|
17
|
+
* Generate an export string for a request in the given format and copy to clipboard.
|
|
15
18
|
* Extracted as standalone function for testability.
|
|
16
19
|
*/
|
|
20
|
+
export declare function exportFormatToClipboard(request: CapturedRequest, format: ExportFormat): Promise<ExportResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Generate curl command for a request and copy to clipboard.
|
|
23
|
+
* Kept for backwards compatibility with existing tests.
|
|
24
|
+
*/
|
|
17
25
|
export declare function exportCurlToClipboard(request: CapturedRequest): Promise<ExportResult>;
|
|
18
26
|
/**
|
|
19
27
|
* Export requests to HAR file.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExport.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/hooks/useExport.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"useExport.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/hooks/useExport.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAQhE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElE,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,eAAe;IACvB,YAAY,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IACxF,SAAS,EAAE,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC;CAC7E;AAUD,iDAAiD;AACjD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAKtD,CAAC;AAEF;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,YAAY,CAAC,CAevB;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC,CAE3F;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,YAAY,CAkB5F;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,eAAe,CAe3C"}
|
|
@@ -5,28 +5,53 @@ import { useCallback } from "react";
|
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as path from "node:path";
|
|
7
7
|
import { generateCurl } from "../utils/curl.js";
|
|
8
|
+
import { generateFetch } from "../utils/fetch.js";
|
|
9
|
+
import { generatePythonRequests } from "../utils/python-requests.js";
|
|
10
|
+
import { generateHttpie } from "../utils/httpie.js";
|
|
8
11
|
import { generateHarString } from "../utils/har.js";
|
|
9
12
|
import { copyToClipboard } from "../utils/clipboard.js";
|
|
13
|
+
/** Maps each format to its generator function. */
|
|
14
|
+
const FORMAT_GENERATORS = {
|
|
15
|
+
curl: generateCurl,
|
|
16
|
+
fetch: generateFetch,
|
|
17
|
+
python: generatePythonRequests,
|
|
18
|
+
httpie: generateHttpie,
|
|
19
|
+
};
|
|
20
|
+
/** Human-readable labels for status messages. */
|
|
21
|
+
export const FORMAT_LABELS = {
|
|
22
|
+
curl: "cURL",
|
|
23
|
+
fetch: "Fetch",
|
|
24
|
+
python: "Python",
|
|
25
|
+
httpie: "HTTPie",
|
|
26
|
+
};
|
|
10
27
|
/**
|
|
11
|
-
* Generate
|
|
28
|
+
* Generate an export string for a request in the given format and copy to clipboard.
|
|
12
29
|
* Extracted as standalone function for testability.
|
|
13
30
|
*/
|
|
14
|
-
export async function
|
|
31
|
+
export async function exportFormatToClipboard(request, format) {
|
|
15
32
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
33
|
+
const generator = FORMAT_GENERATORS[format];
|
|
34
|
+
const output = generator(request);
|
|
35
|
+
await copyToClipboard(output);
|
|
18
36
|
return {
|
|
19
37
|
success: true,
|
|
20
|
-
message:
|
|
38
|
+
message: `${FORMAT_LABELS[format]} copied to clipboard`,
|
|
21
39
|
};
|
|
22
40
|
}
|
|
23
41
|
catch (err) {
|
|
24
42
|
return {
|
|
25
43
|
success: false,
|
|
26
|
-
message: err instanceof Error ? err.message :
|
|
44
|
+
message: err instanceof Error ? err.message : `Failed to copy ${FORMAT_LABELS[format]}`,
|
|
27
45
|
};
|
|
28
46
|
}
|
|
29
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Generate curl command for a request and copy to clipboard.
|
|
50
|
+
* Kept for backwards compatibility with existing tests.
|
|
51
|
+
*/
|
|
52
|
+
export async function exportCurlToClipboard(request) {
|
|
53
|
+
return exportFormatToClipboard(request, "curl");
|
|
54
|
+
}
|
|
30
55
|
/**
|
|
31
56
|
* Export requests to HAR file.
|
|
32
57
|
* Extracted as standalone function for testability.
|
|
@@ -54,10 +79,10 @@ export function exportHarToFile(requests, filename) {
|
|
|
54
79
|
* Wraps standalone functions with useCallback for React optimisation.
|
|
55
80
|
*/
|
|
56
81
|
export function useExport() {
|
|
57
|
-
const
|
|
82
|
+
const exportFormatFn = useCallback((request, format) => exportFormatToClipboard(request, format), []);
|
|
58
83
|
const exportHar = useCallback((requests, filename) => exportHarToFile(requests, filename), []);
|
|
59
84
|
return {
|
|
60
|
-
|
|
85
|
+
exportFormat: exportFormatFn,
|
|
61
86
|
exportHar,
|
|
62
87
|
};
|
|
63
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExport.js","sourceRoot":"","sources":["../../../../src/cli/tui/hooks/useExport.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useExport.js","sourceRoot":"","sources":["../../../../src/cli/tui/hooks/useExport.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAcxD,kDAAkD;AAClD,MA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O,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,CAAC;QACzD,MAAM,UAAU,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAE/C,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QAE/C,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,YAAY,QAAQ,CAAC,MAAM,kBAAkB,OAAO,EAAE;SAChE,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,sBAAsB;SACrE,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,OAAwB,EAAE,MAAoB,EAAE,EAAE,CAAC,uBAAuB,CAAC,OAAO,EAAE,MAAM,CAAC,EAC5F,EAAE,CACH,CAAC;IAEF,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,QAA2B,EAAE,QAAiB,EAAE,EAAE,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACvF,EAAE,CACH,CAAC;IAEF,OAAO;QACL,YAAY,EAAE,cAAc;QAC5B,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
8
|
* Returns [columns, rows] of the terminal, updating when the terminal is resized.
|
|
9
|
+
*
|
|
10
|
+
* Reads stdout.columns/rows synchronously on every render so the value is
|
|
11
|
+
* always current — a resize-event counter forces React to re-render, but
|
|
12
|
+
* the actual dimensions are never cached in state.
|
|
9
13
|
*/
|
|
10
14
|
export declare function useStdoutDimensions(): [number, number];
|
|
11
15
|
//# sourceMappingURL=useStdoutDimensions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStdoutDimensions.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/hooks/useStdoutDimensions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"useStdoutDimensions.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/hooks/useStdoutDimensions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAyBtD"}
|
|
@@ -6,24 +6,34 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { useState, useEffect } from "react";
|
|
8
8
|
import { useStdout } from "ink";
|
|
9
|
+
const DEFAULT_COLUMNS = 80;
|
|
10
|
+
const DEFAULT_ROWS = 24;
|
|
11
|
+
const STARTUP_RECHECK_MS = 50;
|
|
9
12
|
/**
|
|
10
13
|
* Returns [columns, rows] of the terminal, updating when the terminal is resized.
|
|
14
|
+
*
|
|
15
|
+
* Reads stdout.columns/rows synchronously on every render so the value is
|
|
16
|
+
* always current — a resize-event counter forces React to re-render, but
|
|
17
|
+
* the actual dimensions are never cached in state.
|
|
11
18
|
*/
|
|
12
19
|
export function useStdoutDimensions() {
|
|
13
20
|
const { stdout } = useStdout();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
stdout.rows || 24,
|
|
17
|
-
]);
|
|
21
|
+
// Counter whose sole purpose is to trigger a re-render on resize
|
|
22
|
+
const [, setResizeCount] = useState(0);
|
|
18
23
|
useEffect(() => {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
const triggerRerender = () => setResizeCount((n) => n + 1);
|
|
25
|
+
stdout.on("resize", triggerRerender);
|
|
26
|
+
// Force a post-mount sync and one short delayed recheck.
|
|
27
|
+
// Some terminals populate columns/rows shortly after the first paint
|
|
28
|
+
// without emitting an initial "resize" event.
|
|
29
|
+
triggerRerender();
|
|
30
|
+
const startupRecheckTimer = setTimeout(triggerRerender, STARTUP_RECHECK_MS);
|
|
23
31
|
return () => {
|
|
24
|
-
|
|
32
|
+
clearTimeout(startupRecheckTimer);
|
|
33
|
+
stdout.off("resize", triggerRerender);
|
|
25
34
|
};
|
|
26
35
|
}, [stdout]);
|
|
27
|
-
|
|
36
|
+
// Always read current dimensions — never rely on stale state
|
|
37
|
+
return [stdout.columns || DEFAULT_COLUMNS, stdout.rows || DEFAULT_ROWS];
|
|
28
38
|
}
|
|
29
39
|
//# sourceMappingURL=useStdoutDimensions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStdoutDimensions.js","sourceRoot":"","sources":["../../../../src/cli/tui/hooks/useStdoutDimensions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAEhC
|
|
1
|
+
{"version":3,"file":"useStdoutDimensions.js","sourceRoot":"","sources":["../../../../src/cli/tui/hooks/useStdoutDimensions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAEhC,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IAE/B,iEAAiE;IACjE,MAAM,CAAC,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEvC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAE3D,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAErC,yDAAyD;QACzD,qEAAqE;QACrE,8CAA8C;QAC9C,eAAe,EAAE,CAAC;QAClB,MAAM,mBAAmB,GAAG,UAAU,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC;QAE5E,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,mBAAmB,CAAC,CAAC;YAClC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QACxC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,6DAA6D;IAC7D,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,eAAe,EAAE,MAAM,CAAC,IAAI,IAAI,YAAY,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/utils/curl.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/utils/curl.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAkBhE;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CA+B7D"}
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generate curl commands from captured requests.
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
* Headers that should be excluded from curl output.
|
|
6
|
-
* These are typically set automatically by curl or are connection-specific.
|
|
7
|
-
*/
|
|
8
|
-
const EXCLUDED_HEADERS = new Set([
|
|
9
|
-
"host",
|
|
10
|
-
"content-length",
|
|
11
|
-
"connection",
|
|
12
|
-
"accept-encoding",
|
|
13
|
-
"transfer-encoding",
|
|
14
|
-
]);
|
|
4
|
+
import { EXCLUDED_HEADERS } from "./export-shared.js";
|
|
15
5
|
/**
|
|
16
6
|
* Escape a string for use in a shell single-quoted context.
|
|
17
7
|
*
|
|
@@ -44,8 +34,11 @@ export function generateCurl(request) {
|
|
|
44
34
|
}
|
|
45
35
|
parts.push(`-H '${shellEscape(name)}: ${shellEscape(value)}'`);
|
|
46
36
|
}
|
|
47
|
-
// Add body if present
|
|
48
|
-
if (request.requestBody &&
|
|
37
|
+
// Add body if present and method supports it
|
|
38
|
+
if (request.requestBody &&
|
|
39
|
+
request.requestBody.length > 0 &&
|
|
40
|
+
request.method !== "GET" &&
|
|
41
|
+
request.method !== "HEAD") {
|
|
49
42
|
const bodyStr = request.requestBody.toString("utf-8");
|
|
50
43
|
parts.push(`-d '${shellEscape(bodyStr)}'`);
|
|
51
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curl.js","sourceRoot":"","sources":["../../../../src/cli/tui/utils/curl.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"curl.js","sourceRoot":"","sources":["../../../../src/cli/tui/utils/curl.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,SAAS,WAAW,CAAC,GAAW;IAC9B,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AACzD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,OAAwB;IACnD,MAAM,KAAK,GAAa,CAAC,MAAM,CAAC,CAAC;IAEjC,wBAAwB;IACxB,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,UAAU;IACV,KAAK,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAE5C,iDAAiD;IACjD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QACnE,IAAI,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YAC7C,SAAS;QACX,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjE,CAAC;IAED,6CAA6C;IAC7C,IACE,OAAO,CAAC,WAAW;QACnB,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;QAC9B,OAAO,CAAC,MAAM,KAAK,KAAK;QACxB,OAAO,CAAC,MAAM,KAAK,MAAM,EACzB,CAAC;QACD,MAAM,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for export format generators.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Headers that should be excluded from export output.
|
|
6
|
+
* These are typically set automatically by the HTTP client or are connection-specific.
|
|
7
|
+
*/
|
|
8
|
+
export declare const EXCLUDED_HEADERS: Set<string>;
|
|
9
|
+
//# sourceMappingURL=export-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-shared.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/utils/export-shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,aAM3B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for export format generators.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Headers that should be excluded from export output.
|
|
6
|
+
* These are typically set automatically by the HTTP client or are connection-specific.
|
|
7
|
+
*/
|
|
8
|
+
export const EXCLUDED_HEADERS = new Set([
|
|
9
|
+
"host",
|
|
10
|
+
"content-length",
|
|
11
|
+
"connection",
|
|
12
|
+
"accept-encoding",
|
|
13
|
+
"transfer-encoding",
|
|
14
|
+
]);
|
|
15
|
+
//# sourceMappingURL=export-shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-shared.js","sourceRoot":"","sources":["../../../../src/cli/tui/utils/export-shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IACtC,MAAM;IACN,gBAAgB;IAChB,YAAY;IACZ,iBAAiB;IACjB,mBAAmB;CACpB,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate JavaScript fetch() calls from captured requests.
|
|
3
|
+
*/
|
|
4
|
+
import type { CapturedRequest } from "../../../shared/types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Generate a JavaScript fetch() call from a captured request.
|
|
7
|
+
*/
|
|
8
|
+
export declare function generateFetch(request: CapturedRequest): string;
|
|
9
|
+
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/utils/fetch.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AA6BhE;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAoD9D"}
|