@onkernel/sdk 0.8.2 → 0.9.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/package.json +4 -5
  3. package/resources/browsers/browsers.d.mts +4 -0
  4. package/resources/browsers/browsers.d.mts.map +1 -1
  5. package/resources/browsers/browsers.d.ts +4 -0
  6. package/resources/browsers/browsers.d.ts.map +1 -1
  7. package/resources/browsers/browsers.js +4 -0
  8. package/resources/browsers/browsers.js.map +1 -1
  9. package/resources/browsers/browsers.mjs +4 -0
  10. package/resources/browsers/browsers.mjs.map +1 -1
  11. package/resources/browsers/fs/fs.d.mts +253 -0
  12. package/resources/browsers/fs/fs.d.mts.map +1 -0
  13. package/resources/browsers/fs/fs.d.ts +253 -0
  14. package/resources/browsers/fs/fs.d.ts.map +1 -0
  15. package/resources/browsers/fs/fs.js +175 -0
  16. package/resources/browsers/fs/fs.js.map +1 -0
  17. package/resources/browsers/fs/fs.mjs +170 -0
  18. package/resources/browsers/fs/fs.mjs.map +1 -0
  19. package/resources/browsers/fs/index.d.mts +3 -0
  20. package/resources/browsers/fs/index.d.mts.map +1 -0
  21. package/resources/browsers/fs/index.d.ts +3 -0
  22. package/resources/browsers/fs/index.d.ts.map +1 -0
  23. package/resources/browsers/fs/index.js +9 -0
  24. package/resources/browsers/fs/index.js.map +1 -0
  25. package/resources/browsers/fs/index.mjs +4 -0
  26. package/resources/browsers/fs/index.mjs.map +1 -0
  27. package/resources/browsers/fs/watch.d.mts +94 -0
  28. package/resources/browsers/fs/watch.d.mts.map +1 -0
  29. package/resources/browsers/fs/watch.d.ts +94 -0
  30. package/resources/browsers/fs/watch.d.ts.map +1 -0
  31. package/resources/browsers/fs/watch.js +61 -0
  32. package/resources/browsers/fs/watch.js.map +1 -0
  33. package/resources/browsers/fs/watch.mjs +57 -0
  34. package/resources/browsers/fs/watch.mjs.map +1 -0
  35. package/resources/browsers/fs.d.mts +2 -0
  36. package/resources/browsers/fs.d.mts.map +1 -0
  37. package/resources/browsers/fs.d.ts +2 -0
  38. package/resources/browsers/fs.d.ts.map +1 -0
  39. package/resources/browsers/fs.js +6 -0
  40. package/resources/browsers/fs.js.map +1 -0
  41. package/resources/browsers/fs.mjs +3 -0
  42. package/resources/browsers/fs.mjs.map +1 -0
  43. package/resources/browsers/index.d.mts +1 -0
  44. package/resources/browsers/index.d.mts.map +1 -1
  45. package/resources/browsers/index.d.ts +1 -0
  46. package/resources/browsers/index.d.ts.map +1 -1
  47. package/resources/browsers/index.js +3 -1
  48. package/resources/browsers/index.js.map +1 -1
  49. package/resources/browsers/index.mjs +1 -0
  50. package/resources/browsers/index.mjs.map +1 -1
  51. package/src/resources/browsers/browsers.ts +32 -0
  52. package/src/resources/browsers/fs/fs.ts +385 -0
  53. package/src/resources/browsers/fs/index.ts +24 -0
  54. package/src/resources/browsers/fs/watch.ts +135 -0
  55. package/src/resources/browsers/fs.ts +3 -0
  56. package/src/resources/browsers/index.ts +14 -0
  57. package/src/version.ts +1 -1
  58. package/version.d.mts +1 -1
  59. package/version.d.ts +1 -1
  60. package/version.js +1 -1
  61. package/version.mjs +1 -1
@@ -0,0 +1,385 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as WatchAPI from './watch';
5
+ import {
6
+ Watch,
7
+ WatchEventsParams,
8
+ WatchEventsResponse,
9
+ WatchStartParams,
10
+ WatchStartResponse,
11
+ WatchStopParams,
12
+ } from './watch';
13
+ import { APIPromise } from '../../../core/api-promise';
14
+ import { buildHeaders } from '../../../internal/headers';
15
+ import { RequestOptions } from '../../../internal/request-options';
16
+ import { path } from '../../../internal/utils/path';
17
+
18
+ export class Fs extends APIResource {
19
+ watch: WatchAPI.Watch = new WatchAPI.Watch(this._client);
20
+
21
+ /**
22
+ * Create a new directory
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * await client.browsers.fs.createDirectory('id', {
27
+ * path: '/J!',
28
+ * });
29
+ * ```
30
+ */
31
+ createDirectory(id: string, body: FCreateDirectoryParams, options?: RequestOptions): APIPromise<void> {
32
+ return this._client.put(path`/browsers/${id}/fs/create_directory`, {
33
+ body,
34
+ ...options,
35
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
36
+ });
37
+ }
38
+
39
+ /**
40
+ * Delete a directory
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * await client.browsers.fs.deleteDirectory('id', {
45
+ * path: '/J!',
46
+ * });
47
+ * ```
48
+ */
49
+ deleteDirectory(id: string, body: FDeleteDirectoryParams, options?: RequestOptions): APIPromise<void> {
50
+ return this._client.put(path`/browsers/${id}/fs/delete_directory`, {
51
+ body,
52
+ ...options,
53
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
54
+ });
55
+ }
56
+
57
+ /**
58
+ * Delete a file
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * await client.browsers.fs.deleteFile('id', { path: '/J!' });
63
+ * ```
64
+ */
65
+ deleteFile(id: string, body: FDeleteFileParams, options?: RequestOptions): APIPromise<void> {
66
+ return this._client.put(path`/browsers/${id}/fs/delete_file`, {
67
+ body,
68
+ ...options,
69
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
70
+ });
71
+ }
72
+
73
+ /**
74
+ * Get information about a file or directory
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * const response = await client.browsers.fs.fileInfo('id', {
79
+ * path: '/J!',
80
+ * });
81
+ * ```
82
+ */
83
+ fileInfo(id: string, query: FFileInfoParams, options?: RequestOptions): APIPromise<FFileInfoResponse> {
84
+ return this._client.get(path`/browsers/${id}/fs/file_info`, { query, ...options });
85
+ }
86
+
87
+ /**
88
+ * List files in a directory
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * const response = await client.browsers.fs.listFiles('id', {
93
+ * path: '/J!',
94
+ * });
95
+ * ```
96
+ */
97
+ listFiles(id: string, query: FListFilesParams, options?: RequestOptions): APIPromise<FListFilesResponse> {
98
+ return this._client.get(path`/browsers/${id}/fs/list_files`, { query, ...options });
99
+ }
100
+
101
+ /**
102
+ * Move or rename a file or directory
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * await client.browsers.fs.move('id', {
107
+ * dest_path: '/J!',
108
+ * src_path: '/J!',
109
+ * });
110
+ * ```
111
+ */
112
+ move(id: string, body: FMoveParams, options?: RequestOptions): APIPromise<void> {
113
+ return this._client.put(path`/browsers/${id}/fs/move`, {
114
+ body,
115
+ ...options,
116
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
117
+ });
118
+ }
119
+
120
+ /**
121
+ * Read file contents
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * const response = await client.browsers.fs.readFile('id', {
126
+ * path: '/J!',
127
+ * });
128
+ *
129
+ * const content = await response.blob();
130
+ * console.log(content);
131
+ * ```
132
+ */
133
+ readFile(id: string, query: FReadFileParams, options?: RequestOptions): APIPromise<Response> {
134
+ return this._client.get(path`/browsers/${id}/fs/read_file`, {
135
+ query,
136
+ ...options,
137
+ headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
138
+ __binaryResponse: true,
139
+ });
140
+ }
141
+
142
+ /**
143
+ * Set file or directory permissions/ownership
144
+ *
145
+ * @example
146
+ * ```ts
147
+ * await client.browsers.fs.setFilePermissions('id', {
148
+ * mode: '0611',
149
+ * path: '/J!',
150
+ * });
151
+ * ```
152
+ */
153
+ setFilePermissions(
154
+ id: string,
155
+ body: FSetFilePermissionsParams,
156
+ options?: RequestOptions,
157
+ ): APIPromise<void> {
158
+ return this._client.put(path`/browsers/${id}/fs/set_file_permissions`, {
159
+ body,
160
+ ...options,
161
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
162
+ });
163
+ }
164
+
165
+ /**
166
+ * Write or create a file
167
+ *
168
+ * @example
169
+ * ```ts
170
+ * await client.browsers.fs.writeFile(
171
+ * 'id',
172
+ * fs.createReadStream('path/to/file'),
173
+ * { path: '/J!' },
174
+ * );
175
+ * ```
176
+ */
177
+ writeFile(
178
+ id: string,
179
+ contents: string | ArrayBuffer | ArrayBufferView | Blob | DataView,
180
+ params: FWriteFileParams,
181
+ options?: RequestOptions,
182
+ ): APIPromise<void> {
183
+ const { path: path_, mode } = params;
184
+ return this._client.put(path`/browsers/${id}/fs/write_file`, {
185
+ body: contents,
186
+ query: { path: path_, mode },
187
+ ...options,
188
+ headers: buildHeaders([
189
+ { 'Content-Type': 'application/octet-stream', Accept: '*/*' },
190
+ options?.headers,
191
+ ]),
192
+ });
193
+ }
194
+ }
195
+
196
+ export interface FFileInfoResponse {
197
+ /**
198
+ * Whether the path is a directory.
199
+ */
200
+ is_dir: boolean;
201
+
202
+ /**
203
+ * Last modification time.
204
+ */
205
+ mod_time: string;
206
+
207
+ /**
208
+ * File mode bits (e.g., "drwxr-xr-x" or "-rw-r--r--").
209
+ */
210
+ mode: string;
211
+
212
+ /**
213
+ * Base name of the file or directory.
214
+ */
215
+ name: string;
216
+
217
+ /**
218
+ * Absolute path.
219
+ */
220
+ path: string;
221
+
222
+ /**
223
+ * Size in bytes. 0 for directories.
224
+ */
225
+ size_bytes: number;
226
+ }
227
+
228
+ /**
229
+ * Array of file or directory information entries.
230
+ */
231
+ export type FListFilesResponse = Array<FListFilesResponse.FListFilesResponseItem>;
232
+
233
+ export namespace FListFilesResponse {
234
+ export interface FListFilesResponseItem {
235
+ /**
236
+ * Whether the path is a directory.
237
+ */
238
+ is_dir: boolean;
239
+
240
+ /**
241
+ * Last modification time.
242
+ */
243
+ mod_time: string;
244
+
245
+ /**
246
+ * File mode bits (e.g., "drwxr-xr-x" or "-rw-r--r--").
247
+ */
248
+ mode: string;
249
+
250
+ /**
251
+ * Base name of the file or directory.
252
+ */
253
+ name: string;
254
+
255
+ /**
256
+ * Absolute path.
257
+ */
258
+ path: string;
259
+
260
+ /**
261
+ * Size in bytes. 0 for directories.
262
+ */
263
+ size_bytes: number;
264
+ }
265
+ }
266
+
267
+ export interface FCreateDirectoryParams {
268
+ /**
269
+ * Absolute directory path to create.
270
+ */
271
+ path: string;
272
+
273
+ /**
274
+ * Optional directory mode (octal string, e.g. 755). Defaults to 755.
275
+ */
276
+ mode?: string;
277
+ }
278
+
279
+ export interface FDeleteDirectoryParams {
280
+ /**
281
+ * Absolute path to delete.
282
+ */
283
+ path: string;
284
+ }
285
+
286
+ export interface FDeleteFileParams {
287
+ /**
288
+ * Absolute path to delete.
289
+ */
290
+ path: string;
291
+ }
292
+
293
+ export interface FFileInfoParams {
294
+ /**
295
+ * Absolute path of the file or directory.
296
+ */
297
+ path: string;
298
+ }
299
+
300
+ export interface FListFilesParams {
301
+ /**
302
+ * Absolute directory path.
303
+ */
304
+ path: string;
305
+ }
306
+
307
+ export interface FMoveParams {
308
+ /**
309
+ * Absolute destination path.
310
+ */
311
+ dest_path: string;
312
+
313
+ /**
314
+ * Absolute source path.
315
+ */
316
+ src_path: string;
317
+ }
318
+
319
+ export interface FReadFileParams {
320
+ /**
321
+ * Absolute file path to read.
322
+ */
323
+ path: string;
324
+ }
325
+
326
+ export interface FSetFilePermissionsParams {
327
+ /**
328
+ * File mode bits (octal string, e.g. 644).
329
+ */
330
+ mode: string;
331
+
332
+ /**
333
+ * Absolute path whose permissions are to be changed.
334
+ */
335
+ path: string;
336
+
337
+ /**
338
+ * New group name or GID.
339
+ */
340
+ group?: string;
341
+
342
+ /**
343
+ * New owner username or UID.
344
+ */
345
+ owner?: string;
346
+ }
347
+
348
+ export interface FWriteFileParams {
349
+ /**
350
+ * Query param: Destination absolute file path.
351
+ */
352
+ path: string;
353
+
354
+ /**
355
+ * Query param: Optional file mode (octal string, e.g. 644). Defaults to 644.
356
+ */
357
+ mode?: string;
358
+ }
359
+
360
+ Fs.Watch = Watch;
361
+
362
+ export declare namespace Fs {
363
+ export {
364
+ type FFileInfoResponse as FFileInfoResponse,
365
+ type FListFilesResponse as FListFilesResponse,
366
+ type FCreateDirectoryParams as FCreateDirectoryParams,
367
+ type FDeleteDirectoryParams as FDeleteDirectoryParams,
368
+ type FDeleteFileParams as FDeleteFileParams,
369
+ type FFileInfoParams as FFileInfoParams,
370
+ type FListFilesParams as FListFilesParams,
371
+ type FMoveParams as FMoveParams,
372
+ type FReadFileParams as FReadFileParams,
373
+ type FSetFilePermissionsParams as FSetFilePermissionsParams,
374
+ type FWriteFileParams as FWriteFileParams,
375
+ };
376
+
377
+ export {
378
+ Watch as Watch,
379
+ type WatchEventsResponse as WatchEventsResponse,
380
+ type WatchStartResponse as WatchStartResponse,
381
+ type WatchEventsParams as WatchEventsParams,
382
+ type WatchStartParams as WatchStartParams,
383
+ type WatchStopParams as WatchStopParams,
384
+ };
385
+ }
@@ -0,0 +1,24 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ Fs,
5
+ type FFileInfoResponse,
6
+ type FListFilesResponse,
7
+ type FCreateDirectoryParams,
8
+ type FDeleteDirectoryParams,
9
+ type FDeleteFileParams,
10
+ type FFileInfoParams,
11
+ type FListFilesParams,
12
+ type FMoveParams,
13
+ type FReadFileParams,
14
+ type FSetFilePermissionsParams,
15
+ type FWriteFileParams,
16
+ } from './fs';
17
+ export {
18
+ Watch,
19
+ type WatchEventsResponse,
20
+ type WatchStartResponse,
21
+ type WatchEventsParams,
22
+ type WatchStartParams,
23
+ type WatchStopParams,
24
+ } from './watch';
@@ -0,0 +1,135 @@
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 { Stream } from '../../../core/streaming';
6
+ import { buildHeaders } from '../../../internal/headers';
7
+ import { RequestOptions } from '../../../internal/request-options';
8
+ import { path } from '../../../internal/utils/path';
9
+
10
+ export class Watch extends APIResource {
11
+ /**
12
+ * Stream filesystem events for a watch
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const response = await client.browsers.fs.watch.events(
17
+ * 'watch_id',
18
+ * { id: 'id' },
19
+ * );
20
+ * ```
21
+ */
22
+ events(
23
+ watchID: string,
24
+ params: WatchEventsParams,
25
+ options?: RequestOptions,
26
+ ): APIPromise<Stream<WatchEventsResponse>> {
27
+ const { id } = params;
28
+ return this._client.get(path`/browsers/${id}/fs/watch/${watchID}/events`, {
29
+ ...options,
30
+ headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
31
+ stream: true,
32
+ }) as APIPromise<Stream<WatchEventsResponse>>;
33
+ }
34
+
35
+ /**
36
+ * Watch a directory for changes
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const response = await client.browsers.fs.watch.start(
41
+ * 'id',
42
+ * { path: 'path' },
43
+ * );
44
+ * ```
45
+ */
46
+ start(id: string, body: WatchStartParams, options?: RequestOptions): APIPromise<WatchStartResponse> {
47
+ return this._client.post(path`/browsers/${id}/fs/watch`, { body, ...options });
48
+ }
49
+
50
+ /**
51
+ * Stop watching a directory
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * await client.browsers.fs.watch.stop('watch_id', {
56
+ * id: 'id',
57
+ * });
58
+ * ```
59
+ */
60
+ stop(watchID: string, params: WatchStopParams, options?: RequestOptions): APIPromise<void> {
61
+ const { id } = params;
62
+ return this._client.delete(path`/browsers/${id}/fs/watch/${watchID}`, {
63
+ ...options,
64
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
65
+ });
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Filesystem change event.
71
+ */
72
+ export interface WatchEventsResponse {
73
+ /**
74
+ * Absolute path of the file or directory.
75
+ */
76
+ path: string;
77
+
78
+ /**
79
+ * Event type.
80
+ */
81
+ type: 'CREATE' | 'WRITE' | 'DELETE' | 'RENAME';
82
+
83
+ /**
84
+ * Whether the affected path is a directory.
85
+ */
86
+ is_dir?: boolean;
87
+
88
+ /**
89
+ * Base name of the file or directory affected.
90
+ */
91
+ name?: string;
92
+ }
93
+
94
+ export interface WatchStartResponse {
95
+ /**
96
+ * Unique identifier for the directory watch
97
+ */
98
+ watch_id?: string;
99
+ }
100
+
101
+ export interface WatchEventsParams {
102
+ /**
103
+ * Browser session ID
104
+ */
105
+ id: string;
106
+ }
107
+
108
+ export interface WatchStartParams {
109
+ /**
110
+ * Directory to watch.
111
+ */
112
+ path: string;
113
+
114
+ /**
115
+ * Whether to watch recursively.
116
+ */
117
+ recursive?: boolean;
118
+ }
119
+
120
+ export interface WatchStopParams {
121
+ /**
122
+ * Browser session ID
123
+ */
124
+ id: string;
125
+ }
126
+
127
+ export declare namespace Watch {
128
+ export {
129
+ type WatchEventsResponse as WatchEventsResponse,
130
+ type WatchStartResponse as WatchStartResponse,
131
+ type WatchEventsParams as WatchEventsParams,
132
+ type WatchStartParams as WatchStartParams,
133
+ type WatchStopParams as WatchStopParams,
134
+ };
135
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './fs/index';
@@ -9,6 +9,20 @@ export {
9
9
  type BrowserCreateParams,
10
10
  type BrowserDeleteParams,
11
11
  } from './browsers';
12
+ export {
13
+ Fs,
14
+ type FFileInfoResponse,
15
+ type FListFilesResponse,
16
+ type FCreateDirectoryParams,
17
+ type FDeleteDirectoryParams,
18
+ type FDeleteFileParams,
19
+ type FFileInfoParams,
20
+ type FListFilesParams,
21
+ type FMoveParams,
22
+ type FReadFileParams,
23
+ type FSetFilePermissionsParams,
24
+ type FWriteFileParams,
25
+ } from './fs/index';
12
26
  export {
13
27
  Replays,
14
28
  type ReplayListResponse,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.8.2'; // x-release-please-version
1
+ export const VERSION = '0.9.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.8.2";
1
+ export declare const VERSION = "0.9.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.8.2";
1
+ export declare const VERSION = "0.9.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.8.2'; // x-release-please-version
4
+ exports.VERSION = '0.9.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.8.2'; // x-release-please-version
1
+ export const VERSION = '0.9.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map