@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
@@ -1,6 +1,7 @@
1
1
  export * from "./shared.mjs";
2
2
  export { Apps, type AppListResponse, type AppListParams } from "./apps.mjs";
3
- export { Browsers, type BrowserPersistence, 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";
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, 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
+ export { Profiles, type ProfileListResponse, type ProfileCreateParams } from "./profiles.mjs";
6
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,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"}
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,6 +1,7 @@
1
1
  export * from "./shared.js";
2
2
  export { Apps, type AppListResponse, type AppListParams } from "./apps.js";
3
- export { Browsers, type BrowserPersistence, 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";
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, 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
+ export { Profiles, type ProfileListResponse, type ProfileCreateParams } from "./profiles.js";
6
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,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"}
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,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
  "use strict";
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Invocations = exports.Deployments = exports.Browsers = exports.Apps = void 0;
4
+ exports.Profiles = exports.Invocations = exports.Deployments = exports.Browsers = exports.Apps = void 0;
5
5
  const tslib_1 = require("../internal/tslib.js");
6
6
  tslib_1.__exportStar(require("./shared.js"), exports);
7
7
  var apps_1 = require("./apps.js");
@@ -12,4 +12,6 @@ var deployments_1 = require("./deployments.js");
12
12
  Object.defineProperty(exports, "Deployments", { enumerable: true, get: function () { return deployments_1.Deployments; } });
13
13
  var invocations_1 = require("./invocations.js");
14
14
  Object.defineProperty(exports, "Invocations", { enumerable: true, get: function () { return invocations_1.Invocations; } });
15
+ var profiles_1 = require("./profiles.js");
16
+ Object.defineProperty(exports, "Profiles", { enumerable: true, get: function () { return profiles_1.Profiles; } });
15
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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,mDAQ6B;AAP3B,oGAAA,QAAQ,OAAA;AAQV,gDAUuB;AATrB,0GAAA,WAAW,OAAA;AAUb,gDASuB;AARrB,0GAAA,WAAW,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"}
@@ -4,4 +4,5 @@ export { Apps } from "./apps.mjs";
4
4
  export { Browsers, } from "./browsers/browsers.mjs";
5
5
  export { Deployments, } from "./deployments.mjs";
6
6
  export { Invocations, } from "./invocations.mjs";
7
+ export { Profiles } from "./profiles.mjs";
7
8
  //# sourceMappingURL=index.mjs.map
@@ -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,GAOT;OACM,EACL,WAAW,GASZ;OACM,EACL,WAAW,GAQZ"}
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"}
@@ -0,0 +1,39 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import * as BrowsersAPI from "./browsers/browsers.mjs";
3
+ import { APIPromise } from "../core/api-promise.mjs";
4
+ import { RequestOptions } from "../internal/request-options.mjs";
5
+ export declare class Profiles extends APIResource {
6
+ /**
7
+ * Create a browser profile that can be used to load state into future browser
8
+ * sessions.
9
+ */
10
+ create(body: ProfileCreateParams, options?: RequestOptions): APIPromise<BrowsersAPI.Profile>;
11
+ /**
12
+ * Retrieve details for a single profile by its ID or name.
13
+ */
14
+ retrieve(idOrName: string, options?: RequestOptions): APIPromise<BrowsersAPI.Profile>;
15
+ /**
16
+ * List profiles with optional filtering and pagination.
17
+ */
18
+ list(options?: RequestOptions): APIPromise<ProfileListResponse>;
19
+ /**
20
+ * Delete a profile by its ID or by its name.
21
+ */
22
+ delete(idOrName: string, options?: RequestOptions): APIPromise<void>;
23
+ /**
24
+ * Download the profile. Profiles are JSON files containing the pieces of state
25
+ * that we save.
26
+ */
27
+ download(idOrName: string, options?: RequestOptions): APIPromise<Response>;
28
+ }
29
+ export type ProfileListResponse = Array<BrowsersAPI.Profile>;
30
+ export interface ProfileCreateParams {
31
+ /**
32
+ * Optional name of the profile. Must be unique within the organization.
33
+ */
34
+ name?: string;
35
+ }
36
+ export declare namespace Profiles {
37
+ export { type ProfileListResponse as ProfileListResponse, type ProfileCreateParams as ProfileCreateParams };
38
+ }
39
+ //# sourceMappingURL=profiles.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.d.mts","sourceRoot":"","sources":["../src/resources/profiles.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,WAAW;OAChB,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC;IAI5F;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC;IAIrF;;OAEG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;IAI/D;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAOpE;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC;CAO3E;AAED,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;CAC7G"}
@@ -0,0 +1,39 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import * as BrowsersAPI from "./browsers/browsers.js";
3
+ import { APIPromise } from "../core/api-promise.js";
4
+ import { RequestOptions } from "../internal/request-options.js";
5
+ export declare class Profiles extends APIResource {
6
+ /**
7
+ * Create a browser profile that can be used to load state into future browser
8
+ * sessions.
9
+ */
10
+ create(body: ProfileCreateParams, options?: RequestOptions): APIPromise<BrowsersAPI.Profile>;
11
+ /**
12
+ * Retrieve details for a single profile by its ID or name.
13
+ */
14
+ retrieve(idOrName: string, options?: RequestOptions): APIPromise<BrowsersAPI.Profile>;
15
+ /**
16
+ * List profiles with optional filtering and pagination.
17
+ */
18
+ list(options?: RequestOptions): APIPromise<ProfileListResponse>;
19
+ /**
20
+ * Delete a profile by its ID or by its name.
21
+ */
22
+ delete(idOrName: string, options?: RequestOptions): APIPromise<void>;
23
+ /**
24
+ * Download the profile. Profiles are JSON files containing the pieces of state
25
+ * that we save.
26
+ */
27
+ download(idOrName: string, options?: RequestOptions): APIPromise<Response>;
28
+ }
29
+ export type ProfileListResponse = Array<BrowsersAPI.Profile>;
30
+ export interface ProfileCreateParams {
31
+ /**
32
+ * Optional name of the profile. Must be unique within the organization.
33
+ */
34
+ name?: string;
35
+ }
36
+ export declare namespace Profiles {
37
+ export { type ProfileListResponse as ProfileListResponse, type ProfileCreateParams as ProfileCreateParams };
38
+ }
39
+ //# sourceMappingURL=profiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../src/resources/profiles.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,WAAW;OAChB,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC;IAI5F;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC;IAIrF;;OAEG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;IAI/D;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAOpE;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC;CAO3E;AAED,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;CAC7G"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Profiles = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ const headers_1 = require("../internal/headers.js");
7
+ const path_1 = require("../internal/utils/path.js");
8
+ class Profiles extends resource_1.APIResource {
9
+ /**
10
+ * Create a browser profile that can be used to load state into future browser
11
+ * sessions.
12
+ */
13
+ create(body, options) {
14
+ return this._client.post('/profiles', { body, ...options });
15
+ }
16
+ /**
17
+ * Retrieve details for a single profile by its ID or name.
18
+ */
19
+ retrieve(idOrName, options) {
20
+ return this._client.get((0, path_1.path) `/profiles/${idOrName}`, options);
21
+ }
22
+ /**
23
+ * List profiles with optional filtering and pagination.
24
+ */
25
+ list(options) {
26
+ return this._client.get('/profiles', options);
27
+ }
28
+ /**
29
+ * Delete a profile by its ID or by its name.
30
+ */
31
+ delete(idOrName, options) {
32
+ return this._client.delete((0, path_1.path) `/profiles/${idOrName}`, {
33
+ ...options,
34
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
35
+ });
36
+ }
37
+ /**
38
+ * Download the profile. Profiles are JSON files containing the pieces of state
39
+ * that we save.
40
+ */
41
+ download(idOrName, options) {
42
+ return this._client.get((0, path_1.path) `/profiles/${idOrName}/download`, {
43
+ ...options,
44
+ headers: (0, headers_1.buildHeaders)([{ Accept: 'application/octet-stream' }, options?.headers]),
45
+ __binaryResponse: true,
46
+ });
47
+ }
48
+ }
49
+ exports.Profiles = Profiles;
50
+ //# sourceMappingURL=profiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.js","sourceRoot":"","sources":["../src/resources/profiles.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;OAGG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,QAAgB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,aAAa,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,QAAgB,EAAE,OAAwB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,aAAa,QAAQ,EAAE,EAAE;YACtD,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,QAAgB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,aAAa,QAAQ,WAAW,EAAE;YAC5D,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,0BAA0B,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YACjF,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;CACF;AA5CD,4BA4CC"}
@@ -0,0 +1,46 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ import { buildHeaders } from "../internal/headers.mjs";
4
+ import { path } from "../internal/utils/path.mjs";
5
+ export class Profiles extends APIResource {
6
+ /**
7
+ * Create a browser profile that can be used to load state into future browser
8
+ * sessions.
9
+ */
10
+ create(body, options) {
11
+ return this._client.post('/profiles', { body, ...options });
12
+ }
13
+ /**
14
+ * Retrieve details for a single profile by its ID or name.
15
+ */
16
+ retrieve(idOrName, options) {
17
+ return this._client.get(path `/profiles/${idOrName}`, options);
18
+ }
19
+ /**
20
+ * List profiles with optional filtering and pagination.
21
+ */
22
+ list(options) {
23
+ return this._client.get('/profiles', options);
24
+ }
25
+ /**
26
+ * Delete a profile by its ID or by its name.
27
+ */
28
+ delete(idOrName, options) {
29
+ return this._client.delete(path `/profiles/${idOrName}`, {
30
+ ...options,
31
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
32
+ });
33
+ }
34
+ /**
35
+ * Download the profile. Profiles are JSON files containing the pieces of state
36
+ * that we save.
37
+ */
38
+ download(idOrName, options) {
39
+ return this._client.get(path `/profiles/${idOrName}/download`, {
40
+ ...options,
41
+ headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
42
+ __binaryResponse: true,
43
+ });
44
+ }
45
+ }
46
+ //# sourceMappingURL=profiles.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.mjs","sourceRoot":"","sources":["../src/resources/profiles.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;OAGG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,QAAgB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,QAAgB,EAAE,OAAwB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,aAAa,QAAQ,EAAE,EAAE;YACtD,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,QAAgB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,QAAQ,WAAW,EAAE;YAC5D,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,0BAA0B,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YACjF,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;CACF"}
package/src/client.ts CHANGED
@@ -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,
@@ -39,6 +42,7 @@ import {
39
42
  InvocationUpdateResponse,
40
43
  Invocations,
41
44
  } from './resources/invocations';
45
+ import { ProfileCreateParams, ProfileListResponse, Profiles } from './resources/profiles';
42
46
  import {
43
47
  BrowserCreateParams,
44
48
  BrowserCreateResponse,
@@ -47,6 +51,7 @@ import {
47
51
  BrowserPersistence,
48
52
  BrowserRetrieveResponse,
49
53
  Browsers,
54
+ Profile,
50
55
  } from './resources/browsers/browsers';
51
56
  import { type Fetch } from './internal/builtin-types';
52
57
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
@@ -435,7 +440,7 @@ export class Kernel {
435
440
  const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError);
436
441
  const headersTime = Date.now();
437
442
 
438
- if (response instanceof Error) {
443
+ if (response instanceof globalThis.Error) {
439
444
  const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
440
445
  if (options.signal?.aborted) {
441
446
  throw new Errors.APIUserAbortError();
@@ -549,6 +554,25 @@ export class Kernel {
549
554
  return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
550
555
  }
551
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
+
552
576
  async fetchWithTimeout(
553
577
  url: RequestInfo,
554
578
  init: RequestInit | undefined,
@@ -795,16 +819,24 @@ export class Kernel {
795
819
  apps: API.Apps = new API.Apps(this);
796
820
  invocations: API.Invocations = new API.Invocations(this);
797
821
  browsers: API.Browsers = new API.Browsers(this);
822
+ profiles: API.Profiles = new API.Profiles(this);
798
823
  }
799
824
 
800
825
  Kernel.Deployments = Deployments;
801
826
  Kernel.Apps = Apps;
802
827
  Kernel.Invocations = Invocations;
803
828
  Kernel.Browsers = Browsers;
829
+ Kernel.Profiles = Profiles;
804
830
 
805
831
  export declare namespace Kernel {
806
832
  export type RequestOptions = Opts.RequestOptions;
807
833
 
834
+ export import OffsetPagination = Pagination.OffsetPagination;
835
+ export {
836
+ type OffsetPaginationParams as OffsetPaginationParams,
837
+ type OffsetPaginationResponse as OffsetPaginationResponse,
838
+ };
839
+
808
840
  export {
809
841
  Deployments as Deployments,
810
842
  type DeploymentStateEvent as DeploymentStateEvent,
@@ -812,6 +844,7 @@ export declare namespace Kernel {
812
844
  type DeploymentRetrieveResponse as DeploymentRetrieveResponse,
813
845
  type DeploymentListResponse as DeploymentListResponse,
814
846
  type DeploymentFollowResponse as DeploymentFollowResponse,
847
+ type DeploymentListResponsesOffsetPagination as DeploymentListResponsesOffsetPagination,
815
848
  type DeploymentCreateParams as DeploymentCreateParams,
816
849
  type DeploymentListParams as DeploymentListParams,
817
850
  type DeploymentFollowParams as DeploymentFollowParams,
@@ -833,6 +866,7 @@ export declare namespace Kernel {
833
866
  export {
834
867
  Browsers as Browsers,
835
868
  type BrowserPersistence as BrowserPersistence,
869
+ type Profile as Profile,
836
870
  type BrowserCreateResponse as BrowserCreateResponse,
837
871
  type BrowserRetrieveResponse as BrowserRetrieveResponse,
838
872
  type BrowserListResponse as BrowserListResponse,
@@ -840,6 +874,12 @@ export declare namespace Kernel {
840
874
  type BrowserDeleteParams as BrowserDeleteParams,
841
875
  };
842
876
 
877
+ export {
878
+ Profiles as Profiles,
879
+ type ProfileListResponse as ProfileListResponse,
880
+ type ProfileCreateParams as ProfileCreateParams,
881
+ };
882
+
843
883
  export type AppAction = API.AppAction;
844
884
  export type ErrorDetail = API.ErrorDetail;
845
885
  export type ErrorEvent = API.ErrorEvent;
@@ -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';