advanced-tls-client 1.0.2 → 3.0.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/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { EventEmitter } from 'events';
2
- import { Readable } from 'stream';
1
+ import { Readable, PassThrough } from 'stream';
3
2
  interface TLSFingerprint {
4
3
  cipherSuites: number[];
5
4
  extensions: number[];
@@ -41,6 +40,27 @@ interface HTTP2Fingerprint {
41
40
  };
42
41
  headerOrder: string[];
43
42
  }
43
+ interface FullResponse {
44
+ statusCode: number;
45
+ headers: Record<string, string | string[]>;
46
+ body: Buffer;
47
+ text: string;
48
+ json?: any;
49
+ fingerprints: {
50
+ ja3: string;
51
+ ja3Hash: string;
52
+ akamai: string;
53
+ };
54
+ timing: {
55
+ socket: number;
56
+ lookup: number;
57
+ connect: number;
58
+ secureConnect: number;
59
+ response: number;
60
+ end: number;
61
+ total: number;
62
+ };
63
+ }
44
64
  interface ChromeProfile {
45
65
  name: string;
46
66
  version: string;
@@ -67,27 +87,37 @@ interface RequestOptions {
67
87
  maxRedirects?: number;
68
88
  timeout?: number;
69
89
  stream?: boolean;
70
- }
71
- interface Response extends EventEmitter {
72
- statusCode: number;
73
- headers: Record<string, string | string[]>;
74
- body: Buffer | Readable;
75
- text?: string;
76
- json?: any;
77
- timing: {
78
- socket: number;
79
- lookup: number;
80
- connect: number;
81
- secureConnect: number;
82
- response: number;
83
- end: number;
84
- total: number;
85
- };
86
- fingerprints: {
87
- ja3: string;
88
- ja3Hash: string;
89
- akamai: string;
90
- };
90
+ open_timeout?: number;
91
+ response_timeout?: number;
92
+ read_timeout?: number;
93
+ follow_max?: number;
94
+ proxy?: string;
95
+ username?: string;
96
+ password?: string;
97
+ auth?: 'basic' | 'digest' | 'auto';
98
+ agent?: any;
99
+ json?: boolean;
100
+ multipart?: boolean;
101
+ boundary?: string;
102
+ encoding?: string;
103
+ parse_response?: boolean | 'json' | 'xml';
104
+ compressed?: boolean;
105
+ decode_response?: boolean;
106
+ parse_cookies?: boolean;
107
+ follow_set_cookies?: boolean;
108
+ follow_set_referer?: boolean;
109
+ follow_keep_method?: boolean;
110
+ follow_if_same_host?: boolean;
111
+ follow_if_same_protocol?: boolean;
112
+ follow_if_same_location?: boolean;
113
+ use_proxy_from_env_var?: boolean;
114
+ output?: string;
115
+ localAddress?: string;
116
+ lookup?: Function;
117
+ signal?: AbortSignal;
118
+ connection?: string;
119
+ content_type?: string;
120
+ uri_modifier?: Function;
91
121
  }
92
122
  declare class ProfileRegistry {
93
123
  private static getGrease;
@@ -107,8 +137,14 @@ declare class AdvancedTLSClient {
107
137
  private maxCachedSessions;
108
138
  private sessionTimeout;
109
139
  private cleanupInterval;
140
+ private defaults;
110
141
  constructor(profileName?: string);
111
- request(url: string, options?: RequestOptions): Promise<Response>;
142
+ setup(uri: string, options: RequestOptions): any;
143
+ request(uri: string, data?: any, options?: RequestOptions, callback?: Function): Promise<FullResponse | PassThrough>;
144
+ private generateJA3;
145
+ private buildMultipart;
146
+ private generateMultipart;
147
+ private flatten;
112
148
  destroy(): void;
113
149
  }
114
- export { AdvancedTLSClient, ProfileRegistry };
150
+ export { AdvancedTLSClient, ProfileRegistry, FullResponse };