surfsky 0.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/LICENSE +21 -0
- package/README.md +471 -0
- package/dist/index.d.ts +1722 -0
- package/dist/index.js +2754 -0
- package/package.json +64 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1722 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/types.d.ts
|
|
3
|
+
declare const os: z.ZodEnum<{
|
|
4
|
+
android: "android";
|
|
5
|
+
mac: "mac";
|
|
6
|
+
win: "win";
|
|
7
|
+
}>;
|
|
8
|
+
declare const arch: z.ZodEnum<{
|
|
9
|
+
arm: "arm";
|
|
10
|
+
x86: "x86";
|
|
11
|
+
}>;
|
|
12
|
+
declare const deviceType: z.ZodEnum<{
|
|
13
|
+
phone: "phone";
|
|
14
|
+
tablet: "tablet";
|
|
15
|
+
}>;
|
|
16
|
+
declare const waitUntil: z.ZodEnum<{
|
|
17
|
+
commit: "commit";
|
|
18
|
+
domcontentloaded: "domcontentloaded";
|
|
19
|
+
load: "load";
|
|
20
|
+
networkidle: "networkidle";
|
|
21
|
+
}>;
|
|
22
|
+
declare const proxyType: z.ZodEnum<{
|
|
23
|
+
mobile: "mobile";
|
|
24
|
+
residential: "residential";
|
|
25
|
+
}>;
|
|
26
|
+
declare const profileOrdering: z.ZodEnum<{
|
|
27
|
+
"-active": "-active";
|
|
28
|
+
"-created": "-created";
|
|
29
|
+
"-title": "-title";
|
|
30
|
+
active: "active";
|
|
31
|
+
created: "created";
|
|
32
|
+
title: "title";
|
|
33
|
+
}>;
|
|
34
|
+
declare const regionalPool: z.ZodEnum<{
|
|
35
|
+
asia: "asia";
|
|
36
|
+
centralasia: "centralasia";
|
|
37
|
+
eastasia: "eastasia";
|
|
38
|
+
europe: "europe";
|
|
39
|
+
mena: "mena";
|
|
40
|
+
northamerica: "northamerica";
|
|
41
|
+
oceania: "oceania";
|
|
42
|
+
sea: "sea";
|
|
43
|
+
southamerica: "southamerica";
|
|
44
|
+
southasia: "southasia";
|
|
45
|
+
western: "western";
|
|
46
|
+
westeurope: "westeurope";
|
|
47
|
+
}>;
|
|
48
|
+
type OS = z.infer<typeof os>;
|
|
49
|
+
type Arch = z.infer<typeof arch>;
|
|
50
|
+
type DeviceType = z.infer<typeof deviceType>;
|
|
51
|
+
type WaitUntil = z.infer<typeof waitUntil>;
|
|
52
|
+
type ProxyType = z.infer<typeof proxyType>;
|
|
53
|
+
type ProfileOrdering = z.infer<typeof profileOrdering>;
|
|
54
|
+
type RegionalPool = z.infer<typeof regionalPool>;
|
|
55
|
+
type ExportFormat = "json" | "netscape";
|
|
56
|
+
type MouseButton = "left" | "right" | "middle";
|
|
57
|
+
type KeyModifier = "Alt" | "Control" | "Meta" | "Shift";
|
|
58
|
+
type ScrollBehavior = "smooth" | "instant";
|
|
59
|
+
/** A known value, or one the server added after this SDK was published. */
|
|
60
|
+
type Loose<T extends string> = T | (string & {});
|
|
61
|
+
declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
62
|
+
type Closed<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]; };
|
|
63
|
+
declare const noiseSchema: z.ZodObject<{
|
|
64
|
+
webgl: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
65
|
+
canvas: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
66
|
+
audio: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
67
|
+
client_rects: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
68
|
+
}, z.core.$loose>;
|
|
69
|
+
type Noise = Closed<z.infer<typeof noiseSchema>>;
|
|
70
|
+
declare const mediaDevicesSchema: z.ZodObject<{
|
|
71
|
+
video_in: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
72
|
+
audio_out: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
73
|
+
audio_in: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
74
|
+
}, z.core.$loose>;
|
|
75
|
+
type MediaDevices = Closed<z.infer<typeof mediaDevicesSchema>>;
|
|
76
|
+
declare const geolocationSchema: z.ZodObject<{
|
|
77
|
+
latitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
78
|
+
longitude: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
79
|
+
accuracy: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
80
|
+
}, z.core.$loose>;
|
|
81
|
+
type Geolocation = Closed<z.infer<typeof geolocationSchema>>;
|
|
82
|
+
declare const fingerprintSchema: z.ZodObject<{
|
|
83
|
+
os: z.ZodOptional<z.ZodNullable<z.ZodType<Loose<"android" | "mac" | "win">, string, z.core.$ZodTypeInternals<Loose<"android" | "mac" | "win">, string>>>>;
|
|
84
|
+
os_arch: z.ZodOptional<z.ZodNullable<z.ZodType<Loose<"arm" | "x86">, string, z.core.$ZodTypeInternals<Loose<"arm" | "x86">, string>>>>;
|
|
85
|
+
os_version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
86
|
+
device_model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
87
|
+
device_type: z.ZodOptional<z.ZodNullable<z.ZodType<Loose<"phone" | "tablet">, string, z.core.$ZodTypeInternals<Loose<"phone" | "tablet">, string>>>>;
|
|
88
|
+
user_agent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
89
|
+
cpu: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
90
|
+
ram: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
91
|
+
renderer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
92
|
+
noise: z.ZodOptional<z.ZodNullable<z.ZodType<Closed<{
|
|
93
|
+
[x: string]: unknown;
|
|
94
|
+
webgl?: boolean | null | undefined;
|
|
95
|
+
canvas?: boolean | null | undefined;
|
|
96
|
+
audio?: boolean | null | undefined;
|
|
97
|
+
client_rects?: boolean | null | undefined;
|
|
98
|
+
}>, Closed<{
|
|
99
|
+
[x: string]: unknown;
|
|
100
|
+
webgl?: boolean | null | undefined;
|
|
101
|
+
canvas?: boolean | null | undefined;
|
|
102
|
+
audio?: boolean | null | undefined;
|
|
103
|
+
client_rects?: boolean | null | undefined;
|
|
104
|
+
}>, z.core.$ZodTypeInternals<Closed<{
|
|
105
|
+
[x: string]: unknown;
|
|
106
|
+
webgl?: boolean | null | undefined;
|
|
107
|
+
canvas?: boolean | null | undefined;
|
|
108
|
+
audio?: boolean | null | undefined;
|
|
109
|
+
client_rects?: boolean | null | undefined;
|
|
110
|
+
}>, Closed<{
|
|
111
|
+
[x: string]: unknown;
|
|
112
|
+
webgl?: boolean | null | undefined;
|
|
113
|
+
canvas?: boolean | null | undefined;
|
|
114
|
+
audio?: boolean | null | undefined;
|
|
115
|
+
client_rects?: boolean | null | undefined;
|
|
116
|
+
}>>>>>;
|
|
117
|
+
media_devices: z.ZodOptional<z.ZodNullable<z.ZodType<Closed<{
|
|
118
|
+
[x: string]: unknown;
|
|
119
|
+
video_in?: number | null | undefined;
|
|
120
|
+
audio_out?: number | null | undefined;
|
|
121
|
+
audio_in?: number | null | undefined;
|
|
122
|
+
}>, Closed<{
|
|
123
|
+
[x: string]: unknown;
|
|
124
|
+
video_in?: number | null | undefined;
|
|
125
|
+
audio_out?: number | null | undefined;
|
|
126
|
+
audio_in?: number | null | undefined;
|
|
127
|
+
}>, z.core.$ZodTypeInternals<Closed<{
|
|
128
|
+
[x: string]: unknown;
|
|
129
|
+
video_in?: number | null | undefined;
|
|
130
|
+
audio_out?: number | null | undefined;
|
|
131
|
+
audio_in?: number | null | undefined;
|
|
132
|
+
}>, Closed<{
|
|
133
|
+
[x: string]: unknown;
|
|
134
|
+
video_in?: number | null | undefined;
|
|
135
|
+
audio_out?: number | null | undefined;
|
|
136
|
+
audio_in?: number | null | undefined;
|
|
137
|
+
}>>>>>;
|
|
138
|
+
screen: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
139
|
+
languages: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
140
|
+
timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
141
|
+
geolocation: z.ZodOptional<z.ZodNullable<z.ZodType<Closed<{
|
|
142
|
+
[x: string]: unknown;
|
|
143
|
+
latitude?: number | null | undefined;
|
|
144
|
+
longitude?: number | null | undefined;
|
|
145
|
+
accuracy?: number | null | undefined;
|
|
146
|
+
}>, Closed<{
|
|
147
|
+
[x: string]: unknown;
|
|
148
|
+
latitude?: number | null | undefined;
|
|
149
|
+
longitude?: number | null | undefined;
|
|
150
|
+
accuracy?: number | null | undefined;
|
|
151
|
+
}>, z.core.$ZodTypeInternals<Closed<{
|
|
152
|
+
[x: string]: unknown;
|
|
153
|
+
latitude?: number | null | undefined;
|
|
154
|
+
longitude?: number | null | undefined;
|
|
155
|
+
accuracy?: number | null | undefined;
|
|
156
|
+
}>, Closed<{
|
|
157
|
+
[x: string]: unknown;
|
|
158
|
+
latitude?: number | null | undefined;
|
|
159
|
+
longitude?: number | null | undefined;
|
|
160
|
+
accuracy?: number | null | undefined;
|
|
161
|
+
}>>>>>;
|
|
162
|
+
dns: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
163
|
+
}, z.core.$loose>;
|
|
164
|
+
type Fingerprint = Closed<z.infer<typeof fingerprintSchema>>;
|
|
165
|
+
declare const storageOptionsSchema: z.ZodObject<{
|
|
166
|
+
cookies: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
167
|
+
passwords: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
168
|
+
extensions: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
169
|
+
localstorage: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
170
|
+
history: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
171
|
+
bookmarks: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
172
|
+
serviceworkers: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
173
|
+
}, z.core.$loose>;
|
|
174
|
+
type StorageOptions = Closed<z.infer<typeof storageOptionsSchema>>;
|
|
175
|
+
declare const browserSettings: z.ZodObject<{
|
|
176
|
+
inactive_kill_timeout: z.ZodOptional<z.ZodNumber>;
|
|
177
|
+
cache_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
178
|
+
cache_key: z.ZodOptional<z.ZodString>;
|
|
179
|
+
}, z.core.$strict>;
|
|
180
|
+
type BrowserSettings = z.infer<typeof browserSettings>;
|
|
181
|
+
declare const shared: z.ZodObject<{
|
|
182
|
+
tier: z.ZodLiteral<"shared">;
|
|
183
|
+
country: z.ZodOptional<z.ZodString>;
|
|
184
|
+
}, z.core.$strict>;
|
|
185
|
+
declare const premium: z.ZodObject<{
|
|
186
|
+
tier: z.ZodOptional<z.ZodLiteral<"premium">>;
|
|
187
|
+
country: z.ZodOptional<z.ZodString>;
|
|
188
|
+
region: z.ZodOptional<z.ZodString>;
|
|
189
|
+
city: z.ZodOptional<z.ZodString>;
|
|
190
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
191
|
+
mobile: "mobile";
|
|
192
|
+
residential: "residential";
|
|
193
|
+
}>>;
|
|
194
|
+
pool: z.ZodOptional<z.ZodEnum<{
|
|
195
|
+
asia: "asia";
|
|
196
|
+
centralasia: "centralasia";
|
|
197
|
+
eastasia: "eastasia";
|
|
198
|
+
europe: "europe";
|
|
199
|
+
mena: "mena";
|
|
200
|
+
northamerica: "northamerica";
|
|
201
|
+
oceania: "oceania";
|
|
202
|
+
sea: "sea";
|
|
203
|
+
southamerica: "southamerica";
|
|
204
|
+
southasia: "southasia";
|
|
205
|
+
western: "western";
|
|
206
|
+
westeurope: "westeurope";
|
|
207
|
+
}>>;
|
|
208
|
+
asn: z.ZodOptional<z.ZodNumber>;
|
|
209
|
+
lat: z.ZodOptional<z.ZodNumber>;
|
|
210
|
+
lon: z.ZodOptional<z.ZodNumber>;
|
|
211
|
+
session_minutes: z.ZodOptional<z.ZodNumber>;
|
|
212
|
+
unique_ip: z.ZodOptional<z.ZodBoolean>;
|
|
213
|
+
keep_asn: z.ZodOptional<z.ZodBoolean>;
|
|
214
|
+
keep_ip: z.ZodOptional<z.ZodBoolean>;
|
|
215
|
+
}, z.core.$strict>;
|
|
216
|
+
type SharedProxy = z.infer<typeof shared>;
|
|
217
|
+
type PremiumProxy = z.infer<typeof premium>;
|
|
218
|
+
/** A proxy URL of your own, or a selector for one of Surfsky's pools. */
|
|
219
|
+
type ProxyLike = string | SharedProxy | PremiumProxy;
|
|
220
|
+
declare const domainRoute: z.ZodObject<{
|
|
221
|
+
proxy: z.ZodString;
|
|
222
|
+
domain: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
223
|
+
domain_suffix: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
224
|
+
domain_keyword: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
225
|
+
domain_regex: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
226
|
+
}, z.core.$strict>;
|
|
227
|
+
type DomainRoute = z.infer<typeof domainRoute>;
|
|
228
|
+
declare const cookieInput: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>;
|
|
229
|
+
type CookieInput = z.infer<typeof cookieInput>;
|
|
230
|
+
declare const oneTimeStartRequest: z.ZodObject<{
|
|
231
|
+
fingerprint: z.ZodOptional<z.ZodType<Closed<{
|
|
232
|
+
[x: string]: unknown;
|
|
233
|
+
os?: Loose<"android" | "mac" | "win"> | null | undefined;
|
|
234
|
+
os_arch?: Loose<"arm" | "x86"> | null | undefined;
|
|
235
|
+
os_version?: string | null | undefined;
|
|
236
|
+
device_model?: string | null | undefined;
|
|
237
|
+
device_type?: Loose<"phone" | "tablet"> | null | undefined;
|
|
238
|
+
user_agent?: string | null | undefined;
|
|
239
|
+
cpu?: number | null | undefined;
|
|
240
|
+
ram?: number | null | undefined;
|
|
241
|
+
renderer?: string | null | undefined;
|
|
242
|
+
noise?: Closed<{
|
|
243
|
+
[x: string]: unknown;
|
|
244
|
+
webgl?: boolean | null | undefined;
|
|
245
|
+
canvas?: boolean | null | undefined;
|
|
246
|
+
audio?: boolean | null | undefined;
|
|
247
|
+
client_rects?: boolean | null | undefined;
|
|
248
|
+
}> | null | undefined;
|
|
249
|
+
media_devices?: Closed<{
|
|
250
|
+
[x: string]: unknown;
|
|
251
|
+
video_in?: number | null | undefined;
|
|
252
|
+
audio_out?: number | null | undefined;
|
|
253
|
+
audio_in?: number | null | undefined;
|
|
254
|
+
}> | null | undefined;
|
|
255
|
+
screen?: string | null | undefined;
|
|
256
|
+
languages?: string[] | null | undefined;
|
|
257
|
+
timezone?: string | null | undefined;
|
|
258
|
+
geolocation?: Closed<{
|
|
259
|
+
[x: string]: unknown;
|
|
260
|
+
latitude?: number | null | undefined;
|
|
261
|
+
longitude?: number | null | undefined;
|
|
262
|
+
accuracy?: number | null | undefined;
|
|
263
|
+
}> | null | undefined;
|
|
264
|
+
dns?: string | null | undefined;
|
|
265
|
+
}>, Closed<{
|
|
266
|
+
[x: string]: unknown;
|
|
267
|
+
os?: Loose<"android" | "mac" | "win"> | null | undefined;
|
|
268
|
+
os_arch?: Loose<"arm" | "x86"> | null | undefined;
|
|
269
|
+
os_version?: string | null | undefined;
|
|
270
|
+
device_model?: string | null | undefined;
|
|
271
|
+
device_type?: Loose<"phone" | "tablet"> | null | undefined;
|
|
272
|
+
user_agent?: string | null | undefined;
|
|
273
|
+
cpu?: number | null | undefined;
|
|
274
|
+
ram?: number | null | undefined;
|
|
275
|
+
renderer?: string | null | undefined;
|
|
276
|
+
noise?: Closed<{
|
|
277
|
+
[x: string]: unknown;
|
|
278
|
+
webgl?: boolean | null | undefined;
|
|
279
|
+
canvas?: boolean | null | undefined;
|
|
280
|
+
audio?: boolean | null | undefined;
|
|
281
|
+
client_rects?: boolean | null | undefined;
|
|
282
|
+
}> | null | undefined;
|
|
283
|
+
media_devices?: Closed<{
|
|
284
|
+
[x: string]: unknown;
|
|
285
|
+
video_in?: number | null | undefined;
|
|
286
|
+
audio_out?: number | null | undefined;
|
|
287
|
+
audio_in?: number | null | undefined;
|
|
288
|
+
}> | null | undefined;
|
|
289
|
+
screen?: string | null | undefined;
|
|
290
|
+
languages?: string[] | null | undefined;
|
|
291
|
+
timezone?: string | null | undefined;
|
|
292
|
+
geolocation?: Closed<{
|
|
293
|
+
[x: string]: unknown;
|
|
294
|
+
latitude?: number | null | undefined;
|
|
295
|
+
longitude?: number | null | undefined;
|
|
296
|
+
accuracy?: number | null | undefined;
|
|
297
|
+
}> | null | undefined;
|
|
298
|
+
dns?: string | null | undefined;
|
|
299
|
+
}>, z.core.$ZodTypeInternals<Closed<{
|
|
300
|
+
[x: string]: unknown;
|
|
301
|
+
os?: Loose<"android" | "mac" | "win"> | null | undefined;
|
|
302
|
+
os_arch?: Loose<"arm" | "x86"> | null | undefined;
|
|
303
|
+
os_version?: string | null | undefined;
|
|
304
|
+
device_model?: string | null | undefined;
|
|
305
|
+
device_type?: Loose<"phone" | "tablet"> | null | undefined;
|
|
306
|
+
user_agent?: string | null | undefined;
|
|
307
|
+
cpu?: number | null | undefined;
|
|
308
|
+
ram?: number | null | undefined;
|
|
309
|
+
renderer?: string | null | undefined;
|
|
310
|
+
noise?: Closed<{
|
|
311
|
+
[x: string]: unknown;
|
|
312
|
+
webgl?: boolean | null | undefined;
|
|
313
|
+
canvas?: boolean | null | undefined;
|
|
314
|
+
audio?: boolean | null | undefined;
|
|
315
|
+
client_rects?: boolean | null | undefined;
|
|
316
|
+
}> | null | undefined;
|
|
317
|
+
media_devices?: Closed<{
|
|
318
|
+
[x: string]: unknown;
|
|
319
|
+
video_in?: number | null | undefined;
|
|
320
|
+
audio_out?: number | null | undefined;
|
|
321
|
+
audio_in?: number | null | undefined;
|
|
322
|
+
}> | null | undefined;
|
|
323
|
+
screen?: string | null | undefined;
|
|
324
|
+
languages?: string[] | null | undefined;
|
|
325
|
+
timezone?: string | null | undefined;
|
|
326
|
+
geolocation?: Closed<{
|
|
327
|
+
[x: string]: unknown;
|
|
328
|
+
latitude?: number | null | undefined;
|
|
329
|
+
longitude?: number | null | undefined;
|
|
330
|
+
accuracy?: number | null | undefined;
|
|
331
|
+
}> | null | undefined;
|
|
332
|
+
dns?: string | null | undefined;
|
|
333
|
+
}>, Closed<{
|
|
334
|
+
[x: string]: unknown;
|
|
335
|
+
os?: Loose<"android" | "mac" | "win"> | null | undefined;
|
|
336
|
+
os_arch?: Loose<"arm" | "x86"> | null | undefined;
|
|
337
|
+
os_version?: string | null | undefined;
|
|
338
|
+
device_model?: string | null | undefined;
|
|
339
|
+
device_type?: Loose<"phone" | "tablet"> | null | undefined;
|
|
340
|
+
user_agent?: string | null | undefined;
|
|
341
|
+
cpu?: number | null | undefined;
|
|
342
|
+
ram?: number | null | undefined;
|
|
343
|
+
renderer?: string | null | undefined;
|
|
344
|
+
noise?: Closed<{
|
|
345
|
+
[x: string]: unknown;
|
|
346
|
+
webgl?: boolean | null | undefined;
|
|
347
|
+
canvas?: boolean | null | undefined;
|
|
348
|
+
audio?: boolean | null | undefined;
|
|
349
|
+
client_rects?: boolean | null | undefined;
|
|
350
|
+
}> | null | undefined;
|
|
351
|
+
media_devices?: Closed<{
|
|
352
|
+
[x: string]: unknown;
|
|
353
|
+
video_in?: number | null | undefined;
|
|
354
|
+
audio_out?: number | null | undefined;
|
|
355
|
+
audio_in?: number | null | undefined;
|
|
356
|
+
}> | null | undefined;
|
|
357
|
+
screen?: string | null | undefined;
|
|
358
|
+
languages?: string[] | null | undefined;
|
|
359
|
+
timezone?: string | null | undefined;
|
|
360
|
+
geolocation?: Closed<{
|
|
361
|
+
[x: string]: unknown;
|
|
362
|
+
latitude?: number | null | undefined;
|
|
363
|
+
longitude?: number | null | undefined;
|
|
364
|
+
accuracy?: number | null | undefined;
|
|
365
|
+
}> | null | undefined;
|
|
366
|
+
dns?: string | null | undefined;
|
|
367
|
+
}>>>>;
|
|
368
|
+
proxy: z.ZodOptional<z.ZodNullable<z.ZodCustom<ProxyLike, ProxyLike>>>;
|
|
369
|
+
browser_settings: z.ZodOptional<z.ZodObject<{
|
|
370
|
+
inactive_kill_timeout: z.ZodOptional<z.ZodNumber>;
|
|
371
|
+
cache_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
372
|
+
cache_key: z.ZodOptional<z.ZodString>;
|
|
373
|
+
}, z.core.$strict>>;
|
|
374
|
+
enable_chromedriver: z.ZodOptional<z.ZodBoolean>;
|
|
375
|
+
extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
376
|
+
proxy_blacklist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
377
|
+
domain_routes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
378
|
+
proxy: z.ZodString;
|
|
379
|
+
domain: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
380
|
+
domain_suffix: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
381
|
+
domain_keyword: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
382
|
+
domain_regex: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
383
|
+
}, z.core.$strict>>>;
|
|
384
|
+
cookies: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
385
|
+
}, z.core.$strict>;
|
|
386
|
+
declare const profileStartRequest: z.ZodObject<{
|
|
387
|
+
proxy: z.ZodOptional<z.ZodNullable<z.ZodCustom<ProxyLike, ProxyLike>>>;
|
|
388
|
+
browser_settings: z.ZodOptional<z.ZodObject<{
|
|
389
|
+
inactive_kill_timeout: z.ZodOptional<z.ZodNumber>;
|
|
390
|
+
cache_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
391
|
+
cache_key: z.ZodOptional<z.ZodString>;
|
|
392
|
+
}, z.core.$strict>>;
|
|
393
|
+
enable_chromedriver: z.ZodOptional<z.ZodBoolean>;
|
|
394
|
+
extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
395
|
+
proxy_blacklist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
396
|
+
domain_routes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
397
|
+
proxy: z.ZodString;
|
|
398
|
+
domain: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
399
|
+
domain_suffix: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
400
|
+
domain_keyword: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
401
|
+
domain_regex: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
402
|
+
}, z.core.$strict>>>;
|
|
403
|
+
fingerprint: z.ZodType<null | undefined, unknown, z.core.$ZodTypeInternals<null | undefined, unknown>>;
|
|
404
|
+
cookies: z.ZodType<null | undefined, unknown, z.core.$ZodTypeInternals<null | undefined, unknown>>;
|
|
405
|
+
}, z.core.$strict>;
|
|
406
|
+
declare const profileCreateRequest: z.ZodObject<{
|
|
407
|
+
title: z.ZodString;
|
|
408
|
+
fingerprint: z.ZodType<Closed<{
|
|
409
|
+
[x: string]: unknown;
|
|
410
|
+
os?: Loose<"android" | "mac" | "win"> | null | undefined;
|
|
411
|
+
os_arch?: Loose<"arm" | "x86"> | null | undefined;
|
|
412
|
+
os_version?: string | null | undefined;
|
|
413
|
+
device_model?: string | null | undefined;
|
|
414
|
+
device_type?: Loose<"phone" | "tablet"> | null | undefined;
|
|
415
|
+
user_agent?: string | null | undefined;
|
|
416
|
+
cpu?: number | null | undefined;
|
|
417
|
+
ram?: number | null | undefined;
|
|
418
|
+
renderer?: string | null | undefined;
|
|
419
|
+
noise?: Closed<{
|
|
420
|
+
[x: string]: unknown;
|
|
421
|
+
webgl?: boolean | null | undefined;
|
|
422
|
+
canvas?: boolean | null | undefined;
|
|
423
|
+
audio?: boolean | null | undefined;
|
|
424
|
+
client_rects?: boolean | null | undefined;
|
|
425
|
+
}> | null | undefined;
|
|
426
|
+
media_devices?: Closed<{
|
|
427
|
+
[x: string]: unknown;
|
|
428
|
+
video_in?: number | null | undefined;
|
|
429
|
+
audio_out?: number | null | undefined;
|
|
430
|
+
audio_in?: number | null | undefined;
|
|
431
|
+
}> | null | undefined;
|
|
432
|
+
screen?: string | null | undefined;
|
|
433
|
+
languages?: string[] | null | undefined;
|
|
434
|
+
timezone?: string | null | undefined;
|
|
435
|
+
geolocation?: Closed<{
|
|
436
|
+
[x: string]: unknown;
|
|
437
|
+
latitude?: number | null | undefined;
|
|
438
|
+
longitude?: number | null | undefined;
|
|
439
|
+
accuracy?: number | null | undefined;
|
|
440
|
+
}> | null | undefined;
|
|
441
|
+
dns?: string | null | undefined;
|
|
442
|
+
}>, Closed<{
|
|
443
|
+
[x: string]: unknown;
|
|
444
|
+
os?: Loose<"android" | "mac" | "win"> | null | undefined;
|
|
445
|
+
os_arch?: Loose<"arm" | "x86"> | null | undefined;
|
|
446
|
+
os_version?: string | null | undefined;
|
|
447
|
+
device_model?: string | null | undefined;
|
|
448
|
+
device_type?: Loose<"phone" | "tablet"> | null | undefined;
|
|
449
|
+
user_agent?: string | null | undefined;
|
|
450
|
+
cpu?: number | null | undefined;
|
|
451
|
+
ram?: number | null | undefined;
|
|
452
|
+
renderer?: string | null | undefined;
|
|
453
|
+
noise?: Closed<{
|
|
454
|
+
[x: string]: unknown;
|
|
455
|
+
webgl?: boolean | null | undefined;
|
|
456
|
+
canvas?: boolean | null | undefined;
|
|
457
|
+
audio?: boolean | null | undefined;
|
|
458
|
+
client_rects?: boolean | null | undefined;
|
|
459
|
+
}> | null | undefined;
|
|
460
|
+
media_devices?: Closed<{
|
|
461
|
+
[x: string]: unknown;
|
|
462
|
+
video_in?: number | null | undefined;
|
|
463
|
+
audio_out?: number | null | undefined;
|
|
464
|
+
audio_in?: number | null | undefined;
|
|
465
|
+
}> | null | undefined;
|
|
466
|
+
screen?: string | null | undefined;
|
|
467
|
+
languages?: string[] | null | undefined;
|
|
468
|
+
timezone?: string | null | undefined;
|
|
469
|
+
geolocation?: Closed<{
|
|
470
|
+
[x: string]: unknown;
|
|
471
|
+
latitude?: number | null | undefined;
|
|
472
|
+
longitude?: number | null | undefined;
|
|
473
|
+
accuracy?: number | null | undefined;
|
|
474
|
+
}> | null | undefined;
|
|
475
|
+
dns?: string | null | undefined;
|
|
476
|
+
}>, z.core.$ZodTypeInternals<Closed<{
|
|
477
|
+
[x: string]: unknown;
|
|
478
|
+
os?: Loose<"android" | "mac" | "win"> | null | undefined;
|
|
479
|
+
os_arch?: Loose<"arm" | "x86"> | null | undefined;
|
|
480
|
+
os_version?: string | null | undefined;
|
|
481
|
+
device_model?: string | null | undefined;
|
|
482
|
+
device_type?: Loose<"phone" | "tablet"> | null | undefined;
|
|
483
|
+
user_agent?: string | null | undefined;
|
|
484
|
+
cpu?: number | null | undefined;
|
|
485
|
+
ram?: number | null | undefined;
|
|
486
|
+
renderer?: string | null | undefined;
|
|
487
|
+
noise?: Closed<{
|
|
488
|
+
[x: string]: unknown;
|
|
489
|
+
webgl?: boolean | null | undefined;
|
|
490
|
+
canvas?: boolean | null | undefined;
|
|
491
|
+
audio?: boolean | null | undefined;
|
|
492
|
+
client_rects?: boolean | null | undefined;
|
|
493
|
+
}> | null | undefined;
|
|
494
|
+
media_devices?: Closed<{
|
|
495
|
+
[x: string]: unknown;
|
|
496
|
+
video_in?: number | null | undefined;
|
|
497
|
+
audio_out?: number | null | undefined;
|
|
498
|
+
audio_in?: number | null | undefined;
|
|
499
|
+
}> | null | undefined;
|
|
500
|
+
screen?: string | null | undefined;
|
|
501
|
+
languages?: string[] | null | undefined;
|
|
502
|
+
timezone?: string | null | undefined;
|
|
503
|
+
geolocation?: Closed<{
|
|
504
|
+
[x: string]: unknown;
|
|
505
|
+
latitude?: number | null | undefined;
|
|
506
|
+
longitude?: number | null | undefined;
|
|
507
|
+
accuracy?: number | null | undefined;
|
|
508
|
+
}> | null | undefined;
|
|
509
|
+
dns?: string | null | undefined;
|
|
510
|
+
}>, Closed<{
|
|
511
|
+
[x: string]: unknown;
|
|
512
|
+
os?: Loose<"android" | "mac" | "win"> | null | undefined;
|
|
513
|
+
os_arch?: Loose<"arm" | "x86"> | null | undefined;
|
|
514
|
+
os_version?: string | null | undefined;
|
|
515
|
+
device_model?: string | null | undefined;
|
|
516
|
+
device_type?: Loose<"phone" | "tablet"> | null | undefined;
|
|
517
|
+
user_agent?: string | null | undefined;
|
|
518
|
+
cpu?: number | null | undefined;
|
|
519
|
+
ram?: number | null | undefined;
|
|
520
|
+
renderer?: string | null | undefined;
|
|
521
|
+
noise?: Closed<{
|
|
522
|
+
[x: string]: unknown;
|
|
523
|
+
webgl?: boolean | null | undefined;
|
|
524
|
+
canvas?: boolean | null | undefined;
|
|
525
|
+
audio?: boolean | null | undefined;
|
|
526
|
+
client_rects?: boolean | null | undefined;
|
|
527
|
+
}> | null | undefined;
|
|
528
|
+
media_devices?: Closed<{
|
|
529
|
+
[x: string]: unknown;
|
|
530
|
+
video_in?: number | null | undefined;
|
|
531
|
+
audio_out?: number | null | undefined;
|
|
532
|
+
audio_in?: number | null | undefined;
|
|
533
|
+
}> | null | undefined;
|
|
534
|
+
screen?: string | null | undefined;
|
|
535
|
+
languages?: string[] | null | undefined;
|
|
536
|
+
timezone?: string | null | undefined;
|
|
537
|
+
geolocation?: Closed<{
|
|
538
|
+
[x: string]: unknown;
|
|
539
|
+
latitude?: number | null | undefined;
|
|
540
|
+
longitude?: number | null | undefined;
|
|
541
|
+
accuracy?: number | null | undefined;
|
|
542
|
+
}> | null | undefined;
|
|
543
|
+
dns?: string | null | undefined;
|
|
544
|
+
}>>>;
|
|
545
|
+
description: z.ZodOptional<z.ZodString>;
|
|
546
|
+
proxy: z.ZodOptional<z.ZodNullable<z.ZodCustom<ProxyLike, ProxyLike>>>;
|
|
547
|
+
cookies: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
548
|
+
storage_options: z.ZodOptional<z.ZodType<Closed<{
|
|
549
|
+
[x: string]: unknown;
|
|
550
|
+
cookies?: boolean | null | undefined;
|
|
551
|
+
passwords?: boolean | null | undefined;
|
|
552
|
+
extensions?: boolean | null | undefined;
|
|
553
|
+
localstorage?: boolean | null | undefined;
|
|
554
|
+
history?: boolean | null | undefined;
|
|
555
|
+
bookmarks?: boolean | null | undefined;
|
|
556
|
+
serviceworkers?: boolean | null | undefined;
|
|
557
|
+
}>, Closed<{
|
|
558
|
+
[x: string]: unknown;
|
|
559
|
+
cookies?: boolean | null | undefined;
|
|
560
|
+
passwords?: boolean | null | undefined;
|
|
561
|
+
extensions?: boolean | null | undefined;
|
|
562
|
+
localstorage?: boolean | null | undefined;
|
|
563
|
+
history?: boolean | null | undefined;
|
|
564
|
+
bookmarks?: boolean | null | undefined;
|
|
565
|
+
serviceworkers?: boolean | null | undefined;
|
|
566
|
+
}>, z.core.$ZodTypeInternals<Closed<{
|
|
567
|
+
[x: string]: unknown;
|
|
568
|
+
cookies?: boolean | null | undefined;
|
|
569
|
+
passwords?: boolean | null | undefined;
|
|
570
|
+
extensions?: boolean | null | undefined;
|
|
571
|
+
localstorage?: boolean | null | undefined;
|
|
572
|
+
history?: boolean | null | undefined;
|
|
573
|
+
bookmarks?: boolean | null | undefined;
|
|
574
|
+
serviceworkers?: boolean | null | undefined;
|
|
575
|
+
}>, Closed<{
|
|
576
|
+
[x: string]: unknown;
|
|
577
|
+
cookies?: boolean | null | undefined;
|
|
578
|
+
passwords?: boolean | null | undefined;
|
|
579
|
+
extensions?: boolean | null | undefined;
|
|
580
|
+
localstorage?: boolean | null | undefined;
|
|
581
|
+
history?: boolean | null | undefined;
|
|
582
|
+
bookmarks?: boolean | null | undefined;
|
|
583
|
+
serviceworkers?: boolean | null | undefined;
|
|
584
|
+
}>>>>;
|
|
585
|
+
}, z.core.$strict>;
|
|
586
|
+
declare const profileUpdateRequest: z.ZodObject<{
|
|
587
|
+
title: z.ZodOptional<z.ZodString>;
|
|
588
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
589
|
+
proxy: z.ZodOptional<z.ZodNullable<z.ZodCustom<ProxyLike, ProxyLike>>>;
|
|
590
|
+
fingerprint: z.ZodOptional<z.ZodPipe<z.ZodType<Closed<{
|
|
591
|
+
[x: string]: unknown;
|
|
592
|
+
os?: Loose<"android" | "mac" | "win"> | null | undefined;
|
|
593
|
+
os_arch?: Loose<"arm" | "x86"> | null | undefined;
|
|
594
|
+
os_version?: string | null | undefined;
|
|
595
|
+
device_model?: string | null | undefined;
|
|
596
|
+
device_type?: Loose<"phone" | "tablet"> | null | undefined;
|
|
597
|
+
user_agent?: string | null | undefined;
|
|
598
|
+
cpu?: number | null | undefined;
|
|
599
|
+
ram?: number | null | undefined;
|
|
600
|
+
renderer?: string | null | undefined;
|
|
601
|
+
noise?: Closed<{
|
|
602
|
+
[x: string]: unknown;
|
|
603
|
+
webgl?: boolean | null | undefined;
|
|
604
|
+
canvas?: boolean | null | undefined;
|
|
605
|
+
audio?: boolean | null | undefined;
|
|
606
|
+
client_rects?: boolean | null | undefined;
|
|
607
|
+
}> | null | undefined;
|
|
608
|
+
media_devices?: Closed<{
|
|
609
|
+
[x: string]: unknown;
|
|
610
|
+
video_in?: number | null | undefined;
|
|
611
|
+
audio_out?: number | null | undefined;
|
|
612
|
+
audio_in?: number | null | undefined;
|
|
613
|
+
}> | null | undefined;
|
|
614
|
+
screen?: string | null | undefined;
|
|
615
|
+
languages?: string[] | null | undefined;
|
|
616
|
+
timezone?: string | null | undefined;
|
|
617
|
+
geolocation?: Closed<{
|
|
618
|
+
[x: string]: unknown;
|
|
619
|
+
latitude?: number | null | undefined;
|
|
620
|
+
longitude?: number | null | undefined;
|
|
621
|
+
accuracy?: number | null | undefined;
|
|
622
|
+
}> | null | undefined;
|
|
623
|
+
dns?: string | null | undefined;
|
|
624
|
+
}>, Closed<{
|
|
625
|
+
[x: string]: unknown;
|
|
626
|
+
os?: Loose<"android" | "mac" | "win"> | null | undefined;
|
|
627
|
+
os_arch?: Loose<"arm" | "x86"> | null | undefined;
|
|
628
|
+
os_version?: string | null | undefined;
|
|
629
|
+
device_model?: string | null | undefined;
|
|
630
|
+
device_type?: Loose<"phone" | "tablet"> | null | undefined;
|
|
631
|
+
user_agent?: string | null | undefined;
|
|
632
|
+
cpu?: number | null | undefined;
|
|
633
|
+
ram?: number | null | undefined;
|
|
634
|
+
renderer?: string | null | undefined;
|
|
635
|
+
noise?: Closed<{
|
|
636
|
+
[x: string]: unknown;
|
|
637
|
+
webgl?: boolean | null | undefined;
|
|
638
|
+
canvas?: boolean | null | undefined;
|
|
639
|
+
audio?: boolean | null | undefined;
|
|
640
|
+
client_rects?: boolean | null | undefined;
|
|
641
|
+
}> | null | undefined;
|
|
642
|
+
media_devices?: Closed<{
|
|
643
|
+
[x: string]: unknown;
|
|
644
|
+
video_in?: number | null | undefined;
|
|
645
|
+
audio_out?: number | null | undefined;
|
|
646
|
+
audio_in?: number | null | undefined;
|
|
647
|
+
}> | null | undefined;
|
|
648
|
+
screen?: string | null | undefined;
|
|
649
|
+
languages?: string[] | null | undefined;
|
|
650
|
+
timezone?: string | null | undefined;
|
|
651
|
+
geolocation?: Closed<{
|
|
652
|
+
[x: string]: unknown;
|
|
653
|
+
latitude?: number | null | undefined;
|
|
654
|
+
longitude?: number | null | undefined;
|
|
655
|
+
accuracy?: number | null | undefined;
|
|
656
|
+
}> | null | undefined;
|
|
657
|
+
dns?: string | null | undefined;
|
|
658
|
+
}>, z.core.$ZodTypeInternals<Closed<{
|
|
659
|
+
[x: string]: unknown;
|
|
660
|
+
os?: Loose<"android" | "mac" | "win"> | null | undefined;
|
|
661
|
+
os_arch?: Loose<"arm" | "x86"> | null | undefined;
|
|
662
|
+
os_version?: string | null | undefined;
|
|
663
|
+
device_model?: string | null | undefined;
|
|
664
|
+
device_type?: Loose<"phone" | "tablet"> | null | undefined;
|
|
665
|
+
user_agent?: string | null | undefined;
|
|
666
|
+
cpu?: number | null | undefined;
|
|
667
|
+
ram?: number | null | undefined;
|
|
668
|
+
renderer?: string | null | undefined;
|
|
669
|
+
noise?: Closed<{
|
|
670
|
+
[x: string]: unknown;
|
|
671
|
+
webgl?: boolean | null | undefined;
|
|
672
|
+
canvas?: boolean | null | undefined;
|
|
673
|
+
audio?: boolean | null | undefined;
|
|
674
|
+
client_rects?: boolean | null | undefined;
|
|
675
|
+
}> | null | undefined;
|
|
676
|
+
media_devices?: Closed<{
|
|
677
|
+
[x: string]: unknown;
|
|
678
|
+
video_in?: number | null | undefined;
|
|
679
|
+
audio_out?: number | null | undefined;
|
|
680
|
+
audio_in?: number | null | undefined;
|
|
681
|
+
}> | null | undefined;
|
|
682
|
+
screen?: string | null | undefined;
|
|
683
|
+
languages?: string[] | null | undefined;
|
|
684
|
+
timezone?: string | null | undefined;
|
|
685
|
+
geolocation?: Closed<{
|
|
686
|
+
[x: string]: unknown;
|
|
687
|
+
latitude?: number | null | undefined;
|
|
688
|
+
longitude?: number | null | undefined;
|
|
689
|
+
accuracy?: number | null | undefined;
|
|
690
|
+
}> | null | undefined;
|
|
691
|
+
dns?: string | null | undefined;
|
|
692
|
+
}>, Closed<{
|
|
693
|
+
[x: string]: unknown;
|
|
694
|
+
os?: Loose<"android" | "mac" | "win"> | null | undefined;
|
|
695
|
+
os_arch?: Loose<"arm" | "x86"> | null | undefined;
|
|
696
|
+
os_version?: string | null | undefined;
|
|
697
|
+
device_model?: string | null | undefined;
|
|
698
|
+
device_type?: Loose<"phone" | "tablet"> | null | undefined;
|
|
699
|
+
user_agent?: string | null | undefined;
|
|
700
|
+
cpu?: number | null | undefined;
|
|
701
|
+
ram?: number | null | undefined;
|
|
702
|
+
renderer?: string | null | undefined;
|
|
703
|
+
noise?: Closed<{
|
|
704
|
+
[x: string]: unknown;
|
|
705
|
+
webgl?: boolean | null | undefined;
|
|
706
|
+
canvas?: boolean | null | undefined;
|
|
707
|
+
audio?: boolean | null | undefined;
|
|
708
|
+
client_rects?: boolean | null | undefined;
|
|
709
|
+
}> | null | undefined;
|
|
710
|
+
media_devices?: Closed<{
|
|
711
|
+
[x: string]: unknown;
|
|
712
|
+
video_in?: number | null | undefined;
|
|
713
|
+
audio_out?: number | null | undefined;
|
|
714
|
+
audio_in?: number | null | undefined;
|
|
715
|
+
}> | null | undefined;
|
|
716
|
+
screen?: string | null | undefined;
|
|
717
|
+
languages?: string[] | null | undefined;
|
|
718
|
+
timezone?: string | null | undefined;
|
|
719
|
+
geolocation?: Closed<{
|
|
720
|
+
[x: string]: unknown;
|
|
721
|
+
latitude?: number | null | undefined;
|
|
722
|
+
longitude?: number | null | undefined;
|
|
723
|
+
accuracy?: number | null | undefined;
|
|
724
|
+
}> | null | undefined;
|
|
725
|
+
dns?: string | null | undefined;
|
|
726
|
+
}>>>, z.ZodTransform<{
|
|
727
|
+
user_agent?: string | null | undefined;
|
|
728
|
+
cpu?: number | null | undefined;
|
|
729
|
+
ram?: number | null | undefined;
|
|
730
|
+
renderer?: string | null | undefined;
|
|
731
|
+
noise?: Closed<{
|
|
732
|
+
[x: string]: unknown;
|
|
733
|
+
webgl?: boolean | null | undefined;
|
|
734
|
+
canvas?: boolean | null | undefined;
|
|
735
|
+
audio?: boolean | null | undefined;
|
|
736
|
+
client_rects?: boolean | null | undefined;
|
|
737
|
+
}> | null | undefined;
|
|
738
|
+
media_devices?: Closed<{
|
|
739
|
+
[x: string]: unknown;
|
|
740
|
+
video_in?: number | null | undefined;
|
|
741
|
+
audio_out?: number | null | undefined;
|
|
742
|
+
audio_in?: number | null | undefined;
|
|
743
|
+
}> | null | undefined;
|
|
744
|
+
screen?: string | null | undefined;
|
|
745
|
+
languages?: string[] | null | undefined;
|
|
746
|
+
timezone?: string | null | undefined;
|
|
747
|
+
geolocation?: Closed<{
|
|
748
|
+
[x: string]: unknown;
|
|
749
|
+
latitude?: number | null | undefined;
|
|
750
|
+
longitude?: number | null | undefined;
|
|
751
|
+
accuracy?: number | null | undefined;
|
|
752
|
+
}> | null | undefined;
|
|
753
|
+
dns?: string | null | undefined;
|
|
754
|
+
}, Closed<{
|
|
755
|
+
[x: string]: unknown;
|
|
756
|
+
os?: Loose<"android" | "mac" | "win"> | null | undefined;
|
|
757
|
+
os_arch?: Loose<"arm" | "x86"> | null | undefined;
|
|
758
|
+
os_version?: string | null | undefined;
|
|
759
|
+
device_model?: string | null | undefined;
|
|
760
|
+
device_type?: Loose<"phone" | "tablet"> | null | undefined;
|
|
761
|
+
user_agent?: string | null | undefined;
|
|
762
|
+
cpu?: number | null | undefined;
|
|
763
|
+
ram?: number | null | undefined;
|
|
764
|
+
renderer?: string | null | undefined;
|
|
765
|
+
noise?: Closed<{
|
|
766
|
+
[x: string]: unknown;
|
|
767
|
+
webgl?: boolean | null | undefined;
|
|
768
|
+
canvas?: boolean | null | undefined;
|
|
769
|
+
audio?: boolean | null | undefined;
|
|
770
|
+
client_rects?: boolean | null | undefined;
|
|
771
|
+
}> | null | undefined;
|
|
772
|
+
media_devices?: Closed<{
|
|
773
|
+
[x: string]: unknown;
|
|
774
|
+
video_in?: number | null | undefined;
|
|
775
|
+
audio_out?: number | null | undefined;
|
|
776
|
+
audio_in?: number | null | undefined;
|
|
777
|
+
}> | null | undefined;
|
|
778
|
+
screen?: string | null | undefined;
|
|
779
|
+
languages?: string[] | null | undefined;
|
|
780
|
+
timezone?: string | null | undefined;
|
|
781
|
+
geolocation?: Closed<{
|
|
782
|
+
[x: string]: unknown;
|
|
783
|
+
latitude?: number | null | undefined;
|
|
784
|
+
longitude?: number | null | undefined;
|
|
785
|
+
accuracy?: number | null | undefined;
|
|
786
|
+
}> | null | undefined;
|
|
787
|
+
dns?: string | null | undefined;
|
|
788
|
+
}>>>>;
|
|
789
|
+
storage_options: z.ZodOptional<z.ZodNullable<z.ZodType<Closed<{
|
|
790
|
+
[x: string]: unknown;
|
|
791
|
+
cookies?: boolean | null | undefined;
|
|
792
|
+
passwords?: boolean | null | undefined;
|
|
793
|
+
extensions?: boolean | null | undefined;
|
|
794
|
+
localstorage?: boolean | null | undefined;
|
|
795
|
+
history?: boolean | null | undefined;
|
|
796
|
+
bookmarks?: boolean | null | undefined;
|
|
797
|
+
serviceworkers?: boolean | null | undefined;
|
|
798
|
+
}>, Closed<{
|
|
799
|
+
[x: string]: unknown;
|
|
800
|
+
cookies?: boolean | null | undefined;
|
|
801
|
+
passwords?: boolean | null | undefined;
|
|
802
|
+
extensions?: boolean | null | undefined;
|
|
803
|
+
localstorage?: boolean | null | undefined;
|
|
804
|
+
history?: boolean | null | undefined;
|
|
805
|
+
bookmarks?: boolean | null | undefined;
|
|
806
|
+
serviceworkers?: boolean | null | undefined;
|
|
807
|
+
}>, z.core.$ZodTypeInternals<Closed<{
|
|
808
|
+
[x: string]: unknown;
|
|
809
|
+
cookies?: boolean | null | undefined;
|
|
810
|
+
passwords?: boolean | null | undefined;
|
|
811
|
+
extensions?: boolean | null | undefined;
|
|
812
|
+
localstorage?: boolean | null | undefined;
|
|
813
|
+
history?: boolean | null | undefined;
|
|
814
|
+
bookmarks?: boolean | null | undefined;
|
|
815
|
+
serviceworkers?: boolean | null | undefined;
|
|
816
|
+
}>, Closed<{
|
|
817
|
+
[x: string]: unknown;
|
|
818
|
+
cookies?: boolean | null | undefined;
|
|
819
|
+
passwords?: boolean | null | undefined;
|
|
820
|
+
extensions?: boolean | null | undefined;
|
|
821
|
+
localstorage?: boolean | null | undefined;
|
|
822
|
+
history?: boolean | null | undefined;
|
|
823
|
+
bookmarks?: boolean | null | undefined;
|
|
824
|
+
serviceworkers?: boolean | null | undefined;
|
|
825
|
+
}>>>>>;
|
|
826
|
+
}, z.core.$strict>;
|
|
827
|
+
declare const listPageRequest: z.ZodObject<{
|
|
828
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
829
|
+
page_len: z.ZodOptional<z.ZodNumber>;
|
|
830
|
+
ordering: z.ZodOptional<z.ZodEnum<{
|
|
831
|
+
"-active": "-active";
|
|
832
|
+
"-created": "-created";
|
|
833
|
+
"-title": "-title";
|
|
834
|
+
active: "active";
|
|
835
|
+
created: "created";
|
|
836
|
+
title: "title";
|
|
837
|
+
}>>;
|
|
838
|
+
}, z.core.$strict>;
|
|
839
|
+
declare const scrapeRequest: z.ZodObject<{
|
|
840
|
+
url: z.ZodString;
|
|
841
|
+
screenshot: z.ZodOptional<z.ZodBoolean>;
|
|
842
|
+
wait: z.ZodOptional<z.ZodNumber>;
|
|
843
|
+
wait_until: z.ZodOptional<z.ZodEnum<{
|
|
844
|
+
commit: "commit";
|
|
845
|
+
domcontentloaded: "domcontentloaded";
|
|
846
|
+
load: "load";
|
|
847
|
+
networkidle: "networkidle";
|
|
848
|
+
}>>;
|
|
849
|
+
wait_for: z.ZodOptional<z.ZodString>;
|
|
850
|
+
human_actions: z.ZodOptional<z.ZodNumber>;
|
|
851
|
+
}, z.core.$strict>;
|
|
852
|
+
type OneTimeStartRequest = z.infer<typeof oneTimeStartRequest>;
|
|
853
|
+
type ProfileStartRequest = z.infer<typeof profileStartRequest>;
|
|
854
|
+
type ProfileCreateRequest = z.infer<typeof profileCreateRequest>;
|
|
855
|
+
/** As the caller writes it; the parse strips the immutable fingerprint fields. */
|
|
856
|
+
type ProfileUpdateRequest = z.input<typeof profileUpdateRequest>;
|
|
857
|
+
type ListPageRequest = z.infer<typeof listPageRequest>;
|
|
858
|
+
type ScrapeRequest = z.infer<typeof scrapeRequest>;
|
|
859
|
+
type Parser<T> = (value: unknown) => T;
|
|
860
|
+
declare const parseOneTimeStartRequest: Parser<OneTimeStartRequest>;
|
|
861
|
+
declare const parseProfileStartRequest: Parser<ProfileStartRequest>;
|
|
862
|
+
declare const parseProfileCreateRequest: Parser<ProfileCreateRequest>;
|
|
863
|
+
declare const parseProfileUpdateRequest: Parser<z.output<typeof profileUpdateRequest>>;
|
|
864
|
+
declare const parseScrapeRequest: Parser<ScrapeRequest>;
|
|
865
|
+
declare const parseListPageRequest: Parser<ListPageRequest>;
|
|
866
|
+
declare function parseProxyLike(value: unknown, what?: string): ProxyLike;
|
|
867
|
+
interface InspectorPage {
|
|
868
|
+
page_title?: string | null;
|
|
869
|
+
page_url?: string | null;
|
|
870
|
+
devtools_url?: string | null;
|
|
871
|
+
}
|
|
872
|
+
interface Inspector {
|
|
873
|
+
list?: string | null;
|
|
874
|
+
pages?: InspectorPage[] | null;
|
|
875
|
+
screencast?: string | null;
|
|
876
|
+
}
|
|
877
|
+
interface Session {
|
|
878
|
+
internal_uuid: string;
|
|
879
|
+
ws_url: string;
|
|
880
|
+
inspector?: Inspector | null;
|
|
881
|
+
}
|
|
882
|
+
interface ProfileRef {
|
|
883
|
+
uuid: string;
|
|
884
|
+
}
|
|
885
|
+
interface ActiveProfile {
|
|
886
|
+
internal_uuid: string;
|
|
887
|
+
profile_uuid?: string | null;
|
|
888
|
+
one_time?: boolean | null;
|
|
889
|
+
started_at?: string | null;
|
|
890
|
+
active_seconds?: number | null;
|
|
891
|
+
}
|
|
892
|
+
interface ProfileSummary {
|
|
893
|
+
uuid: string;
|
|
894
|
+
title?: string | null;
|
|
895
|
+
description?: string | null;
|
|
896
|
+
proxy?: string | null;
|
|
897
|
+
status?: string | null;
|
|
898
|
+
}
|
|
899
|
+
interface Profile {
|
|
900
|
+
uuid: string;
|
|
901
|
+
title?: string | null;
|
|
902
|
+
description?: string | null;
|
|
903
|
+
start_pages?: unknown[] | null;
|
|
904
|
+
pinned_tag?: string | null;
|
|
905
|
+
proxy?: string | null;
|
|
906
|
+
status?: string | null;
|
|
907
|
+
storage_options?: StorageOptions | null;
|
|
908
|
+
last_active?: string | null;
|
|
909
|
+
fingerprint?: Fingerprint | null;
|
|
910
|
+
has_user_password?: boolean | null;
|
|
911
|
+
password_set_at?: string | null;
|
|
912
|
+
created_at?: string | null;
|
|
913
|
+
updated_at?: string | null;
|
|
914
|
+
}
|
|
915
|
+
/** Cookies are camelCase on the wire, in the API and in CDP. */
|
|
916
|
+
interface Cookie {
|
|
917
|
+
domain?: string | null;
|
|
918
|
+
name?: string | null;
|
|
919
|
+
value?: string | null;
|
|
920
|
+
path?: string | null;
|
|
921
|
+
expirationDate?: number | null;
|
|
922
|
+
hostOnly?: boolean | null;
|
|
923
|
+
httpOnly?: boolean | null;
|
|
924
|
+
sameSite?: string | null;
|
|
925
|
+
secure?: boolean | null;
|
|
926
|
+
}
|
|
927
|
+
interface ScrapeResult {
|
|
928
|
+
url?: string | null;
|
|
929
|
+
status?: number | null;
|
|
930
|
+
status_text?: string | null;
|
|
931
|
+
content?: string | null;
|
|
932
|
+
cookies?: Cookie[] | null;
|
|
933
|
+
/** base64 PNG when requested */
|
|
934
|
+
screenshot?: string | null;
|
|
935
|
+
}
|
|
936
|
+
interface BatchDeleteResult {
|
|
937
|
+
deleted_uuids: string[];
|
|
938
|
+
active_uuids: string[];
|
|
939
|
+
not_found_uuids: string[];
|
|
940
|
+
}
|
|
941
|
+
interface StopAllResult {
|
|
942
|
+
stopped: string[];
|
|
943
|
+
failed: unknown[];
|
|
944
|
+
}
|
|
945
|
+
interface ProxyCountry {
|
|
946
|
+
code: string;
|
|
947
|
+
name?: string | null;
|
|
948
|
+
}
|
|
949
|
+
interface ProxyRegion {
|
|
950
|
+
code: string;
|
|
951
|
+
name?: string | null;
|
|
952
|
+
country?: string | null;
|
|
953
|
+
country_code?: string | null;
|
|
954
|
+
}
|
|
955
|
+
interface ProxyCity {
|
|
956
|
+
code: string;
|
|
957
|
+
name?: string | null;
|
|
958
|
+
region?: string | null;
|
|
959
|
+
region_code?: string | null;
|
|
960
|
+
country?: string | null;
|
|
961
|
+
country_code?: string | null;
|
|
962
|
+
}
|
|
963
|
+
interface ProxyQuota {
|
|
964
|
+
remaining_bytes?: number | null;
|
|
965
|
+
remaining_gb?: number | null;
|
|
966
|
+
}
|
|
967
|
+
/** `-1` means unlimited. */
|
|
968
|
+
interface SharedProxyQuota {
|
|
969
|
+
limit_gb?: number | null;
|
|
970
|
+
limit_bytes?: number | null;
|
|
971
|
+
used_bytes?: number | null;
|
|
972
|
+
remaining_bytes?: number | null;
|
|
973
|
+
remaining_gb?: number | null;
|
|
974
|
+
reset_time?: number | null;
|
|
975
|
+
}
|
|
976
|
+
interface TrafficVolume {
|
|
977
|
+
bytes?: number | null;
|
|
978
|
+
gb?: number | null;
|
|
979
|
+
}
|
|
980
|
+
interface TrafficStats {
|
|
981
|
+
"24h"?: TrafficVolume | null;
|
|
982
|
+
"7d"?: TrafficVolume | null;
|
|
983
|
+
"30d"?: TrafficVolume | null;
|
|
984
|
+
}
|
|
985
|
+
interface Renderer {
|
|
986
|
+
value: string;
|
|
987
|
+
platform?: string | null;
|
|
988
|
+
archs?: string[] | null;
|
|
989
|
+
}
|
|
990
|
+
interface Screen {
|
|
991
|
+
value: string;
|
|
992
|
+
platform?: string | null;
|
|
993
|
+
archs?: string[] | null;
|
|
994
|
+
}
|
|
995
|
+
interface DeviceModel {
|
|
996
|
+
value: string;
|
|
997
|
+
os?: string | null;
|
|
998
|
+
os_versions?: string[] | null;
|
|
999
|
+
archs?: string[] | null;
|
|
1000
|
+
device_type?: string | null;
|
|
1001
|
+
}
|
|
1002
|
+
interface Extension {
|
|
1003
|
+
uuid: string;
|
|
1004
|
+
name?: string | null;
|
|
1005
|
+
created_at?: string | null;
|
|
1006
|
+
updated_at?: string | null;
|
|
1007
|
+
}
|
|
1008
|
+
interface SessionLimits {
|
|
1009
|
+
has_session_limits?: boolean | null;
|
|
1010
|
+
spm?: number | null;
|
|
1011
|
+
remaining?: number | null;
|
|
1012
|
+
used?: number | null;
|
|
1013
|
+
additional_spm?: number | null;
|
|
1014
|
+
reset_time?: number | null;
|
|
1015
|
+
}
|
|
1016
|
+
interface BrowserLimits {
|
|
1017
|
+
has_browser_limits?: boolean | null;
|
|
1018
|
+
parallel_browsers?: number | null;
|
|
1019
|
+
running?: number | null;
|
|
1020
|
+
available?: number | null;
|
|
1021
|
+
}
|
|
1022
|
+
//#endregion
|
|
1023
|
+
//#region src/browser/actions.d.ts
|
|
1024
|
+
type Send = (method: string, params?: Record<string, unknown>) => Promise<any>;
|
|
1025
|
+
interface ClickOptions {
|
|
1026
|
+
button?: MouseButton;
|
|
1027
|
+
clickCount?: number;
|
|
1028
|
+
modifiers?: KeyModifier[];
|
|
1029
|
+
waitForVisible?: boolean;
|
|
1030
|
+
scrollIntoView?: boolean;
|
|
1031
|
+
preDelay?: number;
|
|
1032
|
+
postDelay?: number;
|
|
1033
|
+
timeout?: number;
|
|
1034
|
+
}
|
|
1035
|
+
type DblclickOptions = Omit<ClickOptions, "clickCount">;
|
|
1036
|
+
interface HoverOptions {
|
|
1037
|
+
waitForVisible?: boolean;
|
|
1038
|
+
scrollIntoView?: boolean;
|
|
1039
|
+
timeout?: number;
|
|
1040
|
+
}
|
|
1041
|
+
interface PressOptions {
|
|
1042
|
+
modifiers?: KeyModifier[];
|
|
1043
|
+
delay?: number;
|
|
1044
|
+
}
|
|
1045
|
+
interface MouseClickOptions {
|
|
1046
|
+
button?: MouseButton;
|
|
1047
|
+
clickCount?: number;
|
|
1048
|
+
modifiers?: KeyModifier[];
|
|
1049
|
+
preDelay?: number;
|
|
1050
|
+
postDelay?: number;
|
|
1051
|
+
}
|
|
1052
|
+
interface ScrollOptions {
|
|
1053
|
+
deltaX?: number;
|
|
1054
|
+
deltaY?: number;
|
|
1055
|
+
duration?: number;
|
|
1056
|
+
}
|
|
1057
|
+
interface ScrollToOptions {
|
|
1058
|
+
x?: number;
|
|
1059
|
+
y?: number;
|
|
1060
|
+
behavior?: ScrollBehavior;
|
|
1061
|
+
}
|
|
1062
|
+
interface DragOptions {
|
|
1063
|
+
startX: number;
|
|
1064
|
+
startY: number;
|
|
1065
|
+
endX: number;
|
|
1066
|
+
endY: number;
|
|
1067
|
+
button?: MouseButton;
|
|
1068
|
+
}
|
|
1069
|
+
declare class Keyboard {
|
|
1070
|
+
#private;
|
|
1071
|
+
constructor(send: Send);
|
|
1072
|
+
type(text: string): Promise<any>;
|
|
1073
|
+
press(key: string, options?: PressOptions): Promise<any>;
|
|
1074
|
+
}
|
|
1075
|
+
declare class Mouse {
|
|
1076
|
+
#private;
|
|
1077
|
+
constructor(send: Send);
|
|
1078
|
+
move(x: number, y: number): Promise<any>;
|
|
1079
|
+
click(x: number, y: number, options?: MouseClickOptions): Promise<any>;
|
|
1080
|
+
down(x: number, y: number, options?: {
|
|
1081
|
+
button?: MouseButton;
|
|
1082
|
+
}): Promise<any>;
|
|
1083
|
+
up(x: number, y: number, options?: {
|
|
1084
|
+
button?: MouseButton;
|
|
1085
|
+
}): Promise<any>;
|
|
1086
|
+
wheel(options?: {
|
|
1087
|
+
deltaX?: number;
|
|
1088
|
+
deltaY?: number;
|
|
1089
|
+
}): Promise<any>;
|
|
1090
|
+
drag(options: DragOptions): Promise<any>;
|
|
1091
|
+
}
|
|
1092
|
+
declare abstract class Actions {
|
|
1093
|
+
readonly keyboard: Keyboard;
|
|
1094
|
+
readonly mouse: Mouse;
|
|
1095
|
+
constructor();
|
|
1096
|
+
abstract send(method: string, params?: Record<string, unknown>): Promise<any>;
|
|
1097
|
+
click(selector: string, options?: ClickOptions): Promise<any>;
|
|
1098
|
+
dblclick(selector: string, options?: DblclickOptions): Promise<any>;
|
|
1099
|
+
hover(selector: string, options?: HoverOptions): Promise<any>;
|
|
1100
|
+
type(selector: string, text: string): Promise<any>;
|
|
1101
|
+
fill(selector: string, text: string): Promise<any>;
|
|
1102
|
+
scroll(options?: ScrollOptions): Promise<any>;
|
|
1103
|
+
scrollIntoView(selector: string, options?: {
|
|
1104
|
+
behavior?: ScrollBehavior;
|
|
1105
|
+
}): Promise<any>;
|
|
1106
|
+
scrollTo(options?: ScrollToOptions): Promise<any>;
|
|
1107
|
+
}
|
|
1108
|
+
//#endregion
|
|
1109
|
+
//#region src/errors.d.ts
|
|
1110
|
+
declare class SurfskyError extends Error {
|
|
1111
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1112
|
+
}
|
|
1113
|
+
/** No API token, or another unusable client setting. */
|
|
1114
|
+
declare class ConfigurationError extends SurfskyError {}
|
|
1115
|
+
/** A request that failed validation before it was sent. `cause` is the ZodError. */
|
|
1116
|
+
declare class ValidationError extends SurfskyError {
|
|
1117
|
+
readonly issues: readonly z.core.$ZodIssue[];
|
|
1118
|
+
constructor(message: string, error: z.ZodError);
|
|
1119
|
+
}
|
|
1120
|
+
interface APIErrorOptions {
|
|
1121
|
+
statusCode?: number;
|
|
1122
|
+
body?: unknown;
|
|
1123
|
+
requestId?: string;
|
|
1124
|
+
headers?: Record<string, string>;
|
|
1125
|
+
retryAfter?: number;
|
|
1126
|
+
cause?: unknown;
|
|
1127
|
+
}
|
|
1128
|
+
/** An error response from the API, or a request that never got one. */
|
|
1129
|
+
declare class APIError extends SurfskyError {
|
|
1130
|
+
readonly statusCode: number | undefined;
|
|
1131
|
+
readonly body: unknown;
|
|
1132
|
+
readonly code: string | undefined;
|
|
1133
|
+
readonly requestId: string | undefined;
|
|
1134
|
+
readonly headers: Record<string, string> | undefined;
|
|
1135
|
+
readonly retryAfter: number | undefined;
|
|
1136
|
+
constructor(message: string, options?: APIErrorOptions);
|
|
1137
|
+
toString(): string;
|
|
1138
|
+
}
|
|
1139
|
+
/** The request never reached the API. */
|
|
1140
|
+
declare class APIConnectionError extends APIError {}
|
|
1141
|
+
/** No response within the timeout. */
|
|
1142
|
+
declare class APITimeoutError extends APIConnectionError {}
|
|
1143
|
+
/** 400 or 422. */
|
|
1144
|
+
declare class BadRequestError extends APIError {}
|
|
1145
|
+
/** 401, or a 422 that rejects the token header. */
|
|
1146
|
+
declare class AuthenticationError extends APIError {}
|
|
1147
|
+
/** 402. */
|
|
1148
|
+
declare class PaymentRequiredError extends APIError {}
|
|
1149
|
+
/** 403. */
|
|
1150
|
+
declare class ForbiddenError extends APIError {}
|
|
1151
|
+
/** 404. */
|
|
1152
|
+
declare class NotFoundError extends APIError {}
|
|
1153
|
+
/** 409. */
|
|
1154
|
+
declare class ConflictError extends APIError {}
|
|
1155
|
+
/** 429. `retryAfter` is the server's hint in ms. */
|
|
1156
|
+
declare class RateLimitError extends APIError {}
|
|
1157
|
+
/** 429 with `shared_traffic_limit_reached`. */
|
|
1158
|
+
declare class SharedTrafficLimitError extends APIError {}
|
|
1159
|
+
/** 429 with `premium_traffic_limit_reached`. */
|
|
1160
|
+
declare class PremiumTrafficLimitError extends APIError {}
|
|
1161
|
+
/** 429 with `monthly_session_limit_reached`. */
|
|
1162
|
+
declare class MonthlySessionLimitError extends APIError {}
|
|
1163
|
+
/** 5xx. */
|
|
1164
|
+
declare class ServerError extends APIError {}
|
|
1165
|
+
/** An error reply to a CDP command, or a lost connection. */
|
|
1166
|
+
declare class CDPError extends SurfskyError {
|
|
1167
|
+
readonly code: number | undefined;
|
|
1168
|
+
constructor(message: string, options?: {
|
|
1169
|
+
code?: number;
|
|
1170
|
+
cause?: unknown;
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
/** A browser wait or command ran out of time. */
|
|
1174
|
+
declare class BrowserTimeoutError extends SurfskyError {}
|
|
1175
|
+
/** The page is gone. */
|
|
1176
|
+
declare class PageClosedError extends SurfskyError {}
|
|
1177
|
+
//#endregion
|
|
1178
|
+
//#region src/transport.d.ts
|
|
1179
|
+
type Params = Record<string, string | number | boolean | undefined>;
|
|
1180
|
+
/** One API call: the request plus how to read its reply. */
|
|
1181
|
+
interface Spec<T> {
|
|
1182
|
+
method: string;
|
|
1183
|
+
path: string;
|
|
1184
|
+
json?: unknown;
|
|
1185
|
+
params?: Params;
|
|
1186
|
+
body?: BodyInit;
|
|
1187
|
+
parse?: (data: any) => T;
|
|
1188
|
+
acceptError?: (status: number, body: unknown) => boolean;
|
|
1189
|
+
timeout?: number;
|
|
1190
|
+
}
|
|
1191
|
+
interface Logger {
|
|
1192
|
+
debug(message: string): void;
|
|
1193
|
+
info(message: string): void;
|
|
1194
|
+
warn(message: string): void;
|
|
1195
|
+
error(message: string): void;
|
|
1196
|
+
}
|
|
1197
|
+
//#endregion
|
|
1198
|
+
//#region src/browser/cdp.d.ts
|
|
1199
|
+
/** What the client needs from a socket; the native `WebSocket` fits. */
|
|
1200
|
+
interface WebSocketLike {
|
|
1201
|
+
readonly readyState: number;
|
|
1202
|
+
send(data: string): void;
|
|
1203
|
+
close(code?: number, reason?: string): void;
|
|
1204
|
+
addEventListener(type: string, listener: (event: any) => void): void;
|
|
1205
|
+
}
|
|
1206
|
+
type CreateWebSocket = (url: string) => WebSocketLike;
|
|
1207
|
+
type EventHandler = (params: any, sessionId: string | undefined) => void;
|
|
1208
|
+
interface CDPClientOptions {
|
|
1209
|
+
createWebSocket?: CreateWebSocket;
|
|
1210
|
+
onClose?: () => void;
|
|
1211
|
+
logger?: Partial<Logger> | null;
|
|
1212
|
+
}
|
|
1213
|
+
declare class CDPClient {
|
|
1214
|
+
#private;
|
|
1215
|
+
readonly wsUrl: string;
|
|
1216
|
+
onClose: (() => void) | undefined;
|
|
1217
|
+
constructor(wsUrl: string, options?: CDPClientOptions);
|
|
1218
|
+
get connected(): boolean;
|
|
1219
|
+
start(): Promise<void>;
|
|
1220
|
+
stop(): Promise<void>;
|
|
1221
|
+
on(event: string, handler: EventHandler): void;
|
|
1222
|
+
/** Put a command on the wire and hand back its reply to await later. */
|
|
1223
|
+
post(method: string, params?: Record<string, unknown>, sessionId?: string): {
|
|
1224
|
+
id: number;
|
|
1225
|
+
reply: Promise<any>;
|
|
1226
|
+
};
|
|
1227
|
+
/** Drop a posted command nobody is going to await. */
|
|
1228
|
+
forget(id: number): void;
|
|
1229
|
+
send(method: string, params?: Record<string, unknown>, sessionId?: string): Promise<any>;
|
|
1230
|
+
}
|
|
1231
|
+
//#endregion
|
|
1232
|
+
//#region src/util.d.ts
|
|
1233
|
+
/** A one-shot event: `wait()` resolves once `set()` was called. */
|
|
1234
|
+
declare class Flag {
|
|
1235
|
+
#private;
|
|
1236
|
+
get isSet(): boolean;
|
|
1237
|
+
set(): void;
|
|
1238
|
+
wait(): Promise<void>;
|
|
1239
|
+
}
|
|
1240
|
+
//#endregion
|
|
1241
|
+
//#region src/browser/page.d.ts
|
|
1242
|
+
type DialogHandler = (kind: string, message: string) => boolean | string | null | undefined;
|
|
1243
|
+
interface GotoOptions {
|
|
1244
|
+
waitUntil?: WaitUntil;
|
|
1245
|
+
/** ms */
|
|
1246
|
+
timeout?: number;
|
|
1247
|
+
}
|
|
1248
|
+
interface WaitOptions {
|
|
1249
|
+
/** ms */
|
|
1250
|
+
timeout?: number;
|
|
1251
|
+
}
|
|
1252
|
+
interface EvaluateOptions {
|
|
1253
|
+
args?: unknown[];
|
|
1254
|
+
/** The isolated world the page cannot see (default), or the page's own context. */
|
|
1255
|
+
isolated?: boolean;
|
|
1256
|
+
awaitPromise?: boolean;
|
|
1257
|
+
}
|
|
1258
|
+
interface ScreenshotOptions {
|
|
1259
|
+
selector?: string;
|
|
1260
|
+
fullPage?: boolean;
|
|
1261
|
+
format?: "png" | "jpeg" | "webp";
|
|
1262
|
+
quality?: number;
|
|
1263
|
+
}
|
|
1264
|
+
/** A wait's time budget: poll loops `check()` it, single awaits `race()` against it. `null` is no limit. */
|
|
1265
|
+
declare class Deadline {
|
|
1266
|
+
readonly timeout: number | null;
|
|
1267
|
+
readonly message: string;
|
|
1268
|
+
readonly until: number;
|
|
1269
|
+
constructor(timeout: number | null | undefined, message: string);
|
|
1270
|
+
error(): BrowserTimeoutError;
|
|
1271
|
+
check(): void;
|
|
1272
|
+
race<T>(promise: Promise<T>): Promise<T>;
|
|
1273
|
+
}
|
|
1274
|
+
declare class CapturedResponse {
|
|
1275
|
+
readonly url: string;
|
|
1276
|
+
readonly status: number;
|
|
1277
|
+
readonly headers: Record<string, string>;
|
|
1278
|
+
readonly body: Uint8Array;
|
|
1279
|
+
constructor(url: string, status: number, headers: Record<string, string>, body: Uint8Array);
|
|
1280
|
+
get text(): string;
|
|
1281
|
+
json(): any;
|
|
1282
|
+
}
|
|
1283
|
+
/** The lifecycle wait of one `goto`. */
|
|
1284
|
+
declare class NavWaiter {
|
|
1285
|
+
readonly milestone: string;
|
|
1286
|
+
readonly done: Flag;
|
|
1287
|
+
error: string | undefined;
|
|
1288
|
+
loaderId: string | undefined;
|
|
1289
|
+
readonly created: string[];
|
|
1290
|
+
readonly reached: Set<string>;
|
|
1291
|
+
constructor(milestone: string);
|
|
1292
|
+
follow(loaderId: string): boolean;
|
|
1293
|
+
followNewest(): boolean;
|
|
1294
|
+
observe(name: unknown, loaderId: unknown): void;
|
|
1295
|
+
fail(reason: string): void;
|
|
1296
|
+
}
|
|
1297
|
+
/** One page target. `Browser` is the session's first page plus the connection. */
|
|
1298
|
+
declare class Page extends Actions {
|
|
1299
|
+
#private;
|
|
1300
|
+
/** @internal */ _browser: Browser;
|
|
1301
|
+
/** @internal */ _targetId: string;
|
|
1302
|
+
/** @internal */ _sessionId: string;
|
|
1303
|
+
/** @internal */ _frameId: string;
|
|
1304
|
+
/** @internal */ _closed: boolean;
|
|
1305
|
+
/** Answers this page's dialogs; the browser's handler when unset. */
|
|
1306
|
+
onDialog: DialogHandler | null;
|
|
1307
|
+
/** @internal the main frame's newest document */
|
|
1308
|
+
_loaderId: string | undefined;
|
|
1309
|
+
/** @internal the lifecycle events it reached */
|
|
1310
|
+
_milestones: Set<string>;
|
|
1311
|
+
/** @internal the isolated world's context */
|
|
1312
|
+
_worldId: number | undefined;
|
|
1313
|
+
/** @internal commands wait for the setup */
|
|
1314
|
+
_ready: Flag;
|
|
1315
|
+
/** @internal */ _setupError: unknown;
|
|
1316
|
+
/** @internal */ _waiter: NavWaiter | undefined;
|
|
1317
|
+
/** @internal */ _status: number | undefined;
|
|
1318
|
+
/** @internal */ _storageReady: boolean;
|
|
1319
|
+
/** @internal */ _captures: string[];
|
|
1320
|
+
/** @internal */ _responses: CapturedResponse[];
|
|
1321
|
+
/** @internal */ _inFlight: Map<string, Record<string, unknown>>;
|
|
1322
|
+
constructor(browser: Browser | undefined, targetId: string, sessionId: string);
|
|
1323
|
+
/** @internal fresh page state; the browser reuses it on connect */
|
|
1324
|
+
_reset(targetId: string, sessionId: string): void;
|
|
1325
|
+
get cdp(): CDPClient;
|
|
1326
|
+
get targetId(): string;
|
|
1327
|
+
get closed(): boolean;
|
|
1328
|
+
get status(): number | undefined;
|
|
1329
|
+
send(method: string, params?: Record<string, unknown>): Promise<any>;
|
|
1330
|
+
/** @internal */
|
|
1331
|
+
_requireOpen(): void;
|
|
1332
|
+
/** @internal */
|
|
1333
|
+
_send(method: string, params?: Record<string, unknown>): Promise<any>;
|
|
1334
|
+
/** @internal */
|
|
1335
|
+
_waitReady(): Promise<void>;
|
|
1336
|
+
/** @internal */
|
|
1337
|
+
_setup(waiting: boolean): Promise<void>;
|
|
1338
|
+
close(): Promise<void>;
|
|
1339
|
+
bringToFront(): Promise<void>;
|
|
1340
|
+
waitForLoadState(state?: WaitUntil, options?: WaitOptions): Promise<void>;
|
|
1341
|
+
goto(url: string, options?: GotoOptions): Promise<void>;
|
|
1342
|
+
reload(options?: GotoOptions): Promise<void>;
|
|
1343
|
+
goBack(options?: WaitOptions): Promise<string | null>;
|
|
1344
|
+
goForward(options?: WaitOptions): Promise<string | null>;
|
|
1345
|
+
get responses(): CapturedResponse[];
|
|
1346
|
+
/** Record responses whose URL contains a fragment. Call before navigating. */
|
|
1347
|
+
captureResponses(...fragments: string[]): Promise<void>;
|
|
1348
|
+
stopCapturing(): Promise<void>;
|
|
1349
|
+
waitForResponse(fragment: string, options?: WaitOptions): Promise<CapturedResponse>;
|
|
1350
|
+
/** @internal */
|
|
1351
|
+
_onResponse(event: Record<string, any>): void;
|
|
1352
|
+
/** @internal */
|
|
1353
|
+
_onBodyReady(event: Record<string, any>): void;
|
|
1354
|
+
localStorage(): Promise<Record<string, string>>;
|
|
1355
|
+
setLocalStorage(values: Record<string, string>): Promise<void>;
|
|
1356
|
+
sessionStorage(): Promise<Record<string, string>>;
|
|
1357
|
+
setSessionStorage(values: Record<string, string>): Promise<void>;
|
|
1358
|
+
clearCookies(): Promise<void>;
|
|
1359
|
+
/**
|
|
1360
|
+
* Run script in the page. A function (or a string that looks like one) is called
|
|
1361
|
+
* with `args` as JSON; anything else is an expression. It runs in an isolated world:
|
|
1362
|
+
* the page's DOM, but not its globals, so the page's own script cannot see the call
|
|
1363
|
+
* or hook it. Page variables (`window.__data`) need `isolated: false`, the main
|
|
1364
|
+
* world, where a site that hooks the natives can notice.
|
|
1365
|
+
*/
|
|
1366
|
+
evaluate(expression: string | ((...args: any[]) => unknown), options?: EvaluateOptions): Promise<any>;
|
|
1367
|
+
/** Poll until the expression is truthy. Returns the value. */
|
|
1368
|
+
waitForFunction(expression: string | ((...args: any[]) => unknown), options?: EvaluateOptions & WaitOptions): Promise<any>;
|
|
1369
|
+
innerText(selector: string): Promise<string | null>;
|
|
1370
|
+
allInnerTexts(selector: string): Promise<string[]>;
|
|
1371
|
+
getAttribute(selector: string, name: string): Promise<string | null>;
|
|
1372
|
+
count(selector: string): Promise<number>;
|
|
1373
|
+
selectOption(selector: string, option: string | {
|
|
1374
|
+
value?: string;
|
|
1375
|
+
label?: string;
|
|
1376
|
+
}): Promise<string>;
|
|
1377
|
+
waitForSelector(selector: string, options?: {
|
|
1378
|
+
visible?: boolean;
|
|
1379
|
+
} & WaitOptions): Promise<void>;
|
|
1380
|
+
/** Wait until the URL contains the fragment. Returns the URL. */
|
|
1381
|
+
waitForUrl(fragment: string, options?: WaitOptions): Promise<string>;
|
|
1382
|
+
/** The first match has a bounding box. */
|
|
1383
|
+
isVisible(selector: string): Promise<boolean>;
|
|
1384
|
+
outerHtml(selector: string): Promise<string | null>;
|
|
1385
|
+
setCookies(cookies: (Cookie | Record<string, unknown>)[]): Promise<void>;
|
|
1386
|
+
content(): Promise<string>;
|
|
1387
|
+
title(): Promise<string>;
|
|
1388
|
+
url(): Promise<string>;
|
|
1389
|
+
cookies(): Promise<Cookie[]>;
|
|
1390
|
+
screenshot(options?: ScreenshotOptions): Promise<Uint8Array>;
|
|
1391
|
+
/** @internal */
|
|
1392
|
+
_onLifecycle(event: Record<string, any>): void;
|
|
1393
|
+
/** @internal */
|
|
1394
|
+
_onDialog(event: Record<string, any>): void;
|
|
1395
|
+
/** @internal */
|
|
1396
|
+
_onRequestPaused(event: Record<string, any>): void;
|
|
1397
|
+
/** @internal */
|
|
1398
|
+
_spawn(task: Promise<unknown>): void;
|
|
1399
|
+
}
|
|
1400
|
+
//#endregion
|
|
1401
|
+
//#region src/browser/browser.d.ts
|
|
1402
|
+
declare const RESOURCE_TYPES: Readonly<Record<string, string>>;
|
|
1403
|
+
interface BrowserOptions {
|
|
1404
|
+
blockResources?: Iterable<string> | null;
|
|
1405
|
+
blockUrls?: readonly string[] | null;
|
|
1406
|
+
connectTimeout?: number;
|
|
1407
|
+
commandTimeout?: number | null;
|
|
1408
|
+
createWebSocket?: CreateWebSocket;
|
|
1409
|
+
logger?: Partial<Logger> | null;
|
|
1410
|
+
onClose?: () => Promise<void> | void;
|
|
1411
|
+
}
|
|
1412
|
+
/** A connected cloud browser, and the page its session started with. */
|
|
1413
|
+
declare class Browser extends Page implements AsyncDisposable {
|
|
1414
|
+
#private;
|
|
1415
|
+
readonly session: Session;
|
|
1416
|
+
readonly data: Record<string, unknown>;
|
|
1417
|
+
readonly blockedResources: ReadonlySet<string>;
|
|
1418
|
+
readonly blockedUrls: readonly string[];
|
|
1419
|
+
readonly connectTimeout: number;
|
|
1420
|
+
readonly commandTimeout: number | null;
|
|
1421
|
+
readonly logger: Logger;
|
|
1422
|
+
/** @internal */ _pages: Map<string, Page>;
|
|
1423
|
+
/** @internal aborts on close: background sleeps end early */
|
|
1424
|
+
_signal: AbortSignal;
|
|
1425
|
+
constructor(session: Session, options?: BrowserOptions);
|
|
1426
|
+
get internalUuid(): string;
|
|
1427
|
+
get cdp(): CDPClient;
|
|
1428
|
+
get connected(): boolean;
|
|
1429
|
+
get shouldRecycle(): boolean;
|
|
1430
|
+
/**
|
|
1431
|
+
* Leases so far, the current one included. Rotate the browser from your own loop:
|
|
1432
|
+
*
|
|
1433
|
+
* if (browser.useCount >= 20) browser.retire();
|
|
1434
|
+
*/
|
|
1435
|
+
get useCount(): number;
|
|
1436
|
+
/** @internal */
|
|
1437
|
+
_lease(): void;
|
|
1438
|
+
get pages(): Page[];
|
|
1439
|
+
/** @internal what a page's Fetch.enable intercepts */
|
|
1440
|
+
get _fetchPatterns(): Record<string, unknown>[];
|
|
1441
|
+
/** Replace this browser with a fresh one after the lease. */
|
|
1442
|
+
retire(): void;
|
|
1443
|
+
newPage(): Promise<Page>;
|
|
1444
|
+
/**
|
|
1445
|
+
* Run `action`, the click that opens a window, and return the page it opened:
|
|
1446
|
+
*
|
|
1447
|
+
* const popup = await browser.waitForPage(browser.click("a[target=_blank]"));
|
|
1448
|
+
*
|
|
1449
|
+
* A site can open the window after an async step, so `pages` right after the
|
|
1450
|
+
* click may not have it yet.
|
|
1451
|
+
*/
|
|
1452
|
+
waitForPage(action: Promise<unknown> | (() => Promise<unknown>), options?: WaitOptions): Promise<Page>;
|
|
1453
|
+
connect(): Promise<void>;
|
|
1454
|
+
close(): Promise<void>;
|
|
1455
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
1456
|
+
/** @internal a lease ends: other pages closed, captures dropped, dialogs reset; `data` stays */
|
|
1457
|
+
_endLease(): Promise<void>;
|
|
1458
|
+
/** @internal */
|
|
1459
|
+
_pageReady(targetId: string, deadline: Deadline): Promise<Page>;
|
|
1460
|
+
/** @internal */
|
|
1461
|
+
_onAttached(event: Record<string, any>): void;
|
|
1462
|
+
/** @internal */
|
|
1463
|
+
_onDetached(event: Record<string, any>): void;
|
|
1464
|
+
/** @internal */
|
|
1465
|
+
_drop(page: Page): void;
|
|
1466
|
+
/** @internal */
|
|
1467
|
+
_onDisconnect(): void;
|
|
1468
|
+
/** @internal track a background task; its failure is logged at debug level */
|
|
1469
|
+
_spawn(task: Promise<unknown>): void;
|
|
1470
|
+
}
|
|
1471
|
+
//#endregion
|
|
1472
|
+
//#region src/resources/account.d.ts
|
|
1473
|
+
declare class Account {
|
|
1474
|
+
#private;
|
|
1475
|
+
readonly client: Surfsky;
|
|
1476
|
+
constructor(client: Surfsky);
|
|
1477
|
+
sessionLimits(): Promise<SessionLimits>;
|
|
1478
|
+
browserLimits(): Promise<BrowserLimits>;
|
|
1479
|
+
/** The plan's parallel-browser cap; `SURFSKY_MAX_BROWSERS` overrides it. */
|
|
1480
|
+
maxBrowsers(): Promise<number>;
|
|
1481
|
+
}
|
|
1482
|
+
//#endregion
|
|
1483
|
+
//#region src/resources/extensions.d.ts
|
|
1484
|
+
type ExtensionFile = string | Uint8Array | Blob;
|
|
1485
|
+
declare class Extensions {
|
|
1486
|
+
readonly client: Surfsky;
|
|
1487
|
+
constructor(client: Surfsky);
|
|
1488
|
+
/** Upload a zip (max 100 MB) given as a path, bytes or a Blob. */
|
|
1489
|
+
upload(file: ExtensionFile, name: string): Promise<Extension>;
|
|
1490
|
+
listAll(): Promise<Extension[]>;
|
|
1491
|
+
get(uuid: string): Promise<Extension>;
|
|
1492
|
+
update(uuid: string, options: {
|
|
1493
|
+
name: string;
|
|
1494
|
+
}): Promise<Extension>;
|
|
1495
|
+
delete(uuid: string): Promise<void>;
|
|
1496
|
+
}
|
|
1497
|
+
//#endregion
|
|
1498
|
+
//#region src/resources/fingerprints.d.ts
|
|
1499
|
+
interface DeviceModelsOptions {
|
|
1500
|
+
os?: OS;
|
|
1501
|
+
os_arch?: Arch;
|
|
1502
|
+
os_version?: string;
|
|
1503
|
+
device_type?: DeviceType;
|
|
1504
|
+
}
|
|
1505
|
+
declare class Fingerprints {
|
|
1506
|
+
readonly client: Surfsky;
|
|
1507
|
+
constructor(client: Surfsky);
|
|
1508
|
+
renderers(os: OS, osArch: Arch): Promise<Renderer[]>;
|
|
1509
|
+
screens(os: OS, osArch: Arch): Promise<Screen[]>;
|
|
1510
|
+
deviceModels(options?: DeviceModelsOptions): Promise<DeviceModel[]>;
|
|
1511
|
+
}
|
|
1512
|
+
//#endregion
|
|
1513
|
+
//#region src/proxy.d.ts
|
|
1514
|
+
interface ProxySource {
|
|
1515
|
+
pick(): ProxyLike | null | Promise<ProxyLike | null>;
|
|
1516
|
+
}
|
|
1517
|
+
type ProxyFactory = () => ProxyLike | null | Promise<ProxyLike | null>;
|
|
1518
|
+
type ProxyInput = ProxyLike | ProxySource | ProxyFactory;
|
|
1519
|
+
/** Round-robin over a list. */
|
|
1520
|
+
declare class ProxyCycle implements ProxySource {
|
|
1521
|
+
#private;
|
|
1522
|
+
readonly proxies: ProxyLike[];
|
|
1523
|
+
constructor(proxies: Iterable<ProxyLike>);
|
|
1524
|
+
pick(): ProxyLike;
|
|
1525
|
+
}
|
|
1526
|
+
declare class ProxyRandom implements ProxySource {
|
|
1527
|
+
readonly proxies: ProxyLike[];
|
|
1528
|
+
constructor(proxies: Iterable<ProxyLike>);
|
|
1529
|
+
pick(): ProxyLike;
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* A proxy URL from a template: `{session}` is a fresh hex id, `{n}` a counter.
|
|
1533
|
+
* Covers the sticky-session syntax providers put in the username:
|
|
1534
|
+
*
|
|
1535
|
+
* new ProxyTemplate("http://user-cc-us-sessid-{session}:pw@gate.example.com:7000")
|
|
1536
|
+
*
|
|
1537
|
+
* Literal braces are `{{` and `}}`.
|
|
1538
|
+
*/
|
|
1539
|
+
declare class ProxyTemplate implements ProxySource {
|
|
1540
|
+
#private;
|
|
1541
|
+
readonly template: string;
|
|
1542
|
+
constructor(template: string);
|
|
1543
|
+
pick(): string;
|
|
1544
|
+
}
|
|
1545
|
+
//#endregion
|
|
1546
|
+
//#region src/resources/profiles.d.ts
|
|
1547
|
+
type WithProxyInput<T> = Omit<T, "proxy"> & {
|
|
1548
|
+
proxy?: ProxyInput | null;
|
|
1549
|
+
};
|
|
1550
|
+
type SessionOptions = WithProxyInput<OneTimeStartRequest>;
|
|
1551
|
+
type ProfileUpdate = WithProxyInput<ProfileUpdateRequest>;
|
|
1552
|
+
type ProfileCreate = WithProxyInput<ProfileCreateRequest>;
|
|
1553
|
+
type ScrapeOptions = Omit<ScrapeRequest, "url">;
|
|
1554
|
+
type ListPageOptions = ListPageRequest;
|
|
1555
|
+
declare class Profiles {
|
|
1556
|
+
readonly client: Surfsky;
|
|
1557
|
+
constructor(client: Surfsky);
|
|
1558
|
+
/** Start a session on a fresh browser that is gone once stopped. */
|
|
1559
|
+
startOneTime(options?: SessionOptions): Promise<Session>;
|
|
1560
|
+
/** Start a session on a saved profile. */
|
|
1561
|
+
start(uuid: string, options?: SessionOptions): Promise<Session>;
|
|
1562
|
+
stop(session: Session | string): Promise<ProfileRef | null>;
|
|
1563
|
+
stopAll(): Promise<StopAllResult>;
|
|
1564
|
+
listActive(): Promise<ActiveProfile[]>;
|
|
1565
|
+
create(options: ProfileCreate): Promise<ProfileRef>;
|
|
1566
|
+
get(uuid: string): Promise<Profile>;
|
|
1567
|
+
update(uuid: string, fields: ProfileUpdate): Promise<Profile>;
|
|
1568
|
+
delete(uuid: string): Promise<ProfileRef>;
|
|
1569
|
+
deleteMany(uuids: string[]): Promise<BatchDeleteResult>;
|
|
1570
|
+
listPage(options?: ListPageOptions): Promise<ProfileSummary[]>;
|
|
1571
|
+
/** Every profile, page by page. */
|
|
1572
|
+
iterAll(options?: Omit<ListPageOptions, "page">): AsyncGenerator<ProfileSummary, void, undefined>;
|
|
1573
|
+
exportCookies(uuid: string, options?: {
|
|
1574
|
+
export_format?: "json";
|
|
1575
|
+
}): Promise<Cookie[]>;
|
|
1576
|
+
exportCookies(uuid: string, options: {
|
|
1577
|
+
export_format: "netscape";
|
|
1578
|
+
}): Promise<string>;
|
|
1579
|
+
importCookies(uuid: string, cookies: string | Cookie[]): Promise<void>;
|
|
1580
|
+
scrape(session: Session | string, url: string, options?: ScrapeOptions): Promise<ScrapeResult>;
|
|
1581
|
+
}
|
|
1582
|
+
//#endregion
|
|
1583
|
+
//#region src/resources/proxies.d.ts
|
|
1584
|
+
declare class Proxies {
|
|
1585
|
+
readonly client: Surfsky;
|
|
1586
|
+
constructor(client: Surfsky);
|
|
1587
|
+
countries(): Promise<ProxyCountry[]>;
|
|
1588
|
+
regions(country: string): Promise<ProxyRegion[]>;
|
|
1589
|
+
cities(country: string, region: string): Promise<ProxyCity[]>;
|
|
1590
|
+
quota(): Promise<ProxyQuota>;
|
|
1591
|
+
premiumStats(): Promise<TrafficStats>;
|
|
1592
|
+
sharedCountries(): Promise<string[]>;
|
|
1593
|
+
sharedQuota(): Promise<SharedProxyQuota>;
|
|
1594
|
+
sharedStats(): Promise<TrafficStats>;
|
|
1595
|
+
}
|
|
1596
|
+
//#endregion
|
|
1597
|
+
//#region src/client.d.ts
|
|
1598
|
+
interface SurfskyOptions {
|
|
1599
|
+
/** Falls back to `SURFSKY_API_TOKEN`. */
|
|
1600
|
+
apiToken?: string;
|
|
1601
|
+
/** Falls back to `SURFSKY_API_BASE_URL`. */
|
|
1602
|
+
baseUrl?: string;
|
|
1603
|
+
/** Per-request timeout in ms. Default 30_000. */
|
|
1604
|
+
timeout?: number;
|
|
1605
|
+
/** Default 3. */
|
|
1606
|
+
maxRetries?: number;
|
|
1607
|
+
/** Base retry delay in ms, doubled per attempt. Default 500. */
|
|
1608
|
+
backoff?: number;
|
|
1609
|
+
headers?: Record<string, string>;
|
|
1610
|
+
/** Warnings and errors go to the console by default; `null` silences the SDK. */
|
|
1611
|
+
logger?: Partial<Logger> | null;
|
|
1612
|
+
/** Mostly for tests. */
|
|
1613
|
+
fetch?: typeof fetch;
|
|
1614
|
+
}
|
|
1615
|
+
interface RequestOptions {
|
|
1616
|
+
json?: unknown;
|
|
1617
|
+
params?: Params;
|
|
1618
|
+
body?: BodyInit;
|
|
1619
|
+
headers?: Record<string, string>;
|
|
1620
|
+
timeout?: number;
|
|
1621
|
+
}
|
|
1622
|
+
interface SessionStartOptions extends SessionOptions {
|
|
1623
|
+
/** A saved profile to start; a one-time session when absent. */
|
|
1624
|
+
profileUuid?: string;
|
|
1625
|
+
}
|
|
1626
|
+
interface BrowserStartOptions extends SessionStartOptions {
|
|
1627
|
+
/** CDP resource types to drop: `["image", "font", "media"]` saves proxy traffic. */
|
|
1628
|
+
blockResources?: Iterable<string> | null;
|
|
1629
|
+
/** Fetch URL patterns to drop (`*` wildcards). */
|
|
1630
|
+
blockUrls?: readonly string[] | null;
|
|
1631
|
+
/** ms, default 30_000 */
|
|
1632
|
+
connectTimeout?: number;
|
|
1633
|
+
/** ms per CDP command, default 60_000; `null` for none */
|
|
1634
|
+
commandTimeout?: number | null;
|
|
1635
|
+
createWebSocket?: CreateWebSocket;
|
|
1636
|
+
}
|
|
1637
|
+
/** A started session that stops itself on `stop()` or `await using`. */
|
|
1638
|
+
type ManagedSession = Session & AsyncDisposable & {
|
|
1639
|
+
stop(): Promise<void>;
|
|
1640
|
+
};
|
|
1641
|
+
declare class Surfsky implements AsyncDisposable {
|
|
1642
|
+
#private;
|
|
1643
|
+
readonly baseUrl: string;
|
|
1644
|
+
readonly headers: Record<string, string>;
|
|
1645
|
+
readonly timeout: number;
|
|
1646
|
+
readonly maxRetries: number;
|
|
1647
|
+
readonly backoff: number;
|
|
1648
|
+
readonly logger: Logger;
|
|
1649
|
+
readonly fetch: typeof fetch;
|
|
1650
|
+
readonly profiles: Profiles;
|
|
1651
|
+
readonly proxies: Proxies;
|
|
1652
|
+
readonly fingerprints: Fingerprints;
|
|
1653
|
+
readonly extensions: Extensions;
|
|
1654
|
+
readonly account: Account;
|
|
1655
|
+
constructor(options?: SurfskyOptions);
|
|
1656
|
+
withOptions(options: {
|
|
1657
|
+
timeout?: number;
|
|
1658
|
+
maxRetries?: number;
|
|
1659
|
+
headers?: Record<string, string>;
|
|
1660
|
+
}): Surfsky;
|
|
1661
|
+
call<T>(spec: Spec<T>): Promise<T>;
|
|
1662
|
+
/** A raw call for endpoints the SDK does not cover. Never throws on status. */
|
|
1663
|
+
request(method: string, path: string, options?: RequestOptions): Promise<Response>;
|
|
1664
|
+
/** Start a session; `stop()` it (or `await using`) so it does not keep billing. */
|
|
1665
|
+
session(options?: SessionStartOptions): Promise<ManagedSession>;
|
|
1666
|
+
/** Start a session and connect a `Browser` to it. `close()` stops the session. */
|
|
1667
|
+
browser(options?: BrowserStartOptions): Promise<Browser>;
|
|
1668
|
+
/** An open `BrowserPool`. `close()` stops every browser in it. */
|
|
1669
|
+
browsers(options?: PoolOptions): Promise<BrowserPool>;
|
|
1670
|
+
/** `browsers()` and `pool.map()` in 1 call. */
|
|
1671
|
+
map<I, R>(handler: PoolHandler<I, R>, items: Iterable<I>, options?: PoolOptions): Promise<PoolOutcome<I, R>[]>;
|
|
1672
|
+
/** Nothing to release with fetch; here for `await using` symmetry. */
|
|
1673
|
+
close(): Promise<void>;
|
|
1674
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
1675
|
+
}
|
|
1676
|
+
//#endregion
|
|
1677
|
+
//#region src/browser/pool.d.ts
|
|
1678
|
+
type PoolHandler<I, R> = (browser: Browser, item: I) => Promise<R>;
|
|
1679
|
+
interface PoolOptions extends SessionOptions {
|
|
1680
|
+
/** Live browsers at most; `"auto"` (default) is the plan's cap. */
|
|
1681
|
+
concurrency?: number | "auto";
|
|
1682
|
+
blockResources?: Iterable<string> | null;
|
|
1683
|
+
blockUrls?: readonly string[] | null;
|
|
1684
|
+
createWebSocket?: CreateWebSocket;
|
|
1685
|
+
}
|
|
1686
|
+
/** Throw from a `map` handler to end the run after this item. */
|
|
1687
|
+
declare class StopRun extends Error {
|
|
1688
|
+
constructor(message?: string);
|
|
1689
|
+
}
|
|
1690
|
+
type PoolOutcome<I, R> = {
|
|
1691
|
+
ok: true;
|
|
1692
|
+
item: I;
|
|
1693
|
+
index: number;
|
|
1694
|
+
value: R;
|
|
1695
|
+
} | {
|
|
1696
|
+
ok: false;
|
|
1697
|
+
item: I;
|
|
1698
|
+
index: number;
|
|
1699
|
+
error: unknown;
|
|
1700
|
+
};
|
|
1701
|
+
declare class BrowserPool implements AsyncDisposable {
|
|
1702
|
+
#private;
|
|
1703
|
+
readonly sessionOptions: SessionOptions;
|
|
1704
|
+
readonly blockedResources: ReadonlySet<string>;
|
|
1705
|
+
readonly blockedUrls: readonly string[];
|
|
1706
|
+
constructor(client: Surfsky, options?: PoolOptions);
|
|
1707
|
+
/** Max live browsers. */
|
|
1708
|
+
get capacity(): number;
|
|
1709
|
+
open(): Promise<this>;
|
|
1710
|
+
/** Stop every idle browser. A browser still on lease is stopped when its lease ends. */
|
|
1711
|
+
close(): Promise<void>;
|
|
1712
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
1713
|
+
/** Run `fn` on a live browser, then hand the browser back. Waits while all are busy. */
|
|
1714
|
+
lease<R>(fn: (browser: Browser) => Promise<R>): Promise<R>;
|
|
1715
|
+
/** Run every item through `handler` on a leased browser, `capacity` at a time. */
|
|
1716
|
+
map<I, R>(handler: PoolHandler<I, R>, items: Iterable<I>): Promise<PoolOutcome<I, R>[]>;
|
|
1717
|
+
}
|
|
1718
|
+
//#endregion
|
|
1719
|
+
//#region src/version.d.ts
|
|
1720
|
+
declare const VERSION: string;
|
|
1721
|
+
//#endregion
|
|
1722
|
+
export { APIConnectionError, APIError, APIErrorOptions, APITimeoutError, Account, Actions, type ActiveProfile, type Arch, AuthenticationError, BadRequestError, type BatchDeleteResult, Browser, type BrowserLimits, type BrowserOptions, BrowserPool, type BrowserSettings, type BrowserStartOptions, BrowserTimeoutError, CDPClient, type CDPClientOptions, CDPError, CapturedResponse, type ClickOptions, ConfigurationError, ConflictError, type Cookie, type CookieInput, type CreateWebSocket, type DblclickOptions, type DeviceModel, type DeviceModelsOptions, type DeviceType, type DialogHandler, type DomainRoute, type DragOptions, type EvaluateOptions, type EventHandler, type ExportFormat, type Extension, type ExtensionFile, Extensions, type Fingerprint, Fingerprints, ForbiddenError, type Geolocation, type GotoOptions, type HoverOptions, type Inspector, type InspectorPage, type KeyModifier, Keyboard, type ListPageOptions, type ListPageRequest, type Logger, type Loose, type ManagedSession, type MediaDevices, MonthlySessionLimitError, Mouse, type MouseButton, type MouseClickOptions, type Noise, NotFoundError, type OS, type OneTimeStartRequest, Page, PageClosedError, PaymentRequiredError, type PoolHandler, type PoolOptions, type PoolOutcome, type PremiumProxy, PremiumTrafficLimitError, type PressOptions, type Profile, type ProfileCreate, type ProfileCreateRequest, type ProfileOrdering, type ProfileRef, type ProfileStartRequest, type ProfileSummary, type ProfileUpdate, type ProfileUpdateRequest, Profiles, Proxies, type ProxyCity, type ProxyCountry, ProxyCycle, type ProxyFactory, type ProxyInput, type ProxyLike, type ProxyQuota, ProxyRandom, type ProxyRegion, type ProxySource, ProxyTemplate, type ProxyType, RESOURCE_TYPES, RateLimitError, type RegionalPool, type Renderer, type RequestOptions, type ScrapeOptions, type ScrapeRequest, type ScrapeResult, type Screen, type ScreenshotOptions, type ScrollBehavior, type ScrollOptions, type ScrollToOptions, ServerError, type Session, type SessionLimits, type SessionOptions, type SessionStartOptions, type SharedProxy, type SharedProxyQuota, SharedTrafficLimitError, type Spec, type StopAllResult, StopRun, type StorageOptions, Surfsky, SurfskyError, type SurfskyOptions, type TrafficStats, type TrafficVolume, VERSION, ValidationError, type WaitOptions, type WaitUntil, type WebSocketLike, type isRecord, type parseListPageRequest, type parseOneTimeStartRequest, type parseProfileCreateRequest, type parseProfileStartRequest, type parseProfileUpdateRequest, type parseProxyLike, type parseScrapeRequest };
|