wreq-js 2.1.0 → 2.2.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/dist/wreq-js.cjs +630 -58
- package/dist/wreq-js.cjs.map +1 -1
- package/dist/wreq-js.d.cts +130 -4
- package/dist/wreq-js.d.ts +130 -4
- package/dist/wreq-js.js +630 -58
- package/dist/wreq-js.js.map +1 -1
- package/package.json +5 -5
- package/rust/wreq-js.darwin-arm64.node +0 -0
- package/rust/wreq-js.darwin-x64.node +0 -0
- package/rust/wreq-js.linux-arm64-gnu.node +0 -0
- package/rust/wreq-js.linux-x64-gnu.node +0 -0
- package/rust/wreq-js.linux-x64-musl.node +0 -0
- package/rust/wreq-js.win32-x64-msvc.node +0 -0
package/dist/wreq-js.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Readable } from 'node:stream';
|
|
1
2
|
import { ReadableStream } from 'node:stream/web';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -53,6 +54,94 @@ type HeaderTuple = [string, string];
|
|
|
53
54
|
* ```
|
|
54
55
|
*/
|
|
55
56
|
type HeadersInit = Iterable<HeaderTuple> | Array<HeaderTuple> | Record<string, string | number | boolean | null | undefined>;
|
|
57
|
+
type AlpnProtocol = "HTTP1" | "HTTP2" | "HTTP3";
|
|
58
|
+
type AlpsProtocol = "HTTP1" | "HTTP2" | "HTTP3";
|
|
59
|
+
type TlsVersion = "1.0" | "1.1" | "1.2" | "1.3" | "TLS1.0" | "TLS1.1" | "TLS1.2" | "TLS1.3";
|
|
60
|
+
type Http2PseudoHeaderId = "Method" | "Scheme" | "Authority" | "Path" | "Protocol";
|
|
61
|
+
type Http2SettingId = "HeaderTableSize" | "EnablePush" | "MaxConcurrentStreams" | "InitialWindowSize" | "MaxFrameSize" | "MaxHeaderListSize" | "EnableConnectProtocol" | "NoRfc7540Priorities";
|
|
62
|
+
interface Http2StreamDependency {
|
|
63
|
+
dependencyId: number;
|
|
64
|
+
weight: number;
|
|
65
|
+
exclusive?: boolean;
|
|
66
|
+
}
|
|
67
|
+
interface Http2Priority {
|
|
68
|
+
streamId: number;
|
|
69
|
+
dependency: Http2StreamDependency;
|
|
70
|
+
}
|
|
71
|
+
interface Http2ExperimentalSetting {
|
|
72
|
+
id: number;
|
|
73
|
+
value: number;
|
|
74
|
+
}
|
|
75
|
+
interface CustomTlsOptions {
|
|
76
|
+
alpnProtocols?: AlpnProtocol[];
|
|
77
|
+
alpsProtocols?: AlpsProtocol[];
|
|
78
|
+
alpsUseNewCodepoint?: boolean;
|
|
79
|
+
sessionTicket?: boolean;
|
|
80
|
+
minTlsVersion?: TlsVersion;
|
|
81
|
+
maxTlsVersion?: TlsVersion;
|
|
82
|
+
preSharedKey?: boolean;
|
|
83
|
+
enableEchGrease?: boolean;
|
|
84
|
+
permuteExtensions?: boolean;
|
|
85
|
+
greaseEnabled?: boolean;
|
|
86
|
+
enableOcspStapling?: boolean;
|
|
87
|
+
enableSignedCertTimestamps?: boolean;
|
|
88
|
+
recordSizeLimit?: number;
|
|
89
|
+
pskSkipSessionTicket?: boolean;
|
|
90
|
+
keySharesLimit?: number;
|
|
91
|
+
pskDheKe?: boolean;
|
|
92
|
+
renegotiation?: boolean;
|
|
93
|
+
delegatedCredentials?: string;
|
|
94
|
+
curvesList?: string;
|
|
95
|
+
cipherList?: string;
|
|
96
|
+
sigalgsList?: string;
|
|
97
|
+
certificateCompressionAlgorithms?: Array<"zlib" | "brotli" | "zstd">;
|
|
98
|
+
extensionPermutation?: number[];
|
|
99
|
+
aesHwOverride?: boolean;
|
|
100
|
+
preserveTls13CipherList?: boolean;
|
|
101
|
+
randomAesHwOverride?: boolean;
|
|
102
|
+
}
|
|
103
|
+
interface CustomHttp1Options {
|
|
104
|
+
http09Responses?: boolean;
|
|
105
|
+
writev?: boolean;
|
|
106
|
+
maxHeaders?: number;
|
|
107
|
+
readBufExactSize?: number;
|
|
108
|
+
maxBufSize?: number;
|
|
109
|
+
ignoreInvalidHeadersInResponses?: boolean;
|
|
110
|
+
allowSpacesAfterHeaderNameInResponses?: boolean;
|
|
111
|
+
allowObsoleteMultilineHeadersInResponses?: boolean;
|
|
112
|
+
}
|
|
113
|
+
interface CustomHttp2Options {
|
|
114
|
+
adaptiveWindow?: boolean;
|
|
115
|
+
initialStreamId?: number;
|
|
116
|
+
initialConnectionWindowSize?: number;
|
|
117
|
+
initialWindowSize?: number;
|
|
118
|
+
initialMaxSendStreams?: number;
|
|
119
|
+
maxFrameSize?: number;
|
|
120
|
+
keepAliveInterval?: number;
|
|
121
|
+
keepAliveTimeout?: number;
|
|
122
|
+
keepAliveWhileIdle?: boolean;
|
|
123
|
+
maxConcurrentResetStreams?: number;
|
|
124
|
+
maxSendBufferSize?: number;
|
|
125
|
+
maxConcurrentStreams?: number;
|
|
126
|
+
maxHeaderListSize?: number;
|
|
127
|
+
maxPendingAcceptResetStreams?: number;
|
|
128
|
+
enablePush?: boolean;
|
|
129
|
+
headerTableSize?: number;
|
|
130
|
+
enableConnectProtocol?: boolean;
|
|
131
|
+
noRfc7540Priorities?: boolean;
|
|
132
|
+
settingsOrder?: Http2SettingId[];
|
|
133
|
+
headersPseudoOrder?: Http2PseudoHeaderId[];
|
|
134
|
+
headersStreamDependency?: Http2StreamDependency;
|
|
135
|
+
priorities?: Http2Priority[];
|
|
136
|
+
experimentalSettings?: Http2ExperimentalSetting[];
|
|
137
|
+
}
|
|
138
|
+
interface CustomEmulationOptions {
|
|
139
|
+
tlsOptions?: CustomTlsOptions;
|
|
140
|
+
http1Options?: CustomHttp1Options;
|
|
141
|
+
http2Options?: CustomHttp2Options;
|
|
142
|
+
headers?: HeadersInit;
|
|
143
|
+
origHeaders?: string[];
|
|
144
|
+
}
|
|
56
145
|
/**
|
|
57
146
|
* Represents the various types of data that can be used as a request body.
|
|
58
147
|
* Supports strings, binary payloads, URL-encoded parameters, multipart forms, and blobs.
|
|
@@ -176,6 +265,12 @@ interface RequestInit {
|
|
|
176
265
|
* @default 'macos'
|
|
177
266
|
*/
|
|
178
267
|
os?: EmulationOS;
|
|
268
|
+
/**
|
|
269
|
+
* Custom emulation overrides. When `browser` or `os` is present, these fields
|
|
270
|
+
* layer on top of the resolved preset profile. When both are omitted, this
|
|
271
|
+
* switches the request into standalone custom emulation mode.
|
|
272
|
+
*/
|
|
273
|
+
emulation?: CustomEmulationOptions;
|
|
179
274
|
/**
|
|
180
275
|
* Proxy URL to route the request through (e.g., 'http://proxy.example.com:8080').
|
|
181
276
|
* Proxy support depends on the native layer and proxy scheme.
|
|
@@ -254,6 +349,10 @@ interface CreateSessionOptions {
|
|
|
254
349
|
* Operating system to bind to this session. Defaults to 'macos'.
|
|
255
350
|
*/
|
|
256
351
|
os?: EmulationOS;
|
|
352
|
+
/**
|
|
353
|
+
* Custom emulation overrides or a standalone custom emulation for the session transport.
|
|
354
|
+
*/
|
|
355
|
+
emulation?: CustomEmulationOptions;
|
|
257
356
|
/**
|
|
258
357
|
* Optional proxy for every request made through the session.
|
|
259
358
|
*/
|
|
@@ -294,6 +393,10 @@ interface CreateTransportOptions {
|
|
|
294
393
|
* Operating system to emulate for this transport.
|
|
295
394
|
*/
|
|
296
395
|
os?: EmulationOS;
|
|
396
|
+
/**
|
|
397
|
+
* Custom emulation overrides or a standalone custom emulation for this transport.
|
|
398
|
+
*/
|
|
399
|
+
emulation?: CustomEmulationOptions;
|
|
297
400
|
/**
|
|
298
401
|
* Disable HTTPS certificate verification for this transport.
|
|
299
402
|
*/
|
|
@@ -356,6 +459,12 @@ interface RequestOptions {
|
|
|
356
459
|
* @default 'macos'
|
|
357
460
|
*/
|
|
358
461
|
os?: EmulationOS;
|
|
462
|
+
/**
|
|
463
|
+
* Custom emulation overrides. When `browser` or `os` is present, these fields
|
|
464
|
+
* layer on top of the resolved preset profile. When both are omitted, this
|
|
465
|
+
* switches the request into standalone custom emulation mode.
|
|
466
|
+
*/
|
|
467
|
+
emulation?: CustomEmulationOptions;
|
|
359
468
|
/**
|
|
360
469
|
* HTTP method to use for the request.
|
|
361
470
|
* @default 'GET'
|
|
@@ -505,6 +614,12 @@ interface WebSocketOptions {
|
|
|
505
614
|
* @default 'macos'
|
|
506
615
|
*/
|
|
507
616
|
os?: EmulationOS;
|
|
617
|
+
/**
|
|
618
|
+
* Custom emulation overrides. When `browser` or `os` is present, these fields
|
|
619
|
+
* layer on top of the resolved preset profile. When both are omitted, this
|
|
620
|
+
* switches the handshake into standalone custom emulation mode.
|
|
621
|
+
*/
|
|
622
|
+
emulation?: CustomEmulationOptions;
|
|
508
623
|
/**
|
|
509
624
|
* Additional headers to send with the WebSocket upgrade request.
|
|
510
625
|
* Common headers include Authorization, Origin, or custom application headers.
|
|
@@ -547,7 +662,7 @@ interface LegacyWebSocketOptions extends WebSocketOptions {
|
|
|
547
662
|
*/
|
|
548
663
|
onError?: (error: string) => void;
|
|
549
664
|
}
|
|
550
|
-
type SessionWebSocketOptions = Omit<WebSocketOptions, "browser" | "os" | "proxy">;
|
|
665
|
+
type SessionWebSocketOptions = Omit<WebSocketOptions, "browser" | "os" | "proxy" | "emulation">;
|
|
551
666
|
interface LegacySessionWebSocketOptions extends SessionWebSocketOptions {
|
|
552
667
|
/**
|
|
553
668
|
* @deprecated Use `session.websocket(url, options)`.
|
|
@@ -615,8 +730,7 @@ interface NativeWebSocketCloseEvent {
|
|
|
615
730
|
reason: string;
|
|
616
731
|
}
|
|
617
732
|
type SessionDefaults = {
|
|
618
|
-
|
|
619
|
-
os: EmulationOS;
|
|
733
|
+
transportMode: ResolvedEmulationMode;
|
|
620
734
|
proxy?: string;
|
|
621
735
|
timeout?: number;
|
|
622
736
|
insecure?: boolean;
|
|
@@ -624,6 +738,17 @@ type SessionDefaults = {
|
|
|
624
738
|
transportId?: string;
|
|
625
739
|
ownsTransport?: boolean;
|
|
626
740
|
};
|
|
741
|
+
type PresetEmulationMode = {
|
|
742
|
+
kind: "preset";
|
|
743
|
+
browser: BrowserProfile;
|
|
744
|
+
os: EmulationOS;
|
|
745
|
+
emulationJson?: string;
|
|
746
|
+
};
|
|
747
|
+
type CustomEmulationMode = {
|
|
748
|
+
kind: "custom";
|
|
749
|
+
emulationJson: string;
|
|
750
|
+
};
|
|
751
|
+
type ResolvedEmulationMode = PresetEmulationMode | CustomEmulationMode;
|
|
627
752
|
type LegacyWebSocketCallbacks = {
|
|
628
753
|
onMessage?: (data: string | Buffer) => void;
|
|
629
754
|
onClose?: (event: WebSocketCloseEvent) => void;
|
|
@@ -692,6 +817,7 @@ declare class Response {
|
|
|
692
817
|
text(): Promise<string>;
|
|
693
818
|
blob(): Promise<Blob>;
|
|
694
819
|
formData(): Promise<FormData>;
|
|
820
|
+
readable(): Readable;
|
|
695
821
|
clone(): Response;
|
|
696
822
|
private assertBodyAvailable;
|
|
697
823
|
private consumeBody;
|
|
@@ -912,4 +1038,4 @@ declare const _default: {
|
|
|
912
1038
|
RequestError: typeof RequestError;
|
|
913
1039
|
};
|
|
914
1040
|
|
|
915
|
-
export { type BodyInit, type BrowserProfile, type CookieMode, type CreateSessionOptions, type CreateTransportOptions, type EmulationOS, Headers, type HeadersInit, RequestError, type RequestInit, type RequestOptions, Response, Session, type SessionHandle, type SessionWebSocketOptions, Transport, WebSocket, type WebSocketBinaryType, type WebSocketCloseEvent, type WebSocketErrorEvent, type WebSocketEventType, type WebSocketMessageEvent, type WebSocketOpenEvent, type WebSocketOptions, createSession, createTransport, _default as default, fetch, get, getOperatingSystems, getProfiles, post, request, websocket, withSession };
|
|
1041
|
+
export { type AlpnProtocol, type AlpsProtocol, type BodyInit, type BrowserProfile, type CookieMode, type CreateSessionOptions, type CreateTransportOptions, type CustomEmulationOptions, type CustomHttp1Options, type CustomHttp2Options, type CustomTlsOptions, type EmulationOS, Headers, type HeadersInit, type Http2ExperimentalSetting, type Http2Priority, type Http2PseudoHeaderId, type Http2SettingId, type Http2StreamDependency, RequestError, type RequestInit, type RequestOptions, Response, Session, type SessionHandle, type SessionWebSocketOptions, type TlsVersion, Transport, WebSocket, type WebSocketBinaryType, type WebSocketCloseEvent, type WebSocketErrorEvent, type WebSocketEventType, type WebSocketMessageEvent, type WebSocketOpenEvent, type WebSocketOptions, createSession, createTransport, _default as default, fetch, get, getOperatingSystems, getProfiles, post, request, websocket, withSession };
|
package/dist/wreq-js.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Readable } from 'node:stream';
|
|
1
2
|
import { ReadableStream } from 'node:stream/web';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -53,6 +54,94 @@ type HeaderTuple = [string, string];
|
|
|
53
54
|
* ```
|
|
54
55
|
*/
|
|
55
56
|
type HeadersInit = Iterable<HeaderTuple> | Array<HeaderTuple> | Record<string, string | number | boolean | null | undefined>;
|
|
57
|
+
type AlpnProtocol = "HTTP1" | "HTTP2" | "HTTP3";
|
|
58
|
+
type AlpsProtocol = "HTTP1" | "HTTP2" | "HTTP3";
|
|
59
|
+
type TlsVersion = "1.0" | "1.1" | "1.2" | "1.3" | "TLS1.0" | "TLS1.1" | "TLS1.2" | "TLS1.3";
|
|
60
|
+
type Http2PseudoHeaderId = "Method" | "Scheme" | "Authority" | "Path" | "Protocol";
|
|
61
|
+
type Http2SettingId = "HeaderTableSize" | "EnablePush" | "MaxConcurrentStreams" | "InitialWindowSize" | "MaxFrameSize" | "MaxHeaderListSize" | "EnableConnectProtocol" | "NoRfc7540Priorities";
|
|
62
|
+
interface Http2StreamDependency {
|
|
63
|
+
dependencyId: number;
|
|
64
|
+
weight: number;
|
|
65
|
+
exclusive?: boolean;
|
|
66
|
+
}
|
|
67
|
+
interface Http2Priority {
|
|
68
|
+
streamId: number;
|
|
69
|
+
dependency: Http2StreamDependency;
|
|
70
|
+
}
|
|
71
|
+
interface Http2ExperimentalSetting {
|
|
72
|
+
id: number;
|
|
73
|
+
value: number;
|
|
74
|
+
}
|
|
75
|
+
interface CustomTlsOptions {
|
|
76
|
+
alpnProtocols?: AlpnProtocol[];
|
|
77
|
+
alpsProtocols?: AlpsProtocol[];
|
|
78
|
+
alpsUseNewCodepoint?: boolean;
|
|
79
|
+
sessionTicket?: boolean;
|
|
80
|
+
minTlsVersion?: TlsVersion;
|
|
81
|
+
maxTlsVersion?: TlsVersion;
|
|
82
|
+
preSharedKey?: boolean;
|
|
83
|
+
enableEchGrease?: boolean;
|
|
84
|
+
permuteExtensions?: boolean;
|
|
85
|
+
greaseEnabled?: boolean;
|
|
86
|
+
enableOcspStapling?: boolean;
|
|
87
|
+
enableSignedCertTimestamps?: boolean;
|
|
88
|
+
recordSizeLimit?: number;
|
|
89
|
+
pskSkipSessionTicket?: boolean;
|
|
90
|
+
keySharesLimit?: number;
|
|
91
|
+
pskDheKe?: boolean;
|
|
92
|
+
renegotiation?: boolean;
|
|
93
|
+
delegatedCredentials?: string;
|
|
94
|
+
curvesList?: string;
|
|
95
|
+
cipherList?: string;
|
|
96
|
+
sigalgsList?: string;
|
|
97
|
+
certificateCompressionAlgorithms?: Array<"zlib" | "brotli" | "zstd">;
|
|
98
|
+
extensionPermutation?: number[];
|
|
99
|
+
aesHwOverride?: boolean;
|
|
100
|
+
preserveTls13CipherList?: boolean;
|
|
101
|
+
randomAesHwOverride?: boolean;
|
|
102
|
+
}
|
|
103
|
+
interface CustomHttp1Options {
|
|
104
|
+
http09Responses?: boolean;
|
|
105
|
+
writev?: boolean;
|
|
106
|
+
maxHeaders?: number;
|
|
107
|
+
readBufExactSize?: number;
|
|
108
|
+
maxBufSize?: number;
|
|
109
|
+
ignoreInvalidHeadersInResponses?: boolean;
|
|
110
|
+
allowSpacesAfterHeaderNameInResponses?: boolean;
|
|
111
|
+
allowObsoleteMultilineHeadersInResponses?: boolean;
|
|
112
|
+
}
|
|
113
|
+
interface CustomHttp2Options {
|
|
114
|
+
adaptiveWindow?: boolean;
|
|
115
|
+
initialStreamId?: number;
|
|
116
|
+
initialConnectionWindowSize?: number;
|
|
117
|
+
initialWindowSize?: number;
|
|
118
|
+
initialMaxSendStreams?: number;
|
|
119
|
+
maxFrameSize?: number;
|
|
120
|
+
keepAliveInterval?: number;
|
|
121
|
+
keepAliveTimeout?: number;
|
|
122
|
+
keepAliveWhileIdle?: boolean;
|
|
123
|
+
maxConcurrentResetStreams?: number;
|
|
124
|
+
maxSendBufferSize?: number;
|
|
125
|
+
maxConcurrentStreams?: number;
|
|
126
|
+
maxHeaderListSize?: number;
|
|
127
|
+
maxPendingAcceptResetStreams?: number;
|
|
128
|
+
enablePush?: boolean;
|
|
129
|
+
headerTableSize?: number;
|
|
130
|
+
enableConnectProtocol?: boolean;
|
|
131
|
+
noRfc7540Priorities?: boolean;
|
|
132
|
+
settingsOrder?: Http2SettingId[];
|
|
133
|
+
headersPseudoOrder?: Http2PseudoHeaderId[];
|
|
134
|
+
headersStreamDependency?: Http2StreamDependency;
|
|
135
|
+
priorities?: Http2Priority[];
|
|
136
|
+
experimentalSettings?: Http2ExperimentalSetting[];
|
|
137
|
+
}
|
|
138
|
+
interface CustomEmulationOptions {
|
|
139
|
+
tlsOptions?: CustomTlsOptions;
|
|
140
|
+
http1Options?: CustomHttp1Options;
|
|
141
|
+
http2Options?: CustomHttp2Options;
|
|
142
|
+
headers?: HeadersInit;
|
|
143
|
+
origHeaders?: string[];
|
|
144
|
+
}
|
|
56
145
|
/**
|
|
57
146
|
* Represents the various types of data that can be used as a request body.
|
|
58
147
|
* Supports strings, binary payloads, URL-encoded parameters, multipart forms, and blobs.
|
|
@@ -176,6 +265,12 @@ interface RequestInit {
|
|
|
176
265
|
* @default 'macos'
|
|
177
266
|
*/
|
|
178
267
|
os?: EmulationOS;
|
|
268
|
+
/**
|
|
269
|
+
* Custom emulation overrides. When `browser` or `os` is present, these fields
|
|
270
|
+
* layer on top of the resolved preset profile. When both are omitted, this
|
|
271
|
+
* switches the request into standalone custom emulation mode.
|
|
272
|
+
*/
|
|
273
|
+
emulation?: CustomEmulationOptions;
|
|
179
274
|
/**
|
|
180
275
|
* Proxy URL to route the request through (e.g., 'http://proxy.example.com:8080').
|
|
181
276
|
* Proxy support depends on the native layer and proxy scheme.
|
|
@@ -254,6 +349,10 @@ interface CreateSessionOptions {
|
|
|
254
349
|
* Operating system to bind to this session. Defaults to 'macos'.
|
|
255
350
|
*/
|
|
256
351
|
os?: EmulationOS;
|
|
352
|
+
/**
|
|
353
|
+
* Custom emulation overrides or a standalone custom emulation for the session transport.
|
|
354
|
+
*/
|
|
355
|
+
emulation?: CustomEmulationOptions;
|
|
257
356
|
/**
|
|
258
357
|
* Optional proxy for every request made through the session.
|
|
259
358
|
*/
|
|
@@ -294,6 +393,10 @@ interface CreateTransportOptions {
|
|
|
294
393
|
* Operating system to emulate for this transport.
|
|
295
394
|
*/
|
|
296
395
|
os?: EmulationOS;
|
|
396
|
+
/**
|
|
397
|
+
* Custom emulation overrides or a standalone custom emulation for this transport.
|
|
398
|
+
*/
|
|
399
|
+
emulation?: CustomEmulationOptions;
|
|
297
400
|
/**
|
|
298
401
|
* Disable HTTPS certificate verification for this transport.
|
|
299
402
|
*/
|
|
@@ -356,6 +459,12 @@ interface RequestOptions {
|
|
|
356
459
|
* @default 'macos'
|
|
357
460
|
*/
|
|
358
461
|
os?: EmulationOS;
|
|
462
|
+
/**
|
|
463
|
+
* Custom emulation overrides. When `browser` or `os` is present, these fields
|
|
464
|
+
* layer on top of the resolved preset profile. When both are omitted, this
|
|
465
|
+
* switches the request into standalone custom emulation mode.
|
|
466
|
+
*/
|
|
467
|
+
emulation?: CustomEmulationOptions;
|
|
359
468
|
/**
|
|
360
469
|
* HTTP method to use for the request.
|
|
361
470
|
* @default 'GET'
|
|
@@ -505,6 +614,12 @@ interface WebSocketOptions {
|
|
|
505
614
|
* @default 'macos'
|
|
506
615
|
*/
|
|
507
616
|
os?: EmulationOS;
|
|
617
|
+
/**
|
|
618
|
+
* Custom emulation overrides. When `browser` or `os` is present, these fields
|
|
619
|
+
* layer on top of the resolved preset profile. When both are omitted, this
|
|
620
|
+
* switches the handshake into standalone custom emulation mode.
|
|
621
|
+
*/
|
|
622
|
+
emulation?: CustomEmulationOptions;
|
|
508
623
|
/**
|
|
509
624
|
* Additional headers to send with the WebSocket upgrade request.
|
|
510
625
|
* Common headers include Authorization, Origin, or custom application headers.
|
|
@@ -547,7 +662,7 @@ interface LegacyWebSocketOptions extends WebSocketOptions {
|
|
|
547
662
|
*/
|
|
548
663
|
onError?: (error: string) => void;
|
|
549
664
|
}
|
|
550
|
-
type SessionWebSocketOptions = Omit<WebSocketOptions, "browser" | "os" | "proxy">;
|
|
665
|
+
type SessionWebSocketOptions = Omit<WebSocketOptions, "browser" | "os" | "proxy" | "emulation">;
|
|
551
666
|
interface LegacySessionWebSocketOptions extends SessionWebSocketOptions {
|
|
552
667
|
/**
|
|
553
668
|
* @deprecated Use `session.websocket(url, options)`.
|
|
@@ -615,8 +730,7 @@ interface NativeWebSocketCloseEvent {
|
|
|
615
730
|
reason: string;
|
|
616
731
|
}
|
|
617
732
|
type SessionDefaults = {
|
|
618
|
-
|
|
619
|
-
os: EmulationOS;
|
|
733
|
+
transportMode: ResolvedEmulationMode;
|
|
620
734
|
proxy?: string;
|
|
621
735
|
timeout?: number;
|
|
622
736
|
insecure?: boolean;
|
|
@@ -624,6 +738,17 @@ type SessionDefaults = {
|
|
|
624
738
|
transportId?: string;
|
|
625
739
|
ownsTransport?: boolean;
|
|
626
740
|
};
|
|
741
|
+
type PresetEmulationMode = {
|
|
742
|
+
kind: "preset";
|
|
743
|
+
browser: BrowserProfile;
|
|
744
|
+
os: EmulationOS;
|
|
745
|
+
emulationJson?: string;
|
|
746
|
+
};
|
|
747
|
+
type CustomEmulationMode = {
|
|
748
|
+
kind: "custom";
|
|
749
|
+
emulationJson: string;
|
|
750
|
+
};
|
|
751
|
+
type ResolvedEmulationMode = PresetEmulationMode | CustomEmulationMode;
|
|
627
752
|
type LegacyWebSocketCallbacks = {
|
|
628
753
|
onMessage?: (data: string | Buffer) => void;
|
|
629
754
|
onClose?: (event: WebSocketCloseEvent) => void;
|
|
@@ -692,6 +817,7 @@ declare class Response {
|
|
|
692
817
|
text(): Promise<string>;
|
|
693
818
|
blob(): Promise<Blob>;
|
|
694
819
|
formData(): Promise<FormData>;
|
|
820
|
+
readable(): Readable;
|
|
695
821
|
clone(): Response;
|
|
696
822
|
private assertBodyAvailable;
|
|
697
823
|
private consumeBody;
|
|
@@ -912,4 +1038,4 @@ declare const _default: {
|
|
|
912
1038
|
RequestError: typeof RequestError;
|
|
913
1039
|
};
|
|
914
1040
|
|
|
915
|
-
export { type BodyInit, type BrowserProfile, type CookieMode, type CreateSessionOptions, type CreateTransportOptions, type EmulationOS, Headers, type HeadersInit, RequestError, type RequestInit, type RequestOptions, Response, Session, type SessionHandle, type SessionWebSocketOptions, Transport, WebSocket, type WebSocketBinaryType, type WebSocketCloseEvent, type WebSocketErrorEvent, type WebSocketEventType, type WebSocketMessageEvent, type WebSocketOpenEvent, type WebSocketOptions, createSession, createTransport, _default as default, fetch, get, getOperatingSystems, getProfiles, post, request, websocket, withSession };
|
|
1041
|
+
export { type AlpnProtocol, type AlpsProtocol, type BodyInit, type BrowserProfile, type CookieMode, type CreateSessionOptions, type CreateTransportOptions, type CustomEmulationOptions, type CustomHttp1Options, type CustomHttp2Options, type CustomTlsOptions, type EmulationOS, Headers, type HeadersInit, type Http2ExperimentalSetting, type Http2Priority, type Http2PseudoHeaderId, type Http2SettingId, type Http2StreamDependency, RequestError, type RequestInit, type RequestOptions, Response, Session, type SessionHandle, type SessionWebSocketOptions, type TlsVersion, Transport, WebSocket, type WebSocketBinaryType, type WebSocketCloseEvent, type WebSocketErrorEvent, type WebSocketEventType, type WebSocketMessageEvent, type WebSocketOpenEvent, type WebSocketOptions, createSession, createTransport, _default as default, fetch, get, getOperatingSystems, getProfiles, post, request, websocket, withSession };
|