@valbuild/core 0.97.4 → 0.97.7
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/schema/index.d.ts +9 -0
- package/dist/declarations/src/schema/router.d.ts +2 -1
- package/dist/{index-30ac56b6.cjs.prod.js → index-139e0a7d.cjs.prod.js} +41 -35
- package/dist/{index-a169d6a7.cjs.dev.js → index-24fcc47f.cjs.dev.js} +41 -35
- package/dist/{index-6aa8e224.esm.js → index-802570f7.esm.js} +41 -35
- package/dist/valbuild-core.cjs.dev.js +1 -1
- package/dist/valbuild-core.cjs.prod.js +1 -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
|
@@ -86,6 +86,15 @@ export declare abstract class Schema<Src extends SelectorSource> {
|
|
|
86
86
|
protected abstract executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src): ReifiedRender;
|
|
87
87
|
/** MUTATES! since internal and perf sensitive */
|
|
88
88
|
protected appendValidationError(current: ValidationErrors, path: SourcePath, message: string, value: unknown, schemaError?: boolean): ValidationErrors;
|
|
89
|
+
/**
|
|
90
|
+
* Merges two sets of validation errors path-wise: errors on the same path are
|
|
91
|
+
* concatenated, not overwritten. Object spread cannot be used for this, since
|
|
92
|
+
* it replaces the array of the colliding path. A record, for example, validates
|
|
93
|
+
* the key and the item on the same path, so both sets must survive.
|
|
94
|
+
*
|
|
95
|
+
* MUTATES! since internal and perf sensitive
|
|
96
|
+
*/
|
|
97
|
+
protected mergeValidationErrors(current: ValidationErrors, incoming: ValidationErrors): ValidationErrors;
|
|
89
98
|
}
|
|
90
99
|
export type SelectorOfSchema<T extends Schema<SelectorSource>> = T extends Schema<infer Src> ? Src : never;
|
|
91
100
|
export {};
|
|
@@ -2,4 +2,5 @@ import { Schema, SelectorOfSchema } from "./index.js";
|
|
|
2
2
|
import { ValRouter } from "../router.js";
|
|
3
3
|
import { SelectorSource } from "../selector/index.js";
|
|
4
4
|
import { RecordSchema } from "./record.js";
|
|
5
|
-
export declare function router<
|
|
5
|
+
export declare function router<K extends Schema<string>, T extends Schema<SelectorSource>>(router: ValRouter, key: K, item: T): RecordSchema<T, K, Record<SelectorOfSchema<K>, SelectorOfSchema<T>>>;
|
|
6
|
+
export declare function router<T extends Schema<SelectorSource>>(router: ValRouter, item: T): RecordSchema<T, Schema<string>, Record<string, SelectorOfSchema<T>>>;
|
|
@@ -222,6 +222,34 @@ var Schema = /*#__PURE__*/function () {
|
|
|
222
222
|
}]);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Merges two sets of validation errors path-wise: errors on the same path are
|
|
228
|
+
* concatenated, not overwritten. Object spread cannot be used for this, since
|
|
229
|
+
* it replaces the array of the colliding path. A record, for example, validates
|
|
230
|
+
* the key and the item on the same path, so both sets must survive.
|
|
231
|
+
*
|
|
232
|
+
* MUTATES! since internal and perf sensitive
|
|
233
|
+
*/
|
|
234
|
+
}, {
|
|
235
|
+
key: "mergeValidationErrors",
|
|
236
|
+
value: function mergeValidationErrors(current, incoming) {
|
|
237
|
+
if (!incoming) {
|
|
238
|
+
return current;
|
|
239
|
+
}
|
|
240
|
+
if (!current) {
|
|
241
|
+
return incoming;
|
|
242
|
+
}
|
|
243
|
+
for (var pathS in incoming) {
|
|
244
|
+
var _path = pathS;
|
|
245
|
+
if (current[_path]) {
|
|
246
|
+
current[_path] = current[_path].concat(incoming[_path]);
|
|
247
|
+
} else {
|
|
248
|
+
current[_path] = incoming[_path];
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return current;
|
|
252
|
+
}
|
|
225
253
|
}]);
|
|
226
254
|
}();
|
|
227
255
|
|
|
@@ -1007,11 +1035,7 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1007
1035
|
src);
|
|
1008
1036
|
} else {
|
|
1009
1037
|
var subError = schema["executeValidate"](subPath, src[_key]);
|
|
1010
|
-
|
|
1011
|
-
error = _objectSpread2(_objectSpread2({}, subError), error);
|
|
1012
|
-
} else if (subError) {
|
|
1013
|
-
error = subError;
|
|
1014
|
-
}
|
|
1038
|
+
error = this.mergeValidationErrors(error, subError);
|
|
1015
1039
|
}
|
|
1016
1040
|
}
|
|
1017
1041
|
return error;
|
|
@@ -1185,7 +1209,7 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1185
1209
|
if (assertRes.data === null) {
|
|
1186
1210
|
return false;
|
|
1187
1211
|
}
|
|
1188
|
-
var error =
|
|
1212
|
+
var error = false;
|
|
1189
1213
|
for (var _i = 0, _Object$entries = Object.entries(assertRes.data); _i < _Object$entries.length; _i++) {
|
|
1190
1214
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
1191
1215
|
idx = _Object$entries$_i[0],
|
|
@@ -1193,12 +1217,7 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1193
1217
|
var subPath = unsafeCreateSourcePath(path, Number(idx));
|
|
1194
1218
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1195
1219
|
var subError = this.item["executeValidate"](subPath, i);
|
|
1196
|
-
|
|
1197
|
-
error = _objectSpread2(_objectSpread2({}, subError), error);
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
if (Object.keys(error).length === 0) {
|
|
1201
|
-
return false;
|
|
1220
|
+
error = this.mergeValidationErrors(error, subError);
|
|
1202
1221
|
}
|
|
1203
1222
|
return error;
|
|
1204
1223
|
}
|
|
@@ -2981,9 +3000,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2981
3000
|
}]));
|
|
2982
3001
|
}
|
|
2983
3002
|
var routerValidations = this.getRouterValidations(path, src);
|
|
2984
|
-
|
|
2985
|
-
return routerValidations;
|
|
2986
|
-
}
|
|
3003
|
+
error = this.mergeValidationErrors(error, routerValidations);
|
|
2987
3004
|
var _iterator = result._createForOfIteratorHelper(customValidationErrors),
|
|
2988
3005
|
_step;
|
|
2989
3006
|
try {
|
|
@@ -3047,15 +3064,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3047
3064
|
keyError: true
|
|
3048
3065
|
});
|
|
3049
3066
|
});
|
|
3050
|
-
|
|
3051
|
-
if (error[keyPath]) {
|
|
3052
|
-
error[keyPath] = [].concat(_toConsumableArray(error[keyPath]), _toConsumableArray(keyError[keyPath]));
|
|
3053
|
-
} else {
|
|
3054
|
-
error[keyPath] = keyError[keyPath];
|
|
3055
|
-
}
|
|
3056
|
-
} else {
|
|
3057
|
-
error = keyError;
|
|
3058
|
-
}
|
|
3067
|
+
error = _this2.mergeValidationErrors(error, keyError);
|
|
3059
3068
|
}
|
|
3060
3069
|
}
|
|
3061
3070
|
var subPath = createValPathOfItem(path, key);
|
|
@@ -3070,20 +3079,16 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3070
3079
|
var keyErr = _this2.validateMediaKey(subPath, key);
|
|
3071
3080
|
if (keyErr) {
|
|
3072
3081
|
_this2.markKeyErrorsAtPath(keyErr, subPath);
|
|
3073
|
-
error = error ? _objectSpread2(_objectSpread2({}, error), keyErr) : keyErr;
|
|
3074
3082
|
}
|
|
3083
|
+
error = _this2.mergeValidationErrors(error, keyErr);
|
|
3075
3084
|
var entryErr = _this2.validateMediaEntry(subPath, elem);
|
|
3076
3085
|
if (entryErr) {
|
|
3077
3086
|
_this2.markKeyErrorsAtPath(entryErr, subPath);
|
|
3078
|
-
error = error ? _objectSpread2(_objectSpread2({}, error), entryErr) : entryErr;
|
|
3079
3087
|
}
|
|
3088
|
+
error = _this2.mergeValidationErrors(error, entryErr);
|
|
3080
3089
|
} else {
|
|
3081
3090
|
var subError = _this2.item["executeValidate"](subPath, elem);
|
|
3082
|
-
|
|
3083
|
-
error = _objectSpread2(_objectSpread2({}, subError), error);
|
|
3084
|
-
} else if (subError) {
|
|
3085
|
-
error = subError;
|
|
3086
|
-
}
|
|
3091
|
+
error = _this2.mergeValidationErrors(error, subError);
|
|
3087
3092
|
}
|
|
3088
3093
|
});
|
|
3089
3094
|
return error;
|
|
@@ -4907,10 +4912,11 @@ var datetime = function datetime(options) {
|
|
|
4907
4912
|
return new DateTimeSchema(options);
|
|
4908
4913
|
};
|
|
4909
4914
|
|
|
4910
|
-
function router(router,
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4915
|
+
function router(router, keyOrItem, maybeItem) {
|
|
4916
|
+
if (maybeItem) {
|
|
4917
|
+
return new RecordSchema(maybeItem, false, [], router, keyOrItem);
|
|
4918
|
+
}
|
|
4919
|
+
return new RecordSchema(keyOrItem, false, [], router, string());
|
|
4914
4920
|
}
|
|
4915
4921
|
|
|
4916
4922
|
/**
|
|
@@ -222,6 +222,34 @@ var Schema = /*#__PURE__*/function () {
|
|
|
222
222
|
}]);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Merges two sets of validation errors path-wise: errors on the same path are
|
|
228
|
+
* concatenated, not overwritten. Object spread cannot be used for this, since
|
|
229
|
+
* it replaces the array of the colliding path. A record, for example, validates
|
|
230
|
+
* the key and the item on the same path, so both sets must survive.
|
|
231
|
+
*
|
|
232
|
+
* MUTATES! since internal and perf sensitive
|
|
233
|
+
*/
|
|
234
|
+
}, {
|
|
235
|
+
key: "mergeValidationErrors",
|
|
236
|
+
value: function mergeValidationErrors(current, incoming) {
|
|
237
|
+
if (!incoming) {
|
|
238
|
+
return current;
|
|
239
|
+
}
|
|
240
|
+
if (!current) {
|
|
241
|
+
return incoming;
|
|
242
|
+
}
|
|
243
|
+
for (var pathS in incoming) {
|
|
244
|
+
var _path = pathS;
|
|
245
|
+
if (current[_path]) {
|
|
246
|
+
current[_path] = current[_path].concat(incoming[_path]);
|
|
247
|
+
} else {
|
|
248
|
+
current[_path] = incoming[_path];
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return current;
|
|
252
|
+
}
|
|
225
253
|
}]);
|
|
226
254
|
}();
|
|
227
255
|
|
|
@@ -1007,11 +1035,7 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1007
1035
|
src);
|
|
1008
1036
|
} else {
|
|
1009
1037
|
var subError = schema["executeValidate"](subPath, src[_key]);
|
|
1010
|
-
|
|
1011
|
-
error = _objectSpread2(_objectSpread2({}, subError), error);
|
|
1012
|
-
} else if (subError) {
|
|
1013
|
-
error = subError;
|
|
1014
|
-
}
|
|
1038
|
+
error = this.mergeValidationErrors(error, subError);
|
|
1015
1039
|
}
|
|
1016
1040
|
}
|
|
1017
1041
|
return error;
|
|
@@ -1185,7 +1209,7 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1185
1209
|
if (assertRes.data === null) {
|
|
1186
1210
|
return false;
|
|
1187
1211
|
}
|
|
1188
|
-
var error =
|
|
1212
|
+
var error = false;
|
|
1189
1213
|
for (var _i = 0, _Object$entries = Object.entries(assertRes.data); _i < _Object$entries.length; _i++) {
|
|
1190
1214
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
1191
1215
|
idx = _Object$entries$_i[0],
|
|
@@ -1193,12 +1217,7 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1193
1217
|
var subPath = unsafeCreateSourcePath(path, Number(idx));
|
|
1194
1218
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1195
1219
|
var subError = this.item["executeValidate"](subPath, i);
|
|
1196
|
-
|
|
1197
|
-
error = _objectSpread2(_objectSpread2({}, subError), error);
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
if (Object.keys(error).length === 0) {
|
|
1201
|
-
return false;
|
|
1220
|
+
error = this.mergeValidationErrors(error, subError);
|
|
1202
1221
|
}
|
|
1203
1222
|
return error;
|
|
1204
1223
|
}
|
|
@@ -2981,9 +3000,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2981
3000
|
}]));
|
|
2982
3001
|
}
|
|
2983
3002
|
var routerValidations = this.getRouterValidations(path, src);
|
|
2984
|
-
|
|
2985
|
-
return routerValidations;
|
|
2986
|
-
}
|
|
3003
|
+
error = this.mergeValidationErrors(error, routerValidations);
|
|
2987
3004
|
var _iterator = result._createForOfIteratorHelper(customValidationErrors),
|
|
2988
3005
|
_step;
|
|
2989
3006
|
try {
|
|
@@ -3047,15 +3064,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3047
3064
|
keyError: true
|
|
3048
3065
|
});
|
|
3049
3066
|
});
|
|
3050
|
-
|
|
3051
|
-
if (error[keyPath]) {
|
|
3052
|
-
error[keyPath] = [].concat(_toConsumableArray(error[keyPath]), _toConsumableArray(keyError[keyPath]));
|
|
3053
|
-
} else {
|
|
3054
|
-
error[keyPath] = keyError[keyPath];
|
|
3055
|
-
}
|
|
3056
|
-
} else {
|
|
3057
|
-
error = keyError;
|
|
3058
|
-
}
|
|
3067
|
+
error = _this2.mergeValidationErrors(error, keyError);
|
|
3059
3068
|
}
|
|
3060
3069
|
}
|
|
3061
3070
|
var subPath = createValPathOfItem(path, key);
|
|
@@ -3070,20 +3079,16 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3070
3079
|
var keyErr = _this2.validateMediaKey(subPath, key);
|
|
3071
3080
|
if (keyErr) {
|
|
3072
3081
|
_this2.markKeyErrorsAtPath(keyErr, subPath);
|
|
3073
|
-
error = error ? _objectSpread2(_objectSpread2({}, error), keyErr) : keyErr;
|
|
3074
3082
|
}
|
|
3083
|
+
error = _this2.mergeValidationErrors(error, keyErr);
|
|
3075
3084
|
var entryErr = _this2.validateMediaEntry(subPath, elem);
|
|
3076
3085
|
if (entryErr) {
|
|
3077
3086
|
_this2.markKeyErrorsAtPath(entryErr, subPath);
|
|
3078
|
-
error = error ? _objectSpread2(_objectSpread2({}, error), entryErr) : entryErr;
|
|
3079
3087
|
}
|
|
3088
|
+
error = _this2.mergeValidationErrors(error, entryErr);
|
|
3080
3089
|
} else {
|
|
3081
3090
|
var subError = _this2.item["executeValidate"](subPath, elem);
|
|
3082
|
-
|
|
3083
|
-
error = _objectSpread2(_objectSpread2({}, subError), error);
|
|
3084
|
-
} else if (subError) {
|
|
3085
|
-
error = subError;
|
|
3086
|
-
}
|
|
3091
|
+
error = _this2.mergeValidationErrors(error, subError);
|
|
3087
3092
|
}
|
|
3088
3093
|
});
|
|
3089
3094
|
return error;
|
|
@@ -4907,10 +4912,11 @@ var datetime = function datetime(options) {
|
|
|
4907
4912
|
return new DateTimeSchema(options);
|
|
4908
4913
|
};
|
|
4909
4914
|
|
|
4910
|
-
function router(router,
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4915
|
+
function router(router, keyOrItem, maybeItem) {
|
|
4916
|
+
if (maybeItem) {
|
|
4917
|
+
return new RecordSchema(maybeItem, false, [], router, keyOrItem);
|
|
4918
|
+
}
|
|
4919
|
+
return new RecordSchema(keyOrItem, false, [], router, string());
|
|
4914
4920
|
}
|
|
4915
4921
|
|
|
4916
4922
|
/**
|
|
@@ -220,6 +220,34 @@ var Schema = /*#__PURE__*/function () {
|
|
|
220
220
|
}]);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Merges two sets of validation errors path-wise: errors on the same path are
|
|
226
|
+
* concatenated, not overwritten. Object spread cannot be used for this, since
|
|
227
|
+
* it replaces the array of the colliding path. A record, for example, validates
|
|
228
|
+
* the key and the item on the same path, so both sets must survive.
|
|
229
|
+
*
|
|
230
|
+
* MUTATES! since internal and perf sensitive
|
|
231
|
+
*/
|
|
232
|
+
}, {
|
|
233
|
+
key: "mergeValidationErrors",
|
|
234
|
+
value: function mergeValidationErrors(current, incoming) {
|
|
235
|
+
if (!incoming) {
|
|
236
|
+
return current;
|
|
237
|
+
}
|
|
238
|
+
if (!current) {
|
|
239
|
+
return incoming;
|
|
240
|
+
}
|
|
241
|
+
for (var pathS in incoming) {
|
|
242
|
+
var _path = pathS;
|
|
243
|
+
if (current[_path]) {
|
|
244
|
+
current[_path] = current[_path].concat(incoming[_path]);
|
|
245
|
+
} else {
|
|
246
|
+
current[_path] = incoming[_path];
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return current;
|
|
250
|
+
}
|
|
223
251
|
}]);
|
|
224
252
|
}();
|
|
225
253
|
|
|
@@ -1005,11 +1033,7 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1005
1033
|
src);
|
|
1006
1034
|
} else {
|
|
1007
1035
|
var subError = schema["executeValidate"](subPath, src[_key]);
|
|
1008
|
-
|
|
1009
|
-
error = _objectSpread2(_objectSpread2({}, subError), error);
|
|
1010
|
-
} else if (subError) {
|
|
1011
|
-
error = subError;
|
|
1012
|
-
}
|
|
1036
|
+
error = this.mergeValidationErrors(error, subError);
|
|
1013
1037
|
}
|
|
1014
1038
|
}
|
|
1015
1039
|
return error;
|
|
@@ -1183,7 +1207,7 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1183
1207
|
if (assertRes.data === null) {
|
|
1184
1208
|
return false;
|
|
1185
1209
|
}
|
|
1186
|
-
var error =
|
|
1210
|
+
var error = false;
|
|
1187
1211
|
for (var _i = 0, _Object$entries = Object.entries(assertRes.data); _i < _Object$entries.length; _i++) {
|
|
1188
1212
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
1189
1213
|
idx = _Object$entries$_i[0],
|
|
@@ -1191,12 +1215,7 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1191
1215
|
var subPath = unsafeCreateSourcePath(path, Number(idx));
|
|
1192
1216
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1193
1217
|
var subError = this.item["executeValidate"](subPath, i);
|
|
1194
|
-
|
|
1195
|
-
error = _objectSpread2(_objectSpread2({}, subError), error);
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
if (Object.keys(error).length === 0) {
|
|
1199
|
-
return false;
|
|
1218
|
+
error = this.mergeValidationErrors(error, subError);
|
|
1200
1219
|
}
|
|
1201
1220
|
return error;
|
|
1202
1221
|
}
|
|
@@ -2979,9 +2998,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2979
2998
|
}]));
|
|
2980
2999
|
}
|
|
2981
3000
|
var routerValidations = this.getRouterValidations(path, src);
|
|
2982
|
-
|
|
2983
|
-
return routerValidations;
|
|
2984
|
-
}
|
|
3001
|
+
error = this.mergeValidationErrors(error, routerValidations);
|
|
2985
3002
|
var _iterator = _createForOfIteratorHelper(customValidationErrors),
|
|
2986
3003
|
_step;
|
|
2987
3004
|
try {
|
|
@@ -3045,15 +3062,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3045
3062
|
keyError: true
|
|
3046
3063
|
});
|
|
3047
3064
|
});
|
|
3048
|
-
|
|
3049
|
-
if (error[keyPath]) {
|
|
3050
|
-
error[keyPath] = [].concat(_toConsumableArray(error[keyPath]), _toConsumableArray(keyError[keyPath]));
|
|
3051
|
-
} else {
|
|
3052
|
-
error[keyPath] = keyError[keyPath];
|
|
3053
|
-
}
|
|
3054
|
-
} else {
|
|
3055
|
-
error = keyError;
|
|
3056
|
-
}
|
|
3065
|
+
error = _this2.mergeValidationErrors(error, keyError);
|
|
3057
3066
|
}
|
|
3058
3067
|
}
|
|
3059
3068
|
var subPath = createValPathOfItem(path, key);
|
|
@@ -3068,20 +3077,16 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3068
3077
|
var keyErr = _this2.validateMediaKey(subPath, key);
|
|
3069
3078
|
if (keyErr) {
|
|
3070
3079
|
_this2.markKeyErrorsAtPath(keyErr, subPath);
|
|
3071
|
-
error = error ? _objectSpread2(_objectSpread2({}, error), keyErr) : keyErr;
|
|
3072
3080
|
}
|
|
3081
|
+
error = _this2.mergeValidationErrors(error, keyErr);
|
|
3073
3082
|
var entryErr = _this2.validateMediaEntry(subPath, elem);
|
|
3074
3083
|
if (entryErr) {
|
|
3075
3084
|
_this2.markKeyErrorsAtPath(entryErr, subPath);
|
|
3076
|
-
error = error ? _objectSpread2(_objectSpread2({}, error), entryErr) : entryErr;
|
|
3077
3085
|
}
|
|
3086
|
+
error = _this2.mergeValidationErrors(error, entryErr);
|
|
3078
3087
|
} else {
|
|
3079
3088
|
var subError = _this2.item["executeValidate"](subPath, elem);
|
|
3080
|
-
|
|
3081
|
-
error = _objectSpread2(_objectSpread2({}, subError), error);
|
|
3082
|
-
} else if (subError) {
|
|
3083
|
-
error = subError;
|
|
3084
|
-
}
|
|
3089
|
+
error = _this2.mergeValidationErrors(error, subError);
|
|
3085
3090
|
}
|
|
3086
3091
|
});
|
|
3087
3092
|
return error;
|
|
@@ -4905,10 +4910,11 @@ var datetime = function datetime(options) {
|
|
|
4905
4910
|
return new DateTimeSchema(options);
|
|
4906
4911
|
};
|
|
4907
4912
|
|
|
4908
|
-
function router(router,
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4913
|
+
function router(router, keyOrItem, maybeItem) {
|
|
4914
|
+
if (maybeItem) {
|
|
4915
|
+
return new RecordSchema(maybeItem, false, [], router, keyOrItem);
|
|
4916
|
+
}
|
|
4917
|
+
return new RecordSchema(keyOrItem, false, [], router, string());
|
|
4912
4918
|
}
|
|
4913
4919
|
|
|
4914
4920
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as ArraySchema, B as BooleanSchema, e as DEFAULT_APP_HOST, D as DEFAULT_CONTENT_HOST, g as DEFAULT_VAL_REMOTE_HOST, p as DateSchema, q as DateTimeSchema, F as FATAL_ERROR_TYPES, h as FILE_REF_PROP, j as FILE_REF_SUBTYPE_TAG, o as FileSchema, G as GenericSelector, n as ImageSchema, I as Internal, K as KeyOfSchema, L as LiteralSchema, M as ModuleFilePathSep, N as NumberSchema, O as ObjectSchema, R as RecordSchema, t as RichTextSchema, r as RouteSchema, S as Schema, l as StringSchema, U as UnionSchema, V as VAL_EXTENSION, k as derefPatch, u as deserializeSchema, f as extractValModules, v as getSourcePathFromRoute, i as initVal, m as modules } from './index-
|
|
1
|
+
export { A as ArraySchema, B as BooleanSchema, e as DEFAULT_APP_HOST, D as DEFAULT_CONTENT_HOST, g as DEFAULT_VAL_REMOTE_HOST, p as DateSchema, q as DateTimeSchema, F as FATAL_ERROR_TYPES, h as FILE_REF_PROP, j as FILE_REF_SUBTYPE_TAG, o as FileSchema, G as GenericSelector, n as ImageSchema, I as Internal, K as KeyOfSchema, L as LiteralSchema, M as ModuleFilePathSep, N as NumberSchema, O as ObjectSchema, R as RecordSchema, t as RichTextSchema, r as RouteSchema, S as Schema, l as StringSchema, U as UnionSchema, V as VAL_EXTENSION, k as derefPatch, u as deserializeSchema, f as extractValModules, v as getSourcePathFromRoute, i as initVal, m as modules } from './index-802570f7.esm.js';
|
|
2
2
|
import './result-4bd63123.esm.js';
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dist_valbuildCore = require('../../dist/index-
|
|
5
|
+
var dist_valbuildCore = require('../../dist/index-24fcc47f.cjs.dev.js');
|
|
6
6
|
var result = require('../../dist/result-bb1f436e.cjs.dev.js');
|
|
7
7
|
var util = require('../../dist/util-b213092b.cjs.dev.js');
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dist_valbuildCore = require('../../dist/index-
|
|
5
|
+
var dist_valbuildCore = require('../../dist/index-139e0a7d.cjs.prod.js');
|
|
6
6
|
var result = require('../../dist/result-787e35f6.cjs.prod.js');
|
|
7
7
|
var util = require('../../dist/util-030d8a1f.cjs.prod.js');
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as _typeof, a as _slicedToArray, P as PatchError, s as splitModuleFilePathAndModulePath, b as _createClass, c as _classCallCheck, d as _toConsumableArray } from '../../dist/index-
|
|
2
|
-
export { P as PatchError } from '../../dist/index-
|
|
1
|
+
import { _ as _typeof, a as _slicedToArray, P as PatchError, s as splitModuleFilePathAndModulePath, b as _createClass, c as _classCallCheck, d as _toConsumableArray } from '../../dist/index-802570f7.esm.js';
|
|
2
|
+
export { P as PatchError } from '../../dist/index-802570f7.esm.js';
|
|
3
3
|
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-4bd63123.esm.js';
|
|
4
4
|
import { p as pipe } from '../../dist/util-18613e99.esm.js';
|
|
5
5
|
|