@apify/input_schema 3.7.0 → 3.8.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.
- package/README.md +0 -1
- package/cjs/index.cjs +25 -47
- package/cjs/index.cjs.map +1 -1
- package/cjs/index.d.ts +10 -4
- package/esm/index.d.mts +10 -4
- package/esm/index.mjs +25 -47
- package/esm/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,7 +15,6 @@ package | version
|
|
|
15
15
|
`@apify/markdown` | [](https://www.npmjs.com/package/@apify/markdown)
|
|
16
16
|
`@apify/payment_qr_codes` | [](https://www.npmjs.com/package/@apify/payment_qr_codes)
|
|
17
17
|
`@apify/pseudo_url` | [](https://www.npmjs.com/package/@apify/pseudo_url)
|
|
18
|
-
`@apify/salesforce_client` | [](https://www.npmjs.com/package/@apify/salesforce_client)
|
|
19
18
|
`@apify/utilities` | [](https://www.npmjs.com/package/@apify/utilities)
|
|
20
19
|
`@apify/timeout` | [](https://www.npmjs.com/package/@apify/timeout)
|
|
21
20
|
|
package/cjs/index.cjs
CHANGED
|
@@ -53,8 +53,7 @@ var intlStrings = {
|
|
|
53
53
|
};
|
|
54
54
|
function m(stringId, variables) {
|
|
55
55
|
let text = intlStrings[stringId];
|
|
56
|
-
if (!text)
|
|
57
|
-
return stringId;
|
|
56
|
+
if (!text) return stringId;
|
|
58
57
|
if (variables) {
|
|
59
58
|
Object.keys(variables).forEach((variableName) => {
|
|
60
59
|
text = text.split(`{${variableName}}`).join(variables[variableName]);
|
|
@@ -153,7 +152,7 @@ var schema_default = {
|
|
|
153
152
|
title: { type: "string" },
|
|
154
153
|
description: { type: "string" },
|
|
155
154
|
nullable: { type: "boolean" },
|
|
156
|
-
editor: { enum: ["javascript", "python", "textfield", "textarea", "datepicker", "hidden"] },
|
|
155
|
+
editor: { enum: ["javascript", "python", "textfield", "textarea", "datepicker", "hidden", "dataset", "keyValueStore", "requestQueue"] },
|
|
157
156
|
isSecret: { type: "boolean" }
|
|
158
157
|
},
|
|
159
158
|
required: ["type", "title", "description", "editor"],
|
|
@@ -179,7 +178,7 @@ var schema_default = {
|
|
|
179
178
|
nullable: { type: "boolean" },
|
|
180
179
|
minLength: { type: "integer" },
|
|
181
180
|
maxLength: { type: "integer" },
|
|
182
|
-
editor: { enum: ["javascript", "python", "textfield", "textarea", "datepicker", "hidden"] },
|
|
181
|
+
editor: { enum: ["javascript", "python", "textfield", "textarea", "datepicker", "hidden", "dataset", "keyValueStore", "requestQueue"] },
|
|
183
182
|
isSecret: { type: "boolean" },
|
|
184
183
|
sectionCaption: { type: "string" },
|
|
185
184
|
sectionDescription: { type: "string" }
|
|
@@ -378,8 +377,7 @@ function parseAjvError(error, rootName, properties = {}, input = {}) {
|
|
|
378
377
|
}
|
|
379
378
|
__name(parseAjvError, "parseAjvError");
|
|
380
379
|
var validateAgainstSchemaOrThrow = /* @__PURE__ */ __name((validator, obj, inputSchema, rootName) => {
|
|
381
|
-
if (validator.validate(inputSchema, obj))
|
|
382
|
-
return;
|
|
380
|
+
if (validator.validate(inputSchema, obj)) return;
|
|
383
381
|
const errorMessage = parseAjvError(validator.errors[0], rootName)?.message;
|
|
384
382
|
throw new Error(`Input schema is not valid (${errorMessage})`);
|
|
385
383
|
}, "validateAgainstSchemaOrThrow");
|
|
@@ -405,14 +403,12 @@ function validateField(validator, fieldSchema, fieldKey) {
|
|
|
405
403
|
}
|
|
406
404
|
if (fieldSchema.enum) {
|
|
407
405
|
const definition2 = matchingDefinitions.filter((item) => !!item.properties.enum).pop();
|
|
408
|
-
if (!definition2)
|
|
409
|
-
throw new Error('Input schema validation failed to find "enum property" definition');
|
|
406
|
+
if (!definition2) throw new Error('Input schema validation failed to find "enum property" definition');
|
|
410
407
|
validateAgainstSchemaOrThrow(validator, fieldSchema, definition2, `schema.properties.${fieldKey}.enum`);
|
|
411
408
|
return;
|
|
412
409
|
}
|
|
413
410
|
const definition = matchingDefinitions.filter((item) => !item.properties.enum).pop();
|
|
414
|
-
if (!definition)
|
|
415
|
-
throw new Error('Input schema validation failed to find other than "enum property" definition');
|
|
411
|
+
if (!definition) throw new Error('Input schema validation failed to find other than "enum property" definition');
|
|
416
412
|
validateAgainstSchemaOrThrow(validator, fieldSchema, definition, `schema.properties.${fieldKey}`);
|
|
417
413
|
}
|
|
418
414
|
__name(validateField, "validateField");
|
|
@@ -423,11 +419,9 @@ function validateProperties(inputSchema, validator) {
|
|
|
423
419
|
}
|
|
424
420
|
__name(validateProperties, "validateProperties");
|
|
425
421
|
function validateExistenceOfRequiredFields(inputSchema) {
|
|
426
|
-
if (!inputSchema?.required?.length)
|
|
427
|
-
return;
|
|
422
|
+
if (!inputSchema?.required?.length) return;
|
|
428
423
|
Object.values(inputSchema?.required).forEach((fieldKey) => {
|
|
429
|
-
if (inputSchema?.properties[fieldKey])
|
|
430
|
-
return;
|
|
424
|
+
if (inputSchema?.properties[fieldKey]) return;
|
|
431
425
|
throw new Error(m("inputSchema.validation.missingRequiredField", { fieldKey }));
|
|
432
426
|
});
|
|
433
427
|
}
|
|
@@ -442,13 +436,12 @@ __name(validateInputSchema, "validateInputSchema");
|
|
|
442
436
|
|
|
443
437
|
// src/utilities.ts
|
|
444
438
|
var import_consts = require("@apify/consts");
|
|
445
|
-
var import_countries_list = require("countries-list");
|
|
446
439
|
var import_acorn_loose = require("acorn-loose");
|
|
440
|
+
var import_countries_list = require("countries-list");
|
|
447
441
|
function validateProxyField(fieldKey, value, isRequired = false, options = null) {
|
|
448
442
|
const fieldErrors = [];
|
|
449
443
|
if (isRequired) {
|
|
450
|
-
if (value === null)
|
|
451
|
-
return fieldErrors;
|
|
444
|
+
if (value === null) return fieldErrors;
|
|
452
445
|
if (!value) {
|
|
453
446
|
const message = m("inputSchema.validation.required", { rootName: "input", fieldKey });
|
|
454
447
|
fieldErrors.push(message);
|
|
@@ -460,14 +453,12 @@ function validateProxyField(fieldKey, value, isRequired = false, options = null)
|
|
|
460
453
|
return fieldErrors;
|
|
461
454
|
}
|
|
462
455
|
}
|
|
463
|
-
if (!value)
|
|
464
|
-
return fieldErrors;
|
|
456
|
+
if (!value) return fieldErrors;
|
|
465
457
|
const { useApifyProxy, proxyUrls, apifyProxyGroups, apifyProxyCountry } = value;
|
|
466
458
|
if (!useApifyProxy && Array.isArray(proxyUrls)) {
|
|
467
459
|
let invalidUrl = false;
|
|
468
460
|
proxyUrls.forEach((url) => {
|
|
469
|
-
if (!import_consts.PROXY_URL_REGEX.test(url.trim()))
|
|
470
|
-
invalidUrl = url.trim();
|
|
461
|
+
if (!import_consts.PROXY_URL_REGEX.test(url.trim())) invalidUrl = url.trim();
|
|
471
462
|
});
|
|
472
463
|
if (invalidUrl) {
|
|
473
464
|
fieldErrors.push(m("inputSchema.validation.customProxyInvalid", { invalidUrl }));
|
|
@@ -476,13 +467,11 @@ function validateProxyField(fieldKey, value, isRequired = false, options = null)
|
|
|
476
467
|
if (!useApifyProxy && apifyProxyCountry) {
|
|
477
468
|
fieldErrors.push(m("inputSchema.validation.apifyProxyCountryWithoutApifyProxyForbidden"));
|
|
478
469
|
}
|
|
479
|
-
if (!useApifyProxy)
|
|
480
|
-
return fieldErrors;
|
|
470
|
+
if (!useApifyProxy) return fieldErrors;
|
|
481
471
|
if (apifyProxyCountry && !import_countries_list.countries[apifyProxyCountry]) {
|
|
482
472
|
fieldErrors.push(m("inputSchema.validation.apifyProxyCountryInvalid", { invalidCountry: apifyProxyCountry }));
|
|
483
473
|
}
|
|
484
|
-
if (!options)
|
|
485
|
-
return fieldErrors;
|
|
474
|
+
if (!options) return fieldErrors;
|
|
486
475
|
const isStringsArray = /* @__PURE__ */ __name((array) => array.every((item) => typeof item === "string"), "isStringsArray");
|
|
487
476
|
if (apifyProxyGroups && !(Array.isArray(apifyProxyGroups) && isStringsArray(apifyProxyGroups))) {
|
|
488
477
|
fieldErrors.push(m("inputSchema.validation.proxyGroupMustBeArrayOfStrings", { rootName: "input", fieldKey }));
|
|
@@ -534,14 +523,10 @@ function validateInputUsingValidator(validator, inputSchema, input, options = {}
|
|
|
534
523
|
if (editor === "requestListSources") {
|
|
535
524
|
const invalidIndexes = [];
|
|
536
525
|
value.forEach((item, index) => {
|
|
537
|
-
if (!item)
|
|
538
|
-
|
|
539
|
-
else if (
|
|
540
|
-
|
|
541
|
-
else if (item.url && !import_consts.URL_REGEX.test(item.url))
|
|
542
|
-
invalidIndexes.push(index);
|
|
543
|
-
else if (item.requestsFromUrl && !import_consts.URL_REGEX.test(item.requestsFromUrl))
|
|
544
|
-
invalidIndexes.push(index);
|
|
526
|
+
if (!item) invalidIndexes.push(index);
|
|
527
|
+
else if (!item.url && !item.requestsFromUrl) invalidIndexes.push(index);
|
|
528
|
+
else if (item.url && !import_consts.URL_REGEX.test(item.url)) invalidIndexes.push(index);
|
|
529
|
+
else if (item.requestsFromUrl && !import_consts.URL_REGEX.test(item.requestsFromUrl)) invalidIndexes.push(index);
|
|
545
530
|
});
|
|
546
531
|
if (invalidIndexes.length) {
|
|
547
532
|
fieldErrors.push(m("inputSchema.validation.requestListSourcesInvalid", {
|
|
@@ -555,8 +540,7 @@ function validateInputUsingValidator(validator, inputSchema, input, options = {}
|
|
|
555
540
|
const check = new RegExp(patternKey);
|
|
556
541
|
const invalidIndexes = [];
|
|
557
542
|
value.forEach((item, index) => {
|
|
558
|
-
if (!check.test(item.key))
|
|
559
|
-
invalidIndexes.push(index);
|
|
543
|
+
if (!check.test(item.key)) invalidIndexes.push(index);
|
|
560
544
|
});
|
|
561
545
|
if (invalidIndexes.length) {
|
|
562
546
|
fieldErrors.push(m("inputSchema.validation.arrayKeysInvalid", {
|
|
@@ -571,8 +555,7 @@ function validateInputUsingValidator(validator, inputSchema, input, options = {}
|
|
|
571
555
|
const check = new RegExp(patternValue);
|
|
572
556
|
const invalidIndexes = [];
|
|
573
557
|
value.forEach((item, index) => {
|
|
574
|
-
if (!check.test(item.value))
|
|
575
|
-
invalidIndexes.push(index);
|
|
558
|
+
if (!check.test(item.value)) invalidIndexes.push(index);
|
|
576
559
|
});
|
|
577
560
|
if (invalidIndexes.length) {
|
|
578
561
|
fieldErrors.push(m("inputSchema.validation.arrayValuesInvalid", {
|
|
@@ -586,8 +569,7 @@ function validateInputUsingValidator(validator, inputSchema, input, options = {}
|
|
|
586
569
|
const check = new RegExp(patternValue);
|
|
587
570
|
const invalidIndexes = [];
|
|
588
571
|
value.forEach((item, index) => {
|
|
589
|
-
if (!check.test(item))
|
|
590
|
-
invalidIndexes.push(index);
|
|
572
|
+
if (!check.test(item)) invalidIndexes.push(index);
|
|
591
573
|
});
|
|
592
574
|
if (invalidIndexes.length) {
|
|
593
575
|
fieldErrors.push(m("inputSchema.validation.arrayValuesInvalid", {
|
|
@@ -604,8 +586,7 @@ function validateInputUsingValidator(validator, inputSchema, input, options = {}
|
|
|
604
586
|
const check = new RegExp(patternKey);
|
|
605
587
|
const invalidKeys = [];
|
|
606
588
|
Object.keys(value).forEach((key) => {
|
|
607
|
-
if (!check.test(key))
|
|
608
|
-
invalidKeys.push(key);
|
|
589
|
+
if (!check.test(key)) invalidKeys.push(key);
|
|
609
590
|
});
|
|
610
591
|
if (invalidKeys.length) {
|
|
611
592
|
fieldErrors.push(m("inputSchema.validation.objectKeysInvalid", {
|
|
@@ -621,8 +602,7 @@ function validateInputUsingValidator(validator, inputSchema, input, options = {}
|
|
|
621
602
|
const invalidKeys = [];
|
|
622
603
|
Object.keys(value).forEach((key) => {
|
|
623
604
|
const propertyValue = value[key];
|
|
624
|
-
if (typeof propertyValue !== "string" || !check.test(propertyValue))
|
|
625
|
-
invalidKeys.push(key);
|
|
605
|
+
if (typeof propertyValue !== "string" || !check.test(propertyValue)) invalidKeys.push(key);
|
|
626
606
|
});
|
|
627
607
|
if (invalidKeys.length) {
|
|
628
608
|
fieldErrors.push(m("inputSchema.validation.objectValuesInvalid", {
|
|
@@ -647,8 +627,7 @@ function makeInputJsFieldsReadable(json, jsFields, jsonSpacing = 4, globalSpacin
|
|
|
647
627
|
const replacements = {};
|
|
648
628
|
jsFields.forEach((field) => {
|
|
649
629
|
let maybeFunction = parsedJson[field];
|
|
650
|
-
if (!maybeFunction || typeof maybeFunction !== "string")
|
|
651
|
-
return;
|
|
630
|
+
if (!maybeFunction || typeof maybeFunction !== "string") return;
|
|
652
631
|
let ast;
|
|
653
632
|
try {
|
|
654
633
|
ast = (0, import_acorn_loose.parse)(maybeFunction, { ecmaVersion: "latest" });
|
|
@@ -657,8 +636,7 @@ function makeInputJsFieldsReadable(json, jsFields, jsonSpacing = 4, globalSpacin
|
|
|
657
636
|
}
|
|
658
637
|
const isMultiline = maybeFunction.includes("\n");
|
|
659
638
|
const isSingleFunction = ast && ast.body.length === 1 && (ast.body[0].type === "FunctionDeclaration" || ast.body[0].type === "ExpressionStatement" && ast.body[0].expression.type === "ArrowFunctionExpression");
|
|
660
|
-
if (!isSingleFunction && !isMultiline)
|
|
661
|
-
return;
|
|
639
|
+
if (!isSingleFunction && !isMultiline) return;
|
|
662
640
|
const spaces = new Array(isSingleFunction ? jsonSpacing : jsonSpacing * 2).fill(" ").join("");
|
|
663
641
|
maybeFunction = maybeFunction.split("\n").join(`
|
|
664
642
|
${spaces}`).trim();
|
package/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/intl.ts","../../src/schema.json","../../src/input_schema.ts","../../src/utilities.ts"],"sourcesContent":["export * from './intl';\nexport * from './input_schema';\nexport {\n StringFieldDefinition,\n BooleanFieldDefinition,\n IntegerFieldDefinition,\n ObjectFieldDefinition,\n ArrayFieldDefinition,\n MixedFieldDefinition,\n FieldDefinition,\n InputSchema,\n} from './types';\nexport * from './utilities';\n","const intlStrings = {\n 'inputSchema.validation.generic':\n 'Field {rootName}.{fieldKey} {message}',\n 'inputSchema.validation.required':\n 'Field {rootName}.{fieldKey} is required',\n 'inputSchema.validation.proxyRequired':\n 'Field {rootName}.{fieldKey} is required. Please provide custom proxy URLs or use Apify Proxy.',\n 'inputSchema.validation.requestListSourcesInvalid':\n 'Items in {rootName}.{fieldKey} at positions [{invalidIndexes}] do not contain valid URLs',\n 'inputSchema.validation.arrayKeysInvalid':\n 'Keys in {rootName}.{fieldKey} at positions [{invalidIndexes}] must match regular expression \"{pattern}\"',\n 'inputSchema.validation.arrayValuesInvalid':\n 'Values in {rootName}.{fieldKey} at positions [{invalidIndexes}] must match regular expression \"{pattern}\"',\n 'inputSchema.validation.objectKeysInvalid':\n 'Keys [{invalidKeys}] in {rootName}.{fieldKey} must match regular expression \"{pattern}',\n 'inputSchema.validation.objectValuesInvalid':\n 'Keys [{invalidKeys}] in {rootName}.{fieldKey} must have string value which matches regular expression \"{pattern}\"',\n 'inputSchema.validation.additionalProperty':\n 'Property {rootName}.{fieldKey} is not allowed.',\n 'inputSchema.validation.proxyGroupsNotAvailable':\n 'You currently do not have access to proxy groups: {groups}',\n 'inputSchema.validation.customProxyInvalid':\n 'Proxy URL \"{invalidUrl}\" has invalid format, it must be http[s]://[username[:password]]@hostname:port.',\n 'inputSchema.validation.apifyProxyCountryInvalid':\n 'Country code \"{invalidCountry}\" is invalid. Only ISO 3166-1 alpha-2 country codes are supported.',\n 'inputSchema.validation.apifyProxyCountryWithoutApifyProxyForbidden':\n 'The country for Apify Proxy can be specified only when using Apify Proxy.',\n 'inputSchema.validation.noAvailableAutoProxy':\n 'Currently you do not have access to any proxy group usable in automatic mode.',\n 'inputSchema.validation.noMatchingDefinition':\n 'Field schema.properties.{fieldKey} is not matching any input schema type definition. Please make sure that it\\'s type is valid.',\n 'inputSchema.validation.missingRequiredField':\n 'Field schema.properties.{fieldKey} does not exist, but it is specified in schema.required. Either define the field or remove it from schema.required.',\n 'inputSchema.validation.proxyGroupMustBeArrayOfStrings':\n 'Field {rootName}.{fieldKey}.apifyProxyGroups must be an array of strings.',\n};\n\n/**\n * Helper function to simulate intl formatMessage function\n */\nexport function m(stringId: string, variables?: Record<string, any>) {\n let text = intlStrings[stringId];\n if (!text) return stringId;\n\n if (variables) {\n Object.keys(variables).forEach((variableName) => {\n text = text.split(`{${variableName}}`).join(variables[variableName]);\n });\n }\n\n return text;\n}\n","{\n \"title\": \"JSON schema of Apify Actor INPUT_SCHEMA.json\",\n \"type\": \"object\",\n \"properties\": {\n \"$schema\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": \"string\"\n },\n \"schemaVersion\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 1\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"enum\": [\"object\"]\n },\n \"required\": {\n \"type\": \"array\",\n \"minItems\": 0,\n \"items\": { \"type\": \"string\" },\n \"uniqueItems\": true\n },\n \"additionalProperties\": {\n \"type\": \"boolean\"\n },\n \"properties\": {\n \"type\": \"object\",\n \"patternProperties\": {\n \"^\": {\n \"oneOf\": [\n { \"$ref\": \"#/definitions/stringProperty\" },\n { \"$ref\": \"#/definitions/stringEnumProperty\" },\n { \"$ref\": \"#/definitions/arrayProperty\" },\n { \"$ref\": \"#/definitions/objectProperty\" },\n { \"$ref\": \"#/definitions/integerProperty\" },\n { \"$ref\": \"#/definitions/booleanProperty\" },\n { \"$ref\": \"#/definitions/anyProperty\" }\n ]\n }\n }\n }\n },\n \"additionalProperties\": false,\n \"required\": [\"title\", \"type\", \"properties\", \"schemaVersion\"],\n \"definitions\": {\n \"stringEnumProperty\": {\n \"title\": \"Enum property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"editor\": { \"enum\": [\"select\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"string\" },\n \"prefill\": { \"type\": \"string\" },\n \"example\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" },\n \"enum\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"minItems\": 1,\n \"uniqueItems\": true\n },\n \"enumTitles\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"minItems\": 1\n }\n },\n \"required\": [\"type\", \"title\", \"description\", \"enum\"]\n },\n \"stringProperty\": {\n \"title\": \"String property\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"editor\": { \"enum\": [\"javascript\", \"python\", \"textfield\", \"textarea\", \"datepicker\", \"hidden\"] },\n \"isSecret\": { \"type\": \"boolean\" }\n },\n \"required\": [\"type\", \"title\", \"description\", \"editor\"],\n \"if\": {\n \"properties\": {\n \"isSecret\": {\n \"not\": {\n \"const\": true\n }\n }\n }\n },\n \"then\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"string\" },\n \"prefill\": { \"type\": \"string\" },\n \"example\": { \"type\": \"string\" },\n \"pattern\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minLength\": { \"type\": \"integer\" },\n \"maxLength\": { \"type\": \"integer\" },\n \"editor\": { \"enum\": [\"javascript\", \"python\", \"textfield\", \"textarea\", \"datepicker\", \"hidden\"] },\n \"isSecret\": { \"type\": \"boolean\" },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n }\n },\n \"else\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"example\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"editor\": { \"enum\": [\"textfield\", \"textarea\", \"hidden\"] },\n \"isSecret\": { \"type\": \"boolean\" },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n }\n }\n },\n \"arrayProperty\": {\n \"title\": \"Array property\",\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"enum\": [\"array\"] },\n \"editor\": { \"enum\": [\"json\", \"requestListSources\", \"pseudoUrls\", \"globs\", \"keyValue\", \"stringList\", \"select\", \"hidden\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"array\" },\n \"prefill\": { \"type\": \"array\" },\n \"example\": { \"type\": \"array\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minItems\": { \"type\": \"integer\" },\n \"maxItems\": { \"type\": \"integer\" },\n \"uniqueItems\": { \"type\": \"boolean\" },\n\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"additionalProperties\": true,\n \"required\": [\"type\", \"title\", \"description\", \"editor\"],\n \"if\": {\n \"properties\": {\n \"editor\": { \"const\": \"select\" }\n }\n },\n \"then\": {\n \"required\": [\"items\"],\n \"properties\": {\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"enum\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"uniqueItems\": true\n },\n \"enumTitles\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n }\n },\n \"required\": [\"type\", \"enum\"]\n }\n }\n },\n \"else\": {\n \"properties\": {\n \"placeholderKey\": { \"type\": \"string\" },\n \"placeholderValue\": { \"type\": \"string\" },\n \"patternKey\": { \"type\": \"string\" },\n \"patternValue\": { \"type\": \"string\" }\n }\n }\n },\n \"objectProperty\": {\n \"title\": \"Object property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"object\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"object\" },\n \"prefill\": { \"type\": \"object\" },\n \"example\": { \"type\": \"object\" },\n \"patternKey\": { \"type\": \"string\" },\n \"patternValue\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minProperties\": { \"type\": \"integer\" },\n \"maxProperties\": { \"type\": \"integer\" },\n\n \"editor\": { \"enum\": [\"json\", \"proxy\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\", \"editor\"]\n },\n \"integerProperty\": {\n \"title\": \"Integer property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"integer\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"integer\" },\n \"prefill\": { \"type\": \"integer\" },\n \"example\": { \"type\": \"integer\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minimum\": { \"type\": \"integer\" },\n \"maximum\": { \"type\": \"integer\" },\n \"unit\": { \"type\": \"string\" },\n \"editor\": { \"enum\": [\"number\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\"]\n },\n \"booleanProperty\": {\n \"title\": \"Boolean property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"boolean\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"boolean\" },\n \"prefill\": { \"type\": \"boolean\" },\n \"example\": { \"type\": \"boolean\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"groupCaption\": { \"type\": \"string\" },\n \"groupDescription\": { \"type\": \"string\" },\n \"editor\": { \"enum\": [\"checkbox\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\"]\n },\n \"anyProperty\": {\n \"title\": \"Any property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": {\n \"type\": [\"array\"],\n \"items\": {\n \"type\": \"string\",\n \"enum\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"]\n },\n \"uniqueItems\": true,\n \"additionalItems\": false,\n \"minItems\": 1\n },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"] },\n \"prefill\": { \"type\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"] },\n \"example\": { \"type\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"] },\n \"nullable\": { \"type\": \"boolean\" },\n \"editor\": { \"enum\": [\"json\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\", \"editor\"]\n }\n }\n}\n","import Ajv, { ErrorObject, Schema } from 'ajv';\nimport schema from './schema.json';\nimport { m } from './intl';\nimport {\n FieldDefinition,\n InputSchema,\n InputSchemaBaseChecked,\n StringFieldDefinition,\n} from './types';\n\nexport { schema as inputSchema };\n\nconst { definitions } = schema;\n\n/**\n * This function parses AJV error and transforms it into a readable string.\n *\n * @param error An error as returned from AJV.\n * @param rootName Usually 'input' or 'schema' based on if we are passing the input or schema.\n * @param properties (Used only when parsing input errors) List of input schema properties.\n * @param input (Used only when parsing input errors) Actual input that is being parsed.\n * @returns {null|{fieldKey: *, message: *}}\n */\nexport function parseAjvError(\n error: ErrorObject,\n rootName: string,\n properties: Record<string, { nullable?: boolean }> = {},\n input: Record<string, unknown> = {},\n): { fieldKey: string; message: string } | null {\n // There are 3 possible errors comming from validation:\n // - either { keword: 'anything', instancePath: '/someField', message: 'error message that we can use' }\n // - or { keyword: 'additionalProperties', params: { additionalProperty: 'field' }, message: 'must NOT have additional properties' }\n // - or { keyword: 'required', instancePath: '', params.missingProperty: 'someField' }\n\n let fieldKey: string;\n let message: string;\n\n // If error is with keyword type, it means that type of input is incorrect\n // this can mean that provided value is null\n if (error.keyword === 'type') {\n fieldKey = error.instancePath.split('/').pop()!;\n // Check if value is null and field is nullable, if yes, then skip this error\n if (properties[fieldKey] && properties[fieldKey].nullable && input[fieldKey] === null) {\n return null;\n }\n message = m('inputSchema.validation.generic', { rootName, fieldKey, message: error.message });\n } else if (error.keyword === 'required') {\n fieldKey = error.params.missingProperty;\n message = m('inputSchema.validation.required', { rootName, fieldKey });\n } else if (error.keyword === 'additionalProperties') {\n fieldKey = error.params.additionalProperty;\n message = m('inputSchema.validation.additionalProperty', { rootName, fieldKey });\n } else if (error.keyword === 'enum') {\n fieldKey = error.instancePath.split('/').pop()!;\n const errorMessage = `${error.message}: \"${error.params.allowedValues.join('\", \"')}\"`;\n message = m('inputSchema.validation.generic', { rootName, fieldKey, message: errorMessage });\n } else {\n fieldKey = error.instancePath.split('/').pop()!;\n message = m('inputSchema.validation.generic', { rootName, fieldKey, message: error.message });\n }\n\n return { fieldKey, message };\n}\n\n/**\n * Validates given object against schema and throws a human-readable error.\n */\nconst validateAgainstSchemaOrThrow = (validator: Ajv, obj: Record<string, unknown>, inputSchema: Schema, rootName: string) => {\n if (validator.validate(inputSchema, obj)) return;\n\n const errorMessage = parseAjvError(validator.errors![0], rootName)?.message;\n throw new Error(`Input schema is not valid (${errorMessage})`);\n};\n\n/**\n * This validates given object only against the basic input schema without checking the particular fields.\n * We override schema.properties.properties not to validate field definitions.\n */\nfunction validateBasicStructure(validator: Ajv, obj: Record<string, unknown>): asserts obj is InputSchemaBaseChecked {\n const schemaWithoutProperties = {\n ...schema,\n properties: { ...schema.properties, properties: { type: 'object' } as any },\n };\n validateAgainstSchemaOrThrow(validator, obj, schemaWithoutProperties, 'schema');\n}\n\n/**\n * Validates particular field against it's schema.\n */\nfunction validateField(validator: Ajv, fieldSchema: Record<string, unknown>, fieldKey: string): asserts fieldSchema is FieldDefinition {\n const matchingDefinitions = Object\n .values<any>(definitions) // cast as any, as the code in first branch seems to be invalid\n .filter((definition) => {\n return definition.properties.type.enum\n // This is a normal case where fieldSchema.type can be only one possible value matching definition.properties.type.enum.0\n ? definition.properties.type.enum[0] === fieldSchema.type\n // This is a type \"Any\" where fieldSchema.type is an array of possible values\n : Array.isArray(fieldSchema.type);\n });\n\n // There is not matching definition.\n if (matchingDefinitions.length === 0) {\n const errorMessage = m('inputSchema.validation.noMatchingDefinition', { fieldKey });\n throw new Error(`Input schema is not valid (${errorMessage})`);\n }\n\n // If there is only one matching then we are done and simply compare it.\n if (matchingDefinitions.length === 1) {\n validateAgainstSchemaOrThrow(validator, fieldSchema, matchingDefinitions[0], `schema.properties.${fieldKey}`);\n return;\n }\n\n // If there are more matching definitions then the type is string, and we need to get the right one.\n // If the definition contains \"enum\" property then it's enum type.\n if ((fieldSchema as StringFieldDefinition).enum) {\n const definition = matchingDefinitions.filter((item) => !!item.properties.enum).pop();\n if (!definition) throw new Error('Input schema validation failed to find \"enum property\" definition');\n validateAgainstSchemaOrThrow(validator, fieldSchema, definition, `schema.properties.${fieldKey}.enum`);\n return;\n }\n // Otherwise we use the other definition.\n const definition = matchingDefinitions.filter((item) => !item.properties.enum).pop();\n if (!definition) throw new Error('Input schema validation failed to find other than \"enum property\" definition');\n\n validateAgainstSchemaOrThrow(validator, fieldSchema, definition, `schema.properties.${fieldKey}`);\n}\n\n/**\n * Validates all properties in the input schema\n */\nfunction validateProperties(inputSchema: InputSchemaBaseChecked, validator: Ajv): asserts inputSchema is InputSchema {\n Object.entries(inputSchema.properties).forEach(([fieldKey, fieldSchema]) => (\n validateField(validator, fieldSchema, fieldKey)),\n );\n}\n\n/**\n * Validates that all required fields are present in properties list\n */\nexport function validateExistenceOfRequiredFields(inputSchema: InputSchema) {\n // If the input schema does not have any required fields, we do not need to validate them\n if (!inputSchema?.required?.length) return;\n\n Object.values(inputSchema?.required).forEach((fieldKey) => {\n // If the required field is present in the list of properties, we can check the next one\n if (inputSchema?.properties[fieldKey as string]) return;\n\n // The required field is not defined in list of properties. Which means the schema is not valid.\n throw new Error(m('inputSchema.validation.missingRequiredField', { fieldKey }));\n });\n}\n\n/**\n * This function validates given input schema first just for basic structure then each field one by one,\n * then checks that all required fields are present and finally checks fully against the whole schema.\n *\n * This way we get the most accurate error message for user.\n */\nexport function validateInputSchema(validator: Ajv, inputSchema: Record<string, unknown>): asserts inputSchema is InputSchema {\n // First validate just basic structure without fields.\n validateBasicStructure(validator, inputSchema);\n\n // Then validate each field separately.\n validateProperties(inputSchema, validator);\n\n // Next validate if required fields are actually present in the schema\n validateExistenceOfRequiredFields(inputSchema);\n\n // Finally just to be sure run validation against the whole schema.\n validateAgainstSchemaOrThrow(validator, inputSchema, schema, 'schema');\n}\n","import { PROXY_URL_REGEX, URL_REGEX } from '@apify/consts';\nimport { countries } from 'countries-list';\nimport { ValidateFunction } from 'ajv';\nimport { parse } from 'acorn-loose';\nimport { m } from './intl';\nimport { parseAjvError } from './input_schema';\n\n/**\n * Validates input field configured with proxy editor\n * @param fieldKey Proxy field value\n * @param value Proxy field value\n * @param [isRequired] Whether the field is required or not\n * @param [options] Information about proxy groups availability\n * @param [options.hasAutoProxyGroups] Informs validation whether user has atleast one proxy group available in auto mode\n * @param [options.availableProxyGroups] List of available proxy groups\n * @param [options.disabledProxyGroups] Object with groupId as key and error message as value (mostly for residential/SERP)\n */\nfunction validateProxyField(\n fieldKey: Record<string, unknown>,\n value: Record<string, any>,\n isRequired = false,\n options: { hasAutoProxyGroups?: boolean; availableProxyGroups?: string[]; disabledProxyGroups?: Record<string, unknown> } | null = null,\n) {\n const fieldErrors: any[] = [];\n if (isRequired) {\n // Nullable error is already handled by AJV\n if (value === null) return fieldErrors;\n if (!value) {\n const message = m('inputSchema.validation.required', { rootName: 'input', fieldKey });\n fieldErrors.push(message);\n return fieldErrors;\n }\n\n const { useApifyProxy, proxyUrls } = value;\n if (!useApifyProxy && (!Array.isArray(proxyUrls) || proxyUrls.length === 0)) {\n fieldErrors.push(m('inputSchema.validation.proxyRequired', { rootName: 'input', fieldKey }));\n return fieldErrors;\n }\n }\n\n // Input is not required, so missing value is valid\n if (!value) return fieldErrors;\n\n const { useApifyProxy, proxyUrls, apifyProxyGroups, apifyProxyCountry } = value;\n\n if (!useApifyProxy && Array.isArray(proxyUrls)) {\n let invalidUrl = false;\n proxyUrls.forEach((url) => {\n if (!PROXY_URL_REGEX.test(url.trim())) invalidUrl = url.trim();\n });\n if (invalidUrl) {\n fieldErrors.push(m('inputSchema.validation.customProxyInvalid', { invalidUrl }));\n }\n }\n\n // Apify proxy country can be set only when using Apify proxy\n if (!useApifyProxy && apifyProxyCountry) {\n fieldErrors.push(m('inputSchema.validation.apifyProxyCountryWithoutApifyProxyForbidden'));\n }\n\n // If Apify proxy is not used skip additional checks\n if (!useApifyProxy) return fieldErrors;\n\n // If Apify proxy is used, check if there is a selected country and if so, check that it's valid (empty or a valid country code)\n if (apifyProxyCountry && !countries[apifyProxyCountry]) {\n fieldErrors.push(m('inputSchema.validation.apifyProxyCountryInvalid', { invalidCountry: apifyProxyCountry }));\n }\n\n // If options are not provided skip additional checks\n if (!options) return fieldErrors;\n\n // if apifyProxyGroups exists it must be an array of strings\n const isStringsArray = (array: Array<string>) => array.every((item) => typeof item === 'string');\n if (apifyProxyGroups && !(Array.isArray(apifyProxyGroups) && isStringsArray(apifyProxyGroups))) {\n fieldErrors.push(m('inputSchema.validation.proxyGroupMustBeArrayOfStrings', { rootName: 'input', fieldKey }));\n return fieldErrors;\n }\n\n const selectedProxyGroups = (apifyProxyGroups || []);\n\n // Auto mode, check that user has access to alteast one proxy group usable in this mode\n if (!selectedProxyGroups.length && !options.hasAutoProxyGroups) {\n fieldErrors.push(m('inputSchema.validation.noAvailableAutoProxy'));\n return fieldErrors;\n }\n\n // Check if proxy groups selected by user are available to him\n const availableProxyGroupsById = {};\n (options.availableProxyGroups || []).forEach((group) => { availableProxyGroupsById[group] = true; });\n const unavailableProxyGroups = selectedProxyGroups.filter((group: string) => !availableProxyGroupsById[group]);\n\n if (unavailableProxyGroups.length) {\n fieldErrors.push(m('inputSchema.validation.proxyGroupsNotAvailable', {\n rootName: 'input',\n fieldKey,\n groups: unavailableProxyGroups.join(', '),\n }));\n }\n\n // Check if any of the proxy groups are blocked and if yes then output the associated message\n const blockedProxyGroupsById = options.disabledProxyGroups || {};\n selectedProxyGroups\n .filter((group: string) => blockedProxyGroupsById[group])\n .forEach((blockedGroup: string) => {\n fieldErrors.push(blockedProxyGroupsById[blockedGroup]);\n });\n\n return fieldErrors;\n}\n\n/**\n * Uses AJV validator to validate input with input schema and then\n * does custom validation for our own properties (nullable, patternKey, patternValue)\n * @param validator Initialized AJV validator\n * @param inputSchema Valid input schema in object\n * @param input Input object to be validated\n * @param options (Optional) Additional validation configuration for certain fields\n */\nexport function validateInputUsingValidator(\n validator: ValidateFunction,\n inputSchema: Record<string, any>,\n input: Record<string, unknown>,\n options: Record<string, any> = {},\n) {\n const isValid = validator(input); // Check if input is valid based on schema values\n\n const { properties } = inputSchema;\n const required = inputSchema.required || [];\n\n let errors: { fieldKey: string, message: string }[] = [];\n // Process AJV validation errors\n if (!isValid) {\n errors = validator.errors!\n .map((error) => parseAjvError(error, 'input', properties, input))\n .filter((error) => !!error) as any[];\n }\n\n Object.keys(properties).forEach((property) => {\n const value = input[property] as Record<string, any>;\n const { type, editor, patternKey, patternValue } = properties[property];\n const fieldErrors = [];\n // Check that proxy is required, if yes, valides that it's correctly setup\n if (type === 'object' && editor === 'proxy') {\n const proxyValidationErrors = validateProxyField(property as any, value, required.includes(property), options.proxy);\n proxyValidationErrors.forEach((error) => {\n fieldErrors.push(error);\n });\n }\n // Check that array items fit patternKey and patternValue\n if (type === 'array' && value && Array.isArray(value)) {\n if (editor === 'requestListSources') {\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!item) invalidIndexes.push(index);\n else if (!item.url && !item.requestsFromUrl) invalidIndexes.push(index);\n else if (item.url && !URL_REGEX.test(item.url)) invalidIndexes.push(index);\n else if (item.requestsFromUrl && !URL_REGEX.test(item.requestsFromUrl)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.requestListSourcesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n }));\n }\n }\n // If patternKey is provided, then validate keys of objects in array\n if (patternKey && editor === 'keyValue') {\n const check = new RegExp(patternKey);\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!check.test(item.key)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.arrayKeysInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n pattern: patternKey,\n }));\n }\n }\n // If patternValue is provided and editor is keyValue, then validate values of objecs in array\n if (patternValue && editor === 'keyValue') {\n const check = new RegExp(patternValue);\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!check.test(item.value)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.arrayValuesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n pattern: patternValue,\n }));\n }\n // If patternValue is provided and editor is stringList, then validate each item in array\n } else if (patternValue && editor === 'stringList') {\n const check = new RegExp(patternValue);\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!check.test(item)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.arrayValuesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n pattern: patternValue,\n }));\n }\n }\n }\n // Check that object items fit patternKey and patternValue\n if (type === 'object' && value) {\n if (patternKey) {\n const check = new RegExp(patternKey);\n const invalidKeys: any[] = [];\n Object.keys(value).forEach((key) => {\n if (!check.test(key)) invalidKeys.push(key);\n });\n if (invalidKeys.length) {\n fieldErrors.push(m('inputSchema.validation.objectKeysInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidKeys: invalidKeys.join(','),\n pattern: patternKey,\n }));\n }\n }\n if (patternValue) {\n const check = new RegExp(patternValue);\n const invalidKeys: any[] = [];\n Object.keys(value).forEach((key) => {\n const propertyValue = value[key];\n if (typeof propertyValue !== 'string' || !check.test(propertyValue)) invalidKeys.push(key);\n });\n if (invalidKeys.length) {\n fieldErrors.push(m('inputSchema.validation.objectValuesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidKeys: invalidKeys.join(','),\n pattern: patternValue,\n }));\n }\n }\n }\n if (fieldErrors.length > 0) {\n const message = fieldErrors.join(', ');\n errors.push({ fieldKey: property, message });\n }\n });\n\n return errors;\n}\n\n/**\n * This functions parses all given JSON and then takes each of the jsFields.\n * Then if the field:\n * - is valid JS single function it replaces its single line string with a function delacation.\n * - is valid multiline JS code then replaces its single line string with `multiline` string\n * Then stringifies the code with given number of jsonSpacing spaces and finally prefixes whole\n * stringified JSON except the first line with globalSpacing spaces.\n */\nexport function makeInputJsFieldsReadable(json: string, jsFields: string[], jsonSpacing = 4, globalSpacing = 0): string {\n const parsedJson = JSON.parse(json);\n const replacements: Record<string, any> = {};\n\n jsFields.forEach((field) => {\n let maybeFunction = parsedJson[field];\n if (!maybeFunction || typeof maybeFunction !== 'string') return;\n\n let ast;\n try {\n ast = parse(maybeFunction, { ecmaVersion: 'latest' });\n } catch (err) {\n // Don't do anything in a case of invalid JS code.\n return;\n }\n\n const isMultiline = maybeFunction.includes('\\n');\n const isSingleFunction = ast\n && ast.body.length === 1\n && (\n ast.body[0].type === 'FunctionDeclaration'\n || (ast.body[0].type === 'ExpressionStatement' && ast.body[0].expression.type === 'ArrowFunctionExpression')\n );\n\n // If it's not a function declaration or multiline JS code then we do nothing.\n if (!isSingleFunction && !isMultiline) return;\n\n const spaces = (new Array(isSingleFunction ? jsonSpacing : jsonSpacing * 2)).fill(' ').join('');\n maybeFunction = maybeFunction\n .split('\\n').join(`\\n${spaces}`) // This prefixes each line with spaces.\n .trim(); // Trim whitespace on both sides\n\n const replacementValue = isSingleFunction\n ? maybeFunction.replace(/[;]+$/g, '') // Remove trailing semicolons\n : `\\`${maybeFunction}\\``;\n const replacementToken = `<<<REPLACEMENT_TOKEN:${Math.random()}>>>`;\n replacements[replacementToken] = replacementValue;\n parsedJson[field] = replacementToken;\n });\n\n let niceJson = JSON.stringify(parsedJson, null, jsonSpacing);\n\n Object.entries(replacements).forEach(([replacementToken, replacementValue]) => {\n niceJson = niceJson.replace(`\"${replacementToken}\"`, replacementValue);\n });\n\n const globalSpaces = (new Array(globalSpacing)).fill(' ').join('');\n niceJson = niceJson.split('\\n').join(`\\n${globalSpaces}`);\n\n return niceJson;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAM,cAAc;AAAA,EAChB,kCACI;AAAA,EACJ,mCACI;AAAA,EACJ,wCACI;AAAA,EACJ,oDACI;AAAA,EACJ,2CACI;AAAA,EACJ,6CACI;AAAA,EACJ,4CACI;AAAA,EACJ,8CACI;AAAA,EACJ,6CACI;AAAA,EACJ,kDACI;AAAA,EACJ,6CACI;AAAA,EACJ,mDACI;AAAA,EACJ,sEACI;AAAA,EACJ,+CACI;AAAA,EACJ,+CACI;AAAA,EACJ,+CACI;AAAA,EACJ,yDACI;AACR;AAKO,SAAS,EAAE,UAAkB,WAAiC;AACjE,MAAI,OAAO,YAAY,QAAQ;AAC/B,MAAI,CAAC;AAAM,WAAO;AAElB,MAAI,WAAW;AACX,WAAO,KAAK,SAAS,EAAE,QAAQ,CAAC,iBAAiB;AAC7C,aAAO,KAAK,MAAM,IAAI,YAAY,GAAG,EAAE,KAAK,UAAU,YAAY,CAAC;AAAA,IACvE,CAAC;AAAA,EACL;AAEA,SAAO;AACX;AAXgB;;;ACxChB;AAAA,EACI,OAAS;AAAA,EACT,MAAQ;AAAA,EACR,YAAc;AAAA,IACV,SAAW;AAAA,MACP,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yB,IAAI,KAAK,CAAC,EAAE,WAAW,SAAS;AAI1F,QAAI,CAAC,oBAAoB,CAAC;AAAa;AAEvC,UAAM,SAAU,IAAI,MAAM,mBAAmB,cAAc,cAAc,CAAC,EAAG,KAAK,GAAG,EAAE,KAAK,EAAE;AAC9F,oBAAgB,cACX,MAAM,IAAI,EAAE,KAAK;AAAA,EAAK,MAAM,EAAE,EAC9B,KAAK;AAEV,UAAM,mBAAmB,mBACnB,cAAc,QAAQ,UAAU,EAAE,IAClC,KAAK,aAAa;AACxB,UAAM,mBAAmB,wBAAwB,KAAK,OAAO,CAAC;AAC9D,iBAAa,gBAAgB,IAAI;AACjC,eAAW,KAAK,IAAI;AAAA,EACxB,CAAC;AAED,MAAI,WAAW,KAAK,UAAU,YAAY,MAAM,WAAW;AAE3D,SAAO,QAAQ,YAAY,EAAE,QAAQ,CAAC,CAAC,kBAAkB,gBAAgB,MAAM;AAC3E,eAAW,SAAS,QAAQ,IAAI,gBAAgB,KAAK,gBAAgB;AAAA,EACzE,CAAC;AAED,QAAM,eAAgB,IAAI,MAAM,aAAa,EAAG,KAAK,GAAG,EAAE,KAAK,EAAE;AACjE,aAAW,SAAS,MAAM,IAAI,EAAE,KAAK;AAAA,EAAK,YAAY,EAAE;AAExD,SAAO;AACX;AAlDgB;","names":["definition","useApifyProxy","proxyUrls"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/intl.ts","../../src/schema.json","../../src/input_schema.ts","../../src/utilities.ts"],"sourcesContent":["export * from './intl';\nexport * from './input_schema';\nexport {\n StringFieldDefinition,\n BooleanFieldDefinition,\n IntegerFieldDefinition,\n ObjectFieldDefinition,\n ArrayFieldDefinition,\n MixedFieldDefinition,\n FieldDefinition,\n InputSchema,\n} from './types';\nexport * from './utilities';\n","const intlStrings = {\n 'inputSchema.validation.generic':\n 'Field {rootName}.{fieldKey} {message}',\n 'inputSchema.validation.required':\n 'Field {rootName}.{fieldKey} is required',\n 'inputSchema.validation.proxyRequired':\n 'Field {rootName}.{fieldKey} is required. Please provide custom proxy URLs or use Apify Proxy.',\n 'inputSchema.validation.requestListSourcesInvalid':\n 'Items in {rootName}.{fieldKey} at positions [{invalidIndexes}] do not contain valid URLs',\n 'inputSchema.validation.arrayKeysInvalid':\n 'Keys in {rootName}.{fieldKey} at positions [{invalidIndexes}] must match regular expression \"{pattern}\"',\n 'inputSchema.validation.arrayValuesInvalid':\n 'Values in {rootName}.{fieldKey} at positions [{invalidIndexes}] must match regular expression \"{pattern}\"',\n 'inputSchema.validation.objectKeysInvalid':\n 'Keys [{invalidKeys}] in {rootName}.{fieldKey} must match regular expression \"{pattern}',\n 'inputSchema.validation.objectValuesInvalid':\n 'Keys [{invalidKeys}] in {rootName}.{fieldKey} must have string value which matches regular expression \"{pattern}\"',\n 'inputSchema.validation.additionalProperty':\n 'Property {rootName}.{fieldKey} is not allowed.',\n 'inputSchema.validation.proxyGroupsNotAvailable':\n 'You currently do not have access to proxy groups: {groups}',\n 'inputSchema.validation.customProxyInvalid':\n 'Proxy URL \"{invalidUrl}\" has invalid format, it must be http[s]://[username[:password]]@hostname:port.',\n 'inputSchema.validation.apifyProxyCountryInvalid':\n 'Country code \"{invalidCountry}\" is invalid. Only ISO 3166-1 alpha-2 country codes are supported.',\n 'inputSchema.validation.apifyProxyCountryWithoutApifyProxyForbidden':\n 'The country for Apify Proxy can be specified only when using Apify Proxy.',\n 'inputSchema.validation.noAvailableAutoProxy':\n 'Currently you do not have access to any proxy group usable in automatic mode.',\n 'inputSchema.validation.noMatchingDefinition':\n 'Field schema.properties.{fieldKey} is not matching any input schema type definition. Please make sure that it\\'s type is valid.',\n 'inputSchema.validation.missingRequiredField':\n 'Field schema.properties.{fieldKey} does not exist, but it is specified in schema.required. Either define the field or remove it from schema.required.',\n 'inputSchema.validation.proxyGroupMustBeArrayOfStrings':\n 'Field {rootName}.{fieldKey}.apifyProxyGroups must be an array of strings.',\n};\n\n/**\n * Helper function to simulate intl formatMessage function\n */\nexport function m(stringId: string, variables?: Record<string, any>) {\n let text = intlStrings[stringId as keyof typeof intlStrings];\n if (!text) return stringId;\n\n if (variables) {\n Object.keys(variables).forEach((variableName) => {\n text = text.split(`{${variableName}}`).join(variables[variableName]);\n });\n }\n\n return text;\n}\n","{\n \"title\": \"JSON schema of Apify Actor INPUT_SCHEMA.json\",\n \"type\": \"object\",\n \"properties\": {\n \"$schema\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": \"string\"\n },\n \"schemaVersion\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 1\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"enum\": [\"object\"]\n },\n \"required\": {\n \"type\": \"array\",\n \"minItems\": 0,\n \"items\": { \"type\": \"string\" },\n \"uniqueItems\": true\n },\n \"additionalProperties\": {\n \"type\": \"boolean\"\n },\n \"properties\": {\n \"type\": \"object\",\n \"patternProperties\": {\n \"^\": {\n \"oneOf\": [\n { \"$ref\": \"#/definitions/stringProperty\" },\n { \"$ref\": \"#/definitions/stringEnumProperty\" },\n { \"$ref\": \"#/definitions/arrayProperty\" },\n { \"$ref\": \"#/definitions/objectProperty\" },\n { \"$ref\": \"#/definitions/integerProperty\" },\n { \"$ref\": \"#/definitions/booleanProperty\" },\n { \"$ref\": \"#/definitions/anyProperty\" }\n ]\n }\n }\n }\n },\n \"additionalProperties\": false,\n \"required\": [\"title\", \"type\", \"properties\", \"schemaVersion\"],\n \"definitions\": {\n \"stringEnumProperty\": {\n \"title\": \"Enum property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"editor\": { \"enum\": [\"select\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"string\" },\n \"prefill\": { \"type\": \"string\" },\n \"example\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" },\n \"enum\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"minItems\": 1,\n \"uniqueItems\": true\n },\n \"enumTitles\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"minItems\": 1\n }\n },\n \"required\": [\"type\", \"title\", \"description\", \"enum\"]\n },\n \"stringProperty\": {\n \"title\": \"String property\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"editor\": { \"enum\": [\"javascript\", \"python\", \"textfield\", \"textarea\", \"datepicker\", \"hidden\", \"dataset\", \"keyValueStore\", \"requestQueue\"] },\n \"isSecret\": { \"type\": \"boolean\" }\n },\n \"required\": [\"type\", \"title\", \"description\", \"editor\"],\n \"if\": {\n \"properties\": {\n \"isSecret\": {\n \"not\": {\n \"const\": true\n }\n }\n }\n },\n \"then\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"string\" },\n \"prefill\": { \"type\": \"string\" },\n \"example\": { \"type\": \"string\" },\n \"pattern\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minLength\": { \"type\": \"integer\" },\n \"maxLength\": { \"type\": \"integer\" },\n \"editor\": { \"enum\": [\"javascript\", \"python\", \"textfield\", \"textarea\", \"datepicker\", \"hidden\", \"dataset\", \"keyValueStore\", \"requestQueue\"] },\n \"isSecret\": { \"type\": \"boolean\" },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n }\n },\n \"else\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"example\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"editor\": { \"enum\": [\"textfield\", \"textarea\", \"hidden\"] },\n \"isSecret\": { \"type\": \"boolean\" },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n }\n }\n },\n \"arrayProperty\": {\n \"title\": \"Array property\",\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"enum\": [\"array\"] },\n \"editor\": { \"enum\": [\"json\", \"requestListSources\", \"pseudoUrls\", \"globs\", \"keyValue\", \"stringList\", \"select\", \"hidden\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"array\" },\n \"prefill\": { \"type\": \"array\" },\n \"example\": { \"type\": \"array\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minItems\": { \"type\": \"integer\" },\n \"maxItems\": { \"type\": \"integer\" },\n \"uniqueItems\": { \"type\": \"boolean\" },\n\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"additionalProperties\": true,\n \"required\": [\"type\", \"title\", \"description\", \"editor\"],\n \"if\": {\n \"properties\": {\n \"editor\": { \"const\": \"select\" }\n }\n },\n \"then\": {\n \"required\": [\"items\"],\n \"properties\": {\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"enum\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"uniqueItems\": true\n },\n \"enumTitles\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n }\n },\n \"required\": [\"type\", \"enum\"]\n }\n }\n },\n \"else\": {\n \"properties\": {\n \"placeholderKey\": { \"type\": \"string\" },\n \"placeholderValue\": { \"type\": \"string\" },\n \"patternKey\": { \"type\": \"string\" },\n \"patternValue\": { \"type\": \"string\" }\n }\n }\n },\n \"objectProperty\": {\n \"title\": \"Object property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"object\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"object\" },\n \"prefill\": { \"type\": \"object\" },\n \"example\": { \"type\": \"object\" },\n \"patternKey\": { \"type\": \"string\" },\n \"patternValue\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minProperties\": { \"type\": \"integer\" },\n \"maxProperties\": { \"type\": \"integer\" },\n\n \"editor\": { \"enum\": [\"json\", \"proxy\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\", \"editor\"]\n },\n \"integerProperty\": {\n \"title\": \"Integer property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"integer\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"integer\" },\n \"prefill\": { \"type\": \"integer\" },\n \"example\": { \"type\": \"integer\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minimum\": { \"type\": \"integer\" },\n \"maximum\": { \"type\": \"integer\" },\n \"unit\": { \"type\": \"string\" },\n \"editor\": { \"enum\": [\"number\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\"]\n },\n \"booleanProperty\": {\n \"title\": \"Boolean property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"boolean\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"boolean\" },\n \"prefill\": { \"type\": \"boolean\" },\n \"example\": { \"type\": \"boolean\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"groupCaption\": { \"type\": \"string\" },\n \"groupDescription\": { \"type\": \"string\" },\n \"editor\": { \"enum\": [\"checkbox\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\"]\n },\n \"anyProperty\": {\n \"title\": \"Any property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": {\n \"type\": [\"array\"],\n \"items\": {\n \"type\": \"string\",\n \"enum\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"]\n },\n \"uniqueItems\": true,\n \"additionalItems\": false,\n \"minItems\": 1\n },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"] },\n \"prefill\": { \"type\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"] },\n \"example\": { \"type\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"] },\n \"nullable\": { \"type\": \"boolean\" },\n \"editor\": { \"enum\": [\"json\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\", \"editor\"]\n }\n }\n}\n","import Ajv, { ErrorObject, Schema } from 'ajv';\n\nimport { m } from './intl';\nimport schema from './schema.json';\nimport {\n FieldDefinition,\n InputSchema,\n InputSchemaBaseChecked,\n StringFieldDefinition,\n} from './types';\n\nexport { schema as inputSchema };\n\nconst { definitions } = schema;\n\n/**\n * This function parses AJV error and transforms it into a readable string.\n *\n * @param error An error as returned from AJV.\n * @param rootName Usually 'input' or 'schema' based on if we are passing the input or schema.\n * @param properties (Used only when parsing input errors) List of input schema properties.\n * @param input (Used only when parsing input errors) Actual input that is being parsed.\n * @returns {null|{fieldKey: *, message: *}}\n */\nexport function parseAjvError(\n error: ErrorObject,\n rootName: string,\n properties: Record<string, { nullable?: boolean }> = {},\n input: Record<string, unknown> = {},\n): { fieldKey: string; message: string } | null {\n // There are 3 possible errors comming from validation:\n // - either { keword: 'anything', instancePath: '/someField', message: 'error message that we can use' }\n // - or { keyword: 'additionalProperties', params: { additionalProperty: 'field' }, message: 'must NOT have additional properties' }\n // - or { keyword: 'required', instancePath: '', params.missingProperty: 'someField' }\n\n let fieldKey: string;\n let message: string;\n\n // If error is with keyword type, it means that type of input is incorrect\n // this can mean that provided value is null\n if (error.keyword === 'type') {\n fieldKey = error.instancePath.split('/').pop()!;\n // Check if value is null and field is nullable, if yes, then skip this error\n if (properties[fieldKey] && properties[fieldKey].nullable && input[fieldKey] === null) {\n return null;\n }\n message = m('inputSchema.validation.generic', { rootName, fieldKey, message: error.message });\n } else if (error.keyword === 'required') {\n fieldKey = error.params.missingProperty;\n message = m('inputSchema.validation.required', { rootName, fieldKey });\n } else if (error.keyword === 'additionalProperties') {\n fieldKey = error.params.additionalProperty;\n message = m('inputSchema.validation.additionalProperty', { rootName, fieldKey });\n } else if (error.keyword === 'enum') {\n fieldKey = error.instancePath.split('/').pop()!;\n const errorMessage = `${error.message}: \"${error.params.allowedValues.join('\", \"')}\"`;\n message = m('inputSchema.validation.generic', { rootName, fieldKey, message: errorMessage });\n } else {\n fieldKey = error.instancePath.split('/').pop()!;\n message = m('inputSchema.validation.generic', { rootName, fieldKey, message: error.message });\n }\n\n return { fieldKey, message };\n}\n\n/**\n * Validates given object against schema and throws a human-readable error.\n */\nconst validateAgainstSchemaOrThrow = (validator: Ajv, obj: Record<string, unknown>, inputSchema: Schema, rootName: string) => {\n if (validator.validate(inputSchema, obj)) return;\n\n const errorMessage = parseAjvError(validator.errors![0], rootName)?.message;\n throw new Error(`Input schema is not valid (${errorMessage})`);\n};\n\n/**\n * This validates given object only against the basic input schema without checking the particular fields.\n * We override schema.properties.properties not to validate field definitions.\n */\nfunction validateBasicStructure(validator: Ajv, obj: Record<string, unknown>): asserts obj is InputSchemaBaseChecked {\n const schemaWithoutProperties = {\n ...schema,\n properties: { ...schema.properties, properties: { type: 'object' } as any },\n };\n validateAgainstSchemaOrThrow(validator, obj, schemaWithoutProperties, 'schema');\n}\n\n/**\n * Validates particular field against it's schema.\n */\nfunction validateField(validator: Ajv, fieldSchema: Record<string, unknown>, fieldKey: string): asserts fieldSchema is FieldDefinition {\n const matchingDefinitions = Object\n .values<any>(definitions) // cast as any, as the code in first branch seems to be invalid\n .filter((definition) => {\n return definition.properties.type.enum\n // This is a normal case where fieldSchema.type can be only one possible value matching definition.properties.type.enum.0\n ? definition.properties.type.enum[0] === fieldSchema.type\n // This is a type \"Any\" where fieldSchema.type is an array of possible values\n : Array.isArray(fieldSchema.type);\n });\n\n // There is not matching definition.\n if (matchingDefinitions.length === 0) {\n const errorMessage = m('inputSchema.validation.noMatchingDefinition', { fieldKey });\n throw new Error(`Input schema is not valid (${errorMessage})`);\n }\n\n // If there is only one matching then we are done and simply compare it.\n if (matchingDefinitions.length === 1) {\n validateAgainstSchemaOrThrow(validator, fieldSchema, matchingDefinitions[0], `schema.properties.${fieldKey}`);\n return;\n }\n\n // If there are more matching definitions then the type is string, and we need to get the right one.\n // If the definition contains \"enum\" property then it's enum type.\n if ((fieldSchema as StringFieldDefinition).enum) {\n const definition = matchingDefinitions.filter((item) => !!item.properties.enum).pop();\n if (!definition) throw new Error('Input schema validation failed to find \"enum property\" definition');\n validateAgainstSchemaOrThrow(validator, fieldSchema, definition, `schema.properties.${fieldKey}.enum`);\n return;\n }\n // Otherwise we use the other definition.\n const definition = matchingDefinitions.filter((item) => !item.properties.enum).pop();\n if (!definition) throw new Error('Input schema validation failed to find other than \"enum property\" definition');\n\n validateAgainstSchemaOrThrow(validator, fieldSchema, definition, `schema.properties.${fieldKey}`);\n}\n\n/**\n * Validates all properties in the input schema\n */\nfunction validateProperties(inputSchema: InputSchemaBaseChecked, validator: Ajv): asserts inputSchema is InputSchema {\n Object.entries(inputSchema.properties).forEach(([fieldKey, fieldSchema]) => (\n validateField(validator, fieldSchema, fieldKey)),\n );\n}\n\n/**\n * Validates that all required fields are present in properties list\n */\nexport function validateExistenceOfRequiredFields(inputSchema: InputSchema) {\n // If the input schema does not have any required fields, we do not need to validate them\n if (!inputSchema?.required?.length) return;\n\n Object.values(inputSchema?.required).forEach((fieldKey) => {\n // If the required field is present in the list of properties, we can check the next one\n if (inputSchema?.properties[fieldKey as string]) return;\n\n // The required field is not defined in list of properties. Which means the schema is not valid.\n throw new Error(m('inputSchema.validation.missingRequiredField', { fieldKey }));\n });\n}\n\n/**\n * This function validates given input schema first just for basic structure then each field one by one,\n * then checks that all required fields are present and finally checks fully against the whole schema.\n *\n * This way we get the most accurate error message for user.\n */\nexport function validateInputSchema(validator: Ajv, inputSchema: Record<string, unknown>): asserts inputSchema is InputSchema {\n // First validate just basic structure without fields.\n validateBasicStructure(validator, inputSchema);\n\n // Then validate each field separately.\n validateProperties(inputSchema, validator);\n\n // Next validate if required fields are actually present in the schema\n validateExistenceOfRequiredFields(inputSchema);\n\n // Finally just to be sure run validation against the whole schema.\n validateAgainstSchemaOrThrow(validator, inputSchema, schema, 'schema');\n}\n","import { PROXY_URL_REGEX, URL_REGEX } from '@apify/consts';\nimport { parse } from 'acorn-loose';\nimport { ValidateFunction } from 'ajv';\nimport { countries } from 'countries-list';\n\nimport { parseAjvError } from './input_schema';\nimport { m } from './intl';\n\n/**\n * Validates input field configured with proxy editor\n * @param fieldKey Proxy field value\n * @param value Proxy field value\n * @param [isRequired] Whether the field is required or not\n * @param [options] Information about proxy groups availability\n * @param [options.hasAutoProxyGroups] Informs validation whether user has atleast one proxy group available in auto mode\n * @param [options.availableProxyGroups] List of available proxy groups\n * @param [options.disabledProxyGroups] Object with groupId as key and error message as value (mostly for residential/SERP)\n */\nfunction validateProxyField(\n fieldKey: Record<string, unknown>,\n value: Record<string, any>,\n isRequired = false,\n options: { hasAutoProxyGroups?: boolean; availableProxyGroups?: string[]; disabledProxyGroups?: Record<string, unknown> } | null = null,\n) {\n const fieldErrors: any[] = [];\n if (isRequired) {\n // Nullable error is already handled by AJV\n if (value === null) return fieldErrors;\n if (!value) {\n const message = m('inputSchema.validation.required', { rootName: 'input', fieldKey });\n fieldErrors.push(message);\n return fieldErrors;\n }\n\n const { useApifyProxy, proxyUrls } = value;\n if (!useApifyProxy && (!Array.isArray(proxyUrls) || proxyUrls.length === 0)) {\n fieldErrors.push(m('inputSchema.validation.proxyRequired', { rootName: 'input', fieldKey }));\n return fieldErrors;\n }\n }\n\n // Input is not required, so missing value is valid\n if (!value) return fieldErrors;\n\n const { useApifyProxy, proxyUrls, apifyProxyGroups, apifyProxyCountry } = value;\n\n if (!useApifyProxy && Array.isArray(proxyUrls)) {\n let invalidUrl = false;\n proxyUrls.forEach((url) => {\n if (!PROXY_URL_REGEX.test(url.trim())) invalidUrl = url.trim();\n });\n if (invalidUrl) {\n fieldErrors.push(m('inputSchema.validation.customProxyInvalid', { invalidUrl }));\n }\n }\n\n // Apify proxy country can be set only when using Apify proxy\n if (!useApifyProxy && apifyProxyCountry) {\n fieldErrors.push(m('inputSchema.validation.apifyProxyCountryWithoutApifyProxyForbidden'));\n }\n\n // If Apify proxy is not used skip additional checks\n if (!useApifyProxy) return fieldErrors;\n\n // If Apify proxy is used, check if there is a selected country and if so, check that it's valid (empty or a valid country code)\n if (apifyProxyCountry && !countries[apifyProxyCountry as keyof typeof countries]) {\n fieldErrors.push(m('inputSchema.validation.apifyProxyCountryInvalid', { invalidCountry: apifyProxyCountry }));\n }\n\n // If options are not provided skip additional checks\n if (!options) return fieldErrors;\n\n // if apifyProxyGroups exists it must be an array of strings\n const isStringsArray = (array: Array<string>) => array.every((item) => typeof item === 'string');\n if (apifyProxyGroups && !(Array.isArray(apifyProxyGroups) && isStringsArray(apifyProxyGroups))) {\n fieldErrors.push(m('inputSchema.validation.proxyGroupMustBeArrayOfStrings', { rootName: 'input', fieldKey }));\n return fieldErrors;\n }\n\n const selectedProxyGroups = (apifyProxyGroups || []);\n\n // Auto mode, check that user has access to alteast one proxy group usable in this mode\n if (!selectedProxyGroups.length && !options.hasAutoProxyGroups) {\n fieldErrors.push(m('inputSchema.validation.noAvailableAutoProxy'));\n return fieldErrors;\n }\n\n // Check if proxy groups selected by user are available to him\n const availableProxyGroupsById = {} as Record<string, boolean>;\n (options.availableProxyGroups || []).forEach((group) => { availableProxyGroupsById[group] = true; });\n const unavailableProxyGroups = selectedProxyGroups.filter((group: string) => !availableProxyGroupsById[group]);\n\n if (unavailableProxyGroups.length) {\n fieldErrors.push(m('inputSchema.validation.proxyGroupsNotAvailable', {\n rootName: 'input',\n fieldKey,\n groups: unavailableProxyGroups.join(', '),\n }));\n }\n\n // Check if any of the proxy groups are blocked and if yes then output the associated message\n const blockedProxyGroupsById = options.disabledProxyGroups || {};\n selectedProxyGroups\n .filter((group: string) => blockedProxyGroupsById[group])\n .forEach((blockedGroup: string) => {\n fieldErrors.push(blockedProxyGroupsById[blockedGroup]);\n });\n\n return fieldErrors;\n}\n\n/**\n * Uses AJV validator to validate input with input schema and then\n * does custom validation for our own properties (nullable, patternKey, patternValue)\n * @param validator Initialized AJV validator\n * @param inputSchema Valid input schema in object\n * @param input Input object to be validated\n * @param options (Optional) Additional validation configuration for certain fields\n */\nexport function validateInputUsingValidator(\n validator: ValidateFunction,\n inputSchema: Record<string, any>,\n input: Record<string, unknown>,\n options: Record<string, any> = {},\n) {\n const isValid = validator(input); // Check if input is valid based on schema values\n\n const { properties } = inputSchema;\n const required = inputSchema.required || [];\n\n let errors: { fieldKey: string, message: string }[] = [];\n // Process AJV validation errors\n if (!isValid) {\n errors = validator.errors!\n .map((error) => parseAjvError(error, 'input', properties, input))\n .filter((error) => !!error) as any[];\n }\n\n Object.keys(properties).forEach((property) => {\n const value = input[property] as Record<string, any>;\n const { type, editor, patternKey, patternValue } = properties[property];\n const fieldErrors = [];\n // Check that proxy is required, if yes, valides that it's correctly setup\n if (type === 'object' && editor === 'proxy') {\n const proxyValidationErrors = validateProxyField(property as any, value, required.includes(property), options.proxy);\n proxyValidationErrors.forEach((error) => {\n fieldErrors.push(error);\n });\n }\n // Check that array items fit patternKey and patternValue\n if (type === 'array' && value && Array.isArray(value)) {\n if (editor === 'requestListSources') {\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!item) invalidIndexes.push(index);\n else if (!item.url && !item.requestsFromUrl) invalidIndexes.push(index);\n else if (item.url && !URL_REGEX.test(item.url)) invalidIndexes.push(index);\n else if (item.requestsFromUrl && !URL_REGEX.test(item.requestsFromUrl)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.requestListSourcesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n }));\n }\n }\n // If patternKey is provided, then validate keys of objects in array\n if (patternKey && editor === 'keyValue') {\n const check = new RegExp(patternKey);\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!check.test(item.key)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.arrayKeysInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n pattern: patternKey,\n }));\n }\n }\n // If patternValue is provided and editor is keyValue, then validate values of objecs in array\n if (patternValue && editor === 'keyValue') {\n const check = new RegExp(patternValue);\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!check.test(item.value)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.arrayValuesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n pattern: patternValue,\n }));\n }\n // If patternValue is provided and editor is stringList, then validate each item in array\n } else if (patternValue && editor === 'stringList') {\n const check = new RegExp(patternValue);\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!check.test(item)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.arrayValuesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n pattern: patternValue,\n }));\n }\n }\n }\n // Check that object items fit patternKey and patternValue\n if (type === 'object' && value) {\n if (patternKey) {\n const check = new RegExp(patternKey);\n const invalidKeys: any[] = [];\n Object.keys(value).forEach((key) => {\n if (!check.test(key)) invalidKeys.push(key);\n });\n if (invalidKeys.length) {\n fieldErrors.push(m('inputSchema.validation.objectKeysInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidKeys: invalidKeys.join(','),\n pattern: patternKey,\n }));\n }\n }\n if (patternValue) {\n const check = new RegExp(patternValue);\n const invalidKeys: any[] = [];\n Object.keys(value).forEach((key) => {\n const propertyValue = value[key];\n if (typeof propertyValue !== 'string' || !check.test(propertyValue)) invalidKeys.push(key);\n });\n if (invalidKeys.length) {\n fieldErrors.push(m('inputSchema.validation.objectValuesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidKeys: invalidKeys.join(','),\n pattern: patternValue,\n }));\n }\n }\n }\n if (fieldErrors.length > 0) {\n const message = fieldErrors.join(', ');\n errors.push({ fieldKey: property, message });\n }\n });\n\n return errors;\n}\n\n/**\n * This functions parses all given JSON and then takes each of the jsFields.\n * Then if the field:\n * - is valid JS single function it replaces its single line string with a function delacation.\n * - is valid multiline JS code then replaces its single line string with `multiline` string\n * Then stringifies the code with given number of jsonSpacing spaces and finally prefixes whole\n * stringified JSON except the first line with globalSpacing spaces.\n */\nexport function makeInputJsFieldsReadable(json: string, jsFields: string[], jsonSpacing = 4, globalSpacing = 0): string {\n const parsedJson = JSON.parse(json);\n const replacements: Record<string, any> = {};\n\n jsFields.forEach((field) => {\n let maybeFunction = parsedJson[field];\n if (!maybeFunction || typeof maybeFunction !== 'string') return;\n\n let ast;\n try {\n ast = parse(maybeFunction, { ecmaVersion: 'latest' });\n } catch (err) {\n // Don't do anything in a case of invalid JS code.\n return;\n }\n\n const isMultiline = maybeFunction.includes('\\n');\n const isSingleFunction = ast\n && ast.body.length === 1\n && (\n ast.body[0].type === 'FunctionDeclaration'\n || (ast.body[0].type === 'ExpressionStatement' && ast.body[0].expression.type === 'ArrowFunctionExpression')\n );\n\n // If it's not a function declaration or multiline JS code then we do nothing.\n if (!isSingleFunction && !isMultiline) return;\n\n const spaces = (new Array(isSingleFunction ? jsonSpacing : jsonSpacing * 2)).fill(' ').join('');\n maybeFunction = maybeFunction\n .split('\\n').join(`\\n${spaces}`) // This prefixes each line with spaces.\n .trim(); // Trim whitespace on both sides\n\n const replacementValue = isSingleFunction\n ? maybeFunction.replace(/[;]+$/g, '') // Remove trailing semicolons\n : `\\`${maybeFunction}\\``;\n const replacementToken = `<<<REPLACEMENT_TOKEN:${Math.random()}>>>`;\n replacements[replacementToken] = replacementValue;\n parsedJson[field] = replacementToken;\n });\n\n let niceJson = JSON.stringify(parsedJson, null, jsonSpacing);\n\n Object.entries(replacements).forEach(([replacementToken, replacementValue]) => {\n niceJson = niceJson.replace(`\"${replacementToken}\"`, replacementValue);\n });\n\n const globalSpaces = (new Array(globalSpacing)).fill(' ').join('');\n niceJson = niceJson.split('\\n').join(`\\n${globalSpaces}`);\n\n return niceJson;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAM,cAAc;AAAA,EAChB,kCACI;AAAA,EACJ,mCACI;AAAA,EACJ,wCACI;AAAA,EACJ,oDACI;AAAA,EACJ,2CACI;AAAA,EACJ,6CACI;AAAA,EACJ,4CACI;AAAA,EACJ,8CACI;AAAA,EACJ,6CACI;AAAA,EACJ,kDACI;AAAA,EACJ,6CACI;AAAA,EACJ,mDACI;AAAA,EACJ,sEACI;AAAA,EACJ,+CACI;AAAA,EACJ,+CACI;AAAA,EACJ,+CACI;AAAA,EACJ,yDACI;AACR;AAKO,SAAS,EAAE,UAAkB,WAAiC;AACjE,MAAI,OAAO,YAAY,QAAoC;AAC3D,MAAI,CAAC,KAAM,QAAO;AAElB,MAAI,WAAW;AACX,WAAO,KAAK,SAAS,EAAE,QAAQ,CAAC,iBAAiB;AAC7C,aAAO,KAAK,MAAM,IAAI,YAAY,GAAG,EAAE,K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C;AAAA,IACxD,SAAS,KAAK;AAEV;AAAA,IACJ;AAEA,UAAM,cAAc,cAAc,SAAS,IAAI;AAC/C,UAAM,mBAAmB,OAClB,IAAI,KAAK,WAAW,MAEnB,IAAI,KAAK,CAAC,EAAE,SAAS,yBACjB,IAAI,KAAK,CAAC,EAAE,SAAS,yBAAyB,IAAI,KAAK,CAAC,EAAE,WAAW,SAAS;AAI1F,QAAI,CAAC,oBAAoB,CAAC,YAAa;AAEvC,UAAM,SAAU,IAAI,MAAM,mBAAmB,cAAc,cAAc,CAAC,EAAG,KAAK,GAAG,EAAE,KAAK,EAAE;AAC9F,oBAAgB,cACX,MAAM,IAAI,EAAE,KAAK;AAAA,EAAK,MAAM,EAAE,EAC9B,KAAK;AAEV,UAAM,mBAAmB,mBACnB,cAAc,QAAQ,UAAU,EAAE,IAClC,KAAK,aAAa;AACxB,UAAM,mBAAmB,wBAAwB,KAAK,OAAO,CAAC;AAC9D,iBAAa,gBAAgB,IAAI;AACjC,eAAW,KAAK,IAAI;AAAA,EACxB,CAAC;AAED,MAAI,WAAW,KAAK,UAAU,YAAY,MAAM,WAAW;AAE3D,SAAO,QAAQ,YAAY,EAAE,QAAQ,CAAC,CAAC,kBAAkB,gBAAgB,MAAM;AAC3E,eAAW,SAAS,QAAQ,IAAI,gBAAgB,KAAK,gBAAgB;AAAA,EACzE,CAAC;AAED,QAAM,eAAgB,IAAI,MAAM,aAAa,EAAG,KAAK,GAAG,EAAE,KAAK,EAAE;AACjE,aAAW,SAAS,MAAM,IAAI,EAAE,KAAK;AAAA,EAAK,YAAY,EAAE;AAExD,SAAO;AACX;AAlDgB;","names":["definition","useApifyProxy","proxyUrls"]}
|
package/cjs/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import Ajv, { ErrorObject, ValidateFunction } from 'ajv';
|
|
|
3
3
|
/**
|
|
4
4
|
* Helper function to simulate intl formatMessage function
|
|
5
5
|
*/
|
|
6
|
-
declare function m(stringId: string, variables?: Record<string, any>):
|
|
6
|
+
declare function m(stringId: string, variables?: Record<string, any>): string;
|
|
7
7
|
|
|
8
8
|
var title = "JSON schema of Apify Actor INPUT_SCHEMA.json";
|
|
9
9
|
var type = "object";
|
|
@@ -165,7 +165,10 @@ var definitions = {
|
|
|
165
165
|
"textfield",
|
|
166
166
|
"textarea",
|
|
167
167
|
"datepicker",
|
|
168
|
-
"hidden"
|
|
168
|
+
"hidden",
|
|
169
|
+
"dataset",
|
|
170
|
+
"keyValueStore",
|
|
171
|
+
"requestQueue"
|
|
169
172
|
]
|
|
170
173
|
},
|
|
171
174
|
isSecret: {
|
|
@@ -229,7 +232,10 @@ var definitions = {
|
|
|
229
232
|
"textfield",
|
|
230
233
|
"textarea",
|
|
231
234
|
"datepicker",
|
|
232
|
-
"hidden"
|
|
235
|
+
"hidden",
|
|
236
|
+
"dataset",
|
|
237
|
+
"keyValueStore",
|
|
238
|
+
"requestQueue"
|
|
233
239
|
]
|
|
234
240
|
},
|
|
235
241
|
isSecret: {
|
|
@@ -674,7 +680,7 @@ type CommonFieldDefinition<T> = {
|
|
|
674
680
|
};
|
|
675
681
|
type StringFieldDefinition = CommonFieldDefinition<string> & {
|
|
676
682
|
type: 'string';
|
|
677
|
-
editor: 'textfield' | 'textarea' | 'javascript' | 'python' | 'select' | 'datepicker' | 'hidden' | 'json';
|
|
683
|
+
editor: 'textfield' | 'textarea' | 'javascript' | 'python' | 'select' | 'datepicker' | 'hidden' | 'json' | 'dataset' | 'keyValueStore' | 'requestQueue';
|
|
678
684
|
pattern?: string;
|
|
679
685
|
minLength?: number;
|
|
680
686
|
maxLength?: number;
|
package/esm/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import Ajv, { ErrorObject, ValidateFunction } from 'ajv';
|
|
|
3
3
|
/**
|
|
4
4
|
* Helper function to simulate intl formatMessage function
|
|
5
5
|
*/
|
|
6
|
-
declare function m(stringId: string, variables?: Record<string, any>):
|
|
6
|
+
declare function m(stringId: string, variables?: Record<string, any>): string;
|
|
7
7
|
|
|
8
8
|
var title = "JSON schema of Apify Actor INPUT_SCHEMA.json";
|
|
9
9
|
var type = "object";
|
|
@@ -165,7 +165,10 @@ var definitions = {
|
|
|
165
165
|
"textfield",
|
|
166
166
|
"textarea",
|
|
167
167
|
"datepicker",
|
|
168
|
-
"hidden"
|
|
168
|
+
"hidden",
|
|
169
|
+
"dataset",
|
|
170
|
+
"keyValueStore",
|
|
171
|
+
"requestQueue"
|
|
169
172
|
]
|
|
170
173
|
},
|
|
171
174
|
isSecret: {
|
|
@@ -229,7 +232,10 @@ var definitions = {
|
|
|
229
232
|
"textfield",
|
|
230
233
|
"textarea",
|
|
231
234
|
"datepicker",
|
|
232
|
-
"hidden"
|
|
235
|
+
"hidden",
|
|
236
|
+
"dataset",
|
|
237
|
+
"keyValueStore",
|
|
238
|
+
"requestQueue"
|
|
233
239
|
]
|
|
234
240
|
},
|
|
235
241
|
isSecret: {
|
|
@@ -674,7 +680,7 @@ type CommonFieldDefinition<T> = {
|
|
|
674
680
|
};
|
|
675
681
|
type StringFieldDefinition = CommonFieldDefinition<string> & {
|
|
676
682
|
type: 'string';
|
|
677
|
-
editor: 'textfield' | 'textarea' | 'javascript' | 'python' | 'select' | 'datepicker' | 'hidden' | 'json';
|
|
683
|
+
editor: 'textfield' | 'textarea' | 'javascript' | 'python' | 'select' | 'datepicker' | 'hidden' | 'json' | 'dataset' | 'keyValueStore' | 'requestQueue';
|
|
678
684
|
pattern?: string;
|
|
679
685
|
minLength?: number;
|
|
680
686
|
maxLength?: number;
|
package/esm/index.mjs
CHANGED
|
@@ -23,8 +23,7 @@ var intlStrings = {
|
|
|
23
23
|
};
|
|
24
24
|
function m(stringId, variables) {
|
|
25
25
|
let text = intlStrings[stringId];
|
|
26
|
-
if (!text)
|
|
27
|
-
return stringId;
|
|
26
|
+
if (!text) return stringId;
|
|
28
27
|
if (variables) {
|
|
29
28
|
Object.keys(variables).forEach((variableName) => {
|
|
30
29
|
text = text.split(`{${variableName}}`).join(variables[variableName]);
|
|
@@ -123,7 +122,7 @@ var schema_default = {
|
|
|
123
122
|
title: { type: "string" },
|
|
124
123
|
description: { type: "string" },
|
|
125
124
|
nullable: { type: "boolean" },
|
|
126
|
-
editor: { enum: ["javascript", "python", "textfield", "textarea", "datepicker", "hidden"] },
|
|
125
|
+
editor: { enum: ["javascript", "python", "textfield", "textarea", "datepicker", "hidden", "dataset", "keyValueStore", "requestQueue"] },
|
|
127
126
|
isSecret: { type: "boolean" }
|
|
128
127
|
},
|
|
129
128
|
required: ["type", "title", "description", "editor"],
|
|
@@ -149,7 +148,7 @@ var schema_default = {
|
|
|
149
148
|
nullable: { type: "boolean" },
|
|
150
149
|
minLength: { type: "integer" },
|
|
151
150
|
maxLength: { type: "integer" },
|
|
152
|
-
editor: { enum: ["javascript", "python", "textfield", "textarea", "datepicker", "hidden"] },
|
|
151
|
+
editor: { enum: ["javascript", "python", "textfield", "textarea", "datepicker", "hidden", "dataset", "keyValueStore", "requestQueue"] },
|
|
153
152
|
isSecret: { type: "boolean" },
|
|
154
153
|
sectionCaption: { type: "string" },
|
|
155
154
|
sectionDescription: { type: "string" }
|
|
@@ -348,8 +347,7 @@ function parseAjvError(error, rootName, properties = {}, input = {}) {
|
|
|
348
347
|
}
|
|
349
348
|
__name(parseAjvError, "parseAjvError");
|
|
350
349
|
var validateAgainstSchemaOrThrow = /* @__PURE__ */ __name((validator, obj, inputSchema, rootName) => {
|
|
351
|
-
if (validator.validate(inputSchema, obj))
|
|
352
|
-
return;
|
|
350
|
+
if (validator.validate(inputSchema, obj)) return;
|
|
353
351
|
const errorMessage = parseAjvError(validator.errors[0], rootName)?.message;
|
|
354
352
|
throw new Error(`Input schema is not valid (${errorMessage})`);
|
|
355
353
|
}, "validateAgainstSchemaOrThrow");
|
|
@@ -375,14 +373,12 @@ function validateField(validator, fieldSchema, fieldKey) {
|
|
|
375
373
|
}
|
|
376
374
|
if (fieldSchema.enum) {
|
|
377
375
|
const definition2 = matchingDefinitions.filter((item) => !!item.properties.enum).pop();
|
|
378
|
-
if (!definition2)
|
|
379
|
-
throw new Error('Input schema validation failed to find "enum property" definition');
|
|
376
|
+
if (!definition2) throw new Error('Input schema validation failed to find "enum property" definition');
|
|
380
377
|
validateAgainstSchemaOrThrow(validator, fieldSchema, definition2, `schema.properties.${fieldKey}.enum`);
|
|
381
378
|
return;
|
|
382
379
|
}
|
|
383
380
|
const definition = matchingDefinitions.filter((item) => !item.properties.enum).pop();
|
|
384
|
-
if (!definition)
|
|
385
|
-
throw new Error('Input schema validation failed to find other than "enum property" definition');
|
|
381
|
+
if (!definition) throw new Error('Input schema validation failed to find other than "enum property" definition');
|
|
386
382
|
validateAgainstSchemaOrThrow(validator, fieldSchema, definition, `schema.properties.${fieldKey}`);
|
|
387
383
|
}
|
|
388
384
|
__name(validateField, "validateField");
|
|
@@ -393,11 +389,9 @@ function validateProperties(inputSchema, validator) {
|
|
|
393
389
|
}
|
|
394
390
|
__name(validateProperties, "validateProperties");
|
|
395
391
|
function validateExistenceOfRequiredFields(inputSchema) {
|
|
396
|
-
if (!inputSchema?.required?.length)
|
|
397
|
-
return;
|
|
392
|
+
if (!inputSchema?.required?.length) return;
|
|
398
393
|
Object.values(inputSchema?.required).forEach((fieldKey) => {
|
|
399
|
-
if (inputSchema?.properties[fieldKey])
|
|
400
|
-
return;
|
|
394
|
+
if (inputSchema?.properties[fieldKey]) return;
|
|
401
395
|
throw new Error(m("inputSchema.validation.missingRequiredField", { fieldKey }));
|
|
402
396
|
});
|
|
403
397
|
}
|
|
@@ -412,13 +406,12 @@ __name(validateInputSchema, "validateInputSchema");
|
|
|
412
406
|
|
|
413
407
|
// src/utilities.ts
|
|
414
408
|
import { PROXY_URL_REGEX, URL_REGEX } from "@apify/consts";
|
|
415
|
-
import { countries } from "countries-list";
|
|
416
409
|
import { parse } from "acorn-loose";
|
|
410
|
+
import { countries } from "countries-list";
|
|
417
411
|
function validateProxyField(fieldKey, value, isRequired = false, options = null) {
|
|
418
412
|
const fieldErrors = [];
|
|
419
413
|
if (isRequired) {
|
|
420
|
-
if (value === null)
|
|
421
|
-
return fieldErrors;
|
|
414
|
+
if (value === null) return fieldErrors;
|
|
422
415
|
if (!value) {
|
|
423
416
|
const message = m("inputSchema.validation.required", { rootName: "input", fieldKey });
|
|
424
417
|
fieldErrors.push(message);
|
|
@@ -430,14 +423,12 @@ function validateProxyField(fieldKey, value, isRequired = false, options = null)
|
|
|
430
423
|
return fieldErrors;
|
|
431
424
|
}
|
|
432
425
|
}
|
|
433
|
-
if (!value)
|
|
434
|
-
return fieldErrors;
|
|
426
|
+
if (!value) return fieldErrors;
|
|
435
427
|
const { useApifyProxy, proxyUrls, apifyProxyGroups, apifyProxyCountry } = value;
|
|
436
428
|
if (!useApifyProxy && Array.isArray(proxyUrls)) {
|
|
437
429
|
let invalidUrl = false;
|
|
438
430
|
proxyUrls.forEach((url) => {
|
|
439
|
-
if (!PROXY_URL_REGEX.test(url.trim()))
|
|
440
|
-
invalidUrl = url.trim();
|
|
431
|
+
if (!PROXY_URL_REGEX.test(url.trim())) invalidUrl = url.trim();
|
|
441
432
|
});
|
|
442
433
|
if (invalidUrl) {
|
|
443
434
|
fieldErrors.push(m("inputSchema.validation.customProxyInvalid", { invalidUrl }));
|
|
@@ -446,13 +437,11 @@ function validateProxyField(fieldKey, value, isRequired = false, options = null)
|
|
|
446
437
|
if (!useApifyProxy && apifyProxyCountry) {
|
|
447
438
|
fieldErrors.push(m("inputSchema.validation.apifyProxyCountryWithoutApifyProxyForbidden"));
|
|
448
439
|
}
|
|
449
|
-
if (!useApifyProxy)
|
|
450
|
-
return fieldErrors;
|
|
440
|
+
if (!useApifyProxy) return fieldErrors;
|
|
451
441
|
if (apifyProxyCountry && !countries[apifyProxyCountry]) {
|
|
452
442
|
fieldErrors.push(m("inputSchema.validation.apifyProxyCountryInvalid", { invalidCountry: apifyProxyCountry }));
|
|
453
443
|
}
|
|
454
|
-
if (!options)
|
|
455
|
-
return fieldErrors;
|
|
444
|
+
if (!options) return fieldErrors;
|
|
456
445
|
const isStringsArray = /* @__PURE__ */ __name((array) => array.every((item) => typeof item === "string"), "isStringsArray");
|
|
457
446
|
if (apifyProxyGroups && !(Array.isArray(apifyProxyGroups) && isStringsArray(apifyProxyGroups))) {
|
|
458
447
|
fieldErrors.push(m("inputSchema.validation.proxyGroupMustBeArrayOfStrings", { rootName: "input", fieldKey }));
|
|
@@ -504,14 +493,10 @@ function validateInputUsingValidator(validator, inputSchema, input, options = {}
|
|
|
504
493
|
if (editor === "requestListSources") {
|
|
505
494
|
const invalidIndexes = [];
|
|
506
495
|
value.forEach((item, index) => {
|
|
507
|
-
if (!item)
|
|
508
|
-
|
|
509
|
-
else if (
|
|
510
|
-
|
|
511
|
-
else if (item.url && !URL_REGEX.test(item.url))
|
|
512
|
-
invalidIndexes.push(index);
|
|
513
|
-
else if (item.requestsFromUrl && !URL_REGEX.test(item.requestsFromUrl))
|
|
514
|
-
invalidIndexes.push(index);
|
|
496
|
+
if (!item) invalidIndexes.push(index);
|
|
497
|
+
else if (!item.url && !item.requestsFromUrl) invalidIndexes.push(index);
|
|
498
|
+
else if (item.url && !URL_REGEX.test(item.url)) invalidIndexes.push(index);
|
|
499
|
+
else if (item.requestsFromUrl && !URL_REGEX.test(item.requestsFromUrl)) invalidIndexes.push(index);
|
|
515
500
|
});
|
|
516
501
|
if (invalidIndexes.length) {
|
|
517
502
|
fieldErrors.push(m("inputSchema.validation.requestListSourcesInvalid", {
|
|
@@ -525,8 +510,7 @@ function validateInputUsingValidator(validator, inputSchema, input, options = {}
|
|
|
525
510
|
const check = new RegExp(patternKey);
|
|
526
511
|
const invalidIndexes = [];
|
|
527
512
|
value.forEach((item, index) => {
|
|
528
|
-
if (!check.test(item.key))
|
|
529
|
-
invalidIndexes.push(index);
|
|
513
|
+
if (!check.test(item.key)) invalidIndexes.push(index);
|
|
530
514
|
});
|
|
531
515
|
if (invalidIndexes.length) {
|
|
532
516
|
fieldErrors.push(m("inputSchema.validation.arrayKeysInvalid", {
|
|
@@ -541,8 +525,7 @@ function validateInputUsingValidator(validator, inputSchema, input, options = {}
|
|
|
541
525
|
const check = new RegExp(patternValue);
|
|
542
526
|
const invalidIndexes = [];
|
|
543
527
|
value.forEach((item, index) => {
|
|
544
|
-
if (!check.test(item.value))
|
|
545
|
-
invalidIndexes.push(index);
|
|
528
|
+
if (!check.test(item.value)) invalidIndexes.push(index);
|
|
546
529
|
});
|
|
547
530
|
if (invalidIndexes.length) {
|
|
548
531
|
fieldErrors.push(m("inputSchema.validation.arrayValuesInvalid", {
|
|
@@ -556,8 +539,7 @@ function validateInputUsingValidator(validator, inputSchema, input, options = {}
|
|
|
556
539
|
const check = new RegExp(patternValue);
|
|
557
540
|
const invalidIndexes = [];
|
|
558
541
|
value.forEach((item, index) => {
|
|
559
|
-
if (!check.test(item))
|
|
560
|
-
invalidIndexes.push(index);
|
|
542
|
+
if (!check.test(item)) invalidIndexes.push(index);
|
|
561
543
|
});
|
|
562
544
|
if (invalidIndexes.length) {
|
|
563
545
|
fieldErrors.push(m("inputSchema.validation.arrayValuesInvalid", {
|
|
@@ -574,8 +556,7 @@ function validateInputUsingValidator(validator, inputSchema, input, options = {}
|
|
|
574
556
|
const check = new RegExp(patternKey);
|
|
575
557
|
const invalidKeys = [];
|
|
576
558
|
Object.keys(value).forEach((key) => {
|
|
577
|
-
if (!check.test(key))
|
|
578
|
-
invalidKeys.push(key);
|
|
559
|
+
if (!check.test(key)) invalidKeys.push(key);
|
|
579
560
|
});
|
|
580
561
|
if (invalidKeys.length) {
|
|
581
562
|
fieldErrors.push(m("inputSchema.validation.objectKeysInvalid", {
|
|
@@ -591,8 +572,7 @@ function validateInputUsingValidator(validator, inputSchema, input, options = {}
|
|
|
591
572
|
const invalidKeys = [];
|
|
592
573
|
Object.keys(value).forEach((key) => {
|
|
593
574
|
const propertyValue = value[key];
|
|
594
|
-
if (typeof propertyValue !== "string" || !check.test(propertyValue))
|
|
595
|
-
invalidKeys.push(key);
|
|
575
|
+
if (typeof propertyValue !== "string" || !check.test(propertyValue)) invalidKeys.push(key);
|
|
596
576
|
});
|
|
597
577
|
if (invalidKeys.length) {
|
|
598
578
|
fieldErrors.push(m("inputSchema.validation.objectValuesInvalid", {
|
|
@@ -617,8 +597,7 @@ function makeInputJsFieldsReadable(json, jsFields, jsonSpacing = 4, globalSpacin
|
|
|
617
597
|
const replacements = {};
|
|
618
598
|
jsFields.forEach((field) => {
|
|
619
599
|
let maybeFunction = parsedJson[field];
|
|
620
|
-
if (!maybeFunction || typeof maybeFunction !== "string")
|
|
621
|
-
return;
|
|
600
|
+
if (!maybeFunction || typeof maybeFunction !== "string") return;
|
|
622
601
|
let ast;
|
|
623
602
|
try {
|
|
624
603
|
ast = parse(maybeFunction, { ecmaVersion: "latest" });
|
|
@@ -627,8 +606,7 @@ function makeInputJsFieldsReadable(json, jsFields, jsonSpacing = 4, globalSpacin
|
|
|
627
606
|
}
|
|
628
607
|
const isMultiline = maybeFunction.includes("\n");
|
|
629
608
|
const isSingleFunction = ast && ast.body.length === 1 && (ast.body[0].type === "FunctionDeclaration" || ast.body[0].type === "ExpressionStatement" && ast.body[0].expression.type === "ArrowFunctionExpression");
|
|
630
|
-
if (!isSingleFunction && !isMultiline)
|
|
631
|
-
return;
|
|
609
|
+
if (!isSingleFunction && !isMultiline) return;
|
|
632
610
|
const spaces = new Array(isSingleFunction ? jsonSpacing : jsonSpacing * 2).fill(" ").join("");
|
|
633
611
|
maybeFunction = maybeFunction.split("\n").join(`
|
|
634
612
|
${spaces}`).trim();
|
package/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/intl.ts","../../src/schema.json","../../src/input_schema.ts","../../src/utilities.ts"],"sourcesContent":["const intlStrings = {\n 'inputSchema.validation.generic':\n 'Field {rootName}.{fieldKey} {message}',\n 'inputSchema.validation.required':\n 'Field {rootName}.{fieldKey} is required',\n 'inputSchema.validation.proxyRequired':\n 'Field {rootName}.{fieldKey} is required. Please provide custom proxy URLs or use Apify Proxy.',\n 'inputSchema.validation.requestListSourcesInvalid':\n 'Items in {rootName}.{fieldKey} at positions [{invalidIndexes}] do not contain valid URLs',\n 'inputSchema.validation.arrayKeysInvalid':\n 'Keys in {rootName}.{fieldKey} at positions [{invalidIndexes}] must match regular expression \"{pattern}\"',\n 'inputSchema.validation.arrayValuesInvalid':\n 'Values in {rootName}.{fieldKey} at positions [{invalidIndexes}] must match regular expression \"{pattern}\"',\n 'inputSchema.validation.objectKeysInvalid':\n 'Keys [{invalidKeys}] in {rootName}.{fieldKey} must match regular expression \"{pattern}',\n 'inputSchema.validation.objectValuesInvalid':\n 'Keys [{invalidKeys}] in {rootName}.{fieldKey} must have string value which matches regular expression \"{pattern}\"',\n 'inputSchema.validation.additionalProperty':\n 'Property {rootName}.{fieldKey} is not allowed.',\n 'inputSchema.validation.proxyGroupsNotAvailable':\n 'You currently do not have access to proxy groups: {groups}',\n 'inputSchema.validation.customProxyInvalid':\n 'Proxy URL \"{invalidUrl}\" has invalid format, it must be http[s]://[username[:password]]@hostname:port.',\n 'inputSchema.validation.apifyProxyCountryInvalid':\n 'Country code \"{invalidCountry}\" is invalid. Only ISO 3166-1 alpha-2 country codes are supported.',\n 'inputSchema.validation.apifyProxyCountryWithoutApifyProxyForbidden':\n 'The country for Apify Proxy can be specified only when using Apify Proxy.',\n 'inputSchema.validation.noAvailableAutoProxy':\n 'Currently you do not have access to any proxy group usable in automatic mode.',\n 'inputSchema.validation.noMatchingDefinition':\n 'Field schema.properties.{fieldKey} is not matching any input schema type definition. Please make sure that it\\'s type is valid.',\n 'inputSchema.validation.missingRequiredField':\n 'Field schema.properties.{fieldKey} does not exist, but it is specified in schema.required. Either define the field or remove it from schema.required.',\n 'inputSchema.validation.proxyGroupMustBeArrayOfStrings':\n 'Field {rootName}.{fieldKey}.apifyProxyGroups must be an array of strings.',\n};\n\n/**\n * Helper function to simulate intl formatMessage function\n */\nexport function m(stringId: string, variables?: Record<string, any>) {\n let text = intlStrings[stringId];\n if (!text) return stringId;\n\n if (variables) {\n Object.keys(variables).forEach((variableName) => {\n text = text.split(`{${variableName}}`).join(variables[variableName]);\n });\n }\n\n return text;\n}\n","{\n \"title\": \"JSON schema of Apify Actor INPUT_SCHEMA.json\",\n \"type\": \"object\",\n \"properties\": {\n \"$schema\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": \"string\"\n },\n \"schemaVersion\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 1\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"enum\": [\"object\"]\n },\n \"required\": {\n \"type\": \"array\",\n \"minItems\": 0,\n \"items\": { \"type\": \"string\" },\n \"uniqueItems\": true\n },\n \"additionalProperties\": {\n \"type\": \"boolean\"\n },\n \"properties\": {\n \"type\": \"object\",\n \"patternProperties\": {\n \"^\": {\n \"oneOf\": [\n { \"$ref\": \"#/definitions/stringProperty\" },\n { \"$ref\": \"#/definitions/stringEnumProperty\" },\n { \"$ref\": \"#/definitions/arrayProperty\" },\n { \"$ref\": \"#/definitions/objectProperty\" },\n { \"$ref\": \"#/definitions/integerProperty\" },\n { \"$ref\": \"#/definitions/booleanProperty\" },\n { \"$ref\": \"#/definitions/anyProperty\" }\n ]\n }\n }\n }\n },\n \"additionalProperties\": false,\n \"required\": [\"title\", \"type\", \"properties\", \"schemaVersion\"],\n \"definitions\": {\n \"stringEnumProperty\": {\n \"title\": \"Enum property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"editor\": { \"enum\": [\"select\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"string\" },\n \"prefill\": { \"type\": \"string\" },\n \"example\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" },\n \"enum\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"minItems\": 1,\n \"uniqueItems\": true\n },\n \"enumTitles\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"minItems\": 1\n }\n },\n \"required\": [\"type\", \"title\", \"description\", \"enum\"]\n },\n \"stringProperty\": {\n \"title\": \"String property\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"editor\": { \"enum\": [\"javascript\", \"python\", \"textfield\", \"textarea\", \"datepicker\", \"hidden\"] },\n \"isSecret\": { \"type\": \"boolean\" }\n },\n \"required\": [\"type\", \"title\", \"description\", \"editor\"],\n \"if\": {\n \"properties\": {\n \"isSecret\": {\n \"not\": {\n \"const\": true\n }\n }\n }\n },\n \"then\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"string\" },\n \"prefill\": { \"type\": \"string\" },\n \"example\": { \"type\": \"string\" },\n \"pattern\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minLength\": { \"type\": \"integer\" },\n \"maxLength\": { \"type\": \"integer\" },\n \"editor\": { \"enum\": [\"javascript\", \"python\", \"textfield\", \"textarea\", \"datepicker\", \"hidden\"] },\n \"isSecret\": { \"type\": \"boolean\" },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n }\n },\n \"else\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"example\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"editor\": { \"enum\": [\"textfield\", \"textarea\", \"hidden\"] },\n \"isSecret\": { \"type\": \"boolean\" },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n }\n }\n },\n \"arrayProperty\": {\n \"title\": \"Array property\",\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"enum\": [\"array\"] },\n \"editor\": { \"enum\": [\"json\", \"requestListSources\", \"pseudoUrls\", \"globs\", \"keyValue\", \"stringList\", \"select\", \"hidden\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"array\" },\n \"prefill\": { \"type\": \"array\" },\n \"example\": { \"type\": \"array\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minItems\": { \"type\": \"integer\" },\n \"maxItems\": { \"type\": \"integer\" },\n \"uniqueItems\": { \"type\": \"boolean\" },\n\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"additionalProperties\": true,\n \"required\": [\"type\", \"title\", \"description\", \"editor\"],\n \"if\": {\n \"properties\": {\n \"editor\": { \"const\": \"select\" }\n }\n },\n \"then\": {\n \"required\": [\"items\"],\n \"properties\": {\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"enum\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"uniqueItems\": true\n },\n \"enumTitles\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n }\n },\n \"required\": [\"type\", \"enum\"]\n }\n }\n },\n \"else\": {\n \"properties\": {\n \"placeholderKey\": { \"type\": \"string\" },\n \"placeholderValue\": { \"type\": \"string\" },\n \"patternKey\": { \"type\": \"string\" },\n \"patternValue\": { \"type\": \"string\" }\n }\n }\n },\n \"objectProperty\": {\n \"title\": \"Object property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"object\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"object\" },\n \"prefill\": { \"type\": \"object\" },\n \"example\": { \"type\": \"object\" },\n \"patternKey\": { \"type\": \"string\" },\n \"patternValue\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minProperties\": { \"type\": \"integer\" },\n \"maxProperties\": { \"type\": \"integer\" },\n\n \"editor\": { \"enum\": [\"json\", \"proxy\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\", \"editor\"]\n },\n \"integerProperty\": {\n \"title\": \"Integer property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"integer\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"integer\" },\n \"prefill\": { \"type\": \"integer\" },\n \"example\": { \"type\": \"integer\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minimum\": { \"type\": \"integer\" },\n \"maximum\": { \"type\": \"integer\" },\n \"unit\": { \"type\": \"string\" },\n \"editor\": { \"enum\": [\"number\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\"]\n },\n \"booleanProperty\": {\n \"title\": \"Boolean property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"boolean\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"boolean\" },\n \"prefill\": { \"type\": \"boolean\" },\n \"example\": { \"type\": \"boolean\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"groupCaption\": { \"type\": \"string\" },\n \"groupDescription\": { \"type\": \"string\" },\n \"editor\": { \"enum\": [\"checkbox\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\"]\n },\n \"anyProperty\": {\n \"title\": \"Any property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": {\n \"type\": [\"array\"],\n \"items\": {\n \"type\": \"string\",\n \"enum\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"]\n },\n \"uniqueItems\": true,\n \"additionalItems\": false,\n \"minItems\": 1\n },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"] },\n \"prefill\": { \"type\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"] },\n \"example\": { \"type\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"] },\n \"nullable\": { \"type\": \"boolean\" },\n \"editor\": { \"enum\": [\"json\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\", \"editor\"]\n }\n }\n}\n","import Ajv, { ErrorObject, Schema } from 'ajv';\nimport schema from './schema.json';\nimport { m } from './intl';\nimport {\n FieldDefinition,\n InputSchema,\n InputSchemaBaseChecked,\n StringFieldDefinition,\n} from './types';\n\nexport { schema as inputSchema };\n\nconst { definitions } = schema;\n\n/**\n * This function parses AJV error and transforms it into a readable string.\n *\n * @param error An error as returned from AJV.\n * @param rootName Usually 'input' or 'schema' based on if we are passing the input or schema.\n * @param properties (Used only when parsing input errors) List of input schema properties.\n * @param input (Used only when parsing input errors) Actual input that is being parsed.\n * @returns {null|{fieldKey: *, message: *}}\n */\nexport function parseAjvError(\n error: ErrorObject,\n rootName: string,\n properties: Record<string, { nullable?: boolean }> = {},\n input: Record<string, unknown> = {},\n): { fieldKey: string; message: string } | null {\n // There are 3 possible errors comming from validation:\n // - either { keword: 'anything', instancePath: '/someField', message: 'error message that we can use' }\n // - or { keyword: 'additionalProperties', params: { additionalProperty: 'field' }, message: 'must NOT have additional properties' }\n // - or { keyword: 'required', instancePath: '', params.missingProperty: 'someField' }\n\n let fieldKey: string;\n let message: string;\n\n // If error is with keyword type, it means that type of input is incorrect\n // this can mean that provided value is null\n if (error.keyword === 'type') {\n fieldKey = error.instancePath.split('/').pop()!;\n // Check if value is null and field is nullable, if yes, then skip this error\n if (properties[fieldKey] && properties[fieldKey].nullable && input[fieldKey] === null) {\n return null;\n }\n message = m('inputSchema.validation.generic', { rootName, fieldKey, message: error.message });\n } else if (error.keyword === 'required') {\n fieldKey = error.params.missingProperty;\n message = m('inputSchema.validation.required', { rootName, fieldKey });\n } else if (error.keyword === 'additionalProperties') {\n fieldKey = error.params.additionalProperty;\n message = m('inputSchema.validation.additionalProperty', { rootName, fieldKey });\n } else if (error.keyword === 'enum') {\n fieldKey = error.instancePath.split('/').pop()!;\n const errorMessage = `${error.message}: \"${error.params.allowedValues.join('\", \"')}\"`;\n message = m('inputSchema.validation.generic', { rootName, fieldKey, message: errorMessage });\n } else {\n fieldKey = error.instancePath.split('/').pop()!;\n message = m('inputSchema.validation.generic', { rootName, fieldKey, message: error.message });\n }\n\n return { fieldKey, message };\n}\n\n/**\n * Validates given object against schema and throws a human-readable error.\n */\nconst validateAgainstSchemaOrThrow = (validator: Ajv, obj: Record<string, unknown>, inputSchema: Schema, rootName: string) => {\n if (validator.validate(inputSchema, obj)) return;\n\n const errorMessage = parseAjvError(validator.errors![0], rootName)?.message;\n throw new Error(`Input schema is not valid (${errorMessage})`);\n};\n\n/**\n * This validates given object only against the basic input schema without checking the particular fields.\n * We override schema.properties.properties not to validate field definitions.\n */\nfunction validateBasicStructure(validator: Ajv, obj: Record<string, unknown>): asserts obj is InputSchemaBaseChecked {\n const schemaWithoutProperties = {\n ...schema,\n properties: { ...schema.properties, properties: { type: 'object' } as any },\n };\n validateAgainstSchemaOrThrow(validator, obj, schemaWithoutProperties, 'schema');\n}\n\n/**\n * Validates particular field against it's schema.\n */\nfunction validateField(validator: Ajv, fieldSchema: Record<string, unknown>, fieldKey: string): asserts fieldSchema is FieldDefinition {\n const matchingDefinitions = Object\n .values<any>(definitions) // cast as any, as the code in first branch seems to be invalid\n .filter((definition) => {\n return definition.properties.type.enum\n // This is a normal case where fieldSchema.type can be only one possible value matching definition.properties.type.enum.0\n ? definition.properties.type.enum[0] === fieldSchema.type\n // This is a type \"Any\" where fieldSchema.type is an array of possible values\n : Array.isArray(fieldSchema.type);\n });\n\n // There is not matching definition.\n if (matchingDefinitions.length === 0) {\n const errorMessage = m('inputSchema.validation.noMatchingDefinition', { fieldKey });\n throw new Error(`Input schema is not valid (${errorMessage})`);\n }\n\n // If there is only one matching then we are done and simply compare it.\n if (matchingDefinitions.length === 1) {\n validateAgainstSchemaOrThrow(validator, fieldSchema, matchingDefinitions[0], `schema.properties.${fieldKey}`);\n return;\n }\n\n // If there are more matching definitions then the type is string, and we need to get the right one.\n // If the definition contains \"enum\" property then it's enum type.\n if ((fieldSchema as StringFieldDefinition).enum) {\n const definition = matchingDefinitions.filter((item) => !!item.properties.enum).pop();\n if (!definition) throw new Error('Input schema validation failed to find \"enum property\" definition');\n validateAgainstSchemaOrThrow(validator, fieldSchema, definition, `schema.properties.${fieldKey}.enum`);\n return;\n }\n // Otherwise we use the other definition.\n const definition = matchingDefinitions.filter((item) => !item.properties.enum).pop();\n if (!definition) throw new Error('Input schema validation failed to find other than \"enum property\" definition');\n\n validateAgainstSchemaOrThrow(validator, fieldSchema, definition, `schema.properties.${fieldKey}`);\n}\n\n/**\n * Validates all properties in the input schema\n */\nfunction validateProperties(inputSchema: InputSchemaBaseChecked, validator: Ajv): asserts inputSchema is InputSchema {\n Object.entries(inputSchema.properties).forEach(([fieldKey, fieldSchema]) => (\n validateField(validator, fieldSchema, fieldKey)),\n );\n}\n\n/**\n * Validates that all required fields are present in properties list\n */\nexport function validateExistenceOfRequiredFields(inputSchema: InputSchema) {\n // If the input schema does not have any required fields, we do not need to validate them\n if (!inputSchema?.required?.length) return;\n\n Object.values(inputSchema?.required).forEach((fieldKey) => {\n // If the required field is present in the list of properties, we can check the next one\n if (inputSchema?.properties[fieldKey as string]) return;\n\n // The required field is not defined in list of properties. Which means the schema is not valid.\n throw new Error(m('inputSchema.validation.missingRequiredField', { fieldKey }));\n });\n}\n\n/**\n * This function validates given input schema first just for basic structure then each field one by one,\n * then checks that all required fields are present and finally checks fully against the whole schema.\n *\n * This way we get the most accurate error message for user.\n */\nexport function validateInputSchema(validator: Ajv, inputSchema: Record<string, unknown>): asserts inputSchema is InputSchema {\n // First validate just basic structure without fields.\n validateBasicStructure(validator, inputSchema);\n\n // Then validate each field separately.\n validateProperties(inputSchema, validator);\n\n // Next validate if required fields are actually present in the schema\n validateExistenceOfRequiredFields(inputSchema);\n\n // Finally just to be sure run validation against the whole schema.\n validateAgainstSchemaOrThrow(validator, inputSchema, schema, 'schema');\n}\n","import { PROXY_URL_REGEX, URL_REGEX } from '@apify/consts';\nimport { countries } from 'countries-list';\nimport { ValidateFunction } from 'ajv';\nimport { parse } from 'acorn-loose';\nimport { m } from './intl';\nimport { parseAjvError } from './input_schema';\n\n/**\n * Validates input field configured with proxy editor\n * @param fieldKey Proxy field value\n * @param value Proxy field value\n * @param [isRequired] Whether the field is required or not\n * @param [options] Information about proxy groups availability\n * @param [options.hasAutoProxyGroups] Informs validation whether user has atleast one proxy group available in auto mode\n * @param [options.availableProxyGroups] List of available proxy groups\n * @param [options.disabledProxyGroups] Object with groupId as key and error message as value (mostly for residential/SERP)\n */\nfunction validateProxyField(\n fieldKey: Record<string, unknown>,\n value: Record<string, any>,\n isRequired = false,\n options: { hasAutoProxyGroups?: boolean; availableProxyGroups?: string[]; disabledProxyGroups?: Record<string, unknown> } | null = null,\n) {\n const fieldErrors: any[] = [];\n if (isRequired) {\n // Nullable error is already handled by AJV\n if (value === null) return fieldErrors;\n if (!value) {\n const message = m('inputSchema.validation.required', { rootName: 'input', fieldKey });\n fieldErrors.push(message);\n return fieldErrors;\n }\n\n const { useApifyProxy, proxyUrls } = value;\n if (!useApifyProxy && (!Array.isArray(proxyUrls) || proxyUrls.length === 0)) {\n fieldErrors.push(m('inputSchema.validation.proxyRequired', { rootName: 'input', fieldKey }));\n return fieldErrors;\n }\n }\n\n // Input is not required, so missing value is valid\n if (!value) return fieldErrors;\n\n const { useApifyProxy, proxyUrls, apifyProxyGroups, apifyProxyCountry } = value;\n\n if (!useApifyProxy && Array.isArray(proxyUrls)) {\n let invalidUrl = false;\n proxyUrls.forEach((url) => {\n if (!PROXY_URL_REGEX.test(url.trim())) invalidUrl = url.trim();\n });\n if (invalidUrl) {\n fieldErrors.push(m('inputSchema.validation.customProxyInvalid', { invalidUrl }));\n }\n }\n\n // Apify proxy country can be set only when using Apify proxy\n if (!useApifyProxy && apifyProxyCountry) {\n fieldErrors.push(m('inputSchema.validation.apifyProxyCountryWithoutApifyProxyForbidden'));\n }\n\n // If Apify proxy is not used skip additional checks\n if (!useApifyProxy) return fieldErrors;\n\n // If Apify proxy is used, check if there is a selected country and if so, check that it's valid (empty or a valid country code)\n if (apifyProxyCountry && !countries[apifyProxyCountry]) {\n fieldErrors.push(m('inputSchema.validation.apifyProxyCountryInvalid', { invalidCountry: apifyProxyCountry }));\n }\n\n // If options are not provided skip additional checks\n if (!options) return fieldErrors;\n\n // if apifyProxyGroups exists it must be an array of strings\n const isStringsArray = (array: Array<string>) => array.every((item) => typeof item === 'string');\n if (apifyProxyGroups && !(Array.isArray(apifyProxyGroups) && isStringsArray(apifyProxyGroups))) {\n fieldErrors.push(m('inputSchema.validation.proxyGroupMustBeArrayOfStrings', { rootName: 'input', fieldKey }));\n return fieldErrors;\n }\n\n const selectedProxyGroups = (apifyProxyGroups || []);\n\n // Auto mode, check that user has access to alteast one proxy group usable in this mode\n if (!selectedProxyGroups.length && !options.hasAutoProxyGroups) {\n fieldErrors.push(m('inputSchema.validation.noAvailableAutoProxy'));\n return fieldErrors;\n }\n\n // Check if proxy groups selected by user are available to him\n const availableProxyGroupsById = {};\n (options.availableProxyGroups || []).forEach((group) => { availableProxyGroupsById[group] = true; });\n const unavailableProxyGroups = selectedProxyGroups.filter((group: string) => !availableProxyGroupsById[group]);\n\n if (unavailableProxyGroups.length) {\n fieldErrors.push(m('inputSchema.validation.proxyGroupsNotAvailable', {\n rootName: 'input',\n fieldKey,\n groups: unavailableProxyGroups.join(', '),\n }));\n }\n\n // Check if any of the proxy groups are blocked and if yes then output the associated message\n const blockedProxyGroupsById = options.disabledProxyGroups || {};\n selectedProxyGroups\n .filter((group: string) => blockedProxyGroupsById[group])\n .forEach((blockedGroup: string) => {\n fieldErrors.push(blockedProxyGroupsById[blockedGroup]);\n });\n\n return fieldErrors;\n}\n\n/**\n * Uses AJV validator to validate input with input schema and then\n * does custom validation for our own properties (nullable, patternKey, patternValue)\n * @param validator Initialized AJV validator\n * @param inputSchema Valid input schema in object\n * @param input Input object to be validated\n * @param options (Optional) Additional validation configuration for certain fields\n */\nexport function validateInputUsingValidator(\n validator: ValidateFunction,\n inputSchema: Record<string, any>,\n input: Record<string, unknown>,\n options: Record<string, any> = {},\n) {\n const isValid = validator(input); // Check if input is valid based on schema values\n\n const { properties } = inputSchema;\n const required = inputSchema.required || [];\n\n let errors: { fieldKey: string, message: string }[] = [];\n // Process AJV validation errors\n if (!isValid) {\n errors = validator.errors!\n .map((error) => parseAjvError(error, 'input', properties, input))\n .filter((error) => !!error) as any[];\n }\n\n Object.keys(properties).forEach((property) => {\n const value = input[property] as Record<string, any>;\n const { type, editor, patternKey, patternValue } = properties[property];\n const fieldErrors = [];\n // Check that proxy is required, if yes, valides that it's correctly setup\n if (type === 'object' && editor === 'proxy') {\n const proxyValidationErrors = validateProxyField(property as any, value, required.includes(property), options.proxy);\n proxyValidationErrors.forEach((error) => {\n fieldErrors.push(error);\n });\n }\n // Check that array items fit patternKey and patternValue\n if (type === 'array' && value && Array.isArray(value)) {\n if (editor === 'requestListSources') {\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!item) invalidIndexes.push(index);\n else if (!item.url && !item.requestsFromUrl) invalidIndexes.push(index);\n else if (item.url && !URL_REGEX.test(item.url)) invalidIndexes.push(index);\n else if (item.requestsFromUrl && !URL_REGEX.test(item.requestsFromUrl)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.requestListSourcesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n }));\n }\n }\n // If patternKey is provided, then validate keys of objects in array\n if (patternKey && editor === 'keyValue') {\n const check = new RegExp(patternKey);\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!check.test(item.key)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.arrayKeysInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n pattern: patternKey,\n }));\n }\n }\n // If patternValue is provided and editor is keyValue, then validate values of objecs in array\n if (patternValue && editor === 'keyValue') {\n const check = new RegExp(patternValue);\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!check.test(item.value)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.arrayValuesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n pattern: patternValue,\n }));\n }\n // If patternValue is provided and editor is stringList, then validate each item in array\n } else if (patternValue && editor === 'stringList') {\n const check = new RegExp(patternValue);\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!check.test(item)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.arrayValuesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n pattern: patternValue,\n }));\n }\n }\n }\n // Check that object items fit patternKey and patternValue\n if (type === 'object' && value) {\n if (patternKey) {\n const check = new RegExp(patternKey);\n const invalidKeys: any[] = [];\n Object.keys(value).forEach((key) => {\n if (!check.test(key)) invalidKeys.push(key);\n });\n if (invalidKeys.length) {\n fieldErrors.push(m('inputSchema.validation.objectKeysInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidKeys: invalidKeys.join(','),\n pattern: patternKey,\n }));\n }\n }\n if (patternValue) {\n const check = new RegExp(patternValue);\n const invalidKeys: any[] = [];\n Object.keys(value).forEach((key) => {\n const propertyValue = value[key];\n if (typeof propertyValue !== 'string' || !check.test(propertyValue)) invalidKeys.push(key);\n });\n if (invalidKeys.length) {\n fieldErrors.push(m('inputSchema.validation.objectValuesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidKeys: invalidKeys.join(','),\n pattern: patternValue,\n }));\n }\n }\n }\n if (fieldErrors.length > 0) {\n const message = fieldErrors.join(', ');\n errors.push({ fieldKey: property, message });\n }\n });\n\n return errors;\n}\n\n/**\n * This functions parses all given JSON and then takes each of the jsFields.\n * Then if the field:\n * - is valid JS single function it replaces its single line string with a function delacation.\n * - is valid multiline JS code then replaces its single line string with `multiline` string\n * Then stringifies the code with given number of jsonSpacing spaces and finally prefixes whole\n * stringified JSON except the first line with globalSpacing spaces.\n */\nexport function makeInputJsFieldsReadable(json: string, jsFields: string[], jsonSpacing = 4, globalSpacing = 0): string {\n const parsedJson = JSON.parse(json);\n const replacements: Record<string, any> = {};\n\n jsFields.forEach((field) => {\n let maybeFunction = parsedJson[field];\n if (!maybeFunction || typeof maybeFunction !== 'string') return;\n\n let ast;\n try {\n ast = parse(maybeFunction, { ecmaVersion: 'latest' });\n } catch (err) {\n // Don't do anything in a case of invalid JS code.\n return;\n }\n\n const isMultiline = maybeFunction.includes('\\n');\n const isSingleFunction = ast\n && ast.body.length === 1\n && (\n ast.body[0].type === 'FunctionDeclaration'\n || (ast.body[0].type === 'ExpressionStatement' && ast.body[0].expression.type === 'ArrowFunctionExpression')\n );\n\n // If it's not a function declaration or multiline JS code then we do nothing.\n if (!isSingleFunction && !isMultiline) return;\n\n const spaces = (new Array(isSingleFunction ? jsonSpacing : jsonSpacing * 2)).fill(' ').join('');\n maybeFunction = maybeFunction\n .split('\\n').join(`\\n${spaces}`) // This prefixes each line with spaces.\n .trim(); // Trim whitespace on both sides\n\n const replacementValue = isSingleFunction\n ? maybeFunction.replace(/[;]+$/g, '') // Remove trailing semicolons\n : `\\`${maybeFunction}\\``;\n const replacementToken = `<<<REPLACEMENT_TOKEN:${Math.random()}>>>`;\n replacements[replacementToken] = replacementValue;\n parsedJson[field] = replacementToken;\n });\n\n let niceJson = JSON.stringify(parsedJson, null, jsonSpacing);\n\n Object.entries(replacements).forEach(([replacementToken, replacementValue]) => {\n niceJson = niceJson.replace(`\"${replacementToken}\"`, replacementValue);\n });\n\n const globalSpaces = (new Array(globalSpacing)).fill(' ').join('');\n niceJson = niceJson.split('\\n').join(`\\n${globalSpaces}`);\n\n return niceJson;\n}\n"],"mappings":";;;;AAAA,IAAM,cAAc;AAAA,EAChB,kCACI;AAAA,EACJ,mCACI;AAAA,EACJ,wCACI;AAAA,EACJ,oDACI;AAAA,EACJ,2CACI;AAAA,EACJ,6CACI;AAAA,EACJ,4CACI;AAAA,EACJ,8CACI;AAAA,EACJ,6CACI;AAAA,EACJ,kDACI;AAAA,EACJ,6CACI;AAAA,EACJ,mDACI;AAAA,EACJ,sEACI;AAAA,EACJ,+CACI;AAAA,EACJ,+CACI;AAAA,EACJ,+CACI;AAAA,EACJ,yDACI;AACR;AAKO,SAAS,EAAE,UAAkB,WAAiC;AACjE,MAAI,OAAO,YAAY,QAAQ;AAC/B,MAAI,CAAC;AAAM,WAAO;AAElB,MAAI,WAAW;AACX,WAAO,KAAK,SAAS,EAAE,QAAQ,CAAC,iBAAiB;AAC7C,aAAO,KAAK,MAAM,IAAI,YAAY,GAAG,EAAE,KAAK,UAAU,YAAY,CAAC;AAAA,IACvE,CAAC;AAAA,EACL;AAEA,SAAO;AACX;AAXgB;;;ACxChB;AAAA,EACI,OAAS;AAAA,EACT,MAAQ;AAAA,EACR,YAAc;AAAA,IACV,SAAW;AAAA,MACP,MAAQ;AAAA,IACZ;AAAA,IACA,OAAS;AAAA,MACL,MAAQ;AAA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AAI1F,QAAI,CAAC,oBAAoB,CAAC;AAAa;AAEvC,UAAM,SAAU,IAAI,MAAM,mBAAmB,cAAc,cAAc,CAAC,EAAG,KAAK,GAAG,EAAE,KAAK,EAAE;AAC9F,oBAAgB,cACX,MAAM,IAAI,EAAE,KAAK;AAAA,EAAK,MAAM,EAAE,EAC9B,KAAK;AAEV,UAAM,mBAAmB,mBACnB,cAAc,QAAQ,UAAU,EAAE,IAClC,KAAK,aAAa;AACxB,UAAM,mBAAmB,wBAAwB,KAAK,OAAO,CAAC;AAC9D,iBAAa,gBAAgB,IAAI;AACjC,eAAW,KAAK,IAAI;AAAA,EACxB,CAAC;AAED,MAAI,WAAW,KAAK,UAAU,YAAY,MAAM,WAAW;AAE3D,SAAO,QAAQ,YAAY,EAAE,QAAQ,CAAC,CAAC,kBAAkB,gBAAgB,MAAM;AAC3E,eAAW,SAAS,QAAQ,IAAI,gBAAgB,KAAK,gBAAgB;AAAA,EACzE,CAAC;AAED,QAAM,eAAgB,IAAI,MAAM,aAAa,EAAG,KAAK,GAAG,EAAE,KAAK,EAAE;AACjE,aAAW,SAAS,MAAM,IAAI,EAAE,KAAK;AAAA,EAAK,YAAY,EAAE;AAExD,SAAO;AACX;AAlDgB;","names":["definition","useApifyProxy","proxyUrls"]}
|
|
1
|
+
{"version":3,"sources":["../../src/intl.ts","../../src/schema.json","../../src/input_schema.ts","../../src/utilities.ts"],"sourcesContent":["const intlStrings = {\n 'inputSchema.validation.generic':\n 'Field {rootName}.{fieldKey} {message}',\n 'inputSchema.validation.required':\n 'Field {rootName}.{fieldKey} is required',\n 'inputSchema.validation.proxyRequired':\n 'Field {rootName}.{fieldKey} is required. Please provide custom proxy URLs or use Apify Proxy.',\n 'inputSchema.validation.requestListSourcesInvalid':\n 'Items in {rootName}.{fieldKey} at positions [{invalidIndexes}] do not contain valid URLs',\n 'inputSchema.validation.arrayKeysInvalid':\n 'Keys in {rootName}.{fieldKey} at positions [{invalidIndexes}] must match regular expression \"{pattern}\"',\n 'inputSchema.validation.arrayValuesInvalid':\n 'Values in {rootName}.{fieldKey} at positions [{invalidIndexes}] must match regular expression \"{pattern}\"',\n 'inputSchema.validation.objectKeysInvalid':\n 'Keys [{invalidKeys}] in {rootName}.{fieldKey} must match regular expression \"{pattern}',\n 'inputSchema.validation.objectValuesInvalid':\n 'Keys [{invalidKeys}] in {rootName}.{fieldKey} must have string value which matches regular expression \"{pattern}\"',\n 'inputSchema.validation.additionalProperty':\n 'Property {rootName}.{fieldKey} is not allowed.',\n 'inputSchema.validation.proxyGroupsNotAvailable':\n 'You currently do not have access to proxy groups: {groups}',\n 'inputSchema.validation.customProxyInvalid':\n 'Proxy URL \"{invalidUrl}\" has invalid format, it must be http[s]://[username[:password]]@hostname:port.',\n 'inputSchema.validation.apifyProxyCountryInvalid':\n 'Country code \"{invalidCountry}\" is invalid. Only ISO 3166-1 alpha-2 country codes are supported.',\n 'inputSchema.validation.apifyProxyCountryWithoutApifyProxyForbidden':\n 'The country for Apify Proxy can be specified only when using Apify Proxy.',\n 'inputSchema.validation.noAvailableAutoProxy':\n 'Currently you do not have access to any proxy group usable in automatic mode.',\n 'inputSchema.validation.noMatchingDefinition':\n 'Field schema.properties.{fieldKey} is not matching any input schema type definition. Please make sure that it\\'s type is valid.',\n 'inputSchema.validation.missingRequiredField':\n 'Field schema.properties.{fieldKey} does not exist, but it is specified in schema.required. Either define the field or remove it from schema.required.',\n 'inputSchema.validation.proxyGroupMustBeArrayOfStrings':\n 'Field {rootName}.{fieldKey}.apifyProxyGroups must be an array of strings.',\n};\n\n/**\n * Helper function to simulate intl formatMessage function\n */\nexport function m(stringId: string, variables?: Record<string, any>) {\n let text = intlStrings[stringId as keyof typeof intlStrings];\n if (!text) return stringId;\n\n if (variables) {\n Object.keys(variables).forEach((variableName) => {\n text = text.split(`{${variableName}}`).join(variables[variableName]);\n });\n }\n\n return text;\n}\n","{\n \"title\": \"JSON schema of Apify Actor INPUT_SCHEMA.json\",\n \"type\": \"object\",\n \"properties\": {\n \"$schema\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": \"string\"\n },\n \"schemaVersion\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 1\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"enum\": [\"object\"]\n },\n \"required\": {\n \"type\": \"array\",\n \"minItems\": 0,\n \"items\": { \"type\": \"string\" },\n \"uniqueItems\": true\n },\n \"additionalProperties\": {\n \"type\": \"boolean\"\n },\n \"properties\": {\n \"type\": \"object\",\n \"patternProperties\": {\n \"^\": {\n \"oneOf\": [\n { \"$ref\": \"#/definitions/stringProperty\" },\n { \"$ref\": \"#/definitions/stringEnumProperty\" },\n { \"$ref\": \"#/definitions/arrayProperty\" },\n { \"$ref\": \"#/definitions/objectProperty\" },\n { \"$ref\": \"#/definitions/integerProperty\" },\n { \"$ref\": \"#/definitions/booleanProperty\" },\n { \"$ref\": \"#/definitions/anyProperty\" }\n ]\n }\n }\n }\n },\n \"additionalProperties\": false,\n \"required\": [\"title\", \"type\", \"properties\", \"schemaVersion\"],\n \"definitions\": {\n \"stringEnumProperty\": {\n \"title\": \"Enum property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"editor\": { \"enum\": [\"select\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"string\" },\n \"prefill\": { \"type\": \"string\" },\n \"example\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" },\n \"enum\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"minItems\": 1,\n \"uniqueItems\": true\n },\n \"enumTitles\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"minItems\": 1\n }\n },\n \"required\": [\"type\", \"title\", \"description\", \"enum\"]\n },\n \"stringProperty\": {\n \"title\": \"String property\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"editor\": { \"enum\": [\"javascript\", \"python\", \"textfield\", \"textarea\", \"datepicker\", \"hidden\", \"dataset\", \"keyValueStore\", \"requestQueue\"] },\n \"isSecret\": { \"type\": \"boolean\" }\n },\n \"required\": [\"type\", \"title\", \"description\", \"editor\"],\n \"if\": {\n \"properties\": {\n \"isSecret\": {\n \"not\": {\n \"const\": true\n }\n }\n }\n },\n \"then\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"string\" },\n \"prefill\": { \"type\": \"string\" },\n \"example\": { \"type\": \"string\" },\n \"pattern\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minLength\": { \"type\": \"integer\" },\n \"maxLength\": { \"type\": \"integer\" },\n \"editor\": { \"enum\": [\"javascript\", \"python\", \"textfield\", \"textarea\", \"datepicker\", \"hidden\", \"dataset\", \"keyValueStore\", \"requestQueue\"] },\n \"isSecret\": { \"type\": \"boolean\" },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n }\n },\n \"else\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"example\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"editor\": { \"enum\": [\"textfield\", \"textarea\", \"hidden\"] },\n \"isSecret\": { \"type\": \"boolean\" },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n }\n }\n },\n \"arrayProperty\": {\n \"title\": \"Array property\",\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"enum\": [\"array\"] },\n \"editor\": { \"enum\": [\"json\", \"requestListSources\", \"pseudoUrls\", \"globs\", \"keyValue\", \"stringList\", \"select\", \"hidden\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"array\" },\n \"prefill\": { \"type\": \"array\" },\n \"example\": { \"type\": \"array\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minItems\": { \"type\": \"integer\" },\n \"maxItems\": { \"type\": \"integer\" },\n \"uniqueItems\": { \"type\": \"boolean\" },\n\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"additionalProperties\": true,\n \"required\": [\"type\", \"title\", \"description\", \"editor\"],\n \"if\": {\n \"properties\": {\n \"editor\": { \"const\": \"select\" }\n }\n },\n \"then\": {\n \"required\": [\"items\"],\n \"properties\": {\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"string\"] },\n \"enum\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"uniqueItems\": true\n },\n \"enumTitles\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n }\n },\n \"required\": [\"type\", \"enum\"]\n }\n }\n },\n \"else\": {\n \"properties\": {\n \"placeholderKey\": { \"type\": \"string\" },\n \"placeholderValue\": { \"type\": \"string\" },\n \"patternKey\": { \"type\": \"string\" },\n \"patternValue\": { \"type\": \"string\" }\n }\n }\n },\n \"objectProperty\": {\n \"title\": \"Object property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"object\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"object\" },\n \"prefill\": { \"type\": \"object\" },\n \"example\": { \"type\": \"object\" },\n \"patternKey\": { \"type\": \"string\" },\n \"patternValue\": { \"type\": \"string\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minProperties\": { \"type\": \"integer\" },\n \"maxProperties\": { \"type\": \"integer\" },\n\n \"editor\": { \"enum\": [\"json\", \"proxy\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\", \"editor\"]\n },\n \"integerProperty\": {\n \"title\": \"Integer property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"integer\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"integer\" },\n \"prefill\": { \"type\": \"integer\" },\n \"example\": { \"type\": \"integer\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"minimum\": { \"type\": \"integer\" },\n \"maximum\": { \"type\": \"integer\" },\n \"unit\": { \"type\": \"string\" },\n \"editor\": { \"enum\": [\"number\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\"]\n },\n \"booleanProperty\": {\n \"title\": \"Boolean property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"enum\": [\"boolean\"] },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": \"boolean\" },\n \"prefill\": { \"type\": \"boolean\" },\n \"example\": { \"type\": \"boolean\" },\n \"nullable\": { \"type\": \"boolean\" },\n \"groupCaption\": { \"type\": \"string\" },\n \"groupDescription\": { \"type\": \"string\" },\n \"editor\": { \"enum\": [\"checkbox\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\"]\n },\n \"anyProperty\": {\n \"title\": \"Any property\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": {\n \"type\": [\"array\"],\n \"items\": {\n \"type\": \"string\",\n \"enum\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"]\n },\n \"uniqueItems\": true,\n \"additionalItems\": false,\n \"minItems\": 1\n },\n \"title\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"default\": { \"type\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"] },\n \"prefill\": { \"type\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"] },\n \"example\": { \"type\": [\"object\", \"array\", \"string\", \"integer\", \"boolean\"] },\n \"nullable\": { \"type\": \"boolean\" },\n \"editor\": { \"enum\": [\"json\", \"hidden\"] },\n \"sectionCaption\": { \"type\": \"string\" },\n \"sectionDescription\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"title\", \"description\", \"editor\"]\n }\n }\n}\n","import Ajv, { ErrorObject, Schema } from 'ajv';\n\nimport { m } from './intl';\nimport schema from './schema.json';\nimport {\n FieldDefinition,\n InputSchema,\n InputSchemaBaseChecked,\n StringFieldDefinition,\n} from './types';\n\nexport { schema as inputSchema };\n\nconst { definitions } = schema;\n\n/**\n * This function parses AJV error and transforms it into a readable string.\n *\n * @param error An error as returned from AJV.\n * @param rootName Usually 'input' or 'schema' based on if we are passing the input or schema.\n * @param properties (Used only when parsing input errors) List of input schema properties.\n * @param input (Used only when parsing input errors) Actual input that is being parsed.\n * @returns {null|{fieldKey: *, message: *}}\n */\nexport function parseAjvError(\n error: ErrorObject,\n rootName: string,\n properties: Record<string, { nullable?: boolean }> = {},\n input: Record<string, unknown> = {},\n): { fieldKey: string; message: string } | null {\n // There are 3 possible errors comming from validation:\n // - either { keword: 'anything', instancePath: '/someField', message: 'error message that we can use' }\n // - or { keyword: 'additionalProperties', params: { additionalProperty: 'field' }, message: 'must NOT have additional properties' }\n // - or { keyword: 'required', instancePath: '', params.missingProperty: 'someField' }\n\n let fieldKey: string;\n let message: string;\n\n // If error is with keyword type, it means that type of input is incorrect\n // this can mean that provided value is null\n if (error.keyword === 'type') {\n fieldKey = error.instancePath.split('/').pop()!;\n // Check if value is null and field is nullable, if yes, then skip this error\n if (properties[fieldKey] && properties[fieldKey].nullable && input[fieldKey] === null) {\n return null;\n }\n message = m('inputSchema.validation.generic', { rootName, fieldKey, message: error.message });\n } else if (error.keyword === 'required') {\n fieldKey = error.params.missingProperty;\n message = m('inputSchema.validation.required', { rootName, fieldKey });\n } else if (error.keyword === 'additionalProperties') {\n fieldKey = error.params.additionalProperty;\n message = m('inputSchema.validation.additionalProperty', { rootName, fieldKey });\n } else if (error.keyword === 'enum') {\n fieldKey = error.instancePath.split('/').pop()!;\n const errorMessage = `${error.message}: \"${error.params.allowedValues.join('\", \"')}\"`;\n message = m('inputSchema.validation.generic', { rootName, fieldKey, message: errorMessage });\n } else {\n fieldKey = error.instancePath.split('/').pop()!;\n message = m('inputSchema.validation.generic', { rootName, fieldKey, message: error.message });\n }\n\n return { fieldKey, message };\n}\n\n/**\n * Validates given object against schema and throws a human-readable error.\n */\nconst validateAgainstSchemaOrThrow = (validator: Ajv, obj: Record<string, unknown>, inputSchema: Schema, rootName: string) => {\n if (validator.validate(inputSchema, obj)) return;\n\n const errorMessage = parseAjvError(validator.errors![0], rootName)?.message;\n throw new Error(`Input schema is not valid (${errorMessage})`);\n};\n\n/**\n * This validates given object only against the basic input schema without checking the particular fields.\n * We override schema.properties.properties not to validate field definitions.\n */\nfunction validateBasicStructure(validator: Ajv, obj: Record<string, unknown>): asserts obj is InputSchemaBaseChecked {\n const schemaWithoutProperties = {\n ...schema,\n properties: { ...schema.properties, properties: { type: 'object' } as any },\n };\n validateAgainstSchemaOrThrow(validator, obj, schemaWithoutProperties, 'schema');\n}\n\n/**\n * Validates particular field against it's schema.\n */\nfunction validateField(validator: Ajv, fieldSchema: Record<string, unknown>, fieldKey: string): asserts fieldSchema is FieldDefinition {\n const matchingDefinitions = Object\n .values<any>(definitions) // cast as any, as the code in first branch seems to be invalid\n .filter((definition) => {\n return definition.properties.type.enum\n // This is a normal case where fieldSchema.type can be only one possible value matching definition.properties.type.enum.0\n ? definition.properties.type.enum[0] === fieldSchema.type\n // This is a type \"Any\" where fieldSchema.type is an array of possible values\n : Array.isArray(fieldSchema.type);\n });\n\n // There is not matching definition.\n if (matchingDefinitions.length === 0) {\n const errorMessage = m('inputSchema.validation.noMatchingDefinition', { fieldKey });\n throw new Error(`Input schema is not valid (${errorMessage})`);\n }\n\n // If there is only one matching then we are done and simply compare it.\n if (matchingDefinitions.length === 1) {\n validateAgainstSchemaOrThrow(validator, fieldSchema, matchingDefinitions[0], `schema.properties.${fieldKey}`);\n return;\n }\n\n // If there are more matching definitions then the type is string, and we need to get the right one.\n // If the definition contains \"enum\" property then it's enum type.\n if ((fieldSchema as StringFieldDefinition).enum) {\n const definition = matchingDefinitions.filter((item) => !!item.properties.enum).pop();\n if (!definition) throw new Error('Input schema validation failed to find \"enum property\" definition');\n validateAgainstSchemaOrThrow(validator, fieldSchema, definition, `schema.properties.${fieldKey}.enum`);\n return;\n }\n // Otherwise we use the other definition.\n const definition = matchingDefinitions.filter((item) => !item.properties.enum).pop();\n if (!definition) throw new Error('Input schema validation failed to find other than \"enum property\" definition');\n\n validateAgainstSchemaOrThrow(validator, fieldSchema, definition, `schema.properties.${fieldKey}`);\n}\n\n/**\n * Validates all properties in the input schema\n */\nfunction validateProperties(inputSchema: InputSchemaBaseChecked, validator: Ajv): asserts inputSchema is InputSchema {\n Object.entries(inputSchema.properties).forEach(([fieldKey, fieldSchema]) => (\n validateField(validator, fieldSchema, fieldKey)),\n );\n}\n\n/**\n * Validates that all required fields are present in properties list\n */\nexport function validateExistenceOfRequiredFields(inputSchema: InputSchema) {\n // If the input schema does not have any required fields, we do not need to validate them\n if (!inputSchema?.required?.length) return;\n\n Object.values(inputSchema?.required).forEach((fieldKey) => {\n // If the required field is present in the list of properties, we can check the next one\n if (inputSchema?.properties[fieldKey as string]) return;\n\n // The required field is not defined in list of properties. Which means the schema is not valid.\n throw new Error(m('inputSchema.validation.missingRequiredField', { fieldKey }));\n });\n}\n\n/**\n * This function validates given input schema first just for basic structure then each field one by one,\n * then checks that all required fields are present and finally checks fully against the whole schema.\n *\n * This way we get the most accurate error message for user.\n */\nexport function validateInputSchema(validator: Ajv, inputSchema: Record<string, unknown>): asserts inputSchema is InputSchema {\n // First validate just basic structure without fields.\n validateBasicStructure(validator, inputSchema);\n\n // Then validate each field separately.\n validateProperties(inputSchema, validator);\n\n // Next validate if required fields are actually present in the schema\n validateExistenceOfRequiredFields(inputSchema);\n\n // Finally just to be sure run validation against the whole schema.\n validateAgainstSchemaOrThrow(validator, inputSchema, schema, 'schema');\n}\n","import { PROXY_URL_REGEX, URL_REGEX } from '@apify/consts';\nimport { parse } from 'acorn-loose';\nimport { ValidateFunction } from 'ajv';\nimport { countries } from 'countries-list';\n\nimport { parseAjvError } from './input_schema';\nimport { m } from './intl';\n\n/**\n * Validates input field configured with proxy editor\n * @param fieldKey Proxy field value\n * @param value Proxy field value\n * @param [isRequired] Whether the field is required or not\n * @param [options] Information about proxy groups availability\n * @param [options.hasAutoProxyGroups] Informs validation whether user has atleast one proxy group available in auto mode\n * @param [options.availableProxyGroups] List of available proxy groups\n * @param [options.disabledProxyGroups] Object with groupId as key and error message as value (mostly for residential/SERP)\n */\nfunction validateProxyField(\n fieldKey: Record<string, unknown>,\n value: Record<string, any>,\n isRequired = false,\n options: { hasAutoProxyGroups?: boolean; availableProxyGroups?: string[]; disabledProxyGroups?: Record<string, unknown> } | null = null,\n) {\n const fieldErrors: any[] = [];\n if (isRequired) {\n // Nullable error is already handled by AJV\n if (value === null) return fieldErrors;\n if (!value) {\n const message = m('inputSchema.validation.required', { rootName: 'input', fieldKey });\n fieldErrors.push(message);\n return fieldErrors;\n }\n\n const { useApifyProxy, proxyUrls } = value;\n if (!useApifyProxy && (!Array.isArray(proxyUrls) || proxyUrls.length === 0)) {\n fieldErrors.push(m('inputSchema.validation.proxyRequired', { rootName: 'input', fieldKey }));\n return fieldErrors;\n }\n }\n\n // Input is not required, so missing value is valid\n if (!value) return fieldErrors;\n\n const { useApifyProxy, proxyUrls, apifyProxyGroups, apifyProxyCountry } = value;\n\n if (!useApifyProxy && Array.isArray(proxyUrls)) {\n let invalidUrl = false;\n proxyUrls.forEach((url) => {\n if (!PROXY_URL_REGEX.test(url.trim())) invalidUrl = url.trim();\n });\n if (invalidUrl) {\n fieldErrors.push(m('inputSchema.validation.customProxyInvalid', { invalidUrl }));\n }\n }\n\n // Apify proxy country can be set only when using Apify proxy\n if (!useApifyProxy && apifyProxyCountry) {\n fieldErrors.push(m('inputSchema.validation.apifyProxyCountryWithoutApifyProxyForbidden'));\n }\n\n // If Apify proxy is not used skip additional checks\n if (!useApifyProxy) return fieldErrors;\n\n // If Apify proxy is used, check if there is a selected country and if so, check that it's valid (empty or a valid country code)\n if (apifyProxyCountry && !countries[apifyProxyCountry as keyof typeof countries]) {\n fieldErrors.push(m('inputSchema.validation.apifyProxyCountryInvalid', { invalidCountry: apifyProxyCountry }));\n }\n\n // If options are not provided skip additional checks\n if (!options) return fieldErrors;\n\n // if apifyProxyGroups exists it must be an array of strings\n const isStringsArray = (array: Array<string>) => array.every((item) => typeof item === 'string');\n if (apifyProxyGroups && !(Array.isArray(apifyProxyGroups) && isStringsArray(apifyProxyGroups))) {\n fieldErrors.push(m('inputSchema.validation.proxyGroupMustBeArrayOfStrings', { rootName: 'input', fieldKey }));\n return fieldErrors;\n }\n\n const selectedProxyGroups = (apifyProxyGroups || []);\n\n // Auto mode, check that user has access to alteast one proxy group usable in this mode\n if (!selectedProxyGroups.length && !options.hasAutoProxyGroups) {\n fieldErrors.push(m('inputSchema.validation.noAvailableAutoProxy'));\n return fieldErrors;\n }\n\n // Check if proxy groups selected by user are available to him\n const availableProxyGroupsById = {} as Record<string, boolean>;\n (options.availableProxyGroups || []).forEach((group) => { availableProxyGroupsById[group] = true; });\n const unavailableProxyGroups = selectedProxyGroups.filter((group: string) => !availableProxyGroupsById[group]);\n\n if (unavailableProxyGroups.length) {\n fieldErrors.push(m('inputSchema.validation.proxyGroupsNotAvailable', {\n rootName: 'input',\n fieldKey,\n groups: unavailableProxyGroups.join(', '),\n }));\n }\n\n // Check if any of the proxy groups are blocked and if yes then output the associated message\n const blockedProxyGroupsById = options.disabledProxyGroups || {};\n selectedProxyGroups\n .filter((group: string) => blockedProxyGroupsById[group])\n .forEach((blockedGroup: string) => {\n fieldErrors.push(blockedProxyGroupsById[blockedGroup]);\n });\n\n return fieldErrors;\n}\n\n/**\n * Uses AJV validator to validate input with input schema and then\n * does custom validation for our own properties (nullable, patternKey, patternValue)\n * @param validator Initialized AJV validator\n * @param inputSchema Valid input schema in object\n * @param input Input object to be validated\n * @param options (Optional) Additional validation configuration for certain fields\n */\nexport function validateInputUsingValidator(\n validator: ValidateFunction,\n inputSchema: Record<string, any>,\n input: Record<string, unknown>,\n options: Record<string, any> = {},\n) {\n const isValid = validator(input); // Check if input is valid based on schema values\n\n const { properties } = inputSchema;\n const required = inputSchema.required || [];\n\n let errors: { fieldKey: string, message: string }[] = [];\n // Process AJV validation errors\n if (!isValid) {\n errors = validator.errors!\n .map((error) => parseAjvError(error, 'input', properties, input))\n .filter((error) => !!error) as any[];\n }\n\n Object.keys(properties).forEach((property) => {\n const value = input[property] as Record<string, any>;\n const { type, editor, patternKey, patternValue } = properties[property];\n const fieldErrors = [];\n // Check that proxy is required, if yes, valides that it's correctly setup\n if (type === 'object' && editor === 'proxy') {\n const proxyValidationErrors = validateProxyField(property as any, value, required.includes(property), options.proxy);\n proxyValidationErrors.forEach((error) => {\n fieldErrors.push(error);\n });\n }\n // Check that array items fit patternKey and patternValue\n if (type === 'array' && value && Array.isArray(value)) {\n if (editor === 'requestListSources') {\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!item) invalidIndexes.push(index);\n else if (!item.url && !item.requestsFromUrl) invalidIndexes.push(index);\n else if (item.url && !URL_REGEX.test(item.url)) invalidIndexes.push(index);\n else if (item.requestsFromUrl && !URL_REGEX.test(item.requestsFromUrl)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.requestListSourcesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n }));\n }\n }\n // If patternKey is provided, then validate keys of objects in array\n if (patternKey && editor === 'keyValue') {\n const check = new RegExp(patternKey);\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!check.test(item.key)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.arrayKeysInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n pattern: patternKey,\n }));\n }\n }\n // If patternValue is provided and editor is keyValue, then validate values of objecs in array\n if (patternValue && editor === 'keyValue') {\n const check = new RegExp(patternValue);\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!check.test(item.value)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.arrayValuesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n pattern: patternValue,\n }));\n }\n // If patternValue is provided and editor is stringList, then validate each item in array\n } else if (patternValue && editor === 'stringList') {\n const check = new RegExp(patternValue);\n const invalidIndexes: any[] = [];\n value.forEach((item, index) => {\n if (!check.test(item)) invalidIndexes.push(index);\n });\n if (invalidIndexes.length) {\n fieldErrors.push(m('inputSchema.validation.arrayValuesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidIndexes: invalidIndexes.join(','),\n pattern: patternValue,\n }));\n }\n }\n }\n // Check that object items fit patternKey and patternValue\n if (type === 'object' && value) {\n if (patternKey) {\n const check = new RegExp(patternKey);\n const invalidKeys: any[] = [];\n Object.keys(value).forEach((key) => {\n if (!check.test(key)) invalidKeys.push(key);\n });\n if (invalidKeys.length) {\n fieldErrors.push(m('inputSchema.validation.objectKeysInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidKeys: invalidKeys.join(','),\n pattern: patternKey,\n }));\n }\n }\n if (patternValue) {\n const check = new RegExp(patternValue);\n const invalidKeys: any[] = [];\n Object.keys(value).forEach((key) => {\n const propertyValue = value[key];\n if (typeof propertyValue !== 'string' || !check.test(propertyValue)) invalidKeys.push(key);\n });\n if (invalidKeys.length) {\n fieldErrors.push(m('inputSchema.validation.objectValuesInvalid', {\n rootName: 'input',\n fieldKey: property,\n invalidKeys: invalidKeys.join(','),\n pattern: patternValue,\n }));\n }\n }\n }\n if (fieldErrors.length > 0) {\n const message = fieldErrors.join(', ');\n errors.push({ fieldKey: property, message });\n }\n });\n\n return errors;\n}\n\n/**\n * This functions parses all given JSON and then takes each of the jsFields.\n * Then if the field:\n * - is valid JS single function it replaces its single line string with a function delacation.\n * - is valid multiline JS code then replaces its single line string with `multiline` string\n * Then stringifies the code with given number of jsonSpacing spaces and finally prefixes whole\n * stringified JSON except the first line with globalSpacing spaces.\n */\nexport function makeInputJsFieldsReadable(json: string, jsFields: string[], jsonSpacing = 4, globalSpacing = 0): string {\n const parsedJson = JSON.parse(json);\n const replacements: Record<string, any> = {};\n\n jsFields.forEach((field) => {\n let maybeFunction = parsedJson[field];\n if (!maybeFunction || typeof maybeFunction !== 'string') return;\n\n let ast;\n try {\n ast = parse(maybeFunction, { ecmaVersion: 'latest' });\n } catch (err) {\n // Don't do anything in a case of invalid JS code.\n return;\n }\n\n const isMultiline = maybeFunction.includes('\\n');\n const isSingleFunction = ast\n && ast.body.length === 1\n && (\n ast.body[0].type === 'FunctionDeclaration'\n || (ast.body[0].type === 'ExpressionStatement' && ast.body[0].expression.type === 'ArrowFunctionExpression')\n );\n\n // If it's not a function declaration or multiline JS code then we do nothing.\n if (!isSingleFunction && !isMultiline) return;\n\n const spaces = (new Array(isSingleFunction ? jsonSpacing : jsonSpacing * 2)).fill(' ').join('');\n maybeFunction = maybeFunction\n .split('\\n').join(`\\n${spaces}`) // This prefixes each line with spaces.\n .trim(); // Trim whitespace on both sides\n\n const replacementValue = isSingleFunction\n ? maybeFunction.replace(/[;]+$/g, '') // Remove trailing semicolons\n : `\\`${maybeFunction}\\``;\n const replacementToken = `<<<REPLACEMENT_TOKEN:${Math.random()}>>>`;\n replacements[replacementToken] = replacementValue;\n parsedJson[field] = replacementToken;\n });\n\n let niceJson = JSON.stringify(parsedJson, null, jsonSpacing);\n\n Object.entries(replacements).forEach(([replacementToken, replacementValue]) => {\n niceJson = niceJson.replace(`\"${replacementToken}\"`, replacementValue);\n });\n\n const globalSpaces = (new Array(globalSpacing)).fill(' ').join('');\n niceJson = niceJson.split('\\n').join(`\\n${globalSpaces}`);\n\n return niceJson;\n}\n"],"mappings":";;;;AAAA,IAAM,cAAc;AAAA,EAChB,kCACI;AAAA,EACJ,mCACI;AAAA,EACJ,wCACI;AAAA,EACJ,oDACI;AAAA,EACJ,2CACI;AAAA,EACJ,6CACI;AAAA,EACJ,4CACI;AAAA,EACJ,8CACI;AAAA,EACJ,6CACI;AAAA,EACJ,kDACI;AAAA,EACJ,6CACI;AAAA,EACJ,mDACI;AAAA,EACJ,sEACI;AAAA,EACJ,+CACI;AAAA,EACJ,+CACI;AAAA,EACJ,+CACI;AAAA,EACJ,yDACI;AACR;AAKO,SAAS,EAAE,UAAkB,WAAiC;AACjE,MAAI,OAAO,YAAY,QAAoC;AAC3D,MAAI,CAAC,KAAM,QAAO;AAElB,MAAI,WAAW;AACX,WAAO,KAAK,SAAS,EAAE,QAAQ,CAAC,iBAAiB;AAC7C,aAAO,KAAK,MAAM,IAAI,YAAY,GAAG,EAAE,KAAK,UAAU,YAAY,CAAC;AAAA,IACvE,CAAC;AAAA,EACL;AAEA,SAAO;AACX;AAXgB;;;ACxChB;AAAA,EACI,OAAS;AAAA,EACT,MAAQ;AAAA,EACR,YAAc;AAAA,IACV,SAAW;AAAA,MACP,MAAQ;AAAA,IACZ;AAAA,IACA,OAAS;AAAA,MACL,MAAQ;AAAA,IACZ;AAAA,IACA,eAAiB;AAAA,MACb,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,SAAW;AAAA,IACf;A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AM,SAAU,IAAI,MAAM,mBAAmB,cAAc,cAAc,CAAC,EAAG,KAAK,GAAG,EAAE,KAAK,EAAE;AAC9F,oBAAgB,cACX,MAAM,IAAI,EAAE,KAAK;AAAA,EAAK,MAAM,EAAE,EAC9B,KAAK;AAEV,UAAM,mBAAmB,mBACnB,cAAc,QAAQ,UAAU,EAAE,IAClC,KAAK,aAAa;AACxB,UAAM,mBAAmB,wBAAwB,KAAK,OAAO,CAAC;AAC9D,iBAAa,gBAAgB,IAAI;AACjC,eAAW,KAAK,IAAI;AAAA,EACxB,CAAC;AAED,MAAI,WAAW,KAAK,UAAU,YAAY,MAAM,WAAW;AAE3D,SAAO,QAAQ,YAAY,EAAE,QAAQ,CAAC,CAAC,kBAAkB,gBAAgB,MAAM;AAC3E,eAAW,SAAS,QAAQ,IAAI,gBAAgB,KAAK,gBAAgB;AAAA,EACzE,CAAC;AAED,QAAM,eAAgB,IAAI,MAAM,aAAa,EAAG,KAAK,GAAG,EAAE,KAAK,EAAE;AACjE,aAAW,SAAS,MAAM,IAAI,EAAE,KAAK;AAAA,EAAK,YAAY,EAAE;AAExD,SAAO;AACX;AAlDgB;","names":["definition","useApifyProxy","proxyUrls"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/input_schema",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Tools and constants shared across Apify projects.",
|
|
5
5
|
"main": "./cjs/index.cjs",
|
|
6
6
|
"module": "./esm/index.mjs",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"ajv": "^8.0.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "6c0d6d45bed2c98666dd1b23627b62bc4bbddb09"
|
|
59
59
|
}
|