@dunx/http 2.0.1 → 2.1.1
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/README.md +136 -47
- package/dist/{chunk-5z96f3gr.js → chunk-sz4pvqxy.js} +4 -3
- package/dist/{chunk-5z96f3gr.js.map → chunk-sz4pvqxy.js.map} +2 -2
- package/dist/client.js +1 -1
- package/dist/health/contracts.d.ts +56 -0
- package/dist/health/controller.d.ts +21 -0
- package/dist/health/indicators.d.ts +71 -0
- package/dist/health/module.d.ts +40 -0
- package/dist/health/readiness.d.ts +51 -0
- package/dist/health/registry.d.ts +64 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +407 -55
- package/dist/index.js.map +15 -9
- package/dist/route/discover.d.ts +1 -1
- package/dist/server/application.d.ts +6 -0
- package/dist/server/client-address.d.ts +7 -1
- package/dist/server/settings.d.ts +9 -4
- package/package.json +2 -2
package/dist/route/discover.d.ts
CHANGED
|
@@ -132,6 +132,12 @@ export declare class HttpApplication implements HttpApp {
|
|
|
132
132
|
* matches an upgrade, and no `fetch` handler is needed at all.
|
|
133
133
|
*/
|
|
134
134
|
listen(port?: number): Promise<string>;
|
|
135
|
+
/**
|
|
136
|
+
* Delegated unchanged: the drain is the container's phase, and `shutdown()`
|
|
137
|
+
* runs it. Public so an operator can start draining without committing to a
|
|
138
|
+
* shutdown, which is what a readiness probe wants during a rolling deploy.
|
|
139
|
+
*/
|
|
140
|
+
drain(): Promise<void>;
|
|
135
141
|
shutdown(): Promise<void>;
|
|
136
142
|
enableShutdownHooks(signals?: readonly ShutdownSignal[], options?: ShutdownHookOptions): this;
|
|
137
143
|
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import type { BunRequest, Server } from 'bun';
|
|
2
2
|
export interface AddressSource {
|
|
3
3
|
readonly server: Server<unknown>;
|
|
4
|
-
readonly trustProxy: boolean;
|
|
4
|
+
readonly trustProxy: boolean | number;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* The client's address, honouring the `'trust proxy'` setting.
|
|
8
8
|
*
|
|
9
|
+
* With the setting on, the address is read from `X-Forwarded-For` counting from
|
|
10
|
+
* the right by the number of trusted hops, never from the left. A client can put
|
|
11
|
+
* anything in the header it sends; only the entries a proxy appended carry any
|
|
12
|
+
* weight, and there are exactly as many of those as there are proxies in front of
|
|
13
|
+
* this server.
|
|
14
|
+
*
|
|
9
15
|
* Bound and exported by `HttpFactory`'s global wrapper module, so injecting it in a
|
|
10
16
|
* middleware or controller needs no registration and `app.clientIp(req)` is the same
|
|
11
17
|
* instance. That binding is not optional under module scoping: an unbound class
|
|
@@ -5,10 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export interface AppSettings {
|
|
7
7
|
/**
|
|
8
|
-
* Resolve the client address from `X-Forwarded-For` rather than the socket.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Resolve the client address from `X-Forwarded-For` rather than the socket.
|
|
9
|
+
*
|
|
10
|
+
* The value is how many proxies sit in front of this server: `true` means one,
|
|
11
|
+
* a number means that many, `false` means read the socket. The address is taken
|
|
12
|
+
* that many entries from the **right**, because a direct client can send
|
|
13
|
+
* whatever it likes in the header and only a proxy under your control appends
|
|
14
|
+
* to it. Setting a count higher than the number of proxies you actually run
|
|
15
|
+
* hands the caller its own choice of address.
|
|
11
16
|
*/
|
|
12
|
-
'trust proxy': boolean;
|
|
17
|
+
'trust proxy': boolean | number;
|
|
13
18
|
}
|
|
14
19
|
export declare const defaultSettings: () => AppSettings;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dunx/http",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Bun.serve adapter for the dunx framework: controllers, middleware and WebSocket gateways",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@dunx/core": "workspace:*"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@dunx/core": "^2.
|
|
61
|
+
"@dunx/core": "^2.1.1",
|
|
62
62
|
"@types/bun": ">=1.3.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependenciesMeta": {
|