@apify/input_schema 3.5.10 → 3.5.12
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.
- package/{index.js → cjs/index.cjs} +1 -1
- package/cjs/index.cjs.map +1 -0
- package/cjs/index.d.ts +711 -0
- package/esm/index.d.mts +711 -0
- package/esm/index.mjs.map +1 -0
- package/package.json +16 -11
- package/index.d.ts +0 -3
- package/index.js.map +0 -1
- package/index.mjs.map +0 -1
- package/input_schema.d.ts +0 -29
- package/intl.d.ts +0 -4
- package/schema.json +0 -284
- package/utilities.d.ts +0 -22
- /package/{index.mjs → esm/index.mjs} +0 -0
package/cjs/index.d.ts
ADDED
|
@@ -0,0 +1,711 @@
|
|
|
1
|
+
import Ajv, { ErrorObject, ValidateFunction } from 'ajv';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to simulate intl formatMessage function
|
|
5
|
+
*/
|
|
6
|
+
declare function m(stringId: string, variables?: Record<string, any>): any;
|
|
7
|
+
|
|
8
|
+
var title = "JSON schema of Apify Actor INPUT_SCHEMA.json";
|
|
9
|
+
var type = "object";
|
|
10
|
+
var properties = {
|
|
11
|
+
$schema: {
|
|
12
|
+
type: "string"
|
|
13
|
+
},
|
|
14
|
+
title: {
|
|
15
|
+
type: "string"
|
|
16
|
+
},
|
|
17
|
+
schemaVersion: {
|
|
18
|
+
type: "integer",
|
|
19
|
+
minimum: 1,
|
|
20
|
+
maximum: 1
|
|
21
|
+
},
|
|
22
|
+
description: {
|
|
23
|
+
type: "string"
|
|
24
|
+
},
|
|
25
|
+
type: {
|
|
26
|
+
"enum": [
|
|
27
|
+
"object"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
required: {
|
|
31
|
+
type: "array",
|
|
32
|
+
minItems: 0,
|
|
33
|
+
items: {
|
|
34
|
+
type: "string"
|
|
35
|
+
},
|
|
36
|
+
uniqueItems: true
|
|
37
|
+
},
|
|
38
|
+
additionalProperties: {
|
|
39
|
+
type: "boolean"
|
|
40
|
+
},
|
|
41
|
+
properties: {
|
|
42
|
+
type: "object",
|
|
43
|
+
patternProperties: {
|
|
44
|
+
"^": {
|
|
45
|
+
oneOf: [
|
|
46
|
+
{
|
|
47
|
+
$ref: "#/definitions/stringProperty"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
$ref: "#/definitions/stringEnumProperty"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
$ref: "#/definitions/arrayProperty"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
$ref: "#/definitions/objectProperty"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
$ref: "#/definitions/integerProperty"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
$ref: "#/definitions/booleanProperty"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
$ref: "#/definitions/anyProperty"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
var additionalProperties = false;
|
|
73
|
+
var required = [
|
|
74
|
+
"title",
|
|
75
|
+
"type",
|
|
76
|
+
"properties",
|
|
77
|
+
"schemaVersion"
|
|
78
|
+
];
|
|
79
|
+
var definitions = {
|
|
80
|
+
stringEnumProperty: {
|
|
81
|
+
title: "Enum property",
|
|
82
|
+
type: "object",
|
|
83
|
+
additionalProperties: false,
|
|
84
|
+
properties: {
|
|
85
|
+
type: {
|
|
86
|
+
"enum": [
|
|
87
|
+
"string"
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
editor: {
|
|
91
|
+
"enum": [
|
|
92
|
+
"select"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
title: {
|
|
96
|
+
type: "string"
|
|
97
|
+
},
|
|
98
|
+
description: {
|
|
99
|
+
type: "string"
|
|
100
|
+
},
|
|
101
|
+
"default": {
|
|
102
|
+
type: "string"
|
|
103
|
+
},
|
|
104
|
+
prefill: {
|
|
105
|
+
type: "string"
|
|
106
|
+
},
|
|
107
|
+
example: {
|
|
108
|
+
type: "string"
|
|
109
|
+
},
|
|
110
|
+
nullable: {
|
|
111
|
+
type: "boolean"
|
|
112
|
+
},
|
|
113
|
+
sectionCaption: {
|
|
114
|
+
type: "string"
|
|
115
|
+
},
|
|
116
|
+
sectionDescription: {
|
|
117
|
+
type: "string"
|
|
118
|
+
},
|
|
119
|
+
"enum": {
|
|
120
|
+
type: "array",
|
|
121
|
+
items: {
|
|
122
|
+
type: "string"
|
|
123
|
+
},
|
|
124
|
+
minItems: 1,
|
|
125
|
+
uniqueItems: true
|
|
126
|
+
},
|
|
127
|
+
enumTitles: {
|
|
128
|
+
type: "array",
|
|
129
|
+
items: {
|
|
130
|
+
type: "string"
|
|
131
|
+
},
|
|
132
|
+
minItems: 1
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
required: [
|
|
136
|
+
"type",
|
|
137
|
+
"title",
|
|
138
|
+
"description",
|
|
139
|
+
"enum"
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
stringProperty: {
|
|
143
|
+
title: "String property",
|
|
144
|
+
type: "object",
|
|
145
|
+
additionalProperties: true,
|
|
146
|
+
properties: {
|
|
147
|
+
type: {
|
|
148
|
+
"enum": [
|
|
149
|
+
"string"
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
title: {
|
|
153
|
+
type: "string"
|
|
154
|
+
},
|
|
155
|
+
description: {
|
|
156
|
+
type: "string"
|
|
157
|
+
},
|
|
158
|
+
nullable: {
|
|
159
|
+
type: "boolean"
|
|
160
|
+
},
|
|
161
|
+
editor: {
|
|
162
|
+
"enum": [
|
|
163
|
+
"javascript",
|
|
164
|
+
"python",
|
|
165
|
+
"textfield",
|
|
166
|
+
"textarea",
|
|
167
|
+
"datepicker",
|
|
168
|
+
"hidden"
|
|
169
|
+
]
|
|
170
|
+
},
|
|
171
|
+
isSecret: {
|
|
172
|
+
type: "boolean"
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
required: [
|
|
176
|
+
"type",
|
|
177
|
+
"title",
|
|
178
|
+
"description",
|
|
179
|
+
"editor"
|
|
180
|
+
],
|
|
181
|
+
"if": {
|
|
182
|
+
properties: {
|
|
183
|
+
isSecret: {
|
|
184
|
+
not: {
|
|
185
|
+
"const": true
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
then: {
|
|
191
|
+
additionalProperties: false,
|
|
192
|
+
properties: {
|
|
193
|
+
type: {
|
|
194
|
+
"enum": [
|
|
195
|
+
"string"
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
title: {
|
|
199
|
+
type: "string"
|
|
200
|
+
},
|
|
201
|
+
description: {
|
|
202
|
+
type: "string"
|
|
203
|
+
},
|
|
204
|
+
"default": {
|
|
205
|
+
type: "string"
|
|
206
|
+
},
|
|
207
|
+
prefill: {
|
|
208
|
+
type: "string"
|
|
209
|
+
},
|
|
210
|
+
example: {
|
|
211
|
+
type: "string"
|
|
212
|
+
},
|
|
213
|
+
pattern: {
|
|
214
|
+
type: "string"
|
|
215
|
+
},
|
|
216
|
+
nullable: {
|
|
217
|
+
type: "boolean"
|
|
218
|
+
},
|
|
219
|
+
minLength: {
|
|
220
|
+
type: "integer"
|
|
221
|
+
},
|
|
222
|
+
maxLength: {
|
|
223
|
+
type: "integer"
|
|
224
|
+
},
|
|
225
|
+
editor: {
|
|
226
|
+
"enum": [
|
|
227
|
+
"javascript",
|
|
228
|
+
"python",
|
|
229
|
+
"textfield",
|
|
230
|
+
"textarea",
|
|
231
|
+
"datepicker",
|
|
232
|
+
"hidden"
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
isSecret: {
|
|
236
|
+
type: "boolean"
|
|
237
|
+
},
|
|
238
|
+
sectionCaption: {
|
|
239
|
+
type: "string"
|
|
240
|
+
},
|
|
241
|
+
sectionDescription: {
|
|
242
|
+
type: "string"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"else": {
|
|
247
|
+
additionalProperties: false,
|
|
248
|
+
properties: {
|
|
249
|
+
type: {
|
|
250
|
+
"enum": [
|
|
251
|
+
"string"
|
|
252
|
+
]
|
|
253
|
+
},
|
|
254
|
+
title: {
|
|
255
|
+
type: "string"
|
|
256
|
+
},
|
|
257
|
+
description: {
|
|
258
|
+
type: "string"
|
|
259
|
+
},
|
|
260
|
+
example: {
|
|
261
|
+
type: "string"
|
|
262
|
+
},
|
|
263
|
+
nullable: {
|
|
264
|
+
type: "boolean"
|
|
265
|
+
},
|
|
266
|
+
editor: {
|
|
267
|
+
"enum": [
|
|
268
|
+
"textfield",
|
|
269
|
+
"textarea",
|
|
270
|
+
"hidden"
|
|
271
|
+
]
|
|
272
|
+
},
|
|
273
|
+
isSecret: {
|
|
274
|
+
type: "boolean"
|
|
275
|
+
},
|
|
276
|
+
sectionCaption: {
|
|
277
|
+
type: "string"
|
|
278
|
+
},
|
|
279
|
+
sectionDescription: {
|
|
280
|
+
type: "string"
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
arrayProperty: {
|
|
286
|
+
title: "Array property",
|
|
287
|
+
type: "object",
|
|
288
|
+
properties: {
|
|
289
|
+
type: {
|
|
290
|
+
"enum": [
|
|
291
|
+
"array"
|
|
292
|
+
]
|
|
293
|
+
},
|
|
294
|
+
editor: {
|
|
295
|
+
"enum": [
|
|
296
|
+
"json",
|
|
297
|
+
"requestListSources",
|
|
298
|
+
"pseudoUrls",
|
|
299
|
+
"globs",
|
|
300
|
+
"keyValue",
|
|
301
|
+
"stringList",
|
|
302
|
+
"select",
|
|
303
|
+
"hidden"
|
|
304
|
+
]
|
|
305
|
+
},
|
|
306
|
+
title: {
|
|
307
|
+
type: "string"
|
|
308
|
+
},
|
|
309
|
+
description: {
|
|
310
|
+
type: "string"
|
|
311
|
+
},
|
|
312
|
+
"default": {
|
|
313
|
+
type: "array"
|
|
314
|
+
},
|
|
315
|
+
prefill: {
|
|
316
|
+
type: "array"
|
|
317
|
+
},
|
|
318
|
+
example: {
|
|
319
|
+
type: "array"
|
|
320
|
+
},
|
|
321
|
+
nullable: {
|
|
322
|
+
type: "boolean"
|
|
323
|
+
},
|
|
324
|
+
minItems: {
|
|
325
|
+
type: "integer"
|
|
326
|
+
},
|
|
327
|
+
maxItems: {
|
|
328
|
+
type: "integer"
|
|
329
|
+
},
|
|
330
|
+
uniqueItems: {
|
|
331
|
+
type: "boolean"
|
|
332
|
+
},
|
|
333
|
+
sectionCaption: {
|
|
334
|
+
type: "string"
|
|
335
|
+
},
|
|
336
|
+
sectionDescription: {
|
|
337
|
+
type: "string"
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
additionalProperties: true,
|
|
341
|
+
required: [
|
|
342
|
+
"type",
|
|
343
|
+
"title",
|
|
344
|
+
"description",
|
|
345
|
+
"editor"
|
|
346
|
+
],
|
|
347
|
+
"if": {
|
|
348
|
+
properties: {
|
|
349
|
+
editor: {
|
|
350
|
+
"const": "select"
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
then: {
|
|
355
|
+
required: [
|
|
356
|
+
"items"
|
|
357
|
+
],
|
|
358
|
+
properties: {
|
|
359
|
+
items: {
|
|
360
|
+
type: "object",
|
|
361
|
+
additionalProperties: false,
|
|
362
|
+
properties: {
|
|
363
|
+
type: {
|
|
364
|
+
"enum": [
|
|
365
|
+
"string"
|
|
366
|
+
]
|
|
367
|
+
},
|
|
368
|
+
"enum": {
|
|
369
|
+
type: "array",
|
|
370
|
+
items: {
|
|
371
|
+
type: "string"
|
|
372
|
+
},
|
|
373
|
+
uniqueItems: true
|
|
374
|
+
},
|
|
375
|
+
enumTitles: {
|
|
376
|
+
type: "array",
|
|
377
|
+
items: {
|
|
378
|
+
type: "string"
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
required: [
|
|
383
|
+
"type",
|
|
384
|
+
"enum"
|
|
385
|
+
]
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
"else": {
|
|
390
|
+
properties: {
|
|
391
|
+
placeholderKey: {
|
|
392
|
+
type: "string"
|
|
393
|
+
},
|
|
394
|
+
placeholderValue: {
|
|
395
|
+
type: "string"
|
|
396
|
+
},
|
|
397
|
+
patternKey: {
|
|
398
|
+
type: "string"
|
|
399
|
+
},
|
|
400
|
+
patternValue: {
|
|
401
|
+
type: "string"
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
objectProperty: {
|
|
407
|
+
title: "Object property",
|
|
408
|
+
type: "object",
|
|
409
|
+
additionalProperties: false,
|
|
410
|
+
properties: {
|
|
411
|
+
type: {
|
|
412
|
+
"enum": [
|
|
413
|
+
"object"
|
|
414
|
+
]
|
|
415
|
+
},
|
|
416
|
+
title: {
|
|
417
|
+
type: "string"
|
|
418
|
+
},
|
|
419
|
+
description: {
|
|
420
|
+
type: "string"
|
|
421
|
+
},
|
|
422
|
+
"default": {
|
|
423
|
+
type: "object"
|
|
424
|
+
},
|
|
425
|
+
prefill: {
|
|
426
|
+
type: "object"
|
|
427
|
+
},
|
|
428
|
+
example: {
|
|
429
|
+
type: "object"
|
|
430
|
+
},
|
|
431
|
+
patternKey: {
|
|
432
|
+
type: "string"
|
|
433
|
+
},
|
|
434
|
+
patternValue: {
|
|
435
|
+
type: "string"
|
|
436
|
+
},
|
|
437
|
+
nullable: {
|
|
438
|
+
type: "boolean"
|
|
439
|
+
},
|
|
440
|
+
minProperties: {
|
|
441
|
+
type: "integer"
|
|
442
|
+
},
|
|
443
|
+
maxProperties: {
|
|
444
|
+
type: "integer"
|
|
445
|
+
},
|
|
446
|
+
editor: {
|
|
447
|
+
"enum": [
|
|
448
|
+
"json",
|
|
449
|
+
"proxy",
|
|
450
|
+
"hidden"
|
|
451
|
+
]
|
|
452
|
+
},
|
|
453
|
+
sectionCaption: {
|
|
454
|
+
type: "string"
|
|
455
|
+
},
|
|
456
|
+
sectionDescription: {
|
|
457
|
+
type: "string"
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
required: [
|
|
461
|
+
"type",
|
|
462
|
+
"title",
|
|
463
|
+
"description",
|
|
464
|
+
"editor"
|
|
465
|
+
]
|
|
466
|
+
},
|
|
467
|
+
integerProperty: {
|
|
468
|
+
title: "Integer property",
|
|
469
|
+
type: "object",
|
|
470
|
+
additionalProperties: false,
|
|
471
|
+
properties: {
|
|
472
|
+
type: {
|
|
473
|
+
"enum": [
|
|
474
|
+
"integer"
|
|
475
|
+
]
|
|
476
|
+
},
|
|
477
|
+
title: {
|
|
478
|
+
type: "string"
|
|
479
|
+
},
|
|
480
|
+
description: {
|
|
481
|
+
type: "string"
|
|
482
|
+
},
|
|
483
|
+
"default": {
|
|
484
|
+
type: "integer"
|
|
485
|
+
},
|
|
486
|
+
prefill: {
|
|
487
|
+
type: "integer"
|
|
488
|
+
},
|
|
489
|
+
example: {
|
|
490
|
+
type: "integer"
|
|
491
|
+
},
|
|
492
|
+
nullable: {
|
|
493
|
+
type: "boolean"
|
|
494
|
+
},
|
|
495
|
+
minimum: {
|
|
496
|
+
type: "integer"
|
|
497
|
+
},
|
|
498
|
+
maximum: {
|
|
499
|
+
type: "integer"
|
|
500
|
+
},
|
|
501
|
+
unit: {
|
|
502
|
+
type: "string"
|
|
503
|
+
},
|
|
504
|
+
editor: {
|
|
505
|
+
"enum": [
|
|
506
|
+
"number",
|
|
507
|
+
"hidden"
|
|
508
|
+
]
|
|
509
|
+
},
|
|
510
|
+
sectionCaption: {
|
|
511
|
+
type: "string"
|
|
512
|
+
},
|
|
513
|
+
sectionDescription: {
|
|
514
|
+
type: "string"
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
required: [
|
|
518
|
+
"type",
|
|
519
|
+
"title",
|
|
520
|
+
"description"
|
|
521
|
+
]
|
|
522
|
+
},
|
|
523
|
+
booleanProperty: {
|
|
524
|
+
title: "Boolean property",
|
|
525
|
+
type: "object",
|
|
526
|
+
additionalProperties: false,
|
|
527
|
+
properties: {
|
|
528
|
+
type: {
|
|
529
|
+
"enum": [
|
|
530
|
+
"boolean"
|
|
531
|
+
]
|
|
532
|
+
},
|
|
533
|
+
title: {
|
|
534
|
+
type: "string"
|
|
535
|
+
},
|
|
536
|
+
description: {
|
|
537
|
+
type: "string"
|
|
538
|
+
},
|
|
539
|
+
"default": {
|
|
540
|
+
type: "boolean"
|
|
541
|
+
},
|
|
542
|
+
example: {
|
|
543
|
+
type: "boolean"
|
|
544
|
+
},
|
|
545
|
+
nullable: {
|
|
546
|
+
type: "boolean"
|
|
547
|
+
},
|
|
548
|
+
groupCaption: {
|
|
549
|
+
type: "string"
|
|
550
|
+
},
|
|
551
|
+
groupDescription: {
|
|
552
|
+
type: "string"
|
|
553
|
+
},
|
|
554
|
+
editor: {
|
|
555
|
+
"enum": [
|
|
556
|
+
"checkbox",
|
|
557
|
+
"hidden"
|
|
558
|
+
]
|
|
559
|
+
},
|
|
560
|
+
sectionCaption: {
|
|
561
|
+
type: "string"
|
|
562
|
+
},
|
|
563
|
+
sectionDescription: {
|
|
564
|
+
type: "string"
|
|
565
|
+
}
|
|
566
|
+
},
|
|
567
|
+
required: [
|
|
568
|
+
"type",
|
|
569
|
+
"title",
|
|
570
|
+
"description"
|
|
571
|
+
]
|
|
572
|
+
},
|
|
573
|
+
anyProperty: {
|
|
574
|
+
title: "Any property",
|
|
575
|
+
type: "object",
|
|
576
|
+
additionalProperties: false,
|
|
577
|
+
properties: {
|
|
578
|
+
type: {
|
|
579
|
+
type: [
|
|
580
|
+
"array"
|
|
581
|
+
],
|
|
582
|
+
items: {
|
|
583
|
+
type: "string",
|
|
584
|
+
"enum": [
|
|
585
|
+
"object",
|
|
586
|
+
"array",
|
|
587
|
+
"string",
|
|
588
|
+
"integer",
|
|
589
|
+
"boolean"
|
|
590
|
+
]
|
|
591
|
+
},
|
|
592
|
+
uniqueItems: true,
|
|
593
|
+
additionalItems: false,
|
|
594
|
+
minItems: 1
|
|
595
|
+
},
|
|
596
|
+
title: {
|
|
597
|
+
type: "string"
|
|
598
|
+
},
|
|
599
|
+
description: {
|
|
600
|
+
type: "string"
|
|
601
|
+
},
|
|
602
|
+
"default": {
|
|
603
|
+
type: [
|
|
604
|
+
"object",
|
|
605
|
+
"array",
|
|
606
|
+
"string",
|
|
607
|
+
"integer",
|
|
608
|
+
"boolean"
|
|
609
|
+
]
|
|
610
|
+
},
|
|
611
|
+
prefill: {
|
|
612
|
+
type: [
|
|
613
|
+
"object",
|
|
614
|
+
"array",
|
|
615
|
+
"string",
|
|
616
|
+
"integer",
|
|
617
|
+
"boolean"
|
|
618
|
+
]
|
|
619
|
+
},
|
|
620
|
+
example: {
|
|
621
|
+
type: [
|
|
622
|
+
"object",
|
|
623
|
+
"array",
|
|
624
|
+
"string",
|
|
625
|
+
"integer",
|
|
626
|
+
"boolean"
|
|
627
|
+
]
|
|
628
|
+
},
|
|
629
|
+
nullable: {
|
|
630
|
+
type: "boolean"
|
|
631
|
+
},
|
|
632
|
+
editor: {
|
|
633
|
+
"enum": [
|
|
634
|
+
"json",
|
|
635
|
+
"hidden"
|
|
636
|
+
]
|
|
637
|
+
},
|
|
638
|
+
sectionCaption: {
|
|
639
|
+
type: "string"
|
|
640
|
+
},
|
|
641
|
+
sectionDescription: {
|
|
642
|
+
type: "string"
|
|
643
|
+
}
|
|
644
|
+
},
|
|
645
|
+
required: [
|
|
646
|
+
"type",
|
|
647
|
+
"title",
|
|
648
|
+
"description",
|
|
649
|
+
"editor"
|
|
650
|
+
]
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
var schema = {
|
|
654
|
+
title: title,
|
|
655
|
+
type: type,
|
|
656
|
+
properties: properties,
|
|
657
|
+
additionalProperties: additionalProperties,
|
|
658
|
+
required: required,
|
|
659
|
+
definitions: definitions
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* This function parses AJV error and transforms it into a readable string.
|
|
664
|
+
*
|
|
665
|
+
* @param error An error as returned from AJV.
|
|
666
|
+
* @param rootName Usually 'input' or 'schema' based on if we are passing the input or schema.
|
|
667
|
+
* @param properties (Used only when parsing input errors) List of input schema properties.
|
|
668
|
+
* @param input (Used only when parsing input errors) Actual input that is being parsed.
|
|
669
|
+
* @returns {null|{fieldKey: *, message: *}}
|
|
670
|
+
*/
|
|
671
|
+
declare function parseAjvError(error: ErrorObject, rootName: string, properties?: Record<string, {
|
|
672
|
+
nullable?: boolean;
|
|
673
|
+
}>, input?: Record<string, unknown>): {
|
|
674
|
+
fieldKey: string;
|
|
675
|
+
message: string;
|
|
676
|
+
} | null;
|
|
677
|
+
/**
|
|
678
|
+
* Validates that all required fields are present in properties list
|
|
679
|
+
*/
|
|
680
|
+
declare function validateExistenceOfRequiredFields<T extends Record<string, any>>(inputSchema: T): void;
|
|
681
|
+
/**
|
|
682
|
+
* This function validates given input schema first just for basic structure then each field one by one,
|
|
683
|
+
* then checks that all required fields are present and finally checks fully against the whole schema.
|
|
684
|
+
*
|
|
685
|
+
* This way we get the most accurate error message for user.
|
|
686
|
+
*/
|
|
687
|
+
declare function validateInputSchema<T extends Record<string, any>>(validator: Ajv, inputSchema: T): void;
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Uses AJV validator to validate input with input schema and then
|
|
691
|
+
* does custom validation for our own properties (nullable, patternKey, patternValue)
|
|
692
|
+
* @param validator Initialized AJV validator
|
|
693
|
+
* @param inputSchema Valid input schema in object
|
|
694
|
+
* @param input Input object to be validated
|
|
695
|
+
* @param options (Optional) Additional validation configuration for certain fields
|
|
696
|
+
*/
|
|
697
|
+
declare function validateInputUsingValidator(validator: ValidateFunction, inputSchema: Record<string, any>, input: Record<string, unknown>, options?: Record<string, any>): {
|
|
698
|
+
fieldKey: string;
|
|
699
|
+
message: string;
|
|
700
|
+
}[];
|
|
701
|
+
/**
|
|
702
|
+
* This functions parses all given JSON and then takes each of the jsFields.
|
|
703
|
+
* Then if the field:
|
|
704
|
+
* - is valid JS single function it replaces its single line string with a function delacation.
|
|
705
|
+
* - is valid multiline JS code then replaces its single line string with `multiline` string
|
|
706
|
+
* Then stringifies the code with given number of jsonSpacing spaces and finally prefixes whole
|
|
707
|
+
* stringified JSON except the first line with globalSpacing spaces.
|
|
708
|
+
*/
|
|
709
|
+
declare function makeInputJsFieldsReadable(json: string, jsFields: string[], jsonSpacing?: number, globalSpacing?: number): string;
|
|
710
|
+
|
|
711
|
+
export { schema as inputSchema, m, makeInputJsFieldsReadable, parseAjvError, validateExistenceOfRequiredFields, validateInputSchema, validateInputUsingValidator };
|