@onkernel/sdk 0.10.0 → 0.11.1

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 (90) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +31 -0
  3. package/client.d.mts +13 -4
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +13 -4
  6. package/client.d.ts.map +1 -1
  7. package/client.js +12 -1
  8. package/client.js.map +1 -1
  9. package/client.mjs +12 -1
  10. package/client.mjs.map +1 -1
  11. package/core/pagination.d.mts +53 -0
  12. package/core/pagination.d.mts.map +1 -0
  13. package/core/pagination.d.ts +53 -0
  14. package/core/pagination.d.ts.map +1 -0
  15. package/core/pagination.js +110 -0
  16. package/core/pagination.js.map +1 -0
  17. package/core/pagination.mjs +104 -0
  18. package/core/pagination.mjs.map +1 -0
  19. package/index.d.mts +1 -0
  20. package/index.d.mts.map +1 -1
  21. package/index.d.ts +1 -0
  22. package/index.d.ts.map +1 -1
  23. package/index.js +3 -1
  24. package/index.js.map +1 -1
  25. package/index.mjs +1 -0
  26. package/index.mjs.map +1 -1
  27. package/internal/utils/values.js +3 -3
  28. package/internal/utils/values.js.map +1 -1
  29. package/internal/utils/values.mjs +3 -3
  30. package/internal/utils/values.mjs.map +1 -1
  31. package/package.json +11 -1
  32. package/pagination.d.mts +2 -0
  33. package/pagination.d.mts.map +1 -0
  34. package/pagination.d.ts +2 -0
  35. package/pagination.d.ts.map +1 -0
  36. package/pagination.js +6 -0
  37. package/pagination.js.map +1 -0
  38. package/pagination.mjs +2 -0
  39. package/pagination.mjs.map +1 -0
  40. package/resources/browsers/browsers.d.mts +67 -1
  41. package/resources/browsers/browsers.d.mts.map +1 -1
  42. package/resources/browsers/browsers.d.ts +67 -1
  43. package/resources/browsers/browsers.d.ts.map +1 -1
  44. package/resources/browsers/browsers.js.map +1 -1
  45. package/resources/browsers/browsers.mjs.map +1 -1
  46. package/resources/browsers/index.d.mts +1 -1
  47. package/resources/browsers/index.d.mts.map +1 -1
  48. package/resources/browsers/index.d.ts +1 -1
  49. package/resources/browsers/index.d.ts.map +1 -1
  50. package/resources/browsers/index.js.map +1 -1
  51. package/resources/browsers/index.mjs.map +1 -1
  52. package/resources/deployments.d.mts +45 -43
  53. package/resources/deployments.d.mts.map +1 -1
  54. package/resources/deployments.d.ts +45 -43
  55. package/resources/deployments.d.ts.map +1 -1
  56. package/resources/deployments.js +9 -2
  57. package/resources/deployments.js.map +1 -1
  58. package/resources/deployments.mjs +9 -2
  59. package/resources/deployments.mjs.map +1 -1
  60. package/resources/index.d.mts +3 -2
  61. package/resources/index.d.mts.map +1 -1
  62. package/resources/index.d.ts +3 -2
  63. package/resources/index.d.ts.map +1 -1
  64. package/resources/index.js +3 -1
  65. package/resources/index.js.map +1 -1
  66. package/resources/index.mjs +1 -0
  67. package/resources/index.mjs.map +1 -1
  68. package/resources/profiles.d.mts +39 -0
  69. package/resources/profiles.d.mts.map +1 -0
  70. package/resources/profiles.d.ts +39 -0
  71. package/resources/profiles.d.ts.map +1 -0
  72. package/resources/profiles.js +50 -0
  73. package/resources/profiles.js.map +1 -0
  74. package/resources/profiles.mjs +46 -0
  75. package/resources/profiles.mjs.map +1 -0
  76. package/src/client.ts +41 -1
  77. package/src/core/pagination.ts +167 -0
  78. package/src/index.ts +1 -0
  79. package/src/internal/utils/values.ts +3 -3
  80. package/src/pagination.ts +2 -0
  81. package/src/resources/browsers/browsers.ts +79 -0
  82. package/src/resources/browsers/index.ts +1 -0
  83. package/src/resources/deployments.ts +48 -42
  84. package/src/resources/index.ts +3 -0
  85. package/src/resources/profiles.ts +67 -0
  86. package/src/version.ts +1 -1
  87. package/version.d.mts +1 -1
  88. package/version.d.ts +1 -1
  89. package/version.js +1 -1
  90. package/version.mjs +1 -1
@@ -146,6 +146,36 @@ export interface BrowserPersistence {
146
146
  id: string;
147
147
  }
148
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
+
149
179
  export interface BrowserCreateResponse {
150
180
  /**
151
181
  * Websocket URL for Chrome DevTools Protocol connections to the browser session
@@ -187,6 +217,11 @@ export interface BrowserCreateResponse {
187
217
  * Optional persistence configuration for the browser session.
188
218
  */
189
219
  persistence?: BrowserPersistence;
220
+
221
+ /**
222
+ * Browser profile metadata.
223
+ */
224
+ profile?: Profile;
190
225
  }
191
226
 
192
227
  export interface BrowserRetrieveResponse {
@@ -230,6 +265,11 @@ export interface BrowserRetrieveResponse {
230
265
  * Optional persistence configuration for the browser session.
231
266
  */
232
267
  persistence?: BrowserPersistence;
268
+
269
+ /**
270
+ * Browser profile metadata.
271
+ */
272
+ profile?: Profile;
233
273
  }
234
274
 
235
275
  export type BrowserListResponse = Array<BrowserListResponse.BrowserListResponseItem>;
@@ -276,6 +316,11 @@ export namespace BrowserListResponse {
276
316
  * Optional persistence configuration for the browser session.
277
317
  */
278
318
  persistence?: BrowsersAPI.BrowserPersistence;
319
+
320
+ /**
321
+ * Browser profile metadata.
322
+ */
323
+ profile?: BrowsersAPI.Profile;
279
324
  }
280
325
  }
281
326
 
@@ -296,6 +341,13 @@ export interface BrowserCreateParams {
296
341
  */
297
342
  persistence?: BrowserPersistence;
298
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
+
299
351
  /**
300
352
  * If true, launches the browser in stealth mode to reduce detection by anti-bot
301
353
  * mechanisms.
@@ -310,6 +362,32 @@ export interface BrowserCreateParams {
310
362
  timeout_seconds?: number;
311
363
  }
312
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
+
313
391
  export interface BrowserDeleteParams {
314
392
  /**
315
393
  * Persistent browser identifier
@@ -325,6 +403,7 @@ Browsers.Logs = Logs;
325
403
  export declare namespace Browsers {
326
404
  export {
327
405
  type BrowserPersistence as BrowserPersistence,
406
+ type Profile as Profile,
328
407
  type BrowserCreateResponse as BrowserCreateResponse,
329
408
  type BrowserRetrieveResponse as BrowserRetrieveResponse,
330
409
  type BrowserListResponse as BrowserListResponse,
@@ -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,
@@ -3,6 +3,7 @@
3
3
  import { APIResource } from '../core/resource';
4
4
  import * as Shared from './shared';
5
5
  import { APIPromise } from '../core/api-promise';
6
+ import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../core/pagination';
6
7
  import { Stream } from '../core/streaming';
7
8
  import { type Uploadable } from '../core/uploads';
8
9
  import { buildHeaders } from '../internal/headers';
@@ -43,14 +44,20 @@ export class Deployments extends APIResource {
43
44
  *
44
45
  * @example
45
46
  * ```ts
46
- * const deployments = await client.deployments.list();
47
+ * // Automatically fetches more pages as needed.
48
+ * for await (const deploymentListResponse of client.deployments.list()) {
49
+ * // ...
50
+ * }
47
51
  * ```
48
52
  */
49
53
  list(
50
54
  query: DeploymentListParams | null | undefined = {},
51
55
  options?: RequestOptions,
52
- ): APIPromise<DeploymentListResponse> {
53
- return this._client.get('/deployments', { query, ...options });
56
+ ): PagePromise<DeploymentListResponsesOffsetPagination, DeploymentListResponse> {
57
+ return this._client.getAPIList('/deployments', OffsetPagination<DeploymentListResponse>, {
58
+ query,
59
+ ...options,
60
+ });
54
61
  }
55
62
 
56
63
  /**
@@ -77,6 +84,8 @@ export class Deployments extends APIResource {
77
84
  }
78
85
  }
79
86
 
87
+ export type DeploymentListResponsesOffsetPagination = OffsetPagination<DeploymentListResponse>;
88
+
80
89
  /**
81
90
  * An event representing the current state of a deployment.
82
91
  */
@@ -234,53 +243,49 @@ export interface DeploymentRetrieveResponse {
234
243
  updated_at?: string | null;
235
244
  }
236
245
 
237
- export type DeploymentListResponse = Array<DeploymentListResponse.DeploymentListResponseItem>;
238
-
239
- export namespace DeploymentListResponse {
246
+ /**
247
+ * Deployment record information.
248
+ */
249
+ export interface DeploymentListResponse {
240
250
  /**
241
- * Deployment record information.
251
+ * Unique identifier for the deployment
242
252
  */
243
- export interface DeploymentListResponseItem {
244
- /**
245
- * Unique identifier for the deployment
246
- */
247
- id: string;
253
+ id: string;
248
254
 
249
- /**
250
- * Timestamp when the deployment was created
251
- */
252
- created_at: string;
255
+ /**
256
+ * Timestamp when the deployment was created
257
+ */
258
+ created_at: string;
253
259
 
254
- /**
255
- * Deployment region code
256
- */
257
- region: 'aws.us-east-1a';
260
+ /**
261
+ * Deployment region code
262
+ */
263
+ region: 'aws.us-east-1a';
258
264
 
259
- /**
260
- * Current status of the deployment
261
- */
262
- status: 'queued' | 'in_progress' | 'running' | 'failed' | 'stopped';
265
+ /**
266
+ * Current status of the deployment
267
+ */
268
+ status: 'queued' | 'in_progress' | 'running' | 'failed' | 'stopped';
263
269
 
264
- /**
265
- * Relative path to the application entrypoint
266
- */
267
- entrypoint_rel_path?: string;
270
+ /**
271
+ * Relative path to the application entrypoint
272
+ */
273
+ entrypoint_rel_path?: string;
268
274
 
269
- /**
270
- * Environment variables configured for this deployment
271
- */
272
- env_vars?: { [key: string]: string };
275
+ /**
276
+ * Environment variables configured for this deployment
277
+ */
278
+ env_vars?: { [key: string]: string };
273
279
 
274
- /**
275
- * Status reason
276
- */
277
- status_reason?: string;
280
+ /**
281
+ * Status reason
282
+ */
283
+ status_reason?: string;
278
284
 
279
- /**
280
- * Timestamp when the deployment was last updated
281
- */
282
- updated_at?: string | null;
283
- }
285
+ /**
286
+ * Timestamp when the deployment was last updated
287
+ */
288
+ updated_at?: string | null;
284
289
  }
285
290
 
286
291
  /**
@@ -373,7 +378,7 @@ export interface DeploymentCreateParams {
373
378
  version?: string;
374
379
  }
375
380
 
376
- export interface DeploymentListParams {
381
+ export interface DeploymentListParams extends OffsetPaginationParams {
377
382
  /**
378
383
  * Filter results by application name.
379
384
  */
@@ -394,6 +399,7 @@ export declare namespace Deployments {
394
399
  type DeploymentRetrieveResponse as DeploymentRetrieveResponse,
395
400
  type DeploymentListResponse as DeploymentListResponse,
396
401
  type DeploymentFollowResponse as DeploymentFollowResponse,
402
+ type DeploymentListResponsesOffsetPagination as DeploymentListResponsesOffsetPagination,
397
403
  type DeploymentCreateParams as DeploymentCreateParams,
398
404
  type DeploymentListParams as DeploymentListParams,
399
405
  type DeploymentFollowParams as DeploymentFollowParams,
@@ -5,6 +5,7 @@ export { Apps, type AppListResponse, type AppListParams } from './apps';
5
5
  export {
6
6
  Browsers,
7
7
  type BrowserPersistence,
8
+ type Profile,
8
9
  type BrowserCreateResponse,
9
10
  type BrowserRetrieveResponse,
10
11
  type BrowserListResponse,
@@ -21,6 +22,7 @@ export {
21
22
  type DeploymentCreateParams,
22
23
  type DeploymentListParams,
23
24
  type DeploymentFollowParams,
25
+ type DeploymentListResponsesOffsetPagination,
24
26
  } from './deployments';
25
27
  export {
26
28
  Invocations,
@@ -32,3 +34,4 @@ export {
32
34
  type InvocationCreateParams,
33
35
  type InvocationUpdateParams,
34
36
  } from './invocations';
37
+ export { Profiles, type ProfileListResponse, type ProfileCreateParams } from './profiles';
@@ -0,0 +1,67 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import * as BrowsersAPI from './browsers/browsers';
5
+ import { APIPromise } from '../core/api-promise';
6
+ import { buildHeaders } from '../internal/headers';
7
+ import { RequestOptions } from '../internal/request-options';
8
+ import { path } from '../internal/utils/path';
9
+
10
+ export class Profiles extends APIResource {
11
+ /**
12
+ * Create a browser profile that can be used to load state into future browser
13
+ * sessions.
14
+ */
15
+ create(body: ProfileCreateParams, options?: RequestOptions): APIPromise<BrowsersAPI.Profile> {
16
+ return this._client.post('/profiles', { body, ...options });
17
+ }
18
+
19
+ /**
20
+ * Retrieve details for a single profile by its ID or name.
21
+ */
22
+ retrieve(idOrName: string, options?: RequestOptions): APIPromise<BrowsersAPI.Profile> {
23
+ return this._client.get(path`/profiles/${idOrName}`, options);
24
+ }
25
+
26
+ /**
27
+ * List profiles with optional filtering and pagination.
28
+ */
29
+ list(options?: RequestOptions): APIPromise<ProfileListResponse> {
30
+ return this._client.get('/profiles', options);
31
+ }
32
+
33
+ /**
34
+ * Delete a profile by its ID or by its name.
35
+ */
36
+ delete(idOrName: string, options?: RequestOptions): APIPromise<void> {
37
+ return this._client.delete(path`/profiles/${idOrName}`, {
38
+ ...options,
39
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
40
+ });
41
+ }
42
+
43
+ /**
44
+ * Download the profile. Profiles are JSON files containing the pieces of state
45
+ * that we save.
46
+ */
47
+ download(idOrName: string, options?: RequestOptions): APIPromise<Response> {
48
+ return this._client.get(path`/profiles/${idOrName}/download`, {
49
+ ...options,
50
+ headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
51
+ __binaryResponse: true,
52
+ });
53
+ }
54
+ }
55
+
56
+ export type ProfileListResponse = Array<BrowsersAPI.Profile>;
57
+
58
+ export interface ProfileCreateParams {
59
+ /**
60
+ * Optional name of the profile. Must be unique within the organization.
61
+ */
62
+ name?: string;
63
+ }
64
+
65
+ export declare namespace Profiles {
66
+ export { type ProfileListResponse as ProfileListResponse, type ProfileCreateParams as ProfileCreateParams };
67
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.10.0'; // x-release-please-version
1
+ export const VERSION = '0.11.1'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.10.0";
1
+ export declare const VERSION = "0.11.1";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.10.0";
1
+ export declare const VERSION = "0.11.1";
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.10.0'; // x-release-please-version
4
+ exports.VERSION = '0.11.1'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.10.0'; // x-release-please-version
1
+ export const VERSION = '0.11.1'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map