@solarisdk/browser 0.5.1 → 0.5.2
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 +1 -1
- package/dist/browser-session.d.ts +1 -1
- package/dist/browser-session.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ console.log(await page.title());
|
|
|
29
29
|
await browser.close();
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
Or with explicit resource management (Node 22
|
|
32
|
+
Or with explicit resource management (compiled TypeScript 5.2+, or uncompiled on Node 24+; Node 22 rejects the syntax):
|
|
33
33
|
|
|
34
34
|
```ts
|
|
35
35
|
await using browser = await solari.launch({ stealth: true });
|
|
@@ -54,6 +54,6 @@ export declare class BrowserSession {
|
|
|
54
54
|
newPage(): Promise<Page>;
|
|
55
55
|
/** Close the browser and release the session. Idempotent. */
|
|
56
56
|
close(): Promise<void>;
|
|
57
|
-
/** Supports `await using browser = await solari.launch()` (Node
|
|
57
|
+
/** Supports `await using browser = await solari.launch()` (compiled TypeScript 5.2+, or uncompiled on Node 24+). */
|
|
58
58
|
[Symbol.asyncDispose](): Promise<void>;
|
|
59
59
|
}
|
package/dist/browser-session.js
CHANGED
|
@@ -101,7 +101,7 @@ export class BrowserSession {
|
|
|
101
101
|
if (browserErr)
|
|
102
102
|
throw browserErr;
|
|
103
103
|
}
|
|
104
|
-
/** Supports `await using browser = await solari.launch()` (Node
|
|
104
|
+
/** Supports `await using browser = await solari.launch()` (compiled TypeScript 5.2+, or uncompiled on Node 24+). */
|
|
105
105
|
async [Symbol.asyncDispose]() {
|
|
106
106
|
await this.close();
|
|
107
107
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -353,7 +353,7 @@ export declare class Solari {
|
|
|
353
353
|
* await page.goto("https://example.com");
|
|
354
354
|
* await browser.close();
|
|
355
355
|
*
|
|
356
|
-
* Or with explicit resource management (Node
|
|
356
|
+
* Or with explicit resource management (compiled TypeScript 5.2+, or uncompiled on Node 24+):
|
|
357
357
|
*
|
|
358
358
|
* await using browser = await solari.launch({ stealth: true });
|
|
359
359
|
*/
|
package/dist/index.js
CHANGED
|
@@ -141,7 +141,8 @@ const DEFAULT_TIMEOUT_MS = 90_000;
|
|
|
141
141
|
/**
|
|
142
142
|
* The gateway's `timeoutSeconds` for a `sessionTimeoutMs`: rounded UP to whole
|
|
143
143
|
* seconds (1001 -> 2). Zero/undefined means "omit". Throws for a negative, NaN,
|
|
144
|
-
* Infinity or non-integer value
|
|
144
|
+
* Infinity or non-integer value, and for one whose seconds do not fit the wire
|
|
145
|
+
* field (int32), as the Go and Rust SDKs do. Not clamped: the gateway still answers 400 under 60 s.
|
|
145
146
|
*/
|
|
146
147
|
function sessionTimeoutSeconds(ms) {
|
|
147
148
|
if (ms === undefined || ms === 0)
|
|
@@ -149,7 +150,11 @@ function sessionTimeoutSeconds(ms) {
|
|
|
149
150
|
if (typeof ms !== "number" || !Number.isInteger(ms) || ms < 0) {
|
|
150
151
|
throw new SolariError(`Solari: sessionTimeoutMs must be a non-negative integer number of milliseconds, got ${String(ms)}`);
|
|
151
152
|
}
|
|
152
|
-
|
|
153
|
+
const seconds = Math.ceil(ms / 1000);
|
|
154
|
+
if (seconds > 2_147_483_647) {
|
|
155
|
+
throw new SolariError(`Solari: sessionTimeoutMs is too large, got ${String(ms)}`);
|
|
156
|
+
}
|
|
157
|
+
return seconds;
|
|
153
158
|
}
|
|
154
159
|
function isRetryableStatus(status) {
|
|
155
160
|
return status === 502 || status === 503 || status === 504 || status === 507;
|
|
@@ -627,7 +632,7 @@ export class Solari {
|
|
|
627
632
|
* await page.goto("https://example.com");
|
|
628
633
|
* await browser.close();
|
|
629
634
|
*
|
|
630
|
-
* Or with explicit resource management (Node
|
|
635
|
+
* Or with explicit resource management (compiled TypeScript 5.2+, or uncompiled on Node 24+):
|
|
631
636
|
*
|
|
632
637
|
* await using browser = await solari.launch({ stealth: true });
|
|
633
638
|
*/
|