@b3os/sdk 0.0.0-stage → 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 +202 -0
- package/README.md +233 -2
- package/dist/cjs/core/client.d.ts +165 -0
- package/dist/cjs/core/client.js +825 -0
- package/dist/cjs/core/client.js.map +1 -0
- package/dist/cjs/core/errors.d.ts +101 -0
- package/dist/cjs/core/errors.js +249 -0
- package/dist/cjs/core/errors.js.map +1 -0
- package/dist/cjs/core/index.d.ts +12 -0
- package/dist/cjs/core/index.js +42 -0
- package/dist/cjs/core/index.js.map +1 -0
- package/dist/cjs/core/jobs.d.ts +31 -0
- package/dist/cjs/core/jobs.js +72 -0
- package/dist/cjs/core/jobs.js.map +1 -0
- package/dist/cjs/core/namespace.d.ts +7 -0
- package/dist/cjs/core/namespace.js +13 -0
- package/dist/cjs/core/namespace.js.map +1 -0
- package/dist/cjs/core/op.d.ts +47 -0
- package/dist/cjs/core/op.js +5 -0
- package/dist/cjs/core/op.js.map +1 -0
- package/dist/cjs/core/promise.d.ts +106 -0
- package/dist/cjs/core/promise.js +200 -0
- package/dist/cjs/core/promise.js.map +1 -0
- package/dist/cjs/core/response.d.ts +54 -0
- package/dist/cjs/core/response.js +92 -0
- package/dist/cjs/core/response.js.map +1 -0
- package/dist/cjs/core/sse.d.ts +79 -0
- package/dist/cjs/core/sse.js +291 -0
- package/dist/cjs/core/sse.js.map +1 -0
- package/dist/cjs/core/timing.d.ts +20 -0
- package/dist/cjs/core/timing.js +96 -0
- package/dist/cjs/core/timing.js.map +1 -0
- package/dist/cjs/core/transport.d.ts +80 -0
- package/dist/cjs/core/transport.js +472 -0
- package/dist/cjs/core/transport.js.map +1 -0
- package/dist/cjs/core/util.d.ts +25 -0
- package/dist/cjs/core/util.js +142 -0
- package/dist/cjs/core/util.js.map +1 -0
- package/dist/cjs/core/ws.d.ts +52 -0
- package/dist/cjs/core/ws.js +181 -0
- package/dist/cjs/core/ws.js.map +1 -0
- package/dist/cjs/generated/client.d.ts +62 -0
- package/dist/cjs/generated/client.js +130 -0
- package/dist/cjs/generated/client.js.map +1 -0
- package/dist/cjs/generated/errors.d.ts +4 -0
- package/dist/cjs/generated/errors.js +160 -0
- package/dist/cjs/generated/errors.js.map +1 -0
- package/dist/cjs/generated/ids.d.ts +114 -0
- package/dist/cjs/generated/ids.js +47 -0
- package/dist/cjs/generated/ids.js.map +1 -0
- package/dist/cjs/generated/jobs.d.ts +10 -0
- package/dist/cjs/generated/jobs.js +24 -0
- package/dist/cjs/generated/jobs.js.map +1 -0
- package/dist/cjs/generated/ns/actions.d.ts +161 -0
- package/dist/cjs/generated/ns/actions.js +304 -0
- package/dist/cjs/generated/ns/actions.js.map +1 -0
- package/dist/cjs/generated/ns/infer.d.ts +190 -0
- package/dist/cjs/generated/ns/infer.js +253 -0
- package/dist/cjs/generated/ns/infer.js.map +1 -0
- package/dist/cjs/generated/ns/keys.d.ts +76 -0
- package/dist/cjs/generated/ns/keys.js +144 -0
- package/dist/cjs/generated/ns/keys.js.map +1 -0
- package/dist/cjs/generated/ns/limits.d.ts +22 -0
- package/dist/cjs/generated/ns/limits.js +32 -0
- package/dist/cjs/generated/ns/limits.js.map +1 -0
- package/dist/cjs/generated/ns/orgs.d.ts +38 -0
- package/dist/cjs/generated/ns/orgs.js +68 -0
- package/dist/cjs/generated/ns/orgs.js.map +1 -0
- package/dist/cjs/generated/ns/projects.d.ts +57 -0
- package/dist/cjs/generated/ns/projects.js +115 -0
- package/dist/cjs/generated/ns/projects.js.map +1 -0
- package/dist/cjs/generated/ns/render.d.ts +159 -0
- package/dist/cjs/generated/ns/render.js +299 -0
- package/dist/cjs/generated/ns/render.js.map +1 -0
- package/dist/cjs/generated/ns/requests.d.ts +36 -0
- package/dist/cjs/generated/ns/requests.js +54 -0
- package/dist/cjs/generated/ns/requests.js.map +1 -0
- package/dist/cjs/generated/ns/routines.d.ts +212 -0
- package/dist/cjs/generated/ns/routines.js +419 -0
- package/dist/cjs/generated/ns/routines.js.map +1 -0
- package/dist/cjs/generated/ns/sandboxes.d.ts +318 -0
- package/dist/cjs/generated/ns/sandboxes.js +549 -0
- package/dist/cjs/generated/ns/sandboxes.js.map +1 -0
- package/dist/cjs/generated/ns/usage.d.ts +30 -0
- package/dist/cjs/generated/ns/usage.js +49 -0
- package/dist/cjs/generated/ns/usage.js.map +1 -0
- package/dist/cjs/generated/ns/vault.d.ts +69 -0
- package/dist/cjs/generated/ns/vault.js +122 -0
- package/dist/cjs/generated/ns/vault.js.map +1 -0
- package/dist/cjs/generated/ns/vision.d.ts +376 -0
- package/dist/cjs/generated/ns/vision.js +736 -0
- package/dist/cjs/generated/ns/vision.js.map +1 -0
- package/dist/cjs/generated/ns/webhooks.d.ts +50 -0
- package/dist/cjs/generated/ns/webhooks.js +91 -0
- package/dist/cjs/generated/ns/webhooks.js.map +1 -0
- package/dist/cjs/generated/types.d.ts +4613 -0
- package/dist/cjs/generated/types.js +4 -0
- package/dist/cjs/generated/types.js.map +1 -0
- package/dist/cjs/index.d.ts +22 -0
- package/dist/cjs/index.js +81 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/webhooks.d.ts +19 -0
- package/dist/cjs/webhooks.js +85 -0
- package/dist/cjs/webhooks.js.map +1 -0
- package/dist/esm/core/client.d.ts +165 -0
- package/dist/esm/core/client.js +821 -0
- package/dist/esm/core/client.js.map +1 -0
- package/dist/esm/core/errors.d.ts +101 -0
- package/dist/esm/core/errors.js +239 -0
- package/dist/esm/core/errors.js.map +1 -0
- package/dist/esm/core/index.d.ts +12 -0
- package/dist/esm/core/index.js +15 -0
- package/dist/esm/core/index.js.map +1 -0
- package/dist/esm/core/jobs.d.ts +31 -0
- package/dist/esm/core/jobs.js +66 -0
- package/dist/esm/core/jobs.js.map +1 -0
- package/dist/esm/core/namespace.d.ts +7 -0
- package/dist/esm/core/namespace.js +9 -0
- package/dist/esm/core/namespace.js.map +1 -0
- package/dist/esm/core/op.d.ts +47 -0
- package/dist/esm/core/op.js +4 -0
- package/dist/esm/core/op.js.map +1 -0
- package/dist/esm/core/promise.d.ts +106 -0
- package/dist/esm/core/promise.js +193 -0
- package/dist/esm/core/promise.js.map +1 -0
- package/dist/esm/core/response.d.ts +54 -0
- package/dist/esm/core/response.js +86 -0
- package/dist/esm/core/response.js.map +1 -0
- package/dist/esm/core/sse.d.ts +79 -0
- package/dist/esm/core/sse.js +286 -0
- package/dist/esm/core/sse.js.map +1 -0
- package/dist/esm/core/timing.d.ts +20 -0
- package/dist/esm/core/timing.js +92 -0
- package/dist/esm/core/timing.js.map +1 -0
- package/dist/esm/core/transport.d.ts +80 -0
- package/dist/esm/core/transport.js +465 -0
- package/dist/esm/core/transport.js.map +1 -0
- package/dist/esm/core/util.d.ts +25 -0
- package/dist/esm/core/util.js +128 -0
- package/dist/esm/core/util.js.map +1 -0
- package/dist/esm/core/ws.d.ts +52 -0
- package/dist/esm/core/ws.js +175 -0
- package/dist/esm/core/ws.js.map +1 -0
- package/dist/esm/generated/client.d.ts +62 -0
- package/dist/esm/generated/client.js +126 -0
- package/dist/esm/generated/client.js.map +1 -0
- package/dist/esm/generated/errors.d.ts +4 -0
- package/dist/esm/generated/errors.js +157 -0
- package/dist/esm/generated/errors.js.map +1 -0
- package/dist/esm/generated/ids.d.ts +114 -0
- package/dist/esm/generated/ids.js +42 -0
- package/dist/esm/generated/ids.js.map +1 -0
- package/dist/esm/generated/jobs.d.ts +10 -0
- package/dist/esm/generated/jobs.js +21 -0
- package/dist/esm/generated/jobs.js.map +1 -0
- package/dist/esm/generated/ns/actions.d.ts +161 -0
- package/dist/esm/generated/ns/actions.js +300 -0
- package/dist/esm/generated/ns/actions.js.map +1 -0
- package/dist/esm/generated/ns/infer.d.ts +190 -0
- package/dist/esm/generated/ns/infer.js +249 -0
- package/dist/esm/generated/ns/infer.js.map +1 -0
- package/dist/esm/generated/ns/keys.d.ts +76 -0
- package/dist/esm/generated/ns/keys.js +140 -0
- package/dist/esm/generated/ns/keys.js.map +1 -0
- package/dist/esm/generated/ns/limits.d.ts +22 -0
- package/dist/esm/generated/ns/limits.js +28 -0
- package/dist/esm/generated/ns/limits.js.map +1 -0
- package/dist/esm/generated/ns/orgs.d.ts +38 -0
- package/dist/esm/generated/ns/orgs.js +64 -0
- package/dist/esm/generated/ns/orgs.js.map +1 -0
- package/dist/esm/generated/ns/projects.d.ts +57 -0
- package/dist/esm/generated/ns/projects.js +111 -0
- package/dist/esm/generated/ns/projects.js.map +1 -0
- package/dist/esm/generated/ns/render.d.ts +159 -0
- package/dist/esm/generated/ns/render.js +295 -0
- package/dist/esm/generated/ns/render.js.map +1 -0
- package/dist/esm/generated/ns/requests.d.ts +36 -0
- package/dist/esm/generated/ns/requests.js +50 -0
- package/dist/esm/generated/ns/requests.js.map +1 -0
- package/dist/esm/generated/ns/routines.d.ts +212 -0
- package/dist/esm/generated/ns/routines.js +415 -0
- package/dist/esm/generated/ns/routines.js.map +1 -0
- package/dist/esm/generated/ns/sandboxes.d.ts +318 -0
- package/dist/esm/generated/ns/sandboxes.js +545 -0
- package/dist/esm/generated/ns/sandboxes.js.map +1 -0
- package/dist/esm/generated/ns/usage.d.ts +30 -0
- package/dist/esm/generated/ns/usage.js +45 -0
- package/dist/esm/generated/ns/usage.js.map +1 -0
- package/dist/esm/generated/ns/vault.d.ts +69 -0
- package/dist/esm/generated/ns/vault.js +118 -0
- package/dist/esm/generated/ns/vault.js.map +1 -0
- package/dist/esm/generated/ns/vision.d.ts +376 -0
- package/dist/esm/generated/ns/vision.js +732 -0
- package/dist/esm/generated/ns/vision.js.map +1 -0
- package/dist/esm/generated/ns/webhooks.d.ts +50 -0
- package/dist/esm/generated/ns/webhooks.js +87 -0
- package/dist/esm/generated/ns/webhooks.js.map +1 -0
- package/dist/esm/generated/types.d.ts +4613 -0
- package/dist/esm/generated/types.js +3 -0
- package/dist/esm/generated/types.js.map +1 -0
- package/dist/esm/index.d.ts +22 -0
- package/dist/esm/index.js +28 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/webhooks.d.ts +19 -0
- package/dist/esm/webhooks.js +79 -0
- package/dist/esm/webhooks.js.map +1 -0
- package/package.json +98 -4
- package/src/core/client.ts +1022 -0
- package/src/core/errors.ts +296 -0
- package/src/core/index.ts +45 -0
- package/src/core/jobs.ts +94 -0
- package/src/core/namespace.ts +10 -0
- package/src/core/op.ts +53 -0
- package/src/core/promise.ts +268 -0
- package/src/core/response.ts +115 -0
- package/src/core/sse.ts +305 -0
- package/src/core/timing.ts +106 -0
- package/src/core/transport.ts +489 -0
- package/src/core/util.ts +138 -0
- package/src/core/ws.ts +215 -0
- package/src/generated/client.ts +143 -0
- package/src/generated/errors.ts +313 -0
- package/src/generated/ids.ts +47 -0
- package/src/generated/jobs.ts +25 -0
- package/src/generated/ns/actions.ts +353 -0
- package/src/generated/ns/infer.ts +332 -0
- package/src/generated/ns/keys.ts +152 -0
- package/src/generated/ns/limits.ts +35 -0
- package/src/generated/ns/orgs.ts +77 -0
- package/src/generated/ns/projects.ts +122 -0
- package/src/generated/ns/render.ts +348 -0
- package/src/generated/ns/requests.ts +61 -0
- package/src/generated/ns/routines.ts +474 -0
- package/src/generated/ns/sandboxes.ts +671 -0
- package/src/generated/ns/usage.ts +56 -0
- package/src/generated/ns/vault.ts +136 -0
- package/src/generated/ns/vision.ts +836 -0
- package/src/generated/ns/webhooks.ts +100 -0
- package/src/generated/types.ts +5131 -0
- package/src/index.ts +30 -0
- package/src/webhooks.ts +100 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { RequestOptions } from "../../core/client.ts";
|
|
2
|
+
import { Namespace } from "../../core/namespace.ts";
|
|
3
|
+
import type { Op } from "../../core/op.ts";
|
|
4
|
+
import type { APIPromise, ListPromise } from "../../core/promise.ts";
|
|
5
|
+
import type * as T from "../types.ts";
|
|
6
|
+
/** Descriptors of every vault operation, keyed by method name (for tooling and custom clients). */
|
|
7
|
+
export declare const vaultOps: {
|
|
8
|
+
readonly listConnections: Op;
|
|
9
|
+
readonly createConnection: Op;
|
|
10
|
+
readonly deleteConnection: Op;
|
|
11
|
+
readonly getConnection: Op;
|
|
12
|
+
readonly updateConnection: Op;
|
|
13
|
+
};
|
|
14
|
+
/** Stored connections (credentials actions and routines use without seeing them) (`/v1/vault`). */
|
|
15
|
+
export declare class VaultAPI extends Namespace {
|
|
16
|
+
/**
|
|
17
|
+
* List connections
|
|
18
|
+
*
|
|
19
|
+
* Lists connections in this project, newest first, optionally only one pack's or one subject's.
|
|
20
|
+
*
|
|
21
|
+
* `GET /v1/vault/connections` · scope `vault:read` · served by the node
|
|
22
|
+
*/
|
|
23
|
+
listConnections(params?: T.VaultListConnectionsParams, options?: RequestOptions): ListPromise<T.ConnectionList, T.Connection>;
|
|
24
|
+
/**
|
|
25
|
+
* Create a connection
|
|
26
|
+
*
|
|
27
|
+
* Stores a credential. For a pack connection give `pack` and `key` (the connection key in the pack); the type
|
|
28
|
+
* and bound hosts come from the pack and `type`, if given, must match. For a credential used by your own HTTP
|
|
29
|
+
* steps give `type` and `hosts`. For a verification-only connection give `type` and no `hosts` (or `[]`): it
|
|
30
|
+
* is never injected into any request and holds a secret B3OS itself uses, such as a routine webhook's
|
|
31
|
+
* signing secret (`verify.secret`). `secret` holds the fields of the type: `api_key` {api_key}, `basic`
|
|
32
|
+
* {username, password}, `bearer` {token}, `oauth2` {access_token, refresh_token?, expires_at?, client_id?,
|
|
33
|
+
* client_secret?}, `none` {}. An `oauth2` pack connection with `refresh_token` and `expires_at` is refreshed in
|
|
34
|
+
* the background, always against the token endpoint (`tokenUrl`) its pack declared when the connection was
|
|
35
|
+
* created. A project holds at most 1,000 connections (limit `vault.connections`; more is 422
|
|
36
|
+
* `limit_exceeded`).
|
|
37
|
+
*
|
|
38
|
+
* `POST /v1/vault/connections` · scope `vault:write` · served by the node
|
|
39
|
+
*/
|
|
40
|
+
createConnection(body: T.ConnectionCreateRequest, options?: RequestOptions): APIPromise<T.Connection>;
|
|
41
|
+
/**
|
|
42
|
+
* Delete a connection
|
|
43
|
+
*
|
|
44
|
+
* Deletes the connection and its encrypted secret. Routine versions that bind it fail their next step that needs
|
|
45
|
+
* it with `connection_required`; sandboxes granted it lose access.
|
|
46
|
+
*
|
|
47
|
+
* `DELETE /v1/vault/connections/{connection_id}` · scope `vault:write` · served by the node
|
|
48
|
+
*/
|
|
49
|
+
deleteConnection(connectionId: string, options?: RequestOptions): APIPromise<T.Deleted>;
|
|
50
|
+
/**
|
|
51
|
+
* Get a connection
|
|
52
|
+
*
|
|
53
|
+
* Returns a connection's metadata, bound hosts and the names of its stored secret fields. Values are never returned.
|
|
54
|
+
*
|
|
55
|
+
* `GET /v1/vault/connections/{connection_id}` · scope `vault:read` · served by the node
|
|
56
|
+
*/
|
|
57
|
+
getConnection(connectionId: string, options?: RequestOptions): APIPromise<T.Connection>;
|
|
58
|
+
/**
|
|
59
|
+
* Update a connection
|
|
60
|
+
*
|
|
61
|
+
* Changes a connection's label, subject, params, bound hosts (custom connections only) or metadata, or replaces
|
|
62
|
+
* its secret (all fields at once, for rotation). Omitted fields are unchanged. In-flight calls finish with the old
|
|
63
|
+
* secret; new calls use the new one. Concurrent updates of one connection apply one after another; 409
|
|
64
|
+
* `conflict` means the connection kept changing while this update ran (read it and try again).
|
|
65
|
+
*
|
|
66
|
+
* `PATCH /v1/vault/connections/{connection_id}` · scope `vault:write` · served by the node
|
|
67
|
+
*/
|
|
68
|
+
updateConnection(connectionId: string, body: T.ConnectionUpdateRequest, options?: RequestOptions): APIPromise<T.Connection>;
|
|
69
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Generated by packages/sdk/scripts/generate.mjs from packages/spec/dist. Do not edit; run `pnpm generate`.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.VaultAPI = exports.vaultOps = void 0;
|
|
5
|
+
const namespace_ts_1 = require("../../core/namespace.js");
|
|
6
|
+
const listConnectionsOp = {
|
|
7
|
+
id: "vaultListConnections",
|
|
8
|
+
method: "GET",
|
|
9
|
+
path: "/v1/vault/connections",
|
|
10
|
+
timeoutMs: 10000,
|
|
11
|
+
scope: "vault:read",
|
|
12
|
+
};
|
|
13
|
+
const createConnectionOp = {
|
|
14
|
+
id: "vaultCreateConnection",
|
|
15
|
+
method: "POST",
|
|
16
|
+
path: "/v1/vault/connections",
|
|
17
|
+
body: "json",
|
|
18
|
+
idem: true,
|
|
19
|
+
timeoutMs: 10000,
|
|
20
|
+
scope: "vault:write",
|
|
21
|
+
};
|
|
22
|
+
const deleteConnectionOp = {
|
|
23
|
+
id: "vaultDeleteConnection",
|
|
24
|
+
method: "DELETE",
|
|
25
|
+
path: "/v1/vault/connections/{connection_id}",
|
|
26
|
+
params: ["connection_id"],
|
|
27
|
+
timeoutMs: 10000,
|
|
28
|
+
scope: "vault:write",
|
|
29
|
+
};
|
|
30
|
+
const getConnectionOp = {
|
|
31
|
+
id: "vaultGetConnection",
|
|
32
|
+
method: "GET",
|
|
33
|
+
path: "/v1/vault/connections/{connection_id}",
|
|
34
|
+
params: ["connection_id"],
|
|
35
|
+
timeoutMs: 10000,
|
|
36
|
+
scope: "vault:read",
|
|
37
|
+
};
|
|
38
|
+
const updateConnectionOp = {
|
|
39
|
+
id: "vaultUpdateConnection",
|
|
40
|
+
method: "PATCH",
|
|
41
|
+
path: "/v1/vault/connections/{connection_id}",
|
|
42
|
+
params: ["connection_id"],
|
|
43
|
+
body: "json",
|
|
44
|
+
timeoutMs: 10000,
|
|
45
|
+
scope: "vault:write",
|
|
46
|
+
};
|
|
47
|
+
/** Descriptors of every vault operation, keyed by method name (for tooling and custom clients). */
|
|
48
|
+
exports.vaultOps = {
|
|
49
|
+
listConnections: listConnectionsOp,
|
|
50
|
+
createConnection: createConnectionOp,
|
|
51
|
+
deleteConnection: deleteConnectionOp,
|
|
52
|
+
getConnection: getConnectionOp,
|
|
53
|
+
updateConnection: updateConnectionOp,
|
|
54
|
+
};
|
|
55
|
+
/** Stored connections (credentials actions and routines use without seeing them) (`/v1/vault`). */
|
|
56
|
+
class VaultAPI extends namespace_ts_1.Namespace {
|
|
57
|
+
/**
|
|
58
|
+
* List connections
|
|
59
|
+
*
|
|
60
|
+
* Lists connections in this project, newest first, optionally only one pack's or one subject's.
|
|
61
|
+
*
|
|
62
|
+
* `GET /v1/vault/connections` · scope `vault:read` · served by the node
|
|
63
|
+
*/
|
|
64
|
+
listConnections(params, options) {
|
|
65
|
+
return this._client._list(listConnectionsOp, { query: params }, options);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Create a connection
|
|
69
|
+
*
|
|
70
|
+
* Stores a credential. For a pack connection give `pack` and `key` (the connection key in the pack); the type
|
|
71
|
+
* and bound hosts come from the pack and `type`, if given, must match. For a credential used by your own HTTP
|
|
72
|
+
* steps give `type` and `hosts`. For a verification-only connection give `type` and no `hosts` (or `[]`): it
|
|
73
|
+
* is never injected into any request and holds a secret B3OS itself uses, such as a routine webhook's
|
|
74
|
+
* signing secret (`verify.secret`). `secret` holds the fields of the type: `api_key` {api_key}, `basic`
|
|
75
|
+
* {username, password}, `bearer` {token}, `oauth2` {access_token, refresh_token?, expires_at?, client_id?,
|
|
76
|
+
* client_secret?}, `none` {}. An `oauth2` pack connection with `refresh_token` and `expires_at` is refreshed in
|
|
77
|
+
* the background, always against the token endpoint (`tokenUrl`) its pack declared when the connection was
|
|
78
|
+
* created. A project holds at most 1,000 connections (limit `vault.connections`; more is 422
|
|
79
|
+
* `limit_exceeded`).
|
|
80
|
+
*
|
|
81
|
+
* `POST /v1/vault/connections` · scope `vault:write` · served by the node
|
|
82
|
+
*/
|
|
83
|
+
createConnection(body, options) {
|
|
84
|
+
return this._client._call(createConnectionOp, { body }, options);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Delete a connection
|
|
88
|
+
*
|
|
89
|
+
* Deletes the connection and its encrypted secret. Routine versions that bind it fail their next step that needs
|
|
90
|
+
* it with `connection_required`; sandboxes granted it lose access.
|
|
91
|
+
*
|
|
92
|
+
* `DELETE /v1/vault/connections/{connection_id}` · scope `vault:write` · served by the node
|
|
93
|
+
*/
|
|
94
|
+
deleteConnection(connectionId, options) {
|
|
95
|
+
return this._client._call(deleteConnectionOp, { path: [connectionId] }, options);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get a connection
|
|
99
|
+
*
|
|
100
|
+
* Returns a connection's metadata, bound hosts and the names of its stored secret fields. Values are never returned.
|
|
101
|
+
*
|
|
102
|
+
* `GET /v1/vault/connections/{connection_id}` · scope `vault:read` · served by the node
|
|
103
|
+
*/
|
|
104
|
+
getConnection(connectionId, options) {
|
|
105
|
+
return this._client._call(getConnectionOp, { path: [connectionId] }, options);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Update a connection
|
|
109
|
+
*
|
|
110
|
+
* Changes a connection's label, subject, params, bound hosts (custom connections only) or metadata, or replaces
|
|
111
|
+
* its secret (all fields at once, for rotation). Omitted fields are unchanged. In-flight calls finish with the old
|
|
112
|
+
* secret; new calls use the new one. Concurrent updates of one connection apply one after another; 409
|
|
113
|
+
* `conflict` means the connection kept changing while this update ran (read it and try again).
|
|
114
|
+
*
|
|
115
|
+
* `PATCH /v1/vault/connections/{connection_id}` · scope `vault:write` · served by the node
|
|
116
|
+
*/
|
|
117
|
+
updateConnection(connectionId, body, options) {
|
|
118
|
+
return this._client._call(updateConnectionOp, { path: [connectionId], body }, options);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.VaultAPI = VaultAPI;
|
|
122
|
+
//# sourceMappingURL=vault.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vault.js","sourceRoot":"","sources":["../../../../src/generated/ns/vault.ts"],"names":[],"mappings":";AAAA,4GAA4G;;;AAG5G,0DAAoD;AAKpD,MAAM,iBAAiB,GAAO;IAC5B,EAAE,EAAE,sBAAsB;IAC1B,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,uBAAuB;IAC7B,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,YAAY;CACpB,CAAC;AACF,MAAM,kBAAkB,GAAO;IAC7B,EAAE,EAAE,uBAAuB;IAC3B,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,aAAa;CACrB,CAAC;AACF,MAAM,kBAAkB,GAAO;IAC7B,EAAE,EAAE,uBAAuB;IAC3B,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,uCAAuC;IAC7C,MAAM,EAAE,CAAC,eAAe,CAAC;IACzB,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,aAAa;CACrB,CAAC;AACF,MAAM,eAAe,GAAO;IAC1B,EAAE,EAAE,oBAAoB;IACxB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,uCAAuC;IAC7C,MAAM,EAAE,CAAC,eAAe,CAAC;IACzB,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,YAAY;CACpB,CAAC;AACF,MAAM,kBAAkB,GAAO;IAC7B,EAAE,EAAE,uBAAuB;IAC3B,MAAM,EAAE,OAAO;IACf,IAAI,EAAE,uCAAuC;IAC7C,MAAM,EAAE,CAAC,eAAe,CAAC;IACzB,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,aAAa;CACrB,CAAC;AAEF,mGAAmG;AACtF,QAAA,QAAQ,GAAG;IACtB,eAAe,EAAE,iBAAiB;IAClC,gBAAgB,EAAE,kBAAkB;IACpC,gBAAgB,EAAE,kBAAkB;IACpC,aAAa,EAAE,eAAe;IAC9B,gBAAgB,EAAE,kBAAkB;CAC5B,CAAC;AAEX,mGAAmG;AACnG,MAAa,QAAS,SAAQ,wBAAS;IACrC;;;;;;OAMG;IACH,eAAe,CACb,MAAqC,EACrC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAiC,iBAAiB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IAC3G,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,CAAC,IAA+B,EAAE,OAAwB;QACxE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAe,kBAAkB,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IACjF,CAAC;IAED;;;;;;;OAOG;IACH,gBAAgB,CAAC,YAAoB,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAY,kBAAkB,EAAE,EAAE,IAAI,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9F,CAAC;IAED;;;;;;OAMG;IACH,aAAa,CAAC,YAAoB,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAe,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9F,CAAC;IAED;;;;;;;;;OASG;IACH,gBAAgB,CACd,YAAoB,EACpB,IAA+B,EAC/B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAe,kBAAkB,EAAE,EAAE,IAAI,EAAE,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IACvG,CAAC;CACF;AA3ED,4BA2EC"}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import type { RequestOptions, StreamOptions } from "../../core/client.ts";
|
|
2
|
+
import { Namespace } from "../../core/namespace.ts";
|
|
3
|
+
import type { Op } from "../../core/op.ts";
|
|
4
|
+
import type { APIPromise, JobPromise, ListPromise } from "../../core/promise.ts";
|
|
5
|
+
import type { EventStream } from "../../core/sse.ts";
|
|
6
|
+
import { type CdpEndpoint } from "../../core/ws.ts";
|
|
7
|
+
import type * as T from "../types.ts";
|
|
8
|
+
/** Descriptors of every vision operation, keyed by method name (for tooling and custom clients). */
|
|
9
|
+
export declare const visionOps: {
|
|
10
|
+
readonly listBatches: Op;
|
|
11
|
+
readonly createBatch: Op;
|
|
12
|
+
readonly getBatch: Op;
|
|
13
|
+
readonly cancelBatch: Op;
|
|
14
|
+
readonly batchEvents: Op;
|
|
15
|
+
readonly listBatchPages: Op;
|
|
16
|
+
readonly listCrawls: Op;
|
|
17
|
+
readonly createCrawl: Op;
|
|
18
|
+
readonly getCrawl: Op;
|
|
19
|
+
readonly cancelCrawl: Op;
|
|
20
|
+
readonly crawlEvents: Op;
|
|
21
|
+
readonly listCrawlPages: Op;
|
|
22
|
+
readonly createExtract: Op;
|
|
23
|
+
readonly getExtract: Op;
|
|
24
|
+
readonly cancelExtract: Op;
|
|
25
|
+
readonly extractEvents: Op;
|
|
26
|
+
readonly map: Op;
|
|
27
|
+
readonly listProfiles: Op;
|
|
28
|
+
readonly createProfile: Op;
|
|
29
|
+
readonly deleteProfile: Op;
|
|
30
|
+
readonly getProfile: Op;
|
|
31
|
+
readonly updateProfile: Op;
|
|
32
|
+
readonly exportProfileState: Op;
|
|
33
|
+
readonly readUrl: Op;
|
|
34
|
+
readonly scrape: Op;
|
|
35
|
+
readonly listSessions: Op;
|
|
36
|
+
readonly createSession: Op;
|
|
37
|
+
readonly closeSession: Op;
|
|
38
|
+
readonly getSession: Op;
|
|
39
|
+
readonly act: Op;
|
|
40
|
+
readonly connectCdp: Op;
|
|
41
|
+
readonly saveSessionProfile: Op;
|
|
42
|
+
readonly createSessionTicket: Op;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Browsers and web extraction: scrape, map, crawl, batch, browser sessions and profiles (`/v1/vision`).
|
|
46
|
+
*/
|
|
47
|
+
export declare class VisionAPI extends Namespace {
|
|
48
|
+
/**
|
|
49
|
+
* List batch scrapes
|
|
50
|
+
*
|
|
51
|
+
* Lists batch scrapes in this project, newest first. Records are kept for 7 days after they finish.
|
|
52
|
+
*
|
|
53
|
+
* `GET /v1/vision/batches` · scope `vision:read` · served by the node
|
|
54
|
+
*/
|
|
55
|
+
listBatches(params?: T.VisionListBatchesParams, options?: RequestOptions): ListPromise<T.BatchScrapeList, T.BatchScrape>;
|
|
56
|
+
/**
|
|
57
|
+
* Scrape a list of URLs
|
|
58
|
+
*
|
|
59
|
+
* Starts a job that scrapes up to 1,000 URLs with the same options. Each page bills one `vision.page`.
|
|
60
|
+
* Results are listed with `GET /v1/vision/batches/{batch_id}/pages`; `?wait=`, the events stream and
|
|
61
|
+
* `webhook` report progress.
|
|
62
|
+
*
|
|
63
|
+
* `POST /v1/vision/batches` · scope `vision:run` · served by the node
|
|
64
|
+
*/
|
|
65
|
+
createBatch(body: T.BatchCreateRequest, options?: RequestOptions): JobPromise<T.BatchScrape, T.BatchEvent>;
|
|
66
|
+
/**
|
|
67
|
+
* Get a batch scrape
|
|
68
|
+
*
|
|
69
|
+
* Returns the batch job with its status, progress and summary result. Page contents are listed separately.
|
|
70
|
+
*
|
|
71
|
+
* `GET /v1/vision/batches/{batch_id}` · scope `vision:read` · served by the node
|
|
72
|
+
*/
|
|
73
|
+
getBatch(batchId: string, options?: RequestOptions): APIPromise<T.BatchScrape>;
|
|
74
|
+
/**
|
|
75
|
+
* Cancel a batch scrape
|
|
76
|
+
*
|
|
77
|
+
* Stops scraping new URLs. Pages already scraped stay listed and billed. Returns the batch with status `canceled`.
|
|
78
|
+
*
|
|
79
|
+
* `POST /v1/vision/batches/{batch_id}/cancel` · scope `vision:run` · served by the node
|
|
80
|
+
*/
|
|
81
|
+
cancelBatch(batchId: string, options?: RequestOptions): APIPromise<T.BatchScrape>;
|
|
82
|
+
/**
|
|
83
|
+
* Stream a batch's events
|
|
84
|
+
*
|
|
85
|
+
* Server-sent events for the batch: lifecycle events plus `page.succeeded` and `page.failed` per URL. Ends
|
|
86
|
+
* after the terminal event. Reconnect with `Last-Event-ID` to resume.
|
|
87
|
+
*
|
|
88
|
+
* `GET /v1/vision/batches/{batch_id}/events` · scope `vision:read` · served by the node
|
|
89
|
+
*/
|
|
90
|
+
batchEvents(batchId: string, options?: StreamOptions): EventStream<T.BatchEvent>;
|
|
91
|
+
/**
|
|
92
|
+
* List a batch's page results
|
|
93
|
+
*
|
|
94
|
+
* Lists the scraped pages of a batch in completion order, including failures. Available while the batch runs.
|
|
95
|
+
*
|
|
96
|
+
* `GET /v1/vision/batches/{batch_id}/pages` · scope `vision:read` · served by the node
|
|
97
|
+
*/
|
|
98
|
+
listBatchPages(batchId: string, params?: T.VisionListBatchPagesParams, options?: RequestOptions): ListPromise<T.PageResultList, T.PageResult>;
|
|
99
|
+
/**
|
|
100
|
+
* List crawls
|
|
101
|
+
*
|
|
102
|
+
* Lists crawls in this project, newest first. Records are kept for 7 days after they finish.
|
|
103
|
+
*
|
|
104
|
+
* `GET /v1/vision/crawls` · scope `vision:read` · served by the node
|
|
105
|
+
*/
|
|
106
|
+
listCrawls(params?: T.VisionListCrawlsParams, options?: RequestOptions): ListPromise<T.CrawlList, T.Crawl>;
|
|
107
|
+
/**
|
|
108
|
+
* Crawl a site
|
|
109
|
+
*
|
|
110
|
+
* Starts a job that discovers pages from `url` (links and sitemaps), breadth first, and scrapes up to `limit`
|
|
111
|
+
* pages (at most 500). robots.txt is honored and requests to one host are spaced politely. One crawl runs
|
|
112
|
+
* at a time per organization. Each page bills one `vision.page`.
|
|
113
|
+
*
|
|
114
|
+
* `POST /v1/vision/crawls` · scope `vision:run` · served by the node
|
|
115
|
+
*/
|
|
116
|
+
createCrawl(body: T.CrawlCreateRequest, options?: RequestOptions): JobPromise<T.Crawl, T.CrawlEvent>;
|
|
117
|
+
/**
|
|
118
|
+
* Get a crawl
|
|
119
|
+
*
|
|
120
|
+
* Returns the crawl job with its status, progress and summary result. Page contents are listed separately.
|
|
121
|
+
*
|
|
122
|
+
* `GET /v1/vision/crawls/{crawl_id}` · scope `vision:read` · served by the node
|
|
123
|
+
*/
|
|
124
|
+
getCrawl(crawlId: string, options?: RequestOptions): APIPromise<T.Crawl>;
|
|
125
|
+
/**
|
|
126
|
+
* Cancel a crawl
|
|
127
|
+
*
|
|
128
|
+
* Stops discovering and scraping pages. Pages already scraped stay listed and billed.
|
|
129
|
+
*
|
|
130
|
+
* `POST /v1/vision/crawls/{crawl_id}/cancel` · scope `vision:run` · served by the node
|
|
131
|
+
*/
|
|
132
|
+
cancelCrawl(crawlId: string, options?: RequestOptions): APIPromise<T.Crawl>;
|
|
133
|
+
/**
|
|
134
|
+
* Stream a crawl's events
|
|
135
|
+
*
|
|
136
|
+
* Server-sent events for the crawl: lifecycle events plus `page.succeeded` and `page.failed` per page. Ends
|
|
137
|
+
* after the terminal event. Reconnect with `Last-Event-ID` to resume.
|
|
138
|
+
*
|
|
139
|
+
* `GET /v1/vision/crawls/{crawl_id}/events` · scope `vision:read` · served by the node
|
|
140
|
+
*/
|
|
141
|
+
crawlEvents(crawlId: string, options?: StreamOptions): EventStream<T.CrawlEvent>;
|
|
142
|
+
/**
|
|
143
|
+
* List a crawl's page results
|
|
144
|
+
*
|
|
145
|
+
* Lists crawled pages in completion order, including failures. Available while the crawl runs.
|
|
146
|
+
*
|
|
147
|
+
* `GET /v1/vision/crawls/{crawl_id}/pages` · scope `vision:read` · served by the node
|
|
148
|
+
*/
|
|
149
|
+
listCrawlPages(crawlId: string, params?: T.VisionListCrawlPagesParams, options?: RequestOptions): ListPromise<T.PageResultList, T.PageResult>;
|
|
150
|
+
/**
|
|
151
|
+
* Extract structured data
|
|
152
|
+
*
|
|
153
|
+
* Starts a job that scrapes up to 10 URLs and asks the node's model to fill your JSON Schema from their
|
|
154
|
+
* content (with `prompt` as guidance). The result is validated against the schema; an invalid result after
|
|
155
|
+
* retries fails the job with `extraction_failed`. Bills `vision.page` per page plus the model's tokens.
|
|
156
|
+
*
|
|
157
|
+
* `POST /v1/vision/extracts` · scope `vision:run` · served by the node
|
|
158
|
+
*
|
|
159
|
+
* Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
|
|
160
|
+
*/
|
|
161
|
+
createExtract(body: T.ExtractCreateRequest, options?: RequestOptions): JobPromise<T.ExtractJob, T.JobEvent>;
|
|
162
|
+
/**
|
|
163
|
+
* Get an extraction
|
|
164
|
+
*
|
|
165
|
+
* Returns the extraction job; `result.data` holds the extracted JSON once it succeeded.
|
|
166
|
+
*
|
|
167
|
+
* `GET /v1/vision/extracts/{job_id}` · scope `vision:read` · served by the node
|
|
168
|
+
*
|
|
169
|
+
* Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
|
|
170
|
+
*/
|
|
171
|
+
getExtract(jobId: string, options?: RequestOptions): APIPromise<T.ExtractJob>;
|
|
172
|
+
/**
|
|
173
|
+
* Cancel an extraction
|
|
174
|
+
*
|
|
175
|
+
* Stops the extraction. Pages already scraped and tokens already used stay billed.
|
|
176
|
+
*
|
|
177
|
+
* `POST /v1/vision/extracts/{job_id}/cancel` · scope `vision:run` · served by the node
|
|
178
|
+
*
|
|
179
|
+
* Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
|
|
180
|
+
*/
|
|
181
|
+
cancelExtract(jobId: string, options?: RequestOptions): APIPromise<T.ExtractJob>;
|
|
182
|
+
/**
|
|
183
|
+
* Stream an extraction's events
|
|
184
|
+
*
|
|
185
|
+
* Server-sent lifecycle events for the extraction job. Ends after the terminal event.
|
|
186
|
+
*
|
|
187
|
+
* `GET /v1/vision/extracts/{job_id}/events` · scope `vision:read` · served by the node
|
|
188
|
+
*
|
|
189
|
+
* Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
|
|
190
|
+
*/
|
|
191
|
+
extractEvents(jobId: string, options?: StreamOptions): EventStream<T.JobEvent>;
|
|
192
|
+
/**
|
|
193
|
+
* Map a site's URLs
|
|
194
|
+
*
|
|
195
|
+
* Lists URLs on a site from its sitemaps and from links on the start page, without scraping each page. Use it
|
|
196
|
+
* to choose what to scrape or crawl. `search` orders the results by relevance to a phrase. Bills one
|
|
197
|
+
* `vision.page` per call.
|
|
198
|
+
*
|
|
199
|
+
* `POST /v1/vision/map` · scope `vision:run` · served by the node
|
|
200
|
+
*/
|
|
201
|
+
map(body: T.MapRequest, options?: RequestOptions): APIPromise<T.MapResult>;
|
|
202
|
+
/**
|
|
203
|
+
* List profiles
|
|
204
|
+
*
|
|
205
|
+
* Lists profiles in this project, newest first.
|
|
206
|
+
*
|
|
207
|
+
* `GET /v1/vision/profiles` · scope `vision:read` · served by the node
|
|
208
|
+
*/
|
|
209
|
+
listProfiles(params?: T.VisionListProfilesParams, options?: RequestOptions): ListPromise<T.ProfileList, T.Profile>;
|
|
210
|
+
/**
|
|
211
|
+
* Create a profile
|
|
212
|
+
*
|
|
213
|
+
* Stores cookies and storage as a named profile, encrypted in the node's vault. `state` is Playwright's
|
|
214
|
+
* `storageState` JSON (`context.storageState({indexedDB: true})`) uploaded as is. Every cookie domain and
|
|
215
|
+
* origin must belong to `domains` (derived from the state when omitted). The API returns counts and domains,
|
|
216
|
+
* never cookie values; `GET /v1/vision/profiles/{profile_id}/state` exports the state.
|
|
217
|
+
*
|
|
218
|
+
* `POST /v1/vision/profiles` · scope `vision:write` · served by the node
|
|
219
|
+
*/
|
|
220
|
+
createProfile(body: T.ProfileCreateRequest, options?: RequestOptions): APIPromise<T.Profile>;
|
|
221
|
+
/**
|
|
222
|
+
* Delete a profile
|
|
223
|
+
*
|
|
224
|
+
* Deletes the profile and every stored revision. Open sessions that loaded it keep their cookies until they close.
|
|
225
|
+
*
|
|
226
|
+
* `DELETE /v1/vision/profiles/{profile_id}` · scope `vision:write` · served by the node
|
|
227
|
+
*/
|
|
228
|
+
deleteProfile(profileId: string, options?: RequestOptions): APIPromise<T.Deleted>;
|
|
229
|
+
/**
|
|
230
|
+
* Get a profile
|
|
231
|
+
*
|
|
232
|
+
* Returns a profile's metadata, revision and counts. Cookie values and storage contents are never returned here.
|
|
233
|
+
*
|
|
234
|
+
* `GET /v1/vision/profiles/{profile_id}` · scope `vision:read` · served by the node
|
|
235
|
+
*/
|
|
236
|
+
getProfile(profileId: string, options?: RequestOptions): APIPromise<T.Profile>;
|
|
237
|
+
/**
|
|
238
|
+
* Update a profile
|
|
239
|
+
*
|
|
240
|
+
* Renames a profile, changes its domains, expiry or metadata, or replaces its state (a new revision).
|
|
241
|
+
* Omitted fields are unchanged.
|
|
242
|
+
*
|
|
243
|
+
* `PATCH /v1/vision/profiles/{profile_id}` · scope `vision:write` · served by the node
|
|
244
|
+
*/
|
|
245
|
+
updateProfile(profileId: string, body: T.ProfileUpdateRequest, options?: RequestOptions): APIPromise<T.Profile>;
|
|
246
|
+
/**
|
|
247
|
+
* Export a profile's state
|
|
248
|
+
*
|
|
249
|
+
* Returns the current revision's storage state (Playwright `storageState` JSON) so you can load it into your
|
|
250
|
+
* own browser or move it to another project. It contains live session cookies: treat the response like a
|
|
251
|
+
* password. Requires `vision:write`, the same scope that can replace the state.
|
|
252
|
+
*
|
|
253
|
+
* `GET /v1/vision/profiles/{profile_id}/state` · scope `vision:write` · served by the node
|
|
254
|
+
*/
|
|
255
|
+
exportProfileState(profileId: string, options?: RequestOptions): APIPromise<T.ProfileStorageState>;
|
|
256
|
+
/**
|
|
257
|
+
* Read a URL as Markdown
|
|
258
|
+
*
|
|
259
|
+
* The shortest way to read a page: put the target URL after `/v1/vision/r/`, unencoded, for example
|
|
260
|
+
* `GET /v1/vision/r/https://example.com/pricing`. Returns `text/markdown` by default. Options go in
|
|
261
|
+
* `X-B3OS-*` headers so the target URL stays untouched. Same tiers, cache and billing as `scrape`.
|
|
262
|
+
*
|
|
263
|
+
* `GET /v1/vision/r/{url}` · scope `vision:run` · served by the node
|
|
264
|
+
*/
|
|
265
|
+
readUrl(url: string, params: T.VisionReadUrlParams & {
|
|
266
|
+
format: "json";
|
|
267
|
+
}, options?: RequestOptions): APIPromise<T.ScrapeResult>;
|
|
268
|
+
readUrl(url: string, params?: T.VisionReadUrlParams, options?: RequestOptions): APIPromise<string>;
|
|
269
|
+
/**
|
|
270
|
+
* Scrape a page
|
|
271
|
+
*
|
|
272
|
+
* Fetches one URL and returns the formats you ask for. With `engine: "auto"` (the default) vision answers
|
|
273
|
+
* from the cache when a fresh copy exists (`max_age_ms`, default 2 days), otherwise fetches over HTTP and
|
|
274
|
+
* switches to a warm browser only when the page needs JavaScript. Custom `headers`, a `profile` or `actions`
|
|
275
|
+
* bypass the cache; a page that sets cookies (by a response or a script) is cached for your organization
|
|
276
|
+
* only. The response's `cache.state` and `tier` say what served it.
|
|
277
|
+
*
|
|
278
|
+
* Synchronous: the response arrives when the page is done, within `timeout_ms` (at most 60 seconds). For
|
|
279
|
+
* many pages use a batch scrape or a crawl.
|
|
280
|
+
*
|
|
281
|
+
* `POST /v1/vision/scrape` · scope `vision:run` · served by the node
|
|
282
|
+
*/
|
|
283
|
+
scrape(body: T.ScrapeRequest, options?: RequestOptions): APIPromise<T.ScrapeResult>;
|
|
284
|
+
/**
|
|
285
|
+
* List browser sessions
|
|
286
|
+
*
|
|
287
|
+
* Lists sessions in this project, newest first, including recently closed ones (kept for 7 days).
|
|
288
|
+
*
|
|
289
|
+
* `GET /v1/vision/sessions` · scope `vision:read` · served by the node
|
|
290
|
+
*/
|
|
291
|
+
listSessions(params?: T.VisionListSessionsParams, options?: RequestOptions): ListPromise<T.BrowserSessionList, T.BrowserSession>;
|
|
292
|
+
/**
|
|
293
|
+
* Create a browser session
|
|
294
|
+
*
|
|
295
|
+
* Claims a warm, dedicated browser for your organization and returns it ready to drive. Load a `profile` to
|
|
296
|
+
* start signed in; set `persist_profile` to save cookies and storage back when the session closes. The
|
|
297
|
+
* session closes after `timeout_s` (at most 1,800) or on `DELETE`. Bills `vision.browser_ms` from claim to
|
|
298
|
+
* close.
|
|
299
|
+
*
|
|
300
|
+
* `POST /v1/vision/sessions` · scope `vision:write` · served by the node
|
|
301
|
+
*/
|
|
302
|
+
createSession(body?: T.SessionCreateRequest, options?: RequestOptions): APIPromise<T.BrowserSession>;
|
|
303
|
+
/**
|
|
304
|
+
* Close a browser session
|
|
305
|
+
*
|
|
306
|
+
* Closes the session and destroys its browser. With `persist_profile`, cookies and storage are saved to the
|
|
307
|
+
* profile first (a newer revision saved by another session fails the save with `profile_conflict` unless
|
|
308
|
+
* `overwrite_profile` was set; the session still closes). Returns the closed session with the final browser
|
|
309
|
+
* time. Closing a closed session returns it unchanged.
|
|
310
|
+
*
|
|
311
|
+
* `DELETE /v1/vision/sessions/{session_id}` · scope `vision:write` · served by the node
|
|
312
|
+
*/
|
|
313
|
+
closeSession(sessionId: string, options?: RequestOptions): APIPromise<T.BrowserSession>;
|
|
314
|
+
/**
|
|
315
|
+
* Get a browser session
|
|
316
|
+
*
|
|
317
|
+
* Returns the session, its open pages and the browser time used so far.
|
|
318
|
+
*
|
|
319
|
+
* `GET /v1/vision/sessions/{session_id}` · scope `vision:read` · served by the node
|
|
320
|
+
*/
|
|
321
|
+
getSession(sessionId: string, options?: RequestOptions): APIPromise<T.BrowserSession>;
|
|
322
|
+
/**
|
|
323
|
+
* Run browser actions
|
|
324
|
+
*
|
|
325
|
+
* Runs a batch of browser actions in order on one page and returns every result in one round trip:
|
|
326
|
+
* `navigate`, `click`, `hover`, `type`, `key`, `scroll`, `select` and `wait` (the same kinds and fields as
|
|
327
|
+
* render scripts), plus `evaluate`, `screenshot` and `markdown`. Execution stops at the first failed action
|
|
328
|
+
* unless `continue_on_error` is set; the failed action's result carries the error (for example
|
|
329
|
+
* `target_not_found`) and later actions are reported as `skipped`. The batch must finish within `timeout_ms`.
|
|
330
|
+
*
|
|
331
|
+
* `POST /v1/vision/sessions/{session_id}/act` · scope `vision:run` · served by the node
|
|
332
|
+
*/
|
|
333
|
+
act(sessionId: string, body: T.ActRequest, options?: RequestOptions): APIPromise<T.ActResult>;
|
|
334
|
+
/**
|
|
335
|
+
* Connect over CDP
|
|
336
|
+
*
|
|
337
|
+
* Opens a WebSocket that speaks the Chrome DevTools Protocol for this session only, so Playwright
|
|
338
|
+
* (`chromium.connectOverCDP`), Puppeteer (`puppeteer.connect`) or any CDP client can drive the browser. The
|
|
339
|
+
* proxy exposes only the session's own targets. It refuses `SystemInfo.*`, `Tethering.*`, `Extensions.*`,
|
|
340
|
+
* `Cast.*`, and `Browser.*` except the methods Playwright and Puppeteer need to drive a browser
|
|
341
|
+
* (`getVersion`, the permission methods, window bounds, `setDownloadBehavior` and `cancelDownload`); host
|
|
342
|
+
* file access (`DOM.setFileInputFiles`, file drags); downloads to host paths (they land in the session's
|
|
343
|
+
* own directory, wiped with the browser); and navigation to anything but `http:`, `https:` and
|
|
344
|
+
* `about:blank` (`file:`, `chrome:`, `chrome-extension:`, `view-source:`, `devtools:`, `data:`). These
|
|
345
|
+
* answer `cdp_method_blocked` in the CDP error (`error.data.code`). `Target.createBrowserContext` with
|
|
346
|
+
* `proxyServer`, `proxyBypassList` or `originsWithUniversalNetworkAccess` answers `forbidden` (403):
|
|
347
|
+
* every context of a session uses the session's egress. Authenticate with the `Authorization` header or a
|
|
348
|
+
* ticket from `POST /v1/vision/sessions/{session_id}/ticket`. A client that falls more than a few MB
|
|
349
|
+
* behind is disconnected, and so is one that sends a message over 32 MiB. A message with a repeated member
|
|
350
|
+
* (two `method`s, say) answers the JSON-RPC parse error `-32700`.
|
|
351
|
+
*
|
|
352
|
+
* `GET /v1/vision/sessions/{session_id}/cdp` · scope `vision:run` · served by the node
|
|
353
|
+
*/
|
|
354
|
+
connectCdp(sessionId: string, options?: RequestOptions): Promise<CdpEndpoint>;
|
|
355
|
+
/**
|
|
356
|
+
* Save a session to a profile
|
|
357
|
+
*
|
|
358
|
+
* Saves the session's current cookies and storage to a profile now: the named profile is created if it does
|
|
359
|
+
* not exist, otherwise a new revision replaces its state. Use it right after an agent or a person signs in.
|
|
360
|
+
* If another session saved the profile since this one loaded it, the save fails with `profile_conflict`
|
|
361
|
+
* unless `overwrite` is set.
|
|
362
|
+
*
|
|
363
|
+
* `POST /v1/vision/sessions/{session_id}/profile` · scope `vision:write` · served by the node
|
|
364
|
+
*/
|
|
365
|
+
saveSessionProfile(sessionId: string, body: T.SessionProfileSaveRequest, options?: RequestOptions): APIPromise<T.Profile>;
|
|
366
|
+
/**
|
|
367
|
+
* Create a stream ticket
|
|
368
|
+
*
|
|
369
|
+
* Returns a single-use ticket, valid for 30 seconds, that opens the session's CDP socket without a bearer
|
|
370
|
+
* header (for browsers and CDP clients that cannot set headers). Pass it as `?ticket=` or in
|
|
371
|
+
* `Sec-WebSocket-Protocol: b3os.v1, b3os.ticket.<ticket>`. The socket runs with this caller's scopes.
|
|
372
|
+
*
|
|
373
|
+
* `POST /v1/vision/sessions/{session_id}/ticket` · scope `vision:read` · served by the node
|
|
374
|
+
*/
|
|
375
|
+
createSessionTicket(sessionId: string, options?: RequestOptions): APIPromise<T.StreamTicket>;
|
|
376
|
+
}
|