@onkernel/sdk 0.9.1 → 0.11.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 +31 -0
- package/client.d.mts +5 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +5 -2
- package/client.d.ts.map +1 -1
- package/client.js +5 -2
- package/client.js.map +1 -1
- package/client.mjs +5 -2
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/browsers/browsers.d.mts +77 -3
- package/resources/browsers/browsers.d.mts.map +1 -1
- package/resources/browsers/browsers.d.ts +77 -3
- 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 +4 -2
- package/resources/browsers/index.d.mts.map +1 -1
- package/resources/browsers/index.d.ts +4 -2
- 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/resources/index.d.mts +2 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/profiles.d.mts +39 -0
- package/resources/profiles.d.mts.map +1 -0
- package/resources/profiles.d.ts +39 -0
- package/resources/profiles.d.ts.map +1 -0
- package/resources/profiles.js +50 -0
- package/resources/profiles.js.map +1 -0
- package/resources/profiles.mjs +46 -0
- package/resources/profiles.mjs.map +1 -0
- package/src/client.ts +15 -2
- package/src/resources/browsers/browsers.ts +125 -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 +20 -0
- package/src/resources/browsers/logs.ts +50 -0
- package/src/resources/browsers/process.ts +366 -0
- package/src/resources/index.ts +2 -0
- package/src/resources/profiles.ts +67 -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,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Profiles = void 0;
|
|
5
|
+
const resource_1 = require("../core/resource.js");
|
|
6
|
+
const headers_1 = require("../internal/headers.js");
|
|
7
|
+
const path_1 = require("../internal/utils/path.js");
|
|
8
|
+
class Profiles extends resource_1.APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Create a browser profile that can be used to load state into future browser
|
|
11
|
+
* sessions.
|
|
12
|
+
*/
|
|
13
|
+
create(body, options) {
|
|
14
|
+
return this._client.post('/profiles', { body, ...options });
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Retrieve details for a single profile by its ID or name.
|
|
18
|
+
*/
|
|
19
|
+
retrieve(idOrName, options) {
|
|
20
|
+
return this._client.get((0, path_1.path) `/profiles/${idOrName}`, options);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* List profiles with optional filtering and pagination.
|
|
24
|
+
*/
|
|
25
|
+
list(options) {
|
|
26
|
+
return this._client.get('/profiles', options);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Delete a profile by its ID or by its name.
|
|
30
|
+
*/
|
|
31
|
+
delete(idOrName, options) {
|
|
32
|
+
return this._client.delete((0, path_1.path) `/profiles/${idOrName}`, {
|
|
33
|
+
...options,
|
|
34
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Download the profile. Profiles are JSON files containing the pieces of state
|
|
39
|
+
* that we save.
|
|
40
|
+
*/
|
|
41
|
+
download(idOrName, options) {
|
|
42
|
+
return this._client.get((0, path_1.path) `/profiles/${idOrName}/download`, {
|
|
43
|
+
...options,
|
|
44
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: 'application/octet-stream' }, options?.headers]),
|
|
45
|
+
__binaryResponse: true,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.Profiles = Profiles;
|
|
50
|
+
//# sourceMappingURL=profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../src/resources/profiles.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;OAGG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,QAAgB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,aAAa,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,QAAgB,EAAE,OAAwB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,aAAa,QAAQ,EAAE,EAAE;YACtD,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,QAAgB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,aAAa,QAAQ,WAAW,EAAE;YAC5D,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,0BAA0B,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YACjF,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;CACF;AA5CD,4BA4CC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 Profiles extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Create a browser profile that can be used to load state into future browser
|
|
8
|
+
* sessions.
|
|
9
|
+
*/
|
|
10
|
+
create(body, options) {
|
|
11
|
+
return this._client.post('/profiles', { body, ...options });
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Retrieve details for a single profile by its ID or name.
|
|
15
|
+
*/
|
|
16
|
+
retrieve(idOrName, options) {
|
|
17
|
+
return this._client.get(path `/profiles/${idOrName}`, options);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* List profiles with optional filtering and pagination.
|
|
21
|
+
*/
|
|
22
|
+
list(options) {
|
|
23
|
+
return this._client.get('/profiles', options);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Delete a profile by its ID or by its name.
|
|
27
|
+
*/
|
|
28
|
+
delete(idOrName, options) {
|
|
29
|
+
return this._client.delete(path `/profiles/${idOrName}`, {
|
|
30
|
+
...options,
|
|
31
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Download the profile. Profiles are JSON files containing the pieces of state
|
|
36
|
+
* that we save.
|
|
37
|
+
*/
|
|
38
|
+
download(idOrName, options) {
|
|
39
|
+
return this._client.get(path `/profiles/${idOrName}/download`, {
|
|
40
|
+
...options,
|
|
41
|
+
headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
|
|
42
|
+
__binaryResponse: true,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=profiles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.mjs","sourceRoot":"","sources":["../src/resources/profiles.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;OAGG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,QAAgB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,QAAgB,EAAE,OAAwB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,aAAa,QAAQ,EAAE,EAAE;YACtD,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,QAAgB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,QAAQ,WAAW,EAAE;YAC5D,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,0BAA0B,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YACjF,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/src/client.ts
CHANGED
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
InvocationUpdateResponse,
|
|
40
40
|
Invocations,
|
|
41
41
|
} from './resources/invocations';
|
|
42
|
+
import { ProfileCreateParams, ProfileListResponse, Profiles } from './resources/profiles';
|
|
42
43
|
import {
|
|
43
44
|
BrowserCreateParams,
|
|
44
45
|
BrowserCreateResponse,
|
|
@@ -47,6 +48,7 @@ import {
|
|
|
47
48
|
BrowserPersistence,
|
|
48
49
|
BrowserRetrieveResponse,
|
|
49
50
|
Browsers,
|
|
51
|
+
Profile,
|
|
50
52
|
} from './resources/browsers/browsers';
|
|
51
53
|
import { type Fetch } from './internal/builtin-types';
|
|
52
54
|
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
|
@@ -435,7 +437,7 @@ export class Kernel {
|
|
|
435
437
|
const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError);
|
|
436
438
|
const headersTime = Date.now();
|
|
437
439
|
|
|
438
|
-
if (response instanceof Error) {
|
|
440
|
+
if (response instanceof globalThis.Error) {
|
|
439
441
|
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
440
442
|
if (options.signal?.aborted) {
|
|
441
443
|
throw new Errors.APIUserAbortError();
|
|
@@ -742,7 +744,7 @@ export class Kernel {
|
|
|
742
744
|
// Preserve legacy string encoding behavior for now
|
|
743
745
|
headers.values.has('content-type')) ||
|
|
744
746
|
// `Blob` is superset of `File`
|
|
745
|
-
body instanceof Blob ||
|
|
747
|
+
((globalThis as any).Blob && body instanceof (globalThis as any).Blob) ||
|
|
746
748
|
// `FormData` -> `multipart/form-data`
|
|
747
749
|
body instanceof FormData ||
|
|
748
750
|
// `URLSearchParams` -> `application/x-www-form-urlencoded`
|
|
@@ -795,11 +797,15 @@ export class Kernel {
|
|
|
795
797
|
apps: API.Apps = new API.Apps(this);
|
|
796
798
|
invocations: API.Invocations = new API.Invocations(this);
|
|
797
799
|
browsers: API.Browsers = new API.Browsers(this);
|
|
800
|
+
profiles: API.Profiles = new API.Profiles(this);
|
|
798
801
|
}
|
|
802
|
+
|
|
799
803
|
Kernel.Deployments = Deployments;
|
|
800
804
|
Kernel.Apps = Apps;
|
|
801
805
|
Kernel.Invocations = Invocations;
|
|
802
806
|
Kernel.Browsers = Browsers;
|
|
807
|
+
Kernel.Profiles = Profiles;
|
|
808
|
+
|
|
803
809
|
export declare namespace Kernel {
|
|
804
810
|
export type RequestOptions = Opts.RequestOptions;
|
|
805
811
|
|
|
@@ -831,6 +837,7 @@ export declare namespace Kernel {
|
|
|
831
837
|
export {
|
|
832
838
|
Browsers as Browsers,
|
|
833
839
|
type BrowserPersistence as BrowserPersistence,
|
|
840
|
+
type Profile as Profile,
|
|
834
841
|
type BrowserCreateResponse as BrowserCreateResponse,
|
|
835
842
|
type BrowserRetrieveResponse as BrowserRetrieveResponse,
|
|
836
843
|
type BrowserListResponse as BrowserListResponse,
|
|
@@ -838,6 +845,12 @@ export declare namespace Kernel {
|
|
|
838
845
|
type BrowserDeleteParams as BrowserDeleteParams,
|
|
839
846
|
};
|
|
840
847
|
|
|
848
|
+
export {
|
|
849
|
+
Profiles as Profiles,
|
|
850
|
+
type ProfileListResponse as ProfileListResponse,
|
|
851
|
+
type ProfileCreateParams as ProfileCreateParams,
|
|
852
|
+
};
|
|
853
|
+
|
|
841
854
|
export type AppAction = API.AppAction;
|
|
842
855
|
export type ErrorDetail = API.ErrorDetail;
|
|
843
856
|
export type ErrorEvent = API.ErrorEvent;
|
|
@@ -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.
|
|
@@ -123,6 +146,36 @@ export interface BrowserPersistence {
|
|
|
123
146
|
id: string;
|
|
124
147
|
}
|
|
125
148
|
|
|
149
|
+
/**
|
|
150
|
+
* Browser profile metadata.
|
|
151
|
+
*/
|
|
152
|
+
export interface Profile {
|
|
153
|
+
/**
|
|
154
|
+
* Unique identifier for the profile
|
|
155
|
+
*/
|
|
156
|
+
id: string;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Timestamp when the profile was created
|
|
160
|
+
*/
|
|
161
|
+
created_at: string;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Timestamp when the profile was last used
|
|
165
|
+
*/
|
|
166
|
+
last_used_at?: string;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Optional, easier-to-reference name for the profile
|
|
170
|
+
*/
|
|
171
|
+
name?: string | null;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Timestamp when the profile was last updated
|
|
175
|
+
*/
|
|
176
|
+
updated_at?: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
126
179
|
export interface BrowserCreateResponse {
|
|
127
180
|
/**
|
|
128
181
|
* Websocket URL for Chrome DevTools Protocol connections to the browser session
|
|
@@ -164,6 +217,11 @@ export interface BrowserCreateResponse {
|
|
|
164
217
|
* Optional persistence configuration for the browser session.
|
|
165
218
|
*/
|
|
166
219
|
persistence?: BrowserPersistence;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Browser profile metadata.
|
|
223
|
+
*/
|
|
224
|
+
profile?: Profile;
|
|
167
225
|
}
|
|
168
226
|
|
|
169
227
|
export interface BrowserRetrieveResponse {
|
|
@@ -207,6 +265,11 @@ export interface BrowserRetrieveResponse {
|
|
|
207
265
|
* Optional persistence configuration for the browser session.
|
|
208
266
|
*/
|
|
209
267
|
persistence?: BrowserPersistence;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Browser profile metadata.
|
|
271
|
+
*/
|
|
272
|
+
profile?: Profile;
|
|
210
273
|
}
|
|
211
274
|
|
|
212
275
|
export type BrowserListResponse = Array<BrowserListResponse.BrowserListResponseItem>;
|
|
@@ -253,6 +316,11 @@ export namespace BrowserListResponse {
|
|
|
253
316
|
* Optional persistence configuration for the browser session.
|
|
254
317
|
*/
|
|
255
318
|
persistence?: BrowsersAPI.BrowserPersistence;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Browser profile metadata.
|
|
322
|
+
*/
|
|
323
|
+
profile?: BrowsersAPI.Profile;
|
|
256
324
|
}
|
|
257
325
|
}
|
|
258
326
|
|
|
@@ -273,6 +341,13 @@ export interface BrowserCreateParams {
|
|
|
273
341
|
*/
|
|
274
342
|
persistence?: BrowserPersistence;
|
|
275
343
|
|
|
344
|
+
/**
|
|
345
|
+
* Profile selection for the browser session. Provide either id or name. If
|
|
346
|
+
* specified, the matching profile will be loaded into the browser session.
|
|
347
|
+
* Profiles must be created beforehand.
|
|
348
|
+
*/
|
|
349
|
+
profile?: BrowserCreateParams.Profile;
|
|
350
|
+
|
|
276
351
|
/**
|
|
277
352
|
* If true, launches the browser in stealth mode to reduce detection by anti-bot
|
|
278
353
|
* mechanisms.
|
|
@@ -287,6 +362,32 @@ export interface BrowserCreateParams {
|
|
|
287
362
|
timeout_seconds?: number;
|
|
288
363
|
}
|
|
289
364
|
|
|
365
|
+
export namespace BrowserCreateParams {
|
|
366
|
+
/**
|
|
367
|
+
* Profile selection for the browser session. Provide either id or name. If
|
|
368
|
+
* specified, the matching profile will be loaded into the browser session.
|
|
369
|
+
* Profiles must be created beforehand.
|
|
370
|
+
*/
|
|
371
|
+
export interface Profile {
|
|
372
|
+
/**
|
|
373
|
+
* Profile ID to load for this browser session
|
|
374
|
+
*/
|
|
375
|
+
id?: string;
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Profile name to load for this browser session (instead of id). Must be 1-255
|
|
379
|
+
* characters, using letters, numbers, dots, underscores, or hyphens.
|
|
380
|
+
*/
|
|
381
|
+
name?: string;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* If true, save changes made during the session back to the profile when the
|
|
385
|
+
* session ends.
|
|
386
|
+
*/
|
|
387
|
+
save_changes?: boolean;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
290
391
|
export interface BrowserDeleteParams {
|
|
291
392
|
/**
|
|
292
393
|
* Persistent browser identifier
|
|
@@ -296,10 +397,13 @@ export interface BrowserDeleteParams {
|
|
|
296
397
|
|
|
297
398
|
Browsers.Replays = Replays;
|
|
298
399
|
Browsers.Fs = Fs;
|
|
400
|
+
Browsers.Process = Process;
|
|
401
|
+
Browsers.Logs = Logs;
|
|
299
402
|
|
|
300
403
|
export declare namespace Browsers {
|
|
301
404
|
export {
|
|
302
405
|
type BrowserPersistence as BrowserPersistence,
|
|
406
|
+
type Profile as Profile,
|
|
303
407
|
type BrowserCreateResponse as BrowserCreateResponse,
|
|
304
408
|
type BrowserRetrieveResponse as BrowserRetrieveResponse,
|
|
305
409
|
type BrowserListResponse as BrowserListResponse,
|
|
@@ -323,11 +427,32 @@ export declare namespace Browsers {
|
|
|
323
427
|
type FCreateDirectoryParams as FCreateDirectoryParams,
|
|
324
428
|
type FDeleteDirectoryParams as FDeleteDirectoryParams,
|
|
325
429
|
type FDeleteFileParams as FDeleteFileParams,
|
|
430
|
+
type FDownloadDirZipParams as FDownloadDirZipParams,
|
|
326
431
|
type FFileInfoParams as FFileInfoParams,
|
|
327
432
|
type FListFilesParams as FListFilesParams,
|
|
328
433
|
type FMoveParams as FMoveParams,
|
|
329
434
|
type FReadFileParams as FReadFileParams,
|
|
330
435
|
type FSetFilePermissionsParams as FSetFilePermissionsParams,
|
|
436
|
+
type FUploadParams as FUploadParams,
|
|
437
|
+
type FUploadZipParams as FUploadZipParams,
|
|
331
438
|
type FWriteFileParams as FWriteFileParams,
|
|
332
439
|
};
|
|
440
|
+
|
|
441
|
+
export {
|
|
442
|
+
Process as Process,
|
|
443
|
+
type ProcessExecResponse as ProcessExecResponse,
|
|
444
|
+
type ProcessKillResponse as ProcessKillResponse,
|
|
445
|
+
type ProcessSpawnResponse as ProcessSpawnResponse,
|
|
446
|
+
type ProcessStatusResponse as ProcessStatusResponse,
|
|
447
|
+
type ProcessStdinResponse as ProcessStdinResponse,
|
|
448
|
+
type ProcessStdoutStreamResponse as ProcessStdoutStreamResponse,
|
|
449
|
+
type ProcessExecParams as ProcessExecParams,
|
|
450
|
+
type ProcessKillParams as ProcessKillParams,
|
|
451
|
+
type ProcessSpawnParams as ProcessSpawnParams,
|
|
452
|
+
type ProcessStatusParams as ProcessStatusParams,
|
|
453
|
+
type ProcessStdinParams as ProcessStdinParams,
|
|
454
|
+
type ProcessStdoutStreamParams as ProcessStdoutStreamParams,
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
export { Logs as Logs, type LogStreamParams as LogStreamParams };
|
|
333
458
|
}
|
|
@@ -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 {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
export {
|
|
4
4
|
Browsers,
|
|
5
5
|
type BrowserPersistence,
|
|
6
|
+
type Profile,
|
|
6
7
|
type BrowserCreateResponse,
|
|
7
8
|
type BrowserRetrieveResponse,
|
|
8
9
|
type BrowserListResponse,
|
|
@@ -16,13 +17,32 @@ export {
|
|
|
16
17
|
type FCreateDirectoryParams,
|
|
17
18
|
type FDeleteDirectoryParams,
|
|
18
19
|
type FDeleteFileParams,
|
|
20
|
+
type FDownloadDirZipParams,
|
|
19
21
|
type FFileInfoParams,
|
|
20
22
|
type FListFilesParams,
|
|
21
23
|
type FMoveParams,
|
|
22
24
|
type FReadFileParams,
|
|
23
25
|
type FSetFilePermissionsParams,
|
|
26
|
+
type FUploadParams,
|
|
27
|
+
type FUploadZipParams,
|
|
24
28
|
type FWriteFileParams,
|
|
25
29
|
} from './fs/index';
|
|
30
|
+
export { Logs, type LogStreamParams } from './logs';
|
|
31
|
+
export {
|
|
32
|
+
Process,
|
|
33
|
+
type ProcessExecResponse,
|
|
34
|
+
type ProcessKillResponse,
|
|
35
|
+
type ProcessSpawnResponse,
|
|
36
|
+
type ProcessStatusResponse,
|
|
37
|
+
type ProcessStdinResponse,
|
|
38
|
+
type ProcessStdoutStreamResponse,
|
|
39
|
+
type ProcessExecParams,
|
|
40
|
+
type ProcessKillParams,
|
|
41
|
+
type ProcessSpawnParams,
|
|
42
|
+
type ProcessStatusParams,
|
|
43
|
+
type ProcessStdinParams,
|
|
44
|
+
type ProcessStdoutStreamParams,
|
|
45
|
+
} from './process';
|
|
26
46
|
export {
|
|
27
47
|
Replays,
|
|
28
48
|
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
|
+
}
|