fastbrowse 0.7.0 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.d.ts +37 -0
- package/dist/addon.js +92 -0
- package/dist/binary.d.ts +2 -0
- package/dist/binary.js +6 -1
- package/dist/callbacks.d.ts +7 -2
- package/dist/callbacks.js +30 -16
- package/dist/fastbrowse.d.ts +17 -2
- package/dist/fastbrowse.js +41 -16
- package/package.json +6 -6
package/dist/addon.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type RunParams, type RunResult } from './protocol.ts';
|
|
2
|
+
import type { RunOptions } from './run.ts';
|
|
3
|
+
/** A host function of the addon. It answers `{"ok": value}` or `{"error": message}` as JSON, and never rejects. */
|
|
4
|
+
type HostFunction<Argument> = (argument: Argument) => Promise<string>;
|
|
5
|
+
interface AddonHost {
|
|
6
|
+
onEvent?: HostFunction<string>;
|
|
7
|
+
onFrame?: HostFunction<Buffer>;
|
|
8
|
+
until?: HostFunction<string>;
|
|
9
|
+
resolveSecret?: HostFunction<string>;
|
|
10
|
+
}
|
|
11
|
+
interface AddonCancel {
|
|
12
|
+
cancel(): void;
|
|
13
|
+
}
|
|
14
|
+
/** What `crates/fastbrowse-node` exports. */
|
|
15
|
+
export interface Addon {
|
|
16
|
+
Core: new (env?: Record<string, string>) => {
|
|
17
|
+
/** Resolves with `{"result": RunResult}` or `{"error": {"code", "message"}}` as JSON. */
|
|
18
|
+
runTask(params: string, host?: AddonHost, cancel?: AddonCancel): Promise<string>;
|
|
19
|
+
};
|
|
20
|
+
RunCancel: new () => AddonCancel;
|
|
21
|
+
version(): string;
|
|
22
|
+
protocolVersion(): number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The addon to load: the caller's own path first, then the one the environment names, then the `fastbrowse.node`
|
|
26
|
+
* beside the binary in the platform package.
|
|
27
|
+
*/
|
|
28
|
+
export declare function loadAddon(addonPath: string | undefined, env: NodeJS.ProcessEnv): Addon;
|
|
29
|
+
/** Runs on the addon, one at a time as the fastbrowse process runs them, so the two modes answer alike. */
|
|
30
|
+
export declare class InProcess {
|
|
31
|
+
#private;
|
|
32
|
+
constructor(addon: Addon, env: Record<string, string>);
|
|
33
|
+
run(runId: string, params: RunParams, options: RunOptions): Promise<RunResult>;
|
|
34
|
+
/** Stop the run under way, as `shutdown` stops it, and wait until its browser has closed. */
|
|
35
|
+
close(): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
package/dist/addon.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// The agent inside this process: the Rust core as a Node addon (crates/fastbrowse-node), driven with the same `run`
|
|
2
|
+
// params and the same result the fastbrowse process exchanges over JSON-RPC.
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { Callbacks } from './callbacks.js';
|
|
6
|
+
import { abortable } from './abort.js';
|
|
7
|
+
import { platformPackage } from './binary.js';
|
|
8
|
+
import { FastbrowseError, messageOf, RpcError } from './errors.js';
|
|
9
|
+
import { ErrorCode } from './protocol.js';
|
|
10
|
+
/**
|
|
11
|
+
* The addon to load: the caller's own path first, then the one the environment names, then the `fastbrowse.node`
|
|
12
|
+
* beside the binary in the platform package.
|
|
13
|
+
*/
|
|
14
|
+
export function loadAddon(addonPath, env) {
|
|
15
|
+
const path = addonPath ?? env.FASTBROWSE_ADDON ?? join(dirname(platformPackage()), 'fastbrowse.node');
|
|
16
|
+
try {
|
|
17
|
+
return createRequire(import.meta.url)(path);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
throw new FastbrowseError(`could not load the fastbrowse addon at ${path}: ${messageOf(error)}`, {
|
|
21
|
+
cause: error,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** The JSON a host function answers with. What a callback threw reaches the core as its message alone. */
|
|
26
|
+
async function answered(call) {
|
|
27
|
+
try {
|
|
28
|
+
return JSON.stringify({ ok: (await call()) ?? null });
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
return JSON.stringify({ error: messageOf(error) });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Runs on the addon, one at a time as the fastbrowse process runs them, so the two modes answer alike. */
|
|
35
|
+
export class InProcess {
|
|
36
|
+
#addon;
|
|
37
|
+
#core;
|
|
38
|
+
#callbacks = new Callbacks();
|
|
39
|
+
#active;
|
|
40
|
+
#closed = false;
|
|
41
|
+
constructor(addon, env) {
|
|
42
|
+
this.#addon = addon;
|
|
43
|
+
this.#core = new addon.Core(env);
|
|
44
|
+
}
|
|
45
|
+
async run(runId, params, options) {
|
|
46
|
+
if (this.#closed)
|
|
47
|
+
throw new FastbrowseError('this fastbrowse instance is closed');
|
|
48
|
+
const cancel = new this.#addon.RunCancel();
|
|
49
|
+
const host = {
|
|
50
|
+
onEvent: event => answered(() => this.#callbacks.event(runId, JSON.parse(event))),
|
|
51
|
+
};
|
|
52
|
+
if (params.frames)
|
|
53
|
+
host.onFrame = frame => answered(() => this.#callbacks.frame(runId, Uint8Array.from(frame)));
|
|
54
|
+
if (params.until)
|
|
55
|
+
host.until = url => answered(() => this.#callbacks.until(runId, url));
|
|
56
|
+
if (params.secrets?.length) {
|
|
57
|
+
host.resolveSecret = asked => answered(() => {
|
|
58
|
+
const [name, origin] = JSON.parse(asked);
|
|
59
|
+
return this.#callbacks.resolve(runId, name, origin);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
const send = async () => {
|
|
63
|
+
if (this.#active) {
|
|
64
|
+
const message = `run '${this.#active.runId}' is still active, and a server runs one at a time`;
|
|
65
|
+
throw new RpcError(ErrorCode.BUSY, message);
|
|
66
|
+
}
|
|
67
|
+
const done = this.#core.runTask(JSON.stringify(params), host, cancel);
|
|
68
|
+
this.#active = { runId, cancel, done };
|
|
69
|
+
let reply;
|
|
70
|
+
try {
|
|
71
|
+
reply = JSON.parse(await done);
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
this.#active = undefined;
|
|
75
|
+
}
|
|
76
|
+
if (reply.error)
|
|
77
|
+
throw new RpcError(reply.error.code, reply.error.message);
|
|
78
|
+
return reply.result;
|
|
79
|
+
};
|
|
80
|
+
const stop = () => cancel.cancel();
|
|
81
|
+
return this.#callbacks.during(runId, options, stop, () => abortable(options.signal, send, stop));
|
|
82
|
+
}
|
|
83
|
+
/** Stop the run under way, as `shutdown` stops it, and wait until its browser has closed. */
|
|
84
|
+
async close() {
|
|
85
|
+
this.#closed = true;
|
|
86
|
+
const active = this.#active;
|
|
87
|
+
if (!active)
|
|
88
|
+
return;
|
|
89
|
+
active.cancel.cancel();
|
|
90
|
+
await active.done.catch(() => { });
|
|
91
|
+
}
|
|
92
|
+
}
|
package/dist/binary.d.ts
CHANGED
|
@@ -12,3 +12,5 @@ export interface Host {
|
|
|
12
12
|
* the platform package installed beside this package.
|
|
13
13
|
*/
|
|
14
14
|
export declare function resolveBinary(binaryPath: string | undefined, env: NodeJS.ProcessEnv, on?: Host): string;
|
|
15
|
+
/** The manifest of the platform package installed beside this package, which holds the binary and the addon. */
|
|
16
|
+
export declare function platformPackage(on?: Host): string;
|
package/dist/binary.js
CHANGED
|
@@ -32,6 +32,11 @@ export function resolveBinary(binaryPath, env, on = host) {
|
|
|
32
32
|
const named = binaryPath ?? env.FASTBROWSE_BINARY;
|
|
33
33
|
if (named)
|
|
34
34
|
return named;
|
|
35
|
+
const root = dirname(platformPackage(on));
|
|
36
|
+
return join(root, 'fastbrowse', on.platform === 'win32' ? 'fastbrowse.exe' : 'fastbrowse');
|
|
37
|
+
}
|
|
38
|
+
/** The manifest of the platform package installed beside this package, which holds the binary and the addon. */
|
|
39
|
+
export function platformPackage(on = host) {
|
|
35
40
|
const target = `${on.platform}-${on.arch}`;
|
|
36
41
|
if (!TARGETS.includes(target)) {
|
|
37
42
|
throw new FastbrowseError(`fastbrowse has no binary for ${on.platform} ${on.arch}. It is published for ${TARGETS.join(', ')}. ` +
|
|
@@ -54,5 +59,5 @@ export function resolveBinary(binaryPath, env, on = host) {
|
|
|
54
59
|
'optional dependency of fastbrowse, so install without --omit=optional or --no-optional. ' +
|
|
55
60
|
`Or ${OWN_BINARY}.`, { cause: error });
|
|
56
61
|
}
|
|
57
|
-
return
|
|
62
|
+
return manifest;
|
|
58
63
|
}
|
package/dist/callbacks.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { type RunResult } from './protocol.ts';
|
|
1
|
+
import { type BrowserEvent, type RunResult, type StepEvent } from './protocol.ts';
|
|
2
2
|
import type { Connection } from './rpc.ts';
|
|
3
3
|
import type { RunOptions } from './run.ts';
|
|
4
4
|
export declare class Callbacks {
|
|
5
5
|
#private;
|
|
6
|
-
|
|
6
|
+
/** Without a connection, the in-process core calls the four methods below itself. */
|
|
7
|
+
constructor(connection?: Connection);
|
|
8
|
+
event(runId: string, event: StepEvent | BrowserEvent): void;
|
|
9
|
+
frame(runId: string, jpeg: Uint8Array): void;
|
|
10
|
+
until(runId: string, url: string): Promise<boolean>;
|
|
11
|
+
resolve(runId: string, name: string, origin: string): Promise<string | null>;
|
|
7
12
|
/**
|
|
8
13
|
* Hand the server's calls for run `runId` to `options` until `run` settles, and settle as it does.
|
|
9
14
|
*
|
package/dist/callbacks.js
CHANGED
|
@@ -3,34 +3,48 @@ import { FastbrowseError, messageOf, RpcError } from './errors.js';
|
|
|
3
3
|
import { ErrorCode, ServerMethod, } from './protocol.js';
|
|
4
4
|
export class Callbacks {
|
|
5
5
|
#runs = new Map();
|
|
6
|
+
/** Without a connection, the in-process core calls the four methods below itself. */
|
|
6
7
|
constructor(connection) {
|
|
8
|
+
if (!connection)
|
|
9
|
+
return;
|
|
7
10
|
connection.onNotification(ServerMethod.RUN_EVENT, params => {
|
|
8
11
|
const { run_id: runId, event } = params;
|
|
9
|
-
this
|
|
12
|
+
this.event(runId, event);
|
|
10
13
|
});
|
|
11
14
|
connection.onNotification(ServerMethod.RUN_FRAME, params => {
|
|
12
15
|
const { run_id: runId, frame } = params;
|
|
13
|
-
|
|
14
|
-
this.#tell(runId, ServerMethod.RUN_FRAME, options => options.onFrame?.(jpeg));
|
|
16
|
+
this.frame(runId, Uint8Array.from(Buffer.from(frame, 'base64')));
|
|
15
17
|
});
|
|
16
|
-
connection.onRequest(ServerMethod.RUN_UNTIL,
|
|
18
|
+
connection.onRequest(ServerMethod.RUN_UNTIL, params => {
|
|
17
19
|
const { run_id: runId, url } = params;
|
|
18
|
-
|
|
19
|
-
// return anything.
|
|
20
|
-
return (await this.#asked(runId, 'until')(url)) === true;
|
|
20
|
+
return this.until(runId, url);
|
|
21
21
|
});
|
|
22
|
-
connection.onRequest(ServerMethod.SECRETS_RESOLVE,
|
|
22
|
+
connection.onRequest(ServerMethod.SECRETS_RESOLVE, params => {
|
|
23
23
|
const { run_id: runId, name, origin } = params;
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
return await secrets.resolve(name, origin);
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
29
|
-
// What a resolver throws may quote the value, so it stays in this process.
|
|
30
|
-
throw new FastbrowseError(`the resolver threw for the secret '${name}'`);
|
|
31
|
-
}
|
|
24
|
+
return this.resolve(runId, name, origin);
|
|
32
25
|
});
|
|
33
26
|
}
|
|
27
|
+
event(runId, event) {
|
|
28
|
+
this.#tell(runId, ServerMethod.RUN_EVENT, options => options.onEvent?.(event));
|
|
29
|
+
}
|
|
30
|
+
frame(runId, jpeg) {
|
|
31
|
+
this.#tell(runId, ServerMethod.RUN_FRAME, options => options.onFrame?.(jpeg));
|
|
32
|
+
}
|
|
33
|
+
async until(runId, url) {
|
|
34
|
+
// The server ends the run as an error on any reply but a boolean, and a check in plain JavaScript can
|
|
35
|
+
// return anything.
|
|
36
|
+
return (await this.#asked(runId, 'until')(url)) === true;
|
|
37
|
+
}
|
|
38
|
+
async resolve(runId, name, origin) {
|
|
39
|
+
const secrets = this.#asked(runId, 'secrets');
|
|
40
|
+
try {
|
|
41
|
+
return (await secrets.resolve(name, origin)) ?? null;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// What a resolver throws may quote the value, so it stays in this process.
|
|
45
|
+
throw new FastbrowseError(`the resolver threw for the secret '${name}'`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
34
48
|
/**
|
|
35
49
|
* Hand the server's calls for run `runId` to `options` until `run` settles, and settle as it does.
|
|
36
50
|
*
|
package/dist/fastbrowse.d.ts
CHANGED
|
@@ -15,6 +15,17 @@ export interface StartOptions extends BrowserOptions {
|
|
|
15
15
|
* process's own stderr. A stream receives it and is left open when the process ends.
|
|
16
16
|
*/
|
|
17
17
|
stderr?: 'inherit' | 'ignore' | Writable;
|
|
18
|
+
/**
|
|
19
|
+
* Run the agent inside this process, on the fastbrowse addon, instead of starting a fastbrowse process. Runs
|
|
20
|
+
* and their results are the same; `env` then adds to the environment the settings are read from, and
|
|
21
|
+
* `binaryPath` and `stderr` mean nothing.
|
|
22
|
+
*/
|
|
23
|
+
inProcess?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The addon to load with `inProcess`. Without it, the `FASTBROWSE_ADDON` environment variable names one, and
|
|
26
|
+
* without that it is the `fastbrowse.node` in the platform package.
|
|
27
|
+
*/
|
|
28
|
+
addonPath?: string;
|
|
18
29
|
}
|
|
19
30
|
export interface CloseOptions {
|
|
20
31
|
/** How long the process gets to exit after `shutdown` before it is killed. Thirty seconds by default. */
|
|
@@ -25,7 +36,10 @@ export declare class Fastbrowse {
|
|
|
25
36
|
/** The version of the fastbrowse binary this instance drives. */
|
|
26
37
|
readonly fastbrowseVersion: string;
|
|
27
38
|
private constructor();
|
|
28
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Start a fastbrowse process and check that it speaks this SDK's protocol version. With `inProcess`, load the
|
|
41
|
+
* addon instead and run in this process.
|
|
42
|
+
*/
|
|
29
43
|
static start(options?: StartOptions): Promise<Fastbrowse>;
|
|
30
44
|
/**
|
|
31
45
|
* Run a task and resolve with its result, whatever status it ended in: a run that needs a login or got stuck
|
|
@@ -45,7 +59,8 @@ export declare class Fastbrowse {
|
|
|
45
59
|
}): Promise<TypedRunResult<Schema>>;
|
|
46
60
|
/**
|
|
47
61
|
* Ask the fastbrowse process to shut down and wait until it has exited. A process still running when the
|
|
48
|
-
* grace period ends is killed.
|
|
62
|
+
* grace period ends is killed. In-process, stop the run under way and wait until its browser has closed.
|
|
63
|
+
* Every call after the first returns the first one's promise.
|
|
49
64
|
*/
|
|
50
65
|
close(options?: CloseOptions): Promise<void>;
|
|
51
66
|
}
|
package/dist/fastbrowse.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { randomUUID } from 'node:crypto';
|
|
3
3
|
import { abortable } from './abort.js';
|
|
4
|
+
import { InProcess, loadAddon } from './addon.js';
|
|
4
5
|
import { Callbacks } from './callbacks.js';
|
|
5
6
|
import { resolveBinary } from './binary.js';
|
|
6
7
|
import { FastbrowseError, ProcessExitedError } from './errors.js';
|
|
@@ -10,21 +11,33 @@ import { Connection } from './rpc.js';
|
|
|
10
11
|
import { browserParams, runParams } from './run.js';
|
|
11
12
|
// Three times the 10 s the server gives Chrome to exit before it kills it: a server killed first orphans that Chrome.
|
|
12
13
|
const DEFAULT_GRACE_PERIOD_MS = 30_000;
|
|
14
|
+
function mismatch(version, where, protocolVersion) {
|
|
15
|
+
return new FastbrowseError(`this SDK speaks protocol version ${PROTOCOL_VERSION}, and fastbrowse ${version} at ${where} speaks protocol ` +
|
|
16
|
+
`version ${protocolVersion}: install matching versions of the two`);
|
|
17
|
+
}
|
|
13
18
|
export class Fastbrowse {
|
|
14
19
|
/** The version of the fastbrowse binary this instance drives. */
|
|
15
20
|
fastbrowseVersion;
|
|
16
|
-
#
|
|
21
|
+
#backend;
|
|
17
22
|
#browser;
|
|
18
|
-
#callbacks;
|
|
19
23
|
#closed;
|
|
20
|
-
constructor(
|
|
21
|
-
this.#
|
|
24
|
+
constructor(backend, fastbrowseVersion, browser) {
|
|
25
|
+
this.#backend = backend;
|
|
22
26
|
this.fastbrowseVersion = fastbrowseVersion;
|
|
23
27
|
this.#browser = browser;
|
|
24
|
-
this.#callbacks = new Callbacks(server.connection);
|
|
25
28
|
}
|
|
26
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Start a fastbrowse process and check that it speaks this SDK's protocol version. With `inProcess`, load the
|
|
31
|
+
* addon instead and run in this process.
|
|
32
|
+
*/
|
|
27
33
|
static async start(options = {}) {
|
|
34
|
+
if (options.inProcess) {
|
|
35
|
+
const addon = loadAddon(options.addonPath, { ...process.env, ...options.env });
|
|
36
|
+
if (addon.protocolVersion() !== PROTOCOL_VERSION) {
|
|
37
|
+
throw mismatch(addon.version(), 'the addon', addon.protocolVersion());
|
|
38
|
+
}
|
|
39
|
+
return new Fastbrowse(new InProcess(addon, options.env ?? {}), addon.version(), browserParams(options));
|
|
40
|
+
}
|
|
28
41
|
const env = { ...process.env, ...options.env };
|
|
29
42
|
const binary = resolveBinary(options.binaryPath, env);
|
|
30
43
|
const server = new Server(binary, env, options.stderr ?? 'inherit');
|
|
@@ -32,10 +45,9 @@ export class Fastbrowse {
|
|
|
32
45
|
const hello = { protocol_version: PROTOCOL_VERSION };
|
|
33
46
|
const reply = (await server.connection.request(Method.INITIALIZE, hello));
|
|
34
47
|
if (reply.protocol_version !== PROTOCOL_VERSION) {
|
|
35
|
-
throw
|
|
36
|
-
`${binary} speaks protocol version ${reply.protocol_version}: install matching versions of the two`);
|
|
48
|
+
throw mismatch(reply.fastbrowse_version, binary, reply.protocol_version);
|
|
37
49
|
}
|
|
38
|
-
return new Fastbrowse(server, reply.fastbrowse_version, browserParams(options));
|
|
50
|
+
return new Fastbrowse(new Subprocess(server), reply.fastbrowse_version, browserParams(options));
|
|
39
51
|
}
|
|
40
52
|
catch (error) {
|
|
41
53
|
await server.kill();
|
|
@@ -60,21 +72,34 @@ export class Fastbrowse {
|
|
|
60
72
|
// the one that is active.
|
|
61
73
|
const runId = randomUUID();
|
|
62
74
|
const params = runParams(runId, task, this.#browser, options);
|
|
63
|
-
const
|
|
64
|
-
// The reply says only that the request was read, and a process that has gone rejects the run itself.
|
|
65
|
-
const cancel = () => void connection.request(Method.RUN_CANCEL, { run_id: runId }).catch(() => { });
|
|
66
|
-
const result = await this.#callbacks.during(runId, options, cancel, () => abortable(options.signal, () => connection.request(Method.RUN, params), cancel));
|
|
75
|
+
const result = await this.#backend.run(runId, params, options);
|
|
67
76
|
return withOutput(result, options.output);
|
|
68
77
|
}
|
|
69
78
|
/**
|
|
70
79
|
* Ask the fastbrowse process to shut down and wait until it has exited. A process still running when the
|
|
71
|
-
* grace period ends is killed.
|
|
80
|
+
* grace period ends is killed. In-process, stop the run under way and wait until its browser has closed.
|
|
81
|
+
* Every call after the first returns the first one's promise.
|
|
72
82
|
*/
|
|
73
83
|
close(options = {}) {
|
|
74
|
-
this.#closed ??= this.#close(options.gracePeriodMs ?? DEFAULT_GRACE_PERIOD_MS);
|
|
84
|
+
this.#closed ??= this.#backend.close(options.gracePeriodMs ?? DEFAULT_GRACE_PERIOD_MS);
|
|
75
85
|
return this.#closed;
|
|
76
86
|
}
|
|
77
|
-
|
|
87
|
+
}
|
|
88
|
+
/** Runs sent to a fastbrowse process over its stdin and stdout. */
|
|
89
|
+
class Subprocess {
|
|
90
|
+
#server;
|
|
91
|
+
#callbacks;
|
|
92
|
+
constructor(server) {
|
|
93
|
+
this.#server = server;
|
|
94
|
+
this.#callbacks = new Callbacks(server.connection);
|
|
95
|
+
}
|
|
96
|
+
run(runId, params, options) {
|
|
97
|
+
const { connection } = this.#server;
|
|
98
|
+
// The reply says only that the request was read, and a process that has gone rejects the run itself.
|
|
99
|
+
const cancel = () => void connection.request(Method.RUN_CANCEL, { run_id: runId }).catch(() => { });
|
|
100
|
+
return this.#callbacks.during(runId, options, cancel, () => abortable(options.signal, () => connection.request(Method.RUN, params), cancel));
|
|
101
|
+
}
|
|
102
|
+
async close(gracePeriodMs) {
|
|
78
103
|
// The reply says nothing the exit does not, and a process that died earlier answers with a rejection.
|
|
79
104
|
this.#server.connection.request(Method.SHUTDOWN).catch(() => { });
|
|
80
105
|
const overdue = setTimeout(() => void this.#server.kill(), gracePeriodMs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastbrowse",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Browser automation with cited answers, structured output and code-controlled credentials and authorization.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"test": "npm run build && node --test \"test/*.test.ts\""
|
|
28
28
|
},
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@fastbrowse/darwin-arm64": "0.7.
|
|
31
|
-
"@fastbrowse/darwin-x64": "0.7.
|
|
32
|
-
"@fastbrowse/linux-arm64": "0.7.
|
|
33
|
-
"@fastbrowse/linux-x64": "0.7.
|
|
34
|
-
"@fastbrowse/win32-x64": "0.7.
|
|
30
|
+
"@fastbrowse/darwin-arm64": "0.7.3",
|
|
31
|
+
"@fastbrowse/darwin-x64": "0.7.3",
|
|
32
|
+
"@fastbrowse/linux-arm64": "0.7.3",
|
|
33
|
+
"@fastbrowse/linux-x64": "0.7.3",
|
|
34
|
+
"@fastbrowse/win32-x64": "0.7.3"
|
|
35
35
|
}
|
|
36
36
|
}
|