@valbuild/core 0.96.2 → 0.97.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/dist/declarations/src/index.d.ts +1 -0
- package/dist/declarations/src/initSchema.d.ts +13 -0
- package/dist/declarations/src/schema/array.d.ts +10 -1
- package/dist/declarations/src/schema/boolean.d.ts +10 -1
- package/dist/declarations/src/schema/date.d.ts +10 -1
- package/dist/declarations/src/schema/datetime.d.ts +56 -0
- package/dist/declarations/src/schema/file.d.ts +10 -1
- package/dist/declarations/src/schema/image.d.ts +10 -1
- package/dist/declarations/src/schema/index.d.ts +16 -1
- package/dist/declarations/src/schema/keyOf.d.ts +10 -1
- package/dist/declarations/src/schema/literal.d.ts +10 -1
- package/dist/declarations/src/schema/number.d.ts +10 -1
- package/dist/declarations/src/schema/object.d.ts +10 -1
- package/dist/declarations/src/schema/record.d.ts +10 -1
- package/dist/declarations/src/schema/richtext.d.ts +10 -1
- package/dist/declarations/src/schema/route.d.ts +10 -1
- package/dist/declarations/src/schema/string.d.ts +10 -1
- package/dist/declarations/src/schema/union.d.ts +13 -1
- package/dist/{index-68cee7e3.esm.js → index-50fd9c06.esm.js} +669 -137
- package/dist/{index-1d88f031.cjs.dev.js → index-96716d5d.cjs.dev.js} +669 -136
- package/dist/{index-2e89de75.cjs.prod.js → index-f203e2fa.cjs.prod.js} +669 -136
- package/dist/valbuild-core.cjs.dev.js +2 -1
- package/dist/valbuild-core.cjs.prod.js +2 -1
- package/dist/valbuild-core.esm.js +1 -1
- package/package.json +1 -1
- package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
- package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
- package/patch/dist/valbuild-core-patch.esm.js +2 -2
|
@@ -416,6 +416,9 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
416
416
|
var isRemote = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
417
417
|
var customValidateFunctions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
418
418
|
var moduleMetadata = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
419
|
+
var isReadonly = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
420
|
+
var isHidden = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
421
|
+
var description = arguments.length > 7 ? arguments[7] : undefined;
|
|
419
422
|
_classCallCheck(this, FileSchema);
|
|
420
423
|
_this = _callSuper(this, FileSchema);
|
|
421
424
|
_this.options = options;
|
|
@@ -423,18 +426,26 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
423
426
|
_this.isRemote = isRemote;
|
|
424
427
|
_this.customValidateFunctions = customValidateFunctions;
|
|
425
428
|
_this.moduleMetadata = moduleMetadata;
|
|
429
|
+
_this.isReadonly = isReadonly;
|
|
430
|
+
_this.isHidden = isHidden;
|
|
431
|
+
_this.description = description;
|
|
426
432
|
return _this;
|
|
427
433
|
}
|
|
428
434
|
_inherits(FileSchema, _Schema);
|
|
429
435
|
return _createClass(FileSchema, [{
|
|
436
|
+
key: "describe",
|
|
437
|
+
value: function describe(description) {
|
|
438
|
+
return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
439
|
+
}
|
|
440
|
+
}, {
|
|
430
441
|
key: "remote",
|
|
431
442
|
value: function remote() {
|
|
432
|
-
return new FileSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata);
|
|
443
|
+
return new FileSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
|
|
433
444
|
}
|
|
434
445
|
}, {
|
|
435
446
|
key: "validate",
|
|
436
447
|
value: function validate(validationFunction) {
|
|
437
|
-
return new FileSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata);
|
|
448
|
+
return new FileSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
|
|
438
449
|
}
|
|
439
450
|
}, {
|
|
440
451
|
key: "executeValidate",
|
|
@@ -595,7 +606,17 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
595
606
|
}, {
|
|
596
607
|
key: "nullable",
|
|
597
608
|
value: function nullable() {
|
|
598
|
-
return new FileSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata);
|
|
609
|
+
return new FileSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
|
|
610
|
+
}
|
|
611
|
+
}, {
|
|
612
|
+
key: "readonly",
|
|
613
|
+
value: function readonly() {
|
|
614
|
+
return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, true, this.isHidden, this.description);
|
|
615
|
+
}
|
|
616
|
+
}, {
|
|
617
|
+
key: "hidden",
|
|
618
|
+
value: function hidden() {
|
|
619
|
+
return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, true, this.description);
|
|
599
620
|
}
|
|
600
621
|
}, {
|
|
601
622
|
key: "executeSerialize",
|
|
@@ -608,7 +629,10 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
608
629
|
opt: this.opt,
|
|
609
630
|
remote: this.isRemote,
|
|
610
631
|
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
611
|
-
referencedModule: modulePaths.length > 0 ? modulePaths[0] : undefined
|
|
632
|
+
referencedModule: modulePaths.length > 0 ? modulePaths[0] : undefined,
|
|
633
|
+
readonly: this.isReadonly,
|
|
634
|
+
hidden: this.isHidden,
|
|
635
|
+
description: this.description
|
|
612
636
|
};
|
|
613
637
|
}
|
|
614
638
|
}, {
|
|
@@ -688,6 +712,9 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
688
712
|
var isRaw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
689
713
|
var customValidateFunctions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
690
714
|
var renderInput = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
715
|
+
var isReadonly = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
716
|
+
var isHidden = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
717
|
+
var description = arguments.length > 7 ? arguments[7] : undefined;
|
|
691
718
|
_classCallCheck(this, StringSchema);
|
|
692
719
|
_this = _callSuper(this, StringSchema);
|
|
693
720
|
_this.options = options;
|
|
@@ -695,14 +722,22 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
695
722
|
_this.isRaw = isRaw;
|
|
696
723
|
_this.customValidateFunctions = customValidateFunctions;
|
|
697
724
|
_this.renderInput = renderInput;
|
|
725
|
+
_this.isReadonly = isReadonly;
|
|
726
|
+
_this.isHidden = isHidden;
|
|
727
|
+
_this.description = description;
|
|
698
728
|
return _this;
|
|
699
729
|
}
|
|
700
|
-
|
|
701
|
-
/**
|
|
702
|
-
* @deprecated Use `minLength` instead
|
|
703
|
-
*/
|
|
704
730
|
_inherits(StringSchema, _Schema);
|
|
705
731
|
return _createClass(StringSchema, [{
|
|
732
|
+
key: "describe",
|
|
733
|
+
value: function describe(description) {
|
|
734
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* @deprecated Use `minLength` instead
|
|
739
|
+
*/
|
|
740
|
+
}, {
|
|
706
741
|
key: "min",
|
|
707
742
|
value: function min(minLength) {
|
|
708
743
|
return this.minLength(minLength);
|
|
@@ -712,7 +747,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
712
747
|
value: function minLength(_minLength) {
|
|
713
748
|
return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
714
749
|
minLength: _minLength
|
|
715
|
-
}), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput);
|
|
750
|
+
}), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
|
|
716
751
|
}
|
|
717
752
|
|
|
718
753
|
/**
|
|
@@ -728,7 +763,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
728
763
|
value: function maxLength(_maxLength) {
|
|
729
764
|
return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
730
765
|
maxLength: _maxLength
|
|
731
|
-
}), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput);
|
|
766
|
+
}), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
|
|
732
767
|
}
|
|
733
768
|
}, {
|
|
734
769
|
key: "regexp",
|
|
@@ -736,12 +771,12 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
736
771
|
return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
737
772
|
regexp: _regexp,
|
|
738
773
|
regExpMessage: message
|
|
739
|
-
}), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput);
|
|
774
|
+
}), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
|
|
740
775
|
}
|
|
741
776
|
}, {
|
|
742
777
|
key: "validate",
|
|
743
778
|
value: function validate(validationFunction) {
|
|
744
|
-
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction), this.renderInput);
|
|
779
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction), this.renderInput, this.isReadonly, this.isHidden, this.description);
|
|
745
780
|
}
|
|
746
781
|
}, {
|
|
747
782
|
key: "executeValidate",
|
|
@@ -814,12 +849,22 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
814
849
|
}, {
|
|
815
850
|
key: "nullable",
|
|
816
851
|
value: function nullable() {
|
|
817
|
-
return new StringSchema(this.options, true, this.isRaw, this.customValidateFunctions, this.renderInput);
|
|
852
|
+
return new StringSchema(this.options, true, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
|
|
853
|
+
}
|
|
854
|
+
}, {
|
|
855
|
+
key: "readonly",
|
|
856
|
+
value: function readonly() {
|
|
857
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, true, this.isHidden, this.description);
|
|
858
|
+
}
|
|
859
|
+
}, {
|
|
860
|
+
key: "hidden",
|
|
861
|
+
value: function hidden() {
|
|
862
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, true, this.description);
|
|
818
863
|
}
|
|
819
864
|
}, {
|
|
820
865
|
key: "raw",
|
|
821
866
|
value: function raw() {
|
|
822
|
-
return new StringSchema(this.options, this.opt, true, this.customValidateFunctions, this.renderInput);
|
|
867
|
+
return new StringSchema(this.options, this.opt, true, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
|
|
823
868
|
}
|
|
824
869
|
}, {
|
|
825
870
|
key: "executeSerialize",
|
|
@@ -839,13 +884,16 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
839
884
|
},
|
|
840
885
|
opt: this.opt,
|
|
841
886
|
raw: this.isRaw,
|
|
842
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0
|
|
887
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0,
|
|
888
|
+
readonly: this.isReadonly,
|
|
889
|
+
hidden: this.isHidden,
|
|
890
|
+
description: this.description
|
|
843
891
|
};
|
|
844
892
|
}
|
|
845
893
|
}, {
|
|
846
894
|
key: "render",
|
|
847
895
|
value: function render(input) {
|
|
848
|
-
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, input);
|
|
896
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, input, this.isReadonly, this.isHidden, this.description);
|
|
849
897
|
}
|
|
850
898
|
}, {
|
|
851
899
|
key: "executeRender",
|
|
@@ -880,18 +928,29 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
880
928
|
var _this;
|
|
881
929
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
882
930
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
931
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
932
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
933
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
883
934
|
_classCallCheck(this, ObjectSchema);
|
|
884
935
|
_this = _callSuper(this, ObjectSchema);
|
|
885
936
|
_this.items = items;
|
|
886
937
|
_this.opt = opt;
|
|
887
938
|
_this.customValidateFunctions = customValidateFunctions;
|
|
939
|
+
_this.isReadonly = isReadonly;
|
|
940
|
+
_this.isHidden = isHidden;
|
|
941
|
+
_this.description = description;
|
|
888
942
|
return _this;
|
|
889
943
|
}
|
|
890
944
|
_inherits(ObjectSchema, _Schema);
|
|
891
945
|
return _createClass(ObjectSchema, [{
|
|
946
|
+
key: "describe",
|
|
947
|
+
value: function describe(description) {
|
|
948
|
+
return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
949
|
+
}
|
|
950
|
+
}, {
|
|
892
951
|
key: "validate",
|
|
893
952
|
value: function validate(validationFunction) {
|
|
894
|
-
return new ObjectSchema(this.items, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
953
|
+
return new ObjectSchema(this.items, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
895
954
|
}
|
|
896
955
|
}, {
|
|
897
956
|
key: "executeValidate",
|
|
@@ -1015,7 +1074,17 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1015
1074
|
}, {
|
|
1016
1075
|
key: "nullable",
|
|
1017
1076
|
value: function nullable() {
|
|
1018
|
-
return new ObjectSchema(this.items, true);
|
|
1077
|
+
return new ObjectSchema(this.items, true, [], this.isReadonly, this.isHidden, this.description);
|
|
1078
|
+
}
|
|
1079
|
+
}, {
|
|
1080
|
+
key: "readonly",
|
|
1081
|
+
value: function readonly() {
|
|
1082
|
+
return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
1083
|
+
}
|
|
1084
|
+
}, {
|
|
1085
|
+
key: "hidden",
|
|
1086
|
+
value: function hidden() {
|
|
1087
|
+
return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
1019
1088
|
}
|
|
1020
1089
|
}, {
|
|
1021
1090
|
key: "executeSerialize",
|
|
@@ -1030,7 +1099,10 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1030
1099
|
return [key, schema["executeSerialize"]()];
|
|
1031
1100
|
})),
|
|
1032
1101
|
opt: this.opt,
|
|
1033
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
1102
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
1103
|
+
readonly: this.isReadonly,
|
|
1104
|
+
hidden: this.isHidden,
|
|
1105
|
+
description: this.description
|
|
1034
1106
|
};
|
|
1035
1107
|
}
|
|
1036
1108
|
}, {
|
|
@@ -1070,19 +1142,30 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1070
1142
|
var _this;
|
|
1071
1143
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1072
1144
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1145
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
1146
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
1147
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
1073
1148
|
_classCallCheck(this, ArraySchema);
|
|
1074
1149
|
_this = _callSuper(this, ArraySchema);
|
|
1075
1150
|
_defineProperty(_this, "renderInput", null);
|
|
1076
1151
|
_this.item = item;
|
|
1077
1152
|
_this.opt = opt;
|
|
1078
1153
|
_this.customValidateFunctions = customValidateFunctions;
|
|
1154
|
+
_this.isReadonly = isReadonly;
|
|
1155
|
+
_this.isHidden = isHidden;
|
|
1156
|
+
_this.description = description;
|
|
1079
1157
|
return _this;
|
|
1080
1158
|
}
|
|
1081
1159
|
_inherits(ArraySchema, _Schema);
|
|
1082
1160
|
return _createClass(ArraySchema, [{
|
|
1161
|
+
key: "describe",
|
|
1162
|
+
value: function describe(description) {
|
|
1163
|
+
return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
1164
|
+
}
|
|
1165
|
+
}, {
|
|
1083
1166
|
key: "validate",
|
|
1084
1167
|
value: function validate(validationFunction) {
|
|
1085
|
-
return new ArraySchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
1168
|
+
return new ArraySchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
1086
1169
|
}
|
|
1087
1170
|
}, {
|
|
1088
1171
|
key: "executeValidate",
|
|
@@ -1154,7 +1237,17 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1154
1237
|
}, {
|
|
1155
1238
|
key: "nullable",
|
|
1156
1239
|
value: function nullable() {
|
|
1157
|
-
return new ArraySchema(this.item, true);
|
|
1240
|
+
return new ArraySchema(this.item, true, [], this.isReadonly, this.isHidden, this.description);
|
|
1241
|
+
}
|
|
1242
|
+
}, {
|
|
1243
|
+
key: "readonly",
|
|
1244
|
+
value: function readonly() {
|
|
1245
|
+
return new ArraySchema(this.item, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
1246
|
+
}
|
|
1247
|
+
}, {
|
|
1248
|
+
key: "hidden",
|
|
1249
|
+
value: function hidden() {
|
|
1250
|
+
return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
1158
1251
|
}
|
|
1159
1252
|
}, {
|
|
1160
1253
|
key: "executeSerialize",
|
|
@@ -1164,7 +1257,10 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1164
1257
|
type: "array",
|
|
1165
1258
|
item: this.item["executeSerialize"](),
|
|
1166
1259
|
opt: this.opt,
|
|
1167
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
1260
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
1261
|
+
readonly: this.isReadonly,
|
|
1262
|
+
hidden: this.isHidden,
|
|
1263
|
+
description: this.description
|
|
1168
1264
|
};
|
|
1169
1265
|
}
|
|
1170
1266
|
}, {
|
|
@@ -1245,18 +1341,29 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1245
1341
|
var _this;
|
|
1246
1342
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1247
1343
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1344
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
1345
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
1346
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
1248
1347
|
_classCallCheck(this, LiteralSchema);
|
|
1249
1348
|
_this = _callSuper(this, LiteralSchema);
|
|
1250
1349
|
_this.value = value;
|
|
1251
1350
|
_this.opt = opt;
|
|
1252
1351
|
_this.customValidateFunctions = customValidateFunctions;
|
|
1352
|
+
_this.isReadonly = isReadonly;
|
|
1353
|
+
_this.isHidden = isHidden;
|
|
1354
|
+
_this.description = description;
|
|
1253
1355
|
return _this;
|
|
1254
1356
|
}
|
|
1255
1357
|
_inherits(LiteralSchema, _Schema);
|
|
1256
1358
|
return _createClass(LiteralSchema, [{
|
|
1359
|
+
key: "describe",
|
|
1360
|
+
value: function describe(description) {
|
|
1361
|
+
return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
1362
|
+
}
|
|
1363
|
+
}, {
|
|
1257
1364
|
key: "validate",
|
|
1258
1365
|
value: function validate(validationFunction) {
|
|
1259
|
-
return new LiteralSchema(this.value, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
1366
|
+
return new LiteralSchema(this.value, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
1260
1367
|
}
|
|
1261
1368
|
}, {
|
|
1262
1369
|
key: "executeValidate",
|
|
@@ -1319,7 +1426,17 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1319
1426
|
}, {
|
|
1320
1427
|
key: "nullable",
|
|
1321
1428
|
value: function nullable() {
|
|
1322
|
-
return new LiteralSchema(this.value, true);
|
|
1429
|
+
return new LiteralSchema(this.value, true, [], this.isReadonly, this.isHidden, this.description);
|
|
1430
|
+
}
|
|
1431
|
+
}, {
|
|
1432
|
+
key: "readonly",
|
|
1433
|
+
value: function readonly() {
|
|
1434
|
+
return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
1435
|
+
}
|
|
1436
|
+
}, {
|
|
1437
|
+
key: "hidden",
|
|
1438
|
+
value: function hidden() {
|
|
1439
|
+
return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
1323
1440
|
}
|
|
1324
1441
|
}, {
|
|
1325
1442
|
key: "executeSerialize",
|
|
@@ -1329,7 +1446,10 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1329
1446
|
type: "literal",
|
|
1330
1447
|
value: this.value,
|
|
1331
1448
|
opt: this.opt,
|
|
1332
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
1449
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
1450
|
+
readonly: this.isReadonly,
|
|
1451
|
+
hidden: this.isHidden,
|
|
1452
|
+
description: this.description
|
|
1333
1453
|
};
|
|
1334
1454
|
}
|
|
1335
1455
|
}, {
|
|
@@ -1348,19 +1468,30 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1348
1468
|
var _this;
|
|
1349
1469
|
var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1350
1470
|
var customValidateFunctions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
1471
|
+
var isReadonly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
1472
|
+
var isHidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
1473
|
+
var description = arguments.length > 6 ? arguments[6] : undefined;
|
|
1351
1474
|
_classCallCheck(this, UnionSchema);
|
|
1352
1475
|
_this = _callSuper(this, UnionSchema);
|
|
1353
1476
|
_this.key = key;
|
|
1354
1477
|
_this.items = items;
|
|
1355
1478
|
_this.opt = opt;
|
|
1356
1479
|
_this.customValidateFunctions = customValidateFunctions;
|
|
1480
|
+
_this.isReadonly = isReadonly;
|
|
1481
|
+
_this.isHidden = isHidden;
|
|
1482
|
+
_this.description = description;
|
|
1357
1483
|
return _this;
|
|
1358
1484
|
}
|
|
1359
1485
|
_inherits(UnionSchema, _Schema);
|
|
1360
1486
|
return _createClass(UnionSchema, [{
|
|
1487
|
+
key: "describe",
|
|
1488
|
+
value: function describe(description) {
|
|
1489
|
+
return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
1490
|
+
}
|
|
1491
|
+
}, {
|
|
1361
1492
|
key: "validate",
|
|
1362
1493
|
value: function validate(validationFunction) {
|
|
1363
|
-
return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions.concat(validationFunction));
|
|
1494
|
+
return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description);
|
|
1364
1495
|
}
|
|
1365
1496
|
}, {
|
|
1366
1497
|
key: "executeValidate",
|
|
@@ -1653,7 +1784,17 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1653
1784
|
}, {
|
|
1654
1785
|
key: "nullable",
|
|
1655
1786
|
value: function nullable() {
|
|
1656
|
-
return new UnionSchema(this.key, this.items, true);
|
|
1787
|
+
return new UnionSchema(this.key, this.items, true, [], this.isReadonly, this.isHidden, this.description);
|
|
1788
|
+
}
|
|
1789
|
+
}, {
|
|
1790
|
+
key: "readonly",
|
|
1791
|
+
value: function readonly() {
|
|
1792
|
+
return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
1793
|
+
}
|
|
1794
|
+
}, {
|
|
1795
|
+
key: "hidden",
|
|
1796
|
+
value: function hidden() {
|
|
1797
|
+
return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
1657
1798
|
}
|
|
1658
1799
|
}, {
|
|
1659
1800
|
key: "executeSerialize",
|
|
@@ -1668,7 +1809,10 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1668
1809
|
return o["executeSerialize"]();
|
|
1669
1810
|
}),
|
|
1670
1811
|
opt: this.opt,
|
|
1671
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
1812
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
1813
|
+
readonly: this.isReadonly,
|
|
1814
|
+
hidden: this.isHidden,
|
|
1815
|
+
description: this.description
|
|
1672
1816
|
};
|
|
1673
1817
|
}
|
|
1674
1818
|
return {
|
|
@@ -1678,7 +1822,10 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1678
1822
|
return o["executeSerialize"]();
|
|
1679
1823
|
}),
|
|
1680
1824
|
opt: this.opt,
|
|
1681
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0
|
|
1825
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0,
|
|
1826
|
+
readonly: this.isReadonly,
|
|
1827
|
+
hidden: this.isHidden,
|
|
1828
|
+
description: this.description
|
|
1682
1829
|
};
|
|
1683
1830
|
}
|
|
1684
1831
|
}, {
|
|
@@ -1739,6 +1886,9 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1739
1886
|
var isRemote = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1740
1887
|
var customValidateFunctions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
1741
1888
|
var moduleMetadata = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
1889
|
+
var isReadonly = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
1890
|
+
var isHidden = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
1891
|
+
var description = arguments.length > 7 ? arguments[7] : undefined;
|
|
1742
1892
|
_classCallCheck(this, ImageSchema);
|
|
1743
1893
|
_this = _callSuper(this, ImageSchema);
|
|
1744
1894
|
_this.options = options;
|
|
@@ -1746,18 +1896,26 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1746
1896
|
_this.isRemote = isRemote;
|
|
1747
1897
|
_this.customValidateFunctions = customValidateFunctions;
|
|
1748
1898
|
_this.moduleMetadata = moduleMetadata;
|
|
1899
|
+
_this.isReadonly = isReadonly;
|
|
1900
|
+
_this.isHidden = isHidden;
|
|
1901
|
+
_this.description = description;
|
|
1749
1902
|
return _this;
|
|
1750
1903
|
}
|
|
1751
1904
|
_inherits(ImageSchema, _Schema);
|
|
1752
1905
|
return _createClass(ImageSchema, [{
|
|
1906
|
+
key: "describe",
|
|
1907
|
+
value: function describe(description) {
|
|
1908
|
+
return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
1909
|
+
}
|
|
1910
|
+
}, {
|
|
1753
1911
|
key: "remote",
|
|
1754
1912
|
value: function remote() {
|
|
1755
|
-
return new ImageSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata);
|
|
1913
|
+
return new ImageSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
|
|
1756
1914
|
}
|
|
1757
1915
|
}, {
|
|
1758
1916
|
key: "validate",
|
|
1759
1917
|
value: function validate(validationFunction) {
|
|
1760
|
-
return new ImageSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata);
|
|
1918
|
+
return new ImageSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
|
|
1761
1919
|
}
|
|
1762
1920
|
}, {
|
|
1763
1921
|
key: "executeValidate",
|
|
@@ -1937,7 +2095,17 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1937
2095
|
}, {
|
|
1938
2096
|
key: "nullable",
|
|
1939
2097
|
value: function nullable() {
|
|
1940
|
-
return new ImageSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata);
|
|
2098
|
+
return new ImageSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
|
|
2099
|
+
}
|
|
2100
|
+
}, {
|
|
2101
|
+
key: "readonly",
|
|
2102
|
+
value: function readonly() {
|
|
2103
|
+
return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, true, this.isHidden, this.description);
|
|
2104
|
+
}
|
|
2105
|
+
}, {
|
|
2106
|
+
key: "hidden",
|
|
2107
|
+
value: function hidden() {
|
|
2108
|
+
return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, true, this.description);
|
|
1941
2109
|
}
|
|
1942
2110
|
}, {
|
|
1943
2111
|
key: "executeSerialize",
|
|
@@ -1950,7 +2118,10 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1950
2118
|
opt: this.opt,
|
|
1951
2119
|
remote: this.isRemote,
|
|
1952
2120
|
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
1953
|
-
referencedModule: modulePaths.length > 0 ? modulePaths[0] : undefined
|
|
2121
|
+
referencedModule: modulePaths.length > 0 ? modulePaths[0] : undefined,
|
|
2122
|
+
readonly: this.isReadonly,
|
|
2123
|
+
hidden: this.isHidden,
|
|
2124
|
+
description: this.description
|
|
1954
2125
|
};
|
|
1955
2126
|
}
|
|
1956
2127
|
}, {
|
|
@@ -1982,33 +2153,44 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1982
2153
|
var _this;
|
|
1983
2154
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1984
2155
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
2156
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2157
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
2158
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
1985
2159
|
_classCallCheck(this, RouteSchema);
|
|
1986
2160
|
_this = _callSuper(this, RouteSchema);
|
|
1987
2161
|
_this.options = options;
|
|
1988
2162
|
_this.opt = opt;
|
|
1989
2163
|
_this.customValidateFunctions = customValidateFunctions;
|
|
2164
|
+
_this.isReadonly = isReadonly;
|
|
2165
|
+
_this.isHidden = isHidden;
|
|
2166
|
+
_this.description = description;
|
|
1990
2167
|
return _this;
|
|
1991
2168
|
}
|
|
1992
|
-
|
|
1993
|
-
/**
|
|
1994
|
-
* Specify a pattern for which routes are allowed.
|
|
1995
|
-
*
|
|
1996
|
-
* Semantics:
|
|
1997
|
-
* - If only include is set: route must match include pattern
|
|
1998
|
-
* - If only exclude is set: route must NOT match exclude pattern
|
|
1999
|
-
* - If both are set: route must match include AND must NOT match exclude
|
|
2000
|
-
*
|
|
2001
|
-
* @example
|
|
2002
|
-
* s.route().include(/^\/(home|about|contact)$/) // Only these specific routes
|
|
2003
|
-
* s.route().include(/^\/api\//).exclude(/^\/api\/internal\//) // API routes except internal
|
|
2004
|
-
*/
|
|
2005
2169
|
_inherits(RouteSchema, _Schema);
|
|
2006
2170
|
return _createClass(RouteSchema, [{
|
|
2171
|
+
key: "describe",
|
|
2172
|
+
value: function describe(description) {
|
|
2173
|
+
return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
/**
|
|
2177
|
+
* Specify a pattern for which routes are allowed.
|
|
2178
|
+
*
|
|
2179
|
+
* Semantics:
|
|
2180
|
+
* - If only include is set: route must match include pattern
|
|
2181
|
+
* - If only exclude is set: route must NOT match exclude pattern
|
|
2182
|
+
* - If both are set: route must match include AND must NOT match exclude
|
|
2183
|
+
*
|
|
2184
|
+
* @example
|
|
2185
|
+
* s.route().include(/^\/(home|about|contact)$/) // Only these specific routes
|
|
2186
|
+
* s.route().include(/^\/api\//).exclude(/^\/api\/internal\//) // API routes except internal
|
|
2187
|
+
*/
|
|
2188
|
+
}, {
|
|
2007
2189
|
key: "include",
|
|
2008
2190
|
value: function include(pattern) {
|
|
2009
2191
|
return new RouteSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
2010
2192
|
include: pattern
|
|
2011
|
-
}), this.opt, this.customValidateFunctions);
|
|
2193
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
2012
2194
|
}
|
|
2013
2195
|
|
|
2014
2196
|
/**
|
|
@@ -2028,12 +2210,12 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2028
2210
|
value: function exclude(pattern) {
|
|
2029
2211
|
return new RouteSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
2030
2212
|
exclude: pattern
|
|
2031
|
-
}), this.opt, this.customValidateFunctions);
|
|
2213
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
2032
2214
|
}
|
|
2033
2215
|
}, {
|
|
2034
2216
|
key: "validate",
|
|
2035
2217
|
value: function validate(validationFunction) {
|
|
2036
|
-
return new RouteSchema(this.options, this.opt, this.customValidateFunctions.concat(validationFunction));
|
|
2218
|
+
return new RouteSchema(this.options, this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description);
|
|
2037
2219
|
}
|
|
2038
2220
|
}, {
|
|
2039
2221
|
key: "executeValidate",
|
|
@@ -2088,7 +2270,17 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2088
2270
|
}, {
|
|
2089
2271
|
key: "nullable",
|
|
2090
2272
|
value: function nullable() {
|
|
2091
|
-
return new RouteSchema(this.options, true, this.customValidateFunctions);
|
|
2273
|
+
return new RouteSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
2274
|
+
}
|
|
2275
|
+
}, {
|
|
2276
|
+
key: "readonly",
|
|
2277
|
+
value: function readonly() {
|
|
2278
|
+
return new RouteSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
2279
|
+
}
|
|
2280
|
+
}, {
|
|
2281
|
+
key: "hidden",
|
|
2282
|
+
value: function hidden() {
|
|
2283
|
+
return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
2092
2284
|
}
|
|
2093
2285
|
}, {
|
|
2094
2286
|
key: "executeSerialize",
|
|
@@ -2108,7 +2300,10 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2108
2300
|
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
2109
2301
|
},
|
|
2110
2302
|
opt: this.opt,
|
|
2111
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0
|
|
2303
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0,
|
|
2304
|
+
readonly: this.isReadonly,
|
|
2305
|
+
hidden: this.isHidden,
|
|
2306
|
+
description: this.description
|
|
2112
2307
|
};
|
|
2113
2308
|
}
|
|
2114
2309
|
}, {
|
|
@@ -2127,32 +2322,43 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2127
2322
|
var _this;
|
|
2128
2323
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2129
2324
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
2325
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2326
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
2327
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
2130
2328
|
_classCallCheck(this, RichTextSchema);
|
|
2131
2329
|
_this = _callSuper(this, RichTextSchema);
|
|
2132
2330
|
_this.options = options;
|
|
2133
2331
|
_this.opt = opt;
|
|
2134
2332
|
_this.customValidateFunctions = customValidateFunctions;
|
|
2333
|
+
_this.isReadonly = isReadonly;
|
|
2334
|
+
_this.isHidden = isHidden;
|
|
2335
|
+
_this.description = description;
|
|
2135
2336
|
return _this;
|
|
2136
2337
|
}
|
|
2137
2338
|
_inherits(RichTextSchema, _Schema);
|
|
2138
2339
|
return _createClass(RichTextSchema, [{
|
|
2340
|
+
key: "describe",
|
|
2341
|
+
value: function describe(description) {
|
|
2342
|
+
return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
2343
|
+
}
|
|
2344
|
+
}, {
|
|
2139
2345
|
key: "maxLength",
|
|
2140
2346
|
value: function maxLength(max) {
|
|
2141
2347
|
return new RichTextSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
2142
2348
|
maxLength: max
|
|
2143
|
-
}), this.opt);
|
|
2349
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
2144
2350
|
}
|
|
2145
2351
|
}, {
|
|
2146
2352
|
key: "minLength",
|
|
2147
2353
|
value: function minLength(min) {
|
|
2148
2354
|
return new RichTextSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
2149
2355
|
minLength: min
|
|
2150
|
-
}), this.opt);
|
|
2356
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
2151
2357
|
}
|
|
2152
2358
|
}, {
|
|
2153
2359
|
key: "validate",
|
|
2154
2360
|
value: function validate(validationFunction) {
|
|
2155
|
-
return new RichTextSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
2361
|
+
return new RichTextSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
2156
2362
|
}
|
|
2157
2363
|
}, {
|
|
2158
2364
|
key: "executeValidate",
|
|
@@ -2395,28 +2601,12 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2395
2601
|
}])
|
|
2396
2602
|
};
|
|
2397
2603
|
}
|
|
2398
|
-
var
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
if (res) {
|
|
2405
|
-
return {
|
|
2406
|
-
v: res
|
|
2407
|
-
};
|
|
2408
|
-
}
|
|
2409
|
-
} else if (typeof child === "string") {
|
|
2410
|
-
length += child.length;
|
|
2411
|
-
continue;
|
|
2412
|
-
} else {
|
|
2413
|
-
return {
|
|
2414
|
-
v: _defineProperty({}, path, [{
|
|
2415
|
-
message: "Expected 'object' or 'string', got '".concat(_typeof(child), "'"),
|
|
2416
|
-
typeError: true
|
|
2417
|
-
}])
|
|
2418
|
-
};
|
|
2419
|
-
}
|
|
2604
|
+
var childPath = unsafeCreateSourcePath(path, "children");
|
|
2605
|
+
var res = _recurse(childPath, node.children, current);
|
|
2606
|
+
if (res) {
|
|
2607
|
+
return {
|
|
2608
|
+
v: res
|
|
2609
|
+
};
|
|
2420
2610
|
}
|
|
2421
2611
|
}
|
|
2422
2612
|
},
|
|
@@ -2599,10 +2789,10 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2599
2789
|
typeError: true
|
|
2600
2790
|
});
|
|
2601
2791
|
} else {
|
|
2602
|
-
for (var
|
|
2603
|
-
var style = node.styles[
|
|
2792
|
+
for (var _i = 0; _i < node.styles.length; _i++) {
|
|
2793
|
+
var style = node.styles[_i];
|
|
2604
2794
|
if (typeof style !== "string") {
|
|
2605
|
-
var _pathAtError = unsafeCreateSourcePath(path,
|
|
2795
|
+
var _pathAtError = unsafeCreateSourcePath(path, _i);
|
|
2606
2796
|
if (!errors[_pathAtError]) {
|
|
2607
2797
|
errors[_pathAtError] = [];
|
|
2608
2798
|
}
|
|
@@ -2618,7 +2808,17 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2618
2808
|
}, {
|
|
2619
2809
|
key: "nullable",
|
|
2620
2810
|
value: function nullable() {
|
|
2621
|
-
return new RichTextSchema(this.options, true);
|
|
2811
|
+
return new RichTextSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description);
|
|
2812
|
+
}
|
|
2813
|
+
}, {
|
|
2814
|
+
key: "readonly",
|
|
2815
|
+
value: function readonly() {
|
|
2816
|
+
return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
2817
|
+
}
|
|
2818
|
+
}, {
|
|
2819
|
+
key: "hidden",
|
|
2820
|
+
value: function hidden() {
|
|
2821
|
+
return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
2622
2822
|
}
|
|
2623
2823
|
}, {
|
|
2624
2824
|
key: "executeSerialize",
|
|
@@ -2652,7 +2852,10 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2652
2852
|
type: "richtext",
|
|
2653
2853
|
opt: this.opt,
|
|
2654
2854
|
options: serializedOptions,
|
|
2655
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
2855
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
2856
|
+
readonly: this.isReadonly,
|
|
2857
|
+
hidden: this.isHidden,
|
|
2858
|
+
description: this.description
|
|
2656
2859
|
};
|
|
2657
2860
|
}
|
|
2658
2861
|
}, {
|
|
@@ -2707,6 +2910,9 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2707
2910
|
var currentRouter = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
2708
2911
|
var keySchema = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
2709
2912
|
var mediaOptions = arguments.length > 5 ? arguments[5] : undefined;
|
|
2913
|
+
var isReadonly = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
2914
|
+
var isHidden = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
2915
|
+
var description = arguments.length > 8 ? arguments[8] : undefined;
|
|
2710
2916
|
_classCallCheck(this, RecordSchema);
|
|
2711
2917
|
_this = _callSuper(this, RecordSchema);
|
|
2712
2918
|
_defineProperty(_this, "renderInput", null);
|
|
@@ -2716,13 +2922,21 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2716
2922
|
_this.currentRouter = currentRouter;
|
|
2717
2923
|
_this.keySchema = keySchema;
|
|
2718
2924
|
_this.mediaOptions = mediaOptions;
|
|
2925
|
+
_this.isReadonly = isReadonly;
|
|
2926
|
+
_this.isHidden = isHidden;
|
|
2927
|
+
_this.description = description;
|
|
2719
2928
|
return _this;
|
|
2720
2929
|
}
|
|
2721
2930
|
_inherits(RecordSchema, _Schema);
|
|
2722
2931
|
return _createClass(RecordSchema, [{
|
|
2932
|
+
key: "describe",
|
|
2933
|
+
value: function describe(description) {
|
|
2934
|
+
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
2935
|
+
}
|
|
2936
|
+
}, {
|
|
2723
2937
|
key: "validate",
|
|
2724
2938
|
value: function validate(validationFunction) {
|
|
2725
|
-
return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.currentRouter, this.keySchema, this.mediaOptions);
|
|
2939
|
+
return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description);
|
|
2726
2940
|
}
|
|
2727
2941
|
}, {
|
|
2728
2942
|
key: "executeValidate",
|
|
@@ -3068,19 +3282,29 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3068
3282
|
}, {
|
|
3069
3283
|
key: "nullable",
|
|
3070
3284
|
value: function nullable() {
|
|
3071
|
-
return new RecordSchema(this.item, true, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions);
|
|
3285
|
+
return new RecordSchema(this.item, true, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description);
|
|
3286
|
+
}
|
|
3287
|
+
}, {
|
|
3288
|
+
key: "readonly",
|
|
3289
|
+
value: function readonly() {
|
|
3290
|
+
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, true, this.isHidden, this.description);
|
|
3291
|
+
}
|
|
3292
|
+
}, {
|
|
3293
|
+
key: "hidden",
|
|
3294
|
+
value: function hidden() {
|
|
3295
|
+
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, true, this.description);
|
|
3072
3296
|
}
|
|
3073
3297
|
}, {
|
|
3074
3298
|
key: "router",
|
|
3075
3299
|
value: function router(_router) {
|
|
3076
|
-
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router, this.keySchema, this.mediaOptions);
|
|
3300
|
+
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description);
|
|
3077
3301
|
}
|
|
3078
3302
|
}, {
|
|
3079
3303
|
key: "remote",
|
|
3080
3304
|
value: function remote() {
|
|
3081
3305
|
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions ? _objectSpread2(_objectSpread2({}, this.mediaOptions), {}, {
|
|
3082
3306
|
remote: true
|
|
3083
|
-
}) : undefined);
|
|
3307
|
+
}) : undefined, this.isReadonly, this.isHidden, this.description);
|
|
3084
3308
|
}
|
|
3085
3309
|
}, {
|
|
3086
3310
|
key: "getRouterValidations",
|
|
@@ -3134,7 +3358,10 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3134
3358
|
key: (_this$keySchema = this.keySchema) === null || _this$keySchema === void 0 ? void 0 : _this$keySchema["executeSerialize"](),
|
|
3135
3359
|
opt: this.opt,
|
|
3136
3360
|
router: (_this$currentRouter = this.currentRouter) === null || _this$currentRouter === void 0 ? void 0 : _this$currentRouter.getRouterId(),
|
|
3137
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
3361
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
3362
|
+
readonly: this.isReadonly,
|
|
3363
|
+
hidden: this.isHidden,
|
|
3364
|
+
description: this.description
|
|
3138
3365
|
};
|
|
3139
3366
|
if (this.mediaOptions) {
|
|
3140
3367
|
result.mediaType = this.mediaOptions.type;
|
|
@@ -3754,18 +3981,29 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3754
3981
|
var _this;
|
|
3755
3982
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3756
3983
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
3984
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
3985
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
3986
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
3757
3987
|
_classCallCheck(this, NumberSchema);
|
|
3758
3988
|
_this = _callSuper(this, NumberSchema);
|
|
3759
3989
|
_this.options = options;
|
|
3760
3990
|
_this.opt = opt;
|
|
3761
3991
|
_this.customValidateFunctions = customValidateFunctions;
|
|
3992
|
+
_this.isReadonly = isReadonly;
|
|
3993
|
+
_this.isHidden = isHidden;
|
|
3994
|
+
_this.description = description;
|
|
3762
3995
|
return _this;
|
|
3763
3996
|
}
|
|
3764
3997
|
_inherits(NumberSchema, _Schema);
|
|
3765
3998
|
return _createClass(NumberSchema, [{
|
|
3999
|
+
key: "describe",
|
|
4000
|
+
value: function describe(description) {
|
|
4001
|
+
return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
4002
|
+
}
|
|
4003
|
+
}, {
|
|
3766
4004
|
key: "validate",
|
|
3767
4005
|
value: function validate(validationFunction) {
|
|
3768
|
-
return new NumberSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
4006
|
+
return new NumberSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
3769
4007
|
}
|
|
3770
4008
|
}, {
|
|
3771
4009
|
key: "executeValidate",
|
|
@@ -3835,21 +4073,31 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3835
4073
|
}, {
|
|
3836
4074
|
key: "nullable",
|
|
3837
4075
|
value: function nullable() {
|
|
3838
|
-
return new NumberSchema(this.options, true);
|
|
4076
|
+
return new NumberSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description);
|
|
4077
|
+
}
|
|
4078
|
+
}, {
|
|
4079
|
+
key: "readonly",
|
|
4080
|
+
value: function readonly() {
|
|
4081
|
+
return new NumberSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
4082
|
+
}
|
|
4083
|
+
}, {
|
|
4084
|
+
key: "hidden",
|
|
4085
|
+
value: function hidden() {
|
|
4086
|
+
return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
3839
4087
|
}
|
|
3840
4088
|
}, {
|
|
3841
4089
|
key: "max",
|
|
3842
4090
|
value: function max(_max) {
|
|
3843
4091
|
return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
3844
4092
|
max: _max
|
|
3845
|
-
}), this.opt);
|
|
4093
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
3846
4094
|
}
|
|
3847
4095
|
}, {
|
|
3848
4096
|
key: "min",
|
|
3849
4097
|
value: function min(_min) {
|
|
3850
4098
|
return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
3851
4099
|
min: _min
|
|
3852
|
-
}), this.opt);
|
|
4100
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
3853
4101
|
}
|
|
3854
4102
|
}, {
|
|
3855
4103
|
key: "executeSerialize",
|
|
@@ -3859,7 +4107,10 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3859
4107
|
type: "number",
|
|
3860
4108
|
options: this.options,
|
|
3861
4109
|
opt: this.opt,
|
|
3862
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
4110
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
4111
|
+
readonly: this.isReadonly,
|
|
4112
|
+
hidden: this.isHidden,
|
|
4113
|
+
description: this.description
|
|
3863
4114
|
};
|
|
3864
4115
|
}
|
|
3865
4116
|
}, {
|
|
@@ -3878,17 +4129,28 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3878
4129
|
var _this;
|
|
3879
4130
|
var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
3880
4131
|
var customValidateFunctions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
4132
|
+
var isReadonly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
4133
|
+
var isHidden = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
4134
|
+
var description = arguments.length > 4 ? arguments[4] : undefined;
|
|
3881
4135
|
_classCallCheck(this, BooleanSchema);
|
|
3882
4136
|
_this = _callSuper(this, BooleanSchema);
|
|
3883
4137
|
_this.opt = opt;
|
|
3884
4138
|
_this.customValidateFunctions = customValidateFunctions;
|
|
4139
|
+
_this.isReadonly = isReadonly;
|
|
4140
|
+
_this.isHidden = isHidden;
|
|
4141
|
+
_this.description = description;
|
|
3885
4142
|
return _this;
|
|
3886
4143
|
}
|
|
3887
4144
|
_inherits(BooleanSchema, _Schema);
|
|
3888
4145
|
return _createClass(BooleanSchema, [{
|
|
4146
|
+
key: "describe",
|
|
4147
|
+
value: function describe(description) {
|
|
4148
|
+
return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
4149
|
+
}
|
|
4150
|
+
}, {
|
|
3889
4151
|
key: "validate",
|
|
3890
4152
|
value: function validate(validationFunction) {
|
|
3891
|
-
return new BooleanSchema(this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
4153
|
+
return new BooleanSchema(this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
3892
4154
|
}
|
|
3893
4155
|
}, {
|
|
3894
4156
|
key: "executeValidate",
|
|
@@ -3939,7 +4201,17 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3939
4201
|
}, {
|
|
3940
4202
|
key: "nullable",
|
|
3941
4203
|
value: function nullable() {
|
|
3942
|
-
return new BooleanSchema(true);
|
|
4204
|
+
return new BooleanSchema(true, [], this.isReadonly, this.isHidden, this.description);
|
|
4205
|
+
}
|
|
4206
|
+
}, {
|
|
4207
|
+
key: "readonly",
|
|
4208
|
+
value: function readonly() {
|
|
4209
|
+
return new BooleanSchema(this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
4210
|
+
}
|
|
4211
|
+
}, {
|
|
4212
|
+
key: "hidden",
|
|
4213
|
+
value: function hidden() {
|
|
4214
|
+
return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
3943
4215
|
}
|
|
3944
4216
|
}, {
|
|
3945
4217
|
key: "executeSerialize",
|
|
@@ -3948,7 +4220,10 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3948
4220
|
return {
|
|
3949
4221
|
type: "boolean",
|
|
3950
4222
|
opt: this.opt,
|
|
3951
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
4223
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
4224
|
+
readonly: this.isReadonly,
|
|
4225
|
+
hidden: this.isHidden,
|
|
4226
|
+
description: this.description
|
|
3952
4227
|
};
|
|
3953
4228
|
}
|
|
3954
4229
|
}, {
|
|
@@ -3967,19 +4242,30 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3967
4242
|
var _this;
|
|
3968
4243
|
var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
3969
4244
|
var customValidateFunctions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
4245
|
+
var isReadonly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
4246
|
+
var isHidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
4247
|
+
var description = arguments.length > 6 ? arguments[6] : undefined;
|
|
3970
4248
|
_classCallCheck(this, KeyOfSchema);
|
|
3971
4249
|
_this = _callSuper(this, KeyOfSchema);
|
|
3972
4250
|
_this.schema = schema;
|
|
3973
4251
|
_this.sourcePath = sourcePath;
|
|
3974
4252
|
_this.opt = opt;
|
|
3975
4253
|
_this.customValidateFunctions = customValidateFunctions;
|
|
4254
|
+
_this.isReadonly = isReadonly;
|
|
4255
|
+
_this.isHidden = isHidden;
|
|
4256
|
+
_this.description = description;
|
|
3976
4257
|
return _this;
|
|
3977
4258
|
}
|
|
3978
4259
|
_inherits(KeyOfSchema, _Schema);
|
|
3979
4260
|
return _createClass(KeyOfSchema, [{
|
|
4261
|
+
key: "describe",
|
|
4262
|
+
value: function describe(description) {
|
|
4263
|
+
return new KeyOfSchema(this.schema, this.sourcePath, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
4264
|
+
}
|
|
4265
|
+
}, {
|
|
3980
4266
|
key: "validate",
|
|
3981
4267
|
value: function validate(validationFunction) {
|
|
3982
|
-
return new KeyOfSchema(this.schema, this.sourcePath, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
4268
|
+
return new KeyOfSchema(this.schema, this.sourcePath, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
3983
4269
|
}
|
|
3984
4270
|
}, {
|
|
3985
4271
|
key: "executeValidate",
|
|
@@ -4109,7 +4395,17 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4109
4395
|
}, {
|
|
4110
4396
|
key: "nullable",
|
|
4111
4397
|
value: function nullable() {
|
|
4112
|
-
return new KeyOfSchema(this.schema, this.sourcePath, true);
|
|
4398
|
+
return new KeyOfSchema(this.schema, this.sourcePath, true, [], this.isReadonly, this.isHidden, this.description);
|
|
4399
|
+
}
|
|
4400
|
+
}, {
|
|
4401
|
+
key: "readonly",
|
|
4402
|
+
value: function readonly() {
|
|
4403
|
+
return new KeyOfSchema(this.schema, this.sourcePath, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
4404
|
+
}
|
|
4405
|
+
}, {
|
|
4406
|
+
key: "hidden",
|
|
4407
|
+
value: function hidden() {
|
|
4408
|
+
return new KeyOfSchema(this.schema, this.sourcePath, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
4113
4409
|
}
|
|
4114
4410
|
}, {
|
|
4115
4411
|
key: "executeSerialize",
|
|
@@ -4141,7 +4437,10 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4141
4437
|
schema: serializedSchema,
|
|
4142
4438
|
opt: this.opt,
|
|
4143
4439
|
values: values,
|
|
4144
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
4440
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
4441
|
+
readonly: this.isReadonly,
|
|
4442
|
+
hidden: this.isHidden,
|
|
4443
|
+
description: this.description
|
|
4145
4444
|
};
|
|
4146
4445
|
}
|
|
4147
4446
|
}, {
|
|
@@ -4218,68 +4517,78 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4218
4517
|
var _this;
|
|
4219
4518
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4220
4519
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
4520
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
4521
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
4522
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
4221
4523
|
_classCallCheck(this, DateSchema);
|
|
4222
4524
|
_this = _callSuper(this, DateSchema);
|
|
4223
4525
|
_this.options = options;
|
|
4224
4526
|
_this.opt = opt;
|
|
4225
4527
|
_this.customValidateFunctions = customValidateFunctions;
|
|
4528
|
+
_this.isReadonly = isReadonly;
|
|
4529
|
+
_this.isHidden = isHidden;
|
|
4530
|
+
_this.description = description;
|
|
4226
4531
|
return _this;
|
|
4227
4532
|
}
|
|
4228
4533
|
_inherits(DateSchema, _Schema);
|
|
4229
4534
|
return _createClass(DateSchema, [{
|
|
4535
|
+
key: "describe",
|
|
4536
|
+
value: function describe(description) {
|
|
4537
|
+
return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
4538
|
+
}
|
|
4539
|
+
}, {
|
|
4230
4540
|
key: "validate",
|
|
4231
4541
|
value: function validate(validationFunction) {
|
|
4232
|
-
return new DateSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
4542
|
+
return new DateSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
4233
4543
|
}
|
|
4234
4544
|
}, {
|
|
4235
4545
|
key: "executeValidate",
|
|
4236
4546
|
value: function executeValidate(path, src) {
|
|
4237
4547
|
var _this$options, _this$options2, _this$options3, _this$options4;
|
|
4548
|
+
var errors = this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
|
|
4549
|
+
path: path
|
|
4550
|
+
});
|
|
4238
4551
|
if (this.opt && (src === null || src === undefined)) {
|
|
4239
|
-
return false;
|
|
4552
|
+
return errors.length > 0 ? _defineProperty({}, path, errors) : false;
|
|
4240
4553
|
}
|
|
4241
4554
|
if (typeof src !== "string") {
|
|
4242
|
-
|
|
4555
|
+
errors.push({
|
|
4243
4556
|
message: "Expected 'string', got '".concat(_typeof(src), "'"),
|
|
4244
4557
|
value: src
|
|
4245
|
-
}
|
|
4558
|
+
});
|
|
4559
|
+
return _defineProperty({}, path, errors);
|
|
4246
4560
|
}
|
|
4247
4561
|
if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.from && (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.to) {
|
|
4248
4562
|
if (this.options.from > this.options.to) {
|
|
4249
|
-
|
|
4563
|
+
errors.push({
|
|
4250
4564
|
message: "From date ".concat(this.options.from, " is after to date ").concat(this.options.to),
|
|
4251
4565
|
value: src,
|
|
4252
4566
|
typeError: true
|
|
4253
|
-
}
|
|
4254
|
-
}
|
|
4255
|
-
|
|
4256
|
-
return _defineProperty({}, path, [{
|
|
4567
|
+
});
|
|
4568
|
+
} else if (src < this.options.from || src > this.options.to) {
|
|
4569
|
+
errors.push({
|
|
4257
4570
|
message: "Date is not between ".concat(this.options.from, " and ").concat(this.options.to),
|
|
4258
4571
|
value: src
|
|
4259
|
-
}
|
|
4572
|
+
});
|
|
4260
4573
|
}
|
|
4261
4574
|
} else if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.from) {
|
|
4262
4575
|
if (src < this.options.from) {
|
|
4263
|
-
|
|
4576
|
+
errors.push({
|
|
4264
4577
|
message: "Date is before the minimum date ".concat(this.options.from),
|
|
4265
4578
|
value: src
|
|
4266
|
-
}
|
|
4579
|
+
});
|
|
4267
4580
|
}
|
|
4268
4581
|
} else if ((_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.to) {
|
|
4269
4582
|
if (src > this.options.to) {
|
|
4270
|
-
|
|
4583
|
+
errors.push({
|
|
4271
4584
|
message: "Date is after the maximum date ".concat(this.options.to),
|
|
4272
4585
|
value: src
|
|
4273
|
-
}
|
|
4586
|
+
});
|
|
4274
4587
|
}
|
|
4275
4588
|
}
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
// return {
|
|
4280
|
-
// [path]: errors,
|
|
4281
|
-
// } as ValidationErrors;
|
|
4282
|
-
// }
|
|
4589
|
+
if (errors.length > 0) {
|
|
4590
|
+
return _defineProperty({}, path, errors);
|
|
4591
|
+
}
|
|
4283
4592
|
return false;
|
|
4284
4593
|
}
|
|
4285
4594
|
}, {
|
|
@@ -4319,19 +4628,29 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4319
4628
|
value: function from(_from) {
|
|
4320
4629
|
return new DateSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
4321
4630
|
from: _from
|
|
4322
|
-
}), this.opt);
|
|
4631
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
4323
4632
|
}
|
|
4324
4633
|
}, {
|
|
4325
4634
|
key: "to",
|
|
4326
4635
|
value: function to(_to) {
|
|
4327
4636
|
return new DateSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
4328
4637
|
to: _to
|
|
4329
|
-
}), this.opt);
|
|
4638
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
4330
4639
|
}
|
|
4331
4640
|
}, {
|
|
4332
4641
|
key: "nullable",
|
|
4333
4642
|
value: function nullable() {
|
|
4334
|
-
return new DateSchema(this.options, true);
|
|
4643
|
+
return new DateSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description);
|
|
4644
|
+
}
|
|
4645
|
+
}, {
|
|
4646
|
+
key: "readonly",
|
|
4647
|
+
value: function readonly() {
|
|
4648
|
+
return new DateSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
4649
|
+
}
|
|
4650
|
+
}, {
|
|
4651
|
+
key: "hidden",
|
|
4652
|
+
value: function hidden() {
|
|
4653
|
+
return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
4335
4654
|
}
|
|
4336
4655
|
}, {
|
|
4337
4656
|
key: "executeSerialize",
|
|
@@ -4341,7 +4660,10 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4341
4660
|
type: "date",
|
|
4342
4661
|
opt: this.opt,
|
|
4343
4662
|
options: this.options,
|
|
4344
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
4663
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
4664
|
+
readonly: this.isReadonly,
|
|
4665
|
+
hidden: this.isHidden,
|
|
4666
|
+
description: this.description
|
|
4345
4667
|
};
|
|
4346
4668
|
}
|
|
4347
4669
|
}, {
|
|
@@ -4355,6 +4677,203 @@ var date = function date(options) {
|
|
|
4355
4677
|
return new DateSchema(options);
|
|
4356
4678
|
};
|
|
4357
4679
|
|
|
4680
|
+
var DateTimeSchema = /*#__PURE__*/function (_Schema) {
|
|
4681
|
+
function DateTimeSchema(options) {
|
|
4682
|
+
var _this;
|
|
4683
|
+
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4684
|
+
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
4685
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
4686
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
4687
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
4688
|
+
_classCallCheck(this, DateTimeSchema);
|
|
4689
|
+
_this = _callSuper(this, DateTimeSchema);
|
|
4690
|
+
_this.options = options;
|
|
4691
|
+
_this.opt = opt;
|
|
4692
|
+
_this.customValidateFunctions = customValidateFunctions;
|
|
4693
|
+
_this.isReadonly = isReadonly;
|
|
4694
|
+
_this.isHidden = isHidden;
|
|
4695
|
+
_this.description = description;
|
|
4696
|
+
return _this;
|
|
4697
|
+
}
|
|
4698
|
+
_inherits(DateTimeSchema, _Schema);
|
|
4699
|
+
return _createClass(DateTimeSchema, [{
|
|
4700
|
+
key: "describe",
|
|
4701
|
+
value: function describe(description) {
|
|
4702
|
+
return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
4703
|
+
}
|
|
4704
|
+
}, {
|
|
4705
|
+
key: "validate",
|
|
4706
|
+
value: function validate(validationFunction) {
|
|
4707
|
+
return new DateTimeSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
4708
|
+
}
|
|
4709
|
+
}, {
|
|
4710
|
+
key: "executeValidate",
|
|
4711
|
+
value: function executeValidate(path, src) {
|
|
4712
|
+
var _this$options, _this$options2;
|
|
4713
|
+
var errors = this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
|
|
4714
|
+
path: path
|
|
4715
|
+
});
|
|
4716
|
+
if (this.opt && (src === null || src === undefined)) {
|
|
4717
|
+
return errors.length > 0 ? _defineProperty({}, path, errors) : false;
|
|
4718
|
+
}
|
|
4719
|
+
if (typeof src !== "string") {
|
|
4720
|
+
errors.push({
|
|
4721
|
+
message: "Expected 'string', got '".concat(_typeof(src), "'"),
|
|
4722
|
+
value: src
|
|
4723
|
+
});
|
|
4724
|
+
return _defineProperty({}, path, errors);
|
|
4725
|
+
}
|
|
4726
|
+
var srcMs = Date.parse(src);
|
|
4727
|
+
if (Number.isNaN(srcMs)) {
|
|
4728
|
+
errors.push({
|
|
4729
|
+
message: "Value '".concat(src, "' is not a valid ISO 8601 datetime"),
|
|
4730
|
+
value: src
|
|
4731
|
+
});
|
|
4732
|
+
return _defineProperty({}, path, errors);
|
|
4733
|
+
}
|
|
4734
|
+
var fromMs = ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.from) !== undefined ? Date.parse(this.options.from) : undefined;
|
|
4735
|
+
var toMs = ((_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.to) !== undefined ? Date.parse(this.options.to) : undefined;
|
|
4736
|
+
if (fromMs !== undefined && Number.isNaN(fromMs)) {
|
|
4737
|
+
var _this$options3;
|
|
4738
|
+
errors.push({
|
|
4739
|
+
message: "From datetime '".concat((_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.from, "' is not a valid ISO 8601 datetime"),
|
|
4740
|
+
value: src,
|
|
4741
|
+
typeError: true
|
|
4742
|
+
});
|
|
4743
|
+
return _defineProperty({}, path, errors);
|
|
4744
|
+
}
|
|
4745
|
+
if (toMs !== undefined && Number.isNaN(toMs)) {
|
|
4746
|
+
var _this$options4;
|
|
4747
|
+
errors.push({
|
|
4748
|
+
message: "To datetime '".concat((_this$options4 = this.options) === null || _this$options4 === void 0 ? void 0 : _this$options4.to, "' is not a valid ISO 8601 datetime"),
|
|
4749
|
+
value: src,
|
|
4750
|
+
typeError: true
|
|
4751
|
+
});
|
|
4752
|
+
return _defineProperty({}, path, errors);
|
|
4753
|
+
}
|
|
4754
|
+
if (fromMs !== undefined && toMs !== undefined) {
|
|
4755
|
+
if (fromMs > toMs) {
|
|
4756
|
+
var _this$options5, _this$options6;
|
|
4757
|
+
errors.push({
|
|
4758
|
+
message: "From datetime ".concat((_this$options5 = this.options) === null || _this$options5 === void 0 ? void 0 : _this$options5.from, " is after to datetime ").concat((_this$options6 = this.options) === null || _this$options6 === void 0 ? void 0 : _this$options6.to),
|
|
4759
|
+
value: src,
|
|
4760
|
+
typeError: true
|
|
4761
|
+
});
|
|
4762
|
+
} else if (srcMs < fromMs || srcMs > toMs) {
|
|
4763
|
+
var _this$options7, _this$options8;
|
|
4764
|
+
errors.push({
|
|
4765
|
+
message: "Datetime is not between ".concat((_this$options7 = this.options) === null || _this$options7 === void 0 ? void 0 : _this$options7.from, " and ").concat((_this$options8 = this.options) === null || _this$options8 === void 0 ? void 0 : _this$options8.to),
|
|
4766
|
+
value: src
|
|
4767
|
+
});
|
|
4768
|
+
}
|
|
4769
|
+
} else if (fromMs !== undefined) {
|
|
4770
|
+
if (srcMs < fromMs) {
|
|
4771
|
+
var _this$options9;
|
|
4772
|
+
errors.push({
|
|
4773
|
+
message: "Datetime is before the minimum datetime ".concat((_this$options9 = this.options) === null || _this$options9 === void 0 ? void 0 : _this$options9.from),
|
|
4774
|
+
value: src
|
|
4775
|
+
});
|
|
4776
|
+
}
|
|
4777
|
+
} else if (toMs !== undefined) {
|
|
4778
|
+
if (srcMs > toMs) {
|
|
4779
|
+
var _this$options0;
|
|
4780
|
+
errors.push({
|
|
4781
|
+
message: "Datetime is after the maximum datetime ".concat((_this$options0 = this.options) === null || _this$options0 === void 0 ? void 0 : _this$options0.to),
|
|
4782
|
+
value: src
|
|
4783
|
+
});
|
|
4784
|
+
}
|
|
4785
|
+
}
|
|
4786
|
+
if (errors.length > 0) {
|
|
4787
|
+
return _defineProperty({}, path, errors);
|
|
4788
|
+
}
|
|
4789
|
+
return false;
|
|
4790
|
+
}
|
|
4791
|
+
}, {
|
|
4792
|
+
key: "executeAssert",
|
|
4793
|
+
value: function executeAssert(path, src) {
|
|
4794
|
+
if (this.opt && src === null) {
|
|
4795
|
+
return {
|
|
4796
|
+
success: true,
|
|
4797
|
+
data: src
|
|
4798
|
+
};
|
|
4799
|
+
}
|
|
4800
|
+
if (src === null) {
|
|
4801
|
+
return {
|
|
4802
|
+
success: false,
|
|
4803
|
+
errors: _defineProperty({}, path, [{
|
|
4804
|
+
message: "Expected 'string', got 'null'",
|
|
4805
|
+
typeError: true
|
|
4806
|
+
}])
|
|
4807
|
+
};
|
|
4808
|
+
}
|
|
4809
|
+
if (typeof src !== "string") {
|
|
4810
|
+
return {
|
|
4811
|
+
success: false,
|
|
4812
|
+
errors: _defineProperty({}, path, [{
|
|
4813
|
+
message: "Expected 'string', got '".concat(_typeof(src), "'"),
|
|
4814
|
+
typeError: true
|
|
4815
|
+
}])
|
|
4816
|
+
};
|
|
4817
|
+
}
|
|
4818
|
+
return {
|
|
4819
|
+
success: true,
|
|
4820
|
+
data: src
|
|
4821
|
+
};
|
|
4822
|
+
}
|
|
4823
|
+
}, {
|
|
4824
|
+
key: "from",
|
|
4825
|
+
value: function from(_from) {
|
|
4826
|
+
return new DateTimeSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
4827
|
+
from: _from
|
|
4828
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
4829
|
+
}
|
|
4830
|
+
}, {
|
|
4831
|
+
key: "to",
|
|
4832
|
+
value: function to(_to) {
|
|
4833
|
+
return new DateTimeSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
4834
|
+
to: _to
|
|
4835
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
4836
|
+
}
|
|
4837
|
+
}, {
|
|
4838
|
+
key: "nullable",
|
|
4839
|
+
value: function nullable() {
|
|
4840
|
+
return new DateTimeSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description);
|
|
4841
|
+
}
|
|
4842
|
+
}, {
|
|
4843
|
+
key: "readonly",
|
|
4844
|
+
value: function readonly() {
|
|
4845
|
+
return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
4846
|
+
}
|
|
4847
|
+
}, {
|
|
4848
|
+
key: "hidden",
|
|
4849
|
+
value: function hidden() {
|
|
4850
|
+
return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
4851
|
+
}
|
|
4852
|
+
}, {
|
|
4853
|
+
key: "executeSerialize",
|
|
4854
|
+
value: function executeSerialize() {
|
|
4855
|
+
var _this$customValidateF;
|
|
4856
|
+
return {
|
|
4857
|
+
type: "dateTime",
|
|
4858
|
+
opt: this.opt,
|
|
4859
|
+
options: this.options,
|
|
4860
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
4861
|
+
readonly: this.isReadonly,
|
|
4862
|
+
hidden: this.isHidden,
|
|
4863
|
+
description: this.description
|
|
4864
|
+
};
|
|
4865
|
+
}
|
|
4866
|
+
}, {
|
|
4867
|
+
key: "executeRender",
|
|
4868
|
+
value: function executeRender() {
|
|
4869
|
+
return {};
|
|
4870
|
+
}
|
|
4871
|
+
}]);
|
|
4872
|
+
}(Schema);
|
|
4873
|
+
var datetime = function datetime(options) {
|
|
4874
|
+
return new DateTimeSchema(options);
|
|
4875
|
+
};
|
|
4876
|
+
|
|
4358
4877
|
function router(router, item) {
|
|
4359
4878
|
var keySchema = string();
|
|
4360
4879
|
var recordSchema = new RecordSchema(item, false, [], router, keySchema);
|
|
@@ -4439,6 +4958,7 @@ function initSchema() {
|
|
|
4439
4958
|
file: file,
|
|
4440
4959
|
files: files,
|
|
4441
4960
|
date: date,
|
|
4961
|
+
datetime: datetime,
|
|
4442
4962
|
route: route,
|
|
4443
4963
|
router: router,
|
|
4444
4964
|
images: images
|
|
@@ -5822,28 +6342,38 @@ function getFileHash(text) {
|
|
|
5822
6342
|
}
|
|
5823
6343
|
|
|
5824
6344
|
function deserializeSchema(serialized) {
|
|
6345
|
+
var schema = deserializeSchemaImpl(serialized);
|
|
6346
|
+
if (serialized.readonly) {
|
|
6347
|
+
schema = schema.readonly();
|
|
6348
|
+
}
|
|
6349
|
+
if (serialized.hidden) {
|
|
6350
|
+
schema = schema.hidden();
|
|
6351
|
+
}
|
|
6352
|
+
return schema;
|
|
6353
|
+
}
|
|
6354
|
+
function deserializeSchemaImpl(serialized) {
|
|
5825
6355
|
var _serialized$options, _serialized$options2, _serialized$accept, _serialized$directory, _serialized$remote;
|
|
5826
6356
|
switch (serialized.type) {
|
|
5827
6357
|
case "string":
|
|
5828
6358
|
return new StringSchema(_objectSpread2(_objectSpread2({}, serialized.options), {}, {
|
|
5829
6359
|
regexp: ((_serialized$options = serialized.options) === null || _serialized$options === void 0 ? void 0 : _serialized$options.regexp) && new RegExp(serialized.options.regexp.source, serialized.options.regexp.flags),
|
|
5830
6360
|
regExpMessage: (_serialized$options2 = serialized.options) === null || _serialized$options2 === void 0 || (_serialized$options2 = _serialized$options2.regexp) === null || _serialized$options2 === void 0 ? void 0 : _serialized$options2.message
|
|
5831
|
-
}), serialized.opt, serialized.raw);
|
|
6361
|
+
}), serialized.opt, serialized.raw, [], null, false, false, serialized.description);
|
|
5832
6362
|
case "literal":
|
|
5833
|
-
return new LiteralSchema(serialized.value, serialized.opt);
|
|
6363
|
+
return new LiteralSchema(serialized.value, serialized.opt, [], false, false, serialized.description);
|
|
5834
6364
|
case "boolean":
|
|
5835
|
-
return new BooleanSchema(serialized.opt);
|
|
6365
|
+
return new BooleanSchema(serialized.opt, [], false, false, serialized.description);
|
|
5836
6366
|
case "number":
|
|
5837
|
-
return new NumberSchema(serialized.options, serialized.opt);
|
|
6367
|
+
return new NumberSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
|
|
5838
6368
|
case "object":
|
|
5839
6369
|
return new ObjectSchema(Object.fromEntries(Object.entries(serialized.items).map(function (_ref) {
|
|
5840
6370
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
5841
6371
|
key = _ref2[0],
|
|
5842
6372
|
item = _ref2[1];
|
|
5843
6373
|
return [key, deserializeSchema(item)];
|
|
5844
|
-
})), serialized.opt);
|
|
6374
|
+
})), serialized.opt, [], false, false, serialized.description);
|
|
5845
6375
|
case "array":
|
|
5846
|
-
return new ArraySchema(deserializeSchema(serialized.item), serialized.opt);
|
|
6376
|
+
return new ArraySchema(deserializeSchema(serialized.item), serialized.opt, [], false, false, serialized.description);
|
|
5847
6377
|
case "union":
|
|
5848
6378
|
return new UnionSchema(typeof serialized.key === "string" ? serialized.key :
|
|
5849
6379
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -5852,7 +6382,7 @@ function deserializeSchema(serialized) {
|
|
|
5852
6382
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5853
6383
|
serialized.items.map(deserializeSchema),
|
|
5854
6384
|
// TODO: we do not really need any here - right?
|
|
5855
|
-
serialized.opt);
|
|
6385
|
+
serialized.opt, [], false, false, serialized.description);
|
|
5856
6386
|
case "richtext":
|
|
5857
6387
|
{
|
|
5858
6388
|
var _serialized$options3, _serialized$options4, _serialized$options5, _serialized$options6, _serialized$options7, _serialized$options8, _serialized$options9;
|
|
@@ -5862,7 +6392,7 @@ function deserializeSchema(serialized) {
|
|
|
5862
6392
|
img: _typeof((_serialized$options7 = serialized.options) === null || _serialized$options7 === void 0 || (_serialized$options7 = _serialized$options7.inline) === null || _serialized$options7 === void 0 ? void 0 : _serialized$options7.img) === "object" ? deserializeSchema(serialized.options.inline.img) : (_serialized$options8 = serialized.options) === null || _serialized$options8 === void 0 || (_serialized$options8 = _serialized$options8.inline) === null || _serialized$options8 === void 0 ? void 0 : _serialized$options8.img
|
|
5863
6393
|
} : (_serialized$options9 = serialized.options) === null || _serialized$options9 === void 0 ? void 0 : _serialized$options9.inline
|
|
5864
6394
|
});
|
|
5865
|
-
return new RichTextSchema(deserializedOptions, serialized.opt);
|
|
6395
|
+
return new RichTextSchema(deserializedOptions, serialized.opt, [], false, false, serialized.description);
|
|
5866
6396
|
}
|
|
5867
6397
|
case "record":
|
|
5868
6398
|
return new RecordSchema(deserializeSchema(serialized.item), serialized.opt, [], null, serialized.key ? deserializeSchema(serialized.key) : null, serialized.mediaType ? {
|
|
@@ -5871,23 +6401,25 @@ function deserializeSchema(serialized) {
|
|
|
5871
6401
|
directory: (_serialized$directory = serialized.directory) !== null && _serialized$directory !== void 0 ? _serialized$directory : "/public/val",
|
|
5872
6402
|
remote: (_serialized$remote = serialized.remote) !== null && _serialized$remote !== void 0 ? _serialized$remote : false,
|
|
5873
6403
|
altSchema: serialized.alt ? deserializeSchema(serialized.alt) : undefined
|
|
5874
|
-
} : undefined);
|
|
6404
|
+
} : undefined, false, false, serialized.description);
|
|
5875
6405
|
case "keyOf":
|
|
5876
|
-
return new KeyOfSchema(serialized.schema, serialized.path, serialized.opt);
|
|
6406
|
+
return new KeyOfSchema(serialized.schema, serialized.path, serialized.opt, [], false, false, serialized.description);
|
|
5877
6407
|
case "route":
|
|
5878
6408
|
{
|
|
5879
6409
|
var routeOptions = serialized.options ? {
|
|
5880
6410
|
include: serialized.options.include ? new RegExp(serialized.options.include.source, serialized.options.include.flags) : undefined,
|
|
5881
6411
|
exclude: serialized.options.exclude ? new RegExp(serialized.options.exclude.source, serialized.options.exclude.flags) : undefined
|
|
5882
6412
|
} : undefined;
|
|
5883
|
-
return new RouteSchema(routeOptions, serialized.opt);
|
|
6413
|
+
return new RouteSchema(routeOptions, serialized.opt, [], false, false, serialized.description);
|
|
5884
6414
|
}
|
|
5885
6415
|
case "file":
|
|
5886
|
-
return new FileSchema(serialized.options, serialized.opt, serialized.remote);
|
|
6416
|
+
return new FileSchema(serialized.options, serialized.opt, serialized.remote, [], {}, false, false, serialized.description);
|
|
5887
6417
|
case "image":
|
|
5888
|
-
return new ImageSchema(serialized.options, serialized.opt, serialized.remote);
|
|
6418
|
+
return new ImageSchema(serialized.options, serialized.opt, serialized.remote, [], {}, false, false, serialized.description);
|
|
5889
6419
|
case "date":
|
|
5890
|
-
return new DateSchema(serialized.options, serialized.opt);
|
|
6420
|
+
return new DateSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
|
|
6421
|
+
case "dateTime":
|
|
6422
|
+
return new DateTimeSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
|
|
5891
6423
|
default:
|
|
5892
6424
|
{
|
|
5893
6425
|
var exhaustiveCheck = serialized;
|
|
@@ -6251,4 +6783,4 @@ function tryJsonParse(str) {
|
|
|
6251
6783
|
}
|
|
6252
6784
|
}
|
|
6253
6785
|
|
|
6254
|
-
export { ArraySchema as A, BooleanSchema as B, DEFAULT_CONTENT_HOST as D, FATAL_ERROR_TYPES as F, GenericSelector as G, Internal as I, KeyOfSchema as K, LiteralSchema as L, ModuleFilePathSep as M, NumberSchema as N, ObjectSchema as O, PatchError as P, RecordSchema as R, Schema as S, UnionSchema as U, VAL_EXTENSION as V, _typeof as _, _slicedToArray as a, _createClass as b, _classCallCheck as c, _toConsumableArray as d, DEFAULT_APP_HOST as e, DEFAULT_VAL_REMOTE_HOST as f, FILE_REF_PROP as g, FILE_REF_SUBTYPE_TAG as h, initVal as i, derefPatch as j, StringSchema as k, ImageSchema as l, modules as m, FileSchema as n, DateSchema as o,
|
|
6786
|
+
export { ArraySchema as A, BooleanSchema as B, DEFAULT_CONTENT_HOST as D, FATAL_ERROR_TYPES as F, GenericSelector as G, Internal as I, KeyOfSchema as K, LiteralSchema as L, ModuleFilePathSep as M, NumberSchema as N, ObjectSchema as O, PatchError as P, RecordSchema as R, Schema as S, UnionSchema as U, VAL_EXTENSION as V, _typeof as _, _slicedToArray as a, _createClass as b, _classCallCheck as c, _toConsumableArray as d, DEFAULT_APP_HOST as e, DEFAULT_VAL_REMOTE_HOST as f, FILE_REF_PROP as g, FILE_REF_SUBTYPE_TAG as h, initVal as i, derefPatch as j, StringSchema as k, ImageSchema as l, modules as m, FileSchema as n, DateSchema as o, DateTimeSchema as p, RouteSchema as q, RichTextSchema as r, splitModuleFilePathAndModulePath as s, deserializeSchema as t, getSourcePathFromRoute as u };
|