@npy/fetch 0.1.1 → 0.1.2
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/_internal/decode-stream-error.cjs +18 -0
- package/_internal/decode-stream-error.d.cts +11 -0
- package/_internal/decode-stream-error.d.ts +11 -0
- package/_internal/decode-stream-error.js +18 -0
- package/_internal/error-mapping.cjs +44 -0
- package/_internal/error-mapping.d.cts +15 -0
- package/_internal/error-mapping.d.ts +15 -0
- package/_internal/error-mapping.js +41 -0
- package/_internal/guards.cjs +5 -6
- package/{src/_internal → _internal}/guards.d.cts +2 -0
- package/{src/_internal → _internal}/guards.d.ts +2 -0
- package/_internal/guards.js +5 -7
- package/{src/_internal → _internal}/net.d.cts +1 -2
- package/{src/_internal → _internal}/net.d.ts +1 -2
- package/_internal/symbols.cjs +4 -0
- package/_internal/symbols.d.cts +1 -0
- package/_internal/symbols.d.ts +1 -0
- package/_internal/symbols.js +4 -0
- package/agent-pool.cjs +23 -5
- package/agent-pool.d.cts +2 -0
- package/agent-pool.d.ts +2 -0
- package/agent-pool.js +23 -5
- package/agent.cjs +17 -14
- package/agent.js +17 -14
- package/body.cjs +10 -59
- package/body.d.cts +12 -0
- package/body.d.ts +12 -0
- package/body.js +11 -60
- package/dialers/proxy.cjs +7 -0
- package/{src/dialers → dialers}/proxy.d.cts +11 -3
- package/{src/dialers → dialers}/proxy.d.ts +11 -3
- package/dialers/proxy.js +7 -0
- package/dialers/tcp.cjs +22 -0
- package/{src/dialers → dialers}/tcp.d.cts +23 -2
- package/{src/dialers → dialers}/tcp.d.ts +23 -2
- package/dialers/tcp.js +22 -0
- package/encoding.cjs +32 -13
- package/encoding.d.cts +35 -0
- package/encoding.d.ts +35 -0
- package/encoding.js +32 -13
- package/fetch.cjs +279 -43
- package/fetch.d.cts +58 -0
- package/fetch.d.ts +58 -0
- package/fetch.js +278 -43
- package/http-client.cjs +47 -5
- package/http-client.d.cts +39 -0
- package/http-client.d.ts +39 -0
- package/http-client.js +47 -5
- package/index.cjs +7 -3
- package/index.d.cts +14 -1
- package/index.d.ts +14 -1
- package/index.js +6 -4
- package/io/io.cjs +68 -4
- package/{src/io → io}/io.d.cts +1 -1
- package/{src/io → io}/io.d.ts +1 -1
- package/io/io.js +68 -4
- package/io/readers.cjs +14 -54
- package/io/readers.d.cts +69 -0
- package/io/readers.d.ts +69 -0
- package/io/readers.js +14 -54
- package/io/writers.cjs +10 -5
- package/{src/io → io}/writers.d.cts +1 -1
- package/{src/io → io}/writers.d.ts +1 -1
- package/io/writers.js +11 -6
- package/package.json +18 -2
- package/types/agent.d.cts +72 -0
- package/types/agent.d.ts +72 -0
- package/{src/types → types}/dialer.d.cts +3 -0
- package/{src/types → types}/dialer.d.ts +3 -0
- package/_internal/error-adapters.cjs +0 -146
- package/_internal/error-adapters.js +0 -142
- package/src/_internal/error-adapters.d.cts +0 -22
- package/src/_internal/error-adapters.d.ts +0 -22
- package/src/agent-pool.d.cts +0 -2
- package/src/agent-pool.d.ts +0 -2
- package/src/body.d.cts +0 -23
- package/src/body.d.ts +0 -23
- package/src/encoding.d.cts +0 -24
- package/src/encoding.d.ts +0 -24
- package/src/fetch.d.cts +0 -36
- package/src/fetch.d.ts +0 -36
- package/src/http-client.d.cts +0 -23
- package/src/http-client.d.ts +0 -23
- package/src/index.d.cts +0 -7
- package/src/index.d.ts +0 -7
- package/src/io/readers.d.cts +0 -199
- package/src/io/readers.d.ts +0 -199
- package/src/types/agent.d.cts +0 -128
- package/src/types/agent.d.ts +0 -128
- package/tests/test-utils.d.cts +0 -8
- package/tests/test-utils.d.ts +0 -8
- /package/{src/_internal → _internal}/consts.d.cts +0 -0
- /package/{src/_internal → _internal}/consts.d.ts +0 -0
- /package/{src/_internal → _internal}/promises.d.cts +0 -0
- /package/{src/_internal → _internal}/promises.d.ts +0 -0
- /package/{src/_internal → _internal}/streams.d.cts +0 -0
- /package/{src/_internal → _internal}/streams.d.ts +0 -0
- /package/{src/agent.d.cts → agent.d.cts} +0 -0
- /package/{src/agent.d.ts → agent.d.ts} +0 -0
- /package/{src/dialers → dialers}/index.d.cts +0 -0
- /package/{src/dialers → dialers}/index.d.ts +0 -0
- /package/{src/errors.d.cts → errors.d.cts} +0 -0
- /package/{src/errors.d.ts → errors.d.ts} +0 -0
- /package/{src/io → io}/_utils.d.cts +0 -0
- /package/{src/io → io}/_utils.d.ts +0 -0
- /package/{src/io → io}/buf-writer.d.cts +0 -0
- /package/{src/io → io}/buf-writer.d.ts +0 -0
- /package/{src/types → types}/index.d.cts +0 -0
- /package/{src/types → types}/index.d.ts +0 -0
package/src/types/agent.d.cts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { BodyInit } from '../body';
|
|
2
|
-
import { LineReader, Readers } from '../io/readers';
|
|
3
|
-
import { Writers } from '../io/writers';
|
|
4
|
-
import { Dialer } from './dialer';
|
|
5
|
-
export interface Agent {
|
|
6
|
-
[Symbol.dispose](): void;
|
|
7
|
-
close(): void;
|
|
8
|
-
readonly hostname: string;
|
|
9
|
-
readonly port: number;
|
|
10
|
-
send(options: Agent.SendOptions): Promise<Response>;
|
|
11
|
-
whenIdle(): Promise<void>;
|
|
12
|
-
readonly isIdle: boolean;
|
|
13
|
-
readonly lastUsed: number;
|
|
14
|
-
}
|
|
15
|
-
export declare namespace Agent {
|
|
16
|
-
interface ConnectOptions {
|
|
17
|
-
/** Connection timeout (ms) used only while establishing the socket. */
|
|
18
|
-
timeout?: number;
|
|
19
|
-
/**
|
|
20
|
-
* Configure SO_KEEPALIVE on the underlying connection.
|
|
21
|
-
*
|
|
22
|
-
* - `true` / `false`: explicitly set the flag
|
|
23
|
-
* - `null`: do not touch the runtime default
|
|
24
|
-
*/
|
|
25
|
-
keepAlive?: boolean | null;
|
|
26
|
-
/**
|
|
27
|
-
* Configure TCP_NODELAY on the underlying connection.
|
|
28
|
-
*
|
|
29
|
-
* This is a connection-level option only; it is not related to HTTP body
|
|
30
|
-
* buffering or writer coalescing.
|
|
31
|
-
*/
|
|
32
|
-
noDelay?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Reader options currently supported by the low-level HTTP response parser.
|
|
36
|
-
*
|
|
37
|
-
* These options are applied per-agent / per-pool, not per-request.
|
|
38
|
-
*/
|
|
39
|
-
type ReaderOptions = Readers.Options & LineReader.ReadHeadersOptions;
|
|
40
|
-
/**
|
|
41
|
-
* Writer options currently supported by the low-level HTTP request writer.
|
|
42
|
-
*
|
|
43
|
-
* These options are applied per-agent / per-pool, not per-request.
|
|
44
|
-
*/
|
|
45
|
-
type WriterOptions = Writers.Options;
|
|
46
|
-
/**
|
|
47
|
-
* High-level HTTP I/O configuration forwarded to the low-level Readers/Writers.
|
|
48
|
-
*/
|
|
49
|
-
interface IOOptions {
|
|
50
|
-
reader?: ReaderOptions;
|
|
51
|
-
writer?: WriterOptions;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Complete agent-level configuration.
|
|
55
|
-
*
|
|
56
|
-
* `connect` controls socket establishment behavior.
|
|
57
|
-
* `io` controls HTTP reader/writer behavior.
|
|
58
|
-
*/
|
|
59
|
-
interface Options {
|
|
60
|
-
connect?: ConnectOptions;
|
|
61
|
-
io?: IOOptions;
|
|
62
|
-
}
|
|
63
|
-
interface SendOptions {
|
|
64
|
-
/**
|
|
65
|
-
* Absolute request URL.
|
|
66
|
-
*
|
|
67
|
-
* Relative URLs are not supported at this layer.
|
|
68
|
-
*/
|
|
69
|
-
url: string | URL;
|
|
70
|
-
/**
|
|
71
|
-
* HTTP method.
|
|
72
|
-
*
|
|
73
|
-
* The implementation may normalize casing before serialization.
|
|
74
|
-
*/
|
|
75
|
-
method: string;
|
|
76
|
-
/**
|
|
77
|
-
* Pre-normalized headers for the low-level send path.
|
|
78
|
-
*
|
|
79
|
-
* Use `normalizeHeaders(...)` from the fetch layer when starting from a
|
|
80
|
-
* generic `HeadersInit`.
|
|
81
|
-
*/
|
|
82
|
-
headers?: Headers;
|
|
83
|
-
body?: BodyInit | null;
|
|
84
|
-
signal?: AbortSignal;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
export interface AgentPool {
|
|
88
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
89
|
-
close(): Promise<void>;
|
|
90
|
-
readonly hostname: string;
|
|
91
|
-
readonly port: number;
|
|
92
|
-
send(options: Agent.SendOptions): Promise<Response>;
|
|
93
|
-
}
|
|
94
|
-
export declare namespace AgentPool {
|
|
95
|
-
interface Options {
|
|
96
|
-
dialer?: Dialer;
|
|
97
|
-
poolMaxIdlePerHost?: number;
|
|
98
|
-
poolMaxPerHost?: number;
|
|
99
|
-
/** `false` disables idle eviction. Defaults are handled by the implementation. */
|
|
100
|
-
poolIdleTimeout?: number | false;
|
|
101
|
-
/**
|
|
102
|
-
* Publicly exposed socket/connection options.
|
|
103
|
-
*/
|
|
104
|
-
connect?: Agent.ConnectOptions;
|
|
105
|
-
/**
|
|
106
|
-
* Publicly exposed HTTP I/O options forwarded to Readers/Writers.
|
|
107
|
-
*
|
|
108
|
-
* These are client/pool/agent-level settings, not per-request options.
|
|
109
|
-
*/
|
|
110
|
-
io?: Agent.IOOptions;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/** Back-compat */
|
|
114
|
-
export interface AgentConnectOptions extends Agent.ConnectOptions {
|
|
115
|
-
}
|
|
116
|
-
/** Back-compat */
|
|
117
|
-
export interface AgentPoolOptions extends AgentPool.Options {
|
|
118
|
-
}
|
|
119
|
-
/** Back-compat */
|
|
120
|
-
export interface SendOptions extends Agent.SendOptions {
|
|
121
|
-
}
|
|
122
|
-
/** Back-compat */
|
|
123
|
-
export interface AgentIOOptions extends Agent.IOOptions {
|
|
124
|
-
}
|
|
125
|
-
/** Back-compat */
|
|
126
|
-
export type AgentReaderOptions = Agent.ReaderOptions;
|
|
127
|
-
/** Back-compat */
|
|
128
|
-
export type AgentWriterOptions = Agent.WriterOptions;
|
package/src/types/agent.d.ts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { BodyInit } from '../body';
|
|
2
|
-
import { LineReader, Readers } from '../io/readers';
|
|
3
|
-
import { Writers } from '../io/writers';
|
|
4
|
-
import { Dialer } from './dialer';
|
|
5
|
-
export interface Agent {
|
|
6
|
-
[Symbol.dispose](): void;
|
|
7
|
-
close(): void;
|
|
8
|
-
readonly hostname: string;
|
|
9
|
-
readonly port: number;
|
|
10
|
-
send(options: Agent.SendOptions): Promise<Response>;
|
|
11
|
-
whenIdle(): Promise<void>;
|
|
12
|
-
readonly isIdle: boolean;
|
|
13
|
-
readonly lastUsed: number;
|
|
14
|
-
}
|
|
15
|
-
export declare namespace Agent {
|
|
16
|
-
interface ConnectOptions {
|
|
17
|
-
/** Connection timeout (ms) used only while establishing the socket. */
|
|
18
|
-
timeout?: number;
|
|
19
|
-
/**
|
|
20
|
-
* Configure SO_KEEPALIVE on the underlying connection.
|
|
21
|
-
*
|
|
22
|
-
* - `true` / `false`: explicitly set the flag
|
|
23
|
-
* - `null`: do not touch the runtime default
|
|
24
|
-
*/
|
|
25
|
-
keepAlive?: boolean | null;
|
|
26
|
-
/**
|
|
27
|
-
* Configure TCP_NODELAY on the underlying connection.
|
|
28
|
-
*
|
|
29
|
-
* This is a connection-level option only; it is not related to HTTP body
|
|
30
|
-
* buffering or writer coalescing.
|
|
31
|
-
*/
|
|
32
|
-
noDelay?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Reader options currently supported by the low-level HTTP response parser.
|
|
36
|
-
*
|
|
37
|
-
* These options are applied per-agent / per-pool, not per-request.
|
|
38
|
-
*/
|
|
39
|
-
type ReaderOptions = Readers.Options & LineReader.ReadHeadersOptions;
|
|
40
|
-
/**
|
|
41
|
-
* Writer options currently supported by the low-level HTTP request writer.
|
|
42
|
-
*
|
|
43
|
-
* These options are applied per-agent / per-pool, not per-request.
|
|
44
|
-
*/
|
|
45
|
-
type WriterOptions = Writers.Options;
|
|
46
|
-
/**
|
|
47
|
-
* High-level HTTP I/O configuration forwarded to the low-level Readers/Writers.
|
|
48
|
-
*/
|
|
49
|
-
interface IOOptions {
|
|
50
|
-
reader?: ReaderOptions;
|
|
51
|
-
writer?: WriterOptions;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Complete agent-level configuration.
|
|
55
|
-
*
|
|
56
|
-
* `connect` controls socket establishment behavior.
|
|
57
|
-
* `io` controls HTTP reader/writer behavior.
|
|
58
|
-
*/
|
|
59
|
-
interface Options {
|
|
60
|
-
connect?: ConnectOptions;
|
|
61
|
-
io?: IOOptions;
|
|
62
|
-
}
|
|
63
|
-
interface SendOptions {
|
|
64
|
-
/**
|
|
65
|
-
* Absolute request URL.
|
|
66
|
-
*
|
|
67
|
-
* Relative URLs are not supported at this layer.
|
|
68
|
-
*/
|
|
69
|
-
url: string | URL;
|
|
70
|
-
/**
|
|
71
|
-
* HTTP method.
|
|
72
|
-
*
|
|
73
|
-
* The implementation may normalize casing before serialization.
|
|
74
|
-
*/
|
|
75
|
-
method: string;
|
|
76
|
-
/**
|
|
77
|
-
* Pre-normalized headers for the low-level send path.
|
|
78
|
-
*
|
|
79
|
-
* Use `normalizeHeaders(...)` from the fetch layer when starting from a
|
|
80
|
-
* generic `HeadersInit`.
|
|
81
|
-
*/
|
|
82
|
-
headers?: Headers;
|
|
83
|
-
body?: BodyInit | null;
|
|
84
|
-
signal?: AbortSignal;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
export interface AgentPool {
|
|
88
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
89
|
-
close(): Promise<void>;
|
|
90
|
-
readonly hostname: string;
|
|
91
|
-
readonly port: number;
|
|
92
|
-
send(options: Agent.SendOptions): Promise<Response>;
|
|
93
|
-
}
|
|
94
|
-
export declare namespace AgentPool {
|
|
95
|
-
interface Options {
|
|
96
|
-
dialer?: Dialer;
|
|
97
|
-
poolMaxIdlePerHost?: number;
|
|
98
|
-
poolMaxPerHost?: number;
|
|
99
|
-
/** `false` disables idle eviction. Defaults are handled by the implementation. */
|
|
100
|
-
poolIdleTimeout?: number | false;
|
|
101
|
-
/**
|
|
102
|
-
* Publicly exposed socket/connection options.
|
|
103
|
-
*/
|
|
104
|
-
connect?: Agent.ConnectOptions;
|
|
105
|
-
/**
|
|
106
|
-
* Publicly exposed HTTP I/O options forwarded to Readers/Writers.
|
|
107
|
-
*
|
|
108
|
-
* These are client/pool/agent-level settings, not per-request options.
|
|
109
|
-
*/
|
|
110
|
-
io?: Agent.IOOptions;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/** Back-compat */
|
|
114
|
-
export interface AgentConnectOptions extends Agent.ConnectOptions {
|
|
115
|
-
}
|
|
116
|
-
/** Back-compat */
|
|
117
|
-
export interface AgentPoolOptions extends AgentPool.Options {
|
|
118
|
-
}
|
|
119
|
-
/** Back-compat */
|
|
120
|
-
export interface SendOptions extends Agent.SendOptions {
|
|
121
|
-
}
|
|
122
|
-
/** Back-compat */
|
|
123
|
-
export interface AgentIOOptions extends Agent.IOOptions {
|
|
124
|
-
}
|
|
125
|
-
/** Back-compat */
|
|
126
|
-
export type AgentReaderOptions = Agent.ReaderOptions;
|
|
127
|
-
/** Back-compat */
|
|
128
|
-
export type AgentWriterOptions = Agent.WriterOptions;
|
package/tests/test-utils.d.cts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export interface TestServer {
|
|
2
|
-
server: ReturnType<typeof Bun.serve>;
|
|
3
|
-
baseUrl: string;
|
|
4
|
-
stop(): Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
export declare function sleep(ms: number): Promise<void>;
|
|
7
|
-
export declare function headersToObject(headers: Headers): Record<string, string>;
|
|
8
|
-
export declare function createTestServer(): TestServer;
|
package/tests/test-utils.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export interface TestServer {
|
|
2
|
-
server: ReturnType<typeof Bun.serve>;
|
|
3
|
-
baseUrl: string;
|
|
4
|
-
stop(): Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
export declare function sleep(ms: number): Promise<void>;
|
|
7
|
-
export declare function headersToObject(headers: Headers): Record<string, string>;
|
|
8
|
-
export declare function createTestServer(): TestServer;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|