api-tracer-kit 1.0.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/CHANGELOG.md +32 -0
- package/LICENSE +21 -0
- package/README.md +466 -0
- package/cli/bin/api-tracer.mjs +266 -0
- package/cli/config.mjs +224 -0
- package/cli/import.mjs +231 -0
- package/cli/index.mjs +10 -0
- package/cli/presets.mjs +212 -0
- package/cli/report.mjs +346 -0
- package/cli/scan.mjs +142 -0
- package/cli/server.mjs +1576 -0
- package/cli/shape.mjs +90 -0
- package/cli/test.mjs +342 -0
- package/cli/web/app.css +1424 -0
- package/cli/web/app.js +2260 -0
- package/cli/web/favicon.svg +5 -0
- package/cli/web/index.html +159 -0
- package/cli/web/logo.svg +7 -0
- package/dist/axios.cjs +856 -0
- package/dist/axios.cjs.map +1 -0
- package/dist/axios.d.cts +27 -0
- package/dist/axios.d.ts +27 -0
- package/dist/axios.js +853 -0
- package/dist/axios.js.map +1 -0
- package/dist/index.cjs +872 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +74 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.js +857 -0
- package/dist/index.js.map +1 -0
- package/dist/react.cjs +896 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +22 -0
- package/dist/react.d.ts +22 -0
- package/dist/react.js +893 -0
- package/dist/react.js.map +1 -0
- package/dist/tracer-BUWdU2lG.d.ts +76 -0
- package/dist/tracer-DG2YUqK0.d.cts +76 -0
- package/dist/types-Bl2-K6_g.d.cts +111 -0
- package/dist/types-Bl2-K6_g.d.ts +111 -0
- package/dist/ui.cjs +1162 -0
- package/dist/ui.cjs.map +1 -0
- package/dist/ui.d.cts +16 -0
- package/dist/ui.d.ts +16 -0
- package/dist/ui.js +1157 -0
- package/dist/ui.js.map +1 -0
- package/package.json +92 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<base href="./" />
|
|
7
|
+
<title>API console</title>
|
|
8
|
+
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
|
|
9
|
+
<link rel="stylesheet" href="app.css" />
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<header>
|
|
13
|
+
<button class="brand" id="home-btn" title="back to the overview">
|
|
14
|
+
<img src="logo.svg" alt="" class="logo" />
|
|
15
|
+
<div>
|
|
16
|
+
<strong id="console-name">API console</strong>
|
|
17
|
+
<span id="scanned" class="muted"></span>
|
|
18
|
+
</div>
|
|
19
|
+
</button>
|
|
20
|
+
<span class="spacer"></span>
|
|
21
|
+
<div id="health" class="health"></div>
|
|
22
|
+
<label class="inline">env <select id="env"></select></label>
|
|
23
|
+
<button id="live-btn" title="record API calls from the running app">Live</button>
|
|
24
|
+
<button id="report-btn">Report</button>
|
|
25
|
+
<button id="import-btn">Import traffic</button>
|
|
26
|
+
<button id="vars-btn">Variables</button>
|
|
27
|
+
<button id="token-btn">Set token</button>
|
|
28
|
+
</header>
|
|
29
|
+
|
|
30
|
+
<main>
|
|
31
|
+
<aside>
|
|
32
|
+
<input id="search" type="search" placeholder="Search endpoint, path or module" />
|
|
33
|
+
<div class="filters">
|
|
34
|
+
<select id="filter-method"><option value="">any method</option></select>
|
|
35
|
+
<select id="filter-status">
|
|
36
|
+
<option value="">any status</option>
|
|
37
|
+
<option value="pass">passing</option>
|
|
38
|
+
<option value="fail">failing</option>
|
|
39
|
+
<option value="untested">not run</option>
|
|
40
|
+
<option value="regressed">broke since last run</option>
|
|
41
|
+
<option value="unused">unused in app</option>
|
|
42
|
+
<option value="drift">contract drift</option>
|
|
43
|
+
<option value="captured">captured from app</option>
|
|
44
|
+
<option value="uncaptured">never captured</option>
|
|
45
|
+
<option value="uncatalogued">not found in source</option>
|
|
46
|
+
</select>
|
|
47
|
+
</div>
|
|
48
|
+
<div id="tree"></div>
|
|
49
|
+
</aside>
|
|
50
|
+
<section id="panel"></section>
|
|
51
|
+
</main>
|
|
52
|
+
|
|
53
|
+
<dialog id="token-dialog">
|
|
54
|
+
<h3>Sign in</h3>
|
|
55
|
+
<p class="muted">
|
|
56
|
+
Runs the sign-in flow this console was configured with
|
|
57
|
+
— and keeps the resulting token. Your password is forwarded once to the API and is
|
|
58
|
+
never stored, logged, or written to disk.
|
|
59
|
+
</p>
|
|
60
|
+
|
|
61
|
+
<div id="login-step"></div>
|
|
62
|
+
|
|
63
|
+
<details id="paste-fallback">
|
|
64
|
+
<summary class="muted">Or paste a token instead</summary>
|
|
65
|
+
<div class="paste-body">
|
|
66
|
+
<p class="muted">
|
|
67
|
+
The API authenticates with an <code id="hdr">token</code> header. If you are already
|
|
68
|
+
signed in elsewhere, run this in that tab's DevTools console and copy the result:
|
|
69
|
+
</p>
|
|
70
|
+
<pre id="snippet" class="snippet"></pre>
|
|
71
|
+
<button class="link" id="copy-snippet">copy snippet</button>
|
|
72
|
+
<textarea id="token-input" rows="4" placeholder="paste the token here" spellcheck="false"></textarea>
|
|
73
|
+
<p class="muted">
|
|
74
|
+
Held in the server's memory only — never written to disk, never sent back to this page, gone
|
|
75
|
+
when you stop the server.
|
|
76
|
+
</p>
|
|
77
|
+
<div class="row end">
|
|
78
|
+
<button id="token-save">Use this token</button>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</details>
|
|
82
|
+
|
|
83
|
+
<div class="row end">
|
|
84
|
+
<button id="token-clear">Sign out</button>
|
|
85
|
+
<button id="token-close">Close</button>
|
|
86
|
+
</div>
|
|
87
|
+
</dialog>
|
|
88
|
+
|
|
89
|
+
<dialog id="import-dialog">
|
|
90
|
+
<h3>Import real traffic</h3>
|
|
91
|
+
<p class="muted">
|
|
92
|
+
Fills query params, payloads and path ids from requests the running app actually made, so
|
|
93
|
+
you never type a sample by hand.
|
|
94
|
+
</p>
|
|
95
|
+
<ol class="muted steps">
|
|
96
|
+
<li>Open the app in Chrome, DevTools → <b>Network</b>, tick <b>Preserve log</b>.</li>
|
|
97
|
+
<li>Click through the screens you care about.</li>
|
|
98
|
+
<li>Right-click the request list → <b>Save all as HAR with content</b>.</li>
|
|
99
|
+
<li>Drop the file anywhere on this page.</li>
|
|
100
|
+
</ol>
|
|
101
|
+
<p class="muted">Or paste a single request copied with <b>Copy as cURL</b>:</p>
|
|
102
|
+
<textarea id="curl-input" rows="5" spellcheck="false"
|
|
103
|
+
placeholder="curl 'https://api.example.com/...' -H '...' --data-raw '{...}'"></textarea>
|
|
104
|
+
<p class="muted">
|
|
105
|
+
Tokens, cookies and any field named like a secret are stripped before anything is saved.
|
|
106
|
+
</p>
|
|
107
|
+
<div id="import-report"></div>
|
|
108
|
+
<div class="row end">
|
|
109
|
+
<button id="samples-clear">Clear samples</button>
|
|
110
|
+
<button id="import-close">Close</button>
|
|
111
|
+
<button class="primary" id="curl-import">Import cURL</button>
|
|
112
|
+
</div>
|
|
113
|
+
</dialog>
|
|
114
|
+
|
|
115
|
+
<dialog id="replay-dialog">
|
|
116
|
+
<h3>Replay every captured call</h3>
|
|
117
|
+
<p class="muted">
|
|
118
|
+
Each endpoint is called again with the payload, query params and path ids your app used.
|
|
119
|
+
This is not a dry run — writes create and change real records.
|
|
120
|
+
</p>
|
|
121
|
+
<div id="replay-plan"></div>
|
|
122
|
+
<label class="opt"><input type="checkbox" id="opt-deletes" /> include DELETE endpoints</label>
|
|
123
|
+
<label class="opt"><input type="checkbox" id="opt-logout" />
|
|
124
|
+
include logout <span class="muted">(can invalidate the token mid-run)</span></label>
|
|
125
|
+
<label class="opt"><input type="checkbox" id="opt-access" />
|
|
126
|
+
include endpoints needing <code>ACCESS_TOKEN</code>
|
|
127
|
+
<span class="muted">(a fresh JWT is signed for each)</span></label>
|
|
128
|
+
<p class="muted">
|
|
129
|
+
Runs one at a time, in order, so a failure is reproducible. POSTs create a new record on
|
|
130
|
+
every run.
|
|
131
|
+
</p>
|
|
132
|
+
<div class="row end">
|
|
133
|
+
<button id="replay-close">Cancel</button>
|
|
134
|
+
<button class="primary" id="replay-go">Run them</button>
|
|
135
|
+
</div>
|
|
136
|
+
</dialog>
|
|
137
|
+
|
|
138
|
+
<dialog id="vars-dialog">
|
|
139
|
+
<h3>Variables</h3>
|
|
140
|
+
<p class="muted">
|
|
141
|
+
Use <code>{{name}}</code> in any path value, query param or payload. A bulk run also fills a
|
|
142
|
+
path placeholder automatically when a variable shares its name (<code>id</code>,
|
|
143
|
+
<code>patient_id</code>), so checks hit real records instead of <code>/appointments/.json</code>.
|
|
144
|
+
</p>
|
|
145
|
+
<div id="vars-list"></div>
|
|
146
|
+
<div class="row">
|
|
147
|
+
<input id="var-name" placeholder="name" size="14" />
|
|
148
|
+
<input id="var-value" placeholder="value" />
|
|
149
|
+
<button class="primary" id="var-add">Add</button>
|
|
150
|
+
</div>
|
|
151
|
+
<p class="muted">Saved to <code>data/variables.json</code> (gitignored). Not for tokens.</p>
|
|
152
|
+
<div class="row end"><button id="vars-close">Close</button></div>
|
|
153
|
+
</dialog>
|
|
154
|
+
|
|
155
|
+
<div id="drop">drop the HAR file to import</div>
|
|
156
|
+
<div id="toast"></div>
|
|
157
|
+
<script type="module" src="app.js"></script>
|
|
158
|
+
</body>
|
|
159
|
+
</html>
|
package/cli/web/logo.svg
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 40" role="img" aria-label="api-tracer">
|
|
2
|
+
<g fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round">
|
|
3
|
+
<path d="M8 20h7l4-9 6 18 4-9h7" />
|
|
4
|
+
</g>
|
|
5
|
+
<text x="42" y="26" font-family="ui-monospace, SFMono-Regular, Menlo, monospace"
|
|
6
|
+
font-size="15" font-weight="600" fill="currentColor">api-tracer</text>
|
|
7
|
+
</svg>
|