@apify/input_schema 3.9.4 → 3.10.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/cjs/index.cjs +52 -3
- package/cjs/index.cjs.map +1 -1
- package/cjs/index.d.ts +139 -10
- package/esm/index.d.mts +139 -10
- package/esm/index.mjs +52 -3
- package/esm/index.mjs.map +1 -1
- package/package.json +2 -2
package/cjs/index.d.ts
CHANGED
|
@@ -61,6 +61,12 @@ var properties = {
|
|
|
61
61
|
{
|
|
62
62
|
$ref: "#/definitions/booleanProperty"
|
|
63
63
|
},
|
|
64
|
+
{
|
|
65
|
+
$ref: "#/definitions/resourceProperty"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
$ref: "#/definitions/resourceArrayProperty"
|
|
69
|
+
},
|
|
64
70
|
{
|
|
65
71
|
$ref: "#/definitions/anyProperty"
|
|
66
72
|
}
|
|
@@ -165,10 +171,7 @@ var definitions = {
|
|
|
165
171
|
"textfield",
|
|
166
172
|
"textarea",
|
|
167
173
|
"datepicker",
|
|
168
|
-
"hidden"
|
|
169
|
-
"dataset",
|
|
170
|
-
"keyValueStore",
|
|
171
|
-
"requestQueue"
|
|
174
|
+
"hidden"
|
|
172
175
|
]
|
|
173
176
|
},
|
|
174
177
|
isSecret: {
|
|
@@ -329,10 +332,7 @@ var definitions = {
|
|
|
329
332
|
"textfield",
|
|
330
333
|
"textarea",
|
|
331
334
|
"datepicker",
|
|
332
|
-
"hidden"
|
|
333
|
-
"dataset",
|
|
334
|
-
"keyValueStore",
|
|
335
|
-
"requestQueue"
|
|
335
|
+
"hidden"
|
|
336
336
|
]
|
|
337
337
|
},
|
|
338
338
|
isSecret: {
|
|
@@ -738,6 +738,125 @@ var definitions = {
|
|
|
738
738
|
"description"
|
|
739
739
|
]
|
|
740
740
|
},
|
|
741
|
+
resourceProperty: {
|
|
742
|
+
title: "Resource property",
|
|
743
|
+
type: "object",
|
|
744
|
+
additionalProperties: false,
|
|
745
|
+
properties: {
|
|
746
|
+
type: {
|
|
747
|
+
"enum": [
|
|
748
|
+
"string"
|
|
749
|
+
]
|
|
750
|
+
},
|
|
751
|
+
title: {
|
|
752
|
+
type: "string"
|
|
753
|
+
},
|
|
754
|
+
description: {
|
|
755
|
+
type: "string"
|
|
756
|
+
},
|
|
757
|
+
editor: {
|
|
758
|
+
"enum": [
|
|
759
|
+
"resourcePicker",
|
|
760
|
+
"hidden"
|
|
761
|
+
]
|
|
762
|
+
},
|
|
763
|
+
resourceType: {
|
|
764
|
+
"enum": [
|
|
765
|
+
"dataset",
|
|
766
|
+
"keyValueStore",
|
|
767
|
+
"requestQueue"
|
|
768
|
+
]
|
|
769
|
+
},
|
|
770
|
+
"default": {
|
|
771
|
+
type: "string"
|
|
772
|
+
},
|
|
773
|
+
prefill: {
|
|
774
|
+
type: "string"
|
|
775
|
+
},
|
|
776
|
+
example: {
|
|
777
|
+
type: "string"
|
|
778
|
+
},
|
|
779
|
+
nullable: {
|
|
780
|
+
type: "boolean"
|
|
781
|
+
},
|
|
782
|
+
sectionCaption: {
|
|
783
|
+
type: "string"
|
|
784
|
+
},
|
|
785
|
+
sectionDescription: {
|
|
786
|
+
type: "string"
|
|
787
|
+
}
|
|
788
|
+
},
|
|
789
|
+
required: [
|
|
790
|
+
"type",
|
|
791
|
+
"title",
|
|
792
|
+
"description",
|
|
793
|
+
"resourceType"
|
|
794
|
+
]
|
|
795
|
+
},
|
|
796
|
+
resourceArrayProperty: {
|
|
797
|
+
title: "Resource array property",
|
|
798
|
+
type: "object",
|
|
799
|
+
additionalProperties: false,
|
|
800
|
+
properties: {
|
|
801
|
+
type: {
|
|
802
|
+
"enum": [
|
|
803
|
+
"array"
|
|
804
|
+
]
|
|
805
|
+
},
|
|
806
|
+
title: {
|
|
807
|
+
type: "string"
|
|
808
|
+
},
|
|
809
|
+
description: {
|
|
810
|
+
type: "string"
|
|
811
|
+
},
|
|
812
|
+
editor: {
|
|
813
|
+
"enum": [
|
|
814
|
+
"resourcePicker",
|
|
815
|
+
"hidden"
|
|
816
|
+
]
|
|
817
|
+
},
|
|
818
|
+
"default": {
|
|
819
|
+
type: "array"
|
|
820
|
+
},
|
|
821
|
+
prefill: {
|
|
822
|
+
type: "array"
|
|
823
|
+
},
|
|
824
|
+
example: {
|
|
825
|
+
type: "array"
|
|
826
|
+
},
|
|
827
|
+
nullable: {
|
|
828
|
+
type: "boolean"
|
|
829
|
+
},
|
|
830
|
+
minItems: {
|
|
831
|
+
type: "integer"
|
|
832
|
+
},
|
|
833
|
+
maxItems: {
|
|
834
|
+
type: "integer"
|
|
835
|
+
},
|
|
836
|
+
uniqueItems: {
|
|
837
|
+
type: "boolean"
|
|
838
|
+
},
|
|
839
|
+
resourceType: {
|
|
840
|
+
"enum": [
|
|
841
|
+
"dataset",
|
|
842
|
+
"keyValueStore",
|
|
843
|
+
"requestQueue"
|
|
844
|
+
]
|
|
845
|
+
},
|
|
846
|
+
sectionCaption: {
|
|
847
|
+
type: "string"
|
|
848
|
+
},
|
|
849
|
+
sectionDescription: {
|
|
850
|
+
type: "string"
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
required: [
|
|
854
|
+
"type",
|
|
855
|
+
"title",
|
|
856
|
+
"description",
|
|
857
|
+
"resourceType"
|
|
858
|
+
]
|
|
859
|
+
},
|
|
741
860
|
anyProperty: {
|
|
742
861
|
title: "Any property",
|
|
743
862
|
type: "object",
|
|
@@ -839,7 +958,7 @@ type CommonFieldDefinition<T> = {
|
|
|
839
958
|
};
|
|
840
959
|
type StringFieldDefinition = CommonFieldDefinition<string> & {
|
|
841
960
|
type: 'string';
|
|
842
|
-
editor: 'textfield' | 'textarea' | 'javascript' | 'python' | 'select' | 'datepicker' | 'hidden' | 'json'
|
|
961
|
+
editor: 'textfield' | 'textarea' | 'javascript' | 'python' | 'select' | 'datepicker' | 'hidden' | 'json';
|
|
843
962
|
pattern?: string;
|
|
844
963
|
minLength?: number;
|
|
845
964
|
maxLength?: number;
|
|
@@ -882,12 +1001,22 @@ type ArrayFieldDefinition = CommonFieldDefinition<Array<unknown>> & {
|
|
|
882
1001
|
uniqueItems?: boolean;
|
|
883
1002
|
items?: unknown;
|
|
884
1003
|
};
|
|
1004
|
+
type CommonResourceFieldDefinition<T> = CommonFieldDefinition<T> & {
|
|
1005
|
+
editor?: 'resourcePicker' | 'hidden';
|
|
1006
|
+
resourceType: 'dataset' | 'keyValueStore' | 'requestQueue';
|
|
1007
|
+
};
|
|
1008
|
+
type ResourceFieldDefinition = CommonResourceFieldDefinition<string> & {
|
|
1009
|
+
type: 'string';
|
|
1010
|
+
};
|
|
1011
|
+
type ResourceArrayFieldDefinition = CommonResourceFieldDefinition<string[]> & {
|
|
1012
|
+
type: 'array';
|
|
1013
|
+
};
|
|
885
1014
|
type AllTypes = StringFieldDefinition['type'] | BooleanFieldDefinition['type'] | IntegerFieldDefinition['type'] | ObjectFieldDefinition['type'] | ArrayFieldDefinition['type'];
|
|
886
1015
|
type MixedFieldDefinition = CommonFieldDefinition<never> & {
|
|
887
1016
|
type: readonly AllTypes[];
|
|
888
1017
|
editor: 'json';
|
|
889
1018
|
};
|
|
890
|
-
type FieldDefinition = StringFieldDefinition | BooleanFieldDefinition | IntegerFieldDefinition | ObjectFieldDefinition | ArrayFieldDefinition | MixedFieldDefinition;
|
|
1019
|
+
type FieldDefinition = StringFieldDefinition | BooleanFieldDefinition | IntegerFieldDefinition | ObjectFieldDefinition | ArrayFieldDefinition | MixedFieldDefinition | ResourceFieldDefinition | ResourceArrayFieldDefinition;
|
|
891
1020
|
/**
|
|
892
1021
|
* Type with checked base & properties
|
|
893
1022
|
*/
|
package/esm/index.d.mts
CHANGED
|
@@ -61,6 +61,12 @@ var properties = {
|
|
|
61
61
|
{
|
|
62
62
|
$ref: "#/definitions/booleanProperty"
|
|
63
63
|
},
|
|
64
|
+
{
|
|
65
|
+
$ref: "#/definitions/resourceProperty"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
$ref: "#/definitions/resourceArrayProperty"
|
|
69
|
+
},
|
|
64
70
|
{
|
|
65
71
|
$ref: "#/definitions/anyProperty"
|
|
66
72
|
}
|
|
@@ -165,10 +171,7 @@ var definitions = {
|
|
|
165
171
|
"textfield",
|
|
166
172
|
"textarea",
|
|
167
173
|
"datepicker",
|
|
168
|
-
"hidden"
|
|
169
|
-
"dataset",
|
|
170
|
-
"keyValueStore",
|
|
171
|
-
"requestQueue"
|
|
174
|
+
"hidden"
|
|
172
175
|
]
|
|
173
176
|
},
|
|
174
177
|
isSecret: {
|
|
@@ -329,10 +332,7 @@ var definitions = {
|
|
|
329
332
|
"textfield",
|
|
330
333
|
"textarea",
|
|
331
334
|
"datepicker",
|
|
332
|
-
"hidden"
|
|
333
|
-
"dataset",
|
|
334
|
-
"keyValueStore",
|
|
335
|
-
"requestQueue"
|
|
335
|
+
"hidden"
|
|
336
336
|
]
|
|
337
337
|
},
|
|
338
338
|
isSecret: {
|
|
@@ -738,6 +738,125 @@ var definitions = {
|
|
|
738
738
|
"description"
|
|
739
739
|
]
|
|
740
740
|
},
|
|
741
|
+
resourceProperty: {
|
|
742
|
+
title: "Resource property",
|
|
743
|
+
type: "object",
|
|
744
|
+
additionalProperties: false,
|
|
745
|
+
properties: {
|
|
746
|
+
type: {
|
|
747
|
+
"enum": [
|
|
748
|
+
"string"
|
|
749
|
+
]
|
|
750
|
+
},
|
|
751
|
+
title: {
|
|
752
|
+
type: "string"
|
|
753
|
+
},
|
|
754
|
+
description: {
|
|
755
|
+
type: "string"
|
|
756
|
+
},
|
|
757
|
+
editor: {
|
|
758
|
+
"enum": [
|
|
759
|
+
"resourcePicker",
|
|
760
|
+
"hidden"
|
|
761
|
+
]
|
|
762
|
+
},
|
|
763
|
+
resourceType: {
|
|
764
|
+
"enum": [
|
|
765
|
+
"dataset",
|
|
766
|
+
"keyValueStore",
|
|
767
|
+
"requestQueue"
|
|
768
|
+
]
|
|
769
|
+
},
|
|
770
|
+
"default": {
|
|
771
|
+
type: "string"
|
|
772
|
+
},
|
|
773
|
+
prefill: {
|
|
774
|
+
type: "string"
|
|
775
|
+
},
|
|
776
|
+
example: {
|
|
777
|
+
type: "string"
|
|
778
|
+
},
|
|
779
|
+
nullable: {
|
|
780
|
+
type: "boolean"
|
|
781
|
+
},
|
|
782
|
+
sectionCaption: {
|
|
783
|
+
type: "string"
|
|
784
|
+
},
|
|
785
|
+
sectionDescription: {
|
|
786
|
+
type: "string"
|
|
787
|
+
}
|
|
788
|
+
},
|
|
789
|
+
required: [
|
|
790
|
+
"type",
|
|
791
|
+
"title",
|
|
792
|
+
"description",
|
|
793
|
+
"resourceType"
|
|
794
|
+
]
|
|
795
|
+
},
|
|
796
|
+
resourceArrayProperty: {
|
|
797
|
+
title: "Resource array property",
|
|
798
|
+
type: "object",
|
|
799
|
+
additionalProperties: false,
|
|
800
|
+
properties: {
|
|
801
|
+
type: {
|
|
802
|
+
"enum": [
|
|
803
|
+
"array"
|
|
804
|
+
]
|
|
805
|
+
},
|
|
806
|
+
title: {
|
|
807
|
+
type: "string"
|
|
808
|
+
},
|
|
809
|
+
description: {
|
|
810
|
+
type: "string"
|
|
811
|
+
},
|
|
812
|
+
editor: {
|
|
813
|
+
"enum": [
|
|
814
|
+
"resourcePicker",
|
|
815
|
+
"hidden"
|
|
816
|
+
]
|
|
817
|
+
},
|
|
818
|
+
"default": {
|
|
819
|
+
type: "array"
|
|
820
|
+
},
|
|
821
|
+
prefill: {
|
|
822
|
+
type: "array"
|
|
823
|
+
},
|
|
824
|
+
example: {
|
|
825
|
+
type: "array"
|
|
826
|
+
},
|
|
827
|
+
nullable: {
|
|
828
|
+
type: "boolean"
|
|
829
|
+
},
|
|
830
|
+
minItems: {
|
|
831
|
+
type: "integer"
|
|
832
|
+
},
|
|
833
|
+
maxItems: {
|
|
834
|
+
type: "integer"
|
|
835
|
+
},
|
|
836
|
+
uniqueItems: {
|
|
837
|
+
type: "boolean"
|
|
838
|
+
},
|
|
839
|
+
resourceType: {
|
|
840
|
+
"enum": [
|
|
841
|
+
"dataset",
|
|
842
|
+
"keyValueStore",
|
|
843
|
+
"requestQueue"
|
|
844
|
+
]
|
|
845
|
+
},
|
|
846
|
+
sectionCaption: {
|
|
847
|
+
type: "string"
|
|
848
|
+
},
|
|
849
|
+
sectionDescription: {
|
|
850
|
+
type: "string"
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
required: [
|
|
854
|
+
"type",
|
|
855
|
+
"title",
|
|
856
|
+
"description",
|
|
857
|
+
"resourceType"
|
|
858
|
+
]
|
|
859
|
+
},
|
|
741
860
|
anyProperty: {
|
|
742
861
|
title: "Any property",
|
|
743
862
|
type: "object",
|
|
@@ -839,7 +958,7 @@ type CommonFieldDefinition<T> = {
|
|
|
839
958
|
};
|
|
840
959
|
type StringFieldDefinition = CommonFieldDefinition<string> & {
|
|
841
960
|
type: 'string';
|
|
842
|
-
editor: 'textfield' | 'textarea' | 'javascript' | 'python' | 'select' | 'datepicker' | 'hidden' | 'json'
|
|
961
|
+
editor: 'textfield' | 'textarea' | 'javascript' | 'python' | 'select' | 'datepicker' | 'hidden' | 'json';
|
|
843
962
|
pattern?: string;
|
|
844
963
|
minLength?: number;
|
|
845
964
|
maxLength?: number;
|
|
@@ -882,12 +1001,22 @@ type ArrayFieldDefinition = CommonFieldDefinition<Array<unknown>> & {
|
|
|
882
1001
|
uniqueItems?: boolean;
|
|
883
1002
|
items?: unknown;
|
|
884
1003
|
};
|
|
1004
|
+
type CommonResourceFieldDefinition<T> = CommonFieldDefinition<T> & {
|
|
1005
|
+
editor?: 'resourcePicker' | 'hidden';
|
|
1006
|
+
resourceType: 'dataset' | 'keyValueStore' | 'requestQueue';
|
|
1007
|
+
};
|
|
1008
|
+
type ResourceFieldDefinition = CommonResourceFieldDefinition<string> & {
|
|
1009
|
+
type: 'string';
|
|
1010
|
+
};
|
|
1011
|
+
type ResourceArrayFieldDefinition = CommonResourceFieldDefinition<string[]> & {
|
|
1012
|
+
type: 'array';
|
|
1013
|
+
};
|
|
885
1014
|
type AllTypes = StringFieldDefinition['type'] | BooleanFieldDefinition['type'] | IntegerFieldDefinition['type'] | ObjectFieldDefinition['type'] | ArrayFieldDefinition['type'];
|
|
886
1015
|
type MixedFieldDefinition = CommonFieldDefinition<never> & {
|
|
887
1016
|
type: readonly AllTypes[];
|
|
888
1017
|
editor: 'json';
|
|
889
1018
|
};
|
|
890
|
-
type FieldDefinition = StringFieldDefinition | BooleanFieldDefinition | IntegerFieldDefinition | ObjectFieldDefinition | ArrayFieldDefinition | MixedFieldDefinition;
|
|
1019
|
+
type FieldDefinition = StringFieldDefinition | BooleanFieldDefinition | IntegerFieldDefinition | ObjectFieldDefinition | ArrayFieldDefinition | MixedFieldDefinition | ResourceFieldDefinition | ResourceArrayFieldDefinition;
|
|
891
1020
|
/**
|
|
892
1021
|
* Type with checked base & properties
|
|
893
1022
|
*/
|
package/esm/index.mjs
CHANGED
|
@@ -80,6 +80,8 @@ var schema_default = {
|
|
|
80
80
|
{ $ref: "#/definitions/objectProperty" },
|
|
81
81
|
{ $ref: "#/definitions/integerProperty" },
|
|
82
82
|
{ $ref: "#/definitions/booleanProperty" },
|
|
83
|
+
{ $ref: "#/definitions/resourceProperty" },
|
|
84
|
+
{ $ref: "#/definitions/resourceArrayProperty" },
|
|
83
85
|
{ $ref: "#/definitions/anyProperty" }
|
|
84
86
|
]
|
|
85
87
|
}
|
|
@@ -127,7 +129,7 @@ var schema_default = {
|
|
|
127
129
|
title: { type: "string" },
|
|
128
130
|
description: { type: "string" },
|
|
129
131
|
nullable: { type: "boolean" },
|
|
130
|
-
editor: { enum: ["javascript", "python", "textfield", "textarea", "datepicker", "hidden"
|
|
132
|
+
editor: { enum: ["javascript", "python", "textfield", "textarea", "datepicker", "hidden"] },
|
|
131
133
|
isSecret: { type: "boolean" }
|
|
132
134
|
},
|
|
133
135
|
required: ["type", "title", "description", "editor"],
|
|
@@ -188,7 +190,7 @@ var schema_default = {
|
|
|
188
190
|
nullable: { type: "boolean" },
|
|
189
191
|
minLength: { type: "integer" },
|
|
190
192
|
maxLength: { type: "integer" },
|
|
191
|
-
editor: { enum: ["javascript", "python", "textfield", "textarea", "datepicker", "hidden"
|
|
193
|
+
editor: { enum: ["javascript", "python", "textfield", "textarea", "datepicker", "hidden"] },
|
|
192
194
|
isSecret: { type: "boolean" },
|
|
193
195
|
sectionCaption: { type: "string" },
|
|
194
196
|
sectionDescription: { type: "string" }
|
|
@@ -346,6 +348,47 @@ var schema_default = {
|
|
|
346
348
|
},
|
|
347
349
|
required: ["type", "title", "description"]
|
|
348
350
|
},
|
|
351
|
+
resourceProperty: {
|
|
352
|
+
title: "Resource property",
|
|
353
|
+
type: "object",
|
|
354
|
+
additionalProperties: false,
|
|
355
|
+
properties: {
|
|
356
|
+
type: { enum: ["string"] },
|
|
357
|
+
title: { type: "string" },
|
|
358
|
+
description: { type: "string" },
|
|
359
|
+
editor: { enum: ["resourcePicker", "hidden"] },
|
|
360
|
+
resourceType: { enum: ["dataset", "keyValueStore", "requestQueue"] },
|
|
361
|
+
default: { type: "string" },
|
|
362
|
+
prefill: { type: "string" },
|
|
363
|
+
example: { type: "string" },
|
|
364
|
+
nullable: { type: "boolean" },
|
|
365
|
+
sectionCaption: { type: "string" },
|
|
366
|
+
sectionDescription: { type: "string" }
|
|
367
|
+
},
|
|
368
|
+
required: ["type", "title", "description", "resourceType"]
|
|
369
|
+
},
|
|
370
|
+
resourceArrayProperty: {
|
|
371
|
+
title: "Resource array property",
|
|
372
|
+
type: "object",
|
|
373
|
+
additionalProperties: false,
|
|
374
|
+
properties: {
|
|
375
|
+
type: { enum: ["array"] },
|
|
376
|
+
title: { type: "string" },
|
|
377
|
+
description: { type: "string" },
|
|
378
|
+
editor: { enum: ["resourcePicker", "hidden"] },
|
|
379
|
+
default: { type: "array" },
|
|
380
|
+
prefill: { type: "array" },
|
|
381
|
+
example: { type: "array" },
|
|
382
|
+
nullable: { type: "boolean" },
|
|
383
|
+
minItems: { type: "integer" },
|
|
384
|
+
maxItems: { type: "integer" },
|
|
385
|
+
uniqueItems: { type: "boolean" },
|
|
386
|
+
resourceType: { enum: ["dataset", "keyValueStore", "requestQueue"] },
|
|
387
|
+
sectionCaption: { type: "string" },
|
|
388
|
+
sectionDescription: { type: "string" }
|
|
389
|
+
},
|
|
390
|
+
required: ["type", "title", "description", "resourceType"]
|
|
391
|
+
},
|
|
349
392
|
anyProperty: {
|
|
350
393
|
title: "Any property",
|
|
351
394
|
type: "object",
|
|
@@ -446,7 +489,13 @@ function validateField(validator, fieldSchema, fieldKey) {
|
|
|
446
489
|
validateAgainstSchemaOrThrow(validator, fieldSchema, definition2, `schema.properties.${fieldKey}.enum`);
|
|
447
490
|
return;
|
|
448
491
|
}
|
|
449
|
-
|
|
492
|
+
if (fieldSchema.resourceType) {
|
|
493
|
+
const definition2 = matchingDefinitions.filter((item) => !!item.properties.resourceType).pop();
|
|
494
|
+
if (!definition2) throw new Error('Input schema validation failed to find "resource property" definition');
|
|
495
|
+
validateAgainstSchemaOrThrow(validator, fieldSchema, definition2, `schema.properties.${fieldKey}`);
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
const definition = matchingDefinitions.filter((item) => !item.properties.enum && !item.properties.resourceType).pop();
|
|
450
499
|
if (!definition) throw new Error('Input schema validation failed to find other than "enum property" definition');
|
|
451
500
|
validateAgainstSchemaOrThrow(validator, fieldSchema, definition, `schema.properties.${fieldKey}`);
|
|
452
501
|
}
|