@valbuild/core 0.96.3 → 0.97.1
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/extractValModules.d.ts +27 -0
- package/dist/declarations/src/index.d.ts +2 -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/declarations/src/selector/index.d.ts +0 -1
- package/dist/{index-d020e978.cjs.dev.js → index-039896b7.cjs.dev.js} +1285 -374
- package/dist/{index-5bc1d576.cjs.prod.js → index-4da4ac5a.cjs.prod.js} +1285 -374
- package/dist/{index-ba727e96.esm.js → index-8c26d8f4.esm.js} +1284 -375
- package/dist/valbuild-core.cjs.dev.js +3 -1
- package/dist/valbuild-core.cjs.prod.js +3 -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
|
@@ -274,23 +274,29 @@ function _inherits(t, e) {
|
|
|
274
274
|
}), e && _setPrototypeOf(t, e);
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
+
// Identity symbols are registered in the global Symbol registry so that
|
|
278
|
+
// multiple bundled copies of @valbuild/core (e.g. the editor SPA bundle vs.
|
|
279
|
+
// the host Next.js bundle) resolve to the same Symbol instance. Without
|
|
280
|
+
// this, a value produced by one copy reads as `undefined` when accessed
|
|
281
|
+
// via these keys from the other copy — extractValModules running in the
|
|
282
|
+
// SPA against `.val.ts` modules loaded from the host bundle was hitting
|
|
283
|
+
// this exact failure mode.
|
|
277
284
|
/**
|
|
278
285
|
* @internal
|
|
279
286
|
*/
|
|
280
|
-
var GetSchema = Symbol("GetSchema");
|
|
281
|
-
/**
|
|
287
|
+
var GetSchema = Symbol["for"]("@valbuild/core/GetSchema");
|
|
282
288
|
/**
|
|
283
289
|
* @internal
|
|
284
290
|
*/
|
|
285
|
-
var Path = Symbol("Path");
|
|
291
|
+
var Path = Symbol["for"]("@valbuild/core/Path");
|
|
286
292
|
/**
|
|
287
293
|
* @internal
|
|
288
294
|
*/
|
|
289
|
-
var GetSource = Symbol("GetSource");
|
|
295
|
+
var GetSource = Symbol["for"]("@valbuild/core/GetSource");
|
|
290
296
|
/**
|
|
291
297
|
* @internal
|
|
292
298
|
*/
|
|
293
|
-
var ValError = Symbol("ValError");
|
|
299
|
+
var ValError = Symbol["for"]("@valbuild/core/ValError");
|
|
294
300
|
var GenericSelector = /*#__PURE__*/_createClass(function GenericSelector(valOrExpr, path, schema, error) {
|
|
295
301
|
_classCallCheck(this, GenericSelector);
|
|
296
302
|
this[Path] = path;
|
|
@@ -416,6 +422,9 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
416
422
|
var isRemote = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
417
423
|
var customValidateFunctions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
418
424
|
var moduleMetadata = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
425
|
+
var isReadonly = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
426
|
+
var isHidden = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
427
|
+
var description = arguments.length > 7 ? arguments[7] : undefined;
|
|
419
428
|
_classCallCheck(this, FileSchema);
|
|
420
429
|
_this = _callSuper(this, FileSchema);
|
|
421
430
|
_this.options = options;
|
|
@@ -423,18 +432,26 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
423
432
|
_this.isRemote = isRemote;
|
|
424
433
|
_this.customValidateFunctions = customValidateFunctions;
|
|
425
434
|
_this.moduleMetadata = moduleMetadata;
|
|
435
|
+
_this.isReadonly = isReadonly;
|
|
436
|
+
_this.isHidden = isHidden;
|
|
437
|
+
_this.description = description;
|
|
426
438
|
return _this;
|
|
427
439
|
}
|
|
428
440
|
_inherits(FileSchema, _Schema);
|
|
429
441
|
return _createClass(FileSchema, [{
|
|
442
|
+
key: "describe",
|
|
443
|
+
value: function describe(description) {
|
|
444
|
+
return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
445
|
+
}
|
|
446
|
+
}, {
|
|
430
447
|
key: "remote",
|
|
431
448
|
value: function remote() {
|
|
432
|
-
return new FileSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata);
|
|
449
|
+
return new FileSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
|
|
433
450
|
}
|
|
434
451
|
}, {
|
|
435
452
|
key: "validate",
|
|
436
453
|
value: function validate(validationFunction) {
|
|
437
|
-
return new FileSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata);
|
|
454
|
+
return new FileSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
|
|
438
455
|
}
|
|
439
456
|
}, {
|
|
440
457
|
key: "executeValidate",
|
|
@@ -595,7 +612,17 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
595
612
|
}, {
|
|
596
613
|
key: "nullable",
|
|
597
614
|
value: function nullable() {
|
|
598
|
-
return new FileSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata);
|
|
615
|
+
return new FileSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
|
|
616
|
+
}
|
|
617
|
+
}, {
|
|
618
|
+
key: "readonly",
|
|
619
|
+
value: function readonly() {
|
|
620
|
+
return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, true, this.isHidden, this.description);
|
|
621
|
+
}
|
|
622
|
+
}, {
|
|
623
|
+
key: "hidden",
|
|
624
|
+
value: function hidden() {
|
|
625
|
+
return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, true, this.description);
|
|
599
626
|
}
|
|
600
627
|
}, {
|
|
601
628
|
key: "executeSerialize",
|
|
@@ -608,7 +635,10 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
608
635
|
opt: this.opt,
|
|
609
636
|
remote: this.isRemote,
|
|
610
637
|
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
|
|
638
|
+
referencedModule: modulePaths.length > 0 ? modulePaths[0] : undefined,
|
|
639
|
+
readonly: this.isReadonly,
|
|
640
|
+
hidden: this.isHidden,
|
|
641
|
+
description: this.description
|
|
612
642
|
};
|
|
613
643
|
}
|
|
614
644
|
}, {
|
|
@@ -688,6 +718,9 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
688
718
|
var isRaw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
689
719
|
var customValidateFunctions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
690
720
|
var renderInput = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
721
|
+
var isReadonly = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
722
|
+
var isHidden = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
723
|
+
var description = arguments.length > 7 ? arguments[7] : undefined;
|
|
691
724
|
_classCallCheck(this, StringSchema);
|
|
692
725
|
_this = _callSuper(this, StringSchema);
|
|
693
726
|
_this.options = options;
|
|
@@ -695,14 +728,22 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
695
728
|
_this.isRaw = isRaw;
|
|
696
729
|
_this.customValidateFunctions = customValidateFunctions;
|
|
697
730
|
_this.renderInput = renderInput;
|
|
731
|
+
_this.isReadonly = isReadonly;
|
|
732
|
+
_this.isHidden = isHidden;
|
|
733
|
+
_this.description = description;
|
|
698
734
|
return _this;
|
|
699
735
|
}
|
|
700
|
-
|
|
701
|
-
/**
|
|
702
|
-
* @deprecated Use `minLength` instead
|
|
703
|
-
*/
|
|
704
736
|
_inherits(StringSchema, _Schema);
|
|
705
737
|
return _createClass(StringSchema, [{
|
|
738
|
+
key: "describe",
|
|
739
|
+
value: function describe(description) {
|
|
740
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* @deprecated Use `minLength` instead
|
|
745
|
+
*/
|
|
746
|
+
}, {
|
|
706
747
|
key: "min",
|
|
707
748
|
value: function min(minLength) {
|
|
708
749
|
return this.minLength(minLength);
|
|
@@ -712,7 +753,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
712
753
|
value: function minLength(_minLength) {
|
|
713
754
|
return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
714
755
|
minLength: _minLength
|
|
715
|
-
}), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput);
|
|
756
|
+
}), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
|
|
716
757
|
}
|
|
717
758
|
|
|
718
759
|
/**
|
|
@@ -728,7 +769,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
728
769
|
value: function maxLength(_maxLength) {
|
|
729
770
|
return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
730
771
|
maxLength: _maxLength
|
|
731
|
-
}), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput);
|
|
772
|
+
}), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
|
|
732
773
|
}
|
|
733
774
|
}, {
|
|
734
775
|
key: "regexp",
|
|
@@ -736,12 +777,12 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
736
777
|
return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
737
778
|
regexp: _regexp,
|
|
738
779
|
regExpMessage: message
|
|
739
|
-
}), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput);
|
|
780
|
+
}), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
|
|
740
781
|
}
|
|
741
782
|
}, {
|
|
742
783
|
key: "validate",
|
|
743
784
|
value: function validate(validationFunction) {
|
|
744
|
-
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction), this.renderInput);
|
|
785
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction), this.renderInput, this.isReadonly, this.isHidden, this.description);
|
|
745
786
|
}
|
|
746
787
|
}, {
|
|
747
788
|
key: "executeValidate",
|
|
@@ -814,12 +855,22 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
814
855
|
}, {
|
|
815
856
|
key: "nullable",
|
|
816
857
|
value: function nullable() {
|
|
817
|
-
return new StringSchema(this.options, true, this.isRaw, this.customValidateFunctions, this.renderInput);
|
|
858
|
+
return new StringSchema(this.options, true, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
|
|
859
|
+
}
|
|
860
|
+
}, {
|
|
861
|
+
key: "readonly",
|
|
862
|
+
value: function readonly() {
|
|
863
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, true, this.isHidden, this.description);
|
|
864
|
+
}
|
|
865
|
+
}, {
|
|
866
|
+
key: "hidden",
|
|
867
|
+
value: function hidden() {
|
|
868
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, true, this.description);
|
|
818
869
|
}
|
|
819
870
|
}, {
|
|
820
871
|
key: "raw",
|
|
821
872
|
value: function raw() {
|
|
822
|
-
return new StringSchema(this.options, this.opt, true, this.customValidateFunctions, this.renderInput);
|
|
873
|
+
return new StringSchema(this.options, this.opt, true, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
|
|
823
874
|
}
|
|
824
875
|
}, {
|
|
825
876
|
key: "executeSerialize",
|
|
@@ -839,13 +890,16 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
839
890
|
},
|
|
840
891
|
opt: this.opt,
|
|
841
892
|
raw: this.isRaw,
|
|
842
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0
|
|
893
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0,
|
|
894
|
+
readonly: this.isReadonly,
|
|
895
|
+
hidden: this.isHidden,
|
|
896
|
+
description: this.description
|
|
843
897
|
};
|
|
844
898
|
}
|
|
845
899
|
}, {
|
|
846
900
|
key: "render",
|
|
847
901
|
value: function render(input) {
|
|
848
|
-
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, input);
|
|
902
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, input, this.isReadonly, this.isHidden, this.description);
|
|
849
903
|
}
|
|
850
904
|
}, {
|
|
851
905
|
key: "executeRender",
|
|
@@ -880,18 +934,29 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
880
934
|
var _this;
|
|
881
935
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
882
936
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
937
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
938
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
939
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
883
940
|
_classCallCheck(this, ObjectSchema);
|
|
884
941
|
_this = _callSuper(this, ObjectSchema);
|
|
885
942
|
_this.items = items;
|
|
886
943
|
_this.opt = opt;
|
|
887
944
|
_this.customValidateFunctions = customValidateFunctions;
|
|
945
|
+
_this.isReadonly = isReadonly;
|
|
946
|
+
_this.isHidden = isHidden;
|
|
947
|
+
_this.description = description;
|
|
888
948
|
return _this;
|
|
889
949
|
}
|
|
890
950
|
_inherits(ObjectSchema, _Schema);
|
|
891
951
|
return _createClass(ObjectSchema, [{
|
|
952
|
+
key: "describe",
|
|
953
|
+
value: function describe(description) {
|
|
954
|
+
return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
955
|
+
}
|
|
956
|
+
}, {
|
|
892
957
|
key: "validate",
|
|
893
958
|
value: function validate(validationFunction) {
|
|
894
|
-
return new ObjectSchema(this.items, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
959
|
+
return new ObjectSchema(this.items, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
895
960
|
}
|
|
896
961
|
}, {
|
|
897
962
|
key: "executeValidate",
|
|
@@ -1015,7 +1080,17 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1015
1080
|
}, {
|
|
1016
1081
|
key: "nullable",
|
|
1017
1082
|
value: function nullable() {
|
|
1018
|
-
return new ObjectSchema(this.items, true);
|
|
1083
|
+
return new ObjectSchema(this.items, true, [], this.isReadonly, this.isHidden, this.description);
|
|
1084
|
+
}
|
|
1085
|
+
}, {
|
|
1086
|
+
key: "readonly",
|
|
1087
|
+
value: function readonly() {
|
|
1088
|
+
return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
1089
|
+
}
|
|
1090
|
+
}, {
|
|
1091
|
+
key: "hidden",
|
|
1092
|
+
value: function hidden() {
|
|
1093
|
+
return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
1019
1094
|
}
|
|
1020
1095
|
}, {
|
|
1021
1096
|
key: "executeSerialize",
|
|
@@ -1030,7 +1105,10 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1030
1105
|
return [key, schema["executeSerialize"]()];
|
|
1031
1106
|
})),
|
|
1032
1107
|
opt: this.opt,
|
|
1033
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
1108
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
1109
|
+
readonly: this.isReadonly,
|
|
1110
|
+
hidden: this.isHidden,
|
|
1111
|
+
description: this.description
|
|
1034
1112
|
};
|
|
1035
1113
|
}
|
|
1036
1114
|
}, {
|
|
@@ -1070,19 +1148,30 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1070
1148
|
var _this;
|
|
1071
1149
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1072
1150
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1151
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
1152
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
1153
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
1073
1154
|
_classCallCheck(this, ArraySchema);
|
|
1074
1155
|
_this = _callSuper(this, ArraySchema);
|
|
1075
1156
|
_defineProperty(_this, "renderInput", null);
|
|
1076
1157
|
_this.item = item;
|
|
1077
1158
|
_this.opt = opt;
|
|
1078
1159
|
_this.customValidateFunctions = customValidateFunctions;
|
|
1160
|
+
_this.isReadonly = isReadonly;
|
|
1161
|
+
_this.isHidden = isHidden;
|
|
1162
|
+
_this.description = description;
|
|
1079
1163
|
return _this;
|
|
1080
1164
|
}
|
|
1081
1165
|
_inherits(ArraySchema, _Schema);
|
|
1082
1166
|
return _createClass(ArraySchema, [{
|
|
1167
|
+
key: "describe",
|
|
1168
|
+
value: function describe(description) {
|
|
1169
|
+
return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
1170
|
+
}
|
|
1171
|
+
}, {
|
|
1083
1172
|
key: "validate",
|
|
1084
1173
|
value: function validate(validationFunction) {
|
|
1085
|
-
return new ArraySchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
1174
|
+
return new ArraySchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
1086
1175
|
}
|
|
1087
1176
|
}, {
|
|
1088
1177
|
key: "executeValidate",
|
|
@@ -1154,7 +1243,17 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1154
1243
|
}, {
|
|
1155
1244
|
key: "nullable",
|
|
1156
1245
|
value: function nullable() {
|
|
1157
|
-
return new ArraySchema(this.item, true);
|
|
1246
|
+
return new ArraySchema(this.item, true, [], this.isReadonly, this.isHidden, this.description);
|
|
1247
|
+
}
|
|
1248
|
+
}, {
|
|
1249
|
+
key: "readonly",
|
|
1250
|
+
value: function readonly() {
|
|
1251
|
+
return new ArraySchema(this.item, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
1252
|
+
}
|
|
1253
|
+
}, {
|
|
1254
|
+
key: "hidden",
|
|
1255
|
+
value: function hidden() {
|
|
1256
|
+
return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
1158
1257
|
}
|
|
1159
1258
|
}, {
|
|
1160
1259
|
key: "executeSerialize",
|
|
@@ -1164,7 +1263,10 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1164
1263
|
type: "array",
|
|
1165
1264
|
item: this.item["executeSerialize"](),
|
|
1166
1265
|
opt: this.opt,
|
|
1167
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
1266
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
1267
|
+
readonly: this.isReadonly,
|
|
1268
|
+
hidden: this.isHidden,
|
|
1269
|
+
description: this.description
|
|
1168
1270
|
};
|
|
1169
1271
|
}
|
|
1170
1272
|
}, {
|
|
@@ -1245,18 +1347,29 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1245
1347
|
var _this;
|
|
1246
1348
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1247
1349
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1350
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
1351
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
1352
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
1248
1353
|
_classCallCheck(this, LiteralSchema);
|
|
1249
1354
|
_this = _callSuper(this, LiteralSchema);
|
|
1250
1355
|
_this.value = value;
|
|
1251
1356
|
_this.opt = opt;
|
|
1252
1357
|
_this.customValidateFunctions = customValidateFunctions;
|
|
1358
|
+
_this.isReadonly = isReadonly;
|
|
1359
|
+
_this.isHidden = isHidden;
|
|
1360
|
+
_this.description = description;
|
|
1253
1361
|
return _this;
|
|
1254
1362
|
}
|
|
1255
1363
|
_inherits(LiteralSchema, _Schema);
|
|
1256
1364
|
return _createClass(LiteralSchema, [{
|
|
1365
|
+
key: "describe",
|
|
1366
|
+
value: function describe(description) {
|
|
1367
|
+
return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
1368
|
+
}
|
|
1369
|
+
}, {
|
|
1257
1370
|
key: "validate",
|
|
1258
1371
|
value: function validate(validationFunction) {
|
|
1259
|
-
return new LiteralSchema(this.value, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
1372
|
+
return new LiteralSchema(this.value, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
1260
1373
|
}
|
|
1261
1374
|
}, {
|
|
1262
1375
|
key: "executeValidate",
|
|
@@ -1319,7 +1432,17 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1319
1432
|
}, {
|
|
1320
1433
|
key: "nullable",
|
|
1321
1434
|
value: function nullable() {
|
|
1322
|
-
return new LiteralSchema(this.value, true);
|
|
1435
|
+
return new LiteralSchema(this.value, true, [], this.isReadonly, this.isHidden, this.description);
|
|
1436
|
+
}
|
|
1437
|
+
}, {
|
|
1438
|
+
key: "readonly",
|
|
1439
|
+
value: function readonly() {
|
|
1440
|
+
return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
1441
|
+
}
|
|
1442
|
+
}, {
|
|
1443
|
+
key: "hidden",
|
|
1444
|
+
value: function hidden() {
|
|
1445
|
+
return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
1323
1446
|
}
|
|
1324
1447
|
}, {
|
|
1325
1448
|
key: "executeSerialize",
|
|
@@ -1329,7 +1452,10 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1329
1452
|
type: "literal",
|
|
1330
1453
|
value: this.value,
|
|
1331
1454
|
opt: this.opt,
|
|
1332
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
1455
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
1456
|
+
readonly: this.isReadonly,
|
|
1457
|
+
hidden: this.isHidden,
|
|
1458
|
+
description: this.description
|
|
1333
1459
|
};
|
|
1334
1460
|
}
|
|
1335
1461
|
}, {
|
|
@@ -1348,19 +1474,30 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1348
1474
|
var _this;
|
|
1349
1475
|
var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1350
1476
|
var customValidateFunctions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
1477
|
+
var isReadonly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
1478
|
+
var isHidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
1479
|
+
var description = arguments.length > 6 ? arguments[6] : undefined;
|
|
1351
1480
|
_classCallCheck(this, UnionSchema);
|
|
1352
1481
|
_this = _callSuper(this, UnionSchema);
|
|
1353
1482
|
_this.key = key;
|
|
1354
1483
|
_this.items = items;
|
|
1355
1484
|
_this.opt = opt;
|
|
1356
1485
|
_this.customValidateFunctions = customValidateFunctions;
|
|
1486
|
+
_this.isReadonly = isReadonly;
|
|
1487
|
+
_this.isHidden = isHidden;
|
|
1488
|
+
_this.description = description;
|
|
1357
1489
|
return _this;
|
|
1358
1490
|
}
|
|
1359
1491
|
_inherits(UnionSchema, _Schema);
|
|
1360
1492
|
return _createClass(UnionSchema, [{
|
|
1493
|
+
key: "describe",
|
|
1494
|
+
value: function describe(description) {
|
|
1495
|
+
return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
1496
|
+
}
|
|
1497
|
+
}, {
|
|
1361
1498
|
key: "validate",
|
|
1362
1499
|
value: function validate(validationFunction) {
|
|
1363
|
-
return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions.concat(validationFunction));
|
|
1500
|
+
return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description);
|
|
1364
1501
|
}
|
|
1365
1502
|
}, {
|
|
1366
1503
|
key: "executeValidate",
|
|
@@ -1653,7 +1790,17 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1653
1790
|
}, {
|
|
1654
1791
|
key: "nullable",
|
|
1655
1792
|
value: function nullable() {
|
|
1656
|
-
return new UnionSchema(this.key, this.items, true);
|
|
1793
|
+
return new UnionSchema(this.key, this.items, true, [], this.isReadonly, this.isHidden, this.description);
|
|
1794
|
+
}
|
|
1795
|
+
}, {
|
|
1796
|
+
key: "readonly",
|
|
1797
|
+
value: function readonly() {
|
|
1798
|
+
return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
1799
|
+
}
|
|
1800
|
+
}, {
|
|
1801
|
+
key: "hidden",
|
|
1802
|
+
value: function hidden() {
|
|
1803
|
+
return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
1657
1804
|
}
|
|
1658
1805
|
}, {
|
|
1659
1806
|
key: "executeSerialize",
|
|
@@ -1668,7 +1815,10 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1668
1815
|
return o["executeSerialize"]();
|
|
1669
1816
|
}),
|
|
1670
1817
|
opt: this.opt,
|
|
1671
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
1818
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
1819
|
+
readonly: this.isReadonly,
|
|
1820
|
+
hidden: this.isHidden,
|
|
1821
|
+
description: this.description
|
|
1672
1822
|
};
|
|
1673
1823
|
}
|
|
1674
1824
|
return {
|
|
@@ -1678,7 +1828,10 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1678
1828
|
return o["executeSerialize"]();
|
|
1679
1829
|
}),
|
|
1680
1830
|
opt: this.opt,
|
|
1681
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0
|
|
1831
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0,
|
|
1832
|
+
readonly: this.isReadonly,
|
|
1833
|
+
hidden: this.isHidden,
|
|
1834
|
+
description: this.description
|
|
1682
1835
|
};
|
|
1683
1836
|
}
|
|
1684
1837
|
}, {
|
|
@@ -1739,6 +1892,9 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1739
1892
|
var isRemote = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1740
1893
|
var customValidateFunctions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
1741
1894
|
var moduleMetadata = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
1895
|
+
var isReadonly = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
1896
|
+
var isHidden = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
1897
|
+
var description = arguments.length > 7 ? arguments[7] : undefined;
|
|
1742
1898
|
_classCallCheck(this, ImageSchema);
|
|
1743
1899
|
_this = _callSuper(this, ImageSchema);
|
|
1744
1900
|
_this.options = options;
|
|
@@ -1746,18 +1902,26 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1746
1902
|
_this.isRemote = isRemote;
|
|
1747
1903
|
_this.customValidateFunctions = customValidateFunctions;
|
|
1748
1904
|
_this.moduleMetadata = moduleMetadata;
|
|
1905
|
+
_this.isReadonly = isReadonly;
|
|
1906
|
+
_this.isHidden = isHidden;
|
|
1907
|
+
_this.description = description;
|
|
1749
1908
|
return _this;
|
|
1750
1909
|
}
|
|
1751
1910
|
_inherits(ImageSchema, _Schema);
|
|
1752
1911
|
return _createClass(ImageSchema, [{
|
|
1912
|
+
key: "describe",
|
|
1913
|
+
value: function describe(description) {
|
|
1914
|
+
return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
1915
|
+
}
|
|
1916
|
+
}, {
|
|
1753
1917
|
key: "remote",
|
|
1754
1918
|
value: function remote() {
|
|
1755
|
-
return new ImageSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata);
|
|
1919
|
+
return new ImageSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
|
|
1756
1920
|
}
|
|
1757
1921
|
}, {
|
|
1758
1922
|
key: "validate",
|
|
1759
1923
|
value: function validate(validationFunction) {
|
|
1760
|
-
return new ImageSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata);
|
|
1924
|
+
return new ImageSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
|
|
1761
1925
|
}
|
|
1762
1926
|
}, {
|
|
1763
1927
|
key: "executeValidate",
|
|
@@ -1937,7 +2101,17 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1937
2101
|
}, {
|
|
1938
2102
|
key: "nullable",
|
|
1939
2103
|
value: function nullable() {
|
|
1940
|
-
return new ImageSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata);
|
|
2104
|
+
return new ImageSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
|
|
2105
|
+
}
|
|
2106
|
+
}, {
|
|
2107
|
+
key: "readonly",
|
|
2108
|
+
value: function readonly() {
|
|
2109
|
+
return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, true, this.isHidden, this.description);
|
|
2110
|
+
}
|
|
2111
|
+
}, {
|
|
2112
|
+
key: "hidden",
|
|
2113
|
+
value: function hidden() {
|
|
2114
|
+
return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, true, this.description);
|
|
1941
2115
|
}
|
|
1942
2116
|
}, {
|
|
1943
2117
|
key: "executeSerialize",
|
|
@@ -1950,7 +2124,10 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1950
2124
|
opt: this.opt,
|
|
1951
2125
|
remote: this.isRemote,
|
|
1952
2126
|
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
|
|
2127
|
+
referencedModule: modulePaths.length > 0 ? modulePaths[0] : undefined,
|
|
2128
|
+
readonly: this.isReadonly,
|
|
2129
|
+
hidden: this.isHidden,
|
|
2130
|
+
description: this.description
|
|
1954
2131
|
};
|
|
1955
2132
|
}
|
|
1956
2133
|
}, {
|
|
@@ -1982,33 +2159,44 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1982
2159
|
var _this;
|
|
1983
2160
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1984
2161
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
2162
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2163
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
2164
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
1985
2165
|
_classCallCheck(this, RouteSchema);
|
|
1986
2166
|
_this = _callSuper(this, RouteSchema);
|
|
1987
2167
|
_this.options = options;
|
|
1988
2168
|
_this.opt = opt;
|
|
1989
2169
|
_this.customValidateFunctions = customValidateFunctions;
|
|
2170
|
+
_this.isReadonly = isReadonly;
|
|
2171
|
+
_this.isHidden = isHidden;
|
|
2172
|
+
_this.description = description;
|
|
1990
2173
|
return _this;
|
|
1991
2174
|
}
|
|
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
2175
|
_inherits(RouteSchema, _Schema);
|
|
2006
2176
|
return _createClass(RouteSchema, [{
|
|
2177
|
+
key: "describe",
|
|
2178
|
+
value: function describe(description) {
|
|
2179
|
+
return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
2180
|
+
}
|
|
2181
|
+
|
|
2182
|
+
/**
|
|
2183
|
+
* Specify a pattern for which routes are allowed.
|
|
2184
|
+
*
|
|
2185
|
+
* Semantics:
|
|
2186
|
+
* - If only include is set: route must match include pattern
|
|
2187
|
+
* - If only exclude is set: route must NOT match exclude pattern
|
|
2188
|
+
* - If both are set: route must match include AND must NOT match exclude
|
|
2189
|
+
*
|
|
2190
|
+
* @example
|
|
2191
|
+
* s.route().include(/^\/(home|about|contact)$/) // Only these specific routes
|
|
2192
|
+
* s.route().include(/^\/api\//).exclude(/^\/api\/internal\//) // API routes except internal
|
|
2193
|
+
*/
|
|
2194
|
+
}, {
|
|
2007
2195
|
key: "include",
|
|
2008
2196
|
value: function include(pattern) {
|
|
2009
2197
|
return new RouteSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
2010
2198
|
include: pattern
|
|
2011
|
-
}), this.opt, this.customValidateFunctions);
|
|
2199
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
2012
2200
|
}
|
|
2013
2201
|
|
|
2014
2202
|
/**
|
|
@@ -2028,12 +2216,12 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2028
2216
|
value: function exclude(pattern) {
|
|
2029
2217
|
return new RouteSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
2030
2218
|
exclude: pattern
|
|
2031
|
-
}), this.opt, this.customValidateFunctions);
|
|
2219
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
2032
2220
|
}
|
|
2033
2221
|
}, {
|
|
2034
2222
|
key: "validate",
|
|
2035
2223
|
value: function validate(validationFunction) {
|
|
2036
|
-
return new RouteSchema(this.options, this.opt, this.customValidateFunctions.concat(validationFunction));
|
|
2224
|
+
return new RouteSchema(this.options, this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description);
|
|
2037
2225
|
}
|
|
2038
2226
|
}, {
|
|
2039
2227
|
key: "executeValidate",
|
|
@@ -2088,7 +2276,17 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2088
2276
|
}, {
|
|
2089
2277
|
key: "nullable",
|
|
2090
2278
|
value: function nullable() {
|
|
2091
|
-
return new RouteSchema(this.options, true, this.customValidateFunctions);
|
|
2279
|
+
return new RouteSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
2280
|
+
}
|
|
2281
|
+
}, {
|
|
2282
|
+
key: "readonly",
|
|
2283
|
+
value: function readonly() {
|
|
2284
|
+
return new RouteSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
2285
|
+
}
|
|
2286
|
+
}, {
|
|
2287
|
+
key: "hidden",
|
|
2288
|
+
value: function hidden() {
|
|
2289
|
+
return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
2092
2290
|
}
|
|
2093
2291
|
}, {
|
|
2094
2292
|
key: "executeSerialize",
|
|
@@ -2108,7 +2306,10 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2108
2306
|
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
2109
2307
|
},
|
|
2110
2308
|
opt: this.opt,
|
|
2111
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0
|
|
2309
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0,
|
|
2310
|
+
readonly: this.isReadonly,
|
|
2311
|
+
hidden: this.isHidden,
|
|
2312
|
+
description: this.description
|
|
2112
2313
|
};
|
|
2113
2314
|
}
|
|
2114
2315
|
}, {
|
|
@@ -2127,32 +2328,43 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2127
2328
|
var _this;
|
|
2128
2329
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2129
2330
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
2331
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2332
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
2333
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
2130
2334
|
_classCallCheck(this, RichTextSchema);
|
|
2131
2335
|
_this = _callSuper(this, RichTextSchema);
|
|
2132
2336
|
_this.options = options;
|
|
2133
2337
|
_this.opt = opt;
|
|
2134
2338
|
_this.customValidateFunctions = customValidateFunctions;
|
|
2339
|
+
_this.isReadonly = isReadonly;
|
|
2340
|
+
_this.isHidden = isHidden;
|
|
2341
|
+
_this.description = description;
|
|
2135
2342
|
return _this;
|
|
2136
2343
|
}
|
|
2137
2344
|
_inherits(RichTextSchema, _Schema);
|
|
2138
2345
|
return _createClass(RichTextSchema, [{
|
|
2346
|
+
key: "describe",
|
|
2347
|
+
value: function describe(description) {
|
|
2348
|
+
return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
2349
|
+
}
|
|
2350
|
+
}, {
|
|
2139
2351
|
key: "maxLength",
|
|
2140
2352
|
value: function maxLength(max) {
|
|
2141
2353
|
return new RichTextSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
2142
2354
|
maxLength: max
|
|
2143
|
-
}), this.opt);
|
|
2355
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
2144
2356
|
}
|
|
2145
2357
|
}, {
|
|
2146
2358
|
key: "minLength",
|
|
2147
2359
|
value: function minLength(min) {
|
|
2148
2360
|
return new RichTextSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
2149
2361
|
minLength: min
|
|
2150
|
-
}), this.opt);
|
|
2362
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
2151
2363
|
}
|
|
2152
2364
|
}, {
|
|
2153
2365
|
key: "validate",
|
|
2154
2366
|
value: function validate(validationFunction) {
|
|
2155
|
-
return new RichTextSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
2367
|
+
return new RichTextSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
2156
2368
|
}
|
|
2157
2369
|
}, {
|
|
2158
2370
|
key: "executeValidate",
|
|
@@ -2602,7 +2814,17 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2602
2814
|
}, {
|
|
2603
2815
|
key: "nullable",
|
|
2604
2816
|
value: function nullable() {
|
|
2605
|
-
return new RichTextSchema(this.options, true);
|
|
2817
|
+
return new RichTextSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description);
|
|
2818
|
+
}
|
|
2819
|
+
}, {
|
|
2820
|
+
key: "readonly",
|
|
2821
|
+
value: function readonly() {
|
|
2822
|
+
return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
2823
|
+
}
|
|
2824
|
+
}, {
|
|
2825
|
+
key: "hidden",
|
|
2826
|
+
value: function hidden() {
|
|
2827
|
+
return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
2606
2828
|
}
|
|
2607
2829
|
}, {
|
|
2608
2830
|
key: "executeSerialize",
|
|
@@ -2636,7 +2858,10 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2636
2858
|
type: "richtext",
|
|
2637
2859
|
opt: this.opt,
|
|
2638
2860
|
options: serializedOptions,
|
|
2639
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
2861
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
2862
|
+
readonly: this.isReadonly,
|
|
2863
|
+
hidden: this.isHidden,
|
|
2864
|
+
description: this.description
|
|
2640
2865
|
};
|
|
2641
2866
|
}
|
|
2642
2867
|
}, {
|
|
@@ -2691,6 +2916,9 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2691
2916
|
var currentRouter = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
2692
2917
|
var keySchema = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
2693
2918
|
var mediaOptions = arguments.length > 5 ? arguments[5] : undefined;
|
|
2919
|
+
var isReadonly = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
2920
|
+
var isHidden = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
2921
|
+
var description = arguments.length > 8 ? arguments[8] : undefined;
|
|
2694
2922
|
_classCallCheck(this, RecordSchema);
|
|
2695
2923
|
_this = _callSuper(this, RecordSchema);
|
|
2696
2924
|
_defineProperty(_this, "renderInput", null);
|
|
@@ -2700,13 +2928,21 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2700
2928
|
_this.currentRouter = currentRouter;
|
|
2701
2929
|
_this.keySchema = keySchema;
|
|
2702
2930
|
_this.mediaOptions = mediaOptions;
|
|
2931
|
+
_this.isReadonly = isReadonly;
|
|
2932
|
+
_this.isHidden = isHidden;
|
|
2933
|
+
_this.description = description;
|
|
2703
2934
|
return _this;
|
|
2704
2935
|
}
|
|
2705
2936
|
_inherits(RecordSchema, _Schema);
|
|
2706
2937
|
return _createClass(RecordSchema, [{
|
|
2938
|
+
key: "describe",
|
|
2939
|
+
value: function describe(description) {
|
|
2940
|
+
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);
|
|
2941
|
+
}
|
|
2942
|
+
}, {
|
|
2707
2943
|
key: "validate",
|
|
2708
2944
|
value: function validate(validationFunction) {
|
|
2709
|
-
return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.currentRouter, this.keySchema, this.mediaOptions);
|
|
2945
|
+
return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description);
|
|
2710
2946
|
}
|
|
2711
2947
|
}, {
|
|
2712
2948
|
key: "executeValidate",
|
|
@@ -3052,19 +3288,29 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3052
3288
|
}, {
|
|
3053
3289
|
key: "nullable",
|
|
3054
3290
|
value: function nullable() {
|
|
3055
|
-
return new RecordSchema(this.item, true, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions);
|
|
3291
|
+
return new RecordSchema(this.item, true, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description);
|
|
3292
|
+
}
|
|
3293
|
+
}, {
|
|
3294
|
+
key: "readonly",
|
|
3295
|
+
value: function readonly() {
|
|
3296
|
+
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, true, this.isHidden, this.description);
|
|
3297
|
+
}
|
|
3298
|
+
}, {
|
|
3299
|
+
key: "hidden",
|
|
3300
|
+
value: function hidden() {
|
|
3301
|
+
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, true, this.description);
|
|
3056
3302
|
}
|
|
3057
3303
|
}, {
|
|
3058
3304
|
key: "router",
|
|
3059
3305
|
value: function router(_router) {
|
|
3060
|
-
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router, this.keySchema, this.mediaOptions);
|
|
3306
|
+
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description);
|
|
3061
3307
|
}
|
|
3062
3308
|
}, {
|
|
3063
3309
|
key: "remote",
|
|
3064
3310
|
value: function remote() {
|
|
3065
3311
|
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions ? _objectSpread2(_objectSpread2({}, this.mediaOptions), {}, {
|
|
3066
3312
|
remote: true
|
|
3067
|
-
}) : undefined);
|
|
3313
|
+
}) : undefined, this.isReadonly, this.isHidden, this.description);
|
|
3068
3314
|
}
|
|
3069
3315
|
}, {
|
|
3070
3316
|
key: "getRouterValidations",
|
|
@@ -3118,7 +3364,10 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3118
3364
|
key: (_this$keySchema = this.keySchema) === null || _this$keySchema === void 0 ? void 0 : _this$keySchema["executeSerialize"](),
|
|
3119
3365
|
opt: this.opt,
|
|
3120
3366
|
router: (_this$currentRouter = this.currentRouter) === null || _this$currentRouter === void 0 ? void 0 : _this$currentRouter.getRouterId(),
|
|
3121
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
3367
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
3368
|
+
readonly: this.isReadonly,
|
|
3369
|
+
hidden: this.isHidden,
|
|
3370
|
+
description: this.description
|
|
3122
3371
|
};
|
|
3123
3372
|
if (this.mediaOptions) {
|
|
3124
3373
|
result.mediaType = this.mediaOptions.type;
|
|
@@ -3738,18 +3987,29 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3738
3987
|
var _this;
|
|
3739
3988
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3740
3989
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
3990
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
3991
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
3992
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
3741
3993
|
_classCallCheck(this, NumberSchema);
|
|
3742
3994
|
_this = _callSuper(this, NumberSchema);
|
|
3743
3995
|
_this.options = options;
|
|
3744
3996
|
_this.opt = opt;
|
|
3745
3997
|
_this.customValidateFunctions = customValidateFunctions;
|
|
3998
|
+
_this.isReadonly = isReadonly;
|
|
3999
|
+
_this.isHidden = isHidden;
|
|
4000
|
+
_this.description = description;
|
|
3746
4001
|
return _this;
|
|
3747
4002
|
}
|
|
3748
4003
|
_inherits(NumberSchema, _Schema);
|
|
3749
4004
|
return _createClass(NumberSchema, [{
|
|
4005
|
+
key: "describe",
|
|
4006
|
+
value: function describe(description) {
|
|
4007
|
+
return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
4008
|
+
}
|
|
4009
|
+
}, {
|
|
3750
4010
|
key: "validate",
|
|
3751
4011
|
value: function validate(validationFunction) {
|
|
3752
|
-
return new NumberSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
4012
|
+
return new NumberSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
3753
4013
|
}
|
|
3754
4014
|
}, {
|
|
3755
4015
|
key: "executeValidate",
|
|
@@ -3819,21 +4079,31 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3819
4079
|
}, {
|
|
3820
4080
|
key: "nullable",
|
|
3821
4081
|
value: function nullable() {
|
|
3822
|
-
return new NumberSchema(this.options, true);
|
|
4082
|
+
return new NumberSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description);
|
|
4083
|
+
}
|
|
4084
|
+
}, {
|
|
4085
|
+
key: "readonly",
|
|
4086
|
+
value: function readonly() {
|
|
4087
|
+
return new NumberSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
4088
|
+
}
|
|
4089
|
+
}, {
|
|
4090
|
+
key: "hidden",
|
|
4091
|
+
value: function hidden() {
|
|
4092
|
+
return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
3823
4093
|
}
|
|
3824
4094
|
}, {
|
|
3825
4095
|
key: "max",
|
|
3826
4096
|
value: function max(_max) {
|
|
3827
4097
|
return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
3828
4098
|
max: _max
|
|
3829
|
-
}), this.opt);
|
|
4099
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
3830
4100
|
}
|
|
3831
4101
|
}, {
|
|
3832
4102
|
key: "min",
|
|
3833
4103
|
value: function min(_min) {
|
|
3834
4104
|
return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
3835
4105
|
min: _min
|
|
3836
|
-
}), this.opt);
|
|
4106
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
3837
4107
|
}
|
|
3838
4108
|
}, {
|
|
3839
4109
|
key: "executeSerialize",
|
|
@@ -3843,7 +4113,10 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3843
4113
|
type: "number",
|
|
3844
4114
|
options: this.options,
|
|
3845
4115
|
opt: this.opt,
|
|
3846
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
4116
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
4117
|
+
readonly: this.isReadonly,
|
|
4118
|
+
hidden: this.isHidden,
|
|
4119
|
+
description: this.description
|
|
3847
4120
|
};
|
|
3848
4121
|
}
|
|
3849
4122
|
}, {
|
|
@@ -3862,17 +4135,28 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3862
4135
|
var _this;
|
|
3863
4136
|
var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
3864
4137
|
var customValidateFunctions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
4138
|
+
var isReadonly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
4139
|
+
var isHidden = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
4140
|
+
var description = arguments.length > 4 ? arguments[4] : undefined;
|
|
3865
4141
|
_classCallCheck(this, BooleanSchema);
|
|
3866
4142
|
_this = _callSuper(this, BooleanSchema);
|
|
3867
4143
|
_this.opt = opt;
|
|
3868
4144
|
_this.customValidateFunctions = customValidateFunctions;
|
|
4145
|
+
_this.isReadonly = isReadonly;
|
|
4146
|
+
_this.isHidden = isHidden;
|
|
4147
|
+
_this.description = description;
|
|
3869
4148
|
return _this;
|
|
3870
4149
|
}
|
|
3871
4150
|
_inherits(BooleanSchema, _Schema);
|
|
3872
4151
|
return _createClass(BooleanSchema, [{
|
|
4152
|
+
key: "describe",
|
|
4153
|
+
value: function describe(description) {
|
|
4154
|
+
return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
4155
|
+
}
|
|
4156
|
+
}, {
|
|
3873
4157
|
key: "validate",
|
|
3874
4158
|
value: function validate(validationFunction) {
|
|
3875
|
-
return new BooleanSchema(this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
4159
|
+
return new BooleanSchema(this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
3876
4160
|
}
|
|
3877
4161
|
}, {
|
|
3878
4162
|
key: "executeValidate",
|
|
@@ -3923,7 +4207,17 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3923
4207
|
}, {
|
|
3924
4208
|
key: "nullable",
|
|
3925
4209
|
value: function nullable() {
|
|
3926
|
-
return new BooleanSchema(true);
|
|
4210
|
+
return new BooleanSchema(true, [], this.isReadonly, this.isHidden, this.description);
|
|
4211
|
+
}
|
|
4212
|
+
}, {
|
|
4213
|
+
key: "readonly",
|
|
4214
|
+
value: function readonly() {
|
|
4215
|
+
return new BooleanSchema(this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
4216
|
+
}
|
|
4217
|
+
}, {
|
|
4218
|
+
key: "hidden",
|
|
4219
|
+
value: function hidden() {
|
|
4220
|
+
return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
3927
4221
|
}
|
|
3928
4222
|
}, {
|
|
3929
4223
|
key: "executeSerialize",
|
|
@@ -3932,7 +4226,10 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3932
4226
|
return {
|
|
3933
4227
|
type: "boolean",
|
|
3934
4228
|
opt: this.opt,
|
|
3935
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
4229
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
4230
|
+
readonly: this.isReadonly,
|
|
4231
|
+
hidden: this.isHidden,
|
|
4232
|
+
description: this.description
|
|
3936
4233
|
};
|
|
3937
4234
|
}
|
|
3938
4235
|
}, {
|
|
@@ -3951,19 +4248,30 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3951
4248
|
var _this;
|
|
3952
4249
|
var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
3953
4250
|
var customValidateFunctions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
4251
|
+
var isReadonly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
4252
|
+
var isHidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
4253
|
+
var description = arguments.length > 6 ? arguments[6] : undefined;
|
|
3954
4254
|
_classCallCheck(this, KeyOfSchema);
|
|
3955
4255
|
_this = _callSuper(this, KeyOfSchema);
|
|
3956
4256
|
_this.schema = schema;
|
|
3957
4257
|
_this.sourcePath = sourcePath;
|
|
3958
4258
|
_this.opt = opt;
|
|
3959
4259
|
_this.customValidateFunctions = customValidateFunctions;
|
|
4260
|
+
_this.isReadonly = isReadonly;
|
|
4261
|
+
_this.isHidden = isHidden;
|
|
4262
|
+
_this.description = description;
|
|
3960
4263
|
return _this;
|
|
3961
4264
|
}
|
|
3962
4265
|
_inherits(KeyOfSchema, _Schema);
|
|
3963
4266
|
return _createClass(KeyOfSchema, [{
|
|
4267
|
+
key: "describe",
|
|
4268
|
+
value: function describe(description) {
|
|
4269
|
+
return new KeyOfSchema(this.schema, this.sourcePath, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
4270
|
+
}
|
|
4271
|
+
}, {
|
|
3964
4272
|
key: "validate",
|
|
3965
4273
|
value: function validate(validationFunction) {
|
|
3966
|
-
return new KeyOfSchema(this.schema, this.sourcePath, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
4274
|
+
return new KeyOfSchema(this.schema, this.sourcePath, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
3967
4275
|
}
|
|
3968
4276
|
}, {
|
|
3969
4277
|
key: "executeValidate",
|
|
@@ -4093,7 +4401,17 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4093
4401
|
}, {
|
|
4094
4402
|
key: "nullable",
|
|
4095
4403
|
value: function nullable() {
|
|
4096
|
-
return new KeyOfSchema(this.schema, this.sourcePath, true);
|
|
4404
|
+
return new KeyOfSchema(this.schema, this.sourcePath, true, [], this.isReadonly, this.isHidden, this.description);
|
|
4405
|
+
}
|
|
4406
|
+
}, {
|
|
4407
|
+
key: "readonly",
|
|
4408
|
+
value: function readonly() {
|
|
4409
|
+
return new KeyOfSchema(this.schema, this.sourcePath, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
4410
|
+
}
|
|
4411
|
+
}, {
|
|
4412
|
+
key: "hidden",
|
|
4413
|
+
value: function hidden() {
|
|
4414
|
+
return new KeyOfSchema(this.schema, this.sourcePath, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
4097
4415
|
}
|
|
4098
4416
|
}, {
|
|
4099
4417
|
key: "executeSerialize",
|
|
@@ -4125,7 +4443,10 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4125
4443
|
schema: serializedSchema,
|
|
4126
4444
|
opt: this.opt,
|
|
4127
4445
|
values: values,
|
|
4128
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
4446
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
4447
|
+
readonly: this.isReadonly,
|
|
4448
|
+
hidden: this.isHidden,
|
|
4449
|
+
description: this.description
|
|
4129
4450
|
};
|
|
4130
4451
|
}
|
|
4131
4452
|
}, {
|
|
@@ -4202,68 +4523,78 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4202
4523
|
var _this;
|
|
4203
4524
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4204
4525
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
4526
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
4527
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
4528
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
4205
4529
|
_classCallCheck(this, DateSchema);
|
|
4206
4530
|
_this = _callSuper(this, DateSchema);
|
|
4207
4531
|
_this.options = options;
|
|
4208
4532
|
_this.opt = opt;
|
|
4209
4533
|
_this.customValidateFunctions = customValidateFunctions;
|
|
4534
|
+
_this.isReadonly = isReadonly;
|
|
4535
|
+
_this.isHidden = isHidden;
|
|
4536
|
+
_this.description = description;
|
|
4210
4537
|
return _this;
|
|
4211
4538
|
}
|
|
4212
4539
|
_inherits(DateSchema, _Schema);
|
|
4213
4540
|
return _createClass(DateSchema, [{
|
|
4541
|
+
key: "describe",
|
|
4542
|
+
value: function describe(description) {
|
|
4543
|
+
return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
4544
|
+
}
|
|
4545
|
+
}, {
|
|
4214
4546
|
key: "validate",
|
|
4215
4547
|
value: function validate(validationFunction) {
|
|
4216
|
-
return new DateSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
4548
|
+
return new DateSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
4217
4549
|
}
|
|
4218
4550
|
}, {
|
|
4219
4551
|
key: "executeValidate",
|
|
4220
4552
|
value: function executeValidate(path, src) {
|
|
4221
4553
|
var _this$options, _this$options2, _this$options3, _this$options4;
|
|
4554
|
+
var errors = this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
|
|
4555
|
+
path: path
|
|
4556
|
+
});
|
|
4222
4557
|
if (this.opt && (src === null || src === undefined)) {
|
|
4223
|
-
return false;
|
|
4558
|
+
return errors.length > 0 ? _defineProperty({}, path, errors) : false;
|
|
4224
4559
|
}
|
|
4225
4560
|
if (typeof src !== "string") {
|
|
4226
|
-
|
|
4561
|
+
errors.push({
|
|
4227
4562
|
message: "Expected 'string', got '".concat(_typeof(src), "'"),
|
|
4228
4563
|
value: src
|
|
4229
|
-
}
|
|
4564
|
+
});
|
|
4565
|
+
return _defineProperty({}, path, errors);
|
|
4230
4566
|
}
|
|
4231
4567
|
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) {
|
|
4232
4568
|
if (this.options.from > this.options.to) {
|
|
4233
|
-
|
|
4569
|
+
errors.push({
|
|
4234
4570
|
message: "From date ".concat(this.options.from, " is after to date ").concat(this.options.to),
|
|
4235
4571
|
value: src,
|
|
4236
4572
|
typeError: true
|
|
4237
|
-
}
|
|
4238
|
-
}
|
|
4239
|
-
|
|
4240
|
-
return _defineProperty({}, path, [{
|
|
4573
|
+
});
|
|
4574
|
+
} else if (src < this.options.from || src > this.options.to) {
|
|
4575
|
+
errors.push({
|
|
4241
4576
|
message: "Date is not between ".concat(this.options.from, " and ").concat(this.options.to),
|
|
4242
4577
|
value: src
|
|
4243
|
-
}
|
|
4578
|
+
});
|
|
4244
4579
|
}
|
|
4245
4580
|
} else if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.from) {
|
|
4246
4581
|
if (src < this.options.from) {
|
|
4247
|
-
|
|
4582
|
+
errors.push({
|
|
4248
4583
|
message: "Date is before the minimum date ".concat(this.options.from),
|
|
4249
4584
|
value: src
|
|
4250
|
-
}
|
|
4585
|
+
});
|
|
4251
4586
|
}
|
|
4252
4587
|
} else if ((_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.to) {
|
|
4253
4588
|
if (src > this.options.to) {
|
|
4254
|
-
|
|
4589
|
+
errors.push({
|
|
4255
4590
|
message: "Date is after the maximum date ".concat(this.options.to),
|
|
4256
4591
|
value: src
|
|
4257
|
-
}
|
|
4592
|
+
});
|
|
4258
4593
|
}
|
|
4259
4594
|
}
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
// return {
|
|
4264
|
-
// [path]: errors,
|
|
4265
|
-
// } as ValidationErrors;
|
|
4266
|
-
// }
|
|
4595
|
+
if (errors.length > 0) {
|
|
4596
|
+
return _defineProperty({}, path, errors);
|
|
4597
|
+
}
|
|
4267
4598
|
return false;
|
|
4268
4599
|
}
|
|
4269
4600
|
}, {
|
|
@@ -4303,19 +4634,29 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4303
4634
|
value: function from(_from) {
|
|
4304
4635
|
return new DateSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
4305
4636
|
from: _from
|
|
4306
|
-
}), this.opt);
|
|
4637
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
4307
4638
|
}
|
|
4308
4639
|
}, {
|
|
4309
4640
|
key: "to",
|
|
4310
4641
|
value: function to(_to) {
|
|
4311
4642
|
return new DateSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
4312
4643
|
to: _to
|
|
4313
|
-
}), this.opt);
|
|
4644
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
4314
4645
|
}
|
|
4315
4646
|
}, {
|
|
4316
4647
|
key: "nullable",
|
|
4317
4648
|
value: function nullable() {
|
|
4318
|
-
return new DateSchema(this.options, true);
|
|
4649
|
+
return new DateSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description);
|
|
4650
|
+
}
|
|
4651
|
+
}, {
|
|
4652
|
+
key: "readonly",
|
|
4653
|
+
value: function readonly() {
|
|
4654
|
+
return new DateSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
4655
|
+
}
|
|
4656
|
+
}, {
|
|
4657
|
+
key: "hidden",
|
|
4658
|
+
value: function hidden() {
|
|
4659
|
+
return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
4319
4660
|
}
|
|
4320
4661
|
}, {
|
|
4321
4662
|
key: "executeSerialize",
|
|
@@ -4325,7 +4666,10 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4325
4666
|
type: "date",
|
|
4326
4667
|
opt: this.opt,
|
|
4327
4668
|
options: this.options,
|
|
4328
|
-
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
4669
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
4670
|
+
readonly: this.isReadonly,
|
|
4671
|
+
hidden: this.isHidden,
|
|
4672
|
+
description: this.description
|
|
4329
4673
|
};
|
|
4330
4674
|
}
|
|
4331
4675
|
}, {
|
|
@@ -4339,113 +4683,311 @@ var date = function date(options) {
|
|
|
4339
4683
|
return new DateSchema(options);
|
|
4340
4684
|
};
|
|
4341
4685
|
|
|
4342
|
-
function
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
}
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4686
|
+
var DateTimeSchema = /*#__PURE__*/function (_Schema) {
|
|
4687
|
+
function DateTimeSchema(options) {
|
|
4688
|
+
var _this;
|
|
4689
|
+
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4690
|
+
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
4691
|
+
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
4692
|
+
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
4693
|
+
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
4694
|
+
_classCallCheck(this, DateTimeSchema);
|
|
4695
|
+
_this = _callSuper(this, DateTimeSchema);
|
|
4696
|
+
_this.options = options;
|
|
4697
|
+
_this.opt = opt;
|
|
4698
|
+
_this.customValidateFunctions = customValidateFunctions;
|
|
4699
|
+
_this.isReadonly = isReadonly;
|
|
4700
|
+
_this.isHidden = isHidden;
|
|
4701
|
+
_this.description = description;
|
|
4702
|
+
return _this;
|
|
4703
|
+
}
|
|
4704
|
+
_inherits(DateTimeSchema, _Schema);
|
|
4705
|
+
return _createClass(DateTimeSchema, [{
|
|
4706
|
+
key: "describe",
|
|
4707
|
+
value: function describe(description) {
|
|
4708
|
+
return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
4709
|
+
}
|
|
4710
|
+
}, {
|
|
4711
|
+
key: "validate",
|
|
4712
|
+
value: function validate(validationFunction) {
|
|
4713
|
+
return new DateTimeSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
|
|
4714
|
+
}
|
|
4715
|
+
}, {
|
|
4716
|
+
key: "executeValidate",
|
|
4717
|
+
value: function executeValidate(path, src) {
|
|
4718
|
+
var _this$options, _this$options2;
|
|
4719
|
+
var errors = this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
|
|
4720
|
+
path: path
|
|
4721
|
+
});
|
|
4722
|
+
if (this.opt && (src === null || src === undefined)) {
|
|
4723
|
+
return errors.length > 0 ? _defineProperty({}, path, errors) : false;
|
|
4724
|
+
}
|
|
4725
|
+
if (typeof src !== "string") {
|
|
4726
|
+
errors.push({
|
|
4727
|
+
message: "Expected 'string', got '".concat(_typeof(src), "'"),
|
|
4728
|
+
value: src
|
|
4729
|
+
});
|
|
4730
|
+
return _defineProperty({}, path, errors);
|
|
4731
|
+
}
|
|
4732
|
+
var srcMs = Date.parse(src);
|
|
4733
|
+
if (Number.isNaN(srcMs)) {
|
|
4734
|
+
errors.push({
|
|
4735
|
+
message: "Value '".concat(src, "' is not a valid ISO 8601 datetime"),
|
|
4736
|
+
value: src
|
|
4737
|
+
});
|
|
4738
|
+
return _defineProperty({}, path, errors);
|
|
4739
|
+
}
|
|
4740
|
+
var fromMs = ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.from) !== undefined ? Date.parse(this.options.from) : undefined;
|
|
4741
|
+
var toMs = ((_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.to) !== undefined ? Date.parse(this.options.to) : undefined;
|
|
4742
|
+
if (fromMs !== undefined && Number.isNaN(fromMs)) {
|
|
4743
|
+
var _this$options3;
|
|
4744
|
+
errors.push({
|
|
4745
|
+
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"),
|
|
4746
|
+
value: src,
|
|
4747
|
+
typeError: true
|
|
4748
|
+
});
|
|
4749
|
+
return _defineProperty({}, path, errors);
|
|
4750
|
+
}
|
|
4751
|
+
if (toMs !== undefined && Number.isNaN(toMs)) {
|
|
4752
|
+
var _this$options4;
|
|
4753
|
+
errors.push({
|
|
4754
|
+
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"),
|
|
4755
|
+
value: src,
|
|
4756
|
+
typeError: true
|
|
4757
|
+
});
|
|
4758
|
+
return _defineProperty({}, path, errors);
|
|
4759
|
+
}
|
|
4760
|
+
if (fromMs !== undefined && toMs !== undefined) {
|
|
4761
|
+
if (fromMs > toMs) {
|
|
4762
|
+
var _this$options5, _this$options6;
|
|
4763
|
+
errors.push({
|
|
4764
|
+
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),
|
|
4765
|
+
value: src,
|
|
4766
|
+
typeError: true
|
|
4767
|
+
});
|
|
4768
|
+
} else if (srcMs < fromMs || srcMs > toMs) {
|
|
4769
|
+
var _this$options7, _this$options8;
|
|
4770
|
+
errors.push({
|
|
4771
|
+
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),
|
|
4772
|
+
value: src
|
|
4773
|
+
});
|
|
4774
|
+
}
|
|
4775
|
+
} else if (fromMs !== undefined) {
|
|
4776
|
+
if (srcMs < fromMs) {
|
|
4777
|
+
var _this$options9;
|
|
4778
|
+
errors.push({
|
|
4779
|
+
message: "Datetime is before the minimum datetime ".concat((_this$options9 = this.options) === null || _this$options9 === void 0 ? void 0 : _this$options9.from),
|
|
4780
|
+
value: src
|
|
4781
|
+
});
|
|
4782
|
+
}
|
|
4783
|
+
} else if (toMs !== undefined) {
|
|
4784
|
+
if (srcMs > toMs) {
|
|
4785
|
+
var _this$options0;
|
|
4786
|
+
errors.push({
|
|
4787
|
+
message: "Datetime is after the maximum datetime ".concat((_this$options0 = this.options) === null || _this$options0 === void 0 ? void 0 : _this$options0.to),
|
|
4788
|
+
value: src
|
|
4789
|
+
});
|
|
4790
|
+
}
|
|
4791
|
+
}
|
|
4792
|
+
if (errors.length > 0) {
|
|
4793
|
+
return _defineProperty({}, path, errors);
|
|
4794
|
+
}
|
|
4795
|
+
return false;
|
|
4796
|
+
}
|
|
4797
|
+
}, {
|
|
4798
|
+
key: "executeAssert",
|
|
4799
|
+
value: function executeAssert(path, src) {
|
|
4800
|
+
if (this.opt && src === null) {
|
|
4801
|
+
return {
|
|
4802
|
+
success: true,
|
|
4803
|
+
data: src
|
|
4804
|
+
};
|
|
4805
|
+
}
|
|
4806
|
+
if (src === null) {
|
|
4807
|
+
return {
|
|
4808
|
+
success: false,
|
|
4809
|
+
errors: _defineProperty({}, path, [{
|
|
4810
|
+
message: "Expected 'string', got 'null'",
|
|
4811
|
+
typeError: true
|
|
4812
|
+
}])
|
|
4813
|
+
};
|
|
4814
|
+
}
|
|
4815
|
+
if (typeof src !== "string") {
|
|
4816
|
+
return {
|
|
4817
|
+
success: false,
|
|
4818
|
+
errors: _defineProperty({}, path, [{
|
|
4819
|
+
message: "Expected 'string', got '".concat(_typeof(src), "'"),
|
|
4820
|
+
typeError: true
|
|
4821
|
+
}])
|
|
4822
|
+
};
|
|
4823
|
+
}
|
|
4824
|
+
return {
|
|
4825
|
+
success: true,
|
|
4826
|
+
data: src
|
|
4827
|
+
};
|
|
4828
|
+
}
|
|
4829
|
+
}, {
|
|
4830
|
+
key: "from",
|
|
4831
|
+
value: function from(_from) {
|
|
4832
|
+
return new DateTimeSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
4833
|
+
from: _from
|
|
4834
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
4835
|
+
}
|
|
4836
|
+
}, {
|
|
4837
|
+
key: "to",
|
|
4838
|
+
value: function to(_to) {
|
|
4839
|
+
return new DateTimeSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
4840
|
+
to: _to
|
|
4841
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
|
|
4842
|
+
}
|
|
4843
|
+
}, {
|
|
4844
|
+
key: "nullable",
|
|
4845
|
+
value: function nullable() {
|
|
4846
|
+
return new DateTimeSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description);
|
|
4847
|
+
}
|
|
4848
|
+
}, {
|
|
4849
|
+
key: "readonly",
|
|
4850
|
+
value: function readonly() {
|
|
4851
|
+
return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
|
|
4852
|
+
}
|
|
4853
|
+
}, {
|
|
4854
|
+
key: "hidden",
|
|
4855
|
+
value: function hidden() {
|
|
4856
|
+
return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
|
|
4857
|
+
}
|
|
4858
|
+
}, {
|
|
4859
|
+
key: "executeSerialize",
|
|
4860
|
+
value: function executeSerialize() {
|
|
4861
|
+
var _this$customValidateF;
|
|
4862
|
+
return {
|
|
4863
|
+
type: "dateTime",
|
|
4864
|
+
opt: this.opt,
|
|
4865
|
+
options: this.options,
|
|
4866
|
+
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
4867
|
+
readonly: this.isReadonly,
|
|
4868
|
+
hidden: this.isHidden,
|
|
4869
|
+
description: this.description
|
|
4870
|
+
};
|
|
4871
|
+
}
|
|
4872
|
+
}, {
|
|
4873
|
+
key: "executeRender",
|
|
4874
|
+
value: function executeRender() {
|
|
4875
|
+
return {};
|
|
4876
|
+
}
|
|
4877
|
+
}]);
|
|
4878
|
+
}(Schema);
|
|
4879
|
+
var datetime = function datetime(options) {
|
|
4880
|
+
return new DateTimeSchema(options);
|
|
4881
|
+
};
|
|
4882
|
+
|
|
4883
|
+
function router(router, item) {
|
|
4884
|
+
var keySchema = string();
|
|
4885
|
+
var recordSchema = new RecordSchema(item, false, [], router, keySchema);
|
|
4886
|
+
return recordSchema;
|
|
4887
|
+
}
|
|
4888
|
+
|
|
4889
|
+
/**
|
|
4890
|
+
* Alt schema type - can be a string, nullable string, or a record of locale to string
|
|
4891
|
+
*/
|
|
4892
|
+
|
|
4893
|
+
/**
|
|
4894
|
+
* Options for s.images()
|
|
4895
|
+
*/
|
|
4896
|
+
|
|
4897
|
+
/**
|
|
4898
|
+
* Metadata for an image entry in the images record
|
|
4899
|
+
*/
|
|
4900
|
+
|
|
4901
|
+
// Item schema types for images (alt simplified to string | null for typing)
|
|
4902
|
+
|
|
4903
|
+
/**
|
|
4904
|
+
* Define a collection of images.
|
|
4905
|
+
*
|
|
4906
|
+
* @example
|
|
4907
|
+
* ```typescript
|
|
4908
|
+
* const schema = s.images({
|
|
4909
|
+
* accept: "image/webp",
|
|
4910
|
+
* directory: "/public/val/images",
|
|
4911
|
+
* alt: s.string().minLength(4),
|
|
4912
|
+
* });
|
|
4913
|
+
* export default c.define("/content/images.val.ts", schema, {
|
|
4914
|
+
* "/public/val/images/hero.webp": {
|
|
4915
|
+
* width: 1920,
|
|
4916
|
+
* height: 1080,
|
|
4917
|
+
* mimeType: "image/webp",
|
|
4918
|
+
* alt: "Hero image",
|
|
4919
|
+
* },
|
|
4920
|
+
* });
|
|
4921
|
+
* ```
|
|
4922
|
+
*/
|
|
4923
|
+
var images = function images(options) {
|
|
4924
|
+
var _options$directory, _options$alt, _options$remote;
|
|
4925
|
+
var directory = (_options$directory = options.directory) !== null && _options$directory !== void 0 ? _options$directory : "/public/val";
|
|
4926
|
+
var altSchema = (_options$alt = options.alt) !== null && _options$alt !== void 0 ? _options$alt : string().nullable();
|
|
4927
|
+
var itemSchema = new ObjectSchema({
|
|
4928
|
+
width: new NumberSchema(undefined, false),
|
|
4929
|
+
height: new NumberSchema(undefined, false),
|
|
4930
|
+
mimeType: new StringSchema({}, false),
|
|
4931
|
+
alt: altSchema
|
|
4932
|
+
}, false);
|
|
4933
|
+
return new RecordSchema(itemSchema, false, [], null, null, {
|
|
4934
|
+
type: "images",
|
|
4935
|
+
accept: options.accept,
|
|
4936
|
+
directory: directory,
|
|
4937
|
+
remote: (_options$remote = options.remote) !== null && _options$remote !== void 0 ? _options$remote : false,
|
|
4938
|
+
altSchema: altSchema
|
|
4939
|
+
});
|
|
4940
|
+
};
|
|
4941
|
+
|
|
4942
|
+
// import type { F } from "ts-toolbelt";
|
|
4943
|
+
// import { i18n, I18n } from "./schema/future/i18n";
|
|
4944
|
+
// import { oneOf } from "./schema/future/oneOf";
|
|
4945
|
+
|
|
4946
|
+
// export type InitSchemaLocalized<Locales extends readonly string[]> = {
|
|
4947
|
+
// readonly i18n: I18n<Locales>;
|
|
4948
|
+
// };
|
|
4949
|
+
function initSchema() {
|
|
4950
|
+
// locales: F.Narrow<Locales>
|
|
4951
|
+
return {
|
|
4952
|
+
string: string,
|
|
4953
|
+
"boolean": _boolean,
|
|
4954
|
+
array: array,
|
|
4955
|
+
object: object,
|
|
4956
|
+
number: number,
|
|
4957
|
+
union: union,
|
|
4958
|
+
// oneOf,
|
|
4959
|
+
richtext: richtext,
|
|
4960
|
+
image: image,
|
|
4961
|
+
literal: literal,
|
|
4962
|
+
keyOf: keyOf,
|
|
4963
|
+
record: record,
|
|
4964
|
+
file: file,
|
|
4965
|
+
files: files,
|
|
4966
|
+
date: date,
|
|
4967
|
+
datetime: datetime,
|
|
4968
|
+
route: route,
|
|
4969
|
+
router: router,
|
|
4970
|
+
images: images
|
|
4971
|
+
// i18n: i18n(locales),
|
|
4972
|
+
};
|
|
4973
|
+
}
|
|
4974
|
+
|
|
4975
|
+
/**
|
|
4976
|
+
* A image source represents the path to a (local) image.
|
|
4977
|
+
*
|
|
4978
|
+
*/
|
|
4979
|
+
|
|
4980
|
+
var initImage = function initImage(config) {
|
|
4981
|
+
var _config$files$directo, _config$files;
|
|
4982
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4983
|
+
(_config$files$directo = config === null || config === void 0 || (_config$files = config.files) === null || _config$files === void 0 ? void 0 : _config$files.directory) !== null && _config$files$directo !== void 0 ? _config$files$directo : "/public/val";
|
|
4984
|
+
|
|
4985
|
+
/**
|
|
4986
|
+
* Define the source of an image file.
|
|
4987
|
+
*
|
|
4988
|
+
* @example
|
|
4989
|
+
* c.image("/public/val/example.png", {
|
|
4990
|
+
* width: 944,
|
|
4449
4991
|
* height: 944,
|
|
4450
4992
|
* mimeType: "image/png",
|
|
4451
4993
|
*})
|
|
@@ -4562,161 +5104,170 @@ var initVal = function initVal(config) {
|
|
|
4562
5104
|
* import { modules } from "@valbuild/next";
|
|
4563
5105
|
* import { config } from "./val.config";
|
|
4564
5106
|
*
|
|
4565
|
-
* export default modules(config, [
|
|
4566
|
-
* { def: () => import("./app/page.val.ts") },
|
|
4567
|
-
* { def: () => import("./app/another/page.val.ts") },
|
|
4568
|
-
* ]);
|
|
4569
|
-
*/
|
|
4570
|
-
function modules(config, modules) {
|
|
4571
|
-
return {
|
|
4572
|
-
config: config,
|
|
4573
|
-
modules: modules
|
|
4574
|
-
};
|
|
4575
|
-
}
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
if (
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
var
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
})
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
return ok([dereffedPath, referencedPath]);
|
|
4643
|
-
}
|
|
4644
|
-
function derefPatch(patch, document, ops) {
|
|
4645
|
-
var fileUpdates = {};
|
|
4646
|
-
var dereferencedPatch = [];
|
|
4647
|
-
var _iterator3 = _createForOfIteratorHelper(patch),
|
|
4648
|
-
_step3;
|
|
4649
|
-
try {
|
|
4650
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
4651
|
-
var op = _step3.value;
|
|
4652
|
-
if (op.op === "replace") {
|
|
4653
|
-
var maybeDerefRes = derefPath(op.path);
|
|
4654
|
-
if (isErr(maybeDerefRes)) {
|
|
4655
|
-
return maybeDerefRes;
|
|
4656
|
-
}
|
|
4657
|
-
var _maybeDerefRes$value = _slicedToArray(maybeDerefRes.value, 2),
|
|
4658
|
-
dereffedPath = _maybeDerefRes$value[0],
|
|
4659
|
-
referencedPath = _maybeDerefRes$value[1];
|
|
4660
|
-
if (referencedPath) {
|
|
4661
|
-
var maybeValue = ops.get(document, dereffedPath);
|
|
4662
|
-
if (isOk(maybeValue)) {
|
|
4663
|
-
var value = maybeValue.value;
|
|
4664
|
-
if (isFile(value)) {
|
|
4665
|
-
if (referencedPath.length > 0) {
|
|
4666
|
-
return err(new PatchError("Cannot sub-reference file reference at path: ".concat(dereffedPath.join("/"))));
|
|
4667
|
-
}
|
|
4668
|
-
if (typeof op.value !== "string") {
|
|
4669
|
-
return err(new PatchError("Expected base64 encoded string value for file reference, got ".concat(JSON.stringify(op.value))));
|
|
4670
|
-
}
|
|
4671
|
-
fileUpdates[value[FILE_REF_PROP]] = op.value;
|
|
4672
|
-
// } else if (isRemote(value)) {
|
|
4673
|
-
// if (!remotePatches[value[REMOTE_REF_PROP]]) {
|
|
4674
|
-
// remotePatches[value[REMOTE_REF_PROP]] = [];
|
|
4675
|
-
// }
|
|
4676
|
-
// remotePatches[value[REMOTE_REF_PROP]].push({
|
|
4677
|
-
// op: "replace",
|
|
4678
|
-
// path: referencedPath,
|
|
4679
|
-
// value: op.value,
|
|
4680
|
-
// });
|
|
4681
|
-
} else {
|
|
4682
|
-
return err(new PatchError("Unknown reference: ".concat(JSON.stringify(op), " at path: ").concat(dereffedPath.join("/"))));
|
|
4683
|
-
}
|
|
4684
|
-
} else {
|
|
4685
|
-
return maybeValue;
|
|
5107
|
+
* export default modules(config, [
|
|
5108
|
+
* { def: () => import("./app/page.val.ts") },
|
|
5109
|
+
* { def: () => import("./app/another/page.val.ts") },
|
|
5110
|
+
* ]);
|
|
5111
|
+
*/
|
|
5112
|
+
function modules(config, modules) {
|
|
5113
|
+
return {
|
|
5114
|
+
config: config,
|
|
5115
|
+
modules: modules
|
|
5116
|
+
};
|
|
5117
|
+
}
|
|
5118
|
+
|
|
5119
|
+
function _regeneratorValues(e) {
|
|
5120
|
+
if (null != e) {
|
|
5121
|
+
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
5122
|
+
r = 0;
|
|
5123
|
+
if (t) return t.call(e);
|
|
5124
|
+
if ("function" == typeof e.next) return e;
|
|
5125
|
+
if (!isNaN(e.length)) return {
|
|
5126
|
+
next: function () {
|
|
5127
|
+
return e && r >= e.length && (e = void 0), {
|
|
5128
|
+
value: e && e[r++],
|
|
5129
|
+
done: !e
|
|
5130
|
+
};
|
|
5131
|
+
}
|
|
5132
|
+
};
|
|
5133
|
+
}
|
|
5134
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
5135
|
+
}
|
|
5136
|
+
|
|
5137
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
5138
|
+
var i = Object.defineProperty;
|
|
5139
|
+
try {
|
|
5140
|
+
i({}, "", {});
|
|
5141
|
+
} catch (e) {
|
|
5142
|
+
i = 0;
|
|
5143
|
+
}
|
|
5144
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
5145
|
+
function o(r, n) {
|
|
5146
|
+
_regeneratorDefine(e, r, function (e) {
|
|
5147
|
+
return this._invoke(r, n, e);
|
|
5148
|
+
});
|
|
5149
|
+
}
|
|
5150
|
+
r ? i ? i(e, r, {
|
|
5151
|
+
value: n,
|
|
5152
|
+
enumerable: !t,
|
|
5153
|
+
configurable: !t,
|
|
5154
|
+
writable: !t
|
|
5155
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
5156
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
5157
|
+
}
|
|
5158
|
+
|
|
5159
|
+
function _regenerator() {
|
|
5160
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
5161
|
+
var e,
|
|
5162
|
+
t,
|
|
5163
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
5164
|
+
n = r.iterator || "@@iterator",
|
|
5165
|
+
o = r.toStringTag || "@@toStringTag";
|
|
5166
|
+
function i(r, n, o, i) {
|
|
5167
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
5168
|
+
u = Object.create(c.prototype);
|
|
5169
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
5170
|
+
var i,
|
|
5171
|
+
c,
|
|
5172
|
+
u,
|
|
5173
|
+
f = 0,
|
|
5174
|
+
p = o || [],
|
|
5175
|
+
y = !1,
|
|
5176
|
+
G = {
|
|
5177
|
+
p: 0,
|
|
5178
|
+
n: 0,
|
|
5179
|
+
v: e,
|
|
5180
|
+
a: d,
|
|
5181
|
+
f: d.bind(e, 4),
|
|
5182
|
+
d: function (t, r) {
|
|
5183
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
4686
5184
|
}
|
|
4687
|
-
}
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
return err(new PatchError("File operation must have a value that is typeof string. Found: ".concat(_typeof(op.value))));
|
|
4696
|
-
}
|
|
4697
|
-
fileUpdates[op.filePath] = op.value;
|
|
4698
|
-
} else {
|
|
4699
|
-
var _maybeDerefRes = derefPath(op.path);
|
|
4700
|
-
if (isErr(_maybeDerefRes)) {
|
|
4701
|
-
return _maybeDerefRes;
|
|
4702
|
-
}
|
|
4703
|
-
var _maybeDerefRes$value2 = _slicedToArray(_maybeDerefRes.value, 2),
|
|
4704
|
-
_referencedPath = _maybeDerefRes$value2[1];
|
|
4705
|
-
if (_referencedPath) {
|
|
4706
|
-
throw new Error("Unimplemented operation: ".concat(JSON.stringify(op)));
|
|
5185
|
+
};
|
|
5186
|
+
function d(r, n) {
|
|
5187
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
5188
|
+
var o,
|
|
5189
|
+
i = p[t],
|
|
5190
|
+
d = G.p,
|
|
5191
|
+
l = i[2];
|
|
5192
|
+
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
4707
5193
|
}
|
|
4708
|
-
|
|
5194
|
+
if (o || r > 1) return a;
|
|
5195
|
+
throw y = !0, n;
|
|
4709
5196
|
}
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
5197
|
+
return function (o, p, l) {
|
|
5198
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
5199
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
5200
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
5201
|
+
try {
|
|
5202
|
+
if (f = 2, i) {
|
|
5203
|
+
if (c || (o = "next"), t = i[o]) {
|
|
5204
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
5205
|
+
if (!t.done) return t;
|
|
5206
|
+
u = t.value, c < 2 && (c = 0);
|
|
5207
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
5208
|
+
i = e;
|
|
5209
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
5210
|
+
} catch (t) {
|
|
5211
|
+
i = e, c = 1, u = t;
|
|
5212
|
+
} finally {
|
|
5213
|
+
f = 1;
|
|
5214
|
+
}
|
|
5215
|
+
}
|
|
5216
|
+
return {
|
|
5217
|
+
value: t,
|
|
5218
|
+
done: y
|
|
5219
|
+
};
|
|
5220
|
+
};
|
|
5221
|
+
}(r, o, i), !0), u;
|
|
4715
5222
|
}
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
}
|
|
5223
|
+
var a = {};
|
|
5224
|
+
function Generator() {}
|
|
5225
|
+
function GeneratorFunction() {}
|
|
5226
|
+
function GeneratorFunctionPrototype() {}
|
|
5227
|
+
t = Object.getPrototypeOf;
|
|
5228
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
5229
|
+
return this;
|
|
5230
|
+
}), t),
|
|
5231
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
5232
|
+
function f(e) {
|
|
5233
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
5234
|
+
}
|
|
5235
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
5236
|
+
return this;
|
|
5237
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
5238
|
+
return "[object Generator]";
|
|
5239
|
+
}), (_regenerator = function () {
|
|
5240
|
+
return {
|
|
5241
|
+
w: i,
|
|
5242
|
+
m: f
|
|
5243
|
+
};
|
|
5244
|
+
})();
|
|
5245
|
+
}
|
|
5246
|
+
|
|
5247
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
5248
|
+
try {
|
|
5249
|
+
var i = n[a](c),
|
|
5250
|
+
u = i.value;
|
|
5251
|
+
} catch (n) {
|
|
5252
|
+
return void e(n);
|
|
5253
|
+
}
|
|
5254
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
5255
|
+
}
|
|
5256
|
+
function _asyncToGenerator(n) {
|
|
5257
|
+
return function () {
|
|
5258
|
+
var t = this,
|
|
5259
|
+
e = arguments;
|
|
5260
|
+
return new Promise(function (r, o) {
|
|
5261
|
+
var a = n.apply(t, e);
|
|
5262
|
+
function _next(n) {
|
|
5263
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
5264
|
+
}
|
|
5265
|
+
function _throw(n) {
|
|
5266
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
5267
|
+
}
|
|
5268
|
+
_next(void 0);
|
|
5269
|
+
});
|
|
5270
|
+
};
|
|
4720
5271
|
}
|
|
4721
5272
|
|
|
4722
5273
|
/**
|
|
@@ -5052,6 +5603,352 @@ var getSHA256Hash = function getSHA256Hash(bits) {
|
|
|
5052
5603
|
return createHash().update(bits).digest("hex");
|
|
5053
5604
|
};
|
|
5054
5605
|
|
|
5606
|
+
// Lazily constructed: this module is also evaluated inside the QuickJS
|
|
5607
|
+
// sandbox (when user val modules import @valbuild/core), and that sandbox
|
|
5608
|
+
// has no `TextEncoder` global. `hash()` is never called from inside the
|
|
5609
|
+
// sandbox, so deferring construction avoids a ReferenceError at import time.
|
|
5610
|
+
var textEncoder;
|
|
5611
|
+
function getTextEncoder() {
|
|
5612
|
+
if (!textEncoder) {
|
|
5613
|
+
textEncoder = new TextEncoder();
|
|
5614
|
+
}
|
|
5615
|
+
return textEncoder;
|
|
5616
|
+
}
|
|
5617
|
+
function hash(input) {
|
|
5618
|
+
if (_typeof(input) === "object") {
|
|
5619
|
+
return hashObject(input);
|
|
5620
|
+
}
|
|
5621
|
+
return getSHA256Hash(getTextEncoder().encode(input));
|
|
5622
|
+
}
|
|
5623
|
+
function hashObject(obj) {
|
|
5624
|
+
var collector = [];
|
|
5625
|
+
collectObjectRecursive(obj, collector);
|
|
5626
|
+
return getSHA256Hash(getTextEncoder().encode(collector.join("")));
|
|
5627
|
+
}
|
|
5628
|
+
function collectObjectRecursive(item, collector) {
|
|
5629
|
+
if (typeof item === "string") {
|
|
5630
|
+
collector.push("\"", item, "\"");
|
|
5631
|
+
return;
|
|
5632
|
+
} else if (typeof item === "number") {
|
|
5633
|
+
collector.push(item.toString());
|
|
5634
|
+
return;
|
|
5635
|
+
} else if (_typeof(item) === "object") {
|
|
5636
|
+
if (Array.isArray(item)) {
|
|
5637
|
+
collector.push("[");
|
|
5638
|
+
for (var i = 0; i < item.length; i++) {
|
|
5639
|
+
collectObjectRecursive(item[i], collector);
|
|
5640
|
+
if (i !== item.length - 1) collector.push(",");
|
|
5641
|
+
}
|
|
5642
|
+
collector.push("]");
|
|
5643
|
+
} else {
|
|
5644
|
+
collector.push("{");
|
|
5645
|
+
var keys = Object.keys(item).sort();
|
|
5646
|
+
keys.forEach(function (key, i) {
|
|
5647
|
+
collector.push("\"".concat(key, "\":"));
|
|
5648
|
+
collectObjectRecursive(item[key], collector);
|
|
5649
|
+
if (i !== keys.length - 1) collector.push(",");
|
|
5650
|
+
});
|
|
5651
|
+
collector.push("}");
|
|
5652
|
+
}
|
|
5653
|
+
return;
|
|
5654
|
+
} else {
|
|
5655
|
+
console.warn("Unknown type encountered when hashing object", _typeof(item), item);
|
|
5656
|
+
}
|
|
5657
|
+
}
|
|
5658
|
+
|
|
5659
|
+
/**
|
|
5660
|
+
* Extracts schemas and sources from a ValModules registry and computes the
|
|
5661
|
+
* deterministic SHAs that the server and client both use to detect changes.
|
|
5662
|
+
*
|
|
5663
|
+
* Used by ValOps on the server and by ValSyncEngine on the client so the
|
|
5664
|
+
* hash algorithm has a single source of truth.
|
|
5665
|
+
*/
|
|
5666
|
+
function extractValModules(_x) {
|
|
5667
|
+
return _extractValModules.apply(this, arguments);
|
|
5668
|
+
}
|
|
5669
|
+
function _extractValModules() {
|
|
5670
|
+
_extractValModules = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(valModules) {
|
|
5671
|
+
var moduleErrors, addModuleError, sources, schemas, serializedSchemas, configSha, sourcesSha, baseSha, schemaSha, _loop, _ret, moduleIdx;
|
|
5672
|
+
return _regenerator().w(function (_context2) {
|
|
5673
|
+
while (1) switch (_context2.n) {
|
|
5674
|
+
case 0:
|
|
5675
|
+
moduleErrors = [];
|
|
5676
|
+
addModuleError = function addModuleError(message, index, path) {
|
|
5677
|
+
moduleErrors[index] = {
|
|
5678
|
+
message: message,
|
|
5679
|
+
path: path
|
|
5680
|
+
};
|
|
5681
|
+
};
|
|
5682
|
+
sources = {};
|
|
5683
|
+
schemas = {};
|
|
5684
|
+
serializedSchemas = {};
|
|
5685
|
+
configSha = hash(JSON.stringify(valModules.config));
|
|
5686
|
+
sourcesSha = "";
|
|
5687
|
+
baseSha = configSha;
|
|
5688
|
+
schemaSha = configSha;
|
|
5689
|
+
_loop = /*#__PURE__*/_regenerator().m(function _loop(moduleIdx) {
|
|
5690
|
+
var module;
|
|
5691
|
+
return _regenerator().w(function (_context) {
|
|
5692
|
+
while (1) switch (_context.n) {
|
|
5693
|
+
case 0:
|
|
5694
|
+
module = valModules.modules[moduleIdx];
|
|
5695
|
+
if (module.def) {
|
|
5696
|
+
_context.n = 1;
|
|
5697
|
+
break;
|
|
5698
|
+
}
|
|
5699
|
+
addModuleError("val.modules is missing 'def' property", moduleIdx);
|
|
5700
|
+
return _context.a(2, 0);
|
|
5701
|
+
case 1:
|
|
5702
|
+
if (!(typeof module.def !== "function")) {
|
|
5703
|
+
_context.n = 2;
|
|
5704
|
+
break;
|
|
5705
|
+
}
|
|
5706
|
+
addModuleError("val.modules 'def' property is not a function", moduleIdx);
|
|
5707
|
+
return _context.a(2, 0);
|
|
5708
|
+
case 2:
|
|
5709
|
+
_context.n = 3;
|
|
5710
|
+
return module.def().then(function (value) {
|
|
5711
|
+
if (!value) {
|
|
5712
|
+
addModuleError("val.modules 'def' did not return a value", moduleIdx);
|
|
5713
|
+
return;
|
|
5714
|
+
}
|
|
5715
|
+
if (!value["default"]) {
|
|
5716
|
+
addModuleError("val.modules 'def' did not return a default export", moduleIdx);
|
|
5717
|
+
return;
|
|
5718
|
+
}
|
|
5719
|
+
var path = getValPath(value["default"]);
|
|
5720
|
+
if (path === undefined) {
|
|
5721
|
+
addModuleError("path is undefined", moduleIdx);
|
|
5722
|
+
return;
|
|
5723
|
+
}
|
|
5724
|
+
var schema = getSchema(value["default"]);
|
|
5725
|
+
if (schema === undefined) {
|
|
5726
|
+
addModuleError("schema in path '".concat(path, "' is undefined"), moduleIdx, path);
|
|
5727
|
+
return;
|
|
5728
|
+
}
|
|
5729
|
+
// Avoid `schema instanceof Schema` — the editor SPA and the host
|
|
5730
|
+
// Next.js bundle each ship their own copy of @valbuild/core, so the
|
|
5731
|
+
// `Schema` class identity differs between them and the instanceof
|
|
5732
|
+
// check would fail for cross-bundle modules. The executeSerialize
|
|
5733
|
+
// check below is the actual contract we depend on.
|
|
5734
|
+
if (typeof schema["executeSerialize"] !== "function") {
|
|
5735
|
+
addModuleError("schema.serialize in path '".concat(path, "' is not a function"), moduleIdx, path);
|
|
5736
|
+
return;
|
|
5737
|
+
}
|
|
5738
|
+
var source = getSource(value["default"]);
|
|
5739
|
+
if (source === undefined) {
|
|
5740
|
+
addModuleError("source in ".concat(path, " is undefined"), moduleIdx, path);
|
|
5741
|
+
return;
|
|
5742
|
+
}
|
|
5743
|
+
var serializedSchema;
|
|
5744
|
+
try {
|
|
5745
|
+
serializedSchema = schema["executeSerialize"]();
|
|
5746
|
+
} catch (e) {
|
|
5747
|
+
var message = e instanceof Error ? e.message : JSON.stringify(e);
|
|
5748
|
+
addModuleError("Could not serialize module: '".concat(path, "'. Error: ").concat(message), moduleIdx, path);
|
|
5749
|
+
return;
|
|
5750
|
+
}
|
|
5751
|
+
var pathM = path;
|
|
5752
|
+
sources[pathM] = source;
|
|
5753
|
+
schemas[pathM] = schema;
|
|
5754
|
+
serializedSchemas[pathM] = serializedSchema;
|
|
5755
|
+
sourcesSha = hash(sourcesSha + JSON.stringify({
|
|
5756
|
+
path: path,
|
|
5757
|
+
source: source
|
|
5758
|
+
}));
|
|
5759
|
+
baseSha = hash(baseSha + JSON.stringify({
|
|
5760
|
+
path: path,
|
|
5761
|
+
schema: serializedSchema,
|
|
5762
|
+
source: source,
|
|
5763
|
+
modulesErrors: moduleErrors
|
|
5764
|
+
}));
|
|
5765
|
+
schemaSha = hash(schemaSha + JSON.stringify(serializedSchema));
|
|
5766
|
+
});
|
|
5767
|
+
case 3:
|
|
5768
|
+
return _context.a(2);
|
|
5769
|
+
}
|
|
5770
|
+
}, _loop);
|
|
5771
|
+
});
|
|
5772
|
+
moduleIdx = 0;
|
|
5773
|
+
case 1:
|
|
5774
|
+
if (!(moduleIdx < valModules.modules.length)) {
|
|
5775
|
+
_context2.n = 4;
|
|
5776
|
+
break;
|
|
5777
|
+
}
|
|
5778
|
+
return _context2.d(_regeneratorValues(_loop(moduleIdx)), 2);
|
|
5779
|
+
case 2:
|
|
5780
|
+
_ret = _context2.v;
|
|
5781
|
+
if (!(_ret === 0)) {
|
|
5782
|
+
_context2.n = 3;
|
|
5783
|
+
break;
|
|
5784
|
+
}
|
|
5785
|
+
return _context2.a(3, 3);
|
|
5786
|
+
case 3:
|
|
5787
|
+
moduleIdx++;
|
|
5788
|
+
_context2.n = 1;
|
|
5789
|
+
break;
|
|
5790
|
+
case 4:
|
|
5791
|
+
return _context2.a(2, {
|
|
5792
|
+
sources: sources,
|
|
5793
|
+
schemas: schemas,
|
|
5794
|
+
serializedSchemas: serializedSchemas,
|
|
5795
|
+
baseSha: baseSha,
|
|
5796
|
+
schemaSha: schemaSha,
|
|
5797
|
+
sourcesSha: sourcesSha,
|
|
5798
|
+
configSha: configSha,
|
|
5799
|
+
moduleErrors: moduleErrors
|
|
5800
|
+
});
|
|
5801
|
+
}
|
|
5802
|
+
}, _callee);
|
|
5803
|
+
}));
|
|
5804
|
+
return _extractValModules.apply(this, arguments);
|
|
5805
|
+
}
|
|
5806
|
+
|
|
5807
|
+
var DEFAULT_VAL_REMOTE_HOST = "https://remote.val.build";
|
|
5808
|
+
function convertRemoteSource(src) {
|
|
5809
|
+
if (src !== null && src !== void 0 && src.patch_id) {
|
|
5810
|
+
var splitRemoteRefDataRes = splitRemoteRef(src[FILE_REF_PROP]);
|
|
5811
|
+
if (splitRemoteRefDataRes.status === "success") {
|
|
5812
|
+
return {
|
|
5813
|
+
url: "/api/val/files/" + splitRemoteRefDataRes.filePath + "?patch_id=".concat(src["patch_id"], "&remote=true&ref=").concat(encodeURIComponent(src[FILE_REF_PROP])),
|
|
5814
|
+
metadata: src.metadata
|
|
5815
|
+
};
|
|
5816
|
+
} else {
|
|
5817
|
+
console.warn("Internal Val error: failed to split remote ref: ".concat(src[FILE_REF_PROP], ". The data format is different than what is expected. Check Val versions for mismatches."), splitRemoteRefDataRes.error);
|
|
5818
|
+
}
|
|
5819
|
+
}
|
|
5820
|
+
return {
|
|
5821
|
+
url: src[FILE_REF_PROP],
|
|
5822
|
+
metadata: src.metadata
|
|
5823
|
+
};
|
|
5824
|
+
}
|
|
5825
|
+
|
|
5826
|
+
var PatchError = /*#__PURE__*/_createClass(function PatchError(message) {
|
|
5827
|
+
_classCallCheck(this, PatchError);
|
|
5828
|
+
this.message = message;
|
|
5829
|
+
});
|
|
5830
|
+
|
|
5831
|
+
/**
|
|
5832
|
+
* NOTE: MAY mutate the input document.
|
|
5833
|
+
*/
|
|
5834
|
+
|
|
5835
|
+
function derefPath(path) {
|
|
5836
|
+
var dereffedPath = [];
|
|
5837
|
+
var referencedPath = null;
|
|
5838
|
+
var _iterator = _createForOfIteratorHelper(path),
|
|
5839
|
+
_step;
|
|
5840
|
+
try {
|
|
5841
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
5842
|
+
var segment = _step.value;
|
|
5843
|
+
if (segment.startsWith("$")) {
|
|
5844
|
+
var dereffedSegment = segment.slice(1);
|
|
5845
|
+
dereffedPath.push(dereffedSegment);
|
|
5846
|
+
referencedPath = [];
|
|
5847
|
+
var _iterator2 = _createForOfIteratorHelper(path.slice(dereffedPath.length)),
|
|
5848
|
+
_step2;
|
|
5849
|
+
try {
|
|
5850
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
5851
|
+
var _segment = _step2.value;
|
|
5852
|
+
if (_segment.startsWith("$")) {
|
|
5853
|
+
return err(new PatchError("Cannot reference within reference: ".concat(_segment, ". Path: ").concat(path.join("/"))));
|
|
5854
|
+
}
|
|
5855
|
+
referencedPath.push(_segment);
|
|
5856
|
+
}
|
|
5857
|
+
} catch (err) {
|
|
5858
|
+
_iterator2.e(err);
|
|
5859
|
+
} finally {
|
|
5860
|
+
_iterator2.f();
|
|
5861
|
+
}
|
|
5862
|
+
break;
|
|
5863
|
+
} else {
|
|
5864
|
+
dereffedPath.push(segment);
|
|
5865
|
+
}
|
|
5866
|
+
}
|
|
5867
|
+
} catch (err) {
|
|
5868
|
+
_iterator.e(err);
|
|
5869
|
+
} finally {
|
|
5870
|
+
_iterator.f();
|
|
5871
|
+
}
|
|
5872
|
+
return ok([dereffedPath, referencedPath]);
|
|
5873
|
+
}
|
|
5874
|
+
function derefPatch(patch, document, ops) {
|
|
5875
|
+
var fileUpdates = {};
|
|
5876
|
+
var dereferencedPatch = [];
|
|
5877
|
+
var _iterator3 = _createForOfIteratorHelper(patch),
|
|
5878
|
+
_step3;
|
|
5879
|
+
try {
|
|
5880
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
5881
|
+
var op = _step3.value;
|
|
5882
|
+
if (op.op === "replace") {
|
|
5883
|
+
var maybeDerefRes = derefPath(op.path);
|
|
5884
|
+
if (isErr(maybeDerefRes)) {
|
|
5885
|
+
return maybeDerefRes;
|
|
5886
|
+
}
|
|
5887
|
+
var _maybeDerefRes$value = _slicedToArray(maybeDerefRes.value, 2),
|
|
5888
|
+
dereffedPath = _maybeDerefRes$value[0],
|
|
5889
|
+
referencedPath = _maybeDerefRes$value[1];
|
|
5890
|
+
if (referencedPath) {
|
|
5891
|
+
var maybeValue = ops.get(document, dereffedPath);
|
|
5892
|
+
if (isOk(maybeValue)) {
|
|
5893
|
+
var value = maybeValue.value;
|
|
5894
|
+
if (isFile(value)) {
|
|
5895
|
+
if (referencedPath.length > 0) {
|
|
5896
|
+
return err(new PatchError("Cannot sub-reference file reference at path: ".concat(dereffedPath.join("/"))));
|
|
5897
|
+
}
|
|
5898
|
+
if (typeof op.value !== "string") {
|
|
5899
|
+
return err(new PatchError("Expected base64 encoded string value for file reference, got ".concat(JSON.stringify(op.value))));
|
|
5900
|
+
}
|
|
5901
|
+
fileUpdates[value[FILE_REF_PROP]] = op.value;
|
|
5902
|
+
// } else if (isRemote(value)) {
|
|
5903
|
+
// if (!remotePatches[value[REMOTE_REF_PROP]]) {
|
|
5904
|
+
// remotePatches[value[REMOTE_REF_PROP]] = [];
|
|
5905
|
+
// }
|
|
5906
|
+
// remotePatches[value[REMOTE_REF_PROP]].push({
|
|
5907
|
+
// op: "replace",
|
|
5908
|
+
// path: referencedPath,
|
|
5909
|
+
// value: op.value,
|
|
5910
|
+
// });
|
|
5911
|
+
} else {
|
|
5912
|
+
return err(new PatchError("Unknown reference: ".concat(JSON.stringify(op), " at path: ").concat(dereffedPath.join("/"))));
|
|
5913
|
+
}
|
|
5914
|
+
} else {
|
|
5915
|
+
return maybeValue;
|
|
5916
|
+
}
|
|
5917
|
+
} else {
|
|
5918
|
+
dereferencedPatch.push(op);
|
|
5919
|
+
}
|
|
5920
|
+
} else if (op.op === "file") {
|
|
5921
|
+
if (!op.filePath.startsWith("/public")) {
|
|
5922
|
+
return err(new PatchError("Path must start with /public"));
|
|
5923
|
+
}
|
|
5924
|
+
if (typeof op.value !== "string") {
|
|
5925
|
+
return err(new PatchError("File operation must have a value that is typeof string. Found: ".concat(_typeof(op.value))));
|
|
5926
|
+
}
|
|
5927
|
+
fileUpdates[op.filePath] = op.value;
|
|
5928
|
+
} else {
|
|
5929
|
+
var _maybeDerefRes = derefPath(op.path);
|
|
5930
|
+
if (isErr(_maybeDerefRes)) {
|
|
5931
|
+
return _maybeDerefRes;
|
|
5932
|
+
}
|
|
5933
|
+
var _maybeDerefRes$value2 = _slicedToArray(_maybeDerefRes.value, 2),
|
|
5934
|
+
_referencedPath = _maybeDerefRes$value2[1];
|
|
5935
|
+
if (_referencedPath) {
|
|
5936
|
+
throw new Error("Unimplemented operation: ".concat(JSON.stringify(op)));
|
|
5937
|
+
}
|
|
5938
|
+
dereferencedPatch.push(op);
|
|
5939
|
+
}
|
|
5940
|
+
}
|
|
5941
|
+
} catch (err) {
|
|
5942
|
+
_iterator3.e(err);
|
|
5943
|
+
} finally {
|
|
5944
|
+
_iterator3.f();
|
|
5945
|
+
}
|
|
5946
|
+
return ok({
|
|
5947
|
+
fileUpdates: fileUpdates,
|
|
5948
|
+
dereferencedPatch: dereferencedPatch
|
|
5949
|
+
});
|
|
5950
|
+
}
|
|
5951
|
+
|
|
5055
5952
|
var EXT_TO_MIME_TYPES = {
|
|
5056
5953
|
x3d: "application/vnd.hzn-3d-crossword",
|
|
5057
5954
|
"3gp": "video/3gpp",
|
|
@@ -5806,28 +6703,38 @@ function getFileHash(text) {
|
|
|
5806
6703
|
}
|
|
5807
6704
|
|
|
5808
6705
|
function deserializeSchema(serialized) {
|
|
6706
|
+
var schema = deserializeSchemaImpl(serialized);
|
|
6707
|
+
if (serialized.readonly) {
|
|
6708
|
+
schema = schema.readonly();
|
|
6709
|
+
}
|
|
6710
|
+
if (serialized.hidden) {
|
|
6711
|
+
schema = schema.hidden();
|
|
6712
|
+
}
|
|
6713
|
+
return schema;
|
|
6714
|
+
}
|
|
6715
|
+
function deserializeSchemaImpl(serialized) {
|
|
5809
6716
|
var _serialized$options, _serialized$options2, _serialized$accept, _serialized$directory, _serialized$remote;
|
|
5810
6717
|
switch (serialized.type) {
|
|
5811
6718
|
case "string":
|
|
5812
6719
|
return new StringSchema(_objectSpread2(_objectSpread2({}, serialized.options), {}, {
|
|
5813
6720
|
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),
|
|
5814
6721
|
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
|
|
5815
|
-
}), serialized.opt, serialized.raw);
|
|
6722
|
+
}), serialized.opt, serialized.raw, [], null, false, false, serialized.description);
|
|
5816
6723
|
case "literal":
|
|
5817
|
-
return new LiteralSchema(serialized.value, serialized.opt);
|
|
6724
|
+
return new LiteralSchema(serialized.value, serialized.opt, [], false, false, serialized.description);
|
|
5818
6725
|
case "boolean":
|
|
5819
|
-
return new BooleanSchema(serialized.opt);
|
|
6726
|
+
return new BooleanSchema(serialized.opt, [], false, false, serialized.description);
|
|
5820
6727
|
case "number":
|
|
5821
|
-
return new NumberSchema(serialized.options, serialized.opt);
|
|
6728
|
+
return new NumberSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
|
|
5822
6729
|
case "object":
|
|
5823
6730
|
return new ObjectSchema(Object.fromEntries(Object.entries(serialized.items).map(function (_ref) {
|
|
5824
6731
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
5825
6732
|
key = _ref2[0],
|
|
5826
6733
|
item = _ref2[1];
|
|
5827
6734
|
return [key, deserializeSchema(item)];
|
|
5828
|
-
})), serialized.opt);
|
|
6735
|
+
})), serialized.opt, [], false, false, serialized.description);
|
|
5829
6736
|
case "array":
|
|
5830
|
-
return new ArraySchema(deserializeSchema(serialized.item), serialized.opt);
|
|
6737
|
+
return new ArraySchema(deserializeSchema(serialized.item), serialized.opt, [], false, false, serialized.description);
|
|
5831
6738
|
case "union":
|
|
5832
6739
|
return new UnionSchema(typeof serialized.key === "string" ? serialized.key :
|
|
5833
6740
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -5836,7 +6743,7 @@ function deserializeSchema(serialized) {
|
|
|
5836
6743
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5837
6744
|
serialized.items.map(deserializeSchema),
|
|
5838
6745
|
// TODO: we do not really need any here - right?
|
|
5839
|
-
serialized.opt);
|
|
6746
|
+
serialized.opt, [], false, false, serialized.description);
|
|
5840
6747
|
case "richtext":
|
|
5841
6748
|
{
|
|
5842
6749
|
var _serialized$options3, _serialized$options4, _serialized$options5, _serialized$options6, _serialized$options7, _serialized$options8, _serialized$options9;
|
|
@@ -5846,7 +6753,7 @@ function deserializeSchema(serialized) {
|
|
|
5846
6753
|
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
|
|
5847
6754
|
} : (_serialized$options9 = serialized.options) === null || _serialized$options9 === void 0 ? void 0 : _serialized$options9.inline
|
|
5848
6755
|
});
|
|
5849
|
-
return new RichTextSchema(deserializedOptions, serialized.opt);
|
|
6756
|
+
return new RichTextSchema(deserializedOptions, serialized.opt, [], false, false, serialized.description);
|
|
5850
6757
|
}
|
|
5851
6758
|
case "record":
|
|
5852
6759
|
return new RecordSchema(deserializeSchema(serialized.item), serialized.opt, [], null, serialized.key ? deserializeSchema(serialized.key) : null, serialized.mediaType ? {
|
|
@@ -5855,23 +6762,25 @@ function deserializeSchema(serialized) {
|
|
|
5855
6762
|
directory: (_serialized$directory = serialized.directory) !== null && _serialized$directory !== void 0 ? _serialized$directory : "/public/val",
|
|
5856
6763
|
remote: (_serialized$remote = serialized.remote) !== null && _serialized$remote !== void 0 ? _serialized$remote : false,
|
|
5857
6764
|
altSchema: serialized.alt ? deserializeSchema(serialized.alt) : undefined
|
|
5858
|
-
} : undefined);
|
|
6765
|
+
} : undefined, false, false, serialized.description);
|
|
5859
6766
|
case "keyOf":
|
|
5860
|
-
return new KeyOfSchema(serialized.schema, serialized.path, serialized.opt);
|
|
6767
|
+
return new KeyOfSchema(serialized.schema, serialized.path, serialized.opt, [], false, false, serialized.description);
|
|
5861
6768
|
case "route":
|
|
5862
6769
|
{
|
|
5863
6770
|
var routeOptions = serialized.options ? {
|
|
5864
6771
|
include: serialized.options.include ? new RegExp(serialized.options.include.source, serialized.options.include.flags) : undefined,
|
|
5865
6772
|
exclude: serialized.options.exclude ? new RegExp(serialized.options.exclude.source, serialized.options.exclude.flags) : undefined
|
|
5866
6773
|
} : undefined;
|
|
5867
|
-
return new RouteSchema(routeOptions, serialized.opt);
|
|
6774
|
+
return new RouteSchema(routeOptions, serialized.opt, [], false, false, serialized.description);
|
|
5868
6775
|
}
|
|
5869
6776
|
case "file":
|
|
5870
|
-
return new FileSchema(serialized.options, serialized.opt, serialized.remote);
|
|
6777
|
+
return new FileSchema(serialized.options, serialized.opt, serialized.remote, [], {}, false, false, serialized.description);
|
|
5871
6778
|
case "image":
|
|
5872
|
-
return new ImageSchema(serialized.options, serialized.opt, serialized.remote);
|
|
6779
|
+
return new ImageSchema(serialized.options, serialized.opt, serialized.remote, [], {}, false, false, serialized.description);
|
|
5873
6780
|
case "date":
|
|
5874
|
-
return new DateSchema(serialized.options, serialized.opt);
|
|
6781
|
+
return new DateSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
|
|
6782
|
+
case "dateTime":
|
|
6783
|
+
return new DateTimeSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
|
|
5875
6784
|
default:
|
|
5876
6785
|
{
|
|
5877
6786
|
var exhaustiveCheck = serialized;
|
|
@@ -6235,4 +7144,4 @@ function tryJsonParse(str) {
|
|
|
6235
7144
|
}
|
|
6236
7145
|
}
|
|
6237
7146
|
|
|
6238
|
-
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,
|
|
7147
|
+
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, extractValModules as f, DEFAULT_VAL_REMOTE_HOST as g, FILE_REF_PROP as h, initVal as i, FILE_REF_SUBTYPE_TAG as j, derefPatch as k, StringSchema as l, modules as m, ImageSchema as n, FileSchema as o, DateSchema as p, DateTimeSchema as q, RouteSchema as r, splitModuleFilePathAndModulePath as s, RichTextSchema as t, deserializeSchema as u, getSourcePathFromRoute as v };
|