@webda/debug 4.0.0-beta.3
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/LICENSE +166 -0
- package/README.md +95 -0
- package/lib/bodycapture.d.ts +66 -0
- package/lib/bodycapture.js +162 -0
- package/lib/bodycapture.js.map +1 -0
- package/lib/debugservice.service.d.ts +166 -0
- package/lib/debugservice.service.js +609 -0
- package/lib/debugservice.service.js.map +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -0
- package/lib/introspection.d.ts +115 -0
- package/lib/introspection.js +260 -0
- package/lib/introspection.js.map +1 -0
- package/lib/logbuffer.d.ts +75 -0
- package/lib/logbuffer.js +98 -0
- package/lib/logbuffer.js.map +1 -0
- package/lib/requestlog.d.ts +181 -0
- package/lib/requestlog.js +153 -0
- package/lib/requestlog.js.map +1 -0
- package/lib/tui/client.d.ts +165 -0
- package/lib/tui/client.js +220 -0
- package/lib/tui/client.js.map +1 -0
- package/lib/tui/panels/config.d.ts +79 -0
- package/lib/tui/panels/config.js +291 -0
- package/lib/tui/panels/config.js.map +1 -0
- package/lib/tui/panels/logs.d.ts +106 -0
- package/lib/tui/panels/logs.js +342 -0
- package/lib/tui/panels/logs.js.map +1 -0
- package/lib/tui/panels/models.d.ts +47 -0
- package/lib/tui/panels/models.js +193 -0
- package/lib/tui/panels/models.js.map +1 -0
- package/lib/tui/panels/operations.d.ts +55 -0
- package/lib/tui/panels/operations.js +241 -0
- package/lib/tui/panels/operations.js.map +1 -0
- package/lib/tui/panels/panel.d.ts +55 -0
- package/lib/tui/panels/panel.js +31 -0
- package/lib/tui/panels/panel.js.map +1 -0
- package/lib/tui/panels/requests.d.ts +156 -0
- package/lib/tui/panels/requests.js +512 -0
- package/lib/tui/panels/requests.js.map +1 -0
- package/lib/tui/panels/routes.d.ts +45 -0
- package/lib/tui/panels/routes.js +154 -0
- package/lib/tui/panels/routes.js.map +1 -0
- package/lib/tui/panels/services.d.ts +49 -0
- package/lib/tui/panels/services.js +266 -0
- package/lib/tui/panels/services.js.map +1 -0
- package/lib/tui/tui.d.ts +58 -0
- package/lib/tui/tui.js +236 -0
- package/lib/tui/tui.js.map +1 -0
- package/package.json +60 -0
- package/webui/app.js +177 -0
- package/webui/components/logs.js +128 -0
- package/webui/components/model-graph.js +292 -0
- package/webui/components/models.js +213 -0
- package/webui/components/operations.js +315 -0
- package/webui/components/requests.js +264 -0
- package/webui/components/schema-form.js +268 -0
- package/webui/components/services.js +248 -0
- package/webui/index.html +22 -0
- package/webui/logo.svg +1 -0
- package/webui/styles.css +685 -0
- package/webui/vendor/htm.js +1 -0
- package/webui/vendor/preact-hooks.js +2 -0
- package/webui/vendor/preact.js +2 -0
- package/webui/webda.png +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
|
166
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# @webda/debug module
|
|
2
|
+
|
|
3
|
+
This module is part of Webda Application Framework that allows you to quickly develop applications with all modern prerequisites: Security, Extensibility, GraphQL, REST, CloudNative [https://webda.io](https://webda.io)
|
|
4
|
+
|
|
5
|
+
<img src="https://webda.io/images/webda.svg" width="128" />
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
[](https://gitter.im/loopingz/webda?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
10
|
+
[](https://codecov.io/gh/loopingz/webda.io)
|
|
11
|
+
[](https://sonarcloud.io/summary/new_code?id=loopingz_webda.io)
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
<!-- README_HEADER -->
|
|
15
|
+
|
|
16
|
+
# @webda/debug
|
|
17
|
+
|
|
18
|
+
> Development debug server for Webda — live request log, real-time WebSocket event feed, log buffer, and an introspection API to inspect models, routes, services, and operations while `webda debug` is running.
|
|
19
|
+
|
|
20
|
+
## When to use it
|
|
21
|
+
|
|
22
|
+
- You are running `webda debug` locally and want a dashboard that shows incoming HTTP requests, live logs, and application structure in real time.
|
|
23
|
+
- You need programmatic access to the Webda application's routes, models, services, and operations via an HTTP introspection API during development.
|
|
24
|
+
- You want structured request tracing (method, URL, status, duration) without adding production observability overhead.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm add @webda/debug
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Configuration
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"services": {
|
|
37
|
+
"debugService": {
|
|
38
|
+
"type": "DebugService"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`DebugService` listens on port **18181** by default. No additional parameters are required for basic use — the service auto-wires to core events on `resolve()`.
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// Typically you don't instantiate DebugService directly.
|
|
50
|
+
// It is auto-registered when you run:
|
|
51
|
+
// webda debug
|
|
52
|
+
//
|
|
53
|
+
// The service exposes:
|
|
54
|
+
// GET http://localhost:18181/ → Serves the built-in debug web UI
|
|
55
|
+
// GET http://localhost:18181/api/... → Introspection endpoints:
|
|
56
|
+
// /api/routes — registered routes
|
|
57
|
+
// /api/models — model definitions
|
|
58
|
+
// /api/services — active services
|
|
59
|
+
// /api/operations — registered operations
|
|
60
|
+
// /api/config — resolved configuration
|
|
61
|
+
// WS ws://localhost:18181/ws → Live event push (requests + logs)
|
|
62
|
+
|
|
63
|
+
// To manually start the debug server in tests:
|
|
64
|
+
import { DebugService } from "@webda/debug";
|
|
65
|
+
import { Core } from "@webda/core";
|
|
66
|
+
|
|
67
|
+
const debug = await new DebugService(Core.get(), "debugService").resolve().init();
|
|
68
|
+
// Connects to port 18181 — open http://localhost:18181 in a browser
|
|
69
|
+
await debug.stop();
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Reference
|
|
73
|
+
|
|
74
|
+
- API reference: see the auto-generated typedoc at `docs/pages/Modules/debug/`.
|
|
75
|
+
- Source: [`packages/debug`](https://github.com/loopingz/webda.io/tree/main/packages/debug)
|
|
76
|
+
- Related: [`@webda/otel`](../otel) for production-grade OpenTelemetry tracing; [`@webda/workout`](../workout) for the logging system whose output this service buffers.
|
|
77
|
+
|
|
78
|
+
<!-- README_FOOTER -->
|
|
79
|
+
## Sponsors
|
|
80
|
+
|
|
81
|
+
<!--
|
|
82
|
+
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor](mailto:sponsor@webda.io)
|
|
83
|
+
-->
|
|
84
|
+
|
|
85
|
+
Arize AI is a machine learning observability and model monitoring platform. It helps you visualize, monitor, and explain your machine learning models. [Learn more](https://arize.com)
|
|
86
|
+
|
|
87
|
+
[<img src="https://arize.com/hubfs/arize/brand/arize-logomark-1.png" width="200">](https://arize.com)
|
|
88
|
+
|
|
89
|
+
Loopingz is a software development company that provides consulting and development services. [Learn more](https://loopingz.com)
|
|
90
|
+
|
|
91
|
+
[<img src="https://loopingz.com/images/logo.png" width="200">](https://loopingz.com)
|
|
92
|
+
|
|
93
|
+
Tellae is an innovative consulting firm specialized in cities transportation issues. We provide our clients, both public and private, with solutions to support your strategic and operational decisions. [Learn more](https://tellae.fr)
|
|
94
|
+
|
|
95
|
+
[<img src="https://tellae.fr/" width="200">](https://tellae.fr)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { RequestLogBody } from "./requestlog.js";
|
|
2
|
+
/**
|
|
3
|
+
* Decide whether a Content-Type header value indicates a text payload.
|
|
4
|
+
*
|
|
5
|
+
* Matches `text/*`, JSON-shaped types (including `+json` suffix variants
|
|
6
|
+
* like `application/vnd.foo+json`), urlencoded forms, XML, JS, and ECMAScript.
|
|
7
|
+
*
|
|
8
|
+
* @param contentType - The Content-Type header value (or `undefined`).
|
|
9
|
+
* @returns `true` if the type is a known text type, `false` otherwise.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isTextContentType(contentType: string | undefined): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Heuristic: sniff a buffer to see if it looks like text.
|
|
14
|
+
*
|
|
15
|
+
* Used when the Content-Type header is missing. We declare a buffer text-y if
|
|
16
|
+
* the inspected prefix consists entirely of printable ASCII / common
|
|
17
|
+
* whitespace bytes; the presence of a NUL byte or a high-bit byte that is not
|
|
18
|
+
* part of valid UTF-8 multibyte sequences flips it to binary.
|
|
19
|
+
*
|
|
20
|
+
* The conservative behavior is fine — if we get it wrong we still emit a
|
|
21
|
+
* usable representation.
|
|
22
|
+
*
|
|
23
|
+
* @param buffer - The buffer to inspect.
|
|
24
|
+
* @param sample - Maximum bytes to inspect (default 1024).
|
|
25
|
+
* @returns `true` if the prefix looks like text, `false` otherwise.
|
|
26
|
+
*/
|
|
27
|
+
export declare function looksLikeText(buffer: Buffer, sample?: number): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Format the first `count` bytes of a buffer as a lowercase hex string.
|
|
30
|
+
*
|
|
31
|
+
* Used to give a fingerprint for binary payloads (e.g. `89504e47` for PNG)
|
|
32
|
+
* without storing the raw bytes.
|
|
33
|
+
*
|
|
34
|
+
* @param buffer - The buffer to read from.
|
|
35
|
+
* @param count - Number of bytes to include in the preview.
|
|
36
|
+
* @returns A hex string of the first `count` bytes (or the whole buffer if shorter).
|
|
37
|
+
*/
|
|
38
|
+
export declare function hexPreview(buffer: Buffer, count: number): string;
|
|
39
|
+
/**
|
|
40
|
+
* Convert a buffer + content-type into a `RequestLogBody` capture record.
|
|
41
|
+
*
|
|
42
|
+
* Rules:
|
|
43
|
+
* - Empty buffer → `{ kind: "empty" }`.
|
|
44
|
+
* - Text (by Content-Type or sniff): store as `text` if size ≤ `bodyLimit`,
|
|
45
|
+
* else `text-truncated` with the first `bodyLimit` bytes as `content`.
|
|
46
|
+
* - Binary: `{ kind: "binary", size, preview }` — only the byte length and a
|
|
47
|
+
* short hex preview are kept.
|
|
48
|
+
*
|
|
49
|
+
* @param buffer - Buffer holding the payload (may be empty).
|
|
50
|
+
* @param contentType - Value of the Content-Type header, if known.
|
|
51
|
+
* @param bodyLimit - Maximum number of bytes to keep inline for text payloads.
|
|
52
|
+
* @param binaryPreview - Number of bytes to include in the hex preview for binary payloads.
|
|
53
|
+
* @returns A normalized `RequestLogBody` describing the payload.
|
|
54
|
+
*/
|
|
55
|
+
export declare function captureBody(buffer: Buffer, contentType: string | undefined, bodyLimit: number, binaryPreview: number): RequestLogBody;
|
|
56
|
+
/**
|
|
57
|
+
* Normalize a request/response headers record into `Record<string, string>`.
|
|
58
|
+
*
|
|
59
|
+
* - `undefined`/`null` values are dropped.
|
|
60
|
+
* - Array values (e.g. multiple Set-Cookie) are joined with `, `.
|
|
61
|
+
* - Other values are coerced via `String()`.
|
|
62
|
+
*
|
|
63
|
+
* @param headers - The raw headers object (may be `undefined`).
|
|
64
|
+
* @returns A flat string-valued record (always an object, possibly empty).
|
|
65
|
+
*/
|
|
66
|
+
export declare function normalizeHeaders(headers: Record<string, string | string[] | number | undefined> | undefined): Record<string, string>;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content types that we treat as text (and therefore store inline up to the
|
|
3
|
+
* configured size limit). Anything not matched here is treated as binary
|
|
4
|
+
* — only its size and a short hex preview are kept.
|
|
5
|
+
*/
|
|
6
|
+
const TEXT_CONTENT_TYPES = [
|
|
7
|
+
"application/json",
|
|
8
|
+
"application/x-www-form-urlencoded",
|
|
9
|
+
"application/xml",
|
|
10
|
+
"application/javascript",
|
|
11
|
+
"application/ecmascript"
|
|
12
|
+
];
|
|
13
|
+
/**
|
|
14
|
+
* Decide whether a Content-Type header value indicates a text payload.
|
|
15
|
+
*
|
|
16
|
+
* Matches `text/*`, JSON-shaped types (including `+json` suffix variants
|
|
17
|
+
* like `application/vnd.foo+json`), urlencoded forms, XML, JS, and ECMAScript.
|
|
18
|
+
*
|
|
19
|
+
* @param contentType - The Content-Type header value (or `undefined`).
|
|
20
|
+
* @returns `true` if the type is a known text type, `false` otherwise.
|
|
21
|
+
*/
|
|
22
|
+
export function isTextContentType(contentType) {
|
|
23
|
+
if (!contentType)
|
|
24
|
+
return false;
|
|
25
|
+
const ct = contentType.split(";")[0].trim().toLowerCase();
|
|
26
|
+
if (!ct)
|
|
27
|
+
return false;
|
|
28
|
+
if (ct.startsWith("text/"))
|
|
29
|
+
return true;
|
|
30
|
+
if (ct.endsWith("+json") || ct.endsWith("+xml"))
|
|
31
|
+
return true;
|
|
32
|
+
return TEXT_CONTENT_TYPES.includes(ct);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Heuristic: sniff a buffer to see if it looks like text.
|
|
36
|
+
*
|
|
37
|
+
* Used when the Content-Type header is missing. We declare a buffer text-y if
|
|
38
|
+
* the inspected prefix consists entirely of printable ASCII / common
|
|
39
|
+
* whitespace bytes; the presence of a NUL byte or a high-bit byte that is not
|
|
40
|
+
* part of valid UTF-8 multibyte sequences flips it to binary.
|
|
41
|
+
*
|
|
42
|
+
* The conservative behavior is fine — if we get it wrong we still emit a
|
|
43
|
+
* usable representation.
|
|
44
|
+
*
|
|
45
|
+
* @param buffer - The buffer to inspect.
|
|
46
|
+
* @param sample - Maximum bytes to inspect (default 1024).
|
|
47
|
+
* @returns `true` if the prefix looks like text, `false` otherwise.
|
|
48
|
+
*/
|
|
49
|
+
export function looksLikeText(buffer, sample = 1024) {
|
|
50
|
+
if (buffer.length === 0)
|
|
51
|
+
return true;
|
|
52
|
+
const limit = Math.min(buffer.length, sample);
|
|
53
|
+
let i = 0;
|
|
54
|
+
while (i < limit) {
|
|
55
|
+
const byte = buffer[i];
|
|
56
|
+
// Null bytes are a strong signal that this is binary
|
|
57
|
+
if (byte === 0)
|
|
58
|
+
return false;
|
|
59
|
+
// Tab, LF, CR, and printable ASCII range
|
|
60
|
+
if (byte === 0x09 || byte === 0x0a || byte === 0x0d || (byte >= 0x20 && byte <= 0x7e)) {
|
|
61
|
+
i++;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
// High-bit byte: must begin a valid UTF-8 multibyte sequence
|
|
65
|
+
let extra = 0;
|
|
66
|
+
if (byte >= 0xc2 && byte <= 0xdf)
|
|
67
|
+
extra = 1; // 2-byte sequence
|
|
68
|
+
else if (byte >= 0xe0 && byte <= 0xef)
|
|
69
|
+
extra = 2; // 3-byte sequence
|
|
70
|
+
else if (byte >= 0xf0 && byte <= 0xf4)
|
|
71
|
+
extra = 3; // 4-byte sequence
|
|
72
|
+
else
|
|
73
|
+
return false;
|
|
74
|
+
if (i + extra >= limit) {
|
|
75
|
+
// Sequence extends past the inspected window — accept the prefix as text.
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
for (let k = 1; k <= extra; k++) {
|
|
79
|
+
const cont = buffer[i + k];
|
|
80
|
+
if (cont < 0x80 || cont > 0xbf)
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
i += extra + 1;
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Format the first `count` bytes of a buffer as a lowercase hex string.
|
|
89
|
+
*
|
|
90
|
+
* Used to give a fingerprint for binary payloads (e.g. `89504e47` for PNG)
|
|
91
|
+
* without storing the raw bytes.
|
|
92
|
+
*
|
|
93
|
+
* @param buffer - The buffer to read from.
|
|
94
|
+
* @param count - Number of bytes to include in the preview.
|
|
95
|
+
* @returns A hex string of the first `count` bytes (or the whole buffer if shorter).
|
|
96
|
+
*/
|
|
97
|
+
export function hexPreview(buffer, count) {
|
|
98
|
+
if (count <= 0 || buffer.length === 0)
|
|
99
|
+
return "";
|
|
100
|
+
return buffer.subarray(0, Math.min(count, buffer.length)).toString("hex");
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Convert a buffer + content-type into a `RequestLogBody` capture record.
|
|
104
|
+
*
|
|
105
|
+
* Rules:
|
|
106
|
+
* - Empty buffer → `{ kind: "empty" }`.
|
|
107
|
+
* - Text (by Content-Type or sniff): store as `text` if size ≤ `bodyLimit`,
|
|
108
|
+
* else `text-truncated` with the first `bodyLimit` bytes as `content`.
|
|
109
|
+
* - Binary: `{ kind: "binary", size, preview }` — only the byte length and a
|
|
110
|
+
* short hex preview are kept.
|
|
111
|
+
*
|
|
112
|
+
* @param buffer - Buffer holding the payload (may be empty).
|
|
113
|
+
* @param contentType - Value of the Content-Type header, if known.
|
|
114
|
+
* @param bodyLimit - Maximum number of bytes to keep inline for text payloads.
|
|
115
|
+
* @param binaryPreview - Number of bytes to include in the hex preview for binary payloads.
|
|
116
|
+
* @returns A normalized `RequestLogBody` describing the payload.
|
|
117
|
+
*/
|
|
118
|
+
export function captureBody(buffer, contentType, bodyLimit, binaryPreview) {
|
|
119
|
+
if (!buffer || buffer.length === 0) {
|
|
120
|
+
return { kind: "empty" };
|
|
121
|
+
}
|
|
122
|
+
const isText = contentType ? isTextContentType(contentType) : looksLikeText(buffer);
|
|
123
|
+
if (!isText) {
|
|
124
|
+
return { kind: "binary", size: buffer.length, preview: hexPreview(buffer, binaryPreview) };
|
|
125
|
+
}
|
|
126
|
+
// Text path
|
|
127
|
+
if (buffer.length <= bodyLimit) {
|
|
128
|
+
return { kind: "text", content: buffer.toString("utf8"), size: buffer.length };
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
kind: "text-truncated",
|
|
132
|
+
content: buffer.subarray(0, bodyLimit).toString("utf8"),
|
|
133
|
+
size: buffer.length
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Normalize a request/response headers record into `Record<string, string>`.
|
|
138
|
+
*
|
|
139
|
+
* - `undefined`/`null` values are dropped.
|
|
140
|
+
* - Array values (e.g. multiple Set-Cookie) are joined with `, `.
|
|
141
|
+
* - Other values are coerced via `String()`.
|
|
142
|
+
*
|
|
143
|
+
* @param headers - The raw headers object (may be `undefined`).
|
|
144
|
+
* @returns A flat string-valued record (always an object, possibly empty).
|
|
145
|
+
*/
|
|
146
|
+
export function normalizeHeaders(headers) {
|
|
147
|
+
const result = {};
|
|
148
|
+
if (!headers)
|
|
149
|
+
return result;
|
|
150
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
151
|
+
if (value === undefined || value === null)
|
|
152
|
+
continue;
|
|
153
|
+
if (Array.isArray(value)) {
|
|
154
|
+
result[key] = value.join(", ");
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
result[key] = String(value);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=bodycapture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bodycapture.js","sourceRoot":"","sources":["../src/bodycapture.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { Service, ServiceParameters } from "@webda/core";
|
|
2
|
+
import { RequestLog } from "./requestlog.js";
|
|
3
|
+
import { CancelablePromise } from "@webda/utils";
|
|
4
|
+
/**
|
|
5
|
+
* Determine whether the given Origin header value is allowed to access the debug API.
|
|
6
|
+
*
|
|
7
|
+
* Allowed origins:
|
|
8
|
+
* - http://localhost:3000 (docs dev server)
|
|
9
|
+
* - http://127.0.0.1:3000 (docs dev server, alternate address)
|
|
10
|
+
* - https://webda.io (production docs)
|
|
11
|
+
* - https://*.webda.io (any HTTPS subdomain of webda.io)
|
|
12
|
+
*
|
|
13
|
+
* @param origin - The value of the HTTP `Origin` request header.
|
|
14
|
+
* @returns `true` if the origin is allowed, `false` otherwise.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isAllowedOrigin(origin: string | undefined): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Configuration parameters for the {@link DebugService}.
|
|
19
|
+
*
|
|
20
|
+
* All capture knobs default to safe values — capture is enabled with a
|
|
21
|
+
* 64 KB inline body limit and a 4-byte hex preview for binary payloads.
|
|
22
|
+
*/
|
|
23
|
+
export declare class DebugServiceParameters extends ServiceParameters {
|
|
24
|
+
/**
|
|
25
|
+
* Whether to capture request/response headers and bodies for the debug UI.
|
|
26
|
+
* If `false`, only status code and duration are recorded.
|
|
27
|
+
*/
|
|
28
|
+
captureRequests: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Maximum number of bytes to keep inline for text bodies. Larger payloads
|
|
31
|
+
* are truncated to this size and reported as `text-truncated`.
|
|
32
|
+
*/
|
|
33
|
+
captureBodyLimit: number;
|
|
34
|
+
/**
|
|
35
|
+
* Number of leading bytes to include in the hex preview for binary bodies.
|
|
36
|
+
*/
|
|
37
|
+
captureBinaryPreview: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Debug dashboard service that provides an HTTP API for introspection
|
|
41
|
+
* and a WebSocket feed of live request events.
|
|
42
|
+
*
|
|
43
|
+
* @WebdaModda
|
|
44
|
+
*/
|
|
45
|
+
export declare class DebugService extends Service<DebugServiceParameters> {
|
|
46
|
+
static Parameters: typeof DebugServiceParameters;
|
|
47
|
+
/** Ring buffer of recent HTTP requests */
|
|
48
|
+
requestLog: RequestLog;
|
|
49
|
+
/** Ring buffer of application log entries */
|
|
50
|
+
private logBuffer;
|
|
51
|
+
/** HTTP server for the debug API */
|
|
52
|
+
private server?;
|
|
53
|
+
/** WebSocket server for live event push */
|
|
54
|
+
private wss?;
|
|
55
|
+
/** Connected WebSocket clients */
|
|
56
|
+
private clients;
|
|
57
|
+
/** Unsubscribe functions for core event listeners */
|
|
58
|
+
private unsubscribers;
|
|
59
|
+
/** Terminal UI of the running debug command */
|
|
60
|
+
private tui?;
|
|
61
|
+
/** Settle the running debug command */
|
|
62
|
+
private running?;
|
|
63
|
+
/** Timing map: requestId -> start timestamp */
|
|
64
|
+
private timings;
|
|
65
|
+
/**
|
|
66
|
+
* Resolve the typed parameters and the capture knobs (with safe defaults
|
|
67
|
+
* when the surrounding test environment does not load real parameters).
|
|
68
|
+
*
|
|
69
|
+
* @returns The effective `{ captureRequests, captureBodyLimit, captureBinaryPreview }` triple.
|
|
70
|
+
*/
|
|
71
|
+
private getCaptureSettings;
|
|
72
|
+
/**
|
|
73
|
+
* Subscribe to core events to populate the request log.
|
|
74
|
+
* @returns this for chaining
|
|
75
|
+
*/
|
|
76
|
+
resolve(): this;
|
|
77
|
+
/**
|
|
78
|
+
* Wire up core event listeners for request tracking.
|
|
79
|
+
*/
|
|
80
|
+
private subscribeToEvents;
|
|
81
|
+
/**
|
|
82
|
+
* Collect headers, bodies, and any error from a finished context.
|
|
83
|
+
*
|
|
84
|
+
* Returns `undefined` if capture is disabled via configuration. Resolves
|
|
85
|
+
* once both request body (read via the HttpContext, which caches its
|
|
86
|
+
* Buffer after the first read) and response body (read from the
|
|
87
|
+
* WebContext's buffered output stream) have been captured. Failures
|
|
88
|
+
* during capture (e.g. a body that can't be read or that times out) are
|
|
89
|
+
* swallowed so the debug service never breaks the request itself.
|
|
90
|
+
*
|
|
91
|
+
* @param ctx - The finished web context.
|
|
92
|
+
* @returns A {@link RequestLogDetails} payload, or `undefined` when capture is off.
|
|
93
|
+
*/
|
|
94
|
+
private collectDetails;
|
|
95
|
+
/**
|
|
96
|
+
* Start the application HTTP server and the debug HTTP+WS server.
|
|
97
|
+
*
|
|
98
|
+
* @param port - Port for the debug dashboard API
|
|
99
|
+
* @param servePort - Port for the application HTTP server
|
|
100
|
+
* @param web - Disable TUI and only serve the web dashboard
|
|
101
|
+
* @returns a promise settled once the service stops or the TUI quits
|
|
102
|
+
*/
|
|
103
|
+
debug(
|
|
104
|
+
/** @alias p @description Debug dashboard port */
|
|
105
|
+
port?: number,
|
|
106
|
+
/** @alias s @description Application server port */
|
|
107
|
+
servePort?: number,
|
|
108
|
+
/** @description Disable TUI and only serve the web dashboard */
|
|
109
|
+
web?: boolean): CancelablePromise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Start the application server, the debug server and the TUI or browser
|
|
112
|
+
*
|
|
113
|
+
* @param port - Port for the debug dashboard API
|
|
114
|
+
* @param servePort - Port for the application HTTP server
|
|
115
|
+
* @param web - Disable TUI and only serve the web dashboard
|
|
116
|
+
*/
|
|
117
|
+
protected startDebug(port: number, servePort: number, web?: boolean): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Settle the running debug command
|
|
120
|
+
*/
|
|
121
|
+
private settle;
|
|
122
|
+
/**
|
|
123
|
+
* Open a URL in the default browser.
|
|
124
|
+
* @param url - URL to open
|
|
125
|
+
*/
|
|
126
|
+
private openBrowser;
|
|
127
|
+
/**
|
|
128
|
+
* Create and start the debug HTTP server with WebSocket support.
|
|
129
|
+
* @param port - Port to listen on
|
|
130
|
+
*/
|
|
131
|
+
startDebugServer(port: number): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Route incoming HTTP requests to introspection handlers.
|
|
134
|
+
* @param req - Incoming HTTP request
|
|
135
|
+
* @param res - Server response
|
|
136
|
+
*/
|
|
137
|
+
private handleRequest;
|
|
138
|
+
/**
|
|
139
|
+
* Build an OpenAPI spec from the router.
|
|
140
|
+
* @returns OpenAPI document or a stub if the router is unavailable
|
|
141
|
+
*/
|
|
142
|
+
private getOpenAPISpec;
|
|
143
|
+
/**
|
|
144
|
+
* Serve a static file from the webui directory.
|
|
145
|
+
* Falls back to index.html for SPA-style routing.
|
|
146
|
+
* @param pathname - Request pathname
|
|
147
|
+
* @param res - Server response
|
|
148
|
+
*/
|
|
149
|
+
private serveStaticFile;
|
|
150
|
+
/**
|
|
151
|
+
* Write a JSON response.
|
|
152
|
+
* @param res - Server response
|
|
153
|
+
* @param data - Data to serialize
|
|
154
|
+
* @param statusCode - HTTP status code
|
|
155
|
+
*/
|
|
156
|
+
private sendJson;
|
|
157
|
+
/**
|
|
158
|
+
* Broadcast a message to all connected WebSocket clients.
|
|
159
|
+
* @param data - Data to send (will be JSON-serialized)
|
|
160
|
+
*/
|
|
161
|
+
broadcast(data: unknown): void;
|
|
162
|
+
/**
|
|
163
|
+
* Clean up HTTP server and WebSocket connections.
|
|
164
|
+
*/
|
|
165
|
+
stop(): Promise<void>;
|
|
166
|
+
}
|