@onkernel/sdk 0.6.5 → 0.7.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/CHANGELOG.md +26 -0
- package/client.d.mts +2 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -0
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs.map +1 -1
- package/core/streaming.d.mts +5 -3
- package/core/streaming.d.mts.map +1 -1
- package/core/streaming.d.ts +5 -3
- package/core/streaming.d.ts.map +1 -1
- package/core/streaming.js +16 -10
- package/core/streaming.js.map +1 -1
- package/core/streaming.mjs +16 -10
- package/core/streaming.mjs.map +1 -1
- package/internal/parse.js +2 -2
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +2 -2
- package/internal/parse.mjs.map +1 -1
- package/internal/request-options.d.mts +42 -0
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts +42 -0
- package/internal/request-options.d.ts.map +1 -1
- package/internal/request-options.js.map +1 -1
- package/internal/request-options.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/browsers.d.mts +50 -12
- package/resources/browsers.d.mts.map +1 -1
- package/resources/browsers.d.ts +50 -12
- package/resources/browsers.d.ts.map +1 -1
- package/resources/browsers.js +20 -0
- package/resources/browsers.js.map +1 -1
- package/resources/browsers.mjs +20 -0
- package/resources/browsers.mjs.map +1 -1
- package/src/client.ts +2 -0
- package/src/core/streaming.ts +22 -8
- package/src/internal/parse.ts +2 -2
- package/src/internal/request-options.ts +53 -0
- package/src/resources/browsers.ts +64 -14
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/internal/parse.mjs
CHANGED
|
@@ -9,9 +9,9 @@ export async function defaultParseResponse(client, props) {
|
|
|
9
9
|
// Note: there is an invariant here that isn't represented in the type system
|
|
10
10
|
// that if you set `stream: true` the response type must also be `Stream<T>`
|
|
11
11
|
if (props.options.__streamClass) {
|
|
12
|
-
return props.options.__streamClass.fromSSEResponse(response, props.controller);
|
|
12
|
+
return props.options.__streamClass.fromSSEResponse(response, props.controller, client);
|
|
13
13
|
}
|
|
14
|
-
return Stream.fromSSEResponse(response, props.controller);
|
|
14
|
+
return Stream.fromSSEResponse(response, props.controller, client);
|
|
15
15
|
}
|
|
16
16
|
// fetch refuses to read the body when the status code is 204.
|
|
17
17
|
if (response.status === 204) {
|
package/internal/parse.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.mjs","sourceRoot":"","sources":["../src/internal/parse.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,MAAM,EAAE;OAEV,EAAE,oBAAoB,EAAE,SAAS,EAAE;AAW1C,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAI,MAAc,EAAE,KAAuB;IACnF,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,mBAAmB,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACzE,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE;QAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACzB,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;YAEpG,6EAA6E;YAC7E,4EAA4E;YAE5E,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;gBAChC,OAAO,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"parse.mjs","sourceRoot":"","sources":["../src/internal/parse.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,MAAM,EAAE;OAEV,EAAE,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,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;QACvF,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,OAAO,IAAS,CAAC;QACnB,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,OAAO,IAAoB,CAAC;IAC9B,CAAC,CAAC,EAAE,CAAC;IACL,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,CACrB,IAAI,YAAY,mBAAmB,EACnC,oBAAoB,CAAC;QACnB,mBAAmB;QACnB,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI;QACJ,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;KACnC,CAAC,CACH,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -8,17 +8,59 @@ export type FinalRequestOptions = RequestOptions & {
|
|
|
8
8
|
path: string;
|
|
9
9
|
};
|
|
10
10
|
export type RequestOptions = {
|
|
11
|
+
/**
|
|
12
|
+
* The HTTP method for the request (e.g., 'get', 'post', 'put', 'delete').
|
|
13
|
+
*/
|
|
11
14
|
method?: HTTPMethod;
|
|
15
|
+
/**
|
|
16
|
+
* The URL path for the request.
|
|
17
|
+
*
|
|
18
|
+
* @example "/v1/foo"
|
|
19
|
+
*/
|
|
12
20
|
path?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Query parameters to include in the request URL.
|
|
23
|
+
*/
|
|
13
24
|
query?: object | undefined | null;
|
|
25
|
+
/**
|
|
26
|
+
* The request body. Can be a string, JSON object, FormData, or other supported types.
|
|
27
|
+
*/
|
|
14
28
|
body?: unknown;
|
|
29
|
+
/**
|
|
30
|
+
* HTTP headers to include with the request. Can be a Headers object, plain object, or array of tuples.
|
|
31
|
+
*/
|
|
15
32
|
headers?: HeadersLike;
|
|
33
|
+
/**
|
|
34
|
+
* The maximum number of times that the client will retry a request in case of a
|
|
35
|
+
* temporary failure, like a network error or a 5XX error from the server.
|
|
36
|
+
*
|
|
37
|
+
* @default 2
|
|
38
|
+
*/
|
|
16
39
|
maxRetries?: number;
|
|
17
40
|
stream?: boolean | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* The maximum amount of time (in milliseconds) that the client should wait for a response
|
|
43
|
+
* from the server before timing out a single request.
|
|
44
|
+
*
|
|
45
|
+
* @unit milliseconds
|
|
46
|
+
*/
|
|
18
47
|
timeout?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Additional `RequestInit` options to be passed to the underlying `fetch` call.
|
|
50
|
+
* These options will be merged with the client's default fetch options.
|
|
51
|
+
*/
|
|
19
52
|
fetchOptions?: MergedRequestInit;
|
|
53
|
+
/**
|
|
54
|
+
* An AbortSignal that can be used to cancel the request.
|
|
55
|
+
*/
|
|
20
56
|
signal?: AbortSignal | undefined | null;
|
|
57
|
+
/**
|
|
58
|
+
* A unique key for this request to enable idempotency.
|
|
59
|
+
*/
|
|
21
60
|
idempotencyKey?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Override the default base URL for this specific request.
|
|
63
|
+
*/
|
|
22
64
|
defaultBaseURL?: string | undefined;
|
|
23
65
|
__binaryResponse?: boolean | undefined;
|
|
24
66
|
__streamClass?: typeof Stream;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-options.d.mts","sourceRoot":"","sources":["../src/internal/request-options.ts"],"names":[],"mappings":"OAEO,EAAE,eAAe,EAAE;OAEnB,KAAK,EAAE,QAAQ,EAAE;OACjB,EAAE,MAAM,EAAE;OACV,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE;OACtC,EAAE,KAAK,WAAW,EAAE;AAE3B,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAExF,MAAM,MAAM,cAAc,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AW,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAC1E,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE;IAAE,OAAO,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,KAAK,cAAc,CAAC;AAEtG,eAAO,MAAM,eAAe,EAAE,cAO7B,CAAC"}
|
|
@@ -8,17 +8,59 @@ export type FinalRequestOptions = RequestOptions & {
|
|
|
8
8
|
path: string;
|
|
9
9
|
};
|
|
10
10
|
export type RequestOptions = {
|
|
11
|
+
/**
|
|
12
|
+
* The HTTP method for the request (e.g., 'get', 'post', 'put', 'delete').
|
|
13
|
+
*/
|
|
11
14
|
method?: HTTPMethod;
|
|
15
|
+
/**
|
|
16
|
+
* The URL path for the request.
|
|
17
|
+
*
|
|
18
|
+
* @example "/v1/foo"
|
|
19
|
+
*/
|
|
12
20
|
path?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Query parameters to include in the request URL.
|
|
23
|
+
*/
|
|
13
24
|
query?: object | undefined | null;
|
|
25
|
+
/**
|
|
26
|
+
* The request body. Can be a string, JSON object, FormData, or other supported types.
|
|
27
|
+
*/
|
|
14
28
|
body?: unknown;
|
|
29
|
+
/**
|
|
30
|
+
* HTTP headers to include with the request. Can be a Headers object, plain object, or array of tuples.
|
|
31
|
+
*/
|
|
15
32
|
headers?: HeadersLike;
|
|
33
|
+
/**
|
|
34
|
+
* The maximum number of times that the client will retry a request in case of a
|
|
35
|
+
* temporary failure, like a network error or a 5XX error from the server.
|
|
36
|
+
*
|
|
37
|
+
* @default 2
|
|
38
|
+
*/
|
|
16
39
|
maxRetries?: number;
|
|
17
40
|
stream?: boolean | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* The maximum amount of time (in milliseconds) that the client should wait for a response
|
|
43
|
+
* from the server before timing out a single request.
|
|
44
|
+
*
|
|
45
|
+
* @unit milliseconds
|
|
46
|
+
*/
|
|
18
47
|
timeout?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Additional `RequestInit` options to be passed to the underlying `fetch` call.
|
|
50
|
+
* These options will be merged with the client's default fetch options.
|
|
51
|
+
*/
|
|
19
52
|
fetchOptions?: MergedRequestInit;
|
|
53
|
+
/**
|
|
54
|
+
* An AbortSignal that can be used to cancel the request.
|
|
55
|
+
*/
|
|
20
56
|
signal?: AbortSignal | undefined | null;
|
|
57
|
+
/**
|
|
58
|
+
* A unique key for this request to enable idempotency.
|
|
59
|
+
*/
|
|
21
60
|
idempotencyKey?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Override the default base URL for this specific request.
|
|
63
|
+
*/
|
|
22
64
|
defaultBaseURL?: string | undefined;
|
|
23
65
|
__binaryResponse?: boolean | undefined;
|
|
24
66
|
__streamClass?: typeof Stream;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-options.d.ts","sourceRoot":"","sources":["../src/internal/request-options.ts"],"names":[],"mappings":"OAEO,EAAE,eAAe,EAAE;OAEnB,KAAK,EAAE,QAAQ,EAAE;OACjB,EAAE,MAAM,EAAE;OACV,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE;OACtC,EAAE,KAAK,WAAW,EAAE;AAE3B,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAExF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"request-options.d.ts","sourceRoot":"","sources":["../src/internal/request-options.ts"],"names":[],"mappings":"OAEO,EAAE,eAAe,EAAE;OAEnB,KAAK,EAAE,QAAQ,EAAE;OACjB,EAAE,MAAM,EAAE;OACV,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE;OACtC,EAAE,KAAK,WAAW,EAAE;AAE3B,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG;IAAE,MAAM,E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mappings":";AAAA,sFAAsF;;;
|
|
1
|
+
{"version":3,"file":"request-options.js","sourceRoot":"","sources":["../src/internal/request-options.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAqF/E,MAAM,eAAe,GAAmB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;IACnE,OAAO;QACL,WAAW,EAAE;YACX,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,eAAe,mBAO1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-options.mjs","sourceRoot":"","sources":["../src/internal/request-options.ts"],"names":[],"mappings":"AAAA,sFAAsF;
|
|
1
|
+
{"version":3,"file":"request-options.mjs","sourceRoot":"","sources":["../src/internal/request-options.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAqFtF,MAAM,CAAC,MAAM,eAAe,GAAmB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;IACnE,OAAO;QACL,WAAW,EAAE;YACX,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC;AACJ,CAAC,CAAC"}
|
package/package.json
CHANGED
package/resources/browsers.d.mts
CHANGED
|
@@ -54,6 +54,20 @@ export declare class Browsers extends APIResource {
|
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
56
|
deleteByID(id: string, options?: RequestOptions): APIPromise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Get browser session replay.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* const response = await client.browsers.retrieveReplay(
|
|
63
|
+
* 'htzv5orfit78e1m2biiifpbv',
|
|
64
|
+
* );
|
|
65
|
+
*
|
|
66
|
+
* const content = await response.blob();
|
|
67
|
+
* console.log(content);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
retrieveReplay(id: string, options?: RequestOptions): APIPromise<Response>;
|
|
57
71
|
}
|
|
58
72
|
/**
|
|
59
73
|
* Optional persistence configuration for the browser session.
|
|
@@ -65,10 +79,6 @@ export interface BrowserPersistence {
|
|
|
65
79
|
id: string;
|
|
66
80
|
}
|
|
67
81
|
export interface BrowserCreateResponse {
|
|
68
|
-
/**
|
|
69
|
-
* Remote URL for live viewing the browser session
|
|
70
|
-
*/
|
|
71
|
-
browser_live_view_url: string;
|
|
72
82
|
/**
|
|
73
83
|
* Websocket URL for Chrome DevTools Protocol connections to the browser session
|
|
74
84
|
*/
|
|
@@ -77,16 +87,21 @@ export interface BrowserCreateResponse {
|
|
|
77
87
|
* Unique identifier for the browser session
|
|
78
88
|
*/
|
|
79
89
|
session_id: string;
|
|
90
|
+
/**
|
|
91
|
+
* Remote URL for live viewing the browser session. Only available for non-headless
|
|
92
|
+
* browsers.
|
|
93
|
+
*/
|
|
94
|
+
browser_live_view_url?: string;
|
|
80
95
|
/**
|
|
81
96
|
* Optional persistence configuration for the browser session.
|
|
82
97
|
*/
|
|
83
98
|
persistence?: BrowserPersistence;
|
|
84
|
-
}
|
|
85
|
-
export interface BrowserRetrieveResponse {
|
|
86
99
|
/**
|
|
87
|
-
* Remote URL for
|
|
100
|
+
* Remote URL for viewing the browser session replay if enabled
|
|
88
101
|
*/
|
|
89
|
-
|
|
102
|
+
replay_view_url?: string;
|
|
103
|
+
}
|
|
104
|
+
export interface BrowserRetrieveResponse {
|
|
90
105
|
/**
|
|
91
106
|
* Websocket URL for Chrome DevTools Protocol connections to the browser session
|
|
92
107
|
*/
|
|
@@ -95,18 +110,23 @@ export interface BrowserRetrieveResponse {
|
|
|
95
110
|
* Unique identifier for the browser session
|
|
96
111
|
*/
|
|
97
112
|
session_id: string;
|
|
113
|
+
/**
|
|
114
|
+
* Remote URL for live viewing the browser session. Only available for non-headless
|
|
115
|
+
* browsers.
|
|
116
|
+
*/
|
|
117
|
+
browser_live_view_url?: string;
|
|
98
118
|
/**
|
|
99
119
|
* Optional persistence configuration for the browser session.
|
|
100
120
|
*/
|
|
101
121
|
persistence?: BrowserPersistence;
|
|
122
|
+
/**
|
|
123
|
+
* Remote URL for viewing the browser session replay if enabled
|
|
124
|
+
*/
|
|
125
|
+
replay_view_url?: string;
|
|
102
126
|
}
|
|
103
127
|
export type BrowserListResponse = Array<BrowserListResponse.BrowserListResponseItem>;
|
|
104
128
|
export declare namespace BrowserListResponse {
|
|
105
129
|
interface BrowserListResponseItem {
|
|
106
|
-
/**
|
|
107
|
-
* Remote URL for live viewing the browser session
|
|
108
|
-
*/
|
|
109
|
-
browser_live_view_url: string;
|
|
110
130
|
/**
|
|
111
131
|
* Websocket URL for Chrome DevTools Protocol connections to the browser session
|
|
112
132
|
*/
|
|
@@ -115,13 +135,27 @@ export declare namespace BrowserListResponse {
|
|
|
115
135
|
* Unique identifier for the browser session
|
|
116
136
|
*/
|
|
117
137
|
session_id: string;
|
|
138
|
+
/**
|
|
139
|
+
* Remote URL for live viewing the browser session. Only available for non-headless
|
|
140
|
+
* browsers.
|
|
141
|
+
*/
|
|
142
|
+
browser_live_view_url?: string;
|
|
118
143
|
/**
|
|
119
144
|
* Optional persistence configuration for the browser session.
|
|
120
145
|
*/
|
|
121
146
|
persistence?: BrowsersAPI.BrowserPersistence;
|
|
147
|
+
/**
|
|
148
|
+
* Remote URL for viewing the browser session replay if enabled
|
|
149
|
+
*/
|
|
150
|
+
replay_view_url?: string;
|
|
122
151
|
}
|
|
123
152
|
}
|
|
124
153
|
export interface BrowserCreateParams {
|
|
154
|
+
/**
|
|
155
|
+
* If true, launches the browser using a headless image (no VNC/GUI). Defaults to
|
|
156
|
+
* false.
|
|
157
|
+
*/
|
|
158
|
+
headless?: boolean;
|
|
125
159
|
/**
|
|
126
160
|
* action invocation ID
|
|
127
161
|
*/
|
|
@@ -130,6 +164,10 @@ export interface BrowserCreateParams {
|
|
|
130
164
|
* Optional persistence configuration for the browser session.
|
|
131
165
|
*/
|
|
132
166
|
persistence?: BrowserPersistence;
|
|
167
|
+
/**
|
|
168
|
+
* If true, enables replay recording of the browser session. Defaults to false.
|
|
169
|
+
*/
|
|
170
|
+
replay?: boolean;
|
|
133
171
|
/**
|
|
134
172
|
* If true, launches the browser in stealth mode to reduce detection by anti-bot
|
|
135
173
|
* mechanisms.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browsers.d.mts","sourceRoot":"","sources":["../src/resources/browsers.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,WAAW;OAChB,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;OAOG;IACH,MAAM,CACJ,IAAI,GAAE,mBAAmB,GAAG,IAAI,GAAG,SAAc,EACjD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,qBAAqB,CAAC;IAIpC;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,uBAAuB,CAAC;IAInF;;;;;;;OAOG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;IAI/D;;;;;;;;;OASG;IACH,MAAM,CAAC,MAAM,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAS/E;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"browsers.d.mts","sourceRoot":"","sources":["../src/resources/browsers.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,WAAW;OAChB,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qB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sers extends APIResource {
|
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
56
|
deleteByID(id: string, options?: RequestOptions): APIPromise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Get browser session replay.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* const response = await client.browsers.retrieveReplay(
|
|
63
|
+
* 'htzv5orfit78e1m2biiifpbv',
|
|
64
|
+
* );
|
|
65
|
+
*
|
|
66
|
+
* const content = await response.blob();
|
|
67
|
+
* console.log(content);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
retrieveReplay(id: string, options?: RequestOptions): APIPromise<Response>;
|
|
57
71
|
}
|
|
58
72
|
/**
|
|
59
73
|
* Optional persistence configuration for the browser session.
|
|
@@ -65,10 +79,6 @@ export interface BrowserPersistence {
|
|
|
65
79
|
id: string;
|
|
66
80
|
}
|
|
67
81
|
export interface BrowserCreateResponse {
|
|
68
|
-
/**
|
|
69
|
-
* Remote URL for live viewing the browser session
|
|
70
|
-
*/
|
|
71
|
-
browser_live_view_url: string;
|
|
72
82
|
/**
|
|
73
83
|
* Websocket URL for Chrome DevTools Protocol connections to the browser session
|
|
74
84
|
*/
|
|
@@ -77,16 +87,21 @@ export interface BrowserCreateResponse {
|
|
|
77
87
|
* Unique identifier for the browser session
|
|
78
88
|
*/
|
|
79
89
|
session_id: string;
|
|
90
|
+
/**
|
|
91
|
+
* Remote URL for live viewing the browser session. Only available for non-headless
|
|
92
|
+
* browsers.
|
|
93
|
+
*/
|
|
94
|
+
browser_live_view_url?: string;
|
|
80
95
|
/**
|
|
81
96
|
* Optional persistence configuration for the browser session.
|
|
82
97
|
*/
|
|
83
98
|
persistence?: BrowserPersistence;
|
|
84
|
-
}
|
|
85
|
-
export interface BrowserRetrieveResponse {
|
|
86
99
|
/**
|
|
87
|
-
* Remote URL for
|
|
100
|
+
* Remote URL for viewing the browser session replay if enabled
|
|
88
101
|
*/
|
|
89
|
-
|
|
102
|
+
replay_view_url?: string;
|
|
103
|
+
}
|
|
104
|
+
export interface BrowserRetrieveResponse {
|
|
90
105
|
/**
|
|
91
106
|
* Websocket URL for Chrome DevTools Protocol connections to the browser session
|
|
92
107
|
*/
|
|
@@ -95,18 +110,23 @@ export interface BrowserRetrieveResponse {
|
|
|
95
110
|
* Unique identifier for the browser session
|
|
96
111
|
*/
|
|
97
112
|
session_id: string;
|
|
113
|
+
/**
|
|
114
|
+
* Remote URL for live viewing the browser session. Only available for non-headless
|
|
115
|
+
* browsers.
|
|
116
|
+
*/
|
|
117
|
+
browser_live_view_url?: string;
|
|
98
118
|
/**
|
|
99
119
|
* Optional persistence configuration for the browser session.
|
|
100
120
|
*/
|
|
101
121
|
persistence?: BrowserPersistence;
|
|
122
|
+
/**
|
|
123
|
+
* Remote URL for viewing the browser session replay if enabled
|
|
124
|
+
*/
|
|
125
|
+
replay_view_url?: string;
|
|
102
126
|
}
|
|
103
127
|
export type BrowserListResponse = Array<BrowserListResponse.BrowserListResponseItem>;
|
|
104
128
|
export declare namespace BrowserListResponse {
|
|
105
129
|
interface BrowserListResponseItem {
|
|
106
|
-
/**
|
|
107
|
-
* Remote URL for live viewing the browser session
|
|
108
|
-
*/
|
|
109
|
-
browser_live_view_url: string;
|
|
110
130
|
/**
|
|
111
131
|
* Websocket URL for Chrome DevTools Protocol connections to the browser session
|
|
112
132
|
*/
|
|
@@ -115,13 +135,27 @@ export declare namespace BrowserListResponse {
|
|
|
115
135
|
* Unique identifier for the browser session
|
|
116
136
|
*/
|
|
117
137
|
session_id: string;
|
|
138
|
+
/**
|
|
139
|
+
* Remote URL for live viewing the browser session. Only available for non-headless
|
|
140
|
+
* browsers.
|
|
141
|
+
*/
|
|
142
|
+
browser_live_view_url?: string;
|
|
118
143
|
/**
|
|
119
144
|
* Optional persistence configuration for the browser session.
|
|
120
145
|
*/
|
|
121
146
|
persistence?: BrowsersAPI.BrowserPersistence;
|
|
147
|
+
/**
|
|
148
|
+
* Remote URL for viewing the browser session replay if enabled
|
|
149
|
+
*/
|
|
150
|
+
replay_view_url?: string;
|
|
122
151
|
}
|
|
123
152
|
}
|
|
124
153
|
export interface BrowserCreateParams {
|
|
154
|
+
/**
|
|
155
|
+
* If true, launches the browser using a headless image (no VNC/GUI). Defaults to
|
|
156
|
+
* false.
|
|
157
|
+
*/
|
|
158
|
+
headless?: boolean;
|
|
125
159
|
/**
|
|
126
160
|
* action invocation ID
|
|
127
161
|
*/
|
|
@@ -130,6 +164,10 @@ export interface BrowserCreateParams {
|
|
|
130
164
|
* Optional persistence configuration for the browser session.
|
|
131
165
|
*/
|
|
132
166
|
persistence?: BrowserPersistence;
|
|
167
|
+
/**
|
|
168
|
+
* If true, enables replay recording of the browser session. Defaults to false.
|
|
169
|
+
*/
|
|
170
|
+
replay?: boolean;
|
|
133
171
|
/**
|
|
134
172
|
* If true, launches the browser in stealth mode to reduce detection by anti-bot
|
|
135
173
|
* mechanisms.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browsers.d.ts","sourceRoot":"","sources":["../src/resources/browsers.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,WAAW;OAChB,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;OAOG;IACH,MAAM,CACJ,IAAI,GAAE,mBAAmB,GAAG,IAAI,GAAG,SAAc,EACjD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,qBAAqB,CAAC;IAIpC;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,uBAAuB,CAAC;IAInF;;;;;;;OAOG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;IAI/D;;;;;;;;;OASG;IACH,MAAM,CAAC,MAAM,EAAE,mBAAmB,EAAE,O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AC;CACvB;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
|
package/resources/browsers.js
CHANGED
|
@@ -75,6 +75,26 @@ class Browsers extends resource_1.APIResource {
|
|
|
75
75
|
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Get browser session replay.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* const response = await client.browsers.retrieveReplay(
|
|
84
|
+
* 'htzv5orfit78e1m2biiifpbv',
|
|
85
|
+
* );
|
|
86
|
+
*
|
|
87
|
+
* const content = await response.blob();
|
|
88
|
+
* console.log(content);
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
retrieveReplay(id, options) {
|
|
92
|
+
return this._client.get((0, path_1.path) `/browsers/${id}/replay`, {
|
|
93
|
+
...options,
|
|
94
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: 'video/mp4' }, options?.headers]),
|
|
95
|
+
__binaryResponse: true,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
78
98
|
}
|
|
79
99
|
exports.Browsers = Browsers;
|
|
80
100
|
//# sourceMappingURL=browsers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browsers.js","sourceRoot":"","sources":["../src/resources/browsers.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;OAO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CAAC;IACL,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,cAAc,CAAC,EAAU,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,aAAa,EAAE,SAAS,EAAE;YACpD,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAClE,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;CACF;AAlGD,4BAkGC"}
|
package/resources/browsers.mjs
CHANGED
|
@@ -72,5 +72,25 @@ export class Browsers extends APIResource {
|
|
|
72
72
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Get browser session replay.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* const response = await client.browsers.retrieveReplay(
|
|
81
|
+
* 'htzv5orfit78e1m2biiifpbv',
|
|
82
|
+
* );
|
|
83
|
+
*
|
|
84
|
+
* const content = await response.blob();
|
|
85
|
+
* console.log(content);
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
retrieveReplay(id, options) {
|
|
89
|
+
return this._client.get(path `/browsers/${id}/replay`, {
|
|
90
|
+
...options,
|
|
91
|
+
headers: buildHeaders([{ Accept: 'video/mp4' }, options?.headers]),
|
|
92
|
+
__binaryResponse: true,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
75
95
|
}
|
|
76
96
|
//# sourceMappingURL=browsers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browsers.mjs","sourceRoot":"","sources":["../src/resources/browsers.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf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AO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,cAAc,CAAC,EAAU,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,EAAE,SAAS,EAAE;YACpD,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAClE,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/src/client.ts
CHANGED
|
@@ -95,6 +95,8 @@ export interface ClientOptions {
|
|
|
95
95
|
*
|
|
96
96
|
* Note that request timeouts are retried by default, so in a worst-case scenario you may wait
|
|
97
97
|
* much longer than this timeout before the promise succeeds or fails.
|
|
98
|
+
*
|
|
99
|
+
* @unit milliseconds
|
|
98
100
|
*/
|
|
99
101
|
timeout?: number | undefined;
|
|
100
102
|
/**
|
package/src/core/streaming.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { findDoubleNewlineIndex, LineDecoder } from '../internal/decoders/line';
|
|
|
5
5
|
import { ReadableStreamToAsyncIterable } from '../internal/shims';
|
|
6
6
|
import { isAbortError } from '../internal/errors';
|
|
7
7
|
import { encodeUTF8 } from '../internal/utils/bytes';
|
|
8
|
+
import { loggerFor } from '../internal/utils/log';
|
|
9
|
+
import type { Kernel } from '../client';
|
|
8
10
|
|
|
9
11
|
type Bytes = string | ArrayBuffer | Uint8Array | null | undefined;
|
|
10
12
|
|
|
@@ -16,16 +18,24 @@ export type ServerSentEvent = {
|
|
|
16
18
|
|
|
17
19
|
export class Stream<Item> implements AsyncIterable<Item> {
|
|
18
20
|
controller: AbortController;
|
|
21
|
+
#client: Kernel | undefined;
|
|
19
22
|
|
|
20
23
|
constructor(
|
|
21
24
|
private iterator: () => AsyncIterator<Item>,
|
|
22
25
|
controller: AbortController,
|
|
26
|
+
client?: Kernel,
|
|
23
27
|
) {
|
|
24
28
|
this.controller = controller;
|
|
29
|
+
this.#client = client;
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
static fromSSEResponse<Item>(
|
|
32
|
+
static fromSSEResponse<Item>(
|
|
33
|
+
response: Response,
|
|
34
|
+
controller: AbortController,
|
|
35
|
+
client?: Kernel,
|
|
36
|
+
): Stream<Item> {
|
|
28
37
|
let consumed = false;
|
|
38
|
+
const logger = client ? loggerFor(client) : console;
|
|
29
39
|
|
|
30
40
|
async function* iterator(): AsyncIterator<Item, any, undefined> {
|
|
31
41
|
if (consumed) {
|
|
@@ -38,8 +48,8 @@ export class Stream<Item> implements AsyncIterable<Item> {
|
|
|
38
48
|
try {
|
|
39
49
|
yield JSON.parse(sse.data);
|
|
40
50
|
} catch (e) {
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
logger.error(`Could not parse message into JSON:`, sse.data);
|
|
52
|
+
logger.error(`From chunk:`, sse.raw);
|
|
43
53
|
throw e;
|
|
44
54
|
}
|
|
45
55
|
}
|
|
@@ -54,14 +64,18 @@ export class Stream<Item> implements AsyncIterable<Item> {
|
|
|
54
64
|
}
|
|
55
65
|
}
|
|
56
66
|
|
|
57
|
-
return new Stream(iterator, controller);
|
|
67
|
+
return new Stream(iterator, controller, client);
|
|
58
68
|
}
|
|
59
69
|
|
|
60
70
|
/**
|
|
61
71
|
* Generates a Stream from a newline-separated ReadableStream
|
|
62
72
|
* where each item is a JSON value.
|
|
63
73
|
*/
|
|
64
|
-
static fromReadableStream<Item>(
|
|
74
|
+
static fromReadableStream<Item>(
|
|
75
|
+
readableStream: ReadableStream,
|
|
76
|
+
controller: AbortController,
|
|
77
|
+
client?: Kernel,
|
|
78
|
+
): Stream<Item> {
|
|
65
79
|
let consumed = false;
|
|
66
80
|
|
|
67
81
|
async function* iterLines(): AsyncGenerator<string, void, unknown> {
|
|
@@ -101,7 +115,7 @@ export class Stream<Item> implements AsyncIterable<Item> {
|
|
|
101
115
|
}
|
|
102
116
|
}
|
|
103
117
|
|
|
104
|
-
return new Stream(iterator, controller);
|
|
118
|
+
return new Stream(iterator, controller, client);
|
|
105
119
|
}
|
|
106
120
|
|
|
107
121
|
[Symbol.asyncIterator](): AsyncIterator<Item> {
|
|
@@ -131,8 +145,8 @@ export class Stream<Item> implements AsyncIterable<Item> {
|
|
|
131
145
|
};
|
|
132
146
|
|
|
133
147
|
return [
|
|
134
|
-
new Stream(() => teeIterator(left), this.controller),
|
|
135
|
-
new Stream(() => teeIterator(right), this.controller),
|
|
148
|
+
new Stream(() => teeIterator(left), this.controller, this.#client),
|
|
149
|
+
new Stream(() => teeIterator(right), this.controller, this.#client),
|
|
136
150
|
];
|
|
137
151
|
}
|
|
138
152
|
|
package/src/internal/parse.ts
CHANGED
|
@@ -24,10 +24,10 @@ export async function defaultParseResponse<T>(client: Kernel, props: APIResponse
|
|
|
24
24
|
// that if you set `stream: true` the response type must also be `Stream<T>`
|
|
25
25
|
|
|
26
26
|
if (props.options.__streamClass) {
|
|
27
|
-
return props.options.__streamClass.fromSSEResponse(response, props.controller) as any;
|
|
27
|
+
return props.options.__streamClass.fromSSEResponse(response, props.controller, client) as any;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
return Stream.fromSSEResponse(response, props.controller) as any;
|
|
30
|
+
return Stream.fromSSEResponse(response, props.controller, client) as any;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// fetch refuses to read the body when the status code is 204.
|