@decodo/sdk-ts 2.6.1 → 3.0.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.
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Fields other than these are dropped before the upstream call.
3
+ */
1
4
  export interface RunSearchRequest {
2
5
  query: string;
3
6
  url?: string;
@@ -6,11 +9,20 @@ export interface RunSearchRequest {
6
9
  geo?: string;
7
10
  locale?: string;
8
11
  input_encoding?: string;
12
+ /**
13
+ * Not checked to be an integer; forwarded as given.
14
+ */
9
15
  page?: number;
10
16
  [k: string]: unknown;
11
17
  }
12
18
  export type RunSearchResponse = {
19
+ /**
20
+ * Set by the vendor, not by scraper-api. Failures arrive as ScrapeFailed or a 500 UpstreamError instead.
21
+ */
13
22
  status?: 'done';
23
+ /**
24
+ * Observed as an empty string.
25
+ */
14
26
  url?: string;
15
27
  organic?: {
16
28
  link?: string;
@@ -21,10 +33,16 @@ export type RunSearchResponse = {
21
33
  rank?: number;
22
34
  [k: string]: unknown;
23
35
  }[];
36
+ /**
37
+ * An array on the wire, empty when the query has no news; scraper-api's own type calls it an object.
38
+ */
24
39
  top_stories?: {
25
40
  title?: string;
26
41
  link?: string;
27
42
  site?: string;
43
+ /**
44
+ * Relative age as the search engine shows it, for example 3 hours ago.
45
+ */
28
46
  ago?: string;
29
47
  rank?: number;
30
48
  [k: string]: unknown;
@@ -39,6 +57,9 @@ export type RunSearchResponse = {
39
57
  link?: string;
40
58
  [k: string]: unknown;
41
59
  }[];
60
+ /**
61
+ * Observed empty; populated shape not seen.
62
+ */
42
63
  answer_box?: {
43
64
  [k: string]: unknown;
44
65
  };
@@ -58,7 +79,13 @@ export type RunSearchResponse = {
58
79
  [k: string]: unknown;
59
80
  };
60
81
  export interface MapSiteRequest {
82
+ /**
83
+ * Absolute http or https URL to map.
84
+ */
61
85
  url: string;
86
+ /**
87
+ * Maximum links to return. Zero, negative or above 147700 all become 147700; nothing is rejected.
88
+ */
62
89
  limit?: number;
63
90
  sitemap?: 'include' | 'only' | 'skip';
64
91
  domain_filter?: 'domain' | 'subdomain' | 'all';
@@ -66,27 +93,51 @@ export interface MapSiteRequest {
66
93
  locale?: string;
67
94
  JS_rendering?: boolean;
68
95
  follow_redirects?: boolean;
96
+ /**
97
+ * Either one pattern or a list of them. Each must compile as a Go regular expression.
98
+ */
69
99
  select_paths?: string | string[];
100
+ /**
101
+ * Either one pattern or a list of them. Each must compile as a Go regular expression.
102
+ */
70
103
  exclude_paths?: string | string[];
71
104
  [k: string]: unknown;
72
105
  }
73
106
  export interface MapSiteResponse {
107
+ /**
108
+ * Always exactly one element.
109
+ */
74
110
  results: {
75
111
  content: {
76
112
  links: {
77
113
  url: string;
78
114
  }[];
79
115
  };
116
+ /**
117
+ * Always 200. Not the status of the mapped site.
118
+ */
80
119
  status_code: number;
81
120
  url: string;
82
121
  sitemap_status: 'include' | 'only' | 'skip';
83
122
  map_id: string;
123
+ /**
124
+ * UTC timestamp formatted as "YYYY-MM-DD HH:MM:SS". Not RFC 3339.
125
+ */
84
126
  created_at: string;
127
+ /**
128
+ * UTC timestamp formatted as "YYYY-MM-DD HH:MM:SS". Not RFC 3339.
129
+ */
85
130
  updated_at: string;
86
131
  }[];
87
132
  }
88
133
  export interface ListCrawlsQuery {
134
+ /**
135
+ * Only crawls in this state. Not validated; an unknown value matches nothing.
136
+ */
89
137
  status?: 'pending' | 'done' | 'faulted' | 'cancelled' | 'truncated';
138
+ /**
139
+ * The cursor field from the previous page. Omit for the first page.
140
+ */
90
141
  cursor?: string;
91
142
  }
92
143
  export interface ListCrawlsResponse {
@@ -94,86 +145,191 @@ export interface ListCrawlsResponse {
94
145
  id: string;
95
146
  url: string;
96
147
  status: string;
148
+ /**
149
+ * The format the crawl's pages are saved in.
150
+ */
97
151
  output: 'markdown' | 'html';
98
152
  }[];
153
+ /**
154
+ * Present whenever the page was full. The next page may be empty.
155
+ */
99
156
  cursor?: string;
100
157
  }
101
158
  export interface StartCrawlRequest {
159
+ /**
160
+ * An http or https URL with a host. URLs carrying credentials (user:pass@) are refused.
161
+ */
102
162
  url: string;
103
163
  limit?: number;
104
164
  max_depth?: number;
105
165
  sitemap?: 'include' | 'only' | 'skip';
106
166
  domain_filter?: 'domain' | 'subdomain' | 'all';
107
167
  output?: 'markdown' | 'html';
168
+ /**
169
+ * Letters, spaces, dots, apostrophes and hyphens, 2 to 60 characters.
170
+ */
108
171
  geo?: string;
172
+ /**
173
+ * BCP 47 style, for example en or de-DE.
174
+ */
109
175
  locale?: string;
110
176
  follow_redirects?: boolean;
111
177
  JS_retry?: boolean;
178
+ /**
179
+ * Seconds. 0 means the server default. Rejected above the server's ceiling, 4 hours by default; the ceiling is configurable per environment.
180
+ */
112
181
  max_duration?: number;
182
+ /**
183
+ * http or https URL called when the crawl settles. Internal addresses are refused.
184
+ */
113
185
  callback_url?: string;
186
+ /**
187
+ * Opaque value echoed back on the callback, at most 8192 bytes. Redacted in logs.
188
+ */
114
189
  passthrough?: string;
190
+ /**
191
+ * Either one pattern or a list of them. Each must compile as a Go regular expression.
192
+ */
115
193
  select_paths?: string | string[];
194
+ /**
195
+ * Either one pattern or a list of them. Each must compile as a Go regular expression.
196
+ */
116
197
  exclude_paths?: string | string[];
117
198
  [k: string]: unknown;
118
199
  }
119
200
  export interface StartCrawlResponse {
120
201
  target: 'crawl';
121
202
  url: string;
203
+ /**
204
+ * UTC timestamp formatted as "YYYY-MM-DD HH:MM:SS". Not RFC 3339.
205
+ */
122
206
  created_at: string;
123
207
  crawl_id: string;
124
208
  status: 'pending' | 'done' | 'faulted' | 'cancelled' | 'truncated';
209
+ /**
210
+ * Absolute URL of this crawl's status endpoint.
211
+ */
125
212
  crawl_status: string;
213
+ /**
214
+ * Absolute URL of the per-page metadata listing.
215
+ */
126
216
  results_tasks: string;
217
+ /**
218
+ * Absolute URL of the same listing with page content included.
219
+ */
127
220
  results_content: string;
128
221
  }
129
222
  export interface ListCrawlPagesQuery {
223
+ /**
224
+ * Pass content to include each page's body. Any other value selects metadata mode.
225
+ */
130
226
  type?: string;
227
+ /**
228
+ * Page token. Take it from the next URL of the previous page rather than building it; the first page needs none.
229
+ */
131
230
  cursor?: string;
132
231
  }
133
232
  export interface ListCrawlPagesResponse {
134
233
  crawl_id: string;
234
+ /**
235
+ * The crawled pages. Named url, not results.
236
+ */
135
237
  url: {
136
238
  task_id?: string;
137
239
  status: 'pending' | 'done' | 'faulted';
240
+ /**
241
+ * UTC timestamp formatted as "YYYY-MM-DD HH:MM:SS". Not RFC 3339.
242
+ */
138
243
  created_at: string;
244
+ /**
245
+ * UTC timestamp formatted as "YYYY-MM-DD HH:MM:SS". Not RFC 3339.
246
+ */
139
247
  updated_at: string;
140
248
  url: string;
141
249
  depth: number;
142
250
  parent_url?: string;
143
251
  result_key?: string;
252
+ /**
253
+ * Present only when type=content was requested.
254
+ */
144
255
  content?: string;
256
+ /**
257
+ * Why this page has no content, when fetching it failed.
258
+ */
145
259
  content_error?: string;
260
+ /**
261
+ * Absolute URL of this crawl's status endpoint.
262
+ */
146
263
  crawl_status: string;
264
+ /**
265
+ * Absolute URL of the per-page metadata listing.
266
+ */
147
267
  results_tasks: string;
268
+ /**
269
+ * Absolute URL of the same listing with page content included.
270
+ */
148
271
  results_content: string;
149
272
  }[];
273
+ /**
274
+ * Absolute URL of the next page. Absent on the last page.
275
+ */
150
276
  next?: string;
277
+ /**
278
+ * Present only on the first page in content mode.
279
+ */
151
280
  total?: number;
152
281
  }
153
282
  export interface GetCrawlStatusResponse {
154
283
  target: 'crawl';
155
284
  url: string;
285
+ /**
286
+ * UTC timestamp formatted as "YYYY-MM-DD HH:MM:SS". Not RFC 3339.
287
+ */
156
288
  created_at: string;
157
289
  crawl_id: string;
158
290
  status: 'pending' | 'done' | 'faulted' | 'cancelled' | 'truncated';
291
+ /**
292
+ * Why the crawl stopped early. On truncated, max_duration is the deadline and vendor_limit means the vendor kept refusing the account's submissions, quota or request rate. On faulted, no_pages_found means the crawl found nothing to crawl, for example sitemap only on a site without a sitemap.
293
+ */
159
294
  reason?: 'max_duration' | 'vendor_limit' | 'no_pages_found';
160
295
  sitemap_status: 'include' | 'only' | 'skip';
296
+ /**
297
+ * The format the crawl's pages are saved in.
298
+ */
161
299
  output: 'markdown' | 'html';
162
300
  discovered: number;
163
301
  completed: number;
164
302
  failed: number;
165
303
  in_flight: number;
304
+ /**
305
+ * Sitemap files fetched for this crawl, sitemap indexes included. 0 when sitemap is skip.
306
+ */
166
307
  sitemaps: number;
308
+ /**
309
+ * Scrape requests the vendor accepted for this crawl, the billed work. Counts pages, JavaScript retries and sitemap fetches; not results reads.
310
+ */
167
311
  requests: number;
168
312
  }
169
313
  export interface CancelCrawlResponse {
170
314
  target: 'crawl';
171
315
  url: string;
316
+ /**
317
+ * UTC timestamp formatted as "YYYY-MM-DD HH:MM:SS". Not RFC 3339.
318
+ */
172
319
  created_at: string;
173
320
  crawl_id: string;
174
321
  status: 'pending' | 'done' | 'faulted' | 'cancelled' | 'truncated';
322
+ /**
323
+ * Absolute URL of this crawl's status endpoint.
324
+ */
175
325
  crawl_status: string;
326
+ /**
327
+ * Absolute URL of the per-page metadata listing.
328
+ */
176
329
  results_tasks: string;
330
+ /**
331
+ * Absolute URL of the same listing with page content included.
332
+ */
177
333
  results_content: string;
178
334
  }
179
335
  export declare const dataApiEndpoints: {
@@ -1,7 +1,6 @@
1
1
  // Auto-generated by src/codegen/web-scraping-api/generate-parameters.ts — do not edit
2
2
  export const parameterMeta = {
3
3
  "360": { type: "boolean" },
4
- callback_url: { type: "string" },
5
4
  query: { type: "string", maxLength: 2048 },
6
5
  headless: { type: "string", enum: ["html", "png"] },
7
6
  locale: { type: "string" },
@@ -18,24 +17,18 @@ export const parameterMeta = {
18
17
  xhr: { type: "boolean" },
19
18
  markdown: { type: "boolean" },
20
19
  page_count: { type: "number", minimum: 1, maximum: 10 },
20
+ callback_url: { type: "string" },
21
21
  date_range: { type: "string" },
22
22
  stars: { type: "number" },
23
23
  adults: { type: "number", minimum: 1, maximum: 3 },
24
24
  children: { type: "number", minimum: 1, maximum: 3 },
25
- search_type: { type: "string" },
26
- date_start: { type: "string" },
27
- date_end: { type: "string" },
28
25
  url: { type: "string", maxLength: 2056 },
29
- hotel_occupancy: { type: "string" },
30
26
  domain: { type: "string" },
31
- language_code: { type: "string" },
32
- transcript_origin: { type: "string" },
33
27
  autoselect_variant: { type: "boolean" },
34
28
  currency: { type: "string" },
35
29
  category: { type: "string" },
36
30
  merchant: { type: "string" },
37
31
  sort_by: { type: "string" },
38
- parser_type: { type: "string" },
39
32
  product_id: { type: "string" },
40
33
  fulfillment_type: { type: "string" },
41
34
  walmart_store_id: { type: "string" },
@@ -43,11 +36,6 @@ export const parameterMeta = {
43
36
  store_id: { type: "string" },
44
37
  delivery_type: { type: "string" },
45
38
  target_store_id: { type: "string" },
46
- lowes_store_id: { type: "string" },
47
- user_agent_type: { type: "string" },
48
- free_delivery: { type: "boolean" },
49
- pickup_today: { type: "boolean" },
50
- delivery_today_tomorrow: { type: "boolean" },
51
39
  payload: { type: "string" },
52
40
  proxy_pool: { type: "string", enum: ["standard", "premium"] },
53
41
  http_method: { type: "string" },
@@ -59,6 +47,7 @@ export const parameterMeta = {
59
47
  prompt: { type: "string", maxLength: 8192 },
60
48
  search: { type: "boolean" },
61
49
  country: { type: "string" },
50
+ user_agent_type: { type: "string" },
62
51
  sort: { type: "string" },
63
52
  upload_date: { type: "string" },
64
53
  type: { type: "string" },
@@ -74,6 +63,7 @@ export const parameterMeta = {
74
63
  location: { type: "boolean" },
75
64
  purchased: { type: "boolean" },
76
65
  subtitles: { type: "boolean" },
66
+ language_code: { type: "string" },
77
67
  subtitle_origin: { type: "string" },
78
68
  limit: { type: "number", minimum: 0, maximum: 100 },
79
69
  };