@onkernel/sdk 0.159.0 → 0.160.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 (46) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/browser-pools.d.mts +2 -2
  10. package/resources/browser-pools.d.ts +2 -2
  11. package/resources/browsers/browsers.d.mts +2 -2
  12. package/resources/browsers/browsers.d.ts +2 -2
  13. package/resources/browsers/process.d.mts +4 -2
  14. package/resources/browsers/process.d.mts.map +1 -1
  15. package/resources/browsers/process.d.ts +4 -2
  16. package/resources/browsers/process.d.ts.map +1 -1
  17. package/resources/index.d.mts +1 -1
  18. package/resources/index.d.mts.map +1 -1
  19. package/resources/index.d.ts +1 -1
  20. package/resources/index.d.ts.map +1 -1
  21. package/resources/index.js.map +1 -1
  22. package/resources/index.mjs.map +1 -1
  23. package/resources/projects/limits.d.mts +7 -0
  24. package/resources/projects/limits.d.mts.map +1 -1
  25. package/resources/projects/limits.d.ts +7 -0
  26. package/resources/projects/limits.d.ts.map +1 -1
  27. package/resources/reports.d.mts +125 -1
  28. package/resources/reports.d.mts.map +1 -1
  29. package/resources/reports.d.ts +125 -1
  30. package/resources/reports.d.ts.map +1 -1
  31. package/resources/reports.js +22 -0
  32. package/resources/reports.js.map +1 -1
  33. package/resources/reports.mjs +22 -0
  34. package/resources/reports.mjs.map +1 -1
  35. package/src/client.ts +4 -0
  36. package/src/resources/browser-pools.ts +2 -2
  37. package/src/resources/browsers/browsers.ts +2 -2
  38. package/src/resources/browsers/process.ts +4 -2
  39. package/src/resources/index.ts +2 -0
  40. package/src/resources/projects/limits.ts +8 -0
  41. package/src/resources/reports.ts +141 -0
  42. package/src/version.ts +1 -1
  43. package/version.d.mts +1 -1
  44. package/version.d.ts +1 -1
  45. package/version.js +1 -1
  46. package/version.mjs +1 -1
@@ -755,7 +755,7 @@ export interface BrowserPoolCreateParams {
755
755
  /**
756
756
  * Seconds a browser acquired from this pool waits after its last connection closes
757
757
  * before entering standby. Defaults to the platform default when omitted. Minimum
758
- * 3, maximum 300. Idle browsers in the pool use the platform default, and a
758
+ * 10, maximum 300. Idle browsers in the pool use the platform default, and a
759
759
  * released browser returns to it. An acquired browser can override the pool's
760
760
  * value with PATCH /browsers/{id_or_name}.
761
761
  */
@@ -1081,7 +1081,7 @@ export interface BrowserPoolUpdateParams {
1081
1081
 
1082
1082
  /**
1083
1083
  * If provided, replaces the standby idle timeout for browsers in this pool.
1084
- * Minimum 3, maximum 300. Applies to browsers acquired after the update.
1084
+ * Minimum 10, maximum 300. Applies to browsers acquired after the update.
1085
1085
  */
1086
1086
  standby_idle_timeout_seconds?: number;
1087
1087
 
@@ -2170,7 +2170,7 @@ export interface BrowserCreateParams {
2170
2170
  * view) closes before entering standby. A shorter value reduces billed idle time
2171
2171
  * for bursty workloads; a longer value keeps the browser awake between closely
2172
2172
  * spaced connections. Defaults to the platform default when omitted. Minimum
2173
- * allowed is 3 seconds. Maximum allowed is 300 seconds. Not supported with
2173
+ * allowed is 10 seconds. Maximum allowed is 300 seconds. Not supported with
2174
2174
  * gpu=true or on macOS. Can be changed later via PATCH /browsers/{id_or_name}.
2175
2175
  */
2176
2176
  standby_idle_timeout_seconds?: number;
@@ -2441,7 +2441,7 @@ export interface BrowserUpdateParams {
2441
2441
 
2442
2442
  /**
2443
2443
  * Seconds the browser waits after its last connection closes before entering
2444
- * standby. Omit to leave unchanged. Minimum allowed is 3 seconds. Maximum allowed
2444
+ * standby. Omit to leave unchanged. Minimum allowed is 10 seconds. Maximum allowed
2445
2445
  * is 300 seconds. Not supported on GPU browsers or macOS browsers. A browser
2446
2446
  * acquired from a browser pool returns to the platform default when released.
2447
2447
  */
@@ -287,7 +287,8 @@ export interface ProcessStdoutStreamResponse {
287
287
 
288
288
  export interface ProcessExecParams {
289
289
  /**
290
- * Executable or shell command to run.
290
+ * Executable to run, as a path or a name on PATH. Not run through a shell; for
291
+ * shell syntax, use /bin/sh with ["-c", "<script>"] in args.
291
292
  */
292
293
  command: string;
293
294
 
@@ -353,7 +354,8 @@ export interface ProcessResizeParams {
353
354
 
354
355
  export interface ProcessSpawnParams {
355
356
  /**
356
- * Executable or shell command to run.
357
+ * Executable to run, as a path or a name on PATH. Not run through a shell; for
358
+ * shell syntax, use /bin/sh with ["-c", "<script>"] in args.
357
359
  */
358
360
  command: string;
359
361
 
@@ -219,8 +219,10 @@ export {
219
219
  export {
220
220
  Reports,
221
221
  type Report,
222
+ type ReportQueryResponse,
222
223
  type ReportCreateParams,
223
224
  type ReportListParams,
225
+ type ReportQueryParams,
224
226
  type ReportsOffsetPagination,
225
227
  } from './reports';
226
228
  export {
@@ -42,6 +42,14 @@ export class Limits extends APIResource {
42
42
  }
43
43
 
44
44
  export interface ProjectLimits {
45
+ /**
46
+ * Current concurrent browsers in this project, counting active on-demand sessions
47
+ * and browser pool reservations. Compare against `max_concurrent_sessions`, or the
48
+ * organization's `default_project_max_concurrent_sessions` when this project has
49
+ * no override.
50
+ */
51
+ concurrent_sessions_used: number;
52
+
45
53
  /**
46
54
  * Maximum concurrent app invocations for this project. Null means no project-level
47
55
  * cap.
@@ -56,6 +56,29 @@ export class Reports extends APIResource {
56
56
  list(query: ReportListParams, options?: RequestOptions): PagePromise<ReportsOffsetPagination, Report> {
57
57
  return this._client.getAPIList('/reports', OffsetPagination<Report>, { query, ...options });
58
58
  }
59
+
60
+ /**
61
+ * Aggregate reports of one type, grouped by fields of their data. Results come
62
+ * from exported analytics data, which lags by about 75 minutes, so recently
63
+ * submitted reports may not be included yet. Tasks with no matching report do not
64
+ * appear, and with count_distinct a task can be counted in more than one group. A
65
+ * query that runs for more than 10 seconds returns 422 with code query_timeout.
66
+ * Requires tasks:read on the whole project.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const response = await client.reports.query({
71
+ * aggregate: { operation: 'count' },
72
+ * group_by: ['data.symptom'],
73
+ * occurred_after: '2019-12-27T18:11:19.117Z',
74
+ * occurred_before: '2019-12-27T18:11:19.117Z',
75
+ * type: 'bot_detection.observation',
76
+ * });
77
+ * ```
78
+ */
79
+ query(body: ReportQueryParams, options?: RequestOptions): APIPromise<ReportQueryResponse> {
80
+ return this._client.post('/reports/query', { body, ...options });
81
+ }
59
82
  }
60
83
 
61
84
  export type ReportsOffsetPagination = OffsetPagination<Report>;
@@ -106,6 +129,25 @@ export interface Report {
106
129
  session_id?: string | null;
107
130
  }
108
131
 
132
+ export interface ReportQueryResponse {
133
+ groups: Array<ReportQueryResponse.Group>;
134
+ }
135
+
136
+ export namespace ReportQueryResponse {
137
+ export interface Group {
138
+ /**
139
+ * Value of each group_by field for this group, such as {"data.symptom":"captcha"};
140
+ * null when reports lack the field.
141
+ */
142
+ key: { [key: string]: unknown };
143
+
144
+ /**
145
+ * The aggregate for this group.
146
+ */
147
+ value: number;
148
+ }
149
+ }
150
+
109
151
  export interface ReportCreateParams {
110
152
  /**
111
153
  * Report data. It must match the schema of the report type's version and encode to
@@ -156,11 +198,110 @@ export interface ReportListParams extends OffsetPaginationParams {
156
198
  type?: string;
157
199
  }
158
200
 
201
+ export interface ReportQueryParams {
202
+ /**
203
+ * The value computed for each group.
204
+ */
205
+ aggregate: ReportQueryParams.Aggregate;
206
+
207
+ /**
208
+ * Fields of the report data to group by, such as data.symptom. Enums, numbers,
209
+ * booleans and strings of at most 255 characters can be grouped by. A report
210
+ * without a field groups under null.
211
+ */
212
+ group_by: Array<string>;
213
+
214
+ /**
215
+ * Include reports that occurred at or after this time.
216
+ */
217
+ occurred_after: string;
218
+
219
+ /**
220
+ * Include reports that occurred before this time. At most 30 days after
221
+ * occurred_after.
222
+ */
223
+ occurred_before: string;
224
+
225
+ /**
226
+ * Report type to query.
227
+ */
228
+ type: string;
229
+
230
+ /**
231
+ * Exact matches on fields of the report data, keyed by field, such as
232
+ * {"data.site":"booking.com"}. Reports without the field do not match.
233
+ */
234
+ filters?: { [key: string]: string | number | boolean };
235
+
236
+ /**
237
+ * Maximum number of groups to return, largest value first.
238
+ */
239
+ limit?: number;
240
+
241
+ /**
242
+ * Schema version to query. Fields are checked against this version's schema and
243
+ * only reports submitted with it are included. Defaults to the type's latest
244
+ * version.
245
+ */
246
+ schema_version?: number;
247
+
248
+ /**
249
+ * Only include reports whose task matches every filter given.
250
+ */
251
+ task_filter?: ReportQueryParams.TaskFilter;
252
+ }
253
+
254
+ export namespace ReportQueryParams {
255
+ /**
256
+ * The value computed for each group.
257
+ */
258
+ export interface Aggregate {
259
+ /**
260
+ * count counts reports; count_distinct counts distinct task_id values; sum and avg
261
+ * aggregate a numeric field of the report data, leaving out reports without it.
262
+ */
263
+ operation: 'count' | 'count_distinct' | 'sum' | 'avg';
264
+
265
+ /**
266
+ * Optional for count, where it can only be id. task_id for count_distinct, or a
267
+ * numeric data field such as data.expected_amount.minor_units for sum and avg.
268
+ */
269
+ field?: string;
270
+ }
271
+
272
+ /**
273
+ * Only include reports whose task matches every filter given.
274
+ */
275
+ export interface TaskFilter {
276
+ /**
277
+ * Only tasks linked to at least one of these browsers.
278
+ */
279
+ browser_ids?: Array<string>;
280
+
281
+ /**
282
+ * Task metadata entries the task must have, with these exact values.
283
+ */
284
+ metadata?: { [key: string]: string };
285
+
286
+ /**
287
+ * Only tasks that started at or after this time.
288
+ */
289
+ started_after?: string;
290
+
291
+ /**
292
+ * Only tasks that started before this time.
293
+ */
294
+ started_before?: string;
295
+ }
296
+ }
297
+
159
298
  export declare namespace Reports {
160
299
  export {
161
300
  type Report as Report,
301
+ type ReportQueryResponse as ReportQueryResponse,
162
302
  type ReportsOffsetPagination as ReportsOffsetPagination,
163
303
  type ReportCreateParams as ReportCreateParams,
164
304
  type ReportListParams as ReportListParams,
305
+ type ReportQueryParams as ReportQueryParams,
165
306
  };
166
307
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.159.0'; // x-release-please-version
1
+ export const VERSION = '0.160.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.159.0";
1
+ export declare const VERSION = "0.160.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.159.0";
1
+ export declare const VERSION = "0.160.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.159.0'; // x-release-please-version
4
+ exports.VERSION = '0.160.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.159.0'; // x-release-please-version
1
+ export const VERSION = '0.160.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map