@valbuild/core 0.86.3 → 0.87.1

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.
@@ -25,7 +25,10 @@ export type ListArrayRender = {
25
25
  image?: ImageSource | RemoteSource<ImageMetadata> | null;
26
26
  }[];
27
27
  };
28
- type RenderTypes = ListRecordRender | ListArrayRender;
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
- layout: "list";
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
- layout: "list";
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
- constructor(options?: StringOptions | undefined, opt?: boolean, isRaw?: boolean, customValidateFunctions?: ((src: Src) => false | string)[]);
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
- protected executeRender(): ReifiedRender;
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
 
@@ -699,7 +701,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
699
701
  value: function minLength(_minLength) {
700
702
  return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
701
703
  minLength: _minLength
702
- }), this.opt, this.isRaw);
704
+ }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput);
703
705
  }
704
706
 
705
707
  /**
@@ -715,7 +717,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
715
717
  value: function maxLength(_maxLength) {
716
718
  return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
717
719
  maxLength: _maxLength
718
- }), this.opt, this.isRaw);
720
+ }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput);
719
721
  }
720
722
  }, {
721
723
  key: "regexp",
@@ -723,12 +725,12 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
723
725
  return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
724
726
  regexp: _regexp,
725
727
  regExpMessage: message
726
- }), this.opt, this.isRaw);
728
+ }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput);
727
729
  }
728
730
  }, {
729
731
  key: "validate",
730
732
  value: function validate(validationFunction) {
731
- return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction));
733
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction), this.renderInput);
732
734
  }
733
735
  }, {
734
736
  key: "executeValidate",
@@ -795,12 +797,12 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
795
797
  }, {
796
798
  key: "nullable",
797
799
  value: function nullable() {
798
- return new StringSchema(this.options, true, this.isRaw);
800
+ return new StringSchema(this.options, true, this.isRaw, this.customValidateFunctions, this.renderInput);
799
801
  }
800
802
  }, {
801
803
  key: "raw",
802
804
  value: function raw() {
803
- return new StringSchema(this.options, this.opt, true);
805
+ return new StringSchema(this.options, this.opt, true, this.customValidateFunctions, this.renderInput);
804
806
  }
805
807
  }, {
806
808
  key: "executeSerialize",
@@ -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.layout;
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 = input;
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
 
@@ -699,7 +701,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
699
701
  value: function minLength(_minLength) {
700
702
  return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
701
703
  minLength: _minLength
702
- }), this.opt, this.isRaw);
704
+ }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput);
703
705
  }
704
706
 
705
707
  /**
@@ -715,7 +717,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
715
717
  value: function maxLength(_maxLength) {
716
718
  return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
717
719
  maxLength: _maxLength
718
- }), this.opt, this.isRaw);
720
+ }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput);
719
721
  }
720
722
  }, {
721
723
  key: "regexp",
@@ -723,12 +725,12 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
723
725
  return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
724
726
  regexp: _regexp,
725
727
  regExpMessage: message
726
- }), this.opt, this.isRaw);
728
+ }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput);
727
729
  }
728
730
  }, {
729
731
  key: "validate",
730
732
  value: function validate(validationFunction) {
731
- return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction));
733
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction), this.renderInput);
732
734
  }
733
735
  }, {
734
736
  key: "executeValidate",
@@ -795,12 +797,12 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
795
797
  }, {
796
798
  key: "nullable",
797
799
  value: function nullable() {
798
- return new StringSchema(this.options, true, this.isRaw);
800
+ return new StringSchema(this.options, true, this.isRaw, this.customValidateFunctions, this.renderInput);
799
801
  }
800
802
  }, {
801
803
  key: "raw",
802
804
  value: function raw() {
803
- return new StringSchema(this.options, this.opt, true);
805
+ return new StringSchema(this.options, this.opt, true, this.customValidateFunctions, this.renderInput);
804
806
  }
805
807
  }, {
806
808
  key: "executeSerialize",
@@ -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.layout;
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 = input;
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
 
@@ -697,7 +699,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
697
699
  value: function minLength(_minLength) {
698
700
  return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
699
701
  minLength: _minLength
700
- }), this.opt, this.isRaw);
702
+ }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput);
701
703
  }
702
704
 
703
705
  /**
@@ -713,7 +715,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
713
715
  value: function maxLength(_maxLength) {
714
716
  return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
715
717
  maxLength: _maxLength
716
- }), this.opt, this.isRaw);
718
+ }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput);
717
719
  }
718
720
  }, {
719
721
  key: "regexp",
@@ -721,12 +723,12 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
721
723
  return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
722
724
  regexp: _regexp,
723
725
  regExpMessage: message
724
- }), this.opt, this.isRaw);
726
+ }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput);
725
727
  }
726
728
  }, {
727
729
  key: "validate",
728
730
  value: function validate(validationFunction) {
729
- return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction));
731
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction), this.renderInput);
730
732
  }
731
733
  }, {
732
734
  key: "executeValidate",
@@ -793,12 +795,12 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
793
795
  }, {
794
796
  key: "nullable",
795
797
  value: function nullable() {
796
- return new StringSchema(this.options, true, this.isRaw);
798
+ return new StringSchema(this.options, true, this.isRaw, this.customValidateFunctions, this.renderInput);
797
799
  }
798
800
  }, {
799
801
  key: "raw",
800
802
  value: function raw() {
801
- return new StringSchema(this.options, this.opt, true);
803
+ return new StringSchema(this.options, this.opt, true, this.customValidateFunctions, this.renderInput);
802
804
  }
803
805
  }, {
804
806
  key: "executeSerialize",
@@ -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.layout;
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 = input;
2635
+ this.renderInput = {
2636
+ layout: input.as,
2637
+ select: input.select
2638
+ };
2621
2639
  return this;
2622
2640
  }
2623
2641
  }]);
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dist_valbuildCore = require('./index-4465006f.cjs.dev.js');
5
+ var dist_valbuildCore = require('./index-c05b59eb.cjs.dev.js');
6
6
  require('./result-bb1f436e.cjs.dev.js');
7
7
 
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dist_valbuildCore = require('./index-273cfd81.cjs.prod.js');
5
+ var dist_valbuildCore = require('./index-af1d2d7a.cjs.prod.js');
6
6
  require('./result-787e35f6.cjs.prod.js');
7
7
 
8
8
 
@@ -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-812e582d.esm.js';
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-e0c4e804.esm.js';
2
2
  import './result-daff1cae.esm.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/core",
3
- "version": "0.86.3",
3
+ "version": "0.87.1",
4
4
  "private": false,
5
5
  "description": "Val - supercharged hard-coded content",
6
6
  "scripts": {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dist_valbuildCore = require('../../dist/index-4465006f.cjs.dev.js');
5
+ var dist_valbuildCore = require('../../dist/index-c05b59eb.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-273cfd81.cjs.prod.js');
5
+ var dist_valbuildCore = require('../../dist/index-af1d2d7a.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-812e582d.esm.js';
2
- export { P as PatchError } from '../../dist/index-812e582d.esm.js';
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-e0c4e804.esm.js';
2
+ export { P as PatchError } from '../../dist/index-e0c4e804.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