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