@valbuild/core 0.87.2 → 0.87.4
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/initSchema.d.ts +1 -1
- package/dist/declarations/src/schema/record.d.ts +9 -6
- package/dist/declarations/src/schema/validation/ValidationError.d.ts +1 -0
- package/dist/{index-e0c4e804.esm.js → index-2b6db652.esm.js} +65 -25
- package/dist/{index-af1d2d7a.cjs.prod.js → index-b20e3bab.cjs.prod.js} +65 -25
- package/dist/{index-c05b59eb.cjs.dev.js → index-e3cd5eca.cjs.dev.js} +65 -25
- 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 +5 -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
|
@@ -98,7 +98,7 @@ export declare function initSchema(): {
|
|
|
98
98
|
image: (options?: import("./schema/image.js").ImageOptions | undefined) => import("./schema/image.js").ImageSchema<import("./index.js").ImageSource>;
|
|
99
99
|
literal: <T_2 extends string>(value: T_2) => import("./schema/literal.js").LiteralSchema<T_2>;
|
|
100
100
|
keyOf: <Src extends import("./selector/index.js").GenericSelector<import("./source/index.js").SourceObject, undefined> & import("./module.js").ValModuleBrand>(valModule: Src) => import("./schema/keyOf.js").KeyOfSchema<Src, Src extends import("./selector/index.js").GenericSelector<infer S_2 extends import("./source/index.js").Source, undefined> ? S_2 extends readonly import("./source/index.js").Source[] ? number : S_2 extends import("./source/index.js").SourceObject ? string extends keyof S_2 ? import("./schema/string.js").RawString : keyof S_2 : S_2 extends Record<string, import("./source/index.js").Source> ? import("./schema/string.js").RawString : never : never>;
|
|
101
|
-
record:
|
|
101
|
+
record: typeof record;
|
|
102
102
|
file: (options?: import("./schema/file.js").FileOptions | undefined) => import("./schema/file.js").FileSchema<import("./index.js").FileSource<import("./schema/file.js").FileMetadata>>;
|
|
103
103
|
date: (options?: Record<string, never> | undefined) => import("./schema/date.js").DateSchema<import("./schema/string.js").RawString>;
|
|
104
104
|
};
|
|
@@ -10,21 +10,23 @@ import { ValidationErrors } from "./validation/ValidationError.js";
|
|
|
10
10
|
export type SerializedRecordSchema = {
|
|
11
11
|
type: "record";
|
|
12
12
|
item: SerializedSchema;
|
|
13
|
+
key?: SerializedSchema;
|
|
13
14
|
opt: boolean;
|
|
14
15
|
router?: string;
|
|
15
16
|
customValidate?: boolean;
|
|
16
17
|
};
|
|
17
|
-
export declare class RecordSchema<T extends Schema<SelectorSource>, Src extends Record<
|
|
18
|
+
export declare class RecordSchema<T extends Schema<SelectorSource>, K extends Schema<string>, Src extends Record<SelectorOfSchema<K>, SelectorOfSchema<T>> | null> extends Schema<Src> {
|
|
18
19
|
private readonly item;
|
|
19
20
|
private readonly opt;
|
|
20
21
|
private readonly customValidateFunctions;
|
|
21
22
|
private readonly currentRouter;
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
private readonly keySchema;
|
|
24
|
+
constructor(item: T, opt?: boolean, customValidateFunctions?: CustomValidateFunction<Src>[], currentRouter?: ValRouter | null, keySchema?: Schema<string> | null);
|
|
25
|
+
validate(validationFunction: (src: Src) => false | string): RecordSchema<T, K, Src>;
|
|
24
26
|
protected executeValidate(path: SourcePath, src: Src): ValidationErrors;
|
|
25
27
|
protected executeAssert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
|
|
26
|
-
nullable(): RecordSchema<T, Src | null>;
|
|
27
|
-
router(router: ValRouter): RecordSchema<T, Src>;
|
|
28
|
+
nullable(): RecordSchema<T, K, Src | null>;
|
|
29
|
+
router(router: ValRouter): RecordSchema<T, K, Src>;
|
|
28
30
|
private getRouterValidations;
|
|
29
31
|
protected executeSerialize(): SerializedRecordSchema;
|
|
30
32
|
private renderInput;
|
|
@@ -41,4 +43,5 @@ export declare class RecordSchema<T extends Schema<SelectorSource>, Src extends
|
|
|
41
43
|
};
|
|
42
44
|
}): this;
|
|
43
45
|
}
|
|
44
|
-
export declare
|
|
46
|
+
export declare function record<K extends Schema<string>, S extends Schema<SelectorSource>>(key: K, schema: S): RecordSchema<S, K, Record<SelectorOfSchema<K>, SelectorOfSchema<S>>>;
|
|
47
|
+
export declare function record<S extends Schema<SelectorSource>>(schema: S): RecordSchema<S, Schema<string>, Record<string, SelectorOfSchema<S>>>;
|
|
@@ -1516,10 +1516,10 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1516
1516
|
};
|
|
1517
1517
|
}
|
|
1518
1518
|
if (this.key instanceof LiteralSchema) {
|
|
1519
|
-
var
|
|
1519
|
+
var _ref23;
|
|
1520
1520
|
var success = false;
|
|
1521
1521
|
var errors = {};
|
|
1522
|
-
var _iterator2 = _createForOfIteratorHelper((
|
|
1522
|
+
var _iterator2 = _createForOfIteratorHelper((_ref23 = [this.key]).concat.apply(_ref23, _toConsumableArray(this.items))),
|
|
1523
1523
|
_step2;
|
|
1524
1524
|
try {
|
|
1525
1525
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
@@ -2010,7 +2010,7 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2010
2010
|
_step;
|
|
2011
2011
|
try {
|
|
2012
2012
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2013
|
-
var _this2$options$block, _this2$options$block2, _this2$options$block3, _this2$options$block4, _this2$options$block5, _this2$options$block6, _this2$options$block7, _this2$options$block8, _this2$options$block9, _this2$options$
|
|
2013
|
+
var _this2$options$block, _this2$options$block2, _this2$options$block3, _this2$options$block4, _this2$options$block5, _this2$options$block6, _this2$options$block7, _this2$options$block8, _this2$options$block9, _this2$options$block0, _this2$options$inline;
|
|
2014
2014
|
var node = _step.value;
|
|
2015
2015
|
var path = unsafeCreateSourcePath(rootPath, nodes.indexOf(node));
|
|
2016
2016
|
if (typeof node === "string") {
|
|
@@ -2065,7 +2065,7 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2065
2065
|
if (node.tag === "ul" && !((_this2$options$block8 = _this2.options.block) !== null && _this2$options$block8 !== void 0 && _this2$options$block8.ul)) {
|
|
2066
2066
|
addError(path, "'ul' block is not valid", false);
|
|
2067
2067
|
}
|
|
2068
|
-
if (node.tag === "li" && !((_this2$options$block9 = _this2.options.block) !== null && _this2$options$block9 !== void 0 && _this2$options$block9.ul) && !((_this2$options$
|
|
2068
|
+
if (node.tag === "li" && !((_this2$options$block9 = _this2.options.block) !== null && _this2$options$block9 !== void 0 && _this2$options$block9.ul) && !((_this2$options$block0 = _this2.options.block) !== null && _this2$options$block0 !== void 0 && _this2$options$block0.ol)) {
|
|
2069
2069
|
addError(path, "'li' tag is invalid since neither 'ul' nor 'ol' block is not valid", false);
|
|
2070
2070
|
}
|
|
2071
2071
|
if (node.tag === "a" && !((_this2$options$inline = _this2.options.inline) !== null && _this2$options$inline !== void 0 && _this2$options$inline.a)) {
|
|
@@ -2392,6 +2392,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2392
2392
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2393
2393
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
2394
2394
|
var currentRouter = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
2395
|
+
var keySchema = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
2395
2396
|
_classCallCheck(this, RecordSchema);
|
|
2396
2397
|
_this = _callSuper(this, RecordSchema);
|
|
2397
2398
|
_defineProperty(_this, "renderInput", null);
|
|
@@ -2399,13 +2400,14 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2399
2400
|
_this.opt = opt;
|
|
2400
2401
|
_this.customValidateFunctions = customValidateFunctions;
|
|
2401
2402
|
_this.currentRouter = currentRouter;
|
|
2403
|
+
_this.keySchema = keySchema;
|
|
2402
2404
|
return _this;
|
|
2403
2405
|
}
|
|
2404
2406
|
_inherits(RecordSchema, _Schema);
|
|
2405
2407
|
return _createClass(RecordSchema, [{
|
|
2406
2408
|
key: "validate",
|
|
2407
2409
|
value: function validate(validationFunction) {
|
|
2408
|
-
return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
2410
|
+
return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.currentRouter, this.keySchema);
|
|
2409
2411
|
}
|
|
2410
2412
|
}, {
|
|
2411
2413
|
key: "executeValidate",
|
|
@@ -2453,6 +2455,30 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2453
2455
|
var _ref6 = _slicedToArray(_ref5, 2),
|
|
2454
2456
|
key = _ref6[0],
|
|
2455
2457
|
elem = _ref6[1];
|
|
2458
|
+
if (_this2.keySchema) {
|
|
2459
|
+
var keyPath = createValPathOfItem(path, key);
|
|
2460
|
+
if (!keyPath) {
|
|
2461
|
+
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for key validation")) // Should! never happen
|
|
2462
|
+
;
|
|
2463
|
+
}
|
|
2464
|
+
var keyError = _this2.keySchema["executeValidate"](keyPath, key);
|
|
2465
|
+
if (keyError) {
|
|
2466
|
+
keyError[keyPath] = keyError[keyPath].map(function (err) {
|
|
2467
|
+
return _objectSpread2(_objectSpread2({}, err), {}, {
|
|
2468
|
+
keyError: true
|
|
2469
|
+
});
|
|
2470
|
+
});
|
|
2471
|
+
if (error) {
|
|
2472
|
+
if (error[keyPath]) {
|
|
2473
|
+
error[keyPath] = [].concat(_toConsumableArray(error[keyPath]), _toConsumableArray(keyError[keyPath]));
|
|
2474
|
+
} else {
|
|
2475
|
+
error[keyPath] = keyError[keyPath];
|
|
2476
|
+
}
|
|
2477
|
+
} else {
|
|
2478
|
+
error = keyError;
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2456
2482
|
var subPath = createValPathOfItem(path, key);
|
|
2457
2483
|
if (!subPath) {
|
|
2458
2484
|
error = _this2.appendValidationError(error, path, "Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " at key ").concat(elem),
|
|
@@ -2504,12 +2530,12 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2504
2530
|
}, {
|
|
2505
2531
|
key: "nullable",
|
|
2506
2532
|
value: function nullable() {
|
|
2507
|
-
return new RecordSchema(this.item, true);
|
|
2533
|
+
return new RecordSchema(this.item, true, this.customValidateFunctions, this.currentRouter, this.keySchema);
|
|
2508
2534
|
}
|
|
2509
2535
|
}, {
|
|
2510
2536
|
key: "router",
|
|
2511
2537
|
value: function router(_router) {
|
|
2512
|
-
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router);
|
|
2538
|
+
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router, this.keySchema);
|
|
2513
2539
|
}
|
|
2514
2540
|
}, {
|
|
2515
2541
|
key: "getRouterValidations",
|
|
@@ -2530,9 +2556,9 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2530
2556
|
schemaError: true
|
|
2531
2557
|
}]);
|
|
2532
2558
|
}
|
|
2533
|
-
var
|
|
2534
|
-
if (
|
|
2535
|
-
return Object.fromEntries(
|
|
2559
|
+
var routerValidationErrors = this.currentRouter.validate(moduleFilePath, Object.keys(src));
|
|
2560
|
+
if (routerValidationErrors.length > 0) {
|
|
2561
|
+
return Object.fromEntries(routerValidationErrors.map(function (validation) {
|
|
2536
2562
|
if (!validation.error.urlPath) {
|
|
2537
2563
|
return [path, [{
|
|
2538
2564
|
message: "Router validation error: ".concat(validation.error.message, " has no url path"),
|
|
@@ -2541,13 +2567,13 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2541
2567
|
}
|
|
2542
2568
|
var subPath = createValPathOfItem(path, validation.error.urlPath);
|
|
2543
2569
|
if (!subPath) {
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
schemaError: true
|
|
2547
|
-
}]];
|
|
2570
|
+
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for router validation")) // Should! never happen
|
|
2571
|
+
;
|
|
2548
2572
|
}
|
|
2549
2573
|
return [subPath, [{
|
|
2550
|
-
message: validation.error.message
|
|
2574
|
+
message: validation.error.message,
|
|
2575
|
+
value: validation.error.urlPath,
|
|
2576
|
+
keyError: true
|
|
2551
2577
|
}]];
|
|
2552
2578
|
}));
|
|
2553
2579
|
}
|
|
@@ -2556,10 +2582,11 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2556
2582
|
}, {
|
|
2557
2583
|
key: "executeSerialize",
|
|
2558
2584
|
value: function executeSerialize() {
|
|
2559
|
-
var _this$currentRouter, _this$customValidateF;
|
|
2585
|
+
var _this$keySchema, _this$currentRouter, _this$customValidateF;
|
|
2560
2586
|
return {
|
|
2561
2587
|
type: "record",
|
|
2562
2588
|
item: this.item["executeSerialize"](),
|
|
2589
|
+
key: (_this$keySchema = this.keySchema) === null || _this$keySchema === void 0 ? void 0 : _this$keySchema["executeSerialize"](),
|
|
2563
2590
|
opt: this.opt,
|
|
2564
2591
|
router: (_this$currentRouter = this.currentRouter) === null || _this$currentRouter === void 0 ? void 0 : _this$currentRouter.getRouterId(),
|
|
2565
2592
|
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
@@ -2572,16 +2599,16 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2572
2599
|
if (src === null) {
|
|
2573
2600
|
return res;
|
|
2574
2601
|
}
|
|
2575
|
-
for (var
|
|
2576
|
-
var itemSrc = src[
|
|
2602
|
+
for (var _key in src) {
|
|
2603
|
+
var itemSrc = src[_key];
|
|
2577
2604
|
if (itemSrc === null || itemSrc === undefined) {
|
|
2578
2605
|
continue;
|
|
2579
2606
|
}
|
|
2580
|
-
var subPath = unsafeCreateSourcePath(sourcePath,
|
|
2607
|
+
var subPath = unsafeCreateSourcePath(sourcePath, _key);
|
|
2581
2608
|
var itemResult = this.item["executeRender"](subPath, itemSrc);
|
|
2582
2609
|
for (var keyS in itemResult) {
|
|
2583
|
-
var
|
|
2584
|
-
res[
|
|
2610
|
+
var _key2 = keyS;
|
|
2611
|
+
res[_key2] = itemResult[_key2];
|
|
2585
2612
|
}
|
|
2586
2613
|
}
|
|
2587
2614
|
if (this.renderInput) {
|
|
@@ -2640,9 +2667,21 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2640
2667
|
}
|
|
2641
2668
|
}]);
|
|
2642
2669
|
}(Schema);
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2670
|
+
|
|
2671
|
+
// Overload: with key schema
|
|
2672
|
+
|
|
2673
|
+
// Overload: without key schema
|
|
2674
|
+
|
|
2675
|
+
// Implementation
|
|
2676
|
+
function record(keyOrSchema, schema) {
|
|
2677
|
+
if (schema) {
|
|
2678
|
+
// Two-argument call: first is key schema, second is value schema
|
|
2679
|
+
return new RecordSchema(schema, false, [], null, keyOrSchema);
|
|
2680
|
+
} else {
|
|
2681
|
+
// One-argument call: only value schema
|
|
2682
|
+
return new RecordSchema(keyOrSchema, false, [], null, null);
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2646
2685
|
|
|
2647
2686
|
function define(
|
|
2648
2687
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -4092,6 +4131,7 @@ var N = /*#__PURE__*/function (N) {
|
|
|
4092
4131
|
N[N["inputWords"] = 16] = "inputWords";
|
|
4093
4132
|
N[N["highIndex"] = 14] = "highIndex";
|
|
4094
4133
|
N[N["lowIndex"] = 15] = "lowIndex";
|
|
4134
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
4095
4135
|
N[N["workWords"] = 64] = "workWords";
|
|
4096
4136
|
N[N["allocBytes"] = 80] = "allocBytes";
|
|
4097
4137
|
N[N["allocWords"] = 20] = "allocWords";
|
|
@@ -5185,7 +5225,7 @@ function deserializeSchema(serialized) {
|
|
|
5185
5225
|
return new RichTextSchema(deserializedOptions, serialized.opt);
|
|
5186
5226
|
}
|
|
5187
5227
|
case "record":
|
|
5188
|
-
return new RecordSchema(deserializeSchema(serialized.item), serialized.opt);
|
|
5228
|
+
return new RecordSchema(deserializeSchema(serialized.item), serialized.opt, [], null, serialized.key ? deserializeSchema(serialized.key) : null);
|
|
5189
5229
|
case "keyOf":
|
|
5190
5230
|
return new KeyOfSchema(serialized.schema, serialized.path, serialized.opt);
|
|
5191
5231
|
case "file":
|
|
@@ -1518,10 +1518,10 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1518
1518
|
};
|
|
1519
1519
|
}
|
|
1520
1520
|
if (this.key instanceof LiteralSchema) {
|
|
1521
|
-
var
|
|
1521
|
+
var _ref23;
|
|
1522
1522
|
var success = false;
|
|
1523
1523
|
var errors = {};
|
|
1524
|
-
var _iterator2 = result._createForOfIteratorHelper((
|
|
1524
|
+
var _iterator2 = result._createForOfIteratorHelper((_ref23 = [this.key]).concat.apply(_ref23, _toConsumableArray(this.items))),
|
|
1525
1525
|
_step2;
|
|
1526
1526
|
try {
|
|
1527
1527
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
@@ -2012,7 +2012,7 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2012
2012
|
_step;
|
|
2013
2013
|
try {
|
|
2014
2014
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2015
|
-
var _this2$options$block, _this2$options$block2, _this2$options$block3, _this2$options$block4, _this2$options$block5, _this2$options$block6, _this2$options$block7, _this2$options$block8, _this2$options$block9, _this2$options$
|
|
2015
|
+
var _this2$options$block, _this2$options$block2, _this2$options$block3, _this2$options$block4, _this2$options$block5, _this2$options$block6, _this2$options$block7, _this2$options$block8, _this2$options$block9, _this2$options$block0, _this2$options$inline;
|
|
2016
2016
|
var node = _step.value;
|
|
2017
2017
|
var path = unsafeCreateSourcePath(rootPath, nodes.indexOf(node));
|
|
2018
2018
|
if (typeof node === "string") {
|
|
@@ -2067,7 +2067,7 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2067
2067
|
if (node.tag === "ul" && !((_this2$options$block8 = _this2.options.block) !== null && _this2$options$block8 !== void 0 && _this2$options$block8.ul)) {
|
|
2068
2068
|
addError(path, "'ul' block is not valid", false);
|
|
2069
2069
|
}
|
|
2070
|
-
if (node.tag === "li" && !((_this2$options$block9 = _this2.options.block) !== null && _this2$options$block9 !== void 0 && _this2$options$block9.ul) && !((_this2$options$
|
|
2070
|
+
if (node.tag === "li" && !((_this2$options$block9 = _this2.options.block) !== null && _this2$options$block9 !== void 0 && _this2$options$block9.ul) && !((_this2$options$block0 = _this2.options.block) !== null && _this2$options$block0 !== void 0 && _this2$options$block0.ol)) {
|
|
2071
2071
|
addError(path, "'li' tag is invalid since neither 'ul' nor 'ol' block is not valid", false);
|
|
2072
2072
|
}
|
|
2073
2073
|
if (node.tag === "a" && !((_this2$options$inline = _this2.options.inline) !== null && _this2$options$inline !== void 0 && _this2$options$inline.a)) {
|
|
@@ -2394,6 +2394,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2394
2394
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2395
2395
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
2396
2396
|
var currentRouter = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
2397
|
+
var keySchema = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
2397
2398
|
_classCallCheck(this, RecordSchema);
|
|
2398
2399
|
_this = _callSuper(this, RecordSchema);
|
|
2399
2400
|
_defineProperty(_this, "renderInput", null);
|
|
@@ -2401,13 +2402,14 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2401
2402
|
_this.opt = opt;
|
|
2402
2403
|
_this.customValidateFunctions = customValidateFunctions;
|
|
2403
2404
|
_this.currentRouter = currentRouter;
|
|
2405
|
+
_this.keySchema = keySchema;
|
|
2404
2406
|
return _this;
|
|
2405
2407
|
}
|
|
2406
2408
|
_inherits(RecordSchema, _Schema);
|
|
2407
2409
|
return _createClass(RecordSchema, [{
|
|
2408
2410
|
key: "validate",
|
|
2409
2411
|
value: function validate(validationFunction) {
|
|
2410
|
-
return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
2412
|
+
return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.currentRouter, this.keySchema);
|
|
2411
2413
|
}
|
|
2412
2414
|
}, {
|
|
2413
2415
|
key: "executeValidate",
|
|
@@ -2455,6 +2457,30 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2455
2457
|
var _ref6 = _slicedToArray(_ref5, 2),
|
|
2456
2458
|
key = _ref6[0],
|
|
2457
2459
|
elem = _ref6[1];
|
|
2460
|
+
if (_this2.keySchema) {
|
|
2461
|
+
var keyPath = createValPathOfItem(path, key);
|
|
2462
|
+
if (!keyPath) {
|
|
2463
|
+
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for key validation")) // Should! never happen
|
|
2464
|
+
;
|
|
2465
|
+
}
|
|
2466
|
+
var keyError = _this2.keySchema["executeValidate"](keyPath, key);
|
|
2467
|
+
if (keyError) {
|
|
2468
|
+
keyError[keyPath] = keyError[keyPath].map(function (err) {
|
|
2469
|
+
return _objectSpread2(_objectSpread2({}, err), {}, {
|
|
2470
|
+
keyError: true
|
|
2471
|
+
});
|
|
2472
|
+
});
|
|
2473
|
+
if (error) {
|
|
2474
|
+
if (error[keyPath]) {
|
|
2475
|
+
error[keyPath] = [].concat(_toConsumableArray(error[keyPath]), _toConsumableArray(keyError[keyPath]));
|
|
2476
|
+
} else {
|
|
2477
|
+
error[keyPath] = keyError[keyPath];
|
|
2478
|
+
}
|
|
2479
|
+
} else {
|
|
2480
|
+
error = keyError;
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2458
2484
|
var subPath = createValPathOfItem(path, key);
|
|
2459
2485
|
if (!subPath) {
|
|
2460
2486
|
error = _this2.appendValidationError(error, path, "Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " at key ").concat(elem),
|
|
@@ -2506,12 +2532,12 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2506
2532
|
}, {
|
|
2507
2533
|
key: "nullable",
|
|
2508
2534
|
value: function nullable() {
|
|
2509
|
-
return new RecordSchema(this.item, true);
|
|
2535
|
+
return new RecordSchema(this.item, true, this.customValidateFunctions, this.currentRouter, this.keySchema);
|
|
2510
2536
|
}
|
|
2511
2537
|
}, {
|
|
2512
2538
|
key: "router",
|
|
2513
2539
|
value: function router(_router) {
|
|
2514
|
-
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router);
|
|
2540
|
+
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router, this.keySchema);
|
|
2515
2541
|
}
|
|
2516
2542
|
}, {
|
|
2517
2543
|
key: "getRouterValidations",
|
|
@@ -2532,9 +2558,9 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2532
2558
|
schemaError: true
|
|
2533
2559
|
}]);
|
|
2534
2560
|
}
|
|
2535
|
-
var
|
|
2536
|
-
if (
|
|
2537
|
-
return Object.fromEntries(
|
|
2561
|
+
var routerValidationErrors = this.currentRouter.validate(moduleFilePath, Object.keys(src));
|
|
2562
|
+
if (routerValidationErrors.length > 0) {
|
|
2563
|
+
return Object.fromEntries(routerValidationErrors.map(function (validation) {
|
|
2538
2564
|
if (!validation.error.urlPath) {
|
|
2539
2565
|
return [path, [{
|
|
2540
2566
|
message: "Router validation error: ".concat(validation.error.message, " has no url path"),
|
|
@@ -2543,13 +2569,13 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2543
2569
|
}
|
|
2544
2570
|
var subPath = createValPathOfItem(path, validation.error.urlPath);
|
|
2545
2571
|
if (!subPath) {
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
schemaError: true
|
|
2549
|
-
}]];
|
|
2572
|
+
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for router validation")) // Should! never happen
|
|
2573
|
+
;
|
|
2550
2574
|
}
|
|
2551
2575
|
return [subPath, [{
|
|
2552
|
-
message: validation.error.message
|
|
2576
|
+
message: validation.error.message,
|
|
2577
|
+
value: validation.error.urlPath,
|
|
2578
|
+
keyError: true
|
|
2553
2579
|
}]];
|
|
2554
2580
|
}));
|
|
2555
2581
|
}
|
|
@@ -2558,10 +2584,11 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2558
2584
|
}, {
|
|
2559
2585
|
key: "executeSerialize",
|
|
2560
2586
|
value: function executeSerialize() {
|
|
2561
|
-
var _this$currentRouter, _this$customValidateF;
|
|
2587
|
+
var _this$keySchema, _this$currentRouter, _this$customValidateF;
|
|
2562
2588
|
return {
|
|
2563
2589
|
type: "record",
|
|
2564
2590
|
item: this.item["executeSerialize"](),
|
|
2591
|
+
key: (_this$keySchema = this.keySchema) === null || _this$keySchema === void 0 ? void 0 : _this$keySchema["executeSerialize"](),
|
|
2565
2592
|
opt: this.opt,
|
|
2566
2593
|
router: (_this$currentRouter = this.currentRouter) === null || _this$currentRouter === void 0 ? void 0 : _this$currentRouter.getRouterId(),
|
|
2567
2594
|
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
@@ -2574,16 +2601,16 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2574
2601
|
if (src === null) {
|
|
2575
2602
|
return res;
|
|
2576
2603
|
}
|
|
2577
|
-
for (var
|
|
2578
|
-
var itemSrc = src[
|
|
2604
|
+
for (var _key in src) {
|
|
2605
|
+
var itemSrc = src[_key];
|
|
2579
2606
|
if (itemSrc === null || itemSrc === undefined) {
|
|
2580
2607
|
continue;
|
|
2581
2608
|
}
|
|
2582
|
-
var subPath = unsafeCreateSourcePath(sourcePath,
|
|
2609
|
+
var subPath = unsafeCreateSourcePath(sourcePath, _key);
|
|
2583
2610
|
var itemResult = this.item["executeRender"](subPath, itemSrc);
|
|
2584
2611
|
for (var keyS in itemResult) {
|
|
2585
|
-
var
|
|
2586
|
-
res[
|
|
2612
|
+
var _key2 = keyS;
|
|
2613
|
+
res[_key2] = itemResult[_key2];
|
|
2587
2614
|
}
|
|
2588
2615
|
}
|
|
2589
2616
|
if (this.renderInput) {
|
|
@@ -2642,9 +2669,21 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2642
2669
|
}
|
|
2643
2670
|
}]);
|
|
2644
2671
|
}(Schema);
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2672
|
+
|
|
2673
|
+
// Overload: with key schema
|
|
2674
|
+
|
|
2675
|
+
// Overload: without key schema
|
|
2676
|
+
|
|
2677
|
+
// Implementation
|
|
2678
|
+
function record(keyOrSchema, schema) {
|
|
2679
|
+
if (schema) {
|
|
2680
|
+
// Two-argument call: first is key schema, second is value schema
|
|
2681
|
+
return new RecordSchema(schema, false, [], null, keyOrSchema);
|
|
2682
|
+
} else {
|
|
2683
|
+
// One-argument call: only value schema
|
|
2684
|
+
return new RecordSchema(keyOrSchema, false, [], null, null);
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2648
2687
|
|
|
2649
2688
|
function define(
|
|
2650
2689
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -4094,6 +4133,7 @@ var N = /*#__PURE__*/function (N) {
|
|
|
4094
4133
|
N[N["inputWords"] = 16] = "inputWords";
|
|
4095
4134
|
N[N["highIndex"] = 14] = "highIndex";
|
|
4096
4135
|
N[N["lowIndex"] = 15] = "lowIndex";
|
|
4136
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
4097
4137
|
N[N["workWords"] = 64] = "workWords";
|
|
4098
4138
|
N[N["allocBytes"] = 80] = "allocBytes";
|
|
4099
4139
|
N[N["allocWords"] = 20] = "allocWords";
|
|
@@ -5187,7 +5227,7 @@ function deserializeSchema(serialized) {
|
|
|
5187
5227
|
return new RichTextSchema(deserializedOptions, serialized.opt);
|
|
5188
5228
|
}
|
|
5189
5229
|
case "record":
|
|
5190
|
-
return new RecordSchema(deserializeSchema(serialized.item), serialized.opt);
|
|
5230
|
+
return new RecordSchema(deserializeSchema(serialized.item), serialized.opt, [], null, serialized.key ? deserializeSchema(serialized.key) : null);
|
|
5191
5231
|
case "keyOf":
|
|
5192
5232
|
return new KeyOfSchema(serialized.schema, serialized.path, serialized.opt);
|
|
5193
5233
|
case "file":
|
|
@@ -1518,10 +1518,10 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1518
1518
|
};
|
|
1519
1519
|
}
|
|
1520
1520
|
if (this.key instanceof LiteralSchema) {
|
|
1521
|
-
var
|
|
1521
|
+
var _ref23;
|
|
1522
1522
|
var success = false;
|
|
1523
1523
|
var errors = {};
|
|
1524
|
-
var _iterator2 = result._createForOfIteratorHelper((
|
|
1524
|
+
var _iterator2 = result._createForOfIteratorHelper((_ref23 = [this.key]).concat.apply(_ref23, _toConsumableArray(this.items))),
|
|
1525
1525
|
_step2;
|
|
1526
1526
|
try {
|
|
1527
1527
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
@@ -2012,7 +2012,7 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2012
2012
|
_step;
|
|
2013
2013
|
try {
|
|
2014
2014
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2015
|
-
var _this2$options$block, _this2$options$block2, _this2$options$block3, _this2$options$block4, _this2$options$block5, _this2$options$block6, _this2$options$block7, _this2$options$block8, _this2$options$block9, _this2$options$
|
|
2015
|
+
var _this2$options$block, _this2$options$block2, _this2$options$block3, _this2$options$block4, _this2$options$block5, _this2$options$block6, _this2$options$block7, _this2$options$block8, _this2$options$block9, _this2$options$block0, _this2$options$inline;
|
|
2016
2016
|
var node = _step.value;
|
|
2017
2017
|
var path = unsafeCreateSourcePath(rootPath, nodes.indexOf(node));
|
|
2018
2018
|
if (typeof node === "string") {
|
|
@@ -2067,7 +2067,7 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2067
2067
|
if (node.tag === "ul" && !((_this2$options$block8 = _this2.options.block) !== null && _this2$options$block8 !== void 0 && _this2$options$block8.ul)) {
|
|
2068
2068
|
addError(path, "'ul' block is not valid", false);
|
|
2069
2069
|
}
|
|
2070
|
-
if (node.tag === "li" && !((_this2$options$block9 = _this2.options.block) !== null && _this2$options$block9 !== void 0 && _this2$options$block9.ul) && !((_this2$options$
|
|
2070
|
+
if (node.tag === "li" && !((_this2$options$block9 = _this2.options.block) !== null && _this2$options$block9 !== void 0 && _this2$options$block9.ul) && !((_this2$options$block0 = _this2.options.block) !== null && _this2$options$block0 !== void 0 && _this2$options$block0.ol)) {
|
|
2071
2071
|
addError(path, "'li' tag is invalid since neither 'ul' nor 'ol' block is not valid", false);
|
|
2072
2072
|
}
|
|
2073
2073
|
if (node.tag === "a" && !((_this2$options$inline = _this2.options.inline) !== null && _this2$options$inline !== void 0 && _this2$options$inline.a)) {
|
|
@@ -2394,6 +2394,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2394
2394
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2395
2395
|
var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
2396
2396
|
var currentRouter = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
2397
|
+
var keySchema = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
2397
2398
|
_classCallCheck(this, RecordSchema);
|
|
2398
2399
|
_this = _callSuper(this, RecordSchema);
|
|
2399
2400
|
_defineProperty(_this, "renderInput", null);
|
|
@@ -2401,13 +2402,14 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2401
2402
|
_this.opt = opt;
|
|
2402
2403
|
_this.customValidateFunctions = customValidateFunctions;
|
|
2403
2404
|
_this.currentRouter = currentRouter;
|
|
2405
|
+
_this.keySchema = keySchema;
|
|
2404
2406
|
return _this;
|
|
2405
2407
|
}
|
|
2406
2408
|
_inherits(RecordSchema, _Schema);
|
|
2407
2409
|
return _createClass(RecordSchema, [{
|
|
2408
2410
|
key: "validate",
|
|
2409
2411
|
value: function validate(validationFunction) {
|
|
2410
|
-
return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]));
|
|
2412
|
+
return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.currentRouter, this.keySchema);
|
|
2411
2413
|
}
|
|
2412
2414
|
}, {
|
|
2413
2415
|
key: "executeValidate",
|
|
@@ -2455,6 +2457,30 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2455
2457
|
var _ref6 = _slicedToArray(_ref5, 2),
|
|
2456
2458
|
key = _ref6[0],
|
|
2457
2459
|
elem = _ref6[1];
|
|
2460
|
+
if (_this2.keySchema) {
|
|
2461
|
+
var keyPath = createValPathOfItem(path, key);
|
|
2462
|
+
if (!keyPath) {
|
|
2463
|
+
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for key validation")) // Should! never happen
|
|
2464
|
+
;
|
|
2465
|
+
}
|
|
2466
|
+
var keyError = _this2.keySchema["executeValidate"](keyPath, key);
|
|
2467
|
+
if (keyError) {
|
|
2468
|
+
keyError[keyPath] = keyError[keyPath].map(function (err) {
|
|
2469
|
+
return _objectSpread2(_objectSpread2({}, err), {}, {
|
|
2470
|
+
keyError: true
|
|
2471
|
+
});
|
|
2472
|
+
});
|
|
2473
|
+
if (error) {
|
|
2474
|
+
if (error[keyPath]) {
|
|
2475
|
+
error[keyPath] = [].concat(_toConsumableArray(error[keyPath]), _toConsumableArray(keyError[keyPath]));
|
|
2476
|
+
} else {
|
|
2477
|
+
error[keyPath] = keyError[keyPath];
|
|
2478
|
+
}
|
|
2479
|
+
} else {
|
|
2480
|
+
error = keyError;
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2458
2484
|
var subPath = createValPathOfItem(path, key);
|
|
2459
2485
|
if (!subPath) {
|
|
2460
2486
|
error = _this2.appendValidationError(error, path, "Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " at key ").concat(elem),
|
|
@@ -2506,12 +2532,12 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2506
2532
|
}, {
|
|
2507
2533
|
key: "nullable",
|
|
2508
2534
|
value: function nullable() {
|
|
2509
|
-
return new RecordSchema(this.item, true);
|
|
2535
|
+
return new RecordSchema(this.item, true, this.customValidateFunctions, this.currentRouter, this.keySchema);
|
|
2510
2536
|
}
|
|
2511
2537
|
}, {
|
|
2512
2538
|
key: "router",
|
|
2513
2539
|
value: function router(_router) {
|
|
2514
|
-
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router);
|
|
2540
|
+
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router, this.keySchema);
|
|
2515
2541
|
}
|
|
2516
2542
|
}, {
|
|
2517
2543
|
key: "getRouterValidations",
|
|
@@ -2532,9 +2558,9 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2532
2558
|
schemaError: true
|
|
2533
2559
|
}]);
|
|
2534
2560
|
}
|
|
2535
|
-
var
|
|
2536
|
-
if (
|
|
2537
|
-
return Object.fromEntries(
|
|
2561
|
+
var routerValidationErrors = this.currentRouter.validate(moduleFilePath, Object.keys(src));
|
|
2562
|
+
if (routerValidationErrors.length > 0) {
|
|
2563
|
+
return Object.fromEntries(routerValidationErrors.map(function (validation) {
|
|
2538
2564
|
if (!validation.error.urlPath) {
|
|
2539
2565
|
return [path, [{
|
|
2540
2566
|
message: "Router validation error: ".concat(validation.error.message, " has no url path"),
|
|
@@ -2543,13 +2569,13 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2543
2569
|
}
|
|
2544
2570
|
var subPath = createValPathOfItem(path, validation.error.urlPath);
|
|
2545
2571
|
if (!subPath) {
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
schemaError: true
|
|
2549
|
-
}]];
|
|
2572
|
+
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for router validation")) // Should! never happen
|
|
2573
|
+
;
|
|
2550
2574
|
}
|
|
2551
2575
|
return [subPath, [{
|
|
2552
|
-
message: validation.error.message
|
|
2576
|
+
message: validation.error.message,
|
|
2577
|
+
value: validation.error.urlPath,
|
|
2578
|
+
keyError: true
|
|
2553
2579
|
}]];
|
|
2554
2580
|
}));
|
|
2555
2581
|
}
|
|
@@ -2558,10 +2584,11 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2558
2584
|
}, {
|
|
2559
2585
|
key: "executeSerialize",
|
|
2560
2586
|
value: function executeSerialize() {
|
|
2561
|
-
var _this$currentRouter, _this$customValidateF;
|
|
2587
|
+
var _this$keySchema, _this$currentRouter, _this$customValidateF;
|
|
2562
2588
|
return {
|
|
2563
2589
|
type: "record",
|
|
2564
2590
|
item: this.item["executeSerialize"](),
|
|
2591
|
+
key: (_this$keySchema = this.keySchema) === null || _this$keySchema === void 0 ? void 0 : _this$keySchema["executeSerialize"](),
|
|
2565
2592
|
opt: this.opt,
|
|
2566
2593
|
router: (_this$currentRouter = this.currentRouter) === null || _this$currentRouter === void 0 ? void 0 : _this$currentRouter.getRouterId(),
|
|
2567
2594
|
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
|
|
@@ -2574,16 +2601,16 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2574
2601
|
if (src === null) {
|
|
2575
2602
|
return res;
|
|
2576
2603
|
}
|
|
2577
|
-
for (var
|
|
2578
|
-
var itemSrc = src[
|
|
2604
|
+
for (var _key in src) {
|
|
2605
|
+
var itemSrc = src[_key];
|
|
2579
2606
|
if (itemSrc === null || itemSrc === undefined) {
|
|
2580
2607
|
continue;
|
|
2581
2608
|
}
|
|
2582
|
-
var subPath = unsafeCreateSourcePath(sourcePath,
|
|
2609
|
+
var subPath = unsafeCreateSourcePath(sourcePath, _key);
|
|
2583
2610
|
var itemResult = this.item["executeRender"](subPath, itemSrc);
|
|
2584
2611
|
for (var keyS in itemResult) {
|
|
2585
|
-
var
|
|
2586
|
-
res[
|
|
2612
|
+
var _key2 = keyS;
|
|
2613
|
+
res[_key2] = itemResult[_key2];
|
|
2587
2614
|
}
|
|
2588
2615
|
}
|
|
2589
2616
|
if (this.renderInput) {
|
|
@@ -2642,9 +2669,21 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2642
2669
|
}
|
|
2643
2670
|
}]);
|
|
2644
2671
|
}(Schema);
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2672
|
+
|
|
2673
|
+
// Overload: with key schema
|
|
2674
|
+
|
|
2675
|
+
// Overload: without key schema
|
|
2676
|
+
|
|
2677
|
+
// Implementation
|
|
2678
|
+
function record(keyOrSchema, schema) {
|
|
2679
|
+
if (schema) {
|
|
2680
|
+
// Two-argument call: first is key schema, second is value schema
|
|
2681
|
+
return new RecordSchema(schema, false, [], null, keyOrSchema);
|
|
2682
|
+
} else {
|
|
2683
|
+
// One-argument call: only value schema
|
|
2684
|
+
return new RecordSchema(keyOrSchema, false, [], null, null);
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2648
2687
|
|
|
2649
2688
|
function define(
|
|
2650
2689
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -4094,6 +4133,7 @@ var N = /*#__PURE__*/function (N) {
|
|
|
4094
4133
|
N[N["inputWords"] = 16] = "inputWords";
|
|
4095
4134
|
N[N["highIndex"] = 14] = "highIndex";
|
|
4096
4135
|
N[N["lowIndex"] = 15] = "lowIndex";
|
|
4136
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
4097
4137
|
N[N["workWords"] = 64] = "workWords";
|
|
4098
4138
|
N[N["allocBytes"] = 80] = "allocBytes";
|
|
4099
4139
|
N[N["allocWords"] = 20] = "allocWords";
|
|
@@ -5187,7 +5227,7 @@ function deserializeSchema(serialized) {
|
|
|
5187
5227
|
return new RichTextSchema(deserializedOptions, serialized.opt);
|
|
5188
5228
|
}
|
|
5189
5229
|
case "record":
|
|
5190
|
-
return new RecordSchema(deserializeSchema(serialized.item), serialized.opt);
|
|
5230
|
+
return new RecordSchema(deserializeSchema(serialized.item), serialized.opt, [], null, serialized.key ? deserializeSchema(serialized.key) : null);
|
|
5191
5231
|
case "keyOf":
|
|
5192
5232
|
return new KeyOfSchema(serialized.schema, serialized.path, serialized.opt);
|
|
5193
5233
|
case "file":
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as ArraySchema, B as BooleanSchema, e as DEFAULT_APP_HOST, D as DEFAULT_CONTENT_HOST, f as DEFAULT_VAL_REMOTE_HOST, o as DateSchema, F as FATAL_ERROR_TYPES, g as FILE_REF_PROP, h as FILE_REF_SUBTYPE_TAG, n as FileSchema, G as GenericSelector, l as ImageSchema, I as Internal, K as KeyOfSchema, L as LiteralSchema, M as ModuleFilePathSep, N as NumberSchema, O as ObjectSchema, R as RecordSchema, p as RichTextSchema, S as Schema, k as StringSchema, U as UnionSchema, V as VAL_EXTENSION, j as derefPatch, q as deserializeSchema, 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, f as DEFAULT_VAL_REMOTE_HOST, o as DateSchema, F as FATAL_ERROR_TYPES, g as FILE_REF_PROP, h as FILE_REF_SUBTYPE_TAG, n as FileSchema, G as GenericSelector, l as ImageSchema, I as Internal, K as KeyOfSchema, L as LiteralSchema, M as ModuleFilePathSep, N as NumberSchema, O as ObjectSchema, R as RecordSchema, p as RichTextSchema, S as Schema, k as StringSchema, U as UnionSchema, V as VAL_EXTENSION, j as derefPatch, q as deserializeSchema, i as initVal, m as modules } from './index-2b6db652.esm.js';
|
|
2
2
|
import './result-daff1cae.esm.js';
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valbuild/core",
|
|
3
|
-
"version": "0.87.
|
|
3
|
+
"version": "0.87.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Val - supercharged hard-coded content",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/valbuild/val.git"
|
|
9
|
+
},
|
|
6
10
|
"scripts": {
|
|
7
11
|
"typecheck": "tsc --noEmit",
|
|
8
12
|
"test": "jest",
|
|
@@ -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-e3cd5eca.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-b20e3bab.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-2b6db652.esm.js';
|
|
2
|
+
export { P as PatchError } from '../../dist/index-2b6db652.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-daff1cae.esm.js';
|
|
4
4
|
import { p as pipe } from '../../dist/util-18613e99.esm.js';
|
|
5
5
|
|