@onkernel/sdk 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts.map +1 -1
- package/client.js +8 -1
- package/client.js.map +1 -1
- package/client.mjs +8 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/browsers/browsers.d.mts +64 -2
- package/resources/browsers/browsers.d.mts.map +1 -1
- package/resources/browsers/browsers.d.ts +64 -2
- package/resources/browsers/browsers.d.ts.map +1 -1
- package/resources/browsers/browsers.js +8 -0
- package/resources/browsers/browsers.js.map +1 -1
- package/resources/browsers/browsers.mjs +8 -0
- package/resources/browsers/browsers.mjs.map +1 -1
- package/resources/browsers/fs/fs.d.mts +70 -1
- package/resources/browsers/fs/fs.d.mts.map +1 -1
- package/resources/browsers/fs/fs.d.ts +70 -1
- package/resources/browsers/fs/fs.d.ts.map +1 -1
- package/resources/browsers/fs/fs.js +55 -0
- package/resources/browsers/fs/fs.js.map +1 -1
- package/resources/browsers/fs/fs.mjs +55 -0
- package/resources/browsers/fs/fs.mjs.map +1 -1
- package/resources/browsers/fs/index.d.mts +1 -1
- package/resources/browsers/fs/index.d.mts.map +1 -1
- package/resources/browsers/fs/index.d.ts +1 -1
- package/resources/browsers/fs/index.d.ts.map +1 -1
- package/resources/browsers/fs/index.js.map +1 -1
- package/resources/browsers/fs/index.mjs.map +1 -1
- package/resources/browsers/index.d.mts +3 -1
- package/resources/browsers/index.d.mts.map +1 -1
- package/resources/browsers/index.d.ts +3 -1
- package/resources/browsers/index.d.ts.map +1 -1
- package/resources/browsers/index.js +5 -1
- package/resources/browsers/index.js.map +1 -1
- package/resources/browsers/index.mjs +2 -0
- package/resources/browsers/index.mjs.map +1 -1
- package/resources/browsers/logs.d.mts +34 -0
- package/resources/browsers/logs.d.mts.map +1 -0
- package/resources/browsers/logs.d.ts +34 -0
- package/resources/browsers/logs.d.ts.map +1 -0
- package/resources/browsers/logs.js +29 -0
- package/resources/browsers/logs.js.map +1 -0
- package/resources/browsers/logs.mjs +25 -0
- package/resources/browsers/logs.mjs.map +1 -0
- package/resources/browsers/process.d.mts +274 -0
- package/resources/browsers/process.d.mts.map +1 -0
- package/resources/browsers/process.d.ts +274 -0
- package/resources/browsers/process.d.ts.map +1 -0
- package/resources/browsers/process.js +101 -0
- package/resources/browsers/process.js.map +1 -0
- package/resources/browsers/process.mjs +97 -0
- package/resources/browsers/process.mjs.map +1 -0
- package/src/client.ts +15 -1
- package/src/resources/browsers/browsers.ts +113 -0
- package/src/resources/browsers/fs/fs.ts +105 -0
- package/src/resources/browsers/fs/index.ts +3 -0
- package/src/resources/browsers/index.ts +19 -0
- package/src/resources/browsers/logs.ts +50 -0
- package/src/resources/browsers/process.ts +366 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
4
|
import * as BrowsersAPI from './browsers';
|
|
5
|
+
import * as LogsAPI from './logs';
|
|
6
|
+
import { LogStreamParams, Logs } from './logs';
|
|
7
|
+
import * as ProcessAPI from './process';
|
|
8
|
+
import {
|
|
9
|
+
Process,
|
|
10
|
+
ProcessExecParams,
|
|
11
|
+
ProcessExecResponse,
|
|
12
|
+
ProcessKillParams,
|
|
13
|
+
ProcessKillResponse,
|
|
14
|
+
ProcessSpawnParams,
|
|
15
|
+
ProcessSpawnResponse,
|
|
16
|
+
ProcessStatusParams,
|
|
17
|
+
ProcessStatusResponse,
|
|
18
|
+
ProcessStdinParams,
|
|
19
|
+
ProcessStdinResponse,
|
|
20
|
+
ProcessStdoutStreamParams,
|
|
21
|
+
ProcessStdoutStreamResponse,
|
|
22
|
+
} from './process';
|
|
5
23
|
import * as ReplaysAPI from './replays';
|
|
6
24
|
import {
|
|
7
25
|
ReplayDownloadParams,
|
|
@@ -16,6 +34,7 @@ import {
|
|
|
16
34
|
FCreateDirectoryParams,
|
|
17
35
|
FDeleteDirectoryParams,
|
|
18
36
|
FDeleteFileParams,
|
|
37
|
+
FDownloadDirZipParams,
|
|
19
38
|
FFileInfoParams,
|
|
20
39
|
FFileInfoResponse,
|
|
21
40
|
FListFilesParams,
|
|
@@ -23,6 +42,8 @@ import {
|
|
|
23
42
|
FMoveParams,
|
|
24
43
|
FReadFileParams,
|
|
25
44
|
FSetFilePermissionsParams,
|
|
45
|
+
FUploadParams,
|
|
46
|
+
FUploadZipParams,
|
|
26
47
|
FWriteFileParams,
|
|
27
48
|
Fs,
|
|
28
49
|
} from './fs/fs';
|
|
@@ -34,6 +55,8 @@ import { path } from '../../internal/utils/path';
|
|
|
34
55
|
export class Browsers extends APIResource {
|
|
35
56
|
replays: ReplaysAPI.Replays = new ReplaysAPI.Replays(this._client);
|
|
36
57
|
fs: FsAPI.Fs = new FsAPI.Fs(this._client);
|
|
58
|
+
process: ProcessAPI.Process = new ProcessAPI.Process(this._client);
|
|
59
|
+
logs: LogsAPI.Logs = new LogsAPI.Logs(this._client);
|
|
37
60
|
|
|
38
61
|
/**
|
|
39
62
|
* Create a new browser session from within an action.
|
|
@@ -129,11 +152,31 @@ export interface BrowserCreateResponse {
|
|
|
129
152
|
*/
|
|
130
153
|
cdp_ws_url: string;
|
|
131
154
|
|
|
155
|
+
/**
|
|
156
|
+
* When the browser session was created.
|
|
157
|
+
*/
|
|
158
|
+
created_at: string;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Whether the browser session is running in headless mode.
|
|
162
|
+
*/
|
|
163
|
+
headless: boolean;
|
|
164
|
+
|
|
132
165
|
/**
|
|
133
166
|
* Unique identifier for the browser session
|
|
134
167
|
*/
|
|
135
168
|
session_id: string;
|
|
136
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Whether the browser session is running in stealth mode.
|
|
172
|
+
*/
|
|
173
|
+
stealth: boolean;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* The number of seconds of inactivity before the browser session is terminated.
|
|
177
|
+
*/
|
|
178
|
+
timeout_seconds: number;
|
|
179
|
+
|
|
137
180
|
/**
|
|
138
181
|
* Remote URL for live viewing the browser session. Only available for non-headless
|
|
139
182
|
* browsers.
|
|
@@ -152,11 +195,31 @@ export interface BrowserRetrieveResponse {
|
|
|
152
195
|
*/
|
|
153
196
|
cdp_ws_url: string;
|
|
154
197
|
|
|
198
|
+
/**
|
|
199
|
+
* When the browser session was created.
|
|
200
|
+
*/
|
|
201
|
+
created_at: string;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Whether the browser session is running in headless mode.
|
|
205
|
+
*/
|
|
206
|
+
headless: boolean;
|
|
207
|
+
|
|
155
208
|
/**
|
|
156
209
|
* Unique identifier for the browser session
|
|
157
210
|
*/
|
|
158
211
|
session_id: string;
|
|
159
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Whether the browser session is running in stealth mode.
|
|
215
|
+
*/
|
|
216
|
+
stealth: boolean;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* The number of seconds of inactivity before the browser session is terminated.
|
|
220
|
+
*/
|
|
221
|
+
timeout_seconds: number;
|
|
222
|
+
|
|
160
223
|
/**
|
|
161
224
|
* Remote URL for live viewing the browser session. Only available for non-headless
|
|
162
225
|
* browsers.
|
|
@@ -178,11 +241,31 @@ export namespace BrowserListResponse {
|
|
|
178
241
|
*/
|
|
179
242
|
cdp_ws_url: string;
|
|
180
243
|
|
|
244
|
+
/**
|
|
245
|
+
* When the browser session was created.
|
|
246
|
+
*/
|
|
247
|
+
created_at: string;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Whether the browser session is running in headless mode.
|
|
251
|
+
*/
|
|
252
|
+
headless: boolean;
|
|
253
|
+
|
|
181
254
|
/**
|
|
182
255
|
* Unique identifier for the browser session
|
|
183
256
|
*/
|
|
184
257
|
session_id: string;
|
|
185
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Whether the browser session is running in stealth mode.
|
|
261
|
+
*/
|
|
262
|
+
stealth: boolean;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* The number of seconds of inactivity before the browser session is terminated.
|
|
266
|
+
*/
|
|
267
|
+
timeout_seconds: number;
|
|
268
|
+
|
|
186
269
|
/**
|
|
187
270
|
* Remote URL for live viewing the browser session. Only available for non-headless
|
|
188
271
|
* browsers.
|
|
@@ -218,6 +301,13 @@ export interface BrowserCreateParams {
|
|
|
218
301
|
* mechanisms.
|
|
219
302
|
*/
|
|
220
303
|
stealth?: boolean;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* The number of seconds of inactivity before the browser session is terminated.
|
|
307
|
+
* Only applicable to non-persistent browsers. Activity includes CDP connections
|
|
308
|
+
* and live view connections. Defaults to 60 seconds.
|
|
309
|
+
*/
|
|
310
|
+
timeout_seconds?: number;
|
|
221
311
|
}
|
|
222
312
|
|
|
223
313
|
export interface BrowserDeleteParams {
|
|
@@ -229,6 +319,8 @@ export interface BrowserDeleteParams {
|
|
|
229
319
|
|
|
230
320
|
Browsers.Replays = Replays;
|
|
231
321
|
Browsers.Fs = Fs;
|
|
322
|
+
Browsers.Process = Process;
|
|
323
|
+
Browsers.Logs = Logs;
|
|
232
324
|
|
|
233
325
|
export declare namespace Browsers {
|
|
234
326
|
export {
|
|
@@ -256,11 +348,32 @@ export declare namespace Browsers {
|
|
|
256
348
|
type FCreateDirectoryParams as FCreateDirectoryParams,
|
|
257
349
|
type FDeleteDirectoryParams as FDeleteDirectoryParams,
|
|
258
350
|
type FDeleteFileParams as FDeleteFileParams,
|
|
351
|
+
type FDownloadDirZipParams as FDownloadDirZipParams,
|
|
259
352
|
type FFileInfoParams as FFileInfoParams,
|
|
260
353
|
type FListFilesParams as FListFilesParams,
|
|
261
354
|
type FMoveParams as FMoveParams,
|
|
262
355
|
type FReadFileParams as FReadFileParams,
|
|
263
356
|
type FSetFilePermissionsParams as FSetFilePermissionsParams,
|
|
357
|
+
type FUploadParams as FUploadParams,
|
|
358
|
+
type FUploadZipParams as FUploadZipParams,
|
|
264
359
|
type FWriteFileParams as FWriteFileParams,
|
|
265
360
|
};
|
|
361
|
+
|
|
362
|
+
export {
|
|
363
|
+
Process as Process,
|
|
364
|
+
type ProcessExecResponse as ProcessExecResponse,
|
|
365
|
+
type ProcessKillResponse as ProcessKillResponse,
|
|
366
|
+
type ProcessSpawnResponse as ProcessSpawnResponse,
|
|
367
|
+
type ProcessStatusResponse as ProcessStatusResponse,
|
|
368
|
+
type ProcessStdinResponse as ProcessStdinResponse,
|
|
369
|
+
type ProcessStdoutStreamResponse as ProcessStdoutStreamResponse,
|
|
370
|
+
type ProcessExecParams as ProcessExecParams,
|
|
371
|
+
type ProcessKillParams as ProcessKillParams,
|
|
372
|
+
type ProcessSpawnParams as ProcessSpawnParams,
|
|
373
|
+
type ProcessStatusParams as ProcessStatusParams,
|
|
374
|
+
type ProcessStdinParams as ProcessStdinParams,
|
|
375
|
+
type ProcessStdoutStreamParams as ProcessStdoutStreamParams,
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
export { Logs as Logs, type LogStreamParams as LogStreamParams };
|
|
266
379
|
}
|
|
@@ -11,8 +11,10 @@ import {
|
|
|
11
11
|
WatchStopParams,
|
|
12
12
|
} from './watch';
|
|
13
13
|
import { APIPromise } from '../../../core/api-promise';
|
|
14
|
+
import { type Uploadable } from '../../../core/uploads';
|
|
14
15
|
import { buildHeaders } from '../../../internal/headers';
|
|
15
16
|
import { RequestOptions } from '../../../internal/request-options';
|
|
17
|
+
import { multipartFormRequestOptions } from '../../../internal/uploads';
|
|
16
18
|
import { path } from '../../../internal/utils/path';
|
|
17
19
|
|
|
18
20
|
export class Fs extends APIResource {
|
|
@@ -70,6 +72,29 @@ export class Fs extends APIResource {
|
|
|
70
72
|
});
|
|
71
73
|
}
|
|
72
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Returns a ZIP file containing the contents of the specified directory.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* const response = await client.browsers.fs.downloadDirZip(
|
|
81
|
+
* 'id',
|
|
82
|
+
* { path: '/J!' },
|
|
83
|
+
* );
|
|
84
|
+
*
|
|
85
|
+
* const content = await response.blob();
|
|
86
|
+
* console.log(content);
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
downloadDirZip(id: string, query: FDownloadDirZipParams, options?: RequestOptions): APIPromise<Response> {
|
|
90
|
+
return this._client.get(path`/browsers/${id}/fs/download_dir_zip`, {
|
|
91
|
+
query,
|
|
92
|
+
...options,
|
|
93
|
+
headers: buildHeaders([{ Accept: 'application/zip' }, options?.headers]),
|
|
94
|
+
__binaryResponse: true,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
73
98
|
/**
|
|
74
99
|
* Get information about a file or directory
|
|
75
100
|
*
|
|
@@ -162,6 +187,52 @@ export class Fs extends APIResource {
|
|
|
162
187
|
});
|
|
163
188
|
}
|
|
164
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Allows uploading single or multiple files to the remote filesystem.
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```ts
|
|
195
|
+
* await client.browsers.fs.upload('id', {
|
|
196
|
+
* files: [
|
|
197
|
+
* {
|
|
198
|
+
* dest_path: '/J!',
|
|
199
|
+
* file: fs.createReadStream('path/to/file'),
|
|
200
|
+
* },
|
|
201
|
+
* ],
|
|
202
|
+
* });
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
upload(id: string, body: FUploadParams, options?: RequestOptions): APIPromise<void> {
|
|
206
|
+
return this._client.post(
|
|
207
|
+
path`/browsers/${id}/fs/upload`,
|
|
208
|
+
multipartFormRequestOptions(
|
|
209
|
+
{ body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
|
|
210
|
+
this._client,
|
|
211
|
+
),
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Upload a zip file and extract its contents to the specified destination path.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* await client.browsers.fs.uploadZip('id', {
|
|
221
|
+
* dest_path: '/J!',
|
|
222
|
+
* zip_file: fs.createReadStream('path/to/file'),
|
|
223
|
+
* });
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
uploadZip(id: string, body: FUploadZipParams, options?: RequestOptions): APIPromise<void> {
|
|
227
|
+
return this._client.post(
|
|
228
|
+
path`/browsers/${id}/fs/upload_zip`,
|
|
229
|
+
multipartFormRequestOptions(
|
|
230
|
+
{ body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
|
|
231
|
+
this._client,
|
|
232
|
+
),
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
165
236
|
/**
|
|
166
237
|
* Write or create a file
|
|
167
238
|
*
|
|
@@ -290,6 +361,13 @@ export interface FDeleteFileParams {
|
|
|
290
361
|
path: string;
|
|
291
362
|
}
|
|
292
363
|
|
|
364
|
+
export interface FDownloadDirZipParams {
|
|
365
|
+
/**
|
|
366
|
+
* Absolute directory path to archive and download.
|
|
367
|
+
*/
|
|
368
|
+
path: string;
|
|
369
|
+
}
|
|
370
|
+
|
|
293
371
|
export interface FFileInfoParams {
|
|
294
372
|
/**
|
|
295
373
|
* Absolute path of the file or directory.
|
|
@@ -345,6 +423,30 @@ export interface FSetFilePermissionsParams {
|
|
|
345
423
|
owner?: string;
|
|
346
424
|
}
|
|
347
425
|
|
|
426
|
+
export interface FUploadParams {
|
|
427
|
+
files: Array<FUploadParams.File>;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export namespace FUploadParams {
|
|
431
|
+
export interface File {
|
|
432
|
+
/**
|
|
433
|
+
* Absolute destination path to write the file.
|
|
434
|
+
*/
|
|
435
|
+
dest_path: string;
|
|
436
|
+
|
|
437
|
+
file: Uploadable;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export interface FUploadZipParams {
|
|
442
|
+
/**
|
|
443
|
+
* Absolute destination directory to extract the archive to.
|
|
444
|
+
*/
|
|
445
|
+
dest_path: string;
|
|
446
|
+
|
|
447
|
+
zip_file: Uploadable;
|
|
448
|
+
}
|
|
449
|
+
|
|
348
450
|
export interface FWriteFileParams {
|
|
349
451
|
/**
|
|
350
452
|
* Query param: Destination absolute file path.
|
|
@@ -366,11 +468,14 @@ export declare namespace Fs {
|
|
|
366
468
|
type FCreateDirectoryParams as FCreateDirectoryParams,
|
|
367
469
|
type FDeleteDirectoryParams as FDeleteDirectoryParams,
|
|
368
470
|
type FDeleteFileParams as FDeleteFileParams,
|
|
471
|
+
type FDownloadDirZipParams as FDownloadDirZipParams,
|
|
369
472
|
type FFileInfoParams as FFileInfoParams,
|
|
370
473
|
type FListFilesParams as FListFilesParams,
|
|
371
474
|
type FMoveParams as FMoveParams,
|
|
372
475
|
type FReadFileParams as FReadFileParams,
|
|
373
476
|
type FSetFilePermissionsParams as FSetFilePermissionsParams,
|
|
477
|
+
type FUploadParams as FUploadParams,
|
|
478
|
+
type FUploadZipParams as FUploadZipParams,
|
|
374
479
|
type FWriteFileParams as FWriteFileParams,
|
|
375
480
|
};
|
|
376
481
|
|
|
@@ -7,11 +7,14 @@ export {
|
|
|
7
7
|
type FCreateDirectoryParams,
|
|
8
8
|
type FDeleteDirectoryParams,
|
|
9
9
|
type FDeleteFileParams,
|
|
10
|
+
type FDownloadDirZipParams,
|
|
10
11
|
type FFileInfoParams,
|
|
11
12
|
type FListFilesParams,
|
|
12
13
|
type FMoveParams,
|
|
13
14
|
type FReadFileParams,
|
|
14
15
|
type FSetFilePermissionsParams,
|
|
16
|
+
type FUploadParams,
|
|
17
|
+
type FUploadZipParams,
|
|
15
18
|
type FWriteFileParams,
|
|
16
19
|
} from './fs';
|
|
17
20
|
export {
|
|
@@ -16,13 +16,32 @@ export {
|
|
|
16
16
|
type FCreateDirectoryParams,
|
|
17
17
|
type FDeleteDirectoryParams,
|
|
18
18
|
type FDeleteFileParams,
|
|
19
|
+
type FDownloadDirZipParams,
|
|
19
20
|
type FFileInfoParams,
|
|
20
21
|
type FListFilesParams,
|
|
21
22
|
type FMoveParams,
|
|
22
23
|
type FReadFileParams,
|
|
23
24
|
type FSetFilePermissionsParams,
|
|
25
|
+
type FUploadParams,
|
|
26
|
+
type FUploadZipParams,
|
|
24
27
|
type FWriteFileParams,
|
|
25
28
|
} from './fs/index';
|
|
29
|
+
export { Logs, type LogStreamParams } from './logs';
|
|
30
|
+
export {
|
|
31
|
+
Process,
|
|
32
|
+
type ProcessExecResponse,
|
|
33
|
+
type ProcessKillResponse,
|
|
34
|
+
type ProcessSpawnResponse,
|
|
35
|
+
type ProcessStatusResponse,
|
|
36
|
+
type ProcessStdinResponse,
|
|
37
|
+
type ProcessStdoutStreamResponse,
|
|
38
|
+
type ProcessExecParams,
|
|
39
|
+
type ProcessKillParams,
|
|
40
|
+
type ProcessSpawnParams,
|
|
41
|
+
type ProcessStatusParams,
|
|
42
|
+
type ProcessStdinParams,
|
|
43
|
+
type ProcessStdoutStreamParams,
|
|
44
|
+
} from './process';
|
|
26
45
|
export {
|
|
27
46
|
Replays,
|
|
28
47
|
type ReplayListResponse,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import * as Shared from '../shared';
|
|
5
|
+
import { APIPromise } from '../../core/api-promise';
|
|
6
|
+
import { Stream } from '../../core/streaming';
|
|
7
|
+
import { buildHeaders } from '../../internal/headers';
|
|
8
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
9
|
+
import { path } from '../../internal/utils/path';
|
|
10
|
+
|
|
11
|
+
export class Logs extends APIResource {
|
|
12
|
+
/**
|
|
13
|
+
* Stream log files on the browser instance via SSE
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const logEvent = await client.browsers.logs.stream('id', {
|
|
18
|
+
* source: 'path',
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
stream(id: string, query: LogStreamParams, options?: RequestOptions): APIPromise<Stream<Shared.LogEvent>> {
|
|
23
|
+
return this._client.get(path`/browsers/${id}/logs/stream`, {
|
|
24
|
+
query,
|
|
25
|
+
...options,
|
|
26
|
+
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
27
|
+
stream: true,
|
|
28
|
+
}) as APIPromise<Stream<Shared.LogEvent>>;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface LogStreamParams {
|
|
33
|
+
source: 'path' | 'supervisor';
|
|
34
|
+
|
|
35
|
+
follow?: boolean;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* only required if source is path
|
|
39
|
+
*/
|
|
40
|
+
path?: string;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* only required if source is supervisor
|
|
44
|
+
*/
|
|
45
|
+
supervisor_process?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export declare namespace Logs {
|
|
49
|
+
export { type LogStreamParams as LogStreamParams };
|
|
50
|
+
}
|