@onkernel/sdk 0.24.0 → 0.25.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 (80) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +1 -1
  3. package/README.md +7 -2
  4. package/client.d.mts +4 -4
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +4 -4
  7. package/client.d.ts.map +1 -1
  8. package/client.js.map +1 -1
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/agents/agents.d.mts +2 -2
  12. package/resources/agents/agents.d.mts.map +1 -1
  13. package/resources/agents/agents.d.ts +2 -2
  14. package/resources/agents/agents.d.ts.map +1 -1
  15. package/resources/agents/agents.js.map +1 -1
  16. package/resources/agents/agents.mjs.map +1 -1
  17. package/resources/agents/auth/auth.d.mts +107 -129
  18. package/resources/agents/auth/auth.d.mts.map +1 -1
  19. package/resources/agents/auth/auth.d.ts +107 -129
  20. package/resources/agents/auth/auth.d.ts.map +1 -1
  21. package/resources/agents/auth/auth.js +2 -18
  22. package/resources/agents/auth/auth.js.map +1 -1
  23. package/resources/agents/auth/auth.mjs +2 -18
  24. package/resources/agents/auth/auth.mjs.map +1 -1
  25. package/resources/agents/auth/index.d.mts +2 -2
  26. package/resources/agents/auth/index.d.mts.map +1 -1
  27. package/resources/agents/auth/index.d.ts +2 -2
  28. package/resources/agents/auth/index.d.ts.map +1 -1
  29. package/resources/agents/auth/index.js.map +1 -1
  30. package/resources/agents/auth/index.mjs.map +1 -1
  31. package/resources/agents/auth/invocations.d.mts +22 -33
  32. package/resources/agents/auth/invocations.d.mts.map +1 -1
  33. package/resources/agents/auth/invocations.d.ts +22 -33
  34. package/resources/agents/auth/invocations.d.ts.map +1 -1
  35. package/resources/agents/auth/invocations.js +5 -20
  36. package/resources/agents/auth/invocations.js.map +1 -1
  37. package/resources/agents/auth/invocations.mjs +5 -20
  38. package/resources/agents/auth/invocations.mjs.map +1 -1
  39. package/resources/agents/index.d.mts +1 -1
  40. package/resources/agents/index.d.mts.map +1 -1
  41. package/resources/agents/index.d.ts +1 -1
  42. package/resources/agents/index.d.ts.map +1 -1
  43. package/resources/agents/index.js.map +1 -1
  44. package/resources/agents/index.mjs.map +1 -1
  45. package/resources/credentials.d.mts +107 -16
  46. package/resources/credentials.d.mts.map +1 -1
  47. package/resources/credentials.d.ts +107 -16
  48. package/resources/credentials.d.ts.map +1 -1
  49. package/resources/credentials.js +33 -14
  50. package/resources/credentials.js.map +1 -1
  51. package/resources/credentials.mjs +33 -14
  52. package/resources/credentials.mjs.map +1 -1
  53. package/resources/index.d.mts +2 -2
  54. package/resources/index.d.mts.map +1 -1
  55. package/resources/index.d.ts +2 -2
  56. package/resources/index.d.ts.map +1 -1
  57. package/resources/index.js.map +1 -1
  58. package/resources/index.mjs.map +1 -1
  59. package/resources/proxies.d.mts +137 -1
  60. package/resources/proxies.d.mts.map +1 -1
  61. package/resources/proxies.d.ts +137 -1
  62. package/resources/proxies.d.ts.map +1 -1
  63. package/resources/proxies.js +6 -0
  64. package/resources/proxies.js.map +1 -1
  65. package/resources/proxies.mjs +6 -0
  66. package/resources/proxies.mjs.map +1 -1
  67. package/src/client.ts +4 -0
  68. package/src/resources/agents/agents.ts +0 -4
  69. package/src/resources/agents/auth/auth.ts +114 -141
  70. package/src/resources/agents/auth/index.ts +0 -3
  71. package/src/resources/agents/auth/invocations.ts +21 -39
  72. package/src/resources/agents/index.ts +0 -2
  73. package/src/resources/credentials.ts +127 -18
  74. package/src/resources/index.ts +2 -0
  75. package/src/resources/proxies.ts +228 -0
  76. package/src/version.ts +1 -1
  77. package/version.d.mts +1 -1
  78. package/version.d.ts +1 -1
  79. package/version.js +1 -1
  80. package/version.mjs +1 -1
@@ -9,8 +9,7 @@ import { path } from '../internal/utils/path';
9
9
 
10
10
  export class Credentials extends APIResource {
11
11
  /**
12
- * Create a new credential for storing login information. Values are encrypted at
13
- * rest.
12
+ * Create a new credential for storing login information.
14
13
  *
15
14
  * @example
16
15
  * ```ts
@@ -29,27 +28,32 @@ export class Credentials extends APIResource {
29
28
  }
30
29
 
31
30
  /**
32
- * Retrieve a credential by its ID. Credential values are not returned.
31
+ * Retrieve a credential by its ID or name. Credential values are not returned.
33
32
  *
34
33
  * @example
35
34
  * ```ts
36
- * const credential = await client.credentials.retrieve('id');
35
+ * const credential = await client.credentials.retrieve(
36
+ * 'id_or_name',
37
+ * );
37
38
  * ```
38
39
  */
39
- retrieve(id: string, options?: RequestOptions): APIPromise<Credential> {
40
- return this._client.get(path`/credentials/${id}`, options);
40
+ retrieve(idOrName: string, options?: RequestOptions): APIPromise<Credential> {
41
+ return this._client.get(path`/credentials/${idOrName}`, options);
41
42
  }
42
43
 
43
44
  /**
44
- * Update a credential's name or values. Values are encrypted at rest.
45
+ * Update a credential's name or values. When values are provided, they are merged
46
+ * with existing values (new keys are added, existing keys are overwritten).
45
47
  *
46
48
  * @example
47
49
  * ```ts
48
- * const credential = await client.credentials.update('id');
50
+ * const credential = await client.credentials.update(
51
+ * 'id_or_name',
52
+ * );
49
53
  * ```
50
54
  */
51
- update(id: string, body: CredentialUpdateParams, options?: RequestOptions): APIPromise<Credential> {
52
- return this._client.patch(path`/credentials/${id}`, { body, ...options });
55
+ update(idOrName: string, body: CredentialUpdateParams, options?: RequestOptions): APIPromise<Credential> {
56
+ return this._client.patch(path`/credentials/${idOrName}`, { body, ...options });
53
57
  }
54
58
 
55
59
  /**
@@ -72,19 +76,35 @@ export class Credentials extends APIResource {
72
76
  }
73
77
 
74
78
  /**
75
- * Delete a credential by its ID.
79
+ * Delete a credential by its ID or name.
76
80
  *
77
81
  * @example
78
82
  * ```ts
79
- * await client.credentials.delete('id');
83
+ * await client.credentials.delete('id_or_name');
80
84
  * ```
81
85
  */
82
- delete(id: string, options?: RequestOptions): APIPromise<void> {
83
- return this._client.delete(path`/credentials/${id}`, {
86
+ delete(idOrName: string, options?: RequestOptions): APIPromise<void> {
87
+ return this._client.delete(path`/credentials/${idOrName}`, {
84
88
  ...options,
85
89
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
86
90
  });
87
91
  }
92
+
93
+ /**
94
+ * Returns the current 6-digit TOTP code for a credential with a configured
95
+ * totp_secret. Use this to complete 2FA setup on sites or when you need a fresh
96
+ * code.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const response = await client.credentials.totpCode(
101
+ * 'id_or_name',
102
+ * );
103
+ * ```
104
+ */
105
+ totpCode(idOrName: string, options?: RequestOptions): APIPromise<CredentialTotpCodeResponse> {
106
+ return this._client.get(path`/credentials/${idOrName}/totp-code`, options);
107
+ }
88
108
  }
89
109
 
90
110
  export type CredentialsOffsetPagination = OffsetPagination<Credential>;
@@ -107,6 +127,20 @@ export interface CreateCredentialRequest {
107
127
  * Field name to value mapping (e.g., username, password)
108
128
  */
109
129
  values: { [key: string]: string };
130
+
131
+ /**
132
+ * If set, indicates this credential should be used with the specified SSO provider
133
+ * (e.g., google, github, microsoft). When the target site has a matching SSO
134
+ * button, it will be clicked first before filling credential values on the
135
+ * identity provider's login page.
136
+ */
137
+ sso_provider?: string;
138
+
139
+ /**
140
+ * Base32-encoded TOTP secret for generating one-time passwords. Used for automatic
141
+ * 2FA during login.
142
+ */
143
+ totp_secret?: string;
110
144
  }
111
145
 
112
146
  /**
@@ -137,6 +171,30 @@ export interface Credential {
137
171
  * When the credential was last updated
138
172
  */
139
173
  updated_at: string;
174
+
175
+ /**
176
+ * Whether this credential has a TOTP secret configured for automatic 2FA
177
+ */
178
+ has_totp_secret?: boolean;
179
+
180
+ /**
181
+ * If set, indicates this credential should be used with the specified SSO provider
182
+ * (e.g., google, github, microsoft). When the target site has a matching SSO
183
+ * button, it will be clicked first before filling credential values on the
184
+ * identity provider's login page.
185
+ */
186
+ sso_provider?: string | null;
187
+
188
+ /**
189
+ * Current 6-digit TOTP code. Only included in create/update responses when
190
+ * totp_secret was just set.
191
+ */
192
+ totp_code?: string;
193
+
194
+ /**
195
+ * When the totp_code expires. Only included when totp_code is present.
196
+ */
197
+ totp_code_expires_at?: string;
140
198
  }
141
199
 
142
200
  /**
@@ -149,12 +207,36 @@ export interface UpdateCredentialRequest {
149
207
  name?: string;
150
208
 
151
209
  /**
152
- * Field name to value mapping (e.g., username, password). Replaces all existing
153
- * values.
210
+ * If set, indicates this credential should be used with the specified SSO
211
+ * provider. Set to empty string or null to remove.
212
+ */
213
+ sso_provider?: string | null;
214
+
215
+ /**
216
+ * Base32-encoded TOTP secret for generating one-time passwords. Spaces and
217
+ * formatting are automatically normalized. Set to empty string to remove.
218
+ */
219
+ totp_secret?: string;
220
+
221
+ /**
222
+ * Field name to value mapping. Values are merged with existing values (new keys
223
+ * added, existing keys overwritten).
154
224
  */
155
225
  values?: { [key: string]: string };
156
226
  }
157
227
 
228
+ export interface CredentialTotpCodeResponse {
229
+ /**
230
+ * Current 6-digit TOTP code
231
+ */
232
+ code: string;
233
+
234
+ /**
235
+ * When this code expires (ISO 8601 timestamp)
236
+ */
237
+ expires_at: string;
238
+ }
239
+
158
240
  export interface CredentialCreateParams {
159
241
  /**
160
242
  * Target domain this credential is for
@@ -170,6 +252,20 @@ export interface CredentialCreateParams {
170
252
  * Field name to value mapping (e.g., username, password)
171
253
  */
172
254
  values: { [key: string]: string };
255
+
256
+ /**
257
+ * If set, indicates this credential should be used with the specified SSO provider
258
+ * (e.g., google, github, microsoft). When the target site has a matching SSO
259
+ * button, it will be clicked first before filling credential values on the
260
+ * identity provider's login page.
261
+ */
262
+ sso_provider?: string;
263
+
264
+ /**
265
+ * Base32-encoded TOTP secret for generating one-time passwords. Used for automatic
266
+ * 2FA during login.
267
+ */
268
+ totp_secret?: string;
173
269
  }
174
270
 
175
271
  export interface CredentialUpdateParams {
@@ -179,8 +275,20 @@ export interface CredentialUpdateParams {
179
275
  name?: string;
180
276
 
181
277
  /**
182
- * Field name to value mapping (e.g., username, password). Replaces all existing
183
- * values.
278
+ * If set, indicates this credential should be used with the specified SSO
279
+ * provider. Set to empty string or null to remove.
280
+ */
281
+ sso_provider?: string | null;
282
+
283
+ /**
284
+ * Base32-encoded TOTP secret for generating one-time passwords. Spaces and
285
+ * formatting are automatically normalized. Set to empty string to remove.
286
+ */
287
+ totp_secret?: string;
288
+
289
+ /**
290
+ * Field name to value mapping. Values are merged with existing values (new keys
291
+ * added, existing keys overwritten).
184
292
  */
185
293
  values?: { [key: string]: string };
186
294
  }
@@ -197,6 +305,7 @@ export declare namespace Credentials {
197
305
  type CreateCredentialRequest as CreateCredentialRequest,
198
306
  type Credential as Credential,
199
307
  type UpdateCredentialRequest as UpdateCredentialRequest,
308
+ type CredentialTotpCodeResponse as CredentialTotpCodeResponse,
200
309
  type CredentialsOffsetPagination as CredentialsOffsetPagination,
201
310
  type CredentialCreateParams as CredentialCreateParams,
202
311
  type CredentialUpdateParams as CredentialUpdateParams,
@@ -37,6 +37,7 @@ export {
37
37
  type CreateCredentialRequest,
38
38
  type Credential,
39
39
  type UpdateCredentialRequest,
40
+ type CredentialTotpCodeResponse,
40
41
  type CredentialCreateParams,
41
42
  type CredentialUpdateParams,
42
43
  type CredentialListParams,
@@ -81,5 +82,6 @@ export {
81
82
  type ProxyCreateResponse,
82
83
  type ProxyRetrieveResponse,
83
84
  type ProxyListResponse,
85
+ type ProxyCheckResponse,
84
86
  type ProxyCreateParams,
85
87
  } from './proxies';
@@ -37,6 +37,13 @@ export class Proxies extends APIResource {
37
37
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
38
38
  });
39
39
  }
40
+
41
+ /**
42
+ * Run a health check on the proxy to verify it's working.
43
+ */
44
+ check(id: string, options?: RequestOptions): APIPromise<ProxyCheckResponse> {
45
+ return this._client.post(path`/proxies/${id}/check`, options);
46
+ }
40
47
  }
41
48
 
42
49
  /**
@@ -703,6 +710,226 @@ export namespace ProxyListResponse {
703
710
  }
704
711
  }
705
712
 
713
+ /**
714
+ * Configuration for routing traffic through a proxy.
715
+ */
716
+ export interface ProxyCheckResponse {
717
+ /**
718
+ * Proxy type to use. In terms of quality for avoiding bot-detection, from best to
719
+ * worst: `mobile` > `residential` > `isp` > `datacenter`.
720
+ */
721
+ type: 'datacenter' | 'isp' | 'residential' | 'mobile' | 'custom';
722
+
723
+ id?: string;
724
+
725
+ /**
726
+ * Configuration specific to the selected proxy `type`.
727
+ */
728
+ config?:
729
+ | ProxyCheckResponse.DatacenterProxyConfig
730
+ | ProxyCheckResponse.IspProxyConfig
731
+ | ProxyCheckResponse.ResidentialProxyConfig
732
+ | ProxyCheckResponse.MobileProxyConfig
733
+ | ProxyCheckResponse.CustomProxyConfig;
734
+
735
+ /**
736
+ * Timestamp of the last health check performed on this proxy.
737
+ */
738
+ last_checked?: string;
739
+
740
+ /**
741
+ * Readable name of the proxy.
742
+ */
743
+ name?: string;
744
+
745
+ /**
746
+ * Protocol to use for the proxy connection.
747
+ */
748
+ protocol?: 'http' | 'https';
749
+
750
+ /**
751
+ * Current health status of the proxy.
752
+ */
753
+ status?: 'available' | 'unavailable';
754
+ }
755
+
756
+ export namespace ProxyCheckResponse {
757
+ /**
758
+ * Configuration for a datacenter proxy.
759
+ */
760
+ export interface DatacenterProxyConfig {
761
+ /**
762
+ * ISO 3166 country code. Defaults to US if not provided.
763
+ */
764
+ country?: string;
765
+ }
766
+
767
+ /**
768
+ * Configuration for an ISP proxy.
769
+ */
770
+ export interface IspProxyConfig {
771
+ /**
772
+ * ISO 3166 country code. Defaults to US if not provided.
773
+ */
774
+ country?: string;
775
+ }
776
+
777
+ /**
778
+ * Configuration for residential proxies.
779
+ */
780
+ export interface ResidentialProxyConfig {
781
+ /**
782
+ * Autonomous system number. See https://bgp.potaroo.net/cidr/autnums.html
783
+ */
784
+ asn?: string;
785
+
786
+ /**
787
+ * City name (no spaces, e.g. `sanfrancisco`). If provided, `country` must also be
788
+ * provided.
789
+ */
790
+ city?: string;
791
+
792
+ /**
793
+ * ISO 3166 country code.
794
+ */
795
+ country?: string;
796
+
797
+ /**
798
+ * @deprecated Operating system of the residential device.
799
+ */
800
+ os?: 'windows' | 'macos' | 'android';
801
+
802
+ /**
803
+ * Two-letter state code.
804
+ */
805
+ state?: string;
806
+
807
+ /**
808
+ * US ZIP code.
809
+ */
810
+ zip?: string;
811
+ }
812
+
813
+ /**
814
+ * Configuration for mobile proxies.
815
+ */
816
+ export interface MobileProxyConfig {
817
+ /**
818
+ * Autonomous system number. See https://bgp.potaroo.net/cidr/autnums.html
819
+ */
820
+ asn?: string;
821
+
822
+ /**
823
+ * Mobile carrier.
824
+ */
825
+ carrier?:
826
+ | 'a1'
827
+ | 'aircel'
828
+ | 'airtel'
829
+ | 'att'
830
+ | 'celcom'
831
+ | 'chinamobile'
832
+ | 'claro'
833
+ | 'comcast'
834
+ | 'cox'
835
+ | 'digi'
836
+ | 'dt'
837
+ | 'docomo'
838
+ | 'dtac'
839
+ | 'etisalat'
840
+ | 'idea'
841
+ | 'kyivstar'
842
+ | 'meo'
843
+ | 'megafon'
844
+ | 'mtn'
845
+ | 'mtnza'
846
+ | 'mts'
847
+ | 'optus'
848
+ | 'orange'
849
+ | 'qwest'
850
+ | 'reliance_jio'
851
+ | 'robi'
852
+ | 'sprint'
853
+ | 'telefonica'
854
+ | 'telstra'
855
+ | 'tmobile'
856
+ | 'tigo'
857
+ | 'tim'
858
+ | 'verizon'
859
+ | 'vimpelcom'
860
+ | 'vodacomza'
861
+ | 'vodafone'
862
+ | 'vivo'
863
+ | 'zain'
864
+ | 'vivabo'
865
+ | 'telenormyanmar'
866
+ | 'kcelljsc'
867
+ | 'swisscom'
868
+ | 'singtel'
869
+ | 'asiacell'
870
+ | 'windit'
871
+ | 'cellc'
872
+ | 'ooredoo'
873
+ | 'drei'
874
+ | 'umobile'
875
+ | 'cableone'
876
+ | 'proximus'
877
+ | 'tele2'
878
+ | 'mobitel'
879
+ | 'o2'
880
+ | 'bouygues'
881
+ | 'free'
882
+ | 'sfr'
883
+ | 'digicel';
884
+
885
+ /**
886
+ * City name (no spaces, e.g. `sanfrancisco`). If provided, `country` must also be
887
+ * provided.
888
+ */
889
+ city?: string;
890
+
891
+ /**
892
+ * ISO 3166 country code
893
+ */
894
+ country?: string;
895
+
896
+ /**
897
+ * Two-letter state code.
898
+ */
899
+ state?: string;
900
+
901
+ /**
902
+ * US ZIP code.
903
+ */
904
+ zip?: string;
905
+ }
906
+
907
+ /**
908
+ * Configuration for a custom proxy (e.g., private proxy server).
909
+ */
910
+ export interface CustomProxyConfig {
911
+ /**
912
+ * Proxy host address or IP.
913
+ */
914
+ host: string;
915
+
916
+ /**
917
+ * Proxy port.
918
+ */
919
+ port: number;
920
+
921
+ /**
922
+ * Whether the proxy has a password.
923
+ */
924
+ has_password?: boolean;
925
+
926
+ /**
927
+ * Username for proxy authentication.
928
+ */
929
+ username?: string;
930
+ }
931
+ }
932
+
706
933
  export interface ProxyCreateParams {
707
934
  /**
708
935
  * Proxy type to use. In terms of quality for avoiding bot-detection, from best to
@@ -913,6 +1140,7 @@ export declare namespace Proxies {
913
1140
  type ProxyCreateResponse as ProxyCreateResponse,
914
1141
  type ProxyRetrieveResponse as ProxyRetrieveResponse,
915
1142
  type ProxyListResponse as ProxyListResponse,
1143
+ type ProxyCheckResponse as ProxyCheckResponse,
916
1144
  type ProxyCreateParams as ProxyCreateParams,
917
1145
  };
918
1146
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.24.0'; // x-release-please-version
1
+ export const VERSION = '0.25.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.24.0";
1
+ export declare const VERSION = "0.25.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.24.0";
1
+ export declare const VERSION = "0.25.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.24.0'; // x-release-please-version
4
+ exports.VERSION = '0.25.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.24.0'; // x-release-please-version
1
+ export const VERSION = '0.25.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map