browserscale-ts 1.9.0 → 1.10.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/README.md +4 -2
- package/dist/browser.d.ts +1 -1
- package/dist/browserscale.browser.js +133 -46
- package/dist/client.d.ts +50 -1
- package/dist/client.js +89 -1
- package/dist/gen/wrc_pb.d.ts +118 -17
- package/dist/gen/wrc_pb.js +81 -71
- package/dist/index.d.ts +1 -1
- package/dist/internal/convert.js +4 -3
- package/dist/network-capture.d.ts +2 -2
- package/dist/network-capture.js +2 -2
- package/dist/types.d.ts +42 -14
- package/package.json +1 -1
package/dist/internal/convert.js
CHANGED
|
@@ -306,7 +306,8 @@ export function networkExchangeFromProto(e) {
|
|
|
306
306
|
initiatorUrl: e.initiatorUrl,
|
|
307
307
|
requestHeaders: e.requestHeaders.map(headerFromProto),
|
|
308
308
|
requestHeadersAreWire: e.requestHeadersAreWire,
|
|
309
|
-
|
|
309
|
+
requestBodyId: e.requestBodyId,
|
|
310
|
+
requestBodySize: Number(e.requestBodySize),
|
|
310
311
|
requestBodyTruncated: e.requestBodyTruncated,
|
|
311
312
|
hasResponse: e.hasResponse,
|
|
312
313
|
statusCode: e.statusCode,
|
|
@@ -317,9 +318,9 @@ export function networkExchangeFromProto(e) {
|
|
|
317
318
|
servedFrom: e.servedFrom,
|
|
318
319
|
responseHeaders: e.responseHeaders.map(headerFromProto),
|
|
319
320
|
responseHeadersAreWire: e.responseHeadersAreWire,
|
|
320
|
-
|
|
321
|
+
responseBodyId: e.responseBodyId,
|
|
322
|
+
responseBodySize: Number(e.responseBodySize),
|
|
321
323
|
responseBodyTruncated: e.responseBodyTruncated,
|
|
322
|
-
responseBodyCaptured: e.responseBodyCaptured,
|
|
323
324
|
encodedDataLength: Number(e.encodedDataLength),
|
|
324
325
|
error: e.error,
|
|
325
326
|
};
|
|
@@ -52,8 +52,8 @@ export declare class NetworkCapture {
|
|
|
52
52
|
get error(): Error | null;
|
|
53
53
|
/**
|
|
54
54
|
* How many exchanges the server discarded because this reader fell behind.
|
|
55
|
-
* Anything above zero means the log has holes: make the handler cheaper
|
|
56
|
-
* narrow `patterns
|
|
55
|
+
* Anything above zero means the log has holes: make the handler cheaper or
|
|
56
|
+
* narrow `patterns`.
|
|
57
57
|
*/
|
|
58
58
|
get dropped(): number;
|
|
59
59
|
/**
|
package/dist/network-capture.js
CHANGED
|
@@ -57,8 +57,8 @@ export class NetworkCapture {
|
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* How many exchanges the server discarded because this reader fell behind.
|
|
60
|
-
* Anything above zero means the log has holes: make the handler cheaper
|
|
61
|
-
* narrow `patterns
|
|
60
|
+
* Anything above zero means the log has holes: make the handler cheaper or
|
|
61
|
+
* narrow `patterns`.
|
|
62
62
|
*/
|
|
63
63
|
get dropped() {
|
|
64
64
|
return this.droppedCount;
|
package/dist/types.d.ts
CHANGED
|
@@ -142,10 +142,16 @@ export interface NetworkExchange {
|
|
|
142
142
|
*/
|
|
143
143
|
requestHeadersAreWire: boolean;
|
|
144
144
|
/**
|
|
145
|
-
*
|
|
146
|
-
*
|
|
145
|
+
* Names the request body; read it with {@link CloudBrowser.readNetworkBody}.
|
|
146
|
+
* Empty when the request had no body. Bodies never travel with the exchange.
|
|
147
|
+
*/
|
|
148
|
+
requestBodyId: string;
|
|
149
|
+
/** Bytes kept for the request body. */
|
|
150
|
+
requestBodySize: number;
|
|
151
|
+
/**
|
|
152
|
+
* Part of the request body is missing: it hit the per-body cap, or it was a
|
|
153
|
+
* file or streamed upload, which are not kept.
|
|
147
154
|
*/
|
|
148
|
-
requestBody: Uint8Array;
|
|
149
155
|
requestBodyTruncated: boolean;
|
|
150
156
|
/** False when the request failed before any response arrived; see error. */
|
|
151
157
|
hasResponse: boolean;
|
|
@@ -159,26 +165,49 @@ export interface NetworkExchange {
|
|
|
159
165
|
responseHeaders: Header[];
|
|
160
166
|
responseHeadersAreWire: boolean;
|
|
161
167
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
* Binary content does not survive the browser boundary intact — see
|
|
168
|
+
* Names the response body; read it with {@link CloudBrowser.readNetworkBody}.
|
|
169
|
+
* Empty when body capture did not apply to this exchange — see
|
|
165
170
|
* {@link NetworkCaptureOptions.bodies}.
|
|
166
171
|
*/
|
|
167
|
-
|
|
172
|
+
responseBodyId: string;
|
|
173
|
+
/** Bytes kept for the response body, after content decoding. */
|
|
174
|
+
responseBodySize: number;
|
|
175
|
+
/**
|
|
176
|
+
* The kept body is shorter than the one the page received: it hit the
|
|
177
|
+
* per-body cap or the load ended early.
|
|
178
|
+
*/
|
|
168
179
|
responseBodyTruncated: boolean;
|
|
169
|
-
responseBodyCaptured: boolean;
|
|
170
180
|
/** Bytes on the wire, not body size; 0 for a response served from cache. */
|
|
171
181
|
encodedDataLength: number;
|
|
172
182
|
/** Net error name (e.g. "net::ERR_ABORTED"), empty on success. */
|
|
173
183
|
error: string;
|
|
174
184
|
}
|
|
175
|
-
/**
|
|
185
|
+
/** One range of a captured body, from {@link CloudBrowser.readNetworkBodyRange}. */
|
|
186
|
+
export interface NetworkBodyRange {
|
|
187
|
+
/** The bytes read; empty past the end of the body. */
|
|
188
|
+
data: Uint8Array;
|
|
189
|
+
/** Bytes kept for the body as a whole. */
|
|
190
|
+
totalSize: number;
|
|
191
|
+
/** Matches the exchange's truncated flag for this body. */
|
|
192
|
+
truncated: boolean;
|
|
193
|
+
}
|
|
194
|
+
/** A whole captured body, from {@link CloudBrowser.readNetworkBody}. */
|
|
195
|
+
export interface NetworkBody {
|
|
196
|
+
data: Uint8Array;
|
|
197
|
+
/** The kept body is shorter than the original; see the exchange's flag. */
|
|
198
|
+
truncated: boolean;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Which response bodies a network capture keeps. Kept bodies are not part of
|
|
202
|
+
* the exchange; read them with {@link CloudBrowser.readNetworkBody}.
|
|
203
|
+
*/
|
|
176
204
|
export type NetworkBodies = "none" | "text" | "all";
|
|
177
205
|
/**
|
|
178
206
|
* Configures {@link CloudBrowser.captureNetwork}.
|
|
179
207
|
*
|
|
180
|
-
* There is deliberately no byte-cap option:
|
|
181
|
-
* machine shared with other sessions, so the server owns
|
|
208
|
+
* There is deliberately no byte-cap option: kept bodies are stored on a
|
|
209
|
+
* machine shared with other sessions, so the server owns the quota. When a
|
|
210
|
+
* session's bodies exceed it, the oldest are dropped first.
|
|
182
211
|
*/
|
|
183
212
|
export interface NetworkCaptureOptions {
|
|
184
213
|
/**
|
|
@@ -189,9 +218,8 @@ export interface NetworkCaptureOptions {
|
|
|
189
218
|
patterns?: string[];
|
|
190
219
|
/**
|
|
191
220
|
* Response-body capture. `"text"` keeps bodies whose MIME type is textual,
|
|
192
|
-
* `"all"` keeps every body
|
|
193
|
-
*
|
|
194
|
-
* the bodies are textual. Defaults to `"none"`, headers and status only.
|
|
221
|
+
* `"all"` keeps every body, binary included. Defaults to `"none"`, headers
|
|
222
|
+
* and status only. Request bodies are kept whenever a request has one.
|
|
195
223
|
*/
|
|
196
224
|
bodies?: NetworkBodies;
|
|
197
225
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browserscale-ts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Official SDK for browserscale — undetected stealth browsers in the cloud. Rent real Chromium sessions with unique fingerprints, built-in proxies, captcha solving, human-like input and live video — scale web scraping and automation without running a single browser yourself.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|