@onkernel/sdk 0.61.0 → 0.63.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 (134) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/client.d.mts +10 -13
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +10 -13
  5. package/client.d.ts.map +1 -1
  6. package/client.js +0 -3
  7. package/client.js.map +1 -1
  8. package/client.mjs +0 -3
  9. package/client.mjs.map +1 -1
  10. package/internal/qs/formats.d.mts +7 -0
  11. package/internal/qs/formats.d.mts.map +1 -0
  12. package/internal/qs/formats.d.ts +7 -0
  13. package/internal/qs/formats.d.ts.map +1 -0
  14. package/internal/qs/formats.js +13 -0
  15. package/internal/qs/formats.js.map +1 -0
  16. package/internal/qs/formats.mjs +9 -0
  17. package/internal/qs/formats.mjs.map +1 -0
  18. package/internal/qs/index.d.mts +10 -0
  19. package/internal/qs/index.d.mts.map +1 -0
  20. package/internal/qs/index.d.ts +10 -0
  21. package/internal/qs/index.d.ts.map +1 -0
  22. package/internal/qs/index.js +14 -0
  23. package/internal/qs/index.js.map +1 -0
  24. package/internal/qs/index.mjs +10 -0
  25. package/internal/qs/index.mjs.map +1 -0
  26. package/internal/qs/stringify.d.mts +3 -0
  27. package/internal/qs/stringify.d.mts.map +1 -0
  28. package/internal/qs/stringify.d.ts +3 -0
  29. package/internal/qs/stringify.d.ts.map +1 -0
  30. package/internal/qs/stringify.js +277 -0
  31. package/internal/qs/stringify.js.map +1 -0
  32. package/internal/qs/stringify.mjs +274 -0
  33. package/internal/qs/stringify.mjs.map +1 -0
  34. package/internal/qs/types.d.mts +57 -0
  35. package/internal/qs/types.d.mts.map +1 -0
  36. package/internal/qs/types.d.ts +57 -0
  37. package/internal/qs/types.d.ts.map +1 -0
  38. package/internal/qs/types.js +3 -0
  39. package/internal/qs/types.js.map +1 -0
  40. package/internal/qs/types.mjs +2 -0
  41. package/internal/qs/types.mjs.map +1 -0
  42. package/internal/qs/utils.d.mts +15 -0
  43. package/internal/qs/utils.d.mts.map +1 -0
  44. package/internal/qs/utils.d.ts +15 -0
  45. package/internal/qs/utils.d.ts.map +1 -0
  46. package/internal/qs/utils.js +230 -0
  47. package/internal/qs/utils.js.map +1 -0
  48. package/internal/qs/utils.mjs +217 -0
  49. package/internal/qs/utils.mjs.map +1 -0
  50. package/internal/utils/query.d.mts +0 -3
  51. package/internal/utils/query.d.mts.map +1 -1
  52. package/internal/utils/query.d.ts +0 -3
  53. package/internal/utils/query.d.ts.map +1 -1
  54. package/internal/utils/query.js +3 -16
  55. package/internal/utils/query.js.map +1 -1
  56. package/internal/utils/query.mjs +2 -16
  57. package/internal/utils/query.mjs.map +1 -1
  58. package/package.json +1 -1
  59. package/resources/browser-pools.d.mts +19 -4
  60. package/resources/browser-pools.d.mts.map +1 -1
  61. package/resources/browser-pools.d.ts +19 -4
  62. package/resources/browser-pools.d.ts.map +1 -1
  63. package/resources/browser-pools.js +7 -3
  64. package/resources/browser-pools.js.map +1 -1
  65. package/resources/browser-pools.mjs +7 -3
  66. package/resources/browser-pools.mjs.map +1 -1
  67. package/resources/browsers/browsers.d.mts +63 -2
  68. package/resources/browsers/browsers.d.mts.map +1 -1
  69. package/resources/browsers/browsers.d.ts +63 -2
  70. package/resources/browsers/browsers.d.ts.map +1 -1
  71. package/resources/browsers/browsers.js.map +1 -1
  72. package/resources/browsers/browsers.mjs.map +1 -1
  73. package/resources/browsers/index.d.mts +1 -1
  74. package/resources/browsers/index.d.mts.map +1 -1
  75. package/resources/browsers/index.d.ts +1 -1
  76. package/resources/browsers/index.d.ts.map +1 -1
  77. package/resources/browsers/index.js.map +1 -1
  78. package/resources/browsers/index.mjs.map +1 -1
  79. package/resources/credential-providers.d.mts +10 -5
  80. package/resources/credential-providers.d.mts.map +1 -1
  81. package/resources/credential-providers.d.ts +10 -5
  82. package/resources/credential-providers.d.ts.map +1 -1
  83. package/resources/credential-providers.js +10 -4
  84. package/resources/credential-providers.js.map +1 -1
  85. package/resources/credential-providers.mjs +10 -4
  86. package/resources/credential-providers.mjs.map +1 -1
  87. package/resources/extensions.d.mts +35 -31
  88. package/resources/extensions.d.mts.map +1 -1
  89. package/resources/extensions.d.ts +35 -31
  90. package/resources/extensions.d.ts.map +1 -1
  91. package/resources/extensions.js +10 -3
  92. package/resources/extensions.js.map +1 -1
  93. package/resources/extensions.mjs +10 -3
  94. package/resources/extensions.mjs.map +1 -1
  95. package/resources/index.d.mts +5 -5
  96. package/resources/index.d.mts.map +1 -1
  97. package/resources/index.d.ts +5 -5
  98. package/resources/index.d.ts.map +1 -1
  99. package/resources/index.js.map +1 -1
  100. package/resources/index.mjs.map +1 -1
  101. package/resources/invocations.d.mts +9 -0
  102. package/resources/invocations.d.mts.map +1 -1
  103. package/resources/invocations.d.ts +9 -0
  104. package/resources/invocations.d.ts.map +1 -1
  105. package/resources/proxies.d.mts +111 -110
  106. package/resources/proxies.d.mts.map +1 -1
  107. package/resources/proxies.d.ts +111 -110
  108. package/resources/proxies.d.ts.map +1 -1
  109. package/resources/proxies.js +3 -2
  110. package/resources/proxies.js.map +1 -1
  111. package/resources/proxies.mjs +3 -2
  112. package/resources/proxies.mjs.map +1 -1
  113. package/src/client.ts +18 -7
  114. package/src/internal/qs/LICENSE.md +13 -0
  115. package/src/internal/qs/README.md +3 -0
  116. package/src/internal/qs/formats.ts +10 -0
  117. package/src/internal/qs/index.ts +13 -0
  118. package/src/internal/qs/stringify.ts +385 -0
  119. package/src/internal/qs/types.ts +71 -0
  120. package/src/internal/qs/utils.ts +265 -0
  121. package/src/internal/utils/query.ts +2 -18
  122. package/src/resources/browser-pools.ts +27 -6
  123. package/src/resources/browsers/browsers.ts +71 -1
  124. package/src/resources/browsers/index.ts +1 -0
  125. package/src/resources/credential-providers.ts +19 -7
  126. package/src/resources/extensions.ts +41 -29
  127. package/src/resources/index.ts +9 -2
  128. package/src/resources/invocations.ts +11 -0
  129. package/src/resources/proxies.ts +120 -114
  130. package/src/version.ts +1 -1
  131. package/version.d.mts +1 -1
  132. package/version.d.ts +1 -1
  133. package/version.js +1 -1
  134. package/version.mjs +1 -1
@@ -0,0 +1,71 @@
1
+ export type Format = 'RFC1738' | 'RFC3986';
2
+
3
+ export type DefaultEncoder = (str: any, defaultEncoder?: any, charset?: string) => string;
4
+ export type DefaultDecoder = (str: string, decoder?: any, charset?: string) => string;
5
+
6
+ export type BooleanOptional = boolean | undefined;
7
+
8
+ export type StringifyBaseOptions = {
9
+ delimiter?: string;
10
+ allowDots?: boolean;
11
+ encodeDotInKeys?: boolean;
12
+ strictNullHandling?: boolean;
13
+ skipNulls?: boolean;
14
+ encode?: boolean;
15
+ encoder?: (
16
+ str: any,
17
+ defaultEncoder: DefaultEncoder,
18
+ charset: string,
19
+ type: 'key' | 'value',
20
+ format?: Format,
21
+ ) => string;
22
+ filter?: Array<PropertyKey> | ((prefix: PropertyKey, value: any) => any);
23
+ arrayFormat?: 'indices' | 'brackets' | 'repeat' | 'comma';
24
+ indices?: boolean;
25
+ sort?: ((a: PropertyKey, b: PropertyKey) => number) | null;
26
+ serializeDate?: (d: Date) => string;
27
+ format?: 'RFC1738' | 'RFC3986';
28
+ formatter?: (str: PropertyKey) => string;
29
+ encodeValuesOnly?: boolean;
30
+ addQueryPrefix?: boolean;
31
+ charset?: 'utf-8' | 'iso-8859-1';
32
+ charsetSentinel?: boolean;
33
+ allowEmptyArrays?: boolean;
34
+ commaRoundTrip?: boolean;
35
+ };
36
+
37
+ export type StringifyOptions = StringifyBaseOptions;
38
+
39
+ export type ParseBaseOptions = {
40
+ comma?: boolean;
41
+ delimiter?: string | RegExp;
42
+ depth?: number | false;
43
+ decoder?: (str: string, defaultDecoder: DefaultDecoder, charset: string, type: 'key' | 'value') => any;
44
+ arrayLimit?: number;
45
+ parseArrays?: boolean;
46
+ plainObjects?: boolean;
47
+ allowPrototypes?: boolean;
48
+ allowSparse?: boolean;
49
+ parameterLimit?: number;
50
+ strictDepth?: boolean;
51
+ strictNullHandling?: boolean;
52
+ ignoreQueryPrefix?: boolean;
53
+ charset?: 'utf-8' | 'iso-8859-1';
54
+ charsetSentinel?: boolean;
55
+ interpretNumericEntities?: boolean;
56
+ allowEmptyArrays?: boolean;
57
+ duplicates?: 'combine' | 'first' | 'last';
58
+ allowDots?: boolean;
59
+ decodeDotInKeys?: boolean;
60
+ };
61
+
62
+ export type ParseOptions = ParseBaseOptions;
63
+
64
+ export type ParsedQs = {
65
+ [key: string]: undefined | string | string[] | ParsedQs | ParsedQs[];
66
+ };
67
+
68
+ // Type to remove null or undefined union from each property
69
+ export type NonNullableProperties<T> = {
70
+ [K in keyof T]-?: Exclude<T[K], undefined | null>;
71
+ };
@@ -0,0 +1,265 @@
1
+ import { RFC1738 } from './formats';
2
+ import type { DefaultEncoder, Format } from './types';
3
+ import { isArray } from '../utils/values';
4
+
5
+ export let has = (obj: object, key: PropertyKey): boolean => (
6
+ (has = (Object as any).hasOwn ?? Function.prototype.call.bind(Object.prototype.hasOwnProperty)),
7
+ has(obj, key)
8
+ );
9
+
10
+ const hex_table = /* @__PURE__ */ (() => {
11
+ const array = [];
12
+ for (let i = 0; i < 256; ++i) {
13
+ array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
14
+ }
15
+
16
+ return array;
17
+ })();
18
+
19
+ function compact_queue<T extends Record<string, any>>(queue: Array<{ obj: T; prop: string }>) {
20
+ while (queue.length > 1) {
21
+ const item = queue.pop();
22
+ if (!item) continue;
23
+
24
+ const obj = item.obj[item.prop];
25
+
26
+ if (isArray(obj)) {
27
+ const compacted: unknown[] = [];
28
+
29
+ for (let j = 0; j < obj.length; ++j) {
30
+ if (typeof obj[j] !== 'undefined') {
31
+ compacted.push(obj[j]);
32
+ }
33
+ }
34
+
35
+ // @ts-ignore
36
+ item.obj[item.prop] = compacted;
37
+ }
38
+ }
39
+ }
40
+
41
+ function array_to_object(source: any[], options: { plainObjects: boolean }) {
42
+ const obj = options && options.plainObjects ? Object.create(null) : {};
43
+ for (let i = 0; i < source.length; ++i) {
44
+ if (typeof source[i] !== 'undefined') {
45
+ obj[i] = source[i];
46
+ }
47
+ }
48
+
49
+ return obj;
50
+ }
51
+
52
+ export function merge(
53
+ target: any,
54
+ source: any,
55
+ options: { plainObjects?: boolean; allowPrototypes?: boolean } = {},
56
+ ) {
57
+ if (!source) {
58
+ return target;
59
+ }
60
+
61
+ if (typeof source !== 'object') {
62
+ if (isArray(target)) {
63
+ target.push(source);
64
+ } else if (target && typeof target === 'object') {
65
+ if ((options && (options.plainObjects || options.allowPrototypes)) || !has(Object.prototype, source)) {
66
+ target[source] = true;
67
+ }
68
+ } else {
69
+ return [target, source];
70
+ }
71
+
72
+ return target;
73
+ }
74
+
75
+ if (!target || typeof target !== 'object') {
76
+ return [target].concat(source);
77
+ }
78
+
79
+ let mergeTarget = target;
80
+ if (isArray(target) && !isArray(source)) {
81
+ // @ts-ignore
82
+ mergeTarget = array_to_object(target, options);
83
+ }
84
+
85
+ if (isArray(target) && isArray(source)) {
86
+ source.forEach(function (item, i) {
87
+ if (has(target, i)) {
88
+ const targetItem = target[i];
89
+ if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
90
+ target[i] = merge(targetItem, item, options);
91
+ } else {
92
+ target.push(item);
93
+ }
94
+ } else {
95
+ target[i] = item;
96
+ }
97
+ });
98
+ return target;
99
+ }
100
+
101
+ return Object.keys(source).reduce(function (acc, key) {
102
+ const value = source[key];
103
+
104
+ if (has(acc, key)) {
105
+ acc[key] = merge(acc[key], value, options);
106
+ } else {
107
+ acc[key] = value;
108
+ }
109
+ return acc;
110
+ }, mergeTarget);
111
+ }
112
+
113
+ export function assign_single_source(target: any, source: any) {
114
+ return Object.keys(source).reduce(function (acc, key) {
115
+ acc[key] = source[key];
116
+ return acc;
117
+ }, target);
118
+ }
119
+
120
+ export function decode(str: string, _: any, charset: string) {
121
+ const strWithoutPlus = str.replace(/\+/g, ' ');
122
+ if (charset === 'iso-8859-1') {
123
+ // unescape never throws, no try...catch needed:
124
+ return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
125
+ }
126
+ // utf-8
127
+ try {
128
+ return decodeURIComponent(strWithoutPlus);
129
+ } catch (e) {
130
+ return strWithoutPlus;
131
+ }
132
+ }
133
+
134
+ const limit = 1024;
135
+
136
+ export const encode: (
137
+ str: any,
138
+ defaultEncoder: DefaultEncoder,
139
+ charset: string,
140
+ type: 'key' | 'value',
141
+ format: Format,
142
+ ) => string = (str, _defaultEncoder, charset, _kind, format: Format) => {
143
+ // This code was originally written by Brian White for the io.js core querystring library.
144
+ // It has been adapted here for stricter adherence to RFC 3986
145
+ if (str.length === 0) {
146
+ return str;
147
+ }
148
+
149
+ let string = str;
150
+ if (typeof str === 'symbol') {
151
+ string = Symbol.prototype.toString.call(str);
152
+ } else if (typeof str !== 'string') {
153
+ string = String(str);
154
+ }
155
+
156
+ if (charset === 'iso-8859-1') {
157
+ return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
158
+ return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
159
+ });
160
+ }
161
+
162
+ let out = '';
163
+ for (let j = 0; j < string.length; j += limit) {
164
+ const segment = string.length >= limit ? string.slice(j, j + limit) : string;
165
+ const arr = [];
166
+
167
+ for (let i = 0; i < segment.length; ++i) {
168
+ let c = segment.charCodeAt(i);
169
+ if (
170
+ c === 0x2d || // -
171
+ c === 0x2e || // .
172
+ c === 0x5f || // _
173
+ c === 0x7e || // ~
174
+ (c >= 0x30 && c <= 0x39) || // 0-9
175
+ (c >= 0x41 && c <= 0x5a) || // a-z
176
+ (c >= 0x61 && c <= 0x7a) || // A-Z
177
+ (format === RFC1738 && (c === 0x28 || c === 0x29)) // ( )
178
+ ) {
179
+ arr[arr.length] = segment.charAt(i);
180
+ continue;
181
+ }
182
+
183
+ if (c < 0x80) {
184
+ arr[arr.length] = hex_table[c];
185
+ continue;
186
+ }
187
+
188
+ if (c < 0x800) {
189
+ arr[arr.length] = hex_table[0xc0 | (c >> 6)]! + hex_table[0x80 | (c & 0x3f)];
190
+ continue;
191
+ }
192
+
193
+ if (c < 0xd800 || c >= 0xe000) {
194
+ arr[arr.length] =
195
+ hex_table[0xe0 | (c >> 12)]! + hex_table[0x80 | ((c >> 6) & 0x3f)] + hex_table[0x80 | (c & 0x3f)];
196
+ continue;
197
+ }
198
+
199
+ i += 1;
200
+ c = 0x10000 + (((c & 0x3ff) << 10) | (segment.charCodeAt(i) & 0x3ff));
201
+
202
+ arr[arr.length] =
203
+ hex_table[0xf0 | (c >> 18)]! +
204
+ hex_table[0x80 | ((c >> 12) & 0x3f)] +
205
+ hex_table[0x80 | ((c >> 6) & 0x3f)] +
206
+ hex_table[0x80 | (c & 0x3f)];
207
+ }
208
+
209
+ out += arr.join('');
210
+ }
211
+
212
+ return out;
213
+ };
214
+
215
+ export function compact(value: any) {
216
+ const queue = [{ obj: { o: value }, prop: 'o' }];
217
+ const refs = [];
218
+
219
+ for (let i = 0; i < queue.length; ++i) {
220
+ const item = queue[i];
221
+ // @ts-ignore
222
+ const obj = item.obj[item.prop];
223
+
224
+ const keys = Object.keys(obj);
225
+ for (let j = 0; j < keys.length; ++j) {
226
+ const key = keys[j]!;
227
+ const val = obj[key];
228
+ if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
229
+ queue.push({ obj: obj, prop: key });
230
+ refs.push(val);
231
+ }
232
+ }
233
+ }
234
+
235
+ compact_queue(queue);
236
+
237
+ return value;
238
+ }
239
+
240
+ export function is_regexp(obj: any) {
241
+ return Object.prototype.toString.call(obj) === '[object RegExp]';
242
+ }
243
+
244
+ export function is_buffer(obj: any) {
245
+ if (!obj || typeof obj !== 'object') {
246
+ return false;
247
+ }
248
+
249
+ return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
250
+ }
251
+
252
+ export function combine(a: any, b: any) {
253
+ return [].concat(a, b);
254
+ }
255
+
256
+ export function maybe_map<T>(val: T[], fn: (v: T) => T) {
257
+ if (isArray(val)) {
258
+ const mapped = [];
259
+ for (let i = 0; i < val.length; i += 1) {
260
+ mapped.push(fn(val[i]!));
261
+ }
262
+ return mapped;
263
+ }
264
+ return fn(val);
265
+ }
@@ -1,23 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { KernelError } from '../../core/error';
3
+ import * as qs from '../qs/stringify';
4
4
 
5
- /**
6
- * Basic re-implementation of `qs.stringify` for primitive types.
7
- */
8
5
  export function stringifyQuery(query: object | Record<string, unknown>) {
9
- return Object.entries(query)
10
- .filter(([_, value]) => typeof value !== 'undefined')
11
- .map(([key, value]) => {
12
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
13
- return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
14
- }
15
- if (value === null) {
16
- return `${encodeURIComponent(key)}=`;
17
- }
18
- throw new KernelError(
19
- `Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
20
- );
21
- })
22
- .join('&');
6
+ return qs.stringify(query, { arrayFormat: 'comma' });
23
7
  }
@@ -5,6 +5,7 @@ import * as Shared from './shared';
5
5
  import * as BrowsersAPI from './browsers/browsers';
6
6
  import * as TelemetryAPI from './browsers/telemetry';
7
7
  import { APIPromise } from '../core/api-promise';
8
+ import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../core/pagination';
8
9
  import { buildHeaders } from '../internal/headers';
9
10
  import { RequestOptions } from '../internal/request-options';
10
11
  import { path } from '../internal/utils/path';
@@ -60,11 +61,17 @@ export class BrowserPools extends APIResource {
60
61
  *
61
62
  * @example
62
63
  * ```ts
63
- * const browserPools = await client.browserPools.list();
64
+ * // Automatically fetches more pages as needed.
65
+ * for await (const browserPool of client.browserPools.list()) {
66
+ * // ...
67
+ * }
64
68
  * ```
65
69
  */
66
- list(options?: RequestOptions): APIPromise<BrowserPoolListResponse> {
67
- return this._client.get('/browser_pools', options);
70
+ list(
71
+ query: BrowserPoolListParams | null | undefined = {},
72
+ options?: RequestOptions,
73
+ ): PagePromise<BrowserPoolsOffsetPagination, BrowserPool> {
74
+ return this._client.getAPIList('/browser_pools', OffsetPagination<BrowserPool>, { query, ...options });
68
75
  }
69
76
 
70
77
  /**
@@ -143,6 +150,8 @@ export class BrowserPools extends APIResource {
143
150
  }
144
151
  }
145
152
 
153
+ export type BrowserPoolsOffsetPagination = OffsetPagination<BrowserPool>;
154
+
146
155
  /**
147
156
  * A browser pool containing multiple identically configured browsers.
148
157
  */
@@ -276,8 +285,6 @@ export namespace BrowserPool {
276
285
  }
277
286
  }
278
287
 
279
- export type BrowserPoolListResponse = Array<BrowserPool>;
280
-
281
288
  export interface BrowserPoolAcquireResponse {
282
289
  /**
283
290
  * Websocket URL for Chrome DevTools Protocol connections to the browser session
@@ -348,6 +355,11 @@ export interface BrowserPoolAcquireResponse {
348
355
  */
349
356
  kiosk_mode?: boolean;
350
357
 
358
+ /**
359
+ * Human-readable name of the browser session, if one was set at creation.
360
+ */
361
+ name?: string;
362
+
351
363
  /**
352
364
  * Browser pool this session was acquired from, if any.
353
365
  */
@@ -372,6 +384,12 @@ export interface BrowserPoolAcquireResponse {
372
384
  */
373
385
  start_url?: string;
374
386
 
387
+ /**
388
+ * User-defined key-value tags that were set on this browser session, if any.
389
+ * Echoed back when present.
390
+ */
391
+ tags?: BrowsersAPI.Tags;
392
+
375
393
  /**
376
394
  * Active telemetry configuration for the session, if any.
377
395
  */
@@ -591,6 +609,8 @@ export interface BrowserPoolUpdateParams {
591
609
  viewport?: Shared.BrowserViewport;
592
610
  }
593
611
 
612
+ export interface BrowserPoolListParams extends OffsetPaginationParams {}
613
+
594
614
  export interface BrowserPoolDeleteParams {
595
615
  /**
596
616
  * If true, force delete even if browsers are currently leased. Leased browsers
@@ -624,10 +644,11 @@ export interface BrowserPoolReleaseParams {
624
644
  export declare namespace BrowserPools {
625
645
  export {
626
646
  type BrowserPool as BrowserPool,
627
- type BrowserPoolListResponse as BrowserPoolListResponse,
628
647
  type BrowserPoolAcquireResponse as BrowserPoolAcquireResponse,
648
+ type BrowserPoolsOffsetPagination as BrowserPoolsOffsetPagination,
629
649
  type BrowserPoolCreateParams as BrowserPoolCreateParams,
630
650
  type BrowserPoolUpdateParams as BrowserPoolUpdateParams,
651
+ type BrowserPoolListParams as BrowserPoolListParams,
631
652
  type BrowserPoolDeleteParams as BrowserPoolDeleteParams,
632
653
  type BrowserPoolAcquireParams as BrowserPoolAcquireParams,
633
654
  type BrowserPoolReleaseParams as BrowserPoolReleaseParams,
@@ -319,6 +319,11 @@ export interface Profile {
319
319
  updated_at?: string;
320
320
  }
321
321
 
322
+ /**
323
+ * User-defined key-value tags.
324
+ */
325
+ export type Tags = { [key: string]: string };
326
+
322
327
  export interface BrowserCreateResponse {
323
328
  /**
324
329
  * Websocket URL for Chrome DevTools Protocol connections to the browser session
@@ -389,6 +394,11 @@ export interface BrowserCreateResponse {
389
394
  */
390
395
  kiosk_mode?: boolean;
391
396
 
397
+ /**
398
+ * Human-readable name of the browser session, if one was set at creation.
399
+ */
400
+ name?: string;
401
+
392
402
  /**
393
403
  * Browser pool this session was acquired from, if any.
394
404
  */
@@ -413,6 +423,12 @@ export interface BrowserCreateResponse {
413
423
  */
414
424
  start_url?: string;
415
425
 
426
+ /**
427
+ * User-defined key-value tags that were set on this browser session, if any.
428
+ * Echoed back when present.
429
+ */
430
+ tags?: Tags;
431
+
416
432
  /**
417
433
  * Active telemetry configuration for the session, if any.
418
434
  */
@@ -510,6 +526,11 @@ export interface BrowserRetrieveResponse {
510
526
  */
511
527
  kiosk_mode?: boolean;
512
528
 
529
+ /**
530
+ * Human-readable name of the browser session, if one was set at creation.
531
+ */
532
+ name?: string;
533
+
513
534
  /**
514
535
  * Browser pool this session was acquired from, if any.
515
536
  */
@@ -534,6 +555,12 @@ export interface BrowserRetrieveResponse {
534
555
  */
535
556
  start_url?: string;
536
557
 
558
+ /**
559
+ * User-defined key-value tags that were set on this browser session, if any.
560
+ * Echoed back when present.
561
+ */
562
+ tags?: Tags;
563
+
537
564
  /**
538
565
  * Active telemetry configuration for the session, if any.
539
566
  */
@@ -631,6 +658,11 @@ export interface BrowserUpdateResponse {
631
658
  */
632
659
  kiosk_mode?: boolean;
633
660
 
661
+ /**
662
+ * Human-readable name of the browser session, if one was set at creation.
663
+ */
664
+ name?: string;
665
+
634
666
  /**
635
667
  * Browser pool this session was acquired from, if any.
636
668
  */
@@ -655,6 +687,12 @@ export interface BrowserUpdateResponse {
655
687
  */
656
688
  start_url?: string;
657
689
 
690
+ /**
691
+ * User-defined key-value tags that were set on this browser session, if any.
692
+ * Echoed back when present.
693
+ */
694
+ tags?: Tags;
695
+
658
696
  /**
659
697
  * Active telemetry configuration for the session, if any.
660
698
  */
@@ -752,6 +790,11 @@ export interface BrowserListResponse {
752
790
  */
753
791
  kiosk_mode?: boolean;
754
792
 
793
+ /**
794
+ * Human-readable name of the browser session, if one was set at creation.
795
+ */
796
+ name?: string;
797
+
755
798
  /**
756
799
  * Browser pool this session was acquired from, if any.
757
800
  */
@@ -776,6 +819,12 @@ export interface BrowserListResponse {
776
819
  */
777
820
  start_url?: string;
778
821
 
822
+ /**
823
+ * User-defined key-value tags that were set on this browser session, if any.
824
+ * Echoed back when present.
825
+ */
826
+ tags?: Tags;
827
+
779
828
  /**
780
829
  * Active telemetry configuration for the session, if any.
781
830
  */
@@ -865,6 +914,13 @@ export interface BrowserCreateParams {
865
914
  */
866
915
  kiosk_mode?: boolean;
867
916
 
917
+ /**
918
+ * Optional human-readable name for the browser session, used to find it later in
919
+ * the dashboard. Must be unique among active sessions within the project. Set at
920
+ * creation time only.
921
+ */
922
+ name?: string;
923
+
868
924
  /**
869
925
  * Profile selection for the browser session. Provide either id or name. If
870
926
  * specified, the matching profile will be loaded into the browser session.
@@ -891,6 +947,12 @@ export interface BrowserCreateParams {
891
947
  */
892
948
  stealth?: boolean;
893
949
 
950
+ /**
951
+ * Optional user-defined key-value tags for the browser session, used to find and
952
+ * group sessions later. Set at creation time only. Up to 50 pairs.
953
+ */
954
+ tags?: Tags;
955
+
894
956
  /**
895
957
  * Telemetry configuration for the browser session. Set enabled to true to start
896
958
  * capture using VM defaults, or provide browser category settings. If omitted,
@@ -1040,7 +1102,7 @@ export interface BrowserListParams extends OffsetPaginationParams {
1040
1102
  include_deleted?: boolean;
1041
1103
 
1042
1104
  /**
1043
- * Search browsers by session ID, profile ID, proxy ID, or pool name.
1105
+ * Search browsers by name, session ID, profile ID, proxy ID, or pool name.
1044
1106
  */
1045
1107
  query?: string;
1046
1108
 
@@ -1049,6 +1111,13 @@ export interface BrowserListParams extends OffsetPaginationParams {
1049
1111
  * "deleted" returns only soft-deleted sessions, "all" returns both.
1050
1112
  */
1051
1113
  status?: 'active' | 'deleted' | 'all';
1114
+
1115
+ /**
1116
+ * Filter sessions by tag key-value pairs using deepObject style, e.g.
1117
+ * ?tags[team]=backend&tags[env]=staging. Multiple pairs are ANDed: a session must
1118
+ * match every supplied pair exactly.
1119
+ */
1120
+ tags?: { [key: string]: string };
1052
1121
  }
1053
1122
 
1054
1123
  export interface BrowserCurlParams {
@@ -1118,6 +1187,7 @@ export declare namespace Browsers {
1118
1187
  type BrowserPoolRef as BrowserPoolRef,
1119
1188
  type BrowserUsage as BrowserUsage,
1120
1189
  type Profile as Profile,
1190
+ type Tags as Tags,
1121
1191
  type BrowserCreateResponse as BrowserCreateResponse,
1122
1192
  type BrowserRetrieveResponse as BrowserRetrieveResponse,
1123
1193
  type BrowserUpdateResponse as BrowserUpdateResponse,
@@ -5,6 +5,7 @@ export {
5
5
  type BrowserPoolRef,
6
6
  type BrowserUsage,
7
7
  type Profile,
8
+ type Tags,
8
9
  type BrowserCreateResponse,
9
10
  type BrowserRetrieveResponse,
10
11
  type BrowserUpdateResponse,
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
+ import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../core/pagination';
5
6
  import { buildHeaders } from '../internal/headers';
6
7
  import { RequestOptions } from '../internal/request-options';
7
8
  import { path } from '../internal/utils/path';
@@ -63,12 +64,20 @@ export class CredentialProviders extends APIResource {
63
64
  *
64
65
  * @example
65
66
  * ```ts
66
- * const credentialProviders =
67
- * await client.credentialProviders.list();
67
+ * // Automatically fetches more pages as needed.
68
+ * for await (const credentialProvider of client.credentialProviders.list()) {
69
+ * // ...
70
+ * }
68
71
  * ```
69
72
  */
70
- list(options?: RequestOptions): APIPromise<CredentialProviderListResponse> {
71
- return this._client.get('/org/credential_providers', options);
73
+ list(
74
+ query: CredentialProviderListParams | null | undefined = {},
75
+ options?: RequestOptions,
76
+ ): PagePromise<CredentialProvidersOffsetPagination, CredentialProvider> {
77
+ return this._client.getAPIList('/org/credential_providers', OffsetPagination<CredentialProvider>, {
78
+ query,
79
+ ...options,
80
+ });
72
81
  }
73
82
 
74
83
  /**
@@ -115,6 +124,8 @@ export class CredentialProviders extends APIResource {
115
124
  }
116
125
  }
117
126
 
127
+ export type CredentialProvidersOffsetPagination = OffsetPagination<CredentialProvider>;
128
+
118
129
  /**
119
130
  * Request to create an external credential provider
120
131
  */
@@ -280,8 +291,6 @@ export interface UpdateCredentialProviderRequest {
280
291
  priority?: number;
281
292
  }
282
293
 
283
- export type CredentialProviderListResponse = Array<CredentialProvider>;
284
-
285
294
  export interface CredentialProviderListItemsResponse {
286
295
  items?: Array<CredentialProviderItem>;
287
296
  }
@@ -335,6 +344,8 @@ export interface CredentialProviderUpdateParams {
335
344
  priority?: number;
336
345
  }
337
346
 
347
+ export interface CredentialProviderListParams extends OffsetPaginationParams {}
348
+
338
349
  export declare namespace CredentialProviders {
339
350
  export {
340
351
  type CreateCredentialProviderRequest as CreateCredentialProviderRequest,
@@ -342,9 +353,10 @@ export declare namespace CredentialProviders {
342
353
  type CredentialProviderItem as CredentialProviderItem,
343
354
  type CredentialProviderTestResult as CredentialProviderTestResult,
344
355
  type UpdateCredentialProviderRequest as UpdateCredentialProviderRequest,
345
- type CredentialProviderListResponse as CredentialProviderListResponse,
346
356
  type CredentialProviderListItemsResponse as CredentialProviderListItemsResponse,
357
+ type CredentialProvidersOffsetPagination as CredentialProvidersOffsetPagination,
347
358
  type CredentialProviderCreateParams as CredentialProviderCreateParams,
348
359
  type CredentialProviderUpdateParams as CredentialProviderUpdateParams,
360
+ type CredentialProviderListParams as CredentialProviderListParams,
349
361
  };
350
362
  }