@onkernel/sdk 0.158.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 (57) hide show
  1. package/CHANGELOG.md +26 -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 +23 -0
  10. package/resources/browser-pools.d.mts.map +1 -1
  11. package/resources/browser-pools.d.ts +23 -0
  12. package/resources/browser-pools.d.ts.map +1 -1
  13. package/resources/browsers/browsers.d.mts +45 -7
  14. package/resources/browsers/browsers.d.mts.map +1 -1
  15. package/resources/browsers/browsers.d.ts +45 -7
  16. package/resources/browsers/browsers.d.ts.map +1 -1
  17. package/resources/browsers/browsers.js.map +1 -1
  18. package/resources/browsers/browsers.mjs.map +1 -1
  19. package/resources/browsers/process.d.mts +4 -2
  20. package/resources/browsers/process.d.mts.map +1 -1
  21. package/resources/browsers/process.d.ts +4 -2
  22. package/resources/browsers/process.d.ts.map +1 -1
  23. package/resources/index.d.mts +1 -1
  24. package/resources/index.d.mts.map +1 -1
  25. package/resources/index.d.ts +1 -1
  26. package/resources/index.d.ts.map +1 -1
  27. package/resources/index.js.map +1 -1
  28. package/resources/index.mjs.map +1 -1
  29. package/resources/invocations.d.mts +5 -0
  30. package/resources/invocations.d.mts.map +1 -1
  31. package/resources/invocations.d.ts +5 -0
  32. package/resources/invocations.d.ts.map +1 -1
  33. package/resources/projects/limits.d.mts +7 -0
  34. package/resources/projects/limits.d.mts.map +1 -1
  35. package/resources/projects/limits.d.ts +7 -0
  36. package/resources/projects/limits.d.ts.map +1 -1
  37. package/resources/reports.d.mts +125 -1
  38. package/resources/reports.d.mts.map +1 -1
  39. package/resources/reports.d.ts +125 -1
  40. package/resources/reports.d.ts.map +1 -1
  41. package/resources/reports.js +22 -0
  42. package/resources/reports.js.map +1 -1
  43. package/resources/reports.mjs +22 -0
  44. package/resources/reports.mjs.map +1 -1
  45. package/src/client.ts +4 -0
  46. package/src/resources/browser-pools.ts +27 -0
  47. package/src/resources/browsers/browsers.ts +51 -7
  48. package/src/resources/browsers/process.ts +4 -2
  49. package/src/resources/index.ts +2 -0
  50. package/src/resources/invocations.ts +6 -0
  51. package/src/resources/projects/limits.ts +8 -0
  52. package/src/resources/reports.ts +141 -0
  53. package/src/version.ts +1 -1
  54. package/version.d.mts +1 -1
  55. package/version.d.ts +1 -1
  56. package/version.js +1 -1
  57. package/version.mjs +1 -1
@@ -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.158.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.158.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.158.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.158.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.158.0'; // x-release-please-version
1
+ export const VERSION = '0.160.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map