@valbuild/core 0.79.3 → 0.79.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.
@@ -62,7 +62,7 @@ export declare function initSchema(): {
62
62
  number: (options?: {
63
63
  max?: number | undefined;
64
64
  min?: number | undefined;
65
- } | undefined) => import("./schema/index.js").Schema<number>;
65
+ } | undefined) => import("./schema/number.js").NumberSchema<number>;
66
66
  union: <Key extends string | import("./schema/index.js").Schema<string>, T_1 extends import("./schema/index.js").Schema<Key extends string ? {
67
67
  [x: string]: import("./source/index.js").Source;
68
68
  } & {
@@ -18,8 +18,10 @@ export declare class NumberSchema<Src extends number | null> extends Schema<Src>
18
18
  validate(path: SourcePath, src: Src): ValidationErrors;
19
19
  assert(path: SourcePath, src: unknown): SchemaAssertResult<Src>;
20
20
  nullable(): Schema<Src>;
21
+ max(max: number): NumberSchema<Src>;
22
+ min(min: number): NumberSchema<Src>;
21
23
  serialize(): SerializedSchema;
22
24
  protected executePreview(): ReifiedPreview;
23
25
  }
24
- export declare const number: (options?: NumberOptions) => Schema<number>;
26
+ export declare const number: (options?: NumberOptions) => NumberSchema<number>;
25
27
  export {};
@@ -2742,6 +2742,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
2742
2742
  return _createClass(NumberSchema, [{
2743
2743
  key: "validate",
2744
2744
  value: function validate(path, src) {
2745
+ var _this$options, _this$options2;
2745
2746
  if (this.opt && (src === null || src === undefined)) {
2746
2747
  return false;
2747
2748
  }
@@ -2751,6 +2752,18 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
2751
2752
  value: src
2752
2753
  }]);
2753
2754
  }
2755
+ if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.max && src > this.options.max) {
2756
+ return _defineProperty({}, path, [{
2757
+ message: "Expected 'number' less than ".concat(this.options.max),
2758
+ value: src
2759
+ }]);
2760
+ }
2761
+ if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.min && src < this.options.min) {
2762
+ return _defineProperty({}, path, [{
2763
+ message: "Expected 'number' greater than ".concat(this.options.min),
2764
+ value: src
2765
+ }]);
2766
+ }
2754
2767
  return false;
2755
2768
  }
2756
2769
  }, {
@@ -2790,6 +2803,20 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
2790
2803
  value: function nullable() {
2791
2804
  return new NumberSchema(this.options, true);
2792
2805
  }
2806
+ }, {
2807
+ key: "max",
2808
+ value: function max(_max) {
2809
+ return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
2810
+ max: _max
2811
+ }), this.opt);
2812
+ }
2813
+ }, {
2814
+ key: "min",
2815
+ value: function min(_min) {
2816
+ return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
2817
+ min: _min
2818
+ }), this.opt);
2819
+ }
2793
2820
  }, {
2794
2821
  key: "serialize",
2795
2822
  value: function serialize() {
@@ -2744,6 +2744,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
2744
2744
  return _createClass(NumberSchema, [{
2745
2745
  key: "validate",
2746
2746
  value: function validate(path, src) {
2747
+ var _this$options, _this$options2;
2747
2748
  if (this.opt && (src === null || src === undefined)) {
2748
2749
  return false;
2749
2750
  }
@@ -2753,6 +2754,18 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
2753
2754
  value: src
2754
2755
  }]);
2755
2756
  }
2757
+ if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.max && src > this.options.max) {
2758
+ return _defineProperty({}, path, [{
2759
+ message: "Expected 'number' less than ".concat(this.options.max),
2760
+ value: src
2761
+ }]);
2762
+ }
2763
+ if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.min && src < this.options.min) {
2764
+ return _defineProperty({}, path, [{
2765
+ message: "Expected 'number' greater than ".concat(this.options.min),
2766
+ value: src
2767
+ }]);
2768
+ }
2756
2769
  return false;
2757
2770
  }
2758
2771
  }, {
@@ -2792,6 +2805,20 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
2792
2805
  value: function nullable() {
2793
2806
  return new NumberSchema(this.options, true);
2794
2807
  }
2808
+ }, {
2809
+ key: "max",
2810
+ value: function max(_max) {
2811
+ return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
2812
+ max: _max
2813
+ }), this.opt);
2814
+ }
2815
+ }, {
2816
+ key: "min",
2817
+ value: function min(_min) {
2818
+ return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
2819
+ min: _min
2820
+ }), this.opt);
2821
+ }
2795
2822
  }, {
2796
2823
  key: "serialize",
2797
2824
  value: function serialize() {
@@ -2744,6 +2744,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
2744
2744
  return _createClass(NumberSchema, [{
2745
2745
  key: "validate",
2746
2746
  value: function validate(path, src) {
2747
+ var _this$options, _this$options2;
2747
2748
  if (this.opt && (src === null || src === undefined)) {
2748
2749
  return false;
2749
2750
  }
@@ -2753,6 +2754,18 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
2753
2754
  value: src
2754
2755
  }]);
2755
2756
  }
2757
+ if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.max && src > this.options.max) {
2758
+ return _defineProperty({}, path, [{
2759
+ message: "Expected 'number' less than ".concat(this.options.max),
2760
+ value: src
2761
+ }]);
2762
+ }
2763
+ if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.min && src < this.options.min) {
2764
+ return _defineProperty({}, path, [{
2765
+ message: "Expected 'number' greater than ".concat(this.options.min),
2766
+ value: src
2767
+ }]);
2768
+ }
2756
2769
  return false;
2757
2770
  }
2758
2771
  }, {
@@ -2792,6 +2805,20 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
2792
2805
  value: function nullable() {
2793
2806
  return new NumberSchema(this.options, true);
2794
2807
  }
2808
+ }, {
2809
+ key: "max",
2810
+ value: function max(_max) {
2811
+ return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
2812
+ max: _max
2813
+ }), this.opt);
2814
+ }
2815
+ }, {
2816
+ key: "min",
2817
+ value: function min(_min) {
2818
+ return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
2819
+ min: _min
2820
+ }), this.opt);
2821
+ }
2795
2822
  }, {
2796
2823
  key: "serialize",
2797
2824
  value: function serialize() {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dist_valbuildCore = require('./index-041f7675.cjs.dev.js');
5
+ var dist_valbuildCore = require('./index-b03107f7.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-3ecf0ca6.cjs.prod.js');
5
+ var dist_valbuildCore = require('./index-a2affd87.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-1d5e4912.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-7ee9acb3.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.79.3",
3
+ "version": "0.79.4",
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-041f7675.cjs.dev.js');
5
+ var dist_valbuildCore = require('../../dist/index-b03107f7.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-3ecf0ca6.cjs.prod.js');
5
+ var dist_valbuildCore = require('../../dist/index-a2affd87.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-1d5e4912.esm.js';
2
- export { P as PatchError } from '../../dist/index-1d5e4912.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-7ee9acb3.esm.js';
2
+ export { P as PatchError } from '../../dist/index-7ee9acb3.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