@decodo/sdk-ts 3.0.0 → 3.1.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.
@@ -40,7 +40,9 @@ __export(index_exports, {
40
40
  TimeoutError: () => TimeoutError,
41
41
  ValidationError: () => ValidationError,
42
42
  WebScrapingApi: () => WebScrapingApi,
43
+ dataApiRequestSchemas: () => dataApiRequestSchemas,
43
44
  parameterMeta: () => parameterMeta,
45
+ requestSchemas: () => requestSchemas,
44
46
  targetMeta: () => targetMeta,
45
47
  targets: () => targets
46
48
  });
@@ -2205,6 +2207,7 @@ var BundledSchema = class _BundledSchema {
2205
2207
  };
2206
2208
 
2207
2209
  // src/generated/data-api.ts
2210
+ var z2 = __toESM(require("zod"), 1);
2208
2211
  var dataApiEndpoints = {
2209
2212
  runSearch: { method: "POST", path: "/v1/search" },
2210
2213
  mapSite: { method: "POST", path: "/v1/map" },
@@ -2214,6 +2217,237 @@ var dataApiEndpoints = {
2214
2217
  getCrawlStatus: { method: "GET", path: "/v1/crawl/{id}/status" },
2215
2218
  cancelCrawl: { method: "POST", path: "/v1/crawl/{id}/cancel" }
2216
2219
  };
2220
+ var dataApiRequestJsonSchemas = {
2221
+ runSearch: {
2222
+ "type": "object",
2223
+ "required": [
2224
+ "query"
2225
+ ],
2226
+ "description": "Fields other than these are dropped before the upstream call.",
2227
+ "properties": {
2228
+ "query": {
2229
+ "type": "string",
2230
+ "minLength": 1
2231
+ },
2232
+ "url": {
2233
+ "type": "string",
2234
+ "minLength": 1
2235
+ },
2236
+ "uule": {
2237
+ "type": "string"
2238
+ },
2239
+ "gl": {
2240
+ "type": "string"
2241
+ },
2242
+ "geo": {
2243
+ "type": "string"
2244
+ },
2245
+ "locale": {
2246
+ "type": "string"
2247
+ },
2248
+ "input_encoding": {
2249
+ "type": "string"
2250
+ },
2251
+ "page": {
2252
+ "type": "number",
2253
+ "minimum": 1,
2254
+ "description": "Not checked to be an integer; forwarded as given."
2255
+ }
2256
+ }
2257
+ },
2258
+ mapSite: {
2259
+ "type": "object",
2260
+ "required": [
2261
+ "url"
2262
+ ],
2263
+ "properties": {
2264
+ "url": {
2265
+ "type": "string",
2266
+ "description": "Absolute http or https URL to map."
2267
+ },
2268
+ "limit": {
2269
+ "type": "integer",
2270
+ "description": "Maximum links to return. Zero, negative or above 147700 all become 147700; nothing is rejected.",
2271
+ "default": 147700
2272
+ },
2273
+ "sitemap": {
2274
+ "type": "string",
2275
+ "enum": [
2276
+ "include",
2277
+ "only",
2278
+ "skip"
2279
+ ],
2280
+ "default": "include"
2281
+ },
2282
+ "domain_filter": {
2283
+ "type": "string",
2284
+ "enum": [
2285
+ "domain",
2286
+ "subdomain",
2287
+ "all"
2288
+ ],
2289
+ "default": "domain"
2290
+ },
2291
+ "geo": {
2292
+ "type": "string"
2293
+ },
2294
+ "locale": {
2295
+ "type": "string"
2296
+ },
2297
+ "JS_rendering": {
2298
+ "type": "boolean",
2299
+ "default": false
2300
+ },
2301
+ "follow_redirects": {
2302
+ "type": "boolean",
2303
+ "default": true
2304
+ },
2305
+ "select_paths": {
2306
+ "description": "Either one pattern or a list of them. Each must compile as a Go regular expression.",
2307
+ "oneOf": [
2308
+ {
2309
+ "type": "string"
2310
+ },
2311
+ {
2312
+ "type": "array",
2313
+ "items": {
2314
+ "type": "string"
2315
+ }
2316
+ }
2317
+ ]
2318
+ },
2319
+ "exclude_paths": {
2320
+ "description": "Either one pattern or a list of them. Each must compile as a Go regular expression.",
2321
+ "oneOf": [
2322
+ {
2323
+ "type": "string"
2324
+ },
2325
+ {
2326
+ "type": "array",
2327
+ "items": {
2328
+ "type": "string"
2329
+ }
2330
+ }
2331
+ ]
2332
+ }
2333
+ }
2334
+ },
2335
+ startCrawl: {
2336
+ "type": "object",
2337
+ "required": [
2338
+ "url"
2339
+ ],
2340
+ "properties": {
2341
+ "url": {
2342
+ "type": "string",
2343
+ "description": "An http or https URL with a host. URLs carrying credentials (user:pass@) are refused."
2344
+ },
2345
+ "limit": {
2346
+ "type": "integer",
2347
+ "minimum": 1,
2348
+ "maximum": 1e4,
2349
+ "default": 10
2350
+ },
2351
+ "max_depth": {
2352
+ "type": "integer",
2353
+ "minimum": 1,
2354
+ "maximum": 1e4,
2355
+ "default": 5
2356
+ },
2357
+ "sitemap": {
2358
+ "type": "string",
2359
+ "enum": [
2360
+ "include",
2361
+ "only",
2362
+ "skip"
2363
+ ],
2364
+ "default": "include"
2365
+ },
2366
+ "domain_filter": {
2367
+ "type": "string",
2368
+ "enum": [
2369
+ "domain",
2370
+ "subdomain",
2371
+ "all"
2372
+ ],
2373
+ "default": "domain"
2374
+ },
2375
+ "output": {
2376
+ "type": "string",
2377
+ "enum": [
2378
+ "markdown",
2379
+ "html"
2380
+ ],
2381
+ "default": "markdown"
2382
+ },
2383
+ "geo": {
2384
+ "type": "string",
2385
+ "pattern": "^[A-Za-z][A-Za-z .'-]{0,58}[A-Za-z]$",
2386
+ "description": "Letters, spaces, dots, apostrophes and hyphens, 2 to 60 characters."
2387
+ },
2388
+ "locale": {
2389
+ "type": "string",
2390
+ "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$",
2391
+ "description": "BCP 47 style, for example en or de-DE."
2392
+ },
2393
+ "follow_redirects": {
2394
+ "type": "boolean"
2395
+ },
2396
+ "JS_retry": {
2397
+ "type": "boolean"
2398
+ },
2399
+ "max_duration": {
2400
+ "type": "integer",
2401
+ "minimum": 0,
2402
+ "maximum": 14400,
2403
+ "description": "Seconds. 0 means the server default. Rejected above the server's ceiling, 4 hours by default; the ceiling is configurable per environment.",
2404
+ "default": 3600
2405
+ },
2406
+ "callback_url": {
2407
+ "type": "string",
2408
+ "description": "http or https URL called when the crawl settles. Internal addresses are refused."
2409
+ },
2410
+ "passthrough": {
2411
+ "type": "string",
2412
+ "maxLength": 8192,
2413
+ "description": "Opaque value echoed back on the callback, at most 8192 bytes. Redacted in logs."
2414
+ },
2415
+ "select_paths": {
2416
+ "description": "Either one pattern or a list of them. Each must compile as a Go regular expression.",
2417
+ "oneOf": [
2418
+ {
2419
+ "type": "string"
2420
+ },
2421
+ {
2422
+ "type": "array",
2423
+ "items": {
2424
+ "type": "string"
2425
+ }
2426
+ }
2427
+ ]
2428
+ },
2429
+ "exclude_paths": {
2430
+ "description": "Either one pattern or a list of them. Each must compile as a Go regular expression.",
2431
+ "oneOf": [
2432
+ {
2433
+ "type": "string"
2434
+ },
2435
+ {
2436
+ "type": "array",
2437
+ "items": {
2438
+ "type": "string"
2439
+ }
2440
+ }
2441
+ ]
2442
+ }
2443
+ }
2444
+ }
2445
+ };
2446
+ var dataApiRequestSchemas = {
2447
+ runSearch: z2.fromJSONSchema(dataApiRequestJsonSchemas.runSearch),
2448
+ mapSite: z2.fromJSONSchema(dataApiRequestJsonSchemas.mapSite),
2449
+ startCrawl: z2.fromJSONSchema(dataApiRequestJsonSchemas.startCrawl)
2450
+ };
2217
2451
 
2218
2452
  // src/api/web-scraping-api.ts
2219
2453
  var SCRAPER_API_ROUTES = {
@@ -2451,7 +2685,7 @@ var DecodoClient = class {
2451
2685
  // src/schema/remote-schema.ts
2452
2686
  var import_node_fs = require("node:fs");
2453
2687
  var import_node_path2 = require("node:path");
2454
- var z2 = __toESM(require("zod"), 1);
2688
+ var z3 = __toESM(require("zod"), 1);
2455
2689
 
2456
2690
  // src/schema/build-target-meta.ts
2457
2691
  var getTargetParameterKeys = (parameterSchema) => {
@@ -2609,7 +2843,7 @@ var buildRequestSchemas = (ir) => {
2609
2843
  )) {
2610
2844
  schemas.set(
2611
2845
  targetKey,
2612
- z2.fromJSONSchema(
2846
+ z3.fromJSONSchema(
2613
2847
  target.parameter_schema
2614
2848
  )
2615
2849
  );
@@ -2743,7 +2977,9 @@ var parameterMeta = {
2743
2977
  TimeoutError,
2744
2978
  ValidationError,
2745
2979
  WebScrapingApi,
2980
+ dataApiRequestSchemas,
2746
2981
  parameterMeta,
2982
+ requestSchemas,
2747
2983
  targetMeta,
2748
2984
  targets
2749
2985
  });
@@ -951,6 +951,11 @@ declare const dataApiEndpoints: {
951
951
  readonly path: "/v1/crawl/{id}/cancel";
952
952
  };
953
953
  };
954
+ export declare const dataApiRequestSchemas: {
955
+ runSearch: z.ZodObject;
956
+ mapSite: z.ZodObject;
957
+ startCrawl: z.ZodObject;
958
+ };
954
959
  export type CrawlOptions = {
955
960
  pollInterval?: number;
956
961
  timeout?: number;
@@ -1077,7 +1082,7 @@ export declare class DecodoClient {
1077
1082
  }
1078
1083
  export declare class BundledSchema implements DecodoSchema {
1079
1084
  static readonly shared: BundledSchema;
1080
- getRequestSchema(target: string): import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
1085
+ getRequestSchema(target: string): import("zod").ZodObject<import("zod/v4/core").$ZodLooseShape, import("zod/v4/core").$strip>;
1081
1086
  listTargets(): string[];
1082
1087
  getTargetMeta(target: string): TargetMeta;
1083
1088
  getTargetParameterSchema(target: string): JSONSchema4 | undefined;
@@ -1098,6 +1103,7 @@ export declare class RemoteSchema implements DecodoSchema {
1098
1103
  getTargetParameterSchema(target: string): JSONSchema4 | undefined;
1099
1104
  getSharedParameters(): Record<string, unknown>;
1100
1105
  }
1106
+ export declare const requestSchemas: Record<Target, z.ZodObject>;
1101
1107
  export type ParameterMeta = {
1102
1108
  type: string;
1103
1109
  maxLength?: number;
@@ -1,3 +1,4 @@
1
+ import * as z from 'zod';
1
2
  /**
2
3
  * Fields other than these are dropped before the upstream call.
3
4
  */
@@ -363,3 +364,8 @@ export declare const dataApiEndpoints: {
363
364
  };
364
365
  };
365
366
  export type DataApiEndpoint = keyof typeof dataApiEndpoints;
367
+ export declare const dataApiRequestSchemas: {
368
+ runSearch: z.ZodObject;
369
+ mapSite: z.ZodObject;
370
+ startCrawl: z.ZodObject;
371
+ };
@@ -1,4 +1,5 @@
1
1
  // Auto-generated by src/codegen/data-api/generate-data-api.ts — do not edit
2
+ import * as z from 'zod';
2
3
  export const dataApiEndpoints = {
3
4
  runSearch: { method: "POST", path: "/v1/search" },
4
5
  mapSite: { method: "POST", path: "/v1/map" },
@@ -8,3 +9,234 @@ export const dataApiEndpoints = {
8
9
  getCrawlStatus: { method: "GET", path: "/v1/crawl/{id}/status" },
9
10
  cancelCrawl: { method: "POST", path: "/v1/crawl/{id}/cancel" },
10
11
  };
12
+ const dataApiRequestJsonSchemas = {
13
+ runSearch: {
14
+ "type": "object",
15
+ "required": [
16
+ "query"
17
+ ],
18
+ "description": "Fields other than these are dropped before the upstream call.",
19
+ "properties": {
20
+ "query": {
21
+ "type": "string",
22
+ "minLength": 1
23
+ },
24
+ "url": {
25
+ "type": "string",
26
+ "minLength": 1
27
+ },
28
+ "uule": {
29
+ "type": "string"
30
+ },
31
+ "gl": {
32
+ "type": "string"
33
+ },
34
+ "geo": {
35
+ "type": "string"
36
+ },
37
+ "locale": {
38
+ "type": "string"
39
+ },
40
+ "input_encoding": {
41
+ "type": "string"
42
+ },
43
+ "page": {
44
+ "type": "number",
45
+ "minimum": 1,
46
+ "description": "Not checked to be an integer; forwarded as given."
47
+ }
48
+ }
49
+ },
50
+ mapSite: {
51
+ "type": "object",
52
+ "required": [
53
+ "url"
54
+ ],
55
+ "properties": {
56
+ "url": {
57
+ "type": "string",
58
+ "description": "Absolute http or https URL to map."
59
+ },
60
+ "limit": {
61
+ "type": "integer",
62
+ "description": "Maximum links to return. Zero, negative or above 147700 all become 147700; nothing is rejected.",
63
+ "default": 147700
64
+ },
65
+ "sitemap": {
66
+ "type": "string",
67
+ "enum": [
68
+ "include",
69
+ "only",
70
+ "skip"
71
+ ],
72
+ "default": "include"
73
+ },
74
+ "domain_filter": {
75
+ "type": "string",
76
+ "enum": [
77
+ "domain",
78
+ "subdomain",
79
+ "all"
80
+ ],
81
+ "default": "domain"
82
+ },
83
+ "geo": {
84
+ "type": "string"
85
+ },
86
+ "locale": {
87
+ "type": "string"
88
+ },
89
+ "JS_rendering": {
90
+ "type": "boolean",
91
+ "default": false
92
+ },
93
+ "follow_redirects": {
94
+ "type": "boolean",
95
+ "default": true
96
+ },
97
+ "select_paths": {
98
+ "description": "Either one pattern or a list of them. Each must compile as a Go regular expression.",
99
+ "oneOf": [
100
+ {
101
+ "type": "string"
102
+ },
103
+ {
104
+ "type": "array",
105
+ "items": {
106
+ "type": "string"
107
+ }
108
+ }
109
+ ]
110
+ },
111
+ "exclude_paths": {
112
+ "description": "Either one pattern or a list of them. Each must compile as a Go regular expression.",
113
+ "oneOf": [
114
+ {
115
+ "type": "string"
116
+ },
117
+ {
118
+ "type": "array",
119
+ "items": {
120
+ "type": "string"
121
+ }
122
+ }
123
+ ]
124
+ }
125
+ }
126
+ },
127
+ startCrawl: {
128
+ "type": "object",
129
+ "required": [
130
+ "url"
131
+ ],
132
+ "properties": {
133
+ "url": {
134
+ "type": "string",
135
+ "description": "An http or https URL with a host. URLs carrying credentials (user:pass@) are refused."
136
+ },
137
+ "limit": {
138
+ "type": "integer",
139
+ "minimum": 1,
140
+ "maximum": 10000,
141
+ "default": 10
142
+ },
143
+ "max_depth": {
144
+ "type": "integer",
145
+ "minimum": 1,
146
+ "maximum": 10000,
147
+ "default": 5
148
+ },
149
+ "sitemap": {
150
+ "type": "string",
151
+ "enum": [
152
+ "include",
153
+ "only",
154
+ "skip"
155
+ ],
156
+ "default": "include"
157
+ },
158
+ "domain_filter": {
159
+ "type": "string",
160
+ "enum": [
161
+ "domain",
162
+ "subdomain",
163
+ "all"
164
+ ],
165
+ "default": "domain"
166
+ },
167
+ "output": {
168
+ "type": "string",
169
+ "enum": [
170
+ "markdown",
171
+ "html"
172
+ ],
173
+ "default": "markdown"
174
+ },
175
+ "geo": {
176
+ "type": "string",
177
+ "pattern": "^[A-Za-z][A-Za-z .'-]{0,58}[A-Za-z]$",
178
+ "description": "Letters, spaces, dots, apostrophes and hyphens, 2 to 60 characters."
179
+ },
180
+ "locale": {
181
+ "type": "string",
182
+ "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$",
183
+ "description": "BCP 47 style, for example en or de-DE."
184
+ },
185
+ "follow_redirects": {
186
+ "type": "boolean"
187
+ },
188
+ "JS_retry": {
189
+ "type": "boolean"
190
+ },
191
+ "max_duration": {
192
+ "type": "integer",
193
+ "minimum": 0,
194
+ "maximum": 14400,
195
+ "description": "Seconds. 0 means the server default. Rejected above the server's ceiling, 4 hours by default; the ceiling is configurable per environment.",
196
+ "default": 3600
197
+ },
198
+ "callback_url": {
199
+ "type": "string",
200
+ "description": "http or https URL called when the crawl settles. Internal addresses are refused."
201
+ },
202
+ "passthrough": {
203
+ "type": "string",
204
+ "maxLength": 8192,
205
+ "description": "Opaque value echoed back on the callback, at most 8192 bytes. Redacted in logs."
206
+ },
207
+ "select_paths": {
208
+ "description": "Either one pattern or a list of them. Each must compile as a Go regular expression.",
209
+ "oneOf": [
210
+ {
211
+ "type": "string"
212
+ },
213
+ {
214
+ "type": "array",
215
+ "items": {
216
+ "type": "string"
217
+ }
218
+ }
219
+ ]
220
+ },
221
+ "exclude_paths": {
222
+ "description": "Either one pattern or a list of them. Each must compile as a Go regular expression.",
223
+ "oneOf": [
224
+ {
225
+ "type": "string"
226
+ },
227
+ {
228
+ "type": "array",
229
+ "items": {
230
+ "type": "string"
231
+ }
232
+ }
233
+ ]
234
+ }
235
+ }
236
+ },
237
+ };
238
+ export const dataApiRequestSchemas = {
239
+ runSearch: z.fromJSONSchema(dataApiRequestJsonSchemas.runSearch),
240
+ mapSite: z.fromJSONSchema(dataApiRequestJsonSchemas.mapSite),
241
+ startCrawl: z.fromJSONSchema(dataApiRequestJsonSchemas.startCrawl),
242
+ };
@@ -1547,4 +1547,4 @@ export declare const requestJsonSchemas: {
1547
1547
  readonly additionalProperties: false;
1548
1548
  };
1549
1549
  };
1550
- export declare const requestSchemas: Record<Target, z.ZodType>;
1550
+ export declare const requestSchemas: Record<Target, z.ZodObject>;
@@ -7,6 +7,8 @@ export { RemoteSchema } from './schema/remote-schema.js';
7
7
  export type { DecodoSchema, RemoteSchemaLoadOptions } from './schema/types.js';
8
8
  export type { TargetString, TargetParamsMap, TargetMeta, ScrapeRequest, BatchRequest, } from './generated/targets.js';
9
9
  export { targets, targetMeta, Target, } from './generated/targets.js';
10
+ export { requestSchemas } from './generated/request-schemas.js';
11
+ export { dataApiRequestSchemas } from './generated/data-api.js';
10
12
  export { parameterMeta } from './generated/parameters.js';
11
13
  export type { ParameterMeta } from './generated/parameters.js';
12
14
  export type { SyncResponse, AsyncTaskResponse, BatchResponse, TaskMetadata, TaskResultsResponse, TaskStatus, ResultEntry, CrawlPage, CrawlPageList, CrawlResult, } from './types/responses.js';
@@ -3,5 +3,7 @@ export { WebScrapingApi } from './api/web-scraping-api.js';
3
3
  export { BundledSchema } from './schema/bundled-schema.js';
4
4
  export { RemoteSchema } from './schema/remote-schema.js';
5
5
  export { targets, targetMeta, Target, } from './generated/targets.js';
6
+ export { requestSchemas } from './generated/request-schemas.js';
7
+ export { dataApiRequestSchemas } from './generated/data-api.js';
6
8
  export { parameterMeta } from './generated/parameters.js';
7
9
  export { DecodoError, AuthenticationError, RateLimitError, ValidationError, TimeoutError, } from './errors.js';
@@ -2,7 +2,7 @@ import type { JSONSchema4 } from 'json-schema';
2
2
  import type { DecodoSchema } from './types.js';
3
3
  export declare class BundledSchema implements DecodoSchema {
4
4
  static readonly shared: BundledSchema;
5
- getRequestSchema(target: string): import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
5
+ getRequestSchema(target: string): import("zod").ZodObject<import("zod/v4/core").$ZodLooseShape, import("zod/v4/core").$strip>;
6
6
  listTargets(): string[];
7
7
  getTargetMeta(target: string): import("../index.js").TargetMeta;
8
8
  getTargetParameterSchema(target: string): JSONSchema4 | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decodo/sdk-ts",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Official TypeScript SDK for the Decodo APIs",
5
5
  "license": "MIT",
6
6
  "repository": {