@valbuild/core 0.44.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/declarations/src/index.d.ts +13 -14
- package/dist/declarations/src/initSchema.d.ts +2 -1
- package/dist/declarations/src/initVal.d.ts +1 -0
- package/dist/declarations/src/module.d.ts +3 -1
- package/dist/declarations/src/schema/file.d.ts +10 -0
- package/dist/declarations/src/schema/image.d.ts +11 -7
- package/dist/declarations/src/schema/string.d.ts +9 -1
- package/dist/declarations/src/selector/file.d.ts +6 -2
- package/dist/declarations/src/selector/image.d.ts +3 -0
- package/dist/declarations/src/selector/index.d.ts +3 -1
- package/dist/declarations/src/source/file.d.ts +8 -9
- package/dist/declarations/src/source/image.d.ts +7 -0
- package/dist/declarations/src/source/richtext.d.ts +4 -4
- package/dist/{index-6deb169d.cjs.dev.js → index-00276955.cjs.dev.js} +1 -1
- package/dist/{index-c83918b8.esm.js → index-5750c299.esm.js} +3 -81
- package/dist/{index-4f821892.esm.js → index-799bcf49.esm.js} +1 -1
- package/dist/{index-5bdaa229.cjs.prod.js → index-7b467ee6.cjs.prod.js} +2 -82
- package/dist/{index-a5295001.cjs.dev.js → index-d23e237a.cjs.dev.js} +2 -82
- package/dist/{index-216627d7.cjs.prod.js → index-db60fc1d.cjs.prod.js} +1 -1
- package/dist/{ops-422169e5.cjs.dev.js → ops-74e62ffe.cjs.dev.js} +89 -2
- package/dist/{ops-5bd1bd7a.cjs.prod.js → ops-c0e7e3a8.cjs.prod.js} +89 -2
- package/dist/{ops-899d8bef.esm.js → ops-ffed3406.esm.js} +81 -2
- package/dist/valbuild-core.cjs.dev.js +30 -6
- package/dist/valbuild-core.cjs.prod.js +30 -6
- package/dist/valbuild-core.esm.js +22 -7
- package/expr/dist/valbuild-core-expr.cjs.dev.js +2 -2
- package/expr/dist/valbuild-core-expr.cjs.prod.js +2 -2
- package/expr/dist/valbuild-core-expr.esm.js +2 -2
- package/package.json +1 -1
- package/patch/dist/valbuild-core-patch.cjs.dev.js +2 -2
- package/patch/dist/valbuild-core-patch.cjs.prod.js +2 -2
- package/patch/dist/valbuild-core-patch.esm.js +3 -3
@@ -1,6 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var index = require('./index-
|
3
|
+
var index = require('./index-d23e237a.cjs.dev.js');
|
4
4
|
var result = require('./result-48320acd.cjs.dev.js');
|
5
5
|
|
6
6
|
function hasOwn(obj, prop) {
|
@@ -628,6 +628,85 @@ var richtext = function richtext(options) {
|
|
628
628
|
return new RichTextSchema(options !== null && options !== void 0 ? options : {});
|
629
629
|
};
|
630
630
|
|
631
|
+
var ImageSchema = /*#__PURE__*/function (_Schema) {
|
632
|
+
index._inherits(ImageSchema, _Schema);
|
633
|
+
var _super = index._createSuper(ImageSchema);
|
634
|
+
function ImageSchema(options) {
|
635
|
+
var _this;
|
636
|
+
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
637
|
+
index._classCallCheck(this, ImageSchema);
|
638
|
+
_this = _super.call(this);
|
639
|
+
_this.options = options;
|
640
|
+
_this.opt = opt;
|
641
|
+
return _this;
|
642
|
+
}
|
643
|
+
index._createClass(ImageSchema, [{
|
644
|
+
key: "validate",
|
645
|
+
value: function validate(path, src) {
|
646
|
+
if (this.opt && (src === null || src === undefined)) {
|
647
|
+
return false;
|
648
|
+
}
|
649
|
+
if (src === null || src === undefined) {
|
650
|
+
return index._defineProperty({}, path, [{
|
651
|
+
message: "Non-optional image was null or undefined.",
|
652
|
+
value: src
|
653
|
+
}]);
|
654
|
+
}
|
655
|
+
if (typeof src[index.FILE_REF_PROP] !== "string") {
|
656
|
+
return index._defineProperty({}, path, [{
|
657
|
+
message: "Image did not have a file reference string. Got: ".concat(index._typeof(src[index.FILE_REF_PROP])),
|
658
|
+
value: src
|
659
|
+
}]);
|
660
|
+
}
|
661
|
+
if (src[index.VAL_EXTENSION] !== "file") {
|
662
|
+
return index._defineProperty({}, path, [{
|
663
|
+
message: "Image did not have the valid file extension type. Got: ".concat(src[index.VAL_EXTENSION]),
|
664
|
+
value: src
|
665
|
+
}]);
|
666
|
+
}
|
667
|
+
if (src.metadata) {
|
668
|
+
return index._defineProperty({}, path, [{
|
669
|
+
message: "Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and sha256 (string of length 64 of the base16 hash).",
|
670
|
+
// These validation errors will have to be picked up by logic outside of this package and revalidated. Reasons: 1) we have to read files to verify the metadata, which is handled differently in different runtimes (Browser, QuickJS, Node.js); 2) we want to keep this package dependency free.
|
671
|
+
value: src,
|
672
|
+
fixes: ["image:replace-metadata"]
|
673
|
+
}]);
|
674
|
+
}
|
675
|
+
return index._defineProperty({}, path, [{
|
676
|
+
message: "Could not validate Image metadata.",
|
677
|
+
value: src,
|
678
|
+
fixes: ["image:add-metadata"]
|
679
|
+
}]);
|
680
|
+
}
|
681
|
+
}, {
|
682
|
+
key: "assert",
|
683
|
+
value: function assert(src) {
|
684
|
+
if (this.opt && (src === null || src === undefined)) {
|
685
|
+
return true;
|
686
|
+
}
|
687
|
+
return (src === null || src === void 0 ? void 0 : src[index.FILE_REF_PROP]) === "image" && (src === null || src === void 0 ? void 0 : src[index.VAL_EXTENSION]) === "file";
|
688
|
+
}
|
689
|
+
}, {
|
690
|
+
key: "optional",
|
691
|
+
value: function optional() {
|
692
|
+
return new ImageSchema(this.options, true);
|
693
|
+
}
|
694
|
+
}, {
|
695
|
+
key: "serialize",
|
696
|
+
value: function serialize() {
|
697
|
+
return {
|
698
|
+
type: "image",
|
699
|
+
options: this.options,
|
700
|
+
opt: this.opt
|
701
|
+
};
|
702
|
+
}
|
703
|
+
}]);
|
704
|
+
return ImageSchema;
|
705
|
+
}(index.Schema);
|
706
|
+
var image = function image(options) {
|
707
|
+
return new ImageSchema(options);
|
708
|
+
};
|
709
|
+
|
631
710
|
var RecordSchema = /*#__PURE__*/function (_Schema) {
|
632
711
|
index._inherits(RecordSchema, _Schema);
|
633
712
|
var _super = index._createSuper(RecordSchema);
|
@@ -768,7 +847,7 @@ function isRichTextSchema(schema) {
|
|
768
847
|
return schema instanceof RichTextSchema || index._typeof(schema) === "object" && "type" in schema && schema.type === "richtext";
|
769
848
|
}
|
770
849
|
function isImageSchema(schema) {
|
771
|
-
return schema instanceof
|
850
|
+
return schema instanceof ImageSchema || index._typeof(schema) === "object" && "type" in schema && schema.type === "image";
|
772
851
|
}
|
773
852
|
|
774
853
|
// function isOneOfSchema(
|
@@ -968,11 +1047,19 @@ var PatchError = /*#__PURE__*/index._createClass(function PatchError(message) {
|
|
968
1047
|
* NOTE: MAY mutate the input document.
|
969
1048
|
*/
|
970
1049
|
|
1050
|
+
exports.ArraySchema = ArraySchema;
|
1051
|
+
exports.ImageSchema = ImageSchema;
|
1052
|
+
exports.LiteralSchema = LiteralSchema;
|
1053
|
+
exports.ObjectSchema = ObjectSchema;
|
971
1054
|
exports.PatchError = PatchError;
|
1055
|
+
exports.RecordSchema = RecordSchema;
|
1056
|
+
exports.RichTextSchema = RichTextSchema;
|
1057
|
+
exports.UnionSchema = UnionSchema;
|
972
1058
|
exports.array = array;
|
973
1059
|
exports.content = content;
|
974
1060
|
exports.createValPathOfItem = createValPathOfItem;
|
975
1061
|
exports.getSource = getSource;
|
1062
|
+
exports.image = image;
|
976
1063
|
exports.isSelector = isSelector;
|
977
1064
|
exports.literal = literal;
|
978
1065
|
exports.newSelectorProxy = newSelectorProxy;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var index = require('./index-
|
3
|
+
var index = require('./index-7b467ee6.cjs.prod.js');
|
4
4
|
var result = require('./result-26f67b40.cjs.prod.js');
|
5
5
|
|
6
6
|
function hasOwn(obj, prop) {
|
@@ -628,6 +628,85 @@ var richtext = function richtext(options) {
|
|
628
628
|
return new RichTextSchema(options !== null && options !== void 0 ? options : {});
|
629
629
|
};
|
630
630
|
|
631
|
+
var ImageSchema = /*#__PURE__*/function (_Schema) {
|
632
|
+
index._inherits(ImageSchema, _Schema);
|
633
|
+
var _super = index._createSuper(ImageSchema);
|
634
|
+
function ImageSchema(options) {
|
635
|
+
var _this;
|
636
|
+
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
637
|
+
index._classCallCheck(this, ImageSchema);
|
638
|
+
_this = _super.call(this);
|
639
|
+
_this.options = options;
|
640
|
+
_this.opt = opt;
|
641
|
+
return _this;
|
642
|
+
}
|
643
|
+
index._createClass(ImageSchema, [{
|
644
|
+
key: "validate",
|
645
|
+
value: function validate(path, src) {
|
646
|
+
if (this.opt && (src === null || src === undefined)) {
|
647
|
+
return false;
|
648
|
+
}
|
649
|
+
if (src === null || src === undefined) {
|
650
|
+
return index._defineProperty({}, path, [{
|
651
|
+
message: "Non-optional image was null or undefined.",
|
652
|
+
value: src
|
653
|
+
}]);
|
654
|
+
}
|
655
|
+
if (typeof src[index.FILE_REF_PROP] !== "string") {
|
656
|
+
return index._defineProperty({}, path, [{
|
657
|
+
message: "Image did not have a file reference string. Got: ".concat(index._typeof(src[index.FILE_REF_PROP])),
|
658
|
+
value: src
|
659
|
+
}]);
|
660
|
+
}
|
661
|
+
if (src[index.VAL_EXTENSION] !== "file") {
|
662
|
+
return index._defineProperty({}, path, [{
|
663
|
+
message: "Image did not have the valid file extension type. Got: ".concat(src[index.VAL_EXTENSION]),
|
664
|
+
value: src
|
665
|
+
}]);
|
666
|
+
}
|
667
|
+
if (src.metadata) {
|
668
|
+
return index._defineProperty({}, path, [{
|
669
|
+
message: "Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and sha256 (string of length 64 of the base16 hash).",
|
670
|
+
// These validation errors will have to be picked up by logic outside of this package and revalidated. Reasons: 1) we have to read files to verify the metadata, which is handled differently in different runtimes (Browser, QuickJS, Node.js); 2) we want to keep this package dependency free.
|
671
|
+
value: src,
|
672
|
+
fixes: ["image:replace-metadata"]
|
673
|
+
}]);
|
674
|
+
}
|
675
|
+
return index._defineProperty({}, path, [{
|
676
|
+
message: "Could not validate Image metadata.",
|
677
|
+
value: src,
|
678
|
+
fixes: ["image:add-metadata"]
|
679
|
+
}]);
|
680
|
+
}
|
681
|
+
}, {
|
682
|
+
key: "assert",
|
683
|
+
value: function assert(src) {
|
684
|
+
if (this.opt && (src === null || src === undefined)) {
|
685
|
+
return true;
|
686
|
+
}
|
687
|
+
return (src === null || src === void 0 ? void 0 : src[index.FILE_REF_PROP]) === "image" && (src === null || src === void 0 ? void 0 : src[index.VAL_EXTENSION]) === "file";
|
688
|
+
}
|
689
|
+
}, {
|
690
|
+
key: "optional",
|
691
|
+
value: function optional() {
|
692
|
+
return new ImageSchema(this.options, true);
|
693
|
+
}
|
694
|
+
}, {
|
695
|
+
key: "serialize",
|
696
|
+
value: function serialize() {
|
697
|
+
return {
|
698
|
+
type: "image",
|
699
|
+
options: this.options,
|
700
|
+
opt: this.opt
|
701
|
+
};
|
702
|
+
}
|
703
|
+
}]);
|
704
|
+
return ImageSchema;
|
705
|
+
}(index.Schema);
|
706
|
+
var image = function image(options) {
|
707
|
+
return new ImageSchema(options);
|
708
|
+
};
|
709
|
+
|
631
710
|
var RecordSchema = /*#__PURE__*/function (_Schema) {
|
632
711
|
index._inherits(RecordSchema, _Schema);
|
633
712
|
var _super = index._createSuper(RecordSchema);
|
@@ -768,7 +847,7 @@ function isRichTextSchema(schema) {
|
|
768
847
|
return schema instanceof RichTextSchema || index._typeof(schema) === "object" && "type" in schema && schema.type === "richtext";
|
769
848
|
}
|
770
849
|
function isImageSchema(schema) {
|
771
|
-
return schema instanceof
|
850
|
+
return schema instanceof ImageSchema || index._typeof(schema) === "object" && "type" in schema && schema.type === "image";
|
772
851
|
}
|
773
852
|
|
774
853
|
// function isOneOfSchema(
|
@@ -968,11 +1047,19 @@ var PatchError = /*#__PURE__*/index._createClass(function PatchError(message) {
|
|
968
1047
|
* NOTE: MAY mutate the input document.
|
969
1048
|
*/
|
970
1049
|
|
1050
|
+
exports.ArraySchema = ArraySchema;
|
1051
|
+
exports.ImageSchema = ImageSchema;
|
1052
|
+
exports.LiteralSchema = LiteralSchema;
|
1053
|
+
exports.ObjectSchema = ObjectSchema;
|
971
1054
|
exports.PatchError = PatchError;
|
1055
|
+
exports.RecordSchema = RecordSchema;
|
1056
|
+
exports.RichTextSchema = RichTextSchema;
|
1057
|
+
exports.UnionSchema = UnionSchema;
|
972
1058
|
exports.array = array;
|
973
1059
|
exports.content = content;
|
974
1060
|
exports.createValPathOfItem = createValPathOfItem;
|
975
1061
|
exports.getSource = getSource;
|
1062
|
+
exports.image = image;
|
976
1063
|
exports.isSelector = isSelector;
|
977
1064
|
exports.literal = literal;
|
978
1065
|
exports.newSelectorProxy = newSelectorProxy;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { e as _typeof,
|
1
|
+
import { e as _typeof, k as isSerializedVal, F as FILE_REF_PROP, V as VAL_EXTENSION, l as convertFileSource, d as _defineProperty, G as GetSchema, j as GetSource, E as Expr, P as Path, S as Schema, _ as _inherits, a as _createSuper, b as _classCallCheck, c as _createClass, h as _slicedToArray, p as _objectSpread2, t as _toConsumableArray } from './index-5750c299.esm.js';
|
2
2
|
import { _ as _createForOfIteratorHelper } from './result-b96df128.esm.js';
|
3
3
|
|
4
4
|
function hasOwn(obj, prop) {
|
@@ -626,6 +626,85 @@ var richtext = function richtext(options) {
|
|
626
626
|
return new RichTextSchema(options !== null && options !== void 0 ? options : {});
|
627
627
|
};
|
628
628
|
|
629
|
+
var ImageSchema = /*#__PURE__*/function (_Schema) {
|
630
|
+
_inherits(ImageSchema, _Schema);
|
631
|
+
var _super = _createSuper(ImageSchema);
|
632
|
+
function ImageSchema(options) {
|
633
|
+
var _this;
|
634
|
+
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
635
|
+
_classCallCheck(this, ImageSchema);
|
636
|
+
_this = _super.call(this);
|
637
|
+
_this.options = options;
|
638
|
+
_this.opt = opt;
|
639
|
+
return _this;
|
640
|
+
}
|
641
|
+
_createClass(ImageSchema, [{
|
642
|
+
key: "validate",
|
643
|
+
value: function validate(path, src) {
|
644
|
+
if (this.opt && (src === null || src === undefined)) {
|
645
|
+
return false;
|
646
|
+
}
|
647
|
+
if (src === null || src === undefined) {
|
648
|
+
return _defineProperty({}, path, [{
|
649
|
+
message: "Non-optional image was null or undefined.",
|
650
|
+
value: src
|
651
|
+
}]);
|
652
|
+
}
|
653
|
+
if (typeof src[FILE_REF_PROP] !== "string") {
|
654
|
+
return _defineProperty({}, path, [{
|
655
|
+
message: "Image did not have a file reference string. Got: ".concat(_typeof(src[FILE_REF_PROP])),
|
656
|
+
value: src
|
657
|
+
}]);
|
658
|
+
}
|
659
|
+
if (src[VAL_EXTENSION] !== "file") {
|
660
|
+
return _defineProperty({}, path, [{
|
661
|
+
message: "Image did not have the valid file extension type. Got: ".concat(src[VAL_EXTENSION]),
|
662
|
+
value: src
|
663
|
+
}]);
|
664
|
+
}
|
665
|
+
if (src.metadata) {
|
666
|
+
return _defineProperty({}, path, [{
|
667
|
+
message: "Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and sha256 (string of length 64 of the base16 hash).",
|
668
|
+
// These validation errors will have to be picked up by logic outside of this package and revalidated. Reasons: 1) we have to read files to verify the metadata, which is handled differently in different runtimes (Browser, QuickJS, Node.js); 2) we want to keep this package dependency free.
|
669
|
+
value: src,
|
670
|
+
fixes: ["image:replace-metadata"]
|
671
|
+
}]);
|
672
|
+
}
|
673
|
+
return _defineProperty({}, path, [{
|
674
|
+
message: "Could not validate Image metadata.",
|
675
|
+
value: src,
|
676
|
+
fixes: ["image:add-metadata"]
|
677
|
+
}]);
|
678
|
+
}
|
679
|
+
}, {
|
680
|
+
key: "assert",
|
681
|
+
value: function assert(src) {
|
682
|
+
if (this.opt && (src === null || src === undefined)) {
|
683
|
+
return true;
|
684
|
+
}
|
685
|
+
return (src === null || src === void 0 ? void 0 : src[FILE_REF_PROP]) === "image" && (src === null || src === void 0 ? void 0 : src[VAL_EXTENSION]) === "file";
|
686
|
+
}
|
687
|
+
}, {
|
688
|
+
key: "optional",
|
689
|
+
value: function optional() {
|
690
|
+
return new ImageSchema(this.options, true);
|
691
|
+
}
|
692
|
+
}, {
|
693
|
+
key: "serialize",
|
694
|
+
value: function serialize() {
|
695
|
+
return {
|
696
|
+
type: "image",
|
697
|
+
options: this.options,
|
698
|
+
opt: this.opt
|
699
|
+
};
|
700
|
+
}
|
701
|
+
}]);
|
702
|
+
return ImageSchema;
|
703
|
+
}(Schema);
|
704
|
+
var image = function image(options) {
|
705
|
+
return new ImageSchema(options);
|
706
|
+
};
|
707
|
+
|
629
708
|
var RecordSchema = /*#__PURE__*/function (_Schema) {
|
630
709
|
_inherits(RecordSchema, _Schema);
|
631
710
|
var _super = _createSuper(RecordSchema);
|
@@ -966,4 +1045,4 @@ var PatchError = /*#__PURE__*/_createClass(function PatchError(message) {
|
|
966
1045
|
* NOTE: MAY mutate the input document.
|
967
1046
|
*/
|
968
1047
|
|
969
|
-
export { PatchError as P, array as a, record as b, content as c, createValPathOfItem as d,
|
1048
|
+
export { ArraySchema as A, ImageSchema as I, LiteralSchema as L, ObjectSchema as O, PatchError as P, RecordSchema as R, UnionSchema as U, array as a, record as b, content as c, createValPathOfItem as d, isSelector as e, resolvePath as f, getSource as g, RichTextSchema as h, image as i, literal as l, newSelectorProxy as n, object as o, richtext as r, splitModuleIdAndModulePath as s, union as u };
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var ops = require('./ops-
|
6
|
-
var index = require('./index-
|
7
|
-
var expr_dist_valbuildCoreExpr = require('./index-
|
5
|
+
var ops = require('./ops-74e62ffe.cjs.dev.js');
|
6
|
+
var index = require('./index-d23e237a.cjs.dev.js');
|
7
|
+
var expr_dist_valbuildCoreExpr = require('./index-00276955.cjs.dev.js');
|
8
8
|
var result = require('./result-48320acd.cjs.dev.js');
|
9
9
|
|
10
10
|
var NumberSchema = /*#__PURE__*/function (_Schema) {
|
@@ -79,7 +79,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
79
79
|
index._createClass(StringSchema, [{
|
80
80
|
key: "validate",
|
81
81
|
value: function validate(path, src) {
|
82
|
-
var _this$options, _this$options2;
|
82
|
+
var _this$options, _this$options2, _this$options3;
|
83
83
|
if (this.opt && (src === null || src === undefined)) {
|
84
84
|
return false;
|
85
85
|
}
|
@@ -102,6 +102,12 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
102
102
|
value: src
|
103
103
|
});
|
104
104
|
}
|
105
|
+
if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.regexp && !this.options.regexp.test(src)) {
|
106
|
+
errors.push({
|
107
|
+
message: "Expected string to match reg exp: ".concat(this.options.regexp.toString(), ", got '").concat(src, "'"),
|
108
|
+
value: src
|
109
|
+
});
|
110
|
+
}
|
105
111
|
if (errors.length > 0) {
|
106
112
|
return index._defineProperty({}, path, errors);
|
107
113
|
}
|
@@ -128,9 +134,17 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
128
134
|
}, {
|
129
135
|
key: "serialize",
|
130
136
|
value: function serialize() {
|
137
|
+
var _this$options4, _this$options5, _this$options6;
|
131
138
|
return {
|
132
139
|
type: "string",
|
133
|
-
options:
|
140
|
+
options: {
|
141
|
+
maxLength: (_this$options4 = this.options) === null || _this$options4 === void 0 ? void 0 : _this$options4.maxLength,
|
142
|
+
minLength: (_this$options5 = this.options) === null || _this$options5 === void 0 ? void 0 : _this$options5.minLength,
|
143
|
+
regexp: ((_this$options6 = this.options) === null || _this$options6 === void 0 ? void 0 : _this$options6.regexp) && {
|
144
|
+
source: this.options.regexp.source,
|
145
|
+
flags: this.options.regexp.flags
|
146
|
+
}
|
147
|
+
},
|
134
148
|
opt: this.opt,
|
135
149
|
raw: this.isRaw
|
136
150
|
};
|
@@ -341,7 +355,7 @@ function initSchema() {
|
|
341
355
|
union: ops.union,
|
342
356
|
// oneOf,
|
343
357
|
richtext: ops.richtext,
|
344
|
-
image:
|
358
|
+
image: ops.image,
|
345
359
|
literal: ops.literal,
|
346
360
|
keyOf: keyOf,
|
347
361
|
record: ops.record
|
@@ -1562,12 +1576,22 @@ function tryJsonParse(str) {
|
|
1562
1576
|
}
|
1563
1577
|
}
|
1564
1578
|
|
1579
|
+
exports.ArraySchema = ops.ArraySchema;
|
1580
|
+
exports.ImageSchema = ops.ImageSchema;
|
1581
|
+
exports.LiteralSchema = ops.LiteralSchema;
|
1582
|
+
exports.ObjectSchema = ops.ObjectSchema;
|
1583
|
+
exports.RecordSchema = ops.RecordSchema;
|
1584
|
+
exports.RichTextSchema = ops.RichTextSchema;
|
1585
|
+
exports.UnionSchema = ops.UnionSchema;
|
1565
1586
|
exports.FILE_REF_PROP = index.FILE_REF_PROP;
|
1566
1587
|
exports.GenericSelector = index.GenericSelector;
|
1567
1588
|
exports.Schema = index.Schema;
|
1568
1589
|
exports.VAL_EXTENSION = index.VAL_EXTENSION;
|
1569
1590
|
exports.expr = expr_dist_valbuildCoreExpr.index;
|
1591
|
+
exports.BooleanSchema = BooleanSchema;
|
1570
1592
|
exports.Internal = Internal;
|
1593
|
+
exports.NumberSchema = NumberSchema;
|
1594
|
+
exports.StringSchema = StringSchema;
|
1571
1595
|
exports.ValApi = ValApi;
|
1572
1596
|
exports.derefPatch = derefPatch;
|
1573
1597
|
exports.initVal = initVal;
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var ops = require('./ops-
|
6
|
-
var index = require('./index-
|
7
|
-
var expr_dist_valbuildCoreExpr = require('./index-
|
5
|
+
var ops = require('./ops-c0e7e3a8.cjs.prod.js');
|
6
|
+
var index = require('./index-7b467ee6.cjs.prod.js');
|
7
|
+
var expr_dist_valbuildCoreExpr = require('./index-db60fc1d.cjs.prod.js');
|
8
8
|
var result = require('./result-26f67b40.cjs.prod.js');
|
9
9
|
|
10
10
|
var NumberSchema = /*#__PURE__*/function (_Schema) {
|
@@ -79,7 +79,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
79
79
|
index._createClass(StringSchema, [{
|
80
80
|
key: "validate",
|
81
81
|
value: function validate(path, src) {
|
82
|
-
var _this$options, _this$options2;
|
82
|
+
var _this$options, _this$options2, _this$options3;
|
83
83
|
if (this.opt && (src === null || src === undefined)) {
|
84
84
|
return false;
|
85
85
|
}
|
@@ -102,6 +102,12 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
102
102
|
value: src
|
103
103
|
});
|
104
104
|
}
|
105
|
+
if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.regexp && !this.options.regexp.test(src)) {
|
106
|
+
errors.push({
|
107
|
+
message: "Expected string to match reg exp: ".concat(this.options.regexp.toString(), ", got '").concat(src, "'"),
|
108
|
+
value: src
|
109
|
+
});
|
110
|
+
}
|
105
111
|
if (errors.length > 0) {
|
106
112
|
return index._defineProperty({}, path, errors);
|
107
113
|
}
|
@@ -128,9 +134,17 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
128
134
|
}, {
|
129
135
|
key: "serialize",
|
130
136
|
value: function serialize() {
|
137
|
+
var _this$options4, _this$options5, _this$options6;
|
131
138
|
return {
|
132
139
|
type: "string",
|
133
|
-
options:
|
140
|
+
options: {
|
141
|
+
maxLength: (_this$options4 = this.options) === null || _this$options4 === void 0 ? void 0 : _this$options4.maxLength,
|
142
|
+
minLength: (_this$options5 = this.options) === null || _this$options5 === void 0 ? void 0 : _this$options5.minLength,
|
143
|
+
regexp: ((_this$options6 = this.options) === null || _this$options6 === void 0 ? void 0 : _this$options6.regexp) && {
|
144
|
+
source: this.options.regexp.source,
|
145
|
+
flags: this.options.regexp.flags
|
146
|
+
}
|
147
|
+
},
|
134
148
|
opt: this.opt,
|
135
149
|
raw: this.isRaw
|
136
150
|
};
|
@@ -341,7 +355,7 @@ function initSchema() {
|
|
341
355
|
union: ops.union,
|
342
356
|
// oneOf,
|
343
357
|
richtext: ops.richtext,
|
344
|
-
image:
|
358
|
+
image: ops.image,
|
345
359
|
literal: ops.literal,
|
346
360
|
keyOf: keyOf,
|
347
361
|
record: ops.record
|
@@ -1562,12 +1576,22 @@ function tryJsonParse(str) {
|
|
1562
1576
|
}
|
1563
1577
|
}
|
1564
1578
|
|
1579
|
+
exports.ArraySchema = ops.ArraySchema;
|
1580
|
+
exports.ImageSchema = ops.ImageSchema;
|
1581
|
+
exports.LiteralSchema = ops.LiteralSchema;
|
1582
|
+
exports.ObjectSchema = ops.ObjectSchema;
|
1583
|
+
exports.RecordSchema = ops.RecordSchema;
|
1584
|
+
exports.RichTextSchema = ops.RichTextSchema;
|
1585
|
+
exports.UnionSchema = ops.UnionSchema;
|
1565
1586
|
exports.FILE_REF_PROP = index.FILE_REF_PROP;
|
1566
1587
|
exports.GenericSelector = index.GenericSelector;
|
1567
1588
|
exports.Schema = index.Schema;
|
1568
1589
|
exports.VAL_EXTENSION = index.VAL_EXTENSION;
|
1569
1590
|
exports.expr = expr_dist_valbuildCoreExpr.index;
|
1591
|
+
exports.BooleanSchema = BooleanSchema;
|
1570
1592
|
exports.Internal = Internal;
|
1593
|
+
exports.NumberSchema = NumberSchema;
|
1594
|
+
exports.StringSchema = StringSchema;
|
1571
1595
|
exports.ValApi = ValApi;
|
1572
1596
|
exports.derefPatch = derefPatch;
|
1573
1597
|
exports.initVal = initVal;
|
@@ -1,7 +1,8 @@
|
|
1
|
-
import { a as array, o as object, u as union, r as richtext$1, l as literal, b as record, c as content, P as PatchError, n as newSelectorProxy, d as createValPathOfItem,
|
2
|
-
|
3
|
-
|
4
|
-
export {
|
1
|
+
import { a as array, o as object, u as union, r as richtext$1, i as image, l as literal, b as record, c as content, P as PatchError, n as newSelectorProxy, d as createValPathOfItem, e as isSelector, g as getSource, f as resolvePath, s as splitModuleIdAndModulePath } from './ops-ffed3406.esm.js';
|
2
|
+
export { A as ArraySchema, I as ImageSchema, L as LiteralSchema, O as ObjectSchema, R as RecordSchema, h as RichTextSchema, U as UnionSchema } from './ops-ffed3406.esm.js';
|
3
|
+
import { _ as _inherits, a as _createSuper, b as _classCallCheck, c as _createClass, d as _defineProperty, e as _typeof, S as Schema, G as GetSchema, g as getValPath, V as VAL_EXTENSION, f as file, h as _slicedToArray, i as isFile, F as FILE_REF_PROP, P as Path, j as GetSource, k as isSerializedVal, l as convertFileSource, m as getSchema, n as isVal } from './index-5750c299.esm.js';
|
4
|
+
export { F as FILE_REF_PROP, o as GenericSelector, S as Schema, V as VAL_EXTENSION } from './index-5750c299.esm.js';
|
5
|
+
export { i as expr } from './index-799bcf49.esm.js';
|
5
6
|
import { _ as _createForOfIteratorHelper, i as isErr, a as isOk, e as err, o as ok, r as result } from './result-b96df128.esm.js';
|
6
7
|
|
7
8
|
var NumberSchema = /*#__PURE__*/function (_Schema) {
|
@@ -76,7 +77,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
76
77
|
_createClass(StringSchema, [{
|
77
78
|
key: "validate",
|
78
79
|
value: function validate(path, src) {
|
79
|
-
var _this$options, _this$options2;
|
80
|
+
var _this$options, _this$options2, _this$options3;
|
80
81
|
if (this.opt && (src === null || src === undefined)) {
|
81
82
|
return false;
|
82
83
|
}
|
@@ -99,6 +100,12 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
99
100
|
value: src
|
100
101
|
});
|
101
102
|
}
|
103
|
+
if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.regexp && !this.options.regexp.test(src)) {
|
104
|
+
errors.push({
|
105
|
+
message: "Expected string to match reg exp: ".concat(this.options.regexp.toString(), ", got '").concat(src, "'"),
|
106
|
+
value: src
|
107
|
+
});
|
108
|
+
}
|
102
109
|
if (errors.length > 0) {
|
103
110
|
return _defineProperty({}, path, errors);
|
104
111
|
}
|
@@ -125,9 +132,17 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
125
132
|
}, {
|
126
133
|
key: "serialize",
|
127
134
|
value: function serialize() {
|
135
|
+
var _this$options4, _this$options5, _this$options6;
|
128
136
|
return {
|
129
137
|
type: "string",
|
130
|
-
options:
|
138
|
+
options: {
|
139
|
+
maxLength: (_this$options4 = this.options) === null || _this$options4 === void 0 ? void 0 : _this$options4.maxLength,
|
140
|
+
minLength: (_this$options5 = this.options) === null || _this$options5 === void 0 ? void 0 : _this$options5.minLength,
|
141
|
+
regexp: ((_this$options6 = this.options) === null || _this$options6 === void 0 ? void 0 : _this$options6.regexp) && {
|
142
|
+
source: this.options.regexp.source,
|
143
|
+
flags: this.options.regexp.flags
|
144
|
+
}
|
145
|
+
},
|
131
146
|
opt: this.opt,
|
132
147
|
raw: this.isRaw
|
133
148
|
};
|
@@ -1559,4 +1574,4 @@ function tryJsonParse(str) {
|
|
1559
1574
|
}
|
1560
1575
|
}
|
1561
1576
|
|
1562
|
-
export { Internal, ValApi, derefPatch, initVal };
|
1577
|
+
export { BooleanSchema, Internal, NumberSchema, StringSchema, ValApi, derefPatch, initVal };
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var expr_dist_valbuildCoreExpr = require('../../dist/index-
|
6
|
-
var index = require('../../dist/index-
|
5
|
+
var expr_dist_valbuildCoreExpr = require('../../dist/index-00276955.cjs.dev.js');
|
6
|
+
var index = require('../../dist/index-d23e237a.cjs.dev.js');
|
7
7
|
require('../../dist/result-48320acd.cjs.dev.js');
|
8
8
|
|
9
9
|
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var expr_dist_valbuildCoreExpr = require('../../dist/index-
|
6
|
-
var index = require('../../dist/index-
|
5
|
+
var expr_dist_valbuildCoreExpr = require('../../dist/index-db60fc1d.cjs.prod.js');
|
6
|
+
var index = require('../../dist/index-7b467ee6.cjs.prod.js');
|
7
7
|
require('../../dist/result-26f67b40.cjs.prod.js');
|
8
8
|
|
9
9
|
|
@@ -1,3 +1,3 @@
|
|
1
|
-
export { e as evaluate, p as parse } from '../../dist/index-
|
2
|
-
export { C as Call, E as Expr, N as NilSym,
|
1
|
+
export { e as evaluate, p as parse } from '../../dist/index-799bcf49.esm.js';
|
2
|
+
export { C as Call, E as Expr, N as NilSym, r as StringLiteral, s as StringTemplate, q as Sym } from '../../dist/index-5750c299.esm.js';
|
3
3
|
import '../../dist/result-b96df128.esm.js';
|
package/package.json
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var index = require('../../dist/index-
|
5
|
+
var index = require('../../dist/index-d23e237a.cjs.dev.js');
|
6
6
|
var result = require('../../dist/result-48320acd.cjs.dev.js');
|
7
7
|
var util = require('../../dist/util-b213092b.cjs.dev.js');
|
8
|
-
var ops = require('../../dist/ops-
|
8
|
+
var ops = require('../../dist/ops-74e62ffe.cjs.dev.js');
|
9
9
|
|
10
10
|
function isNotRoot(path) {
|
11
11
|
return result.isNonEmpty(path);
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var index = require('../../dist/index-
|
5
|
+
var index = require('../../dist/index-7b467ee6.cjs.prod.js');
|
6
6
|
var result = require('../../dist/result-26f67b40.cjs.prod.js');
|
7
7
|
var util = require('../../dist/util-030d8a1f.cjs.prod.js');
|
8
|
-
var ops = require('../../dist/ops-
|
8
|
+
var ops = require('../../dist/ops-c0e7e3a8.cjs.prod.js');
|
9
9
|
|
10
10
|
function isNotRoot(path) {
|
11
11
|
return result.isNonEmpty(path);
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import { e as _typeof, h as _slicedToArray, c as _createClass, b as _classCallCheck,
|
1
|
+
import { e as _typeof, h as _slicedToArray, c as _createClass, b as _classCallCheck, t as _toConsumableArray } from '../../dist/index-5750c299.esm.js';
|
2
2
|
import { f as isNonEmpty, e as err, o as ok, m as map, g as flatMap, i as isErr, h as flatMapReduce, j as filterOrElse, k as mapErr, l as map$1, n as all, p as flatten, q as allT } from '../../dist/result-b96df128.esm.js';
|
3
3
|
import { p as pipe } from '../../dist/util-18613e99.esm.js';
|
4
|
-
import { P as PatchError, s as splitModuleIdAndModulePath } from '../../dist/ops-
|
5
|
-
export { P as PatchError } from '../../dist/ops-
|
4
|
+
import { P as PatchError, s as splitModuleIdAndModulePath } from '../../dist/ops-ffed3406.esm.js';
|
5
|
+
export { P as PatchError } from '../../dist/ops-ffed3406.esm.js';
|
6
6
|
|
7
7
|
function isNotRoot(path) {
|
8
8
|
return isNonEmpty(path);
|