@valbuild/core 0.45.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 +10 -10
- package/dist/declarations/src/initSchema.d.ts +1 -0
- package/dist/declarations/src/initVal.d.ts +1 -0
- package/dist/declarations/src/schema/string.d.ts +9 -1
- package/dist/{ops-453cddfc.cjs.dev.js → ops-74e62ffe.cjs.dev.js} +7 -0
- package/dist/{ops-18aded72.cjs.prod.js → ops-c0e7e3a8.cjs.prod.js} +7 -0
- package/dist/{ops-117cb796.esm.js → ops-ffed3406.esm.js} +1 -1
- package/dist/valbuild-core.cjs.dev.js +27 -3
- package/dist/valbuild-core.cjs.prod.js +27 -3
- package/dist/valbuild-core.esm.js +19 -4
- 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
@@ -29,16 +29,16 @@ import type { Json } from "./Json.js";
|
|
29
29
|
import { SerializedSchema } from "./schema/index.js";
|
30
30
|
import { PatchJSON } from "./patch/index.js";
|
31
31
|
export { ValApi } from "./ValApi.js";
|
32
|
-
export type
|
33
|
-
export type
|
34
|
-
export type
|
35
|
-
export type
|
36
|
-
export type
|
37
|
-
export type
|
38
|
-
export type
|
39
|
-
export type
|
40
|
-
export type
|
41
|
-
export type
|
32
|
+
export { type SerializedArraySchema, ArraySchema } from "./schema/array.js";
|
33
|
+
export { type SerializedObjectSchema, ObjectSchema } from "./schema/object.js";
|
34
|
+
export { type SerializedRecordSchema, RecordSchema } from "./schema/record.js";
|
35
|
+
export { type SerializedStringSchema, StringSchema } from "./schema/string.js";
|
36
|
+
export { type SerializedNumberSchema, NumberSchema } from "./schema/number.js";
|
37
|
+
export { type SerializedBooleanSchema, BooleanSchema } from "./schema/boolean.js";
|
38
|
+
export { type SerializedImageSchema, ImageSchema } from "./schema/image.js";
|
39
|
+
export { type SerializedRichTextSchema, RichTextSchema, } from "./schema/richtext.js";
|
40
|
+
export { type SerializedUnionSchema, UnionSchema } from "./schema/union.js";
|
41
|
+
export { type SerializedLiteralSchema, LiteralSchema } from "./schema/literal.js";
|
42
42
|
export type ApiCommitResponse = {
|
43
43
|
modules: Record<ModuleId, {
|
44
44
|
patches: {
|
@@ -26,6 +26,7 @@ export declare function initSchema(): {
|
|
26
26
|
string: <T extends string>(options?: {
|
27
27
|
maxLength?: number | undefined;
|
28
28
|
minLength?: number | undefined;
|
29
|
+
regexp?: RegExp | undefined;
|
29
30
|
} | undefined) => import("./schema/string.js").StringSchema<T>;
|
30
31
|
boolean: () => import("./schema/index.js").Schema<boolean>;
|
31
32
|
array: <S extends import("./schema/index.js").Schema<import("./selector/index.js").SelectorSource>>(schema: S) => import("./schema/index.js").Schema<import("./schema/index.js").SelectorOfSchema<S>[]>;
|
@@ -4,10 +4,18 @@ import { ValidationErrors } from "./validation/ValidationError.js";
|
|
4
4
|
type StringOptions = {
|
5
5
|
maxLength?: number;
|
6
6
|
minLength?: number;
|
7
|
+
regexp?: RegExp;
|
7
8
|
};
|
8
9
|
export type SerializedStringSchema = {
|
9
10
|
type: "string";
|
10
|
-
options?:
|
11
|
+
options?: {
|
12
|
+
maxLength?: number;
|
13
|
+
minLength?: number;
|
14
|
+
regexp?: {
|
15
|
+
source: string;
|
16
|
+
flags: string;
|
17
|
+
};
|
18
|
+
};
|
11
19
|
opt: boolean;
|
12
20
|
raw: boolean;
|
13
21
|
};
|
@@ -1047,7 +1047,14 @@ var PatchError = /*#__PURE__*/index._createClass(function PatchError(message) {
|
|
1047
1047
|
* NOTE: MAY mutate the input document.
|
1048
1048
|
*/
|
1049
1049
|
|
1050
|
+
exports.ArraySchema = ArraySchema;
|
1051
|
+
exports.ImageSchema = ImageSchema;
|
1052
|
+
exports.LiteralSchema = LiteralSchema;
|
1053
|
+
exports.ObjectSchema = ObjectSchema;
|
1050
1054
|
exports.PatchError = PatchError;
|
1055
|
+
exports.RecordSchema = RecordSchema;
|
1056
|
+
exports.RichTextSchema = RichTextSchema;
|
1057
|
+
exports.UnionSchema = UnionSchema;
|
1051
1058
|
exports.array = array;
|
1052
1059
|
exports.content = content;
|
1053
1060
|
exports.createValPathOfItem = createValPathOfItem;
|
@@ -1047,7 +1047,14 @@ var PatchError = /*#__PURE__*/index._createClass(function PatchError(message) {
|
|
1047
1047
|
* NOTE: MAY mutate the input document.
|
1048
1048
|
*/
|
1049
1049
|
|
1050
|
+
exports.ArraySchema = ArraySchema;
|
1051
|
+
exports.ImageSchema = ImageSchema;
|
1052
|
+
exports.LiteralSchema = LiteralSchema;
|
1053
|
+
exports.ObjectSchema = ObjectSchema;
|
1050
1054
|
exports.PatchError = PatchError;
|
1055
|
+
exports.RecordSchema = RecordSchema;
|
1056
|
+
exports.RichTextSchema = RichTextSchema;
|
1057
|
+
exports.UnionSchema = UnionSchema;
|
1051
1058
|
exports.array = array;
|
1052
1059
|
exports.content = content;
|
1053
1060
|
exports.createValPathOfItem = createValPathOfItem;
|
@@ -1045,4 +1045,4 @@ var PatchError = /*#__PURE__*/_createClass(function PatchError(message) {
|
|
1045
1045
|
* NOTE: MAY mutate the input document.
|
1046
1046
|
*/
|
1047
1047
|
|
1048
|
-
export { PatchError as P, array as a, record as b, content as c, createValPathOfItem as d, isSelector as e, resolvePath as f, getSource as g, image as i, literal as l, newSelectorProxy as n, object as o, richtext as r, splitModuleIdAndModulePath as s, union as u };
|
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,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var ops = require('./ops-
|
5
|
+
var ops = require('./ops-74e62ffe.cjs.dev.js');
|
6
6
|
var index = require('./index-d23e237a.cjs.dev.js');
|
7
7
|
var expr_dist_valbuildCoreExpr = require('./index-00276955.cjs.dev.js');
|
8
8
|
var result = require('./result-48320acd.cjs.dev.js');
|
@@ -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
|
};
|
@@ -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,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var ops = require('./ops-
|
5
|
+
var ops = require('./ops-c0e7e3a8.cjs.prod.js');
|
6
6
|
var index = require('./index-7b467ee6.cjs.prod.js');
|
7
7
|
var expr_dist_valbuildCoreExpr = require('./index-db60fc1d.cjs.prod.js');
|
8
8
|
var result = require('./result-26f67b40.cjs.prod.js');
|
@@ -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
|
};
|
@@ -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,4 +1,5 @@
|
|
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-
|
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';
|
2
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';
|
3
4
|
export { F as FILE_REF_PROP, o as GenericSelector, S as Schema, V as VAL_EXTENSION } from './index-5750c299.esm.js';
|
4
5
|
export { i as expr } from './index-799bcf49.esm.js';
|
@@ -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 };
|
package/package.json
CHANGED
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
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);
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
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
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);
|