@solarisdk/browser 0.3.0 → 0.4.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/LICENSE +17 -13
- package/README.md +17 -1
- package/dist/index.d.ts +19 -0
- package/dist/index.js +2 -0
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
1
|
+
MIT License
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
Copyright (c) 2026 Solari
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -102,6 +102,22 @@ For staging or self-hosted gateways, pass `baseUrl` instead of `region`.
|
|
|
102
102
|
|
|
103
103
|
## Managed proxies
|
|
104
104
|
|
|
105
|
+
Proxy bandwidth is billed per GB, and pages heavy in video and images can cost tens of megabytes
|
|
106
|
+
per session. `blockHeavy` (off by default) skips them:
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
await solari.launch({
|
|
110
|
+
stealth: true,
|
|
111
|
+
proxy: "us",
|
|
112
|
+
blockHeavy: true, // video/audio + images over 100 KB; or { fonts: true, imageMaxBytes: 50_000 }
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Blocked requests fail inside the browser, so nothing is fetched and nothing leaves through a different
|
|
117
|
+
route; the page sees an ordinary failed load and the blocked image or video does not appear. Images that
|
|
118
|
+
declare no size, and requests made by service workers or cross-origin iframes, are not covered.
|
|
119
|
+
Replays still play: they load media from the original site.
|
|
120
|
+
|
|
105
121
|
```ts
|
|
106
122
|
await solari.launch({
|
|
107
123
|
stealth: true,
|
|
@@ -137,4 +153,4 @@ try {
|
|
|
137
153
|
|
|
138
154
|
## License
|
|
139
155
|
|
|
140
|
-
|
|
156
|
+
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -96,6 +96,16 @@ export interface Profile {
|
|
|
96
96
|
name: string;
|
|
97
97
|
[k: string]: unknown;
|
|
98
98
|
}
|
|
99
|
+
/** What `blockHeavy` skips. Every field is optional. */
|
|
100
|
+
export interface BlockHeavyOptions {
|
|
101
|
+
/** Block video and audio. Default true. */
|
|
102
|
+
media?: boolean;
|
|
103
|
+
/** Block web fonts. Default false (blocking fonts changes how the page renders and fingerprints). */
|
|
104
|
+
fonts?: boolean;
|
|
105
|
+
/** Block images whose declared size (Content-Length, as sent over the wire) exceeds this many bytes;
|
|
106
|
+
* `null` keeps every image. Default 102400 (100 KB). */
|
|
107
|
+
imageMaxBytes?: number | null;
|
|
108
|
+
}
|
|
99
109
|
export interface CreateSessionOptions {
|
|
100
110
|
/** Attach a stored browser profile (cookies + localStorage). */
|
|
101
111
|
profileId?: string;
|
|
@@ -125,6 +135,15 @@ export interface CreateSessionOptions {
|
|
|
125
135
|
* (`sessionTimeoutMs`, else an hour, never past the plan maximum) or until
|
|
126
136
|
* it is released, so a dropped client can reconnect. */
|
|
127
137
|
keepAlive?: boolean;
|
|
138
|
+
/** Skip heavy files so a proxied session does not pay proxy bandwidth for them. Off by default.
|
|
139
|
+
*
|
|
140
|
+
* blockHeavy: true // video/audio + images over 100 KB
|
|
141
|
+
* blockHeavy: { fonts: true, imageMaxBytes: 50_000 }
|
|
142
|
+
*
|
|
143
|
+
* Blocked requests fail inside the browser (nothing is fetched and nothing goes out directly), so the page sees an
|
|
144
|
+
* ordinary failed load: a blocked image or video simply does not appear. Images without a declared size, and requests
|
|
145
|
+
* made by service workers or cross-origin iframes, are not covered. The gateway rejects a malformed value with 400. */
|
|
146
|
+
blockHeavy?: boolean | BlockHeavyOptions;
|
|
128
147
|
/** Free-form JSON object stored with the session (labels, job ids, ...). */
|
|
129
148
|
userMetadata?: Record<string, unknown>;
|
|
130
149
|
}
|
package/dist/index.js
CHANGED
|
@@ -333,6 +333,8 @@ class SessionsResource {
|
|
|
333
333
|
body.timeoutSeconds = timeoutSeconds;
|
|
334
334
|
if (options?.keepAlive === true)
|
|
335
335
|
body.keepAlive = true;
|
|
336
|
+
if (options?.blockHeavy !== undefined && options.blockHeavy !== false)
|
|
337
|
+
body.blockHeavy = options.blockHeavy;
|
|
336
338
|
if (options?.userMetadata !== undefined)
|
|
337
339
|
body.userMetadata = options.userMetadata;
|
|
338
340
|
// A create allocates a slot and launches a browser before it can answer,
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solarisdk/browser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Official client SDK for Solari Browser.",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|