@onkernel/sdk 0.11.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 (65) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +31 -0
  3. package/client.d.mts +8 -2
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +8 -2
  6. package/client.d.ts.map +1 -1
  7. package/client.js +8 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +8 -0
  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/deployments.d.mts +45 -43
  41. package/resources/deployments.d.mts.map +1 -1
  42. package/resources/deployments.d.ts +45 -43
  43. package/resources/deployments.d.ts.map +1 -1
  44. package/resources/deployments.js +9 -2
  45. package/resources/deployments.js.map +1 -1
  46. package/resources/deployments.mjs +9 -2
  47. package/resources/deployments.mjs.map +1 -1
  48. package/resources/index.d.mts +1 -1
  49. package/resources/index.d.mts.map +1 -1
  50. package/resources/index.d.ts +1 -1
  51. package/resources/index.d.ts.map +1 -1
  52. package/resources/index.js.map +1 -1
  53. package/resources/index.mjs.map +1 -1
  54. package/src/client.ts +29 -0
  55. package/src/core/pagination.ts +167 -0
  56. package/src/index.ts +1 -0
  57. package/src/internal/utils/values.ts +3 -3
  58. package/src/pagination.ts +2 -0
  59. package/src/resources/deployments.ts +48 -42
  60. package/src/resources/index.ts +1 -0
  61. package/src/version.ts +1 -1
  62. package/version.d.mts +1 -1
  63. package/version.d.ts +1 -1
  64. package/version.js +1 -1
  65. package/version.mjs +1 -1
@@ -1,6 +1,7 @@
1
1
  import { APIResource } from "../core/resource.js";
2
2
  import * as Shared from "./shared.js";
3
3
  import { APIPromise } from "../core/api-promise.js";
4
+ import { OffsetPagination, type OffsetPaginationParams, PagePromise } from "../core/pagination.js";
4
5
  import { Stream } from "../core/streaming.js";
5
6
  import { type Uploadable } from "../core/uploads.js";
6
7
  import { RequestOptions } from "../internal/request-options.js";
@@ -31,10 +32,13 @@ export declare class Deployments extends APIResource {
31
32
  *
32
33
  * @example
33
34
  * ```ts
34
- * const deployments = await client.deployments.list();
35
+ * // Automatically fetches more pages as needed.
36
+ * for await (const deploymentListResponse of client.deployments.list()) {
37
+ * // ...
38
+ * }
35
39
  * ```
36
40
  */
37
- list(query?: DeploymentListParams | null | undefined, options?: RequestOptions): APIPromise<DeploymentListResponse>;
41
+ list(query?: DeploymentListParams | null | undefined, options?: RequestOptions): PagePromise<DeploymentListResponsesOffsetPagination, DeploymentListResponse>;
38
42
  /**
39
43
  * Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
40
44
  * status updates for a deployment. The stream terminates automatically once the
@@ -47,6 +51,7 @@ export declare class Deployments extends APIResource {
47
51
  */
48
52
  follow(id: string, query?: DeploymentFollowParams | undefined, options?: RequestOptions): APIPromise<Stream<DeploymentFollowResponse>>;
49
53
  }
54
+ export type DeploymentListResponsesOffsetPagination = OffsetPagination<DeploymentListResponse>;
50
55
  /**
51
56
  * An event representing the current state of a deployment.
52
57
  */
@@ -183,47 +188,44 @@ export interface DeploymentRetrieveResponse {
183
188
  */
184
189
  updated_at?: string | null;
185
190
  }
186
- export type DeploymentListResponse = Array<DeploymentListResponse.DeploymentListResponseItem>;
187
- export declare namespace DeploymentListResponse {
191
+ /**
192
+ * Deployment record information.
193
+ */
194
+ export interface DeploymentListResponse {
188
195
  /**
189
- * Deployment record information.
196
+ * Unique identifier for the deployment
190
197
  */
191
- interface DeploymentListResponseItem {
192
- /**
193
- * Unique identifier for the deployment
194
- */
195
- id: string;
196
- /**
197
- * Timestamp when the deployment was created
198
- */
199
- created_at: string;
200
- /**
201
- * Deployment region code
202
- */
203
- region: 'aws.us-east-1a';
204
- /**
205
- * Current status of the deployment
206
- */
207
- status: 'queued' | 'in_progress' | 'running' | 'failed' | 'stopped';
208
- /**
209
- * Relative path to the application entrypoint
210
- */
211
- entrypoint_rel_path?: string;
212
- /**
213
- * Environment variables configured for this deployment
214
- */
215
- env_vars?: {
216
- [key: string]: string;
217
- };
218
- /**
219
- * Status reason
220
- */
221
- status_reason?: string;
222
- /**
223
- * Timestamp when the deployment was last updated
224
- */
225
- updated_at?: string | null;
226
- }
198
+ id: string;
199
+ /**
200
+ * Timestamp when the deployment was created
201
+ */
202
+ created_at: string;
203
+ /**
204
+ * Deployment region code
205
+ */
206
+ region: 'aws.us-east-1a';
207
+ /**
208
+ * Current status of the deployment
209
+ */
210
+ status: 'queued' | 'in_progress' | 'running' | 'failed' | 'stopped';
211
+ /**
212
+ * Relative path to the application entrypoint
213
+ */
214
+ entrypoint_rel_path?: string;
215
+ /**
216
+ * Environment variables configured for this deployment
217
+ */
218
+ env_vars?: {
219
+ [key: string]: string;
220
+ };
221
+ /**
222
+ * Status reason
223
+ */
224
+ status_reason?: string;
225
+ /**
226
+ * Timestamp when the deployment was last updated
227
+ */
228
+ updated_at?: string | null;
227
229
  }
228
230
  /**
229
231
  * Union type representing any deployment event.
@@ -299,7 +301,7 @@ export interface DeploymentCreateParams {
299
301
  */
300
302
  version?: string;
301
303
  }
302
- export interface DeploymentListParams {
304
+ export interface DeploymentListParams extends OffsetPaginationParams {
303
305
  /**
304
306
  * Filter results by application name.
305
307
  */
@@ -312,6 +314,6 @@ export interface DeploymentFollowParams {
312
314
  since?: string;
313
315
  }
314
316
  export declare namespace Deployments {
315
- export { type DeploymentStateEvent as DeploymentStateEvent, type DeploymentCreateResponse as DeploymentCreateResponse, type DeploymentRetrieveResponse as DeploymentRetrieveResponse, type DeploymentListResponse as DeploymentListResponse, type DeploymentFollowResponse as DeploymentFollowResponse, type DeploymentCreateParams as DeploymentCreateParams, type DeploymentListParams as DeploymentListParams, type DeploymentFollowParams as DeploymentFollowParams, };
317
+ export { type DeploymentStateEvent as DeploymentStateEvent, type DeploymentCreateResponse as DeploymentCreateResponse, type DeploymentRetrieveResponse as DeploymentRetrieveResponse, type DeploymentListResponse as DeploymentListResponse, type DeploymentFollowResponse as DeploymentFollowResponse, type DeploymentListResponsesOffsetPagination as DeploymentListResponsesOffsetPagination, type DeploymentCreateParams as DeploymentCreateParams, type DeploymentListParams as DeploymentListParams, type DeploymentFollowParams as DeploymentFollowParams, };
316
318
  }
317
319
  //# sourceMappingURL=deployments.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deployments.d.ts","sourceRoot":"","sources":["../src/resources/deployments.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE;OACV,EAAE,KAAK,UAAU,EAAE;OAEnB,EAAE,cAAc,EAAE;AAIzB,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,wBAAwB,CAAC;IAIpG;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,EA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AAM,CAAC,EAAE,gBAAgB,CAAC;IAE1B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB;IAClE;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EACL,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,uCAAuC,IAAI,uCAAuC,EACvF,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;CACH"}
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Deployments = void 0;
5
5
  const resource_1 = require("../core/resource.js");
6
+ const pagination_1 = require("../core/pagination.js");
6
7
  const headers_1 = require("../internal/headers.js");
7
8
  const uploads_1 = require("../internal/uploads.js");
8
9
  const path_1 = require("../internal/utils/path.js");
@@ -37,11 +38,17 @@ class Deployments extends resource_1.APIResource {
37
38
  *
38
39
  * @example
39
40
  * ```ts
40
- * const deployments = await client.deployments.list();
41
+ * // Automatically fetches more pages as needed.
42
+ * for await (const deploymentListResponse of client.deployments.list()) {
43
+ * // ...
44
+ * }
41
45
  * ```
42
46
  */
43
47
  list(query = {}, options) {
44
- return this._client.get('/deployments', { query, ...options });
48
+ return this._client.getAPIList('/deployments', (pagination_1.OffsetPagination), {
49
+ query,
50
+ ...options,
51
+ });
45
52
  }
46
53
  /**
47
54
  * Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
@@ -1 +1 @@
1
- {"version":3,"file":"deployments.js","sourceRoot":"","sources":["../src/resources/deployments.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAK/C,oDAAmD;AAEnD,oDAAkE;AAClE,oDAA8C;AAE9C,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;;;;;;;;;OAUG;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;;;;;;;OAOG;IACH,IAAI,CACF,QAAiD,EAAE,EACnD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,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;AAjED,kCAiEC"}
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;;;;;;;;;;OAUG;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;AAvED,kCAuEC"}
@@ -1,5 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
  import { APIResource } from "../core/resource.mjs";
3
+ import { OffsetPagination } from "../core/pagination.mjs";
3
4
  import { buildHeaders } from "../internal/headers.mjs";
4
5
  import { multipartFormRequestOptions } from "../internal/uploads.mjs";
5
6
  import { path } from "../internal/utils/path.mjs";
@@ -34,11 +35,17 @@ export class Deployments extends APIResource {
34
35
  *
35
36
  * @example
36
37
  * ```ts
37
- * const deployments = await client.deployments.list();
38
+ * // Automatically fetches more pages as needed.
39
+ * for await (const deploymentListResponse of client.deployments.list()) {
40
+ * // ...
41
+ * }
38
42
  * ```
39
43
  */
40
44
  list(query = {}, options) {
41
- return this._client.get('/deployments', { query, ...options });
45
+ return this._client.getAPIList('/deployments', (OffsetPagination), {
46
+ query,
47
+ ...options,
48
+ });
42
49
  }
43
50
  /**
44
51
  * Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
@@ -1 +1 @@
1
- {"version":3,"file":"deployments.mjs","sourceRoot":"","sources":["../src/resources/deployments.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAKf,EAAE,YAAY,EAAE;OAEhB,EAAE,2BAA2B,EAAE;OAC/B,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;OAUG;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;;;;;;;OAOG;IACH,IAAI,CACF,QAAiD,EAAE,EACnD,OAAwB;Q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,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"}
@@ -1,7 +1,7 @@
1
1
  export * from "./shared.mjs";
2
2
  export { Apps, type AppListResponse, type AppListParams } from "./apps.mjs";
3
3
  export { Browsers, type BrowserPersistence, type Profile, type BrowserCreateResponse, type BrowserRetrieveResponse, type BrowserListResponse, type BrowserCreateParams, type BrowserDeleteParams, } from "./browsers/browsers.mjs";
4
- export { Deployments, type DeploymentStateEvent, type DeploymentCreateResponse, type DeploymentRetrieveResponse, type DeploymentListResponse, type DeploymentFollowResponse, type DeploymentCreateParams, type DeploymentListParams, type DeploymentFollowParams, } from "./deployments.mjs";
4
+ export { Deployments, type DeploymentStateEvent, type DeploymentCreateResponse, type DeploymentRetrieveResponse, type DeploymentListResponse, type DeploymentFollowResponse, type DeploymentCreateParams, type DeploymentListParams, type DeploymentFollowParams, type DeploymentListResponsesOffsetPagination, } from "./deployments.mjs";
5
5
  export { Invocations, type InvocationStateEvent, type InvocationCreateResponse, type InvocationRetrieveResponse, type InvocationUpdateResponse, type InvocationFollowResponse, type InvocationCreateParams, type InvocationUpdateParams, } from "./invocations.mjs";
6
6
  export { Profiles, type ProfileListResponse, type ProfileCreateParams } from "./profiles.mjs";
7
7
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";OAGO,EAAE,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE;OAClD,EACL,QAAQ,EACR,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB;OACM,EACL,WAAW,EACX,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC5B;OACM,EACL,WAAW,EACX,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,GAC5B;OACM,EAAE,QAAQ,EAAE,KAAK,mBAAmB,EAAE,KAAK,mBAAmB,EAAE"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";OAGO,EAAE,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE;OAClD,EACL,QAAQ,EACR,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB;OACM,EACL,WAAW,EACX,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,uCAAuC,GAC7C;OACM,EACL,WAAW,EACX,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,GAC5B;OACM,EAAE,QAAQ,EAAE,KAAK,mBAAmB,EAAE,KAAK,mBAAmB,EAAE"}
@@ -1,7 +1,7 @@
1
1
  export * from "./shared.js";
2
2
  export { Apps, type AppListResponse, type AppListParams } from "./apps.js";
3
3
  export { Browsers, type BrowserPersistence, type Profile, type BrowserCreateResponse, type BrowserRetrieveResponse, type BrowserListResponse, type BrowserCreateParams, type BrowserDeleteParams, } from "./browsers/browsers.js";
4
- export { Deployments, type DeploymentStateEvent, type DeploymentCreateResponse, type DeploymentRetrieveResponse, type DeploymentListResponse, type DeploymentFollowResponse, type DeploymentCreateParams, type DeploymentListParams, type DeploymentFollowParams, } from "./deployments.js";
4
+ export { Deployments, type DeploymentStateEvent, type DeploymentCreateResponse, type DeploymentRetrieveResponse, type DeploymentListResponse, type DeploymentFollowResponse, type DeploymentCreateParams, type DeploymentListParams, type DeploymentFollowParams, type DeploymentListResponsesOffsetPagination, } from "./deployments.js";
5
5
  export { Invocations, type InvocationStateEvent, type InvocationCreateResponse, type InvocationRetrieveResponse, type InvocationUpdateResponse, type InvocationFollowResponse, type InvocationCreateParams, type InvocationUpdateParams, } from "./invocations.js";
6
6
  export { Profiles, type ProfileListResponse, type ProfileCreateParams } from "./profiles.js";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";OAGO,EAAE,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE;OAClD,EACL,QAAQ,EACR,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,E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.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,sDAAyB;AACzB,kCAAwE;AAA/D,4FAAA,IAAI,OAAA;AACb,mDAS6B;AAR3B,oGAAA,QAAQ,OAAA;AASV,gDAUuB;AATrB,0GAAA,WAAW,OAAA;AAUb,gDASuB;AARrB,0GAAA,WAAW,OAAA;AASb,0CAA0F;AAAjF,oGAAA,QAAQ,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,sDAAyB;AACzB,kCAAwE;AAA/D,4FAAA,IAAI,OAAA;AACb,mDAS6B;AAR3B,oGAAA,QAAQ,OAAA;AASV,gDAWuB;AAVrB,0GAAA,WAAW,OAAA;AAWb,gDASuB;AARrB,0GAAA,WAAW,OAAA;AASb,0CAA0F;AAAjF,oGAAA,QAAQ,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;OAG/E,EAAE,IAAI,EAA4C;OAClD,EACL,QAAQ,GAQT;OACM,EACL,WAAW,GASZ;OACM,EACL,WAAW,GAQZ;OACM,EAAE,QAAQ,EAAsD"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;OAG/E,EAAE,IAAI,EAA4C;OAClD,EACL,QAAQ,GAQT;OACM,EACL,WAAW,GAUZ;OACM,EACL,WAAW,GAQZ;OACM,EAAE,QAAQ,EAAsD"}
package/src/client.ts CHANGED
@@ -13,6 +13,8 @@ import * as Shims from './internal/shims';
13
13
  import * as Opts from './internal/request-options';
14
14
  import { VERSION } from './version';
15
15
  import * as Errors from './core/error';
16
+ import * as Pagination from './core/pagination';
17
+ import { AbstractPage, type OffsetPaginationParams, OffsetPaginationResponse } from './core/pagination';
16
18
  import * as Uploads from './core/uploads';
17
19
  import * as API from './resources/index';
18
20
  import { APIPromise } from './core/api-promise';
@@ -24,6 +26,7 @@ import {
24
26
  DeploymentFollowResponse,
25
27
  DeploymentListParams,
26
28
  DeploymentListResponse,
29
+ DeploymentListResponsesOffsetPagination,
27
30
  DeploymentRetrieveResponse,
28
31
  DeploymentStateEvent,
29
32
  Deployments,
@@ -551,6 +554,25 @@ export class Kernel {
551
554
  return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
552
555
  }
553
556
 
557
+ getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
558
+ path: string,
559
+ Page: new (...args: any[]) => PageClass,
560
+ opts?: RequestOptions,
561
+ ): Pagination.PagePromise<PageClass, Item> {
562
+ return this.requestAPIList(Page, { method: 'get', path, ...opts });
563
+ }
564
+
565
+ requestAPIList<
566
+ Item = unknown,
567
+ PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
568
+ >(
569
+ Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
570
+ options: FinalRequestOptions,
571
+ ): Pagination.PagePromise<PageClass, Item> {
572
+ const request = this.makeRequest(options, null, undefined);
573
+ return new Pagination.PagePromise<PageClass, Item>(this as any as Kernel, request, Page);
574
+ }
575
+
554
576
  async fetchWithTimeout(
555
577
  url: RequestInfo,
556
578
  init: RequestInit | undefined,
@@ -809,6 +831,12 @@ Kernel.Profiles = Profiles;
809
831
  export declare namespace Kernel {
810
832
  export type RequestOptions = Opts.RequestOptions;
811
833
 
834
+ export import OffsetPagination = Pagination.OffsetPagination;
835
+ export {
836
+ type OffsetPaginationParams as OffsetPaginationParams,
837
+ type OffsetPaginationResponse as OffsetPaginationResponse,
838
+ };
839
+
812
840
  export {
813
841
  Deployments as Deployments,
814
842
  type DeploymentStateEvent as DeploymentStateEvent,
@@ -816,6 +844,7 @@ export declare namespace Kernel {
816
844
  type DeploymentRetrieveResponse as DeploymentRetrieveResponse,
817
845
  type DeploymentListResponse as DeploymentListResponse,
818
846
  type DeploymentFollowResponse as DeploymentFollowResponse,
847
+ type DeploymentListResponsesOffsetPagination as DeploymentListResponsesOffsetPagination,
819
848
  type DeploymentCreateParams as DeploymentCreateParams,
820
849
  type DeploymentListParams as DeploymentListParams,
821
850
  type DeploymentFollowParams as DeploymentFollowParams,
@@ -0,0 +1,167 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { KernelError } from './error';
4
+ import { FinalRequestOptions } from '../internal/request-options';
5
+ import { defaultParseResponse } from '../internal/parse';
6
+ import { type Kernel } from '../client';
7
+ import { APIPromise } from './api-promise';
8
+ import { type APIResponseProps } from '../internal/parse';
9
+ import { maybeCoerceBoolean, maybeCoerceInteger, maybeObj } from '../internal/utils/values';
10
+
11
+ export type PageRequestOptions = Pick<FinalRequestOptions, 'query' | 'headers' | 'body' | 'path' | 'method'>;
12
+
13
+ export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
14
+ #client: Kernel;
15
+ protected options: FinalRequestOptions;
16
+
17
+ protected response: Response;
18
+ protected body: unknown;
19
+
20
+ constructor(client: Kernel, response: Response, body: unknown, options: FinalRequestOptions) {
21
+ this.#client = client;
22
+ this.options = options;
23
+ this.response = response;
24
+ this.body = body;
25
+ }
26
+
27
+ abstract nextPageRequestOptions(): PageRequestOptions | null;
28
+
29
+ abstract getPaginatedItems(): Item[];
30
+
31
+ hasNextPage(): boolean {
32
+ const items = this.getPaginatedItems();
33
+ if (!items.length) return false;
34
+ return this.nextPageRequestOptions() != null;
35
+ }
36
+
37
+ async getNextPage(): Promise<this> {
38
+ const nextOptions = this.nextPageRequestOptions();
39
+ if (!nextOptions) {
40
+ throw new KernelError(
41
+ 'No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.',
42
+ );
43
+ }
44
+
45
+ return await this.#client.requestAPIList(this.constructor as any, nextOptions);
46
+ }
47
+
48
+ async *iterPages(): AsyncGenerator<this> {
49
+ let page: this = this;
50
+ yield page;
51
+ while (page.hasNextPage()) {
52
+ page = await page.getNextPage();
53
+ yield page;
54
+ }
55
+ }
56
+
57
+ async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
58
+ for await (const page of this.iterPages()) {
59
+ for (const item of page.getPaginatedItems()) {
60
+ yield item;
61
+ }
62
+ }
63
+ }
64
+ }
65
+
66
+ /**
67
+ * This subclass of Promise will resolve to an instantiated Page once the request completes.
68
+ *
69
+ * It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg:
70
+ *
71
+ * for await (const item of client.items.list()) {
72
+ * console.log(item)
73
+ * }
74
+ */
75
+ export class PagePromise<
76
+ PageClass extends AbstractPage<Item>,
77
+ Item = ReturnType<PageClass['getPaginatedItems']>[number],
78
+ >
79
+ extends APIPromise<PageClass>
80
+ implements AsyncIterable<Item>
81
+ {
82
+ constructor(
83
+ client: Kernel,
84
+ request: Promise<APIResponseProps>,
85
+ Page: new (...args: ConstructorParameters<typeof AbstractPage>) => PageClass,
86
+ ) {
87
+ super(
88
+ client,
89
+ request,
90
+ async (client, props) =>
91
+ new Page(client, props.response, await defaultParseResponse(client, props), props.options),
92
+ );
93
+ }
94
+
95
+ /**
96
+ * Allow auto-paginating iteration on an unawaited list call, eg:
97
+ *
98
+ * for await (const item of client.items.list()) {
99
+ * console.log(item)
100
+ * }
101
+ */
102
+ async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
103
+ const page = await this;
104
+ for await (const item of page) {
105
+ yield item;
106
+ }
107
+ }
108
+ }
109
+
110
+ export type OffsetPaginationResponse<Item> = Item[];
111
+
112
+ export interface OffsetPaginationParams {
113
+ offset?: number;
114
+
115
+ limit?: number;
116
+ }
117
+
118
+ export class OffsetPagination<Item> extends AbstractPage<Item> {
119
+ items: Array<Item>;
120
+
121
+ has_more: boolean | null;
122
+
123
+ next_offset: number | null;
124
+
125
+ constructor(
126
+ client: Kernel,
127
+ response: Response,
128
+ body: OffsetPaginationResponse<Item>,
129
+ options: FinalRequestOptions,
130
+ ) {
131
+ super(client, response, body, options);
132
+
133
+ this.items = body || [];
134
+ this.has_more = maybeCoerceBoolean(this.response.headers.get('x-has-more')) ?? null;
135
+ this.next_offset = maybeCoerceInteger(this.response.headers.get('x-next-offset')) ?? null;
136
+ }
137
+
138
+ getPaginatedItems(): Item[] {
139
+ return this.items ?? [];
140
+ }
141
+
142
+ override hasNextPage(): boolean {
143
+ if (this.has_more === false) {
144
+ return false;
145
+ }
146
+
147
+ return super.hasNextPage();
148
+ }
149
+
150
+ nextPageRequestOptions(): PageRequestOptions | null {
151
+ const offset = this.next_offset;
152
+ if (!offset) {
153
+ return null;
154
+ }
155
+
156
+ const length = this.getPaginatedItems().length;
157
+ const currentCount = offset + length;
158
+
159
+ return {
160
+ ...this.options,
161
+ query: {
162
+ ...maybeObj(this.options.query),
163
+ offset: currentCount,
164
+ },
165
+ };
166
+ }
167
+ }
package/src/index.ts CHANGED
@@ -5,6 +5,7 @@ export { Kernel as default } from './client';
5
5
  export { type Uploadable, toFile } from './core/uploads';
6
6
  export { APIPromise } from './core/api-promise';
7
7
  export { Kernel, type ClientOptions } from './client';
8
+ export { PagePromise } from './core/pagination';
8
9
  export {
9
10
  KernelError,
10
11
  APIError,
@@ -76,21 +76,21 @@ export const coerceBoolean = (value: unknown): boolean => {
76
76
  };
77
77
 
78
78
  export const maybeCoerceInteger = (value: unknown): number | undefined => {
79
- if (value === undefined) {
79
+ if (value == null) {
80
80
  return undefined;
81
81
  }
82
82
  return coerceInteger(value);
83
83
  };
84
84
 
85
85
  export const maybeCoerceFloat = (value: unknown): number | undefined => {
86
- if (value === undefined) {
86
+ if (value == null) {
87
87
  return undefined;
88
88
  }
89
89
  return coerceFloat(value);
90
90
  };
91
91
 
92
92
  export const maybeCoerceBoolean = (value: unknown): boolean | undefined => {
93
- if (value === undefined) {
93
+ if (value == null) {
94
94
  return undefined;
95
95
  }
96
96
  return coerceBoolean(value);
@@ -0,0 +1,2 @@
1
+ /** @deprecated Import from ./core/pagination instead */
2
+ export * from './core/pagination';