effect 3.11.6 → 3.11.8
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/cjs/Arbitrary.js +46 -4
- package/dist/cjs/Arbitrary.js.map +1 -1
- package/dist/cjs/JSONSchema.js +157 -38
- package/dist/cjs/JSONSchema.js.map +1 -1
- package/dist/cjs/Schema.js +63 -51
- package/dist/cjs/Schema.js.map +1 -1
- package/dist/cjs/internal/schema/{filters.js → schemaId.js} +4 -2
- package/dist/cjs/internal/schema/schemaId.js.map +1 -0
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Arbitrary.d.ts +5 -1
- package/dist/dts/Arbitrary.d.ts.map +1 -1
- package/dist/dts/JSONSchema.d.ts +11 -2
- package/dist/dts/JSONSchema.d.ts.map +1 -1
- package/dist/dts/Schema.d.ts +16 -6
- package/dist/dts/Schema.d.ts.map +1 -1
- package/dist/dts/internal/schema/schemaId.d.ts +2 -0
- package/dist/dts/internal/schema/schemaId.d.ts.map +1 -0
- package/dist/esm/Arbitrary.js +44 -3
- package/dist/esm/Arbitrary.js.map +1 -1
- package/dist/esm/JSONSchema.js +157 -38
- package/dist/esm/JSONSchema.js.map +1 -1
- package/dist/esm/Schema.js +55 -43
- package/dist/esm/Schema.js.map +1 -1
- package/dist/esm/internal/schema/{filters.js → schemaId.js} +3 -1
- package/dist/esm/internal/schema/schemaId.js.map +1 -0
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/Arbitrary.ts +64 -13
- package/src/JSONSchema.ts +185 -40
- package/src/Schema.ts +65 -50
- package/src/internal/schema/{filters.ts → schemaId.ts} +5 -0
- package/src/internal/version.ts +1 -1
- package/dist/cjs/internal/schema/filters.js.map +0 -1
- package/dist/dts/internal/schema/filters.d.ts +0 -2
- package/dist/dts/internal/schema/filters.d.ts.map +0 -1
- package/dist/esm/internal/schema/filters.js.map +0 -1
package/dist/cjs/Schema.js
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.ListFromSelf = exports.List = exports.LessThanSchemaId = exports.LessThanOrEqualToSchemaId = exports.LessThanOrEqualToDurationSchemaId = exports.LessThanOrEqualToDateSchemaId = exports.LessThanOrEqualToBigIntSchemaId = exports.LessThanOrEqualToBigDecimalSchemaId = exports.LessThanDurationSchemaId = exports.LessThanDateSchemaId = exports.LessThanBigIntSchemaId = exports.LessThanBigDecimalSchemaId = exports.LengthSchemaId = exports.JsonNumberSchemaId = exports.JsonNumber = exports.ItemsCountSchemaId = exports.IntSchemaId = exports.Int = exports.InstanceOfSchemaId = exports.IncludesSchemaId = exports.HashSetFromSelf = exports.HashSet = exports.HashMapFromSelf = exports.HashMap = exports.GreaterThanSchemaId = exports.GreaterThanOrEqualToSchemaId = exports.GreaterThanOrEqualToDurationSchemaId = exports.GreaterThanOrEqualToDateSchemaId = exports.GreaterThanOrEqualToBigIntSchemaId = exports.GreaterThanOrEqualToBigDecimalSchemaId = exports.GreaterThanDurationSchemaId = exports.GreaterThanDateSchemaId = exports.GreaterThanBigIntSchemaId = exports.GreaterThanBigDecimalSchemaId = exports.FromPropertySignature = exports.FiniteSchemaId = exports.Finite = exports.FiberIdFromSelf = exports.FiberId = exports.ExitFromSelf = exports.Exit = exports.Enums = exports.EndsWithSchemaId = exports.EitherFromUnion = exports.EitherFromSelf = exports.Either = exports.DurationFromSelf = exports.DurationFromNanos = exports.DurationFromMillis = exports.Duration = exports.Defect = exports.DateTimeZonedFromSelf = exports.DateTimeZoned = exports.DateTimeUtcFromSelf = exports.DateTimeUtcFromNumber = exports.DateTimeUtc = exports.DateFromString = exports.DateFromSelf = exports.DateFromNumber = exports.Date = exports.DataFromSelf = exports.Data = exports.Config = exports.Class = exports.ChunkFromSelf = exports.Chunk = exports.Char = exports.CauseFromSelf = exports.Cause = exports.CapitalizedSchemaId = exports.Capitalized = exports.Capitalize = exports.BrandSchemaId = exports.BooleanFromUnknown = exports.BooleanFromString = exports.Boolean = exports.BigIntFromSelf = exports.BigIntFromNumber = exports.BigInt = exports.BigDecimalFromSelf = exports.BigDecimalFromNumber = exports.BigDecimal = exports.BetweenSchemaId = exports.BetweenDurationSchemaId = exports.BetweenDateSchemaId = exports.BetweenBigIntSchemaId = exports.BetweenBigDecimalSchemaId = exports.ArrayEnsure = exports.Array = exports.Any = void 0;
|
|
6
|
+
exports.ListFromSelf = exports.List = exports.LessThanSchemaId = exports.LessThanOrEqualToSchemaId = exports.LessThanOrEqualToDurationSchemaId = exports.LessThanOrEqualToDateSchemaId = exports.LessThanOrEqualToBigIntSchemaId = exports.LessThanOrEqualToBigDecimalSchemaId = exports.LessThanDurationSchemaId = exports.LessThanDateSchemaId = exports.LessThanBigIntSchemaId = exports.LessThanBigDecimalSchemaId = exports.LengthSchemaId = exports.JsonNumberSchemaId = exports.JsonNumber = exports.ItemsCountSchemaId = exports.IntSchemaId = exports.Int = exports.InstanceOfSchemaId = exports.IncludesSchemaId = exports.HashSetFromSelf = exports.HashSet = exports.HashMapFromSelf = exports.HashMap = exports.GreaterThanSchemaId = exports.GreaterThanOrEqualToSchemaId = exports.GreaterThanOrEqualToDurationSchemaId = exports.GreaterThanOrEqualToDateSchemaId = exports.GreaterThanOrEqualToBigIntSchemaId = exports.GreaterThanOrEqualToBigDecimalSchemaId = exports.GreaterThanDurationSchemaId = exports.GreaterThanDateSchemaId = exports.GreaterThanBigIntSchemaId = exports.GreaterThanBigDecimalSchemaId = exports.FromPropertySignature = exports.FiniteSchemaId = exports.Finite = exports.FiberIdFromSelf = exports.FiberId = exports.ExitFromSelf = exports.Exit = exports.Enums = exports.EndsWithSchemaId = exports.EitherFromUnion = exports.EitherFromSelf = exports.Either = exports.DurationFromSelf = exports.DurationFromNanos = exports.DurationFromMillis = exports.Duration = exports.Defect = exports.DateTimeZonedFromSelf = exports.DateTimeZoned = exports.DateTimeUtcFromSelf = exports.DateTimeUtcFromNumber = exports.DateTimeUtc = exports.DateFromString = exports.DateFromSelfSchemaId = exports.DateFromSelf = exports.DateFromNumber = exports.Date = exports.DataFromSelf = exports.Data = exports.Config = exports.Class = exports.ChunkFromSelf = exports.Chunk = exports.Char = exports.CauseFromSelf = exports.Cause = exports.CapitalizedSchemaId = exports.Capitalized = exports.Capitalize = exports.BrandSchemaId = exports.BooleanFromUnknown = exports.BooleanFromString = exports.Boolean = exports.BigIntFromSelf = exports.BigIntFromNumber = exports.BigInt = exports.BigDecimalFromSelf = exports.BigDecimalFromNumber = exports.BigDecimal = exports.BetweenSchemaId = exports.BetweenDurationSchemaId = exports.BetweenDateSchemaId = exports.BetweenBigIntSchemaId = exports.BetweenBigDecimalSchemaId = exports.ArrayEnsure = exports.Array = exports.Any = void 0;
|
|
7
7
|
exports.Literal = Literal;
|
|
8
|
-
exports.
|
|
9
|
-
exports.StringFromHex = exports.StringFromBase64Url = exports.StringFromBase64 = exports.String = exports.StartsWithSchemaId = exports.SortedSetFromSelf = exports.SortedSet = exports.SetFromSelf = exports.Set = exports.RefineSchemaId = exports.RedactedFromSelf = exports.Redacted = exports.Record = exports.ReadonlySetFromSelf = exports.ReadonlySet = exports.ReadonlyMapFromSelf = exports.ReadonlyMapFromRecord = exports.ReadonlyMap = exports.PropertySignatureTypeId = exports.PropertySignatureTransformation = exports.PropertySignatureDeclaration = exports.PositiveBigIntFromSelf = exports.PositiveBigInt = exports.PositiveBigDecimalSchemaId = exports.PositiveBigDecimalFromSelf = exports.Positive = exports.PatternSchemaId = exports.OptionFromUndefinedOr = exports.OptionFromSelf = exports.OptionFromNullishOr = exports.OptionFromNullOr = exports.OptionFromNonEmptyTrimmedString = exports.Option = exports.Object = exports.NumberFromString = exports.Number = exports.NullishOr = exports.NullOr = exports.Null = exports.Not = exports.NonPositiveBigIntFromSelf = exports.NonPositiveBigInt = exports.NonPositiveBigDecimalSchemaId = exports.NonPositiveBigDecimalFromSelf = exports.NonPositive = exports.NonNegativeBigIntFromSelf = exports.NonNegativeBigInt = exports.NonNegativeBigDecimalSchemaId = exports.NonNegativeBigDecimalFromSelf = exports.NonNegative = exports.NonNaNSchemaId = exports.NonNaN = exports.NonEmptyTrimmedString = exports.NonEmptyString = exports.NonEmptyChunkFromSelf = exports.NonEmptyChunk = exports.NonEmptyArrayEnsure = exports.NonEmptyArray = exports.Never = exports.NegativeBigIntFromSelf = exports.NegativeBigInt = exports.NegativeBigDecimalSchemaId = exports.NegativeBigDecimalFromSelf = exports.Negative = exports.MultipleOfSchemaId = exports.MinLengthSchemaId = void 0;
|
|
8
|
+
exports.MaxLengthSchemaId = exports.MaxItemsSchemaId = exports.MapFromSelf = exports.MapFromRecord = exports.Map = exports.LowercasedSchemaId = exports.Lowercased = exports.Lowercase = void 0;
|
|
9
|
+
exports.StringFromHex = exports.StringFromBase64Url = exports.StringFromBase64 = exports.String = exports.StartsWithSchemaId = exports.SortedSetFromSelf = exports.SortedSet = exports.SetFromSelf = exports.Set = exports.RefineSchemaId = exports.RedactedFromSelf = exports.Redacted = exports.Record = exports.ReadonlySetFromSelf = exports.ReadonlySet = exports.ReadonlyMapFromSelf = exports.ReadonlyMapFromRecord = exports.ReadonlyMap = exports.PropertySignatureTypeId = exports.PropertySignatureTransformation = exports.PropertySignatureDeclaration = exports.PositiveBigIntFromSelf = exports.PositiveBigInt = exports.PositiveBigDecimalSchemaId = exports.PositiveBigDecimalFromSelf = exports.Positive = exports.PatternSchemaId = exports.OptionFromUndefinedOr = exports.OptionFromSelf = exports.OptionFromNullishOr = exports.OptionFromNullOr = exports.OptionFromNonEmptyTrimmedString = exports.Option = exports.Object = exports.NumberFromString = exports.Number = exports.NullishOr = exports.NullOr = exports.Null = exports.Not = exports.NonPositiveBigIntFromSelf = exports.NonPositiveBigInt = exports.NonPositiveBigDecimalSchemaId = exports.NonPositiveBigDecimalFromSelf = exports.NonPositive = exports.NonNegativeBigIntFromSelf = exports.NonNegativeBigInt = exports.NonNegativeBigDecimalSchemaId = exports.NonNegativeBigDecimalFromSelf = exports.NonNegative = exports.NonNaNSchemaId = exports.NonNaN = exports.NonEmptyTrimmedString = exports.NonEmptyString = exports.NonEmptyChunkFromSelf = exports.NonEmptyChunk = exports.NonEmptyArrayEnsure = exports.NonEmptyArray = exports.Never = exports.NegativeBigIntFromSelf = exports.NegativeBigInt = exports.NegativeBigDecimalSchemaId = exports.NegativeBigDecimalFromSelf = exports.Negative = exports.MultipleOfSchemaId = exports.MinLengthSchemaId = exports.MinItemsSchemaId = void 0;
|
|
10
10
|
exports.Struct = Struct;
|
|
11
11
|
exports.TrimmedSchemaId = exports.Trimmed = exports.Trim = exports.ToPropertySignature = exports.TimeZoneOffsetFromSelf = exports.TimeZoneOffset = exports.TimeZoneNamedFromSelf = exports.TimeZoneNamed = exports.TimeZoneFromSelf = exports.TimeZone = exports.TemplateLiteralParser = exports.TemplateLiteral = exports.TaggedStruct = exports.TaggedRequest = exports.TaggedError = exports.TaggedClass = exports.SymbolFromSelf = exports.Symbol = void 0;
|
|
12
12
|
exports.Tuple = Tuple;
|
|
13
|
-
exports.
|
|
14
|
-
exports.UndefinedOr = exports.Undefined = exports.UncapitalizedSchemaId = void 0;
|
|
13
|
+
exports.Uncapitalize = exports.Uint8ArrayFromSelf = exports.Uint8ArrayFromHex = exports.Uint8ArrayFromBase64Url = exports.Uint8ArrayFromBase64 = exports.Uint8Array = exports.UUIDSchemaId = exports.UUID = exports.URLFromSelf = exports.URL = exports.ULIDSchemaId = exports.ULID = exports.TypeId = void 0;
|
|
14
|
+
exports.UndefinedOr = exports.Undefined = exports.UncapitalizedSchemaId = exports.Uncapitalized = void 0;
|
|
15
15
|
exports.Union = Union;
|
|
16
16
|
exports.asWithResult = exports.asSerializableWithResult = exports.asSerializable = exports.asSchema = exports.annotations = exports.Void = exports.ValidDateSchemaId = exports.ValidDateFromSelf = exports.UppercasedSchemaId = exports.Uppercased = exports.Uppercase = exports.Unknown = exports.UniqueSymbolFromSelf = void 0;
|
|
17
17
|
Object.defineProperty(exports, "asserts", {
|
|
@@ -85,8 +85,8 @@ Object.defineProperty(exports, "is", {
|
|
|
85
85
|
return ParseResult.is;
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
|
-
exports.
|
|
89
|
-
exports.transformLiteral = exports.transform = exports.tag = exports.symbolWithResult = exports.symbolSerializable = exports.suspend = exports.successSchema = exports.startsWith = exports.split = exports.serializeSuccess = exports.serializeFailure = exports.serializeExit = exports.serialize = exports.serializableSchema = exports.requiredToOptional = exports.required = exports.rename = exports.propertySignature = exports.positiveBigInt = exports.positiveBigDecimal = exports.positive = exports.pluck = exports.pickLiteral = exports.pick = exports.pattern = exports.partialWith = exports.partial = exports.parseNumber = exports.parseJson = exports.optionalWith = exports.optionalToRequired = exports.optionalToOptional = exports.optionalElement = exports.optional = exports.omit = exports.nonPositiveBigInt = exports.nonPositiveBigDecimal = exports.nonPositive = exports.nonNegativeBigInt = exports.nonNegativeBigDecimal = exports.nonNegative = exports.nonNaN = exports.nonEmptyString = exports.negativeBigInt = exports.negativeBigDecimal = exports.negative = exports.mutable = exports.multipleOf = exports.minLength = exports.minItems = exports.maxLength = exports.maxItems = exports.makePropertySignature = exports.make = exports.lowercased = exports.lessThanOrEqualToDuration = exports.lessThanOrEqualToDate = exports.lessThanOrEqualToBigInt = void 0;
|
|
88
|
+
exports.lessThanOrEqualTo = exports.lessThanDuration = exports.lessThanDate = exports.lessThanBigInt = exports.lessThanBigDecimal = exports.lessThan = exports.length = exports.keyof = exports.itemsCount = exports.isSchema = exports.isPropertySignature = void 0;
|
|
89
|
+
exports.transformLiteral = exports.transform = exports.tag = exports.symbolWithResult = exports.symbolSerializable = exports.suspend = exports.successSchema = exports.startsWith = exports.split = exports.serializeSuccess = exports.serializeFailure = exports.serializeExit = exports.serialize = exports.serializableSchema = exports.requiredToOptional = exports.required = exports.rename = exports.propertySignature = exports.positiveBigInt = exports.positiveBigDecimal = exports.positive = exports.pluck = exports.pickLiteral = exports.pick = exports.pattern = exports.partialWith = exports.partial = exports.parseNumber = exports.parseJson = exports.optionalWith = exports.optionalToRequired = exports.optionalToOptional = exports.optionalElement = exports.optional = exports.omit = exports.nonPositiveBigInt = exports.nonPositiveBigDecimal = exports.nonPositive = exports.nonNegativeBigInt = exports.nonNegativeBigDecimal = exports.nonNegative = exports.nonNaN = exports.nonEmptyString = exports.negativeBigInt = exports.negativeBigDecimal = exports.negative = exports.mutable = exports.multipleOf = exports.minLength = exports.minItems = exports.maxLength = exports.maxItems = exports.makePropertySignature = exports.make = exports.lowercased = exports.lessThanOrEqualToDuration = exports.lessThanOrEqualToDate = exports.lessThanOrEqualToBigInt = exports.lessThanOrEqualToBigDecimal = void 0;
|
|
90
90
|
exports.transformLiterals = transformLiterals;
|
|
91
91
|
exports.validateEither = exports.validate = exports.validDate = exports.uppercased = exports.uncapitalized = exports.typeSchema = exports.trimmed = exports.transformOrFail = void 0;
|
|
92
92
|
Object.defineProperty(exports, "validateOption", {
|
|
@@ -127,7 +127,7 @@ var _GlobalValue = require("./GlobalValue.js");
|
|
|
127
127
|
var hashMap_ = _interopRequireWildcard(require("./HashMap.js"));
|
|
128
128
|
var hashSet_ = _interopRequireWildcard(require("./HashSet.js"));
|
|
129
129
|
var errors_ = _interopRequireWildcard(require("./internal/schema/errors.js"));
|
|
130
|
-
var
|
|
130
|
+
var schemaId_ = _interopRequireWildcard(require("./internal/schema/schemaId.js"));
|
|
131
131
|
var util_ = _interopRequireWildcard(require("./internal/schema/util.js"));
|
|
132
132
|
var list_ = _interopRequireWildcard(require("./List.js"));
|
|
133
133
|
var number_ = _interopRequireWildcard(require("./Number.js"));
|
|
@@ -1823,7 +1823,7 @@ const trimmed = annotations => self => self.pipe(filter(a => a === a.trim(), {
|
|
|
1823
1823
|
* @since 3.10.0
|
|
1824
1824
|
*/
|
|
1825
1825
|
exports.trimmed = trimmed;
|
|
1826
|
-
const MaxLengthSchemaId = exports.MaxLengthSchemaId =
|
|
1826
|
+
const MaxLengthSchemaId = exports.MaxLengthSchemaId = schemaId_.MaxLengthSchemaId;
|
|
1827
1827
|
/**
|
|
1828
1828
|
* @category string filters
|
|
1829
1829
|
* @since 3.10.0
|
|
@@ -1841,7 +1841,7 @@ const maxLength = (maxLength, annotations) => self => self.pipe(filter(a => a.le
|
|
|
1841
1841
|
* @since 3.10.0
|
|
1842
1842
|
*/
|
|
1843
1843
|
exports.maxLength = maxLength;
|
|
1844
|
-
const MinLengthSchemaId = exports.MinLengthSchemaId =
|
|
1844
|
+
const MinLengthSchemaId = exports.MinLengthSchemaId = schemaId_.MinLengthSchemaId;
|
|
1845
1845
|
/**
|
|
1846
1846
|
* @category string filters
|
|
1847
1847
|
* @since 3.10.0
|
|
@@ -2066,7 +2066,7 @@ class Uppercased extends /*#__PURE__*/String$.pipe( /*#__PURE__*/uppercased({
|
|
|
2066
2066
|
* @since 3.10.0
|
|
2067
2067
|
*/
|
|
2068
2068
|
exports.Uppercased = Uppercased;
|
|
2069
|
-
const LengthSchemaId = exports.LengthSchemaId =
|
|
2069
|
+
const LengthSchemaId = exports.LengthSchemaId = schemaId_.LengthSchemaId;
|
|
2070
2070
|
/**
|
|
2071
2071
|
* @category string filters
|
|
2072
2072
|
* @since 3.10.0
|
|
@@ -2369,7 +2369,7 @@ exports.URL = URL$;
|
|
|
2369
2369
|
* @category schema id
|
|
2370
2370
|
* @since 3.10.0
|
|
2371
2371
|
*/
|
|
2372
|
-
const FiniteSchemaId = exports.FiniteSchemaId =
|
|
2372
|
+
const FiniteSchemaId = exports.FiniteSchemaId = schemaId_.FiniteSchemaId;
|
|
2373
2373
|
/**
|
|
2374
2374
|
* Ensures that the provided value is a finite number.
|
|
2375
2375
|
*
|
|
@@ -2391,18 +2391,18 @@ const finite = annotations => self => self.pipe(filter(Number.isFinite, {
|
|
|
2391
2391
|
* @since 3.10.0
|
|
2392
2392
|
*/
|
|
2393
2393
|
exports.finite = finite;
|
|
2394
|
-
const GreaterThanSchemaId = exports.GreaterThanSchemaId =
|
|
2394
|
+
const GreaterThanSchemaId = exports.GreaterThanSchemaId = schemaId_.GreaterThanSchemaId;
|
|
2395
2395
|
/**
|
|
2396
2396
|
* This filter checks whether the provided number is greater than the specified minimum.
|
|
2397
2397
|
*
|
|
2398
2398
|
* @category number filters
|
|
2399
2399
|
* @since 3.10.0
|
|
2400
2400
|
*/
|
|
2401
|
-
const greaterThan = (
|
|
2401
|
+
const greaterThan = (exclusiveMinimum, annotations) => self => self.pipe(filter(a => a > exclusiveMinimum, {
|
|
2402
2402
|
schemaId: GreaterThanSchemaId,
|
|
2403
|
-
description:
|
|
2403
|
+
description: exclusiveMinimum === 0 ? "a positive number" : `a number greater than ${exclusiveMinimum}`,
|
|
2404
2404
|
jsonSchema: {
|
|
2405
|
-
exclusiveMinimum
|
|
2405
|
+
exclusiveMinimum
|
|
2406
2406
|
},
|
|
2407
2407
|
...annotations
|
|
2408
2408
|
}));
|
|
@@ -2411,18 +2411,18 @@ const greaterThan = (min, annotations) => self => self.pipe(filter(a => a > min,
|
|
|
2411
2411
|
* @since 3.10.0
|
|
2412
2412
|
*/
|
|
2413
2413
|
exports.greaterThan = greaterThan;
|
|
2414
|
-
const GreaterThanOrEqualToSchemaId = exports.GreaterThanOrEqualToSchemaId =
|
|
2414
|
+
const GreaterThanOrEqualToSchemaId = exports.GreaterThanOrEqualToSchemaId = schemaId_.GreaterThanOrEqualToSchemaId;
|
|
2415
2415
|
/**
|
|
2416
2416
|
* This filter checks whether the provided number is greater than or equal to the specified minimum.
|
|
2417
2417
|
*
|
|
2418
2418
|
* @category number filters
|
|
2419
2419
|
* @since 3.10.0
|
|
2420
2420
|
*/
|
|
2421
|
-
const greaterThanOrEqualTo = (
|
|
2421
|
+
const greaterThanOrEqualTo = (minimum, annotations) => self => self.pipe(filter(a => a >= minimum, {
|
|
2422
2422
|
schemaId: GreaterThanOrEqualToSchemaId,
|
|
2423
|
-
description:
|
|
2423
|
+
description: minimum === 0 ? "a non-negative number" : `a number greater than or equal to ${minimum}`,
|
|
2424
2424
|
jsonSchema: {
|
|
2425
|
-
minimum
|
|
2425
|
+
minimum
|
|
2426
2426
|
},
|
|
2427
2427
|
...annotations
|
|
2428
2428
|
}));
|
|
@@ -2450,7 +2450,7 @@ const multipleOf = (divisor, annotations) => self => self.pipe(filter(a => numbe
|
|
|
2450
2450
|
* @since 3.10.0
|
|
2451
2451
|
*/
|
|
2452
2452
|
exports.multipleOf = multipleOf;
|
|
2453
|
-
const IntSchemaId = exports.IntSchemaId =
|
|
2453
|
+
const IntSchemaId = exports.IntSchemaId = schemaId_.IntSchemaId;
|
|
2454
2454
|
/**
|
|
2455
2455
|
* @category number filters
|
|
2456
2456
|
* @since 3.10.0
|
|
@@ -2469,18 +2469,18 @@ const int = annotations => self => self.pipe(filter(a => Number.isSafeInteger(a)
|
|
|
2469
2469
|
* @since 3.10.0
|
|
2470
2470
|
*/
|
|
2471
2471
|
exports.int = int;
|
|
2472
|
-
const LessThanSchemaId = exports.LessThanSchemaId =
|
|
2472
|
+
const LessThanSchemaId = exports.LessThanSchemaId = schemaId_.LessThanSchemaId;
|
|
2473
2473
|
/**
|
|
2474
2474
|
* This filter checks whether the provided number is less than the specified maximum.
|
|
2475
2475
|
*
|
|
2476
2476
|
* @category number filters
|
|
2477
2477
|
* @since 3.10.0
|
|
2478
2478
|
*/
|
|
2479
|
-
const lessThan = (
|
|
2479
|
+
const lessThan = (exclusiveMaximum, annotations) => self => self.pipe(filter(a => a < exclusiveMaximum, {
|
|
2480
2480
|
schemaId: LessThanSchemaId,
|
|
2481
|
-
description:
|
|
2481
|
+
description: exclusiveMaximum === 0 ? "a negative number" : `a number less than ${exclusiveMaximum}`,
|
|
2482
2482
|
jsonSchema: {
|
|
2483
|
-
exclusiveMaximum
|
|
2483
|
+
exclusiveMaximum
|
|
2484
2484
|
},
|
|
2485
2485
|
...annotations
|
|
2486
2486
|
}));
|
|
@@ -2489,18 +2489,18 @@ const lessThan = (max, annotations) => self => self.pipe(filter(a => a < max, {
|
|
|
2489
2489
|
* @since 3.10.0
|
|
2490
2490
|
*/
|
|
2491
2491
|
exports.lessThan = lessThan;
|
|
2492
|
-
const LessThanOrEqualToSchemaId = exports.LessThanOrEqualToSchemaId =
|
|
2492
|
+
const LessThanOrEqualToSchemaId = exports.LessThanOrEqualToSchemaId = schemaId_.LessThanOrEqualToSchemaId;
|
|
2493
2493
|
/**
|
|
2494
2494
|
* This schema checks whether the provided number is less than or equal to the specified maximum.
|
|
2495
2495
|
*
|
|
2496
2496
|
* @category number filters
|
|
2497
2497
|
* @since 3.10.0
|
|
2498
2498
|
*/
|
|
2499
|
-
const lessThanOrEqualTo = (
|
|
2499
|
+
const lessThanOrEqualTo = (maximum, annotations) => self => self.pipe(filter(a => a <= maximum, {
|
|
2500
2500
|
schemaId: LessThanOrEqualToSchemaId,
|
|
2501
|
-
description:
|
|
2501
|
+
description: maximum === 0 ? "a non-positive number" : `a number less than or equal to ${maximum}`,
|
|
2502
2502
|
jsonSchema: {
|
|
2503
|
-
maximum
|
|
2503
|
+
maximum
|
|
2504
2504
|
},
|
|
2505
2505
|
...annotations
|
|
2506
2506
|
}));
|
|
@@ -2509,19 +2509,19 @@ const lessThanOrEqualTo = (max, annotations) => self => self.pipe(filter(a => a
|
|
|
2509
2509
|
* @since 3.10.0
|
|
2510
2510
|
*/
|
|
2511
2511
|
exports.lessThanOrEqualTo = lessThanOrEqualTo;
|
|
2512
|
-
const BetweenSchemaId = exports.BetweenSchemaId =
|
|
2512
|
+
const BetweenSchemaId = exports.BetweenSchemaId = schemaId_.BetweenSchemaId;
|
|
2513
2513
|
/**
|
|
2514
2514
|
* This filter checks whether the provided number falls within the specified minimum and maximum values.
|
|
2515
2515
|
*
|
|
2516
2516
|
* @category number filters
|
|
2517
2517
|
* @since 3.10.0
|
|
2518
2518
|
*/
|
|
2519
|
-
const between = (
|
|
2519
|
+
const between = (minimum, maximum, annotations) => self => self.pipe(filter(a => a >= minimum && a <= maximum, {
|
|
2520
2520
|
schemaId: BetweenSchemaId,
|
|
2521
|
-
description: `a number between ${
|
|
2521
|
+
description: `a number between ${minimum} and ${maximum}`,
|
|
2522
2522
|
jsonSchema: {
|
|
2523
|
-
|
|
2524
|
-
|
|
2523
|
+
minimum,
|
|
2524
|
+
maximum
|
|
2525
2525
|
},
|
|
2526
2526
|
...annotations
|
|
2527
2527
|
}));
|
|
@@ -2530,7 +2530,7 @@ const between = (min, max, annotations) => self => self.pipe(filter(a => a >= mi
|
|
|
2530
2530
|
* @since 3.10.0
|
|
2531
2531
|
*/
|
|
2532
2532
|
exports.between = between;
|
|
2533
|
-
const NonNaNSchemaId = exports.NonNaNSchemaId =
|
|
2533
|
+
const NonNaNSchemaId = exports.NonNaNSchemaId = schemaId_.NonNaNSchemaId;
|
|
2534
2534
|
/**
|
|
2535
2535
|
* @category number filters
|
|
2536
2536
|
* @since 3.10.0
|
|
@@ -2679,7 +2679,7 @@ class NonNegative extends /*#__PURE__*/Number$.pipe( /*#__PURE__*/nonNegative({
|
|
|
2679
2679
|
* @since 3.10.0
|
|
2680
2680
|
*/
|
|
2681
2681
|
exports.NonNegative = NonNegative;
|
|
2682
|
-
const JsonNumberSchemaId = exports.JsonNumberSchemaId =
|
|
2682
|
+
const JsonNumberSchemaId = exports.JsonNumberSchemaId = schemaId_.JsonNumberSchemaId;
|
|
2683
2683
|
/**
|
|
2684
2684
|
* The `JsonNumber` is a schema for representing JSON numbers. It ensures that the provided value is a valid
|
|
2685
2685
|
* number by filtering out `NaN` and `(+/-) Infinity`. This is useful when you want to validate and represent numbers in JSON
|
|
@@ -2734,7 +2734,7 @@ exports.Symbol = Symbol$;
|
|
|
2734
2734
|
* @category schema id
|
|
2735
2735
|
* @since 3.10.0
|
|
2736
2736
|
*/
|
|
2737
|
-
const GreaterThanBigIntSchemaId = exports.GreaterThanBigIntSchemaId =
|
|
2737
|
+
const GreaterThanBigIntSchemaId = exports.GreaterThanBigIntSchemaId = schemaId_.GreaterThanBigintSchemaId;
|
|
2738
2738
|
/**
|
|
2739
2739
|
* @category bigint filters
|
|
2740
2740
|
* @since 3.10.0
|
|
@@ -2752,7 +2752,7 @@ const greaterThanBigInt = (min, annotations) => self => self.pipe(filter(a => a
|
|
|
2752
2752
|
* @since 3.10.0
|
|
2753
2753
|
*/
|
|
2754
2754
|
exports.greaterThanBigInt = greaterThanBigInt;
|
|
2755
|
-
const GreaterThanOrEqualToBigIntSchemaId = exports.GreaterThanOrEqualToBigIntSchemaId =
|
|
2755
|
+
const GreaterThanOrEqualToBigIntSchemaId = exports.GreaterThanOrEqualToBigIntSchemaId = schemaId_.GreaterThanOrEqualToBigIntSchemaId;
|
|
2756
2756
|
/**
|
|
2757
2757
|
* @category bigint filters
|
|
2758
2758
|
* @since 3.10.0
|
|
@@ -2770,7 +2770,7 @@ const greaterThanOrEqualToBigInt = (min, annotations) => self => self.pipe(filte
|
|
|
2770
2770
|
* @since 3.10.0
|
|
2771
2771
|
*/
|
|
2772
2772
|
exports.greaterThanOrEqualToBigInt = greaterThanOrEqualToBigInt;
|
|
2773
|
-
const LessThanBigIntSchemaId = exports.LessThanBigIntSchemaId =
|
|
2773
|
+
const LessThanBigIntSchemaId = exports.LessThanBigIntSchemaId = schemaId_.LessThanBigIntSchemaId;
|
|
2774
2774
|
/**
|
|
2775
2775
|
* @category bigint filters
|
|
2776
2776
|
* @since 3.10.0
|
|
@@ -2788,7 +2788,7 @@ const lessThanBigInt = (max, annotations) => self => self.pipe(filter(a => a < m
|
|
|
2788
2788
|
* @since 3.10.0
|
|
2789
2789
|
*/
|
|
2790
2790
|
exports.lessThanBigInt = lessThanBigInt;
|
|
2791
|
-
const LessThanOrEqualToBigIntSchemaId = exports.LessThanOrEqualToBigIntSchemaId =
|
|
2791
|
+
const LessThanOrEqualToBigIntSchemaId = exports.LessThanOrEqualToBigIntSchemaId = schemaId_.LessThanOrEqualToBigIntSchemaId;
|
|
2792
2792
|
/**
|
|
2793
2793
|
* @category bigint filters
|
|
2794
2794
|
* @since 3.10.0
|
|
@@ -2806,7 +2806,7 @@ const lessThanOrEqualToBigInt = (max, annotations) => self => self.pipe(filter(a
|
|
|
2806
2806
|
* @since 3.10.0
|
|
2807
2807
|
*/
|
|
2808
2808
|
exports.lessThanOrEqualToBigInt = lessThanOrEqualToBigInt;
|
|
2809
|
-
const BetweenBigIntSchemaId = exports.BetweenBigIntSchemaId =
|
|
2809
|
+
const BetweenBigIntSchemaId = exports.BetweenBigIntSchemaId = schemaId_.BetweenBigintSchemaId;
|
|
2810
2810
|
/**
|
|
2811
2811
|
* @category bigint filters
|
|
2812
2812
|
* @since 3.10.0
|
|
@@ -2814,8 +2814,8 @@ const BetweenBigIntSchemaId = exports.BetweenBigIntSchemaId = filters_.BetweenBi
|
|
|
2814
2814
|
const betweenBigInt = (min, max, annotations) => self => self.pipe(filter(a => a >= min && a <= max, {
|
|
2815
2815
|
schemaId: BetweenBigIntSchemaId,
|
|
2816
2816
|
[BetweenBigIntSchemaId]: {
|
|
2817
|
-
|
|
2818
|
-
|
|
2817
|
+
min,
|
|
2818
|
+
max
|
|
2819
2819
|
},
|
|
2820
2820
|
description: `a bigint between ${min}n and ${max}n`,
|
|
2821
2821
|
...annotations
|
|
@@ -3253,7 +3253,7 @@ const StringFromHex = exports.StringFromHex = /*#__PURE__*/makeEncodingTransform
|
|
|
3253
3253
|
* @category schema id
|
|
3254
3254
|
* @since 3.10.0
|
|
3255
3255
|
*/
|
|
3256
|
-
const MinItemsSchemaId = exports.MinItemsSchemaId =
|
|
3256
|
+
const MinItemsSchemaId = exports.MinItemsSchemaId = schemaId_.MinItemsSchemaId;
|
|
3257
3257
|
/**
|
|
3258
3258
|
* @category ReadonlyArray filters
|
|
3259
3259
|
* @since 3.10.0
|
|
@@ -3278,7 +3278,7 @@ const minItems = (n, annotations) => self => {
|
|
|
3278
3278
|
* @since 3.10.0
|
|
3279
3279
|
*/
|
|
3280
3280
|
exports.minItems = minItems;
|
|
3281
|
-
const MaxItemsSchemaId = exports.MaxItemsSchemaId =
|
|
3281
|
+
const MaxItemsSchemaId = exports.MaxItemsSchemaId = schemaId_.MaxItemsSchemaId;
|
|
3282
3282
|
/**
|
|
3283
3283
|
* @category ReadonlyArray filters
|
|
3284
3284
|
* @since 3.10.0
|
|
@@ -3297,7 +3297,7 @@ const maxItems = (n, annotations) => self => self.pipe(filter(a => a.length <= n
|
|
|
3297
3297
|
* @since 3.10.0
|
|
3298
3298
|
*/
|
|
3299
3299
|
exports.maxItems = maxItems;
|
|
3300
|
-
const ItemsCountSchemaId = exports.ItemsCountSchemaId =
|
|
3300
|
+
const ItemsCountSchemaId = exports.ItemsCountSchemaId = schemaId_.ItemsCountSchemaId;
|
|
3301
3301
|
/**
|
|
3302
3302
|
* @category ReadonlyArray filters
|
|
3303
3303
|
* @since 3.10.0
|
|
@@ -3363,6 +3363,9 @@ const ValidDateSchemaId = exports.ValidDateSchemaId = /*#__PURE__*/Symbol.for("e
|
|
|
3363
3363
|
*/
|
|
3364
3364
|
const validDate = annotations => self => self.pipe(filter(a => !Number.isNaN(a.getTime()), {
|
|
3365
3365
|
schemaId: ValidDateSchemaId,
|
|
3366
|
+
[ValidDateSchemaId]: {
|
|
3367
|
+
noInvalidDate: true
|
|
3368
|
+
},
|
|
3366
3369
|
description: "a valid Date",
|
|
3367
3370
|
...annotations
|
|
3368
3371
|
}));
|
|
@@ -3448,15 +3451,21 @@ const BetweenDateSchemaId = exports.BetweenDateSchemaId = /*#__PURE__*/Symbol.fo
|
|
|
3448
3451
|
* @category Date filters
|
|
3449
3452
|
* @since 3.10.0
|
|
3450
3453
|
*/
|
|
3451
|
-
const betweenDate = (
|
|
3454
|
+
const betweenDate = (min, max, annotations) => self => self.pipe(filter(a => a <= max && a >= min, {
|
|
3452
3455
|
schemaId: BetweenDateSchemaId,
|
|
3453
3456
|
[BetweenDateSchemaId]: {
|
|
3454
|
-
|
|
3455
|
-
|
|
3457
|
+
max,
|
|
3458
|
+
min
|
|
3456
3459
|
},
|
|
3457
|
-
description: `a date between ${util_.formatDate(
|
|
3460
|
+
description: `a date between ${util_.formatDate(min)} and ${util_.formatDate(max)}`,
|
|
3458
3461
|
...annotations
|
|
3459
3462
|
}));
|
|
3463
|
+
/**
|
|
3464
|
+
* @category schema id
|
|
3465
|
+
* @since 3.11.8
|
|
3466
|
+
*/
|
|
3467
|
+
exports.betweenDate = betweenDate;
|
|
3468
|
+
const DateFromSelfSchemaId = exports.DateFromSelfSchemaId = schemaId_.DateFromSelfSchemaId;
|
|
3460
3469
|
/**
|
|
3461
3470
|
* Describes a schema that accommodates potentially invalid `Date` instances,
|
|
3462
3471
|
* such as `new Date("Invalid Date")`, without rejection.
|
|
@@ -3464,9 +3473,12 @@ const betweenDate = (minimum, maximum, annotations) => self => self.pipe(filter(
|
|
|
3464
3473
|
* @category Date constructors
|
|
3465
3474
|
* @since 3.10.0
|
|
3466
3475
|
*/
|
|
3467
|
-
exports.betweenDate = betweenDate;
|
|
3468
3476
|
class DateFromSelf extends /*#__PURE__*/declare(Predicate.isDate, {
|
|
3469
3477
|
identifier: "DateFromSelf",
|
|
3478
|
+
schemaId: DateFromSelfSchemaId,
|
|
3479
|
+
[DateFromSelfSchemaId]: {
|
|
3480
|
+
noInvalidDate: false
|
|
3481
|
+
},
|
|
3470
3482
|
description: "a potentially invalid Date instance",
|
|
3471
3483
|
pretty: () => date => `new Date(${JSON.stringify(date)})`,
|
|
3472
3484
|
arbitrary: () => fc => fc.date({
|