@onkernel/sdk 0.9.1 → 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 +18 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts.map +1 -1
- package/client.js +1 -1
- package/client.js.map +1 -1
- package/client.mjs +1 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/browsers/browsers.d.mts +10 -2
- package/resources/browsers/browsers.d.mts.map +1 -1
- package/resources/browsers/browsers.d.ts +10 -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 +3 -1
- package/src/resources/browsers/browsers.ts +46 -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
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
+
import { buildHeaders } from "../../internal/headers.mjs";
|
|
4
|
+
import { path } from "../../internal/utils/path.mjs";
|
|
5
|
+
export class Process extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Execute a command synchronously
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const response = await client.browsers.process.exec('id', {
|
|
12
|
+
* command: 'command',
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
exec(id, body, options) {
|
|
17
|
+
return this._client.post(path `/browsers/${id}/process/exec`, { body, ...options });
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Send signal to process
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const response = await client.browsers.process.kill(
|
|
25
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
26
|
+
* { id: 'id', signal: 'TERM' },
|
|
27
|
+
* );
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
kill(processID, params, options) {
|
|
31
|
+
const { id, ...body } = params;
|
|
32
|
+
return this._client.post(path `/browsers/${id}/process/${processID}/kill`, { body, ...options });
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Execute a command asynchronously
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const response = await client.browsers.process.spawn('id', {
|
|
40
|
+
* command: 'command',
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
spawn(id, body, options) {
|
|
45
|
+
return this._client.post(path `/browsers/${id}/process/spawn`, { body, ...options });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get process status
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const response = await client.browsers.process.status(
|
|
53
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
54
|
+
* { id: 'id' },
|
|
55
|
+
* );
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
status(processID, params, options) {
|
|
59
|
+
const { id } = params;
|
|
60
|
+
return this._client.get(path `/browsers/${id}/process/${processID}/status`, options);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Write to process stdin
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* const response = await client.browsers.process.stdin(
|
|
68
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
69
|
+
* { id: 'id', data_b64: 'data_b64' },
|
|
70
|
+
* );
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
stdin(processID, params, options) {
|
|
74
|
+
const { id, ...body } = params;
|
|
75
|
+
return this._client.post(path `/browsers/${id}/process/${processID}/stdin`, { body, ...options });
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Stream process stdout via SSE
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* const response = await client.browsers.process.stdoutStream(
|
|
83
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
84
|
+
* { id: 'id' },
|
|
85
|
+
* );
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
stdoutStream(processID, params, options) {
|
|
89
|
+
const { id } = params;
|
|
90
|
+
return this._client.get(path `/browsers/${id}/process/${processID}/stdout/stream`, {
|
|
91
|
+
...options,
|
|
92
|
+
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
93
|
+
stream: true,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=process.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.mjs","sourceRoot":"","sources":["../../src/resources/browsers/process.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAU,EAAE,IAAuB,EAAE,OAAwB;QAChE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,aAAa,EAAE,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrF,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,CACF,SAAiB,EACjB,MAAyB,EACzB,OAAwB;QAExB,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,aAAa,EAAE,YAAY,SAAS,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClG,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAU,EAAE,IAAwB,EAAE,OAAwB;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,aAAa,EAAE,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtF,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CACJ,SAAiB,EACjB,MAA2B,EAC3B,OAAwB;QAExB,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,EAAE,YAAY,SAAS,SAAS,EAAE,OAAO,CAAC,CAAC;IACtF,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CACH,SAAiB,EACjB,MAA0B,EAC1B,OAAwB;QAExB,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,aAAa,EAAE,YAAY,SAAS,QAAQ,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnG,CAAC;IAED;;;;;;;;;;OAUG;IACH,YAAY,CACV,SAAiB,EACjB,MAAiC,EACjC,OAAwB;QAExB,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,EAAE,YAAY,SAAS,gBAAgB,EAAE;YAChF,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;SACb,CAAoD,CAAC;IACxD,CAAC;CACF"}
|
package/src/client.ts
CHANGED
|
@@ -742,7 +742,7 @@ export class Kernel {
|
|
|
742
742
|
// Preserve legacy string encoding behavior for now
|
|
743
743
|
headers.values.has('content-type')) ||
|
|
744
744
|
// `Blob` is superset of `File`
|
|
745
|
-
body instanceof Blob ||
|
|
745
|
+
((globalThis as any).Blob && body instanceof (globalThis as any).Blob) ||
|
|
746
746
|
// `FormData` -> `multipart/form-data`
|
|
747
747
|
body instanceof FormData ||
|
|
748
748
|
// `URLSearchParams` -> `application/x-www-form-urlencoded`
|
|
@@ -796,10 +796,12 @@ export class Kernel {
|
|
|
796
796
|
invocations: API.Invocations = new API.Invocations(this);
|
|
797
797
|
browsers: API.Browsers = new API.Browsers(this);
|
|
798
798
|
}
|
|
799
|
+
|
|
799
800
|
Kernel.Deployments = Deployments;
|
|
800
801
|
Kernel.Apps = Apps;
|
|
801
802
|
Kernel.Invocations = Invocations;
|
|
802
803
|
Kernel.Browsers = Browsers;
|
|
804
|
+
|
|
803
805
|
export declare namespace Kernel {
|
|
804
806
|
export type RequestOptions = Opts.RequestOptions;
|
|
805
807
|
|
|
@@ -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.
|
|
@@ -296,6 +319,8 @@ export interface BrowserDeleteParams {
|
|
|
296
319
|
|
|
297
320
|
Browsers.Replays = Replays;
|
|
298
321
|
Browsers.Fs = Fs;
|
|
322
|
+
Browsers.Process = Process;
|
|
323
|
+
Browsers.Logs = Logs;
|
|
299
324
|
|
|
300
325
|
export declare namespace Browsers {
|
|
301
326
|
export {
|
|
@@ -323,11 +348,32 @@ export declare namespace Browsers {
|
|
|
323
348
|
type FCreateDirectoryParams as FCreateDirectoryParams,
|
|
324
349
|
type FDeleteDirectoryParams as FDeleteDirectoryParams,
|
|
325
350
|
type FDeleteFileParams as FDeleteFileParams,
|
|
351
|
+
type FDownloadDirZipParams as FDownloadDirZipParams,
|
|
326
352
|
type FFileInfoParams as FFileInfoParams,
|
|
327
353
|
type FListFilesParams as FListFilesParams,
|
|
328
354
|
type FMoveParams as FMoveParams,
|
|
329
355
|
type FReadFileParams as FReadFileParams,
|
|
330
356
|
type FSetFilePermissionsParams as FSetFilePermissionsParams,
|
|
357
|
+
type FUploadParams as FUploadParams,
|
|
358
|
+
type FUploadZipParams as FUploadZipParams,
|
|
331
359
|
type FWriteFileParams as FWriteFileParams,
|
|
332
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 };
|
|
333
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
|
+
}
|