@onkernel/sdk 0.14.2 → 0.16.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 +22 -0
- package/README.md +5 -17
- package/core/pagination.d.mts.map +1 -1
- package/core/pagination.d.ts.map +1 -1
- package/core/pagination.js +1 -4
- package/core/pagination.js.map +1 -1
- package/core/pagination.mjs +1 -4
- package/core/pagination.mjs.map +1 -1
- package/internal/uploads.js +20 -1
- package/internal/uploads.js.map +1 -1
- package/internal/uploads.mjs +20 -1
- package/internal/uploads.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/browsers/browsers.d.mts +8 -0
- package/resources/browsers/browsers.d.mts.map +1 -1
- package/resources/browsers/browsers.d.ts +8 -0
- 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/computer.d.mts +232 -0
- package/resources/browsers/computer.d.mts.map +1 -0
- package/resources/browsers/computer.d.ts +232 -0
- package/resources/browsers/computer.d.ts.map +1 -0
- package/resources/browsers/computer.js +136 -0
- package/resources/browsers/computer.js.map +1 -0
- package/resources/browsers/computer.mjs +132 -0
- package/resources/browsers/computer.mjs.map +1 -0
- package/resources/browsers/index.d.mts +2 -0
- package/resources/browsers/index.d.mts.map +1 -1
- package/resources/browsers/index.d.ts +2 -0
- 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/playwright.d.mts +63 -0
- package/resources/browsers/playwright.d.mts.map +1 -0
- package/resources/browsers/playwright.d.ts +63 -0
- package/resources/browsers/playwright.d.ts.map +1 -0
- package/resources/browsers/playwright.js +27 -0
- package/resources/browsers/playwright.js.map +1 -0
- package/resources/browsers/playwright.mjs +23 -0
- package/resources/browsers/playwright.mjs.map +1 -0
- package/resources/deployments.d.mts +58 -5
- package/resources/deployments.d.mts.map +1 -1
- package/resources/deployments.d.ts +58 -5
- package/resources/deployments.d.ts.map +1 -1
- package/resources/deployments.js +3 -0
- package/resources/deployments.js.map +1 -1
- package/resources/deployments.mjs +3 -0
- package/resources/deployments.mjs.map +1 -1
- package/src/core/pagination.ts +1 -5
- package/src/internal/uploads.ts +21 -3
- package/src/resources/browsers/browsers.ts +34 -0
- package/src/resources/browsers/computer.ts +328 -0
- package/src/resources/browsers/index.ts +11 -0
- package/src/resources/browsers/playwright.ts +83 -0
- package/src/resources/deployments.ts +68 -6
- 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/resources/deployments.js
CHANGED
|
@@ -15,7 +15,10 @@ class Deployments extends resource_1.APIResource {
|
|
|
15
15
|
* ```ts
|
|
16
16
|
* const deployment = await client.deployments.create({
|
|
17
17
|
* entrypoint_rel_path: 'src/app.py',
|
|
18
|
+
* env_vars: { FOO: 'bar' },
|
|
18
19
|
* file: fs.createReadStream('path/to/file'),
|
|
20
|
+
* region: 'aws.us-east-1a',
|
|
21
|
+
* version: '1.0.0',
|
|
19
22
|
* });
|
|
20
23
|
* ```
|
|
21
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployments.js","sourceRoot":"","sources":["../src/resources/deployments.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,sDAAgG;AAGhG,oDAAmD;AAEnD,oDAAkE;AAClE,oDAA8C;AAE9C,MAAa,WAAY,SAAQ,sBAAW;IAC1C
|
|
1
|
+
{"version":3,"file":"deployments.js","sourceRoot":"","sources":["../src/resources/deployments.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,sDAAgG;AAGhG,oDAAmD;AAEnD,oDAAkE;AAClE,oDAA8C;AAE9C,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAA4B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,IAAA,qCAA2B,EAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC5G,CAAC;IAED;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gBAAgB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,CACF,QAAiD,EAAE,EACnD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAA,6BAAwC,CAAA,EAAE;YACvF,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CACJ,EAAU,EACV,QAA4C,EAAE,EAC9C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gBAAgB,EAAE,SAAS,EAAE;YACvD,KAAK;YACL,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;SACb,CAAiD,CAAC;IACrD,CAAC;CACF;AA1ED,kCA0EC"}
|
|
@@ -12,7 +12,10 @@ export class Deployments extends APIResource {
|
|
|
12
12
|
* ```ts
|
|
13
13
|
* const deployment = await client.deployments.create({
|
|
14
14
|
* entrypoint_rel_path: 'src/app.py',
|
|
15
|
+
* env_vars: { FOO: 'bar' },
|
|
15
16
|
* file: fs.createReadStream('path/to/file'),
|
|
17
|
+
* region: 'aws.us-east-1a',
|
|
18
|
+
* version: '1.0.0',
|
|
16
19
|
* });
|
|
17
20
|
* ```
|
|
18
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployments.mjs","sourceRoot":"","sources":["../src/resources/deployments.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,gBAAgB,EAA4C;OAG9D,EAAE,YAAY,EAAE;OAEhB,EAAE,2BAA2B,EAAE;OAC/B,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C
|
|
1
|
+
{"version":3,"file":"deployments.mjs","sourceRoot":"","sources":["../src/resources/deployments.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,gBAAgB,EAA4C;OAG9D,EAAE,YAAY,EAAE;OAEhB,EAAE,2BAA2B,EAAE;OAC/B,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAA4B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,2BAA2B,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC5G,CAAC;IAED;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,gBAAgB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,CACF,QAAiD,EAAE,EACnD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAA,gBAAwC,CAAA,EAAE;YACvF,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CACJ,EAAU,EACV,QAA4C,EAAE,EAC9C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,gBAAgB,EAAE,SAAS,EAAE;YACvD,KAAK;YACL,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;SACb,CAAiD,CAAC;IACrD,CAAC;CACF"}
|
package/src/core/pagination.ts
CHANGED
|
@@ -148,11 +148,7 @@ export class OffsetPagination<Item> extends AbstractPage<Item> {
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
nextPageRequestOptions(): PageRequestOptions | null {
|
|
151
|
-
const offset = this.next_offset;
|
|
152
|
-
if (!offset) {
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
155
|
-
|
|
151
|
+
const offset = this.next_offset ?? 0;
|
|
156
152
|
const length = this.getPaginatedItems().length;
|
|
157
153
|
const currentCount = offset + length;
|
|
158
154
|
|
package/src/internal/uploads.ts
CHANGED
|
@@ -176,9 +176,27 @@ const addFormValue = async (form: FormData, key: string, value: unknown): Promis
|
|
|
176
176
|
} else if (Array.isArray(value)) {
|
|
177
177
|
await Promise.all(value.map((entry) => addFormValue(form, key + '[]', entry)));
|
|
178
178
|
} else if (typeof value === 'object') {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
// Special case: env_vars should always be flattened for backward compatibility
|
|
180
|
+
// with APIs that expect env_vars[KEY] format
|
|
181
|
+
const shouldAlwaysFlatten = key === 'env_vars';
|
|
182
|
+
// If the object doesn't contain any uploadable values,
|
|
183
|
+
// serialize it as JSON instead of flattening it into bracketed keys.
|
|
184
|
+
// This handles fields with contentType: application/json in the OpenAPI spec.
|
|
185
|
+
if (!shouldAlwaysFlatten && !hasUploadableValue(value)) {
|
|
186
|
+
// Filter out undefined values to check if object has any actual content
|
|
187
|
+
const entries = Object.entries(value).filter(([_, v]) => v !== undefined);
|
|
188
|
+
if (entries.length > 0) {
|
|
189
|
+
form.append(key, JSON.stringify(value));
|
|
190
|
+
}
|
|
191
|
+
// If all properties are undefined, don't add anything to the form
|
|
192
|
+
} else {
|
|
193
|
+
// Flatten objects that:
|
|
194
|
+
// - Contain uploadable values (files/blobs), or
|
|
195
|
+
// - Are explicitly marked to always flatten (like env_vars)
|
|
196
|
+
await Promise.all(
|
|
197
|
+
Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)),
|
|
198
|
+
);
|
|
199
|
+
}
|
|
182
200
|
} else {
|
|
183
201
|
throw new TypeError(
|
|
184
202
|
`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`,
|
|
@@ -2,8 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
4
|
import * as BrowsersAPI from './browsers';
|
|
5
|
+
import * as ComputerAPI from './computer';
|
|
6
|
+
import {
|
|
7
|
+
Computer,
|
|
8
|
+
ComputerCaptureScreenshotParams,
|
|
9
|
+
ComputerClickMouseParams,
|
|
10
|
+
ComputerDragMouseParams,
|
|
11
|
+
ComputerMoveMouseParams,
|
|
12
|
+
ComputerPressKeyParams,
|
|
13
|
+
ComputerScrollParams,
|
|
14
|
+
ComputerTypeTextParams,
|
|
15
|
+
} from './computer';
|
|
5
16
|
import * as LogsAPI from './logs';
|
|
6
17
|
import { LogStreamParams, Logs } from './logs';
|
|
18
|
+
import * as PlaywrightAPI from './playwright';
|
|
19
|
+
import { Playwright, PlaywrightExecuteParams, PlaywrightExecuteResponse } from './playwright';
|
|
7
20
|
import * as ProcessAPI from './process';
|
|
8
21
|
import {
|
|
9
22
|
Process,
|
|
@@ -59,6 +72,8 @@ export class Browsers extends APIResource {
|
|
|
59
72
|
fs: FsAPI.Fs = new FsAPI.Fs(this._client);
|
|
60
73
|
process: ProcessAPI.Process = new ProcessAPI.Process(this._client);
|
|
61
74
|
logs: LogsAPI.Logs = new LogsAPI.Logs(this._client);
|
|
75
|
+
computer: ComputerAPI.Computer = new ComputerAPI.Computer(this._client);
|
|
76
|
+
playwright: PlaywrightAPI.Playwright = new PlaywrightAPI.Playwright(this._client);
|
|
62
77
|
|
|
63
78
|
/**
|
|
64
79
|
* Create a new browser session from within an action.
|
|
@@ -682,6 +697,8 @@ Browsers.Replays = Replays;
|
|
|
682
697
|
Browsers.Fs = Fs;
|
|
683
698
|
Browsers.Process = Process;
|
|
684
699
|
Browsers.Logs = Logs;
|
|
700
|
+
Browsers.Computer = Computer;
|
|
701
|
+
Browsers.Playwright = Playwright;
|
|
685
702
|
|
|
686
703
|
export declare namespace Browsers {
|
|
687
704
|
export {
|
|
@@ -739,4 +756,21 @@ export declare namespace Browsers {
|
|
|
739
756
|
};
|
|
740
757
|
|
|
741
758
|
export { Logs as Logs, type LogStreamParams as LogStreamParams };
|
|
759
|
+
|
|
760
|
+
export {
|
|
761
|
+
Computer as Computer,
|
|
762
|
+
type ComputerCaptureScreenshotParams as ComputerCaptureScreenshotParams,
|
|
763
|
+
type ComputerClickMouseParams as ComputerClickMouseParams,
|
|
764
|
+
type ComputerDragMouseParams as ComputerDragMouseParams,
|
|
765
|
+
type ComputerMoveMouseParams as ComputerMoveMouseParams,
|
|
766
|
+
type ComputerPressKeyParams as ComputerPressKeyParams,
|
|
767
|
+
type ComputerScrollParams as ComputerScrollParams,
|
|
768
|
+
type ComputerTypeTextParams as ComputerTypeTextParams,
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
export {
|
|
772
|
+
Playwright as Playwright,
|
|
773
|
+
type PlaywrightExecuteResponse as PlaywrightExecuteResponse,
|
|
774
|
+
type PlaywrightExecuteParams as PlaywrightExecuteParams,
|
|
775
|
+
};
|
|
742
776
|
}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import { APIPromise } from '../../core/api-promise';
|
|
5
|
+
import { buildHeaders } from '../../internal/headers';
|
|
6
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
7
|
+
import { path } from '../../internal/utils/path';
|
|
8
|
+
|
|
9
|
+
export class Computer extends APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Capture a screenshot of the browser instance
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const response =
|
|
16
|
+
* await client.browsers.computer.captureScreenshot('id');
|
|
17
|
+
*
|
|
18
|
+
* const content = await response.blob();
|
|
19
|
+
* console.log(content);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
captureScreenshot(
|
|
23
|
+
id: string,
|
|
24
|
+
body: ComputerCaptureScreenshotParams | null | undefined = {},
|
|
25
|
+
options?: RequestOptions,
|
|
26
|
+
): APIPromise<Response> {
|
|
27
|
+
return this._client.post(path`/browsers/${id}/computer/screenshot`, {
|
|
28
|
+
body,
|
|
29
|
+
...options,
|
|
30
|
+
headers: buildHeaders([{ Accept: 'image/png' }, options?.headers]),
|
|
31
|
+
__binaryResponse: true,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Simulate a mouse click action on the browser instance
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* await client.browsers.computer.clickMouse('id', {
|
|
41
|
+
* x: 0,
|
|
42
|
+
* y: 0,
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
clickMouse(id: string, body: ComputerClickMouseParams, options?: RequestOptions): APIPromise<void> {
|
|
47
|
+
return this._client.post(path`/browsers/${id}/computer/click_mouse`, {
|
|
48
|
+
body,
|
|
49
|
+
...options,
|
|
50
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Drag the mouse along a path
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* await client.browsers.computer.dragMouse('id', {
|
|
60
|
+
* path: [
|
|
61
|
+
* [0, 0],
|
|
62
|
+
* [0, 0],
|
|
63
|
+
* ],
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
dragMouse(id: string, body: ComputerDragMouseParams, options?: RequestOptions): APIPromise<void> {
|
|
68
|
+
return this._client.post(path`/browsers/${id}/computer/drag_mouse`, {
|
|
69
|
+
body,
|
|
70
|
+
...options,
|
|
71
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Move the mouse cursor to the specified coordinates on the browser instance
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* await client.browsers.computer.moveMouse('id', {
|
|
81
|
+
* x: 0,
|
|
82
|
+
* y: 0,
|
|
83
|
+
* });
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
moveMouse(id: string, body: ComputerMoveMouseParams, options?: RequestOptions): APIPromise<void> {
|
|
87
|
+
return this._client.post(path`/browsers/${id}/computer/move_mouse`, {
|
|
88
|
+
body,
|
|
89
|
+
...options,
|
|
90
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Press one or more keys on the host computer
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* await client.browsers.computer.pressKey('id', {
|
|
100
|
+
* keys: ['string'],
|
|
101
|
+
* });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
pressKey(id: string, body: ComputerPressKeyParams, options?: RequestOptions): APIPromise<void> {
|
|
105
|
+
return this._client.post(path`/browsers/${id}/computer/press_key`, {
|
|
106
|
+
body,
|
|
107
|
+
...options,
|
|
108
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Scroll the mouse wheel at a position on the host computer
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* await client.browsers.computer.scroll('id', { x: 0, y: 0 });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
scroll(id: string, body: ComputerScrollParams, options?: RequestOptions): APIPromise<void> {
|
|
121
|
+
return this._client.post(path`/browsers/${id}/computer/scroll`, {
|
|
122
|
+
body,
|
|
123
|
+
...options,
|
|
124
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Type text on the browser instance
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* await client.browsers.computer.typeText('id', {
|
|
134
|
+
* text: 'text',
|
|
135
|
+
* });
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
typeText(id: string, body: ComputerTypeTextParams, options?: RequestOptions): APIPromise<void> {
|
|
139
|
+
return this._client.post(path`/browsers/${id}/computer/type`, {
|
|
140
|
+
body,
|
|
141
|
+
...options,
|
|
142
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface ComputerCaptureScreenshotParams {
|
|
148
|
+
region?: ComputerCaptureScreenshotParams.Region;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export namespace ComputerCaptureScreenshotParams {
|
|
152
|
+
export interface Region {
|
|
153
|
+
/**
|
|
154
|
+
* Height of the region in pixels
|
|
155
|
+
*/
|
|
156
|
+
height: number;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Width of the region in pixels
|
|
160
|
+
*/
|
|
161
|
+
width: number;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* X coordinate of the region's top-left corner
|
|
165
|
+
*/
|
|
166
|
+
x: number;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Y coordinate of the region's top-left corner
|
|
170
|
+
*/
|
|
171
|
+
y: number;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface ComputerClickMouseParams {
|
|
176
|
+
/**
|
|
177
|
+
* X coordinate of the click position
|
|
178
|
+
*/
|
|
179
|
+
x: number;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Y coordinate of the click position
|
|
183
|
+
*/
|
|
184
|
+
y: number;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Mouse button to interact with
|
|
188
|
+
*/
|
|
189
|
+
button?: 'left' | 'right' | 'middle' | 'back' | 'forward';
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Type of click action
|
|
193
|
+
*/
|
|
194
|
+
click_type?: 'down' | 'up' | 'click';
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Modifier keys to hold during the click
|
|
198
|
+
*/
|
|
199
|
+
hold_keys?: Array<string>;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Number of times to repeat the click
|
|
203
|
+
*/
|
|
204
|
+
num_clicks?: number;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface ComputerDragMouseParams {
|
|
208
|
+
/**
|
|
209
|
+
* Ordered list of [x, y] coordinate pairs to move through while dragging. Must
|
|
210
|
+
* contain at least 2 points.
|
|
211
|
+
*/
|
|
212
|
+
path: Array<Array<number>>;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Mouse button to drag with
|
|
216
|
+
*/
|
|
217
|
+
button?: 'left' | 'middle' | 'right';
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Delay in milliseconds between button down and starting to move along the path.
|
|
221
|
+
*/
|
|
222
|
+
delay?: number;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Modifier keys to hold during the drag
|
|
226
|
+
*/
|
|
227
|
+
hold_keys?: Array<string>;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Delay in milliseconds between relative steps while dragging (not the initial
|
|
231
|
+
* delay).
|
|
232
|
+
*/
|
|
233
|
+
step_delay_ms?: number;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Number of relative move steps per segment in the path. Minimum 1.
|
|
237
|
+
*/
|
|
238
|
+
steps_per_segment?: number;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface ComputerMoveMouseParams {
|
|
242
|
+
/**
|
|
243
|
+
* X coordinate to move the cursor to
|
|
244
|
+
*/
|
|
245
|
+
x: number;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Y coordinate to move the cursor to
|
|
249
|
+
*/
|
|
250
|
+
y: number;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Modifier keys to hold during the move
|
|
254
|
+
*/
|
|
255
|
+
hold_keys?: Array<string>;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface ComputerPressKeyParams {
|
|
259
|
+
/**
|
|
260
|
+
* List of key symbols to press. Each item should be a key symbol supported by
|
|
261
|
+
* xdotool (see X11 keysym definitions). Examples include "Return", "Shift",
|
|
262
|
+
* "Ctrl", "Alt", "F5". Items in this list could also be combinations, e.g.
|
|
263
|
+
* "Ctrl+t" or "Ctrl+Shift+Tab".
|
|
264
|
+
*/
|
|
265
|
+
keys: Array<string>;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Duration to hold the keys down in milliseconds. If omitted or 0, keys are
|
|
269
|
+
* tapped.
|
|
270
|
+
*/
|
|
271
|
+
duration?: number;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Optional modifier keys to hold during the key press sequence.
|
|
275
|
+
*/
|
|
276
|
+
hold_keys?: Array<string>;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export interface ComputerScrollParams {
|
|
280
|
+
/**
|
|
281
|
+
* X coordinate at which to perform the scroll
|
|
282
|
+
*/
|
|
283
|
+
x: number;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Y coordinate at which to perform the scroll
|
|
287
|
+
*/
|
|
288
|
+
y: number;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Horizontal scroll amount. Positive scrolls right, negative scrolls left.
|
|
292
|
+
*/
|
|
293
|
+
delta_x?: number;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Vertical scroll amount. Positive scrolls down, negative scrolls up.
|
|
297
|
+
*/
|
|
298
|
+
delta_y?: number;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Modifier keys to hold during the scroll
|
|
302
|
+
*/
|
|
303
|
+
hold_keys?: Array<string>;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export interface ComputerTypeTextParams {
|
|
307
|
+
/**
|
|
308
|
+
* Text to type on the browser instance
|
|
309
|
+
*/
|
|
310
|
+
text: string;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Delay in milliseconds between keystrokes
|
|
314
|
+
*/
|
|
315
|
+
delay?: number;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export declare namespace Computer {
|
|
319
|
+
export {
|
|
320
|
+
type ComputerCaptureScreenshotParams as ComputerCaptureScreenshotParams,
|
|
321
|
+
type ComputerClickMouseParams as ComputerClickMouseParams,
|
|
322
|
+
type ComputerDragMouseParams as ComputerDragMouseParams,
|
|
323
|
+
type ComputerMoveMouseParams as ComputerMoveMouseParams,
|
|
324
|
+
type ComputerPressKeyParams as ComputerPressKeyParams,
|
|
325
|
+
type ComputerScrollParams as ComputerScrollParams,
|
|
326
|
+
type ComputerTypeTextParams as ComputerTypeTextParams,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
@@ -11,6 +11,16 @@ export {
|
|
|
11
11
|
type BrowserDeleteParams,
|
|
12
12
|
type BrowserLoadExtensionsParams,
|
|
13
13
|
} from './browsers';
|
|
14
|
+
export {
|
|
15
|
+
Computer,
|
|
16
|
+
type ComputerCaptureScreenshotParams,
|
|
17
|
+
type ComputerClickMouseParams,
|
|
18
|
+
type ComputerDragMouseParams,
|
|
19
|
+
type ComputerMoveMouseParams,
|
|
20
|
+
type ComputerPressKeyParams,
|
|
21
|
+
type ComputerScrollParams,
|
|
22
|
+
type ComputerTypeTextParams,
|
|
23
|
+
} from './computer';
|
|
14
24
|
export {
|
|
15
25
|
Fs,
|
|
16
26
|
type FFileInfoResponse,
|
|
@@ -29,6 +39,7 @@ export {
|
|
|
29
39
|
type FWriteFileParams,
|
|
30
40
|
} from './fs/index';
|
|
31
41
|
export { Logs, type LogStreamParams } from './logs';
|
|
42
|
+
export { Playwright, type PlaywrightExecuteResponse, type PlaywrightExecuteParams } from './playwright';
|
|
32
43
|
export {
|
|
33
44
|
Process,
|
|
34
45
|
type ProcessExecResponse,
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import { APIPromise } from '../../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
6
|
+
import { path } from '../../internal/utils/path';
|
|
7
|
+
|
|
8
|
+
export class Playwright extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Execute arbitrary Playwright code in a fresh execution context against the
|
|
11
|
+
* browser. The code runs in the same VM as the browser, minimizing latency and
|
|
12
|
+
* maximizing throughput. It has access to 'page', 'context', and 'browser'
|
|
13
|
+
* variables. It can `return` a value, and this value is returned in the response.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const response = await client.browsers.playwright.execute(
|
|
18
|
+
* 'id',
|
|
19
|
+
* { code: 'code' },
|
|
20
|
+
* );
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
execute(
|
|
24
|
+
id: string,
|
|
25
|
+
body: PlaywrightExecuteParams,
|
|
26
|
+
options?: RequestOptions,
|
|
27
|
+
): APIPromise<PlaywrightExecuteResponse> {
|
|
28
|
+
return this._client.post(path`/browsers/${id}/playwright/execute`, { body, ...options });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Result of Playwright code execution
|
|
34
|
+
*/
|
|
35
|
+
export interface PlaywrightExecuteResponse {
|
|
36
|
+
/**
|
|
37
|
+
* Whether the code executed successfully
|
|
38
|
+
*/
|
|
39
|
+
success: boolean;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Error message if execution failed
|
|
43
|
+
*/
|
|
44
|
+
error?: string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The value returned by the code (if any)
|
|
48
|
+
*/
|
|
49
|
+
result?: unknown;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Standard error from the execution
|
|
53
|
+
*/
|
|
54
|
+
stderr?: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Standard output from the execution
|
|
58
|
+
*/
|
|
59
|
+
stdout?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface PlaywrightExecuteParams {
|
|
63
|
+
/**
|
|
64
|
+
* TypeScript/JavaScript code to execute. The code has access to 'page', 'context',
|
|
65
|
+
* and 'browser' variables. It runs within a function, so you can use a return
|
|
66
|
+
* statement at the end to return a value. This value is returned as the `result`
|
|
67
|
+
* property in the response. Example: "await page.goto('https://example.com');
|
|
68
|
+
* return await page.title();"
|
|
69
|
+
*/
|
|
70
|
+
code: string;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Maximum execution time in seconds. Default is 60.
|
|
74
|
+
*/
|
|
75
|
+
timeout_sec?: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export declare namespace Playwright {
|
|
79
|
+
export {
|
|
80
|
+
type PlaywrightExecuteResponse as PlaywrightExecuteResponse,
|
|
81
|
+
type PlaywrightExecuteParams as PlaywrightExecuteParams,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -19,7 +19,10 @@ export class Deployments extends APIResource {
|
|
|
19
19
|
* ```ts
|
|
20
20
|
* const deployment = await client.deployments.create({
|
|
21
21
|
* entrypoint_rel_path: 'src/app.py',
|
|
22
|
+
* env_vars: { FOO: 'bar' },
|
|
22
23
|
* file: fs.createReadStream('path/to/file'),
|
|
24
|
+
* region: 'aws.us-east-1a',
|
|
25
|
+
* version: '1.0.0',
|
|
23
26
|
* });
|
|
24
27
|
* ```
|
|
25
28
|
*/
|
|
@@ -349,12 +352,7 @@ export interface DeploymentCreateParams {
|
|
|
349
352
|
/**
|
|
350
353
|
* Relative path to the entrypoint of the application
|
|
351
354
|
*/
|
|
352
|
-
entrypoint_rel_path
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* ZIP file containing the application source directory
|
|
356
|
-
*/
|
|
357
|
-
file: Uploadable;
|
|
355
|
+
entrypoint_rel_path?: string;
|
|
358
356
|
|
|
359
357
|
/**
|
|
360
358
|
* Map of environment variables to set for the deployed application. Each key-value
|
|
@@ -362,6 +360,11 @@ export interface DeploymentCreateParams {
|
|
|
362
360
|
*/
|
|
363
361
|
env_vars?: { [key: string]: string };
|
|
364
362
|
|
|
363
|
+
/**
|
|
364
|
+
* ZIP file containing the application source directory
|
|
365
|
+
*/
|
|
366
|
+
file?: Uploadable;
|
|
367
|
+
|
|
365
368
|
/**
|
|
366
369
|
* Allow overwriting an existing app version
|
|
367
370
|
*/
|
|
@@ -372,12 +375,71 @@ export interface DeploymentCreateParams {
|
|
|
372
375
|
*/
|
|
373
376
|
region?: 'aws.us-east-1a';
|
|
374
377
|
|
|
378
|
+
/**
|
|
379
|
+
* Source from which to fetch application code.
|
|
380
|
+
*/
|
|
381
|
+
source?: DeploymentCreateParams.Source;
|
|
382
|
+
|
|
375
383
|
/**
|
|
376
384
|
* Version of the application. Can be any string.
|
|
377
385
|
*/
|
|
378
386
|
version?: string;
|
|
379
387
|
}
|
|
380
388
|
|
|
389
|
+
export namespace DeploymentCreateParams {
|
|
390
|
+
/**
|
|
391
|
+
* Source from which to fetch application code.
|
|
392
|
+
*/
|
|
393
|
+
export interface Source {
|
|
394
|
+
/**
|
|
395
|
+
* Relative path to the application entrypoint within the selected path.
|
|
396
|
+
*/
|
|
397
|
+
entrypoint: string;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Git ref (branch, tag, or commit SHA) to fetch.
|
|
401
|
+
*/
|
|
402
|
+
ref: string;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Source type identifier.
|
|
406
|
+
*/
|
|
407
|
+
type: 'github';
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Base repository URL (without blob/tree suffixes).
|
|
411
|
+
*/
|
|
412
|
+
url: string;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Authentication for private repositories.
|
|
416
|
+
*/
|
|
417
|
+
auth?: Source.Auth;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Path within the repo to deploy (omit to use repo root).
|
|
421
|
+
*/
|
|
422
|
+
path?: string;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export namespace Source {
|
|
426
|
+
/**
|
|
427
|
+
* Authentication for private repositories.
|
|
428
|
+
*/
|
|
429
|
+
export interface Auth {
|
|
430
|
+
/**
|
|
431
|
+
* GitHub PAT or installation access token
|
|
432
|
+
*/
|
|
433
|
+
token: string;
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Auth method
|
|
437
|
+
*/
|
|
438
|
+
method: 'github_token';
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
381
443
|
export interface DeploymentListParams extends OffsetPaginationParams {
|
|
382
444
|
/**
|
|
383
445
|
* Filter results by application name.
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.16.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.16.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|