@nimble-way/nimble-js 0.18.0 → 0.19.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 (102) hide show
  1. package/CHANGELOG.md +14 -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/agent.d.mts +10 -10
  10. package/resources/agent.d.mts.map +1 -1
  11. package/resources/agent.d.ts +10 -10
  12. package/resources/agent.d.ts.map +1 -1
  13. package/resources/batches.d.mts +5 -5
  14. package/resources/batches.d.mts.map +1 -1
  15. package/resources/batches.d.ts +5 -5
  16. package/resources/batches.d.ts.map +1 -1
  17. package/resources/crawl.d.mts +1 -0
  18. package/resources/crawl.d.mts.map +1 -1
  19. package/resources/crawl.d.ts +1 -0
  20. package/resources/crawl.d.ts.map +1 -1
  21. package/resources/fast-serp.d.mts +305 -0
  22. package/resources/fast-serp.d.mts.map +1 -1
  23. package/resources/fast-serp.d.ts +305 -0
  24. package/resources/fast-serp.d.ts.map +1 -1
  25. package/resources/fast-serp.js +13 -0
  26. package/resources/fast-serp.js.map +1 -1
  27. package/resources/fast-serp.mjs +13 -0
  28. package/resources/fast-serp.mjs.map +1 -1
  29. package/resources/index.d.mts +1 -1
  30. package/resources/index.d.mts.map +1 -1
  31. package/resources/index.d.ts +1 -1
  32. package/resources/index.d.ts.map +1 -1
  33. package/resources/index.js.map +1 -1
  34. package/resources/index.mjs.map +1 -1
  35. package/resources/jobs/jobs.d.mts +18 -0
  36. package/resources/jobs/jobs.d.mts.map +1 -1
  37. package/resources/jobs/jobs.d.ts +18 -0
  38. package/resources/jobs/jobs.d.ts.map +1 -1
  39. package/resources/jobs/jobs.js.map +1 -1
  40. package/resources/jobs/jobs.mjs.map +1 -1
  41. package/resources/jobs/runs/artifacts.d.mts +6 -0
  42. package/resources/jobs/runs/artifacts.d.mts.map +1 -1
  43. package/resources/jobs/runs/artifacts.d.ts +6 -0
  44. package/resources/jobs/runs/artifacts.d.ts.map +1 -1
  45. package/resources/media.d.mts +5 -5
  46. package/resources/media.d.mts.map +1 -1
  47. package/resources/media.d.ts +5 -5
  48. package/resources/media.d.ts.map +1 -1
  49. package/resources/serp.d.mts +10 -10
  50. package/resources/serp.d.mts.map +1 -1
  51. package/resources/serp.d.ts +10 -10
  52. package/resources/serp.d.ts.map +1 -1
  53. package/resources/task-agent/runs.d.mts +286 -63
  54. package/resources/task-agent/runs.d.mts.map +1 -1
  55. package/resources/task-agent/runs.d.ts +286 -63
  56. package/resources/task-agent/runs.d.ts.map +1 -1
  57. package/resources/task-agent/runs.js +21 -6
  58. package/resources/task-agent/runs.js.map +1 -1
  59. package/resources/task-agent/runs.mjs +21 -6
  60. package/resources/task-agent/runs.mjs.map +1 -1
  61. package/resources/task-agent/task-agent.d.mts +131 -33
  62. package/resources/task-agent/task-agent.d.mts.map +1 -1
  63. package/resources/task-agent/task-agent.d.ts +131 -33
  64. package/resources/task-agent/task-agent.d.ts.map +1 -1
  65. package/resources/task-agent/task-agent.js +12 -14
  66. package/resources/task-agent/task-agent.js.map +1 -1
  67. package/resources/task-agent/task-agent.mjs +12 -14
  68. package/resources/task-agent/task-agent.mjs.map +1 -1
  69. package/resources/task-agent/templates.d.mts +15 -6
  70. package/resources/task-agent/templates.d.mts.map +1 -1
  71. package/resources/task-agent/templates.d.ts +15 -6
  72. package/resources/task-agent/templates.d.ts.map +1 -1
  73. package/resources/task-agent/templates.js +2 -2
  74. package/resources/task-agent/templates.mjs +2 -2
  75. package/resources/tasks.d.mts +10 -10
  76. package/resources/tasks.d.mts.map +1 -1
  77. package/resources/tasks.d.ts +10 -10
  78. package/resources/tasks.d.ts.map +1 -1
  79. package/resources/top-level.d.mts +14 -10
  80. package/resources/top-level.d.mts.map +1 -1
  81. package/resources/top-level.d.ts +14 -10
  82. package/resources/top-level.d.ts.map +1 -1
  83. package/src/client.ts +6 -2
  84. package/src/resources/agent.ts +11 -11
  85. package/src/resources/batches.ts +5 -5
  86. package/src/resources/crawl.ts +2 -0
  87. package/src/resources/fast-serp.ts +461 -1
  88. package/src/resources/index.ts +1 -1
  89. package/src/resources/jobs/jobs.ts +18 -0
  90. package/src/resources/jobs/runs/artifacts.ts +6 -0
  91. package/src/resources/media.ts +5 -5
  92. package/src/resources/serp.ts +10 -10
  93. package/src/resources/task-agent/runs.ts +304 -76
  94. package/src/resources/task-agent/task-agent.ts +141 -47
  95. package/src/resources/task-agent/templates.ts +16 -7
  96. package/src/resources/tasks.ts +10 -10
  97. package/src/resources/top-level.ts +18 -10
  98. package/src/version.ts +1 -1
  99. package/version.d.mts +1 -1
  100. package/version.d.ts +1 -1
  101. package/version.js +1 -1
  102. package/version.mjs +1 -1
@@ -1,5 +1,465 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
4
6
 
5
- export class FastSerp extends APIResource {}
7
+ export class FastSerp extends APIResource {
8
+ /**
9
+ * Fast SERP
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const response = await client.fastSerp.run({
14
+ * search_engine: 'google_search',
15
+ * });
16
+ * ```
17
+ */
18
+ run(body: FastSerpRunParams, options?: RequestOptions): APIPromise<FastSerpRunResponse> {
19
+ return this._client.post('/v1/fast-serp', { body, ...options });
20
+ }
21
+ }
22
+
23
+ export interface FastSerpRunResponse {
24
+ data: FastSerpRunResponse.Data;
25
+
26
+ metadata: FastSerpRunResponse.Metadata;
27
+
28
+ /**
29
+ * The status of the task.
30
+ */
31
+ status: 'success' | 'skipped' | 'fatal' | 'error' | 'postponed' | 'ignored' | 'rejected' | 'blocked';
32
+
33
+ /**
34
+ * Unique identifier for the task.
35
+ */
36
+ task_id: string;
37
+
38
+ /**
39
+ * The final URL.
40
+ */
41
+ url: string;
42
+
43
+ debug?: FastSerpRunResponse.Debug;
44
+
45
+ /**
46
+ * Pagination information if applicable.
47
+ */
48
+ pagination?: FastSerpRunResponse.NextPageParams | Array<FastSerpRunResponse.UnionMember1>;
49
+
50
+ /**
51
+ * The HTTP status code of the task.
52
+ */
53
+ status_code?: number;
54
+
55
+ /**
56
+ * List of warnings generated during the task.
57
+ */
58
+ warnings?: Array<string>;
59
+ }
60
+
61
+ export namespace FastSerpRunResponse {
62
+ export interface Data {
63
+ /**
64
+ * Browser actions execution results. Present only when browser_actions were
65
+ * specified in the request.
66
+ */
67
+ browser_actions?: Data.BrowserActions;
68
+
69
+ /**
70
+ * The cookies collected from browser actions during the task.
71
+ */
72
+ cookies?: Array<unknown>;
73
+
74
+ /**
75
+ * The evaluation results from browser actions during the task.
76
+ */
77
+ eval?: Array<unknown>;
78
+
79
+ /**
80
+ * The http requests from browser actions made during the task.
81
+ */
82
+ fetch?: Array<unknown>;
83
+
84
+ /**
85
+ * The headers received during the task.
86
+ */
87
+ headers?: { [key: string]: string };
88
+
89
+ /**
90
+ * The HTML content of the page.
91
+ */
92
+ html?: string;
93
+
94
+ /**
95
+ * List of all unique URLs found on the page.
96
+ */
97
+ links?: Array<string>;
98
+
99
+ /**
100
+ * The Markdown version of the HTML content.
101
+ */
102
+ markdown?: string;
103
+
104
+ /**
105
+ * The network capture data collected during the task.
106
+ */
107
+ network_capture?: Array<Data.NetworkCapture>;
108
+
109
+ /**
110
+ * Individual HTML content of each pagination page, before merging.
111
+ */
112
+ pages_html?: Array<string>;
113
+
114
+ /**
115
+ * The parsing results extracted from the HTML & network content.
116
+ */
117
+ parsing?: Data.ParsingSuccessResult | Data.ParsingErrorResult | { [key: string]: unknown };
118
+
119
+ /**
120
+ * The list of redirects that occurred during the task.
121
+ */
122
+ redirects?: Array<Data.Redirect>;
123
+
124
+ /**
125
+ * Screenshots taken during the task, from browser actions, or the screenshot
126
+ * format.
127
+ */
128
+ screenshots?: Array<unknown>;
129
+ }
130
+
131
+ export namespace Data {
132
+ /**
133
+ * Browser actions execution results. Present only when browser_actions were
134
+ * specified in the request.
135
+ */
136
+ export interface BrowserActions {
137
+ results: Array<BrowserActions.Result>;
138
+
139
+ success: boolean;
140
+
141
+ total_duration: number;
142
+ }
143
+
144
+ export namespace BrowserActions {
145
+ export interface Result {
146
+ duration: number;
147
+
148
+ name:
149
+ | 'goto'
150
+ | 'wait'
151
+ | 'wait_for_element'
152
+ | 'wait_for_navigation'
153
+ | 'click'
154
+ | 'fill'
155
+ | 'press'
156
+ | 'scroll'
157
+ | 'auto_scroll'
158
+ | 'screenshot'
159
+ | 'get_cookies'
160
+ | 'eval'
161
+ | 'fetch';
162
+
163
+ status: 'no-run' | 'in-progress' | 'done' | 'error' | 'skipped';
164
+
165
+ error?: string;
166
+
167
+ result?: unknown;
168
+ }
169
+ }
170
+
171
+ export interface NetworkCapture {
172
+ filter: NetworkCapture.Filter;
173
+
174
+ results: Array<NetworkCapture.Result>;
175
+
176
+ errorMessage?: string;
177
+ }
178
+
179
+ export namespace NetworkCapture {
180
+ export interface Filter {
181
+ validation: boolean;
182
+
183
+ wait_for_requests_count: number;
184
+
185
+ method?: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH';
186
+
187
+ /**
188
+ * Resource type for network capture filtering
189
+ */
190
+ resource_type?:
191
+ | 'document'
192
+ | 'stylesheet'
193
+ | 'image'
194
+ | 'media'
195
+ | 'font'
196
+ | 'script'
197
+ | 'texttrack'
198
+ | 'xhr'
199
+ | 'fetch'
200
+ | 'prefetch'
201
+ | 'eventsource'
202
+ | 'websocket'
203
+ | 'manifest'
204
+ | 'signedexchange'
205
+ | 'ping'
206
+ | 'cspviolationreport'
207
+ | 'preflight'
208
+ | 'other'
209
+ | 'fedcm'
210
+ | Array<
211
+ | 'document'
212
+ | 'stylesheet'
213
+ | 'image'
214
+ | 'media'
215
+ | 'font'
216
+ | 'script'
217
+ | 'texttrack'
218
+ | 'xhr'
219
+ | 'fetch'
220
+ | 'prefetch'
221
+ | 'eventsource'
222
+ | 'websocket'
223
+ | 'manifest'
224
+ | 'signedexchange'
225
+ | 'ping'
226
+ | 'cspviolationreport'
227
+ | 'preflight'
228
+ | 'other'
229
+ | 'fedcm'
230
+ >;
231
+
232
+ status_code?: number | Array<number>;
233
+
234
+ url?: Filter.URL;
235
+
236
+ wait_for_requests_count_timeout?: number;
237
+ }
238
+
239
+ export namespace Filter {
240
+ export interface URL {
241
+ type: 'exact' | 'contains';
242
+
243
+ value: string;
244
+ }
245
+ }
246
+
247
+ export interface Result {
248
+ request: Result.Request;
249
+
250
+ response: Result.Response;
251
+ }
252
+
253
+ export namespace Result {
254
+ export interface Request {
255
+ headers: { [key: string]: string };
256
+
257
+ method: string;
258
+
259
+ /**
260
+ * Resource type for network capture filtering
261
+ */
262
+ resource_type:
263
+ | 'document'
264
+ | 'stylesheet'
265
+ | 'image'
266
+ | 'media'
267
+ | 'font'
268
+ | 'script'
269
+ | 'texttrack'
270
+ | 'xhr'
271
+ | 'fetch'
272
+ | 'prefetch'
273
+ | 'eventsource'
274
+ | 'websocket'
275
+ | 'manifest'
276
+ | 'signedexchange'
277
+ | 'ping'
278
+ | 'cspviolationreport'
279
+ | 'preflight'
280
+ | 'other'
281
+ | 'fedcm';
282
+
283
+ url: string;
284
+
285
+ body?: string;
286
+ }
287
+
288
+ export interface Response {
289
+ body: string;
290
+
291
+ headers: { [key: string]: string };
292
+
293
+ serialization: 'none' | 'base64';
294
+
295
+ status: number;
296
+
297
+ status_text: string;
298
+ }
299
+ }
300
+ }
301
+
302
+ export interface ParsingSuccessResult {
303
+ entities: { [key: string]: unknown };
304
+
305
+ status: 'success';
306
+ }
307
+
308
+ export interface ParsingErrorResult {
309
+ error: string;
310
+
311
+ status: 'error';
312
+ }
313
+
314
+ export interface Redirect {
315
+ status_code: number;
316
+
317
+ url: string;
318
+ }
319
+ }
320
+
321
+ export interface Metadata {
322
+ /**
323
+ * The name of the agent used for the query.
324
+ */
325
+ agent?: string;
326
+
327
+ /**
328
+ * The driver used for the task.
329
+ */
330
+ driver?: string;
331
+
332
+ /**
333
+ * The localization identifier for the query.
334
+ */
335
+ localization_id?: string;
336
+
337
+ /**
338
+ * The duration in milliseconds of the query processing.
339
+ */
340
+ query_duration?: number;
341
+
342
+ /**
343
+ * The time when the query was received.
344
+ */
345
+ query_time?: string;
346
+
347
+ /**
348
+ * Additional response parameters.
349
+ */
350
+ response_parameters?: unknown;
351
+
352
+ /**
353
+ * A tag associated with the query.
354
+ */
355
+ tag?: string;
356
+ }
357
+
358
+ export interface Debug {
359
+ /**
360
+ * Performance metrics collected during the task.
361
+ */
362
+ performance_metrics?: { [key: string]: number };
363
+
364
+ /**
365
+ * Total bytes used by the proxy during the task.
366
+ */
367
+ proxy_total_bytes_usage?: number;
368
+
369
+ /**
370
+ * The transformed output after applying any transformations.
371
+ */
372
+ transformed_output?: unknown;
373
+
374
+ /**
375
+ * The userbrowser instance using during the task.
376
+ */
377
+ userbrowser?: unknown;
378
+ }
379
+
380
+ export interface NextPageParams {
381
+ next_page_params: { [key: string]: unknown };
382
+ }
383
+
384
+ export interface UnionMember1 {
385
+ next_page_params: { [key: string]: unknown };
386
+ }
387
+ }
388
+
389
+ export interface FastSerpRunParams {
390
+ /**
391
+ * The search engine to query.
392
+ */
393
+ search_engine:
394
+ | 'google_search'
395
+ | 'google_sge'
396
+ | 'google_aio'
397
+ | 'google_maps_search'
398
+ | 'google_maps_reviews'
399
+ | 'google_maps_place'
400
+ | 'google_news'
401
+ | 'google_images'
402
+ | 'bing_search'
403
+ | 'yandex_search';
404
+
405
+ /**
406
+ * ISO Alpha-2 country code used to access the target search engine (e.g. US, DE,
407
+ * GB).
408
+ */
409
+ country?: string;
410
+
411
+ /**
412
+ * Device type used for the search request.
413
+ */
414
+ device?: 'desktop' | 'mobile';
415
+
416
+ /**
417
+ * Top-level domain for the search engine (e.g. "com", "co.uk", "de").
418
+ */
419
+ domain?: string;
420
+
421
+ /**
422
+ * Locale used for the search request.
423
+ */
424
+ locale?: string;
425
+
426
+ /**
427
+ * Geo-location for the search (canonical Google location name).
428
+ */
429
+ location?: string;
430
+
431
+ /**
432
+ * Number of results to return (1–100).
433
+ */
434
+ num_results?: number;
435
+
436
+ /**
437
+ * The result page number for pagination.
438
+ */
439
+ page?: number;
440
+
441
+ /**
442
+ * When true, the SERP response is parsed into structured JSON.
443
+ */
444
+ parse?: boolean;
445
+
446
+ /**
447
+ * The search keyword or phrase to query.
448
+ */
449
+ query?: string;
450
+
451
+ /**
452
+ * Whether to render the page in a browser before extracting.
453
+ */
454
+ render?: boolean;
455
+
456
+ /**
457
+ * When true, disables Google result filtering (filter=0) so omitted/duplicate and
458
+ * highly similar pages are also returned. Applies to Google search engines.
459
+ */
460
+ show_hidden_results?: boolean;
461
+ }
462
+
463
+ export declare namespace FastSerp {
464
+ export { type FastSerpRunResponse as FastSerpRunResponse, type FastSerpRunParams as FastSerpRunParams };
465
+ }
@@ -31,7 +31,7 @@ export {
31
31
  type DomainKnowledgeGetDriverResponse,
32
32
  type DomainKnowledgeGetDriverParams,
33
33
  } from './domain-knowledge';
34
- export { FastSerp } from './fast-serp';
34
+ export { FastSerp, type FastSerpRunResponse, type FastSerpRunParams } from './fast-serp';
35
35
  export {
36
36
  Jobs,
37
37
  type JobCreateResponse,
@@ -81,6 +81,9 @@ export interface JobCreateResponse {
81
81
  */
82
82
  created_at?: string | null;
83
83
 
84
+ /**
85
+ * Free-text description of the job.
86
+ */
84
87
  description?: string | null;
85
88
 
86
89
  /**
@@ -202,6 +205,9 @@ export interface JobUpdateResponse {
202
205
  */
203
206
  created_at?: string | null;
204
207
 
208
+ /**
209
+ * Free-text description of the job.
210
+ */
205
211
  description?: string | null;
206
212
 
207
213
  /**
@@ -349,6 +355,9 @@ export namespace JobListResponse {
349
355
  */
350
356
  created_at?: string | null;
351
357
 
358
+ /**
359
+ * Free-text description of the job.
360
+ */
352
361
  description?: string | null;
353
362
 
354
363
  /**
@@ -479,6 +488,9 @@ export interface JobGetResponse {
479
488
  */
480
489
  created_at?: string | null;
481
490
 
491
+ /**
492
+ * Free-text description of the job.
493
+ */
482
494
  description?: string | null;
483
495
 
484
496
  /**
@@ -637,6 +649,9 @@ export interface JobCreateParams {
637
649
  */
638
650
  name: string;
639
651
 
652
+ /**
653
+ * Free-text description of the job.
654
+ */
640
655
  description?: string | null;
641
656
 
642
657
  /**
@@ -720,6 +735,9 @@ export namespace JobCreateParams {
720
735
  }
721
736
 
722
737
  export interface JobUpdateParams {
738
+ /**
739
+ * New description.
740
+ */
723
741
  description?: string | null;
724
742
 
725
743
  /**
@@ -80,6 +80,9 @@ export namespace ArtifactListResponse {
80
80
  */
81
81
  created_at: string;
82
82
 
83
+ /**
84
+ * Human-readable artifact description.
85
+ */
83
86
  description: string;
84
87
 
85
88
  /**
@@ -123,6 +126,9 @@ export interface ArtifactGetResponse {
123
126
  */
124
127
  created_at: string;
125
128
 
129
+ /**
130
+ * Human-readable artifact description.
131
+ */
126
132
  description: string;
127
133
 
128
134
  /**
@@ -457,22 +457,22 @@ export namespace MediaRunAsyncResponse {
457
457
  /**
458
458
  * Batch ID if this task is part of a batch.
459
459
  */
460
- batch_id?: string;
460
+ batch_id?: string | null;
461
461
 
462
462
  /**
463
463
  * URL for downloading the task results.
464
464
  */
465
- download_url?: string;
465
+ download_url?: string | null;
466
466
 
467
467
  /**
468
468
  * Error message if the task failed.
469
469
  */
470
- error?: string;
470
+ error?: string | null;
471
471
 
472
472
  /**
473
473
  * Classification of the error type.
474
474
  */
475
- error_type?: string;
475
+ error_type?: string | null;
476
476
 
477
477
  /**
478
478
  * Timestamp when the task was last modified.
@@ -482,7 +482,7 @@ export namespace MediaRunAsyncResponse {
482
482
  /**
483
483
  * Storage location of the output data.
484
484
  */
485
- output_url?: string;
485
+ output_url?: string | null;
486
486
 
487
487
  /**
488
488
  * Queue name the task was submitted to.
@@ -471,22 +471,22 @@ export namespace SerpRunAsyncResponse {
471
471
  /**
472
472
  * Batch ID if this task is part of a batch.
473
473
  */
474
- batch_id?: string;
474
+ batch_id?: string | null;
475
475
 
476
476
  /**
477
477
  * URL for downloading the task results.
478
478
  */
479
- download_url?: string;
479
+ download_url?: string | null;
480
480
 
481
481
  /**
482
482
  * Error message if the task failed.
483
483
  */
484
- error?: string;
484
+ error?: string | null;
485
485
 
486
486
  /**
487
487
  * Classification of the error type.
488
488
  */
489
- error_type?: string;
489
+ error_type?: string | null;
490
490
 
491
491
  /**
492
492
  * Timestamp when the task was last modified.
@@ -496,7 +496,7 @@ export namespace SerpRunAsyncResponse {
496
496
  /**
497
497
  * Storage location of the output data.
498
498
  */
499
- output_url?: string;
499
+ output_url?: string | null;
500
500
 
501
501
  /**
502
502
  * Queue name the task was submitted to.
@@ -569,22 +569,22 @@ export namespace SerpRunBatchResponse {
569
569
  /**
570
570
  * Batch ID if this task is part of a batch.
571
571
  */
572
- batch_id?: string;
572
+ batch_id?: string | null;
573
573
 
574
574
  /**
575
575
  * URL for downloading the task results.
576
576
  */
577
- download_url?: string;
577
+ download_url?: string | null;
578
578
 
579
579
  /**
580
580
  * Error message if the task failed.
581
581
  */
582
- error?: string;
582
+ error?: string | null;
583
583
 
584
584
  /**
585
585
  * Classification of the error type.
586
586
  */
587
- error_type?: string;
587
+ error_type?: string | null;
588
588
 
589
589
  /**
590
590
  * Timestamp when the task was last modified.
@@ -594,7 +594,7 @@ export namespace SerpRunBatchResponse {
594
594
  /**
595
595
  * Storage location of the output data.
596
596
  */
597
- output_url?: string;
597
+ output_url?: string | null;
598
598
 
599
599
  /**
600
600
  * Queue name the task was submitted to.