@suveren/gateway 0.2.12 → 0.3.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 +21 -7
- package/dist/control-plane/index.mjs +146 -2
- package/dist/mcp-server/http.mjs +85 -38
- package/dist/ui/assets/index-RkZBhIxU.js +105 -0
- package/dist/ui/index.html +1 -1
- package/node_modules/@hap/core/dist/index.d.mts +147 -3
- package/node_modules/@hap/core/dist/index.d.ts +147 -3
- package/node_modules/@hap/core/dist/index.js +74 -10
- package/node_modules/@hap/core/dist/index.mjs +69 -10
- package/node_modules/@hap/core/package.json +1 -1
- package/node_modules/@hap/core/src/gatekeeper.ts +4 -4
- package/node_modules/@hap/core/src/identity.ts +77 -0
- package/node_modules/@hap/core/src/index.ts +2 -0
- package/node_modules/@hap/core/src/intent-disclosure.ts +69 -0
- package/node_modules/@hap/core/src/types.ts +62 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/README.md +16 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/index.js +4 -20
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/read.js +17 -17
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/types/json.js +60 -32
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/types/raw.js +3 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/types/text.js +3 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/types/urlencoded.js +16 -20
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/utils.js +18 -16
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/LICENSE +22 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/README.md +69 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +26 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/dist/index.js +170 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/package.json +52 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/package.json +23 -10
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/assert/strict.d.ts +10 -1
- package/node_modules/@types/node/assert.d.ts +144 -17
- package/node_modules/@types/node/async_hooks.d.ts +9 -9
- package/node_modules/@types/node/buffer.d.ts +0 -5
- package/node_modules/@types/node/child_process.d.ts +17 -21
- package/node_modules/@types/node/cluster.d.ts +13 -13
- package/node_modules/@types/node/console.d.ts +1 -1
- package/node_modules/@types/node/crypto.d.ts +454 -571
- package/node_modules/@types/node/diagnostics_channel.d.ts +37 -29
- package/node_modules/@types/node/dns.d.ts +14 -14
- package/node_modules/@types/node/events.d.ts +3 -3
- package/node_modules/@types/node/fs/promises.d.ts +4 -4
- package/node_modules/@types/node/fs.d.ts +3 -12
- package/node_modules/@types/node/globals.d.ts +4 -4
- package/node_modules/@types/node/http.d.ts +5 -5
- package/node_modules/@types/node/http2.d.ts +5 -1
- package/node_modules/@types/node/index.d.ts +0 -3
- package/node_modules/@types/node/inspector.d.ts +1 -1
- package/node_modules/@types/node/module.d.ts +16 -45
- package/node_modules/@types/node/net.d.ts +1 -1
- package/node_modules/@types/node/os.d.ts +2 -2
- package/node_modules/@types/node/package.json +4 -4
- package/node_modules/@types/node/perf_hooks.d.ts +1 -9
- package/node_modules/@types/node/process.d.ts +11 -11
- package/node_modules/@types/node/readline.d.ts +12 -11
- package/node_modules/@types/node/repl.d.ts +10 -10
- package/node_modules/@types/node/sqlite.d.ts +1 -1
- package/node_modules/@types/node/stream/promises.d.ts +2 -2
- package/node_modules/@types/node/stream/web.d.ts +1 -1
- package/node_modules/@types/node/stream.d.ts +5 -5
- package/node_modules/@types/node/test/reporters.d.ts +1 -1
- package/node_modules/@types/node/test.d.ts +8 -8
- package/node_modules/@types/node/tls.d.ts +1 -1
- package/node_modules/@types/node/ts5.6/index.d.ts +1 -4
- package/node_modules/@types/node/ts5.7/index.d.ts +0 -3
- package/node_modules/@types/node/url.d.ts +3 -3
- package/node_modules/@types/node/util/types.d.ts +1 -1
- package/node_modules/@types/node/util.d.ts +3 -20
- package/node_modules/@types/node/v8.d.ts +1 -1
- package/node_modules/@types/node/vm.d.ts +9 -9
- package/node_modules/@types/node/web-globals/domexception.d.ts +15 -0
- package/node_modules/@types/node/worker_threads.d.ts +2 -5
- package/node_modules/@types/node/zlib.d.ts +3 -3
- package/node_modules/fast-uri/index.js +1 -1
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/security.test.js +28 -0
- package/node_modules/hono/dist/adapter/aws-lambda/handler.js +14 -20
- package/node_modules/hono/dist/adapter/lambda-edge/handler.js +8 -2
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +14 -20
- package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +8 -2
- package/node_modules/hono/dist/cjs/helper/css/common.js +3 -1
- package/node_modules/hono/dist/cjs/helper/css/index.js +9 -1
- package/node_modules/hono/dist/cjs/jsx/base.js +8 -14
- package/node_modules/hono/dist/cjs/jsx/components.js +41 -21
- package/node_modules/hono/dist/cjs/jsx/context.js +131 -5
- package/node_modules/hono/dist/cjs/jsx/streaming.js +9 -7
- package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/cors/index.js +2 -5
- package/node_modules/hono/dist/cjs/middleware/language/language.js +10 -32
- package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/timing/timing.js +3 -1
- package/node_modules/hono/dist/cjs/utils/ipaddr.js +6 -1
- package/node_modules/hono/dist/helper/css/common.js +3 -1
- package/node_modules/hono/dist/helper/css/index.js +9 -1
- package/node_modules/hono/dist/jsx/base.js +15 -15
- package/node_modules/hono/dist/jsx/components.js +42 -22
- package/node_modules/hono/dist/jsx/context.js +129 -5
- package/node_modules/hono/dist/jsx/streaming.js +10 -8
- package/node_modules/hono/dist/middleware/bearer-auth/index.js +1 -1
- package/node_modules/hono/dist/middleware/cors/index.js +2 -5
- package/node_modules/hono/dist/middleware/language/language.js +10 -32
- package/node_modules/hono/dist/middleware/serve-static/index.js +1 -1
- package/node_modules/hono/dist/middleware/timing/timing.js +3 -1
- package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +1 -1
- package/node_modules/hono/dist/types/adapter/aws-lambda/handler.d.ts +1 -1
- package/node_modules/hono/dist/types/jsx/base.d.ts +1 -3
- package/node_modules/hono/dist/types/jsx/context.d.ts +39 -0
- package/node_modules/hono/dist/utils/ipaddr.js +6 -1
- package/node_modules/hono/package.json +19 -13
- package/node_modules/http-proxy-middleware/README.md +3 -10
- package/node_modules/http-proxy-middleware/dist/errors.d.ts +4 -0
- package/node_modules/http-proxy-middleware/dist/errors.js +16 -1
- package/node_modules/http-proxy-middleware/dist/factory.d.ts +2 -2
- package/node_modules/http-proxy-middleware/dist/handlers/fix-request-body-utils/stringify-form-data.d.ts +7 -0
- package/node_modules/http-proxy-middleware/dist/handlers/fix-request-body-utils/stringify-form-data.js +45 -0
- package/node_modules/http-proxy-middleware/dist/handlers/fix-request-body.d.ts +1 -1
- package/node_modules/http-proxy-middleware/dist/handlers/fix-request-body.js +23 -23
- package/node_modules/http-proxy-middleware/dist/handlers/response-interceptor.d.ts +1 -1
- package/node_modules/http-proxy-middleware/dist/handlers/response-interceptor.js +1 -1
- package/node_modules/http-proxy-middleware/dist/http-proxy-middleware.d.ts +1 -1
- package/node_modules/http-proxy-middleware/dist/http-proxy-middleware.js +2 -2
- package/node_modules/http-proxy-middleware/dist/legacy/create-proxy-middleware.d.ts +1 -1
- package/node_modules/http-proxy-middleware/dist/legacy/create-proxy-middleware.js +1 -1
- package/node_modules/http-proxy-middleware/dist/legacy/options-adapter.js +1 -1
- package/node_modules/http-proxy-middleware/dist/legacy/types.d.ts +1 -1
- package/node_modules/http-proxy-middleware/dist/path-filter.d.ts +1 -1
- package/node_modules/http-proxy-middleware/dist/path-filter.js +1 -1
- package/node_modules/http-proxy-middleware/dist/path-rewriter.js +1 -1
- package/node_modules/http-proxy-middleware/dist/plugins/default/error-response-plugin.js +2 -1
- package/node_modules/http-proxy-middleware/dist/plugins/default/logger-plugin.js +3 -3
- package/node_modules/http-proxy-middleware/dist/router.js +26 -8
- package/node_modules/http-proxy-middleware/dist/status-code.js +15 -12
- package/node_modules/http-proxy-middleware/dist/types.d.ts +3 -3
- package/node_modules/http-proxy-middleware/dist/types.js +0 -4
- package/node_modules/http-proxy-middleware/dist/utils/sanitize.d.ts +1 -0
- package/node_modules/http-proxy-middleware/dist/utils/sanitize.js +6 -0
- package/node_modules/http-proxy-middleware/package.json +30 -28
- package/node_modules/qs/CHANGELOG.md +11 -0
- package/node_modules/qs/dist/qs.js +17 -17
- package/node_modules/qs/lib/parse.js +19 -8
- package/node_modules/qs/lib/utils.js +47 -8
- package/node_modules/qs/package.json +6 -5
- package/node_modules/qs/test/parse.js +230 -0
- package/node_modules/qs/test/utils.js +194 -0
- package/node_modules/side-channel/CHANGELOG.md +10 -0
- package/node_modules/side-channel/README.md +1 -1
- package/node_modules/side-channel/index.js +5 -2
- package/node_modules/side-channel/package.json +10 -10
- package/node_modules/side-channel/test/index.js +16 -0
- package/node_modules/undici-types/agent.d.ts +0 -2
- package/node_modules/undici-types/client.d.ts +25 -19
- package/node_modules/undici-types/dispatcher.d.ts +7 -33
- package/node_modules/undici-types/dispatcher1-wrapper.d.ts +7 -0
- package/node_modules/undici-types/fetch.d.ts +24 -4
- package/node_modules/undici-types/h2c-client.d.ts +6 -6
- package/node_modules/undici-types/handlers.d.ts +1 -2
- package/node_modules/undici-types/header.d.ts +5 -0
- package/node_modules/undici-types/index.d.ts +3 -1
- package/node_modules/undici-types/interceptors.d.ts +1 -1
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/pool.d.ts +0 -2
- package/node_modules/undici-types/proxy-agent.d.ts +2 -2
- package/node_modules/undici-types/round-robin-pool.d.ts +0 -2
- package/node_modules/undici-types/snapshot-agent.d.ts +4 -0
- package/node_modules/undici-types/socks5-proxy-agent.d.ts +2 -2
- package/node_modules/undici-types/webidl.d.ts +0 -1
- package/package.json +3 -3
- package/dist/ui/assets/index-CS16uhqb.js +0 -102
- package/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
|
@@ -3,7 +3,7 @@ import Dispatcher from './dispatcher'
|
|
|
3
3
|
import buildConnector from './connector'
|
|
4
4
|
import TClientStats from './client-stats'
|
|
5
5
|
|
|
6
|
-
type ClientConnectOptions = Omit<Dispatcher.ConnectOptions
|
|
6
|
+
type ClientConnectOptions<TOpaque = null> = Omit<Dispatcher.ConnectOptions<TOpaque>, 'origin'>
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default.
|
|
@@ -20,22 +20,17 @@ export class Client extends Dispatcher {
|
|
|
20
20
|
readonly stats: TClientStats
|
|
21
21
|
|
|
22
22
|
// Override dispatcher APIs.
|
|
23
|
-
override connect (
|
|
24
|
-
options: ClientConnectOptions
|
|
25
|
-
): Promise<Dispatcher.ConnectData
|
|
26
|
-
override connect (
|
|
27
|
-
options: ClientConnectOptions
|
|
28
|
-
callback: (err: Error | null, data: Dispatcher.ConnectData) => void
|
|
23
|
+
override connect<TOpaque = null> (
|
|
24
|
+
options: ClientConnectOptions<TOpaque>
|
|
25
|
+
): Promise<Dispatcher.ConnectData<TOpaque>>
|
|
26
|
+
override connect<TOpaque = null> (
|
|
27
|
+
options: ClientConnectOptions<TOpaque>,
|
|
28
|
+
callback: (err: Error | null, data: Dispatcher.ConnectData<TOpaque>) => void
|
|
29
29
|
): void
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export declare namespace Client {
|
|
33
|
-
export interface OptionsInterceptors {
|
|
34
|
-
Client: readonly Dispatcher.DispatchInterceptor[];
|
|
35
|
-
}
|
|
36
33
|
export interface Options {
|
|
37
|
-
/** TODO */
|
|
38
|
-
interceptors?: OptionsInterceptors;
|
|
39
34
|
/** The maximum length of request headers in bytes. Default: Node.js' `--max-http-header-size` or `16384` (16KiB). */
|
|
40
35
|
maxHeaderSize?: number;
|
|
41
36
|
/** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */
|
|
@@ -44,7 +39,7 @@ export declare namespace Client {
|
|
|
44
39
|
socketTimeout?: never;
|
|
45
40
|
/** @deprecated unsupported requestTimeout, use headersTimeout & bodyTimeout instead */
|
|
46
41
|
requestTimeout?: never;
|
|
47
|
-
/**
|
|
42
|
+
/** The timeout for establishing a socket connection, in milliseconds. Use `0` to disable it entirely. Default: `10e3` milliseconds (10s). */
|
|
48
43
|
connectTimeout?: number;
|
|
49
44
|
/** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). */
|
|
50
45
|
bodyTimeout?: number;
|
|
@@ -60,7 +55,7 @@ export declare namespace Client {
|
|
|
60
55
|
keepAliveMaxTimeout?: number;
|
|
61
56
|
/** A number of milliseconds subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */
|
|
62
57
|
keepAliveTimeoutThreshold?: number;
|
|
63
|
-
/**
|
|
58
|
+
/** An IPC endpoint, either a Unix domain socket or Windows named pipe. Default: `null`. */
|
|
64
59
|
socketPath?: string;
|
|
65
60
|
/** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */
|
|
66
61
|
pipelining?: number;
|
|
@@ -68,23 +63,25 @@ export declare namespace Client {
|
|
|
68
63
|
tls?: never;
|
|
69
64
|
/** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */
|
|
70
65
|
strictContentLength?: boolean;
|
|
71
|
-
/**
|
|
66
|
+
/** Maximum number of TLS cached sessions used by the built-in connector. Use `0` to disable TLS session caching. Default: `100`. */
|
|
72
67
|
maxCachedSessions?: number;
|
|
73
|
-
/**
|
|
68
|
+
/** Connector options passed to `buildConnector`, or a custom connector function. Default: `null`. */
|
|
74
69
|
connect?: Partial<buildConnector.BuildOptions> | buildConnector.connector;
|
|
75
|
-
/**
|
|
70
|
+
/** The maximum number of requests to send over a single connection before it is reset. Use `0` to disable this limit. Default: `null`. */
|
|
76
71
|
maxRequestsPerClient?: number;
|
|
77
|
-
/**
|
|
72
|
+
/** Local IP address the socket should connect from. */
|
|
78
73
|
localAddress?: string;
|
|
79
74
|
/** Max response body size in bytes, -1 is disabled */
|
|
80
75
|
maxResponseSize?: number;
|
|
76
|
+
/** WebSocket-specific options */
|
|
77
|
+
webSocket?: Client.WebSocketOptions;
|
|
81
78
|
/** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */
|
|
82
79
|
autoSelectFamily?: boolean;
|
|
83
80
|
/** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */
|
|
84
81
|
autoSelectFamilyAttemptTimeout?: number;
|
|
85
82
|
/**
|
|
86
83
|
* @description Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation.
|
|
87
|
-
* @default
|
|
84
|
+
* @default true
|
|
88
85
|
*/
|
|
89
86
|
allowH2?: boolean;
|
|
90
87
|
/**
|
|
@@ -118,6 +115,15 @@ export declare namespace Client {
|
|
|
118
115
|
bytesWritten?: number
|
|
119
116
|
bytesRead?: number
|
|
120
117
|
}
|
|
118
|
+
export interface WebSocketOptions {
|
|
119
|
+
/**
|
|
120
|
+
* Maximum allowed payload size in bytes for WebSocket messages.
|
|
121
|
+
* Applied to uncompressed messages, compressed frame payloads, and decompressed (permessage-deflate) messages.
|
|
122
|
+
* Set to 0 to disable the limit.
|
|
123
|
+
* @default 134217728 (128 MB)
|
|
124
|
+
*/
|
|
125
|
+
maxPayloadSize?: number;
|
|
126
|
+
}
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
export default Client
|
|
@@ -2,17 +2,15 @@ import { URL } from 'node:url'
|
|
|
2
2
|
import { Duplex, Readable, Writable } from 'node:stream'
|
|
3
3
|
import { EventEmitter } from 'node:events'
|
|
4
4
|
import { Blob } from 'node:buffer'
|
|
5
|
-
import { IncomingHttpHeaders } from './header'
|
|
5
|
+
import { IncomingHttpHeaders, OutgoingHttpHeaders } from './header'
|
|
6
6
|
import BodyReadable from './readable'
|
|
7
7
|
import { FormData } from './formdata'
|
|
8
8
|
import Errors from './errors'
|
|
9
9
|
import { Autocomplete } from './utility'
|
|
10
10
|
|
|
11
|
-
type AbortSignal = unknown
|
|
12
|
-
|
|
13
11
|
export default Dispatcher
|
|
14
12
|
|
|
15
|
-
export type UndiciHeaders =
|
|
13
|
+
export type UndiciHeaders = OutgoingHttpHeaders | string[] | Iterable<[string, string | string[] | undefined]> | null
|
|
16
14
|
|
|
17
15
|
/** Dispatcher is the core API used to dispatch requests. */
|
|
18
16
|
declare class Dispatcher extends EventEmitter {
|
|
@@ -123,8 +121,6 @@ declare namespace Dispatcher {
|
|
|
123
121
|
bodyTimeout?: number | null;
|
|
124
122
|
/** Whether the request should stablish a keep-alive or not. Default `false` */
|
|
125
123
|
reset?: boolean;
|
|
126
|
-
/** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */
|
|
127
|
-
throwOnError?: boolean;
|
|
128
124
|
/** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server */
|
|
129
125
|
expectContinue?: boolean;
|
|
130
126
|
}
|
|
@@ -137,8 +133,6 @@ declare namespace Dispatcher {
|
|
|
137
133
|
signal?: AbortSignal | EventEmitter | null;
|
|
138
134
|
/** This argument parameter is passed through to `ConnectData` */
|
|
139
135
|
opaque?: TOpaque;
|
|
140
|
-
/** Default: false */
|
|
141
|
-
redirectionLimitReached?: boolean;
|
|
142
136
|
/** Default: `null` */
|
|
143
137
|
responseHeaders?: 'raw' | null;
|
|
144
138
|
}
|
|
@@ -147,8 +141,6 @@ declare namespace Dispatcher {
|
|
|
147
141
|
opaque?: TOpaque;
|
|
148
142
|
/** Default: `null` */
|
|
149
143
|
signal?: AbortSignal | EventEmitter | null;
|
|
150
|
-
/** Default: false */
|
|
151
|
-
redirectionLimitReached?: boolean;
|
|
152
144
|
/** Default: `null` */
|
|
153
145
|
onInfo?: (info: { statusCode: number, headers: Record<string, string | string[]> }) => void;
|
|
154
146
|
/** Default: `null` */
|
|
@@ -170,8 +162,6 @@ declare namespace Dispatcher {
|
|
|
170
162
|
protocol?: string;
|
|
171
163
|
/** Default: `null` */
|
|
172
164
|
signal?: AbortSignal | EventEmitter | null;
|
|
173
|
-
/** Default: false */
|
|
174
|
-
redirectionLimitReached?: boolean;
|
|
175
165
|
/** Default: `null` */
|
|
176
166
|
responseHeaders?: 'raw' | null;
|
|
177
167
|
}
|
|
@@ -218,6 +208,8 @@ declare namespace Dispatcher {
|
|
|
218
208
|
get aborted(): boolean
|
|
219
209
|
get paused(): boolean
|
|
220
210
|
get reason(): Error | null
|
|
211
|
+
rawHeaders?: Buffer[] | string[] | IncomingHttpHeaders | null
|
|
212
|
+
rawTrailers?: Buffer[] | string[] | IncomingHttpHeaders | null
|
|
221
213
|
abort(reason: Error): void
|
|
222
214
|
pause(): void
|
|
223
215
|
resume(): void
|
|
@@ -231,30 +223,12 @@ declare namespace Dispatcher {
|
|
|
231
223
|
onResponseEnd?(controller: DispatchController, trailers: IncomingHttpHeaders): void;
|
|
232
224
|
onResponseError?(controller: DispatchController, error: Error): void;
|
|
233
225
|
|
|
234
|
-
/** Invoked before request is dispatched on socket. May be invoked multiple times when a request is retried when the request at the head of the pipeline fails. */
|
|
235
|
-
/** @deprecated */
|
|
236
|
-
onConnect?(abort: (err?: Error) => void): void;
|
|
237
|
-
/** Invoked when an error has occurred. */
|
|
238
|
-
/** @deprecated */
|
|
239
|
-
onError?(err: Error): void;
|
|
240
|
-
/** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
|
|
241
|
-
/** @deprecated */
|
|
242
|
-
onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
|
|
243
226
|
/** Invoked when response is received, before headers have been read. **/
|
|
244
|
-
/** @deprecated */
|
|
245
227
|
onResponseStarted?(): void;
|
|
246
|
-
/** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */
|
|
247
|
-
/** @deprecated */
|
|
248
|
-
onHeaders?(statusCode: number, headers: Buffer[], resume: () => void, statusText: string): boolean;
|
|
249
|
-
/** Invoked when response payload data is received. */
|
|
250
|
-
/** @deprecated */
|
|
251
|
-
onData?(chunk: Buffer): boolean;
|
|
252
|
-
/** Invoked when response payload and trailers have been received and the request has completed. */
|
|
253
|
-
/** @deprecated */
|
|
254
|
-
onComplete?(trailers: string[] | null): void;
|
|
255
228
|
/** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */
|
|
256
|
-
|
|
257
|
-
|
|
229
|
+
onBodySent?(chunk: Buffer): void;
|
|
230
|
+
/** Invoked after the request body is fully sent. */
|
|
231
|
+
onRequestSent?(): void;
|
|
258
232
|
}
|
|
259
233
|
export type PipelineHandler<TOpaque = null> = (data: PipelineHandlerData<TOpaque>) => Readable
|
|
260
234
|
export type HttpMethod = Autocomplete<'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'>
|
|
@@ -60,12 +60,32 @@ export interface SpecIterator<T, TReturn = any, TNext = undefined> {
|
|
|
60
60
|
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export interface
|
|
63
|
+
export interface SpecIteratorObject<T, TReturn = undefined, TNext = unknown> extends SpecIterator<T, TReturn, TNext> {
|
|
64
|
+
[Symbol.iterator](): SpecIteratorObject<T, TReturn, TNext>;
|
|
65
|
+
map<U>(callbackfn: (value: T, index: number) => U): SpecIteratorObject<U>;
|
|
66
|
+
filter<S extends T>(predicate: (value: T, index: number) => value is S): SpecIteratorObject<S>;
|
|
67
|
+
filter(predicate: (value: T, index: number) => unknown): SpecIteratorObject<T>;
|
|
68
|
+
take(limit: number): SpecIteratorObject<T>;
|
|
69
|
+
drop(count: number): SpecIteratorObject<T>;
|
|
70
|
+
flatMap<U>(callbackfn: (value: T, index: number) => Iterator<U> | Iterable<U>): SpecIteratorObject<U>;
|
|
71
|
+
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T): T;
|
|
72
|
+
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T, initialValue: T): T;
|
|
73
|
+
reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => U, initialValue: U): U;
|
|
74
|
+
toArray(): T[];
|
|
75
|
+
forEach(callbackfn: (value: T, index: number) => void): void;
|
|
76
|
+
some(predicate: (value: T, index: number) => unknown): boolean;
|
|
77
|
+
every(predicate: (value: T, index: number) => unknown): boolean;
|
|
78
|
+
find<S extends T>(predicate: (value: T, index: number) => value is S): S | undefined;
|
|
79
|
+
find(predicate: (value: T, index: number) => unknown): T | undefined;
|
|
80
|
+
readonly [Symbol.toStringTag]: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface SpecIterableIterator<T> extends SpecIteratorObject<T> {
|
|
64
84
|
[Symbol.iterator](): SpecIterableIterator<T>;
|
|
65
85
|
}
|
|
66
86
|
|
|
67
87
|
export interface SpecIterable<T> {
|
|
68
|
-
[Symbol.iterator]():
|
|
88
|
+
[Symbol.iterator](): SpecIterableIterator<T>;
|
|
69
89
|
}
|
|
70
90
|
|
|
71
91
|
export type HeadersInit = [string, string][] | HeaderRecord | Headers
|
|
@@ -173,7 +193,7 @@ export declare class Request extends BodyMixin {
|
|
|
173
193
|
readonly signal: AbortSignal
|
|
174
194
|
readonly duplex: RequestDuplex
|
|
175
195
|
|
|
176
|
-
|
|
196
|
+
public clone (): Request
|
|
177
197
|
}
|
|
178
198
|
|
|
179
199
|
export interface ResponseInit {
|
|
@@ -203,7 +223,7 @@ export declare class Response extends BodyMixin {
|
|
|
203
223
|
readonly url: string
|
|
204
224
|
readonly redirected: boolean
|
|
205
225
|
|
|
206
|
-
|
|
226
|
+
public clone (): Response
|
|
207
227
|
|
|
208
228
|
static error (): Response
|
|
209
229
|
static json (data: any, init?: ResponseInit): Response
|
|
@@ -32,7 +32,7 @@ export declare namespace H2CClient {
|
|
|
32
32
|
maxHeaderSize?: number;
|
|
33
33
|
/** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */
|
|
34
34
|
headersTimeout?: number;
|
|
35
|
-
/**
|
|
35
|
+
/** The timeout for establishing a socket connection, in milliseconds. Use `0` to disable it entirely. Default: `10e3` milliseconds (10s). */
|
|
36
36
|
connectTimeout?: number;
|
|
37
37
|
/** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). */
|
|
38
38
|
bodyTimeout?: number;
|
|
@@ -42,19 +42,19 @@ export declare namespace H2CClient {
|
|
|
42
42
|
keepAliveMaxTimeout?: number;
|
|
43
43
|
/** A number of milliseconds subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */
|
|
44
44
|
keepAliveTimeoutThreshold?: number;
|
|
45
|
-
/**
|
|
45
|
+
/** An IPC endpoint, either a Unix domain socket or Windows named pipe. Default: `null`. */
|
|
46
46
|
socketPath?: string;
|
|
47
47
|
/** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */
|
|
48
48
|
pipelining?: number;
|
|
49
49
|
/** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */
|
|
50
50
|
strictContentLength?: boolean;
|
|
51
|
-
/**
|
|
51
|
+
/** Maximum number of TLS cached sessions used by the built-in connector. Use `0` to disable TLS session caching. Default: `100`. */
|
|
52
52
|
maxCachedSessions?: number;
|
|
53
|
-
/**
|
|
53
|
+
/** Connector options passed to `buildConnector`, or a custom connector function. Default: `null`. */
|
|
54
54
|
connect?: Omit<Partial<buildConnector.BuildOptions>, 'allowH2'> | buildConnector.connector;
|
|
55
|
-
/**
|
|
55
|
+
/** The maximum number of requests to send over a single connection before it is reset. Use `0` to disable this limit. Default: `null`. */
|
|
56
56
|
maxRequestsPerClient?: number;
|
|
57
|
-
/**
|
|
57
|
+
/** Local IP address the socket should connect from. */
|
|
58
58
|
localAddress?: string;
|
|
59
59
|
/** Max response body size in bytes, -1 is disabled */
|
|
60
60
|
maxResponseSize?: number;
|
|
@@ -5,8 +5,7 @@ export declare class RedirectHandler implements Dispatcher.DispatchHandler {
|
|
|
5
5
|
dispatch: Dispatcher.Dispatch,
|
|
6
6
|
maxRedirections: number,
|
|
7
7
|
opts: Dispatcher.DispatchOptions,
|
|
8
|
-
handler: Dispatcher.DispatchHandler
|
|
9
|
-
redirectionLimitReached: boolean
|
|
8
|
+
handler: Dispatcher.DispatchHandler
|
|
10
9
|
)
|
|
11
10
|
}
|
|
12
11
|
|
|
@@ -5,6 +5,11 @@ import { Autocomplete } from './utility'
|
|
|
5
5
|
*/
|
|
6
6
|
export type IncomingHttpHeaders = Record<string, string | string[] | undefined>
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* The header type declaration of `undici` for outgoing requests.
|
|
10
|
+
*/
|
|
11
|
+
export type OutgoingHttpHeaders = Record<string, number | string | string[] | undefined>
|
|
12
|
+
|
|
8
13
|
type HeaderNames = Autocomplete<
|
|
9
14
|
| 'Accept'
|
|
10
15
|
| 'Accept-CH'
|
|
@@ -11,6 +11,7 @@ import H2CClient from './h2c-client'
|
|
|
11
11
|
import buildConnector from './connector'
|
|
12
12
|
import errors from './errors'
|
|
13
13
|
import Agent from './agent'
|
|
14
|
+
import Dispatcher1Wrapper from './dispatcher1-wrapper'
|
|
14
15
|
import MockClient from './mock-client'
|
|
15
16
|
import MockPool from './mock-pool'
|
|
16
17
|
import MockAgent from './mock-agent'
|
|
@@ -44,7 +45,7 @@ export { Interceptable } from './mock-interceptor'
|
|
|
44
45
|
|
|
45
46
|
declare function globalThisInstall (): void
|
|
46
47
|
|
|
47
|
-
export { Dispatcher, BalancedPool, RoundRobinPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, cacheStores, MockClient, MockPool, MockAgent, SnapshotAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, Socks5ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient, globalThisInstall as install }
|
|
48
|
+
export { Dispatcher, BalancedPool, RoundRobinPool, Pool, Client, buildConnector, errors, Agent, Dispatcher1Wrapper, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, cacheStores, MockClient, MockPool, MockAgent, SnapshotAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, Socks5ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient, globalThisInstall as install }
|
|
48
49
|
export default Undici
|
|
49
50
|
|
|
50
51
|
declare namespace Undici {
|
|
@@ -60,6 +61,7 @@ declare namespace Undici {
|
|
|
60
61
|
const buildConnector: typeof import('./connector').default
|
|
61
62
|
const errors: typeof import('./errors').default
|
|
62
63
|
const Agent: typeof import('./agent').default
|
|
64
|
+
const Dispatcher1Wrapper: typeof import('./dispatcher1-wrapper').default
|
|
63
65
|
const setGlobalDispatcher: typeof import('./global-dispatcher').setGlobalDispatcher
|
|
64
66
|
const getGlobalDispatcher: typeof import('./global-dispatcher').getGlobalDispatcher
|
|
65
67
|
const request: typeof import('./api').request
|
|
@@ -8,7 +8,7 @@ export default Interceptors
|
|
|
8
8
|
declare namespace Interceptors {
|
|
9
9
|
export type DumpInterceptorOpts = { maxSize?: number }
|
|
10
10
|
export type RetryInterceptorOpts = RetryHandler.RetryOptions
|
|
11
|
-
export type RedirectInterceptorOpts = { maxRedirections?: number }
|
|
11
|
+
export type RedirectInterceptorOpts = { maxRedirections?: number, throwOnMaxRedirect?: boolean }
|
|
12
12
|
export type DecompressInterceptorOpts = {
|
|
13
13
|
skipErrorResponses?: boolean
|
|
14
14
|
skipStatusCodes?: number[]
|
|
@@ -35,7 +35,5 @@ declare namespace Pool {
|
|
|
35
35
|
connections?: number | null;
|
|
36
36
|
/** The amount of time before a client is removed from the pool and closed. `null` if no time limit. Default `null` */
|
|
37
37
|
clientTtl?: number | null;
|
|
38
|
-
|
|
39
|
-
interceptors?: { Pool?: readonly Dispatcher.DispatchInterceptor[] } & Client.Options['interceptors']
|
|
40
38
|
}
|
|
41
39
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Agent from './agent'
|
|
2
2
|
import buildConnector from './connector'
|
|
3
3
|
import Dispatcher from './dispatcher'
|
|
4
|
-
import {
|
|
4
|
+
import { OutgoingHttpHeaders } from './header'
|
|
5
5
|
|
|
6
6
|
export default ProxyAgent
|
|
7
7
|
|
|
@@ -20,7 +20,7 @@ declare namespace ProxyAgent {
|
|
|
20
20
|
*/
|
|
21
21
|
auth?: string;
|
|
22
22
|
token?: string;
|
|
23
|
-
headers?:
|
|
23
|
+
headers?: OutgoingHttpHeaders;
|
|
24
24
|
requestTls?: buildConnector.BuildOptions;
|
|
25
25
|
proxyTls?: buildConnector.BuildOptions;
|
|
26
26
|
clientFactory?(origin: URL, opts: object): Dispatcher;
|
|
@@ -35,7 +35,5 @@ declare namespace RoundRobinPool {
|
|
|
35
35
|
connections?: number | null;
|
|
36
36
|
/** The amount of time before a client is removed from the pool and closed. `null` if no time limit. Default `null` */
|
|
37
37
|
clientTtl?: number | null;
|
|
38
|
-
|
|
39
|
-
interceptors?: { RoundRobinPool?: readonly Dispatcher.DispatchInterceptor[] } & Client.Options['interceptors']
|
|
40
38
|
}
|
|
41
39
|
}
|
|
@@ -30,7 +30,9 @@ declare namespace SnapshotRecorder {
|
|
|
30
30
|
ignoreHeaders?: string[]
|
|
31
31
|
excludeHeaders?: string[]
|
|
32
32
|
matchBody?: boolean
|
|
33
|
+
normalizeBody?: (body: string | Buffer | null | undefined) => string
|
|
33
34
|
matchQuery?: boolean
|
|
35
|
+
normalizeQuery?: (query: URLSearchParams) => string
|
|
34
36
|
caseSensitive?: boolean
|
|
35
37
|
shouldRecord?: (requestOpts: any) => boolean
|
|
36
38
|
shouldPlayback?: (requestOpts: any) => boolean
|
|
@@ -98,7 +100,9 @@ declare namespace SnapshotAgent {
|
|
|
98
100
|
ignoreHeaders?: string[]
|
|
99
101
|
excludeHeaders?: string[]
|
|
100
102
|
matchBody?: boolean
|
|
103
|
+
normalizeBody?: (body: string | Buffer | null | undefined) => string
|
|
101
104
|
matchQuery?: boolean
|
|
105
|
+
normalizeQuery?: (query: URLSearchParams) => string
|
|
102
106
|
caseSensitive?: boolean
|
|
103
107
|
shouldRecord?: (requestOpts: any) => boolean
|
|
104
108
|
shouldPlayback?: (requestOpts: any) => boolean
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Dispatcher from './dispatcher'
|
|
2
2
|
import buildConnector from './connector'
|
|
3
|
-
import {
|
|
3
|
+
import { OutgoingHttpHeaders } from './header'
|
|
4
4
|
import Pool from './pool'
|
|
5
5
|
|
|
6
6
|
export default Socks5ProxyAgent
|
|
@@ -12,7 +12,7 @@ declare class Socks5ProxyAgent extends Dispatcher {
|
|
|
12
12
|
declare namespace Socks5ProxyAgent {
|
|
13
13
|
export interface Options extends Pool.Options {
|
|
14
14
|
/** Additional headers to send with the proxy connection */
|
|
15
|
-
headers?:
|
|
15
|
+
headers?: OutgoingHttpHeaders;
|
|
16
16
|
/** SOCKS5 proxy username for authentication */
|
|
17
17
|
username?: string;
|
|
18
18
|
/** SOCKS5 proxy password for authentication */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suveren/gateway",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Suveren gateway — local agent gateway built in compliance with the Human Agency Protocol (HAP). Runs the UI, control plane, and MCP server in one Node process.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "server.js",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"node": ">=20"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
+
"@hap/core": "npm:@humanagencyp/hap-core@^0.6.0",
|
|
26
27
|
"@hpke/core": "^1.9.0",
|
|
27
28
|
"express": "^4.18.0",
|
|
28
29
|
"http-proxy-middleware": "^3.0.0",
|
|
29
|
-
"@hap/core": "npm:@humanagencyp/hap-core@^0.5.0",
|
|
30
30
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
31
31
|
"zod": "^3.22.0"
|
|
32
32
|
},
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"authorization"
|
|
47
47
|
],
|
|
48
48
|
"bundledDependencies": [
|
|
49
|
+
"@hap/core",
|
|
49
50
|
"@hpke/core",
|
|
50
51
|
"express",
|
|
51
52
|
"http-proxy-middleware",
|
|
52
|
-
"@hap/core",
|
|
53
53
|
"@modelcontextprotocol/sdk",
|
|
54
54
|
"zod"
|
|
55
55
|
]
|