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