@valbuild/core 0.86.2 → 0.87.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/render.d.ts +4 -1
- package/dist/declarations/src/schema/array.d.ts +1 -1
- package/dist/declarations/src/schema/record.d.ts +1 -1
- package/dist/declarations/src/schema/string.d.ts +9 -3
- package/dist/{index-4465006f.cjs.dev.js → index-14d1cd02.cjs.dev.js} +21 -3
- package/dist/{index-273cfd81.cjs.prod.js → index-53e70985.cjs.prod.js} +21 -3
- package/dist/{index-812e582d.esm.js → index-cb7787a6.esm.js} +21 -3
- 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
|
@@ -25,7 +25,10 @@ export type ListArrayRender = {
|
|
|
25
25
|
image?: ImageSource | RemoteSource<ImageMetadata> | null;
|
|
26
26
|
}[];
|
|
27
27
|
};
|
|
28
|
-
type
|
|
28
|
+
export type TextareaRender = {
|
|
29
|
+
layout: "textarea";
|
|
30
|
+
};
|
|
31
|
+
type RenderTypes = ListRecordRender | ListArrayRender | TextareaRender;
|
|
29
32
|
type WithStatus<T> = {
|
|
30
33
|
status: "error";
|
|
31
34
|
message: string;
|
|
@@ -23,7 +23,7 @@ export declare class ArraySchema<T extends Schema<SelectorSource>, Src extends S
|
|
|
23
23
|
private renderInput;
|
|
24
24
|
protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src): ReifiedRender;
|
|
25
25
|
render(input: {
|
|
26
|
-
|
|
26
|
+
as: "list";
|
|
27
27
|
select: (input: {
|
|
28
28
|
val: RenderSelector<T>;
|
|
29
29
|
}) => {
|
|
@@ -30,7 +30,7 @@ export declare class RecordSchema<T extends Schema<SelectorSource>, Src extends
|
|
|
30
30
|
private renderInput;
|
|
31
31
|
protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src): ReifiedRender;
|
|
32
32
|
render(input: {
|
|
33
|
-
|
|
33
|
+
as: "list";
|
|
34
34
|
select: (input: {
|
|
35
35
|
key: string;
|
|
36
36
|
val: RenderSelector<T>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
|
|
2
2
|
import { ReifiedRender } from "../render.js";
|
|
3
|
-
import { SourcePath } from "../val/index.js";
|
|
3
|
+
import { ModuleFilePath, SourcePath } from "../val/index.js";
|
|
4
4
|
import { ValidationErrors } from "./validation/ValidationError.js";
|
|
5
5
|
type StringOptions = {
|
|
6
6
|
maxLength?: number;
|
|
@@ -33,7 +33,10 @@ export declare class StringSchema<Src extends string | null> extends Schema<Src>
|
|
|
33
33
|
private readonly opt;
|
|
34
34
|
private readonly isRaw;
|
|
35
35
|
private readonly customValidateFunctions;
|
|
36
|
-
|
|
36
|
+
private readonly renderInput;
|
|
37
|
+
constructor(options?: StringOptions | undefined, opt?: boolean, isRaw?: boolean, customValidateFunctions?: ((src: Src) => false | string)[], renderInput?: {
|
|
38
|
+
as: "textarea";
|
|
39
|
+
} | null);
|
|
37
40
|
/**
|
|
38
41
|
* @deprecated Use `minLength` instead
|
|
39
42
|
*/
|
|
@@ -51,7 +54,10 @@ export declare class StringSchema<Src extends string | null> extends Schema<Src>
|
|
|
51
54
|
nullable(): StringSchema<Src | null>;
|
|
52
55
|
raw(): StringSchema<Src extends null ? RawString | null : RawString>;
|
|
53
56
|
protected executeSerialize(): SerializedSchema;
|
|
54
|
-
|
|
57
|
+
render(input: {
|
|
58
|
+
as: "textarea";
|
|
59
|
+
}): StringSchema<Src>;
|
|
60
|
+
protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src): ReifiedRender;
|
|
55
61
|
}
|
|
56
62
|
export declare const string: <T extends string>(options?: Record<string, never>) => StringSchema<T>;
|
|
57
63
|
export {};
|
|
@@ -676,12 +676,14 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
676
676
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
677
677
|
var isRaw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
678
678
|
var customValidateFunctions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
679
|
+
var renderInput = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
679
680
|
_classCallCheck(this, StringSchema);
|
|
680
681
|
_this = _callSuper(this, StringSchema);
|
|
681
682
|
_this.options = options;
|
|
682
683
|
_this.opt = opt;
|
|
683
684
|
_this.isRaw = isRaw;
|
|
684
685
|
_this.customValidateFunctions = customValidateFunctions;
|
|
686
|
+
_this.renderInput = renderInput;
|
|
685
687
|
return _this;
|
|
686
688
|
}
|
|
687
689
|
|
|
@@ -823,9 +825,22 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
823
825
|
customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0
|
|
824
826
|
};
|
|
825
827
|
}
|
|
828
|
+
}, {
|
|
829
|
+
key: "render",
|
|
830
|
+
value: function render(input) {
|
|
831
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, input);
|
|
832
|
+
}
|
|
826
833
|
}, {
|
|
827
834
|
key: "executeRender",
|
|
828
|
-
value: function executeRender() {
|
|
835
|
+
value: function executeRender(sourcePath, src) {
|
|
836
|
+
if (this.renderInput) {
|
|
837
|
+
return _defineProperty({}, sourcePath, {
|
|
838
|
+
status: "success",
|
|
839
|
+
data: {
|
|
840
|
+
layout: this.renderInput.as
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
}
|
|
829
844
|
return {};
|
|
830
845
|
}
|
|
831
846
|
}]);
|
|
@@ -1149,7 +1164,7 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1149
1164
|
if (this.renderInput) {
|
|
1150
1165
|
var _this$renderInput = this.renderInput,
|
|
1151
1166
|
select = _this$renderInput.select,
|
|
1152
|
-
layout = _this$renderInput.
|
|
1167
|
+
layout = _this$renderInput.as;
|
|
1153
1168
|
if (layout !== "list") {
|
|
1154
1169
|
res[sourcePath] = {
|
|
1155
1170
|
status: "error",
|
|
@@ -2619,7 +2634,10 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2619
2634
|
}, {
|
|
2620
2635
|
key: "render",
|
|
2621
2636
|
value: function render(input) {
|
|
2622
|
-
this.renderInput =
|
|
2637
|
+
this.renderInput = {
|
|
2638
|
+
layout: input.as,
|
|
2639
|
+
select: input.select
|
|
2640
|
+
};
|
|
2623
2641
|
return this;
|
|
2624
2642
|
}
|
|
2625
2643
|
}]);
|
|
@@ -676,12 +676,14 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
676
676
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
677
677
|
var isRaw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
678
678
|
var customValidateFunctions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
679
|
+
var renderInput = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
679
680
|
_classCallCheck(this, StringSchema);
|
|
680
681
|
_this = _callSuper(this, StringSchema);
|
|
681
682
|
_this.options = options;
|
|
682
683
|
_this.opt = opt;
|
|
683
684
|
_this.isRaw = isRaw;
|
|
684
685
|
_this.customValidateFunctions = customValidateFunctions;
|
|
686
|
+
_this.renderInput = renderInput;
|
|
685
687
|
return _this;
|
|
686
688
|
}
|
|
687
689
|
|
|
@@ -823,9 +825,22 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
823
825
|
customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0
|
|
824
826
|
};
|
|
825
827
|
}
|
|
828
|
+
}, {
|
|
829
|
+
key: "render",
|
|
830
|
+
value: function render(input) {
|
|
831
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, input);
|
|
832
|
+
}
|
|
826
833
|
}, {
|
|
827
834
|
key: "executeRender",
|
|
828
|
-
value: function executeRender() {
|
|
835
|
+
value: function executeRender(sourcePath, src) {
|
|
836
|
+
if (this.renderInput) {
|
|
837
|
+
return _defineProperty({}, sourcePath, {
|
|
838
|
+
status: "success",
|
|
839
|
+
data: {
|
|
840
|
+
layout: this.renderInput.as
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
}
|
|
829
844
|
return {};
|
|
830
845
|
}
|
|
831
846
|
}]);
|
|
@@ -1149,7 +1164,7 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1149
1164
|
if (this.renderInput) {
|
|
1150
1165
|
var _this$renderInput = this.renderInput,
|
|
1151
1166
|
select = _this$renderInput.select,
|
|
1152
|
-
layout = _this$renderInput.
|
|
1167
|
+
layout = _this$renderInput.as;
|
|
1153
1168
|
if (layout !== "list") {
|
|
1154
1169
|
res[sourcePath] = {
|
|
1155
1170
|
status: "error",
|
|
@@ -2619,7 +2634,10 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2619
2634
|
}, {
|
|
2620
2635
|
key: "render",
|
|
2621
2636
|
value: function render(input) {
|
|
2622
|
-
this.renderInput =
|
|
2637
|
+
this.renderInput = {
|
|
2638
|
+
layout: input.as,
|
|
2639
|
+
select: input.select
|
|
2640
|
+
};
|
|
2623
2641
|
return this;
|
|
2624
2642
|
}
|
|
2625
2643
|
}]);
|
|
@@ -674,12 +674,14 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
674
674
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
675
675
|
var isRaw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
676
676
|
var customValidateFunctions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
677
|
+
var renderInput = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
677
678
|
_classCallCheck(this, StringSchema);
|
|
678
679
|
_this = _callSuper(this, StringSchema);
|
|
679
680
|
_this.options = options;
|
|
680
681
|
_this.opt = opt;
|
|
681
682
|
_this.isRaw = isRaw;
|
|
682
683
|
_this.customValidateFunctions = customValidateFunctions;
|
|
684
|
+
_this.renderInput = renderInput;
|
|
683
685
|
return _this;
|
|
684
686
|
}
|
|
685
687
|
|
|
@@ -821,9 +823,22 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
821
823
|
customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0
|
|
822
824
|
};
|
|
823
825
|
}
|
|
826
|
+
}, {
|
|
827
|
+
key: "render",
|
|
828
|
+
value: function render(input) {
|
|
829
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, input);
|
|
830
|
+
}
|
|
824
831
|
}, {
|
|
825
832
|
key: "executeRender",
|
|
826
|
-
value: function executeRender() {
|
|
833
|
+
value: function executeRender(sourcePath, src) {
|
|
834
|
+
if (this.renderInput) {
|
|
835
|
+
return _defineProperty({}, sourcePath, {
|
|
836
|
+
status: "success",
|
|
837
|
+
data: {
|
|
838
|
+
layout: this.renderInput.as
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
}
|
|
827
842
|
return {};
|
|
828
843
|
}
|
|
829
844
|
}]);
|
|
@@ -1147,7 +1162,7 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
1147
1162
|
if (this.renderInput) {
|
|
1148
1163
|
var _this$renderInput = this.renderInput,
|
|
1149
1164
|
select = _this$renderInput.select,
|
|
1150
|
-
layout = _this$renderInput.
|
|
1165
|
+
layout = _this$renderInput.as;
|
|
1151
1166
|
if (layout !== "list") {
|
|
1152
1167
|
res[sourcePath] = {
|
|
1153
1168
|
status: "error",
|
|
@@ -2617,7 +2632,10 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2617
2632
|
}, {
|
|
2618
2633
|
key: "render",
|
|
2619
2634
|
value: function render(input) {
|
|
2620
|
-
this.renderInput =
|
|
2635
|
+
this.renderInput = {
|
|
2636
|
+
layout: input.as,
|
|
2637
|
+
select: input.select
|
|
2638
|
+
};
|
|
2621
2639
|
return this;
|
|
2622
2640
|
}
|
|
2623
2641
|
}]);
|
|
@@ -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-cb7787a6.esm.js';
|
|
2
2
|
import './result-daff1cae.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-14d1cd02.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-53e70985.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-cb7787a6.esm.js';
|
|
2
|
+
export { P as PatchError } from '../../dist/index-cb7787a6.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
|
|