effect 3.11.8 → 3.11.10
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/Effect.js +1685 -293
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/FiberHandle.js +1 -5
- package/dist/cjs/FiberHandle.js.map +1 -1
- package/dist/cjs/FiberMap.js +1 -5
- package/dist/cjs/FiberMap.js.map +1 -1
- package/dist/cjs/FiberSet.js +2 -2
- package/dist/cjs/FiberSet.js.map +1 -1
- package/dist/cjs/JSONSchema.js +3 -30
- package/dist/cjs/JSONSchema.js.map +1 -1
- package/dist/cjs/Micro.js +1 -1
- package/dist/cjs/Option.js +1 -1
- package/dist/cjs/ParseResult.js +15 -2
- package/dist/cjs/ParseResult.js.map +1 -1
- package/dist/cjs/Schema.js +333 -231
- package/dist/cjs/Schema.js.map +1 -1
- package/dist/cjs/SchemaAST.js +99 -59
- package/dist/cjs/SchemaAST.js.map +1 -1
- package/dist/cjs/Stream.js +6 -5
- package/dist/cjs/Stream.js.map +1 -1
- package/dist/cjs/internal/core-effect.js +4 -4
- package/dist/cjs/internal/core-effect.js.map +1 -1
- package/dist/cjs/internal/core.js +4 -5
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/doNotation.js.map +1 -1
- package/dist/cjs/internal/fiberRuntime.js +5 -5
- package/dist/cjs/internal/fiberRuntime.js.map +1 -1
- package/dist/cjs/internal/mailbox.js.map +1 -1
- package/dist/cjs/internal/redacted.js +1 -1
- package/dist/cjs/internal/redacted.js.map +1 -1
- package/dist/cjs/internal/runtime.js +1 -1
- package/dist/cjs/internal/runtime.js.map +1 -1
- package/dist/cjs/internal/schema/errors.js +10 -10
- package/dist/cjs/internal/schema/errors.js.map +1 -1
- package/dist/cjs/internal/schema/util.js +2 -2
- package/dist/cjs/internal/schema/util.js.map +1 -1
- package/dist/cjs/internal/stm/core.js +2 -3
- package/dist/cjs/internal/stm/core.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/cjs/internal/version.js.map +1 -1
- package/dist/dts/Effect.d.ts +12053 -8146
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/FiberHandle.d.ts +2 -2
- package/dist/dts/FiberHandle.d.ts.map +1 -1
- package/dist/dts/FiberMap.d.ts +2 -2
- package/dist/dts/FiberMap.d.ts.map +1 -1
- package/dist/dts/FiberSet.d.ts +3 -6
- package/dist/dts/FiberSet.d.ts.map +1 -1
- package/dist/dts/Option.d.ts +1 -1
- package/dist/dts/ParseResult.d.ts.map +1 -1
- package/dist/dts/Schema.d.ts +18 -8
- package/dist/dts/Schema.d.ts.map +1 -1
- package/dist/dts/SchemaAST.d.ts +9 -1
- package/dist/dts/SchemaAST.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +6 -5
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/internal/core-effect.d.ts.map +1 -1
- package/dist/dts/internal/core.d.ts.map +1 -1
- package/dist/dts/internal/fiberRuntime.d.ts.map +1 -1
- package/dist/esm/Effect.js +1734 -294
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/FiberHandle.js +1 -4
- package/dist/esm/FiberHandle.js.map +1 -1
- package/dist/esm/FiberMap.js +1 -4
- package/dist/esm/FiberMap.js.map +1 -1
- package/dist/esm/FiberSet.js +2 -2
- package/dist/esm/FiberSet.js.map +1 -1
- package/dist/esm/JSONSchema.js +3 -30
- package/dist/esm/JSONSchema.js.map +1 -1
- package/dist/esm/Micro.js +1 -1
- package/dist/esm/Micro.js.map +1 -1
- package/dist/esm/Option.js +1 -1
- package/dist/esm/ParseResult.js +12 -1
- package/dist/esm/ParseResult.js.map +1 -1
- package/dist/esm/Schema.js +328 -226
- package/dist/esm/Schema.js.map +1 -1
- package/dist/esm/SchemaAST.js +96 -57
- package/dist/esm/SchemaAST.js.map +1 -1
- package/dist/esm/Stream.js +6 -5
- package/dist/esm/Stream.js.map +1 -1
- package/dist/esm/internal/core-effect.js +4 -4
- package/dist/esm/internal/core-effect.js.map +1 -1
- package/dist/esm/internal/core.js +1 -2
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/doNotation.js.map +1 -1
- package/dist/esm/internal/fiberRuntime.js +5 -5
- package/dist/esm/internal/fiberRuntime.js.map +1 -1
- package/dist/esm/internal/mailbox.js.map +1 -1
- package/dist/esm/internal/redacted.js +1 -1
- package/dist/esm/internal/redacted.js.map +1 -1
- package/dist/esm/internal/runtime.js +1 -1
- package/dist/esm/internal/runtime.js.map +1 -1
- package/dist/esm/internal/schema/errors.js +5 -5
- package/dist/esm/internal/schema/errors.js.map +1 -1
- package/dist/esm/internal/schema/util.js +2 -2
- package/dist/esm/internal/schema/util.js.map +1 -1
- package/dist/esm/internal/stm/core.js +1 -2
- package/dist/esm/internal/stm/core.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/dist/esm/internal/version.js.map +1 -1
- package/package.json +1 -1
- package/src/Effect.ts +7191 -3280
- package/src/FiberHandle.ts +2 -2
- package/src/FiberMap.ts +2 -2
- package/src/FiberSet.ts +3 -3
- package/src/JSONSchema.ts +3 -29
- package/src/Micro.ts +1 -1
- package/src/Option.ts +1 -1
- package/src/ParseResult.ts +19 -3
- package/src/Schema.ts +268 -184
- package/src/SchemaAST.ts +117 -62
- package/src/Stream.ts +6 -5
- package/src/internal/core-effect.ts +13 -10
- package/src/internal/core.ts +1 -2
- package/src/internal/doNotation.ts +1 -1
- package/src/internal/fiberRuntime.ts +15 -15
- package/src/internal/mailbox.ts +1 -1
- package/src/internal/pool.ts +1 -1
- package/src/internal/redacted.ts +1 -1
- package/src/internal/runtime.ts +1 -1
- package/src/internal/schema/errors.ts +6 -5
- package/src/internal/schema/util.ts +2 -2
- package/src/internal/stm/core.ts +1 -2
- package/src/internal/version.ts +1 -1
package/dist/cjs/Schema.js
CHANGED
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
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
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;
|
|
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.NonNegativeInt = 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 = exports.Uncapitalized = void 0;
|
|
13
|
+
exports.Uint8ArrayFromHex = exports.Uint8ArrayFromBase64Url = exports.Uint8ArrayFromBase64 = exports.Uint8Array = exports.Uint8 = 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 = exports.Uncapitalize = exports.Uint8ArrayFromSelf = 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 = exports.lessThanOrEqualToBigDecimal = void 0;
|
|
88
|
+
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 = exports.lessThanOrEqualTo = exports.lessThanDuration = 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", {
|
|
@@ -477,60 +477,77 @@ const TemplateLiteral = (...[head, ...tail]) => {
|
|
|
477
477
|
}
|
|
478
478
|
};
|
|
479
479
|
exports.TemplateLiteral = TemplateLiteral;
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
480
|
+
function getTemplateLiteralParserCoercedElement(encoded, schema) {
|
|
481
|
+
const ast = encoded.ast;
|
|
482
|
+
switch (ast._tag) {
|
|
483
|
+
case "Literal":
|
|
484
|
+
{
|
|
485
|
+
const literal = ast.literal;
|
|
486
|
+
if (!Predicate.isString(literal)) {
|
|
487
|
+
const s = String(literal);
|
|
488
|
+
return transform(Literal(s), schema, {
|
|
489
|
+
strict: true,
|
|
490
|
+
decode: () => literal,
|
|
491
|
+
encode: () => s
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
break;
|
|
495
|
+
}
|
|
496
|
+
case "NumberKeyword":
|
|
497
|
+
return compose(NumberFromString, schema);
|
|
498
|
+
case "Union":
|
|
499
|
+
{
|
|
500
|
+
const members = [];
|
|
501
|
+
let hasCoercions = false;
|
|
502
|
+
for (const member of ast.types) {
|
|
503
|
+
const schema = make(member);
|
|
504
|
+
const encoded = encodedSchema(schema);
|
|
505
|
+
const coerced = getTemplateLiteralParserCoercedElement(encoded, schema);
|
|
506
|
+
if (coerced) {
|
|
507
|
+
hasCoercions = true;
|
|
508
|
+
}
|
|
509
|
+
members.push(coerced ?? schema);
|
|
510
|
+
}
|
|
511
|
+
return hasCoercions ? compose(Union(...members), schema) : schema;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
485
515
|
/**
|
|
486
516
|
* @category template literal
|
|
487
517
|
* @since 3.10.0
|
|
488
518
|
*/
|
|
489
519
|
const TemplateLiteralParser = (...params) => {
|
|
490
520
|
const encodedSchemas = [];
|
|
491
|
-
const
|
|
492
|
-
const
|
|
521
|
+
const elements = [];
|
|
522
|
+
const schemas = [];
|
|
523
|
+
let coerced = false;
|
|
493
524
|
for (let i = 0; i < params.length; i++) {
|
|
494
525
|
const param = params[i];
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
526
|
+
const schema = isSchema(param) ? param : Literal(param);
|
|
527
|
+
schemas.push(schema);
|
|
528
|
+
const encoded = encodedSchema(schema);
|
|
529
|
+
encodedSchemas.push(encoded);
|
|
530
|
+
const element = getTemplateLiteralParserCoercedElement(encoded, schema);
|
|
531
|
+
if (element) {
|
|
532
|
+
elements.push(element);
|
|
533
|
+
coerced = true;
|
|
502
534
|
} else {
|
|
503
|
-
|
|
504
|
-
if (Predicate.isNumber(param)) {
|
|
505
|
-
coercions[i] = Number;
|
|
506
|
-
} else if (Predicate.isBigInt(param)) {
|
|
507
|
-
coercions[i] = literalValueCoercions.bigint;
|
|
508
|
-
} else if (Predicate.isBoolean(param)) {
|
|
509
|
-
coercions[i] = literalValueCoercions.boolean;
|
|
510
|
-
} else if (Predicate.isNull(param)) {
|
|
511
|
-
coercions[i] = literalValueCoercions.null;
|
|
512
|
-
}
|
|
513
|
-
encodedSchemas.push(schema);
|
|
514
|
-
typeSchemas.push(schema);
|
|
535
|
+
elements.push(schema);
|
|
515
536
|
}
|
|
516
537
|
}
|
|
517
538
|
const from = TemplateLiteral(...encodedSchemas);
|
|
518
539
|
const re = AST.getTemplateLiteralCapturingRegExp(from.ast);
|
|
519
|
-
|
|
540
|
+
let to = Tuple(...elements);
|
|
541
|
+
if (coerced) {
|
|
542
|
+
to = to.annotations({
|
|
543
|
+
[AST.AutoTitleAnnotationId]: format(Tuple(...schemas))
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
return class TemplateLiteralParserClass extends transformOrFail(from, to, {
|
|
520
547
|
strict: false,
|
|
521
548
|
decode: (s, _, ast) => {
|
|
522
549
|
const match = re.exec(s);
|
|
523
|
-
|
|
524
|
-
const out = match.slice(1, params.length + 1);
|
|
525
|
-
for (let i = 0; i < out.length; i++) {
|
|
526
|
-
const coerce = coercions[i];
|
|
527
|
-
if (coerce) {
|
|
528
|
-
out[i] = coerce(out[i]);
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
return ParseResult.succeed(out);
|
|
532
|
-
}
|
|
533
|
-
return ParseResult.fail(new ParseResult.Type(ast, s, `${re.source}: no match for ${JSON.stringify(s)}`));
|
|
550
|
+
return match ? ParseResult.succeed(match.slice(1, params.length + 1)) : ParseResult.fail(new ParseResult.Type(ast, s, `${re.source}: no match for ${JSON.stringify(s)}`));
|
|
534
551
|
},
|
|
535
552
|
encode: tuple => ParseResult.succeed(tuple.join(""))
|
|
536
553
|
}) {
|
|
@@ -967,6 +984,12 @@ const applyDefaultValue = (o, defaultValue) => option_.match(o, {
|
|
|
967
984
|
onNone: () => option_.some(defaultValue()),
|
|
968
985
|
onSome: value => option_.some(value === undefined ? defaultValue() : value)
|
|
969
986
|
});
|
|
987
|
+
const pruneUndefined = ast => AST.pruneUndefined(ast, pruneUndefined, ast => {
|
|
988
|
+
const pruned = pruneUndefined(ast.to);
|
|
989
|
+
if (pruned) {
|
|
990
|
+
return new AST.Transformation(ast.from, pruned, ast.transformation);
|
|
991
|
+
}
|
|
992
|
+
});
|
|
970
993
|
/**
|
|
971
994
|
* Enhances a property signature with a default decoding value.
|
|
972
995
|
*
|
|
@@ -977,9 +1000,15 @@ const withDecodingDefault = exports.withDecodingDefault = /*#__PURE__*/(0, _Func
|
|
|
977
1000
|
const ast = self.ast;
|
|
978
1001
|
switch (ast._tag) {
|
|
979
1002
|
case "PropertySignatureDeclaration":
|
|
980
|
-
|
|
1003
|
+
{
|
|
1004
|
+
const to = AST.typeAST(ast.type);
|
|
1005
|
+
return makePropertySignature(new PropertySignatureTransformation(new FromPropertySignature(ast.type, ast.isOptional, ast.isReadonly, ast.annotations), new ToPropertySignature(pruneUndefined(to) ?? to, false, true, {}, ast.defaultValue), o => applyDefaultValue(o, defaultValue), _Function.identity));
|
|
1006
|
+
}
|
|
981
1007
|
case "PropertySignatureTransformation":
|
|
982
|
-
|
|
1008
|
+
{
|
|
1009
|
+
const to = ast.to.type;
|
|
1010
|
+
return makePropertySignature(new PropertySignatureTransformation(ast.from, new ToPropertySignature(pruneUndefined(to) ?? to, false, ast.to.isReadonly, ast.to.annotations, ast.to.defaultValue), o => applyDefaultValue(ast.decode(o), defaultValue), ast.encode));
|
|
1011
|
+
}
|
|
983
1012
|
}
|
|
984
1013
|
});
|
|
985
1014
|
/**
|
|
@@ -1416,10 +1445,8 @@ const brand = (brand, annotations) => self => {
|
|
|
1416
1445
|
onSome: brands => [...brands, brand]
|
|
1417
1446
|
});
|
|
1418
1447
|
const ast = AST.annotations(self.ast, toASTAnnotations({
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
...annotations,
|
|
1422
|
-
[AST.BrandAnnotationId]: annotation
|
|
1448
|
+
[AST.BrandAnnotationId]: annotation,
|
|
1449
|
+
...annotations
|
|
1423
1450
|
}));
|
|
1424
1451
|
return makeBrandClass(ast);
|
|
1425
1452
|
};
|
|
@@ -1812,6 +1839,7 @@ const TrimmedSchemaId = exports.TrimmedSchemaId = /*#__PURE__*/Symbol.for("effec
|
|
|
1812
1839
|
*/
|
|
1813
1840
|
const trimmed = annotations => self => self.pipe(filter(a => a === a.trim(), {
|
|
1814
1841
|
schemaId: TrimmedSchemaId,
|
|
1842
|
+
title: "trimmed",
|
|
1815
1843
|
description: "a string with no leading or trailing whitespace",
|
|
1816
1844
|
jsonSchema: {
|
|
1817
1845
|
pattern: "^\\S[\\s\\S]*\\S$|^\\S$|^$"
|
|
@@ -1830,6 +1858,7 @@ const MaxLengthSchemaId = exports.MaxLengthSchemaId = schemaId_.MaxLengthSchemaI
|
|
|
1830
1858
|
*/
|
|
1831
1859
|
const maxLength = (maxLength, annotations) => self => self.pipe(filter(a => a.length <= maxLength, {
|
|
1832
1860
|
schemaId: MaxLengthSchemaId,
|
|
1861
|
+
title: `maxLength(${maxLength})`,
|
|
1833
1862
|
description: `a string at most ${maxLength} character(s) long`,
|
|
1834
1863
|
jsonSchema: {
|
|
1835
1864
|
maxLength
|
|
@@ -1848,6 +1877,7 @@ const MinLengthSchemaId = exports.MinLengthSchemaId = schemaId_.MinLengthSchemaI
|
|
|
1848
1877
|
*/
|
|
1849
1878
|
const minLength = (minLength, annotations) => self => self.pipe(filter(a => a.length >= minLength, {
|
|
1850
1879
|
schemaId: MinLengthSchemaId,
|
|
1880
|
+
title: `minLength(${minLength})`,
|
|
1851
1881
|
description: `a string at least ${minLength} character(s) long`,
|
|
1852
1882
|
jsonSchema: {
|
|
1853
1883
|
minLength
|
|
@@ -1865,7 +1895,7 @@ const PatternSchemaId = exports.PatternSchemaId = /*#__PURE__*/Symbol.for("effec
|
|
|
1865
1895
|
* @since 3.10.0
|
|
1866
1896
|
*/
|
|
1867
1897
|
const pattern = (regex, annotations) => self => {
|
|
1868
|
-
const
|
|
1898
|
+
const source = regex.source;
|
|
1869
1899
|
return self.pipe(filter(a => {
|
|
1870
1900
|
// The following line ensures that `lastIndex` is reset to `0` in case the user has specified the `g` flag
|
|
1871
1901
|
regex.lastIndex = 0;
|
|
@@ -1875,9 +1905,10 @@ const pattern = (regex, annotations) => self => {
|
|
|
1875
1905
|
[PatternSchemaId]: {
|
|
1876
1906
|
regex
|
|
1877
1907
|
},
|
|
1878
|
-
|
|
1908
|
+
// title: `pattern(/${source}/)`, // avoiding this because it can be very long
|
|
1909
|
+
description: `a string matching the pattern ${source}`,
|
|
1879
1910
|
jsonSchema: {
|
|
1880
|
-
pattern
|
|
1911
|
+
pattern: source
|
|
1881
1912
|
},
|
|
1882
1913
|
...annotations
|
|
1883
1914
|
}));
|
|
@@ -1892,17 +1923,21 @@ const StartsWithSchemaId = exports.StartsWithSchemaId = /*#__PURE__*/Symbol.for(
|
|
|
1892
1923
|
* @category string filters
|
|
1893
1924
|
* @since 3.10.0
|
|
1894
1925
|
*/
|
|
1895
|
-
const startsWith = (startsWith, annotations) => self =>
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
}
|
|
1926
|
+
const startsWith = (startsWith, annotations) => self => {
|
|
1927
|
+
const formatted = JSON.stringify(startsWith);
|
|
1928
|
+
return self.pipe(filter(a => a.startsWith(startsWith), {
|
|
1929
|
+
schemaId: StartsWithSchemaId,
|
|
1930
|
+
[StartsWithSchemaId]: {
|
|
1931
|
+
startsWith
|
|
1932
|
+
},
|
|
1933
|
+
title: `startsWith(${formatted})`,
|
|
1934
|
+
description: `a string starting with ${formatted}`,
|
|
1935
|
+
jsonSchema: {
|
|
1936
|
+
pattern: `^${startsWith}`
|
|
1937
|
+
},
|
|
1938
|
+
...annotations
|
|
1939
|
+
}));
|
|
1940
|
+
};
|
|
1906
1941
|
/**
|
|
1907
1942
|
* @category schema id
|
|
1908
1943
|
* @since 3.10.0
|
|
@@ -1913,17 +1948,21 @@ const EndsWithSchemaId = exports.EndsWithSchemaId = /*#__PURE__*/Symbol.for("eff
|
|
|
1913
1948
|
* @category string filters
|
|
1914
1949
|
* @since 3.10.0
|
|
1915
1950
|
*/
|
|
1916
|
-
const endsWith = (endsWith, annotations) => self =>
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
}
|
|
1951
|
+
const endsWith = (endsWith, annotations) => self => {
|
|
1952
|
+
const formatted = JSON.stringify(endsWith);
|
|
1953
|
+
return self.pipe(filter(a => a.endsWith(endsWith), {
|
|
1954
|
+
schemaId: EndsWithSchemaId,
|
|
1955
|
+
[EndsWithSchemaId]: {
|
|
1956
|
+
endsWith
|
|
1957
|
+
},
|
|
1958
|
+
title: `endsWith(${formatted})`,
|
|
1959
|
+
description: `a string ending with ${formatted}`,
|
|
1960
|
+
jsonSchema: {
|
|
1961
|
+
pattern: `^.*${endsWith}$`
|
|
1962
|
+
},
|
|
1963
|
+
...annotations
|
|
1964
|
+
}));
|
|
1965
|
+
};
|
|
1927
1966
|
/**
|
|
1928
1967
|
* @category schema id
|
|
1929
1968
|
* @since 3.10.0
|
|
@@ -1934,17 +1973,21 @@ const IncludesSchemaId = exports.IncludesSchemaId = /*#__PURE__*/Symbol.for("eff
|
|
|
1934
1973
|
* @category string filters
|
|
1935
1974
|
* @since 3.10.0
|
|
1936
1975
|
*/
|
|
1937
|
-
const includes = (searchString, annotations) => self =>
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
}
|
|
1976
|
+
const includes = (searchString, annotations) => self => {
|
|
1977
|
+
const formatted = JSON.stringify(searchString);
|
|
1978
|
+
return self.pipe(filter(a => a.includes(searchString), {
|
|
1979
|
+
schemaId: IncludesSchemaId,
|
|
1980
|
+
[IncludesSchemaId]: {
|
|
1981
|
+
includes: searchString
|
|
1982
|
+
},
|
|
1983
|
+
title: `includes(${formatted})`,
|
|
1984
|
+
description: `a string including ${formatted}`,
|
|
1985
|
+
jsonSchema: {
|
|
1986
|
+
pattern: `.*${searchString}.*`
|
|
1987
|
+
},
|
|
1988
|
+
...annotations
|
|
1989
|
+
}));
|
|
1990
|
+
};
|
|
1948
1991
|
/**
|
|
1949
1992
|
* @category schema id
|
|
1950
1993
|
* @since 3.10.0
|
|
@@ -1959,6 +2002,7 @@ const LowercasedSchemaId = exports.LowercasedSchemaId = /*#__PURE__*/Symbol.for(
|
|
|
1959
2002
|
*/
|
|
1960
2003
|
const lowercased = annotations => self => self.pipe(filter(a => a === a.toLowerCase(), {
|
|
1961
2004
|
schemaId: LowercasedSchemaId,
|
|
2005
|
+
title: "lowercased",
|
|
1962
2006
|
description: "a lowercase string",
|
|
1963
2007
|
jsonSchema: {
|
|
1964
2008
|
pattern: "^[^A-Z]*$"
|
|
@@ -1971,8 +2015,7 @@ const lowercased = annotations => self => self.pipe(filter(a => a === a.toLowerC
|
|
|
1971
2015
|
*/
|
|
1972
2016
|
exports.lowercased = lowercased;
|
|
1973
2017
|
class Lowercased extends /*#__PURE__*/String$.pipe( /*#__PURE__*/lowercased({
|
|
1974
|
-
identifier: "Lowercased"
|
|
1975
|
-
title: "Lowercased"
|
|
2018
|
+
identifier: "Lowercased"
|
|
1976
2019
|
})) {}
|
|
1977
2020
|
/**
|
|
1978
2021
|
* @category schema id
|
|
@@ -1988,6 +2031,7 @@ const CapitalizedSchemaId = exports.CapitalizedSchemaId = /*#__PURE__*/Symbol.fo
|
|
|
1988
2031
|
*/
|
|
1989
2032
|
const capitalized = annotations => self => self.pipe(filter(a => a[0]?.toUpperCase() === a[0], {
|
|
1990
2033
|
schemaId: CapitalizedSchemaId,
|
|
2034
|
+
title: "capitalized",
|
|
1991
2035
|
description: "a capitalized string",
|
|
1992
2036
|
jsonSchema: {
|
|
1993
2037
|
pattern: "^[^a-z]?.*$"
|
|
@@ -2000,8 +2044,7 @@ const capitalized = annotations => self => self.pipe(filter(a => a[0]?.toUpperCa
|
|
|
2000
2044
|
*/
|
|
2001
2045
|
exports.capitalized = capitalized;
|
|
2002
2046
|
class Capitalized extends /*#__PURE__*/String$.pipe( /*#__PURE__*/capitalized({
|
|
2003
|
-
identifier: "Capitalized"
|
|
2004
|
-
title: "Capitalized"
|
|
2047
|
+
identifier: "Capitalized"
|
|
2005
2048
|
})) {}
|
|
2006
2049
|
/**
|
|
2007
2050
|
* @category schema id
|
|
@@ -2017,6 +2060,7 @@ const UncapitalizedSchemaId = exports.UncapitalizedSchemaId = /*#__PURE__*/Symbo
|
|
|
2017
2060
|
*/
|
|
2018
2061
|
const uncapitalized = annotations => self => self.pipe(filter(a => a[0]?.toLowerCase() === a[0], {
|
|
2019
2062
|
schemaId: UncapitalizedSchemaId,
|
|
2063
|
+
title: "uncapitalized",
|
|
2020
2064
|
description: "a uncapitalized string",
|
|
2021
2065
|
jsonSchema: {
|
|
2022
2066
|
pattern: "^[^A-Z]?.*$"
|
|
@@ -2029,8 +2073,7 @@ const uncapitalized = annotations => self => self.pipe(filter(a => a[0]?.toLower
|
|
|
2029
2073
|
*/
|
|
2030
2074
|
exports.uncapitalized = uncapitalized;
|
|
2031
2075
|
class Uncapitalized extends /*#__PURE__*/String$.pipe( /*#__PURE__*/uncapitalized({
|
|
2032
|
-
identifier: "Uncapitalized"
|
|
2033
|
-
title: "Uncapitalized"
|
|
2076
|
+
identifier: "Uncapitalized"
|
|
2034
2077
|
})) {}
|
|
2035
2078
|
/**
|
|
2036
2079
|
* @category schema id
|
|
@@ -2046,6 +2089,7 @@ const UppercasedSchemaId = exports.UppercasedSchemaId = /*#__PURE__*/Symbol.for(
|
|
|
2046
2089
|
*/
|
|
2047
2090
|
const uppercased = annotations => self => self.pipe(filter(a => a === a.toUpperCase(), {
|
|
2048
2091
|
schemaId: UppercasedSchemaId,
|
|
2092
|
+
title: "uppercased",
|
|
2049
2093
|
description: "an uppercase string",
|
|
2050
2094
|
jsonSchema: {
|
|
2051
2095
|
pattern: "^[^a-z]*$"
|
|
@@ -2058,8 +2102,7 @@ const uppercased = annotations => self => self.pipe(filter(a => a === a.toUpperC
|
|
|
2058
2102
|
*/
|
|
2059
2103
|
exports.uppercased = uppercased;
|
|
2060
2104
|
class Uppercased extends /*#__PURE__*/String$.pipe( /*#__PURE__*/uppercased({
|
|
2061
|
-
identifier: "Uppercased"
|
|
2062
|
-
title: "Uppercased"
|
|
2105
|
+
identifier: "Uppercased"
|
|
2063
2106
|
})) {}
|
|
2064
2107
|
/**
|
|
2065
2108
|
* @category schema id
|
|
@@ -2077,6 +2120,7 @@ const length = (length, annotations) => self => {
|
|
|
2077
2120
|
if (minLength !== maxLength) {
|
|
2078
2121
|
return self.pipe(filter(a => a.length >= minLength && a.length <= maxLength, {
|
|
2079
2122
|
schemaId: LengthSchemaId,
|
|
2123
|
+
title: `length({ min: ${minLength}, max: ${maxLength})`,
|
|
2080
2124
|
description: `a string at least ${minLength} character(s) and at most ${maxLength} character(s) long`,
|
|
2081
2125
|
jsonSchema: {
|
|
2082
2126
|
minLength,
|
|
@@ -2087,6 +2131,7 @@ const length = (length, annotations) => self => {
|
|
|
2087
2131
|
}
|
|
2088
2132
|
return self.pipe(filter(a => a.length === minLength, {
|
|
2089
2133
|
schemaId: LengthSchemaId,
|
|
2134
|
+
title: `length(${minLength})`,
|
|
2090
2135
|
description: minLength === 1 ? `a single character` : `a string ${minLength} character(s) long`,
|
|
2091
2136
|
jsonSchema: {
|
|
2092
2137
|
minLength,
|
|
@@ -2111,6 +2156,7 @@ class Char extends /*#__PURE__*/String$.pipe( /*#__PURE__*/length(1, {
|
|
|
2111
2156
|
*/
|
|
2112
2157
|
exports.Char = Char;
|
|
2113
2158
|
const nonEmptyString = annotations => minLength(1, {
|
|
2159
|
+
title: "nonEmptyString",
|
|
2114
2160
|
description: "a non empty string",
|
|
2115
2161
|
...annotations
|
|
2116
2162
|
});
|
|
@@ -2184,8 +2230,7 @@ class Uncapitalize extends /*#__PURE__*/transform(String$.annotations({
|
|
|
2184
2230
|
*/
|
|
2185
2231
|
exports.Uncapitalize = Uncapitalize;
|
|
2186
2232
|
class Trimmed extends /*#__PURE__*/String$.pipe( /*#__PURE__*/trimmed({
|
|
2187
|
-
identifier: "Trimmed"
|
|
2188
|
-
title: "Trimmed"
|
|
2233
|
+
identifier: "Trimmed"
|
|
2189
2234
|
})) {}
|
|
2190
2235
|
/**
|
|
2191
2236
|
* Useful for validating strings that must contain meaningful characters without
|
|
@@ -2205,8 +2250,7 @@ class Trimmed extends /*#__PURE__*/String$.pipe( /*#__PURE__*/trimmed({
|
|
|
2205
2250
|
*/
|
|
2206
2251
|
exports.Trimmed = Trimmed;
|
|
2207
2252
|
class NonEmptyTrimmedString extends /*#__PURE__*/Trimmed.pipe( /*#__PURE__*/nonEmptyString({
|
|
2208
|
-
identifier: "NonEmptyTrimmedString"
|
|
2209
|
-
title: "NonEmptyTrimmedString"
|
|
2253
|
+
identifier: "NonEmptyTrimmedString"
|
|
2210
2254
|
})) {}
|
|
2211
2255
|
/**
|
|
2212
2256
|
* This schema allows removing whitespaces from the beginning and end of a string.
|
|
@@ -2283,8 +2327,7 @@ const parseJson = (schemaOrOptions, o) => isSchema(schemaOrOptions) ? compose(pa
|
|
|
2283
2327
|
*/
|
|
2284
2328
|
exports.parseJson = parseJson;
|
|
2285
2329
|
class NonEmptyString extends /*#__PURE__*/String$.pipe( /*#__PURE__*/nonEmptyString({
|
|
2286
|
-
identifier: "NonEmptyString"
|
|
2287
|
-
title: "NonEmptyString"
|
|
2330
|
+
identifier: "NonEmptyString"
|
|
2288
2331
|
})) {}
|
|
2289
2332
|
/**
|
|
2290
2333
|
* @category schema id
|
|
@@ -2304,7 +2347,6 @@ const uuidRegexp = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}
|
|
|
2304
2347
|
class UUID extends /*#__PURE__*/String$.pipe( /*#__PURE__*/pattern(uuidRegexp, {
|
|
2305
2348
|
schemaId: UUIDSchemaId,
|
|
2306
2349
|
identifier: "UUID",
|
|
2307
|
-
title: "UUID",
|
|
2308
2350
|
jsonSchema: {
|
|
2309
2351
|
format: "uuid",
|
|
2310
2352
|
pattern: uuidRegexp.source
|
|
@@ -2331,7 +2373,6 @@ const ulidRegexp = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i;
|
|
|
2331
2373
|
class ULID extends /*#__PURE__*/String$.pipe( /*#__PURE__*/pattern(ulidRegexp, {
|
|
2332
2374
|
schemaId: ULIDSchemaId,
|
|
2333
2375
|
identifier: "ULID",
|
|
2334
|
-
title: "ULID",
|
|
2335
2376
|
description: "a Universally Unique Lexicographically Sortable Identifier",
|
|
2336
2377
|
arbitrary: () => fc => fc.ulid()
|
|
2337
2378
|
})) {}
|
|
@@ -2344,7 +2385,6 @@ class ULID extends /*#__PURE__*/String$.pipe( /*#__PURE__*/pattern(ulidRegexp, {
|
|
|
2344
2385
|
exports.ULID = ULID;
|
|
2345
2386
|
class URLFromSelf extends /*#__PURE__*/instanceOf(URL, {
|
|
2346
2387
|
identifier: "URLFromSelf",
|
|
2347
|
-
title: "URLFromSelf",
|
|
2348
2388
|
arbitrary: () => fc => fc.webUrl().map(s => new URL(s)),
|
|
2349
2389
|
pretty: () => url => url.toString()
|
|
2350
2390
|
}) {}
|
|
@@ -2361,7 +2401,6 @@ class URL$ extends /*#__PURE__*/transformOrFail(String$.annotations({
|
|
|
2361
2401
|
encode: url => ParseResult.succeed(url.toString())
|
|
2362
2402
|
}).annotations({
|
|
2363
2403
|
identifier: "URL",
|
|
2364
|
-
title: "URL",
|
|
2365
2404
|
pretty: () => url => url.toString()
|
|
2366
2405
|
}) {}
|
|
2367
2406
|
exports.URL = URL$;
|
|
@@ -2371,15 +2410,14 @@ exports.URL = URL$;
|
|
|
2371
2410
|
*/
|
|
2372
2411
|
const FiniteSchemaId = exports.FiniteSchemaId = schemaId_.FiniteSchemaId;
|
|
2373
2412
|
/**
|
|
2374
|
-
* Ensures that the provided value is a finite number.
|
|
2375
|
-
*
|
|
2376
|
-
* This schema filters out non-finite numeric values, allowing only finite numbers to pass through.
|
|
2413
|
+
* Ensures that the provided value is a finite number (excluding NaN, +Infinity, and -Infinity).
|
|
2377
2414
|
*
|
|
2378
2415
|
* @category number filters
|
|
2379
2416
|
* @since 3.10.0
|
|
2380
2417
|
*/
|
|
2381
2418
|
const finite = annotations => self => self.pipe(filter(Number.isFinite, {
|
|
2382
2419
|
schemaId: FiniteSchemaId,
|
|
2420
|
+
title: "finite",
|
|
2383
2421
|
description: "a finite number",
|
|
2384
2422
|
jsonSchema: {
|
|
2385
2423
|
"type": "number"
|
|
@@ -2400,6 +2438,7 @@ const GreaterThanSchemaId = exports.GreaterThanSchemaId = schemaId_.GreaterThanS
|
|
|
2400
2438
|
*/
|
|
2401
2439
|
const greaterThan = (exclusiveMinimum, annotations) => self => self.pipe(filter(a => a > exclusiveMinimum, {
|
|
2402
2440
|
schemaId: GreaterThanSchemaId,
|
|
2441
|
+
title: `greaterThan(${exclusiveMinimum})`,
|
|
2403
2442
|
description: exclusiveMinimum === 0 ? "a positive number" : `a number greater than ${exclusiveMinimum}`,
|
|
2404
2443
|
jsonSchema: {
|
|
2405
2444
|
exclusiveMinimum
|
|
@@ -2420,6 +2459,7 @@ const GreaterThanOrEqualToSchemaId = exports.GreaterThanOrEqualToSchemaId = sche
|
|
|
2420
2459
|
*/
|
|
2421
2460
|
const greaterThanOrEqualTo = (minimum, annotations) => self => self.pipe(filter(a => a >= minimum, {
|
|
2422
2461
|
schemaId: GreaterThanOrEqualToSchemaId,
|
|
2462
|
+
title: `greaterThanOrEqualTo(${minimum})`,
|
|
2423
2463
|
description: minimum === 0 ? "a non-negative number" : `a number greater than or equal to ${minimum}`,
|
|
2424
2464
|
jsonSchema: {
|
|
2425
2465
|
minimum
|
|
@@ -2436,15 +2476,18 @@ const MultipleOfSchemaId = exports.MultipleOfSchemaId = /*#__PURE__*/Symbol.for(
|
|
|
2436
2476
|
* @category number filters
|
|
2437
2477
|
* @since 3.10.0
|
|
2438
2478
|
*/
|
|
2439
|
-
const multipleOf = (divisor, annotations) => self =>
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
}
|
|
2479
|
+
const multipleOf = (divisor, annotations) => self => {
|
|
2480
|
+
const positiveDivisor = Math.abs(divisor); // spec requires positive divisor
|
|
2481
|
+
return self.pipe(filter(a => number_.remainder(a, divisor) === 0, {
|
|
2482
|
+
schemaId: MultipleOfSchemaId,
|
|
2483
|
+
title: `multipleOf(${positiveDivisor})`,
|
|
2484
|
+
description: `a number divisible by ${positiveDivisor}`,
|
|
2485
|
+
jsonSchema: {
|
|
2486
|
+
multipleOf: positiveDivisor
|
|
2487
|
+
},
|
|
2488
|
+
...annotations
|
|
2489
|
+
}));
|
|
2490
|
+
};
|
|
2448
2491
|
/**
|
|
2449
2492
|
* @category schema id
|
|
2450
2493
|
* @since 3.10.0
|
|
@@ -2452,12 +2495,14 @@ const multipleOf = (divisor, annotations) => self => self.pipe(filter(a => numbe
|
|
|
2452
2495
|
exports.multipleOf = multipleOf;
|
|
2453
2496
|
const IntSchemaId = exports.IntSchemaId = schemaId_.IntSchemaId;
|
|
2454
2497
|
/**
|
|
2498
|
+
* Ensures that the provided value is an integer number (excluding NaN, +Infinity, and -Infinity).
|
|
2499
|
+
*
|
|
2455
2500
|
* @category number filters
|
|
2456
2501
|
* @since 3.10.0
|
|
2457
2502
|
*/
|
|
2458
2503
|
const int = annotations => self => self.pipe(filter(a => Number.isSafeInteger(a), {
|
|
2459
2504
|
schemaId: IntSchemaId,
|
|
2460
|
-
title: "
|
|
2505
|
+
title: "int",
|
|
2461
2506
|
description: "an integer",
|
|
2462
2507
|
jsonSchema: {
|
|
2463
2508
|
type: "integer"
|
|
@@ -2478,6 +2523,7 @@ const LessThanSchemaId = exports.LessThanSchemaId = schemaId_.LessThanSchemaId;
|
|
|
2478
2523
|
*/
|
|
2479
2524
|
const lessThan = (exclusiveMaximum, annotations) => self => self.pipe(filter(a => a < exclusiveMaximum, {
|
|
2480
2525
|
schemaId: LessThanSchemaId,
|
|
2526
|
+
title: `lessThan(${exclusiveMaximum})`,
|
|
2481
2527
|
description: exclusiveMaximum === 0 ? "a negative number" : `a number less than ${exclusiveMaximum}`,
|
|
2482
2528
|
jsonSchema: {
|
|
2483
2529
|
exclusiveMaximum
|
|
@@ -2498,6 +2544,7 @@ const LessThanOrEqualToSchemaId = exports.LessThanOrEqualToSchemaId = schemaId_.
|
|
|
2498
2544
|
*/
|
|
2499
2545
|
const lessThanOrEqualTo = (maximum, annotations) => self => self.pipe(filter(a => a <= maximum, {
|
|
2500
2546
|
schemaId: LessThanOrEqualToSchemaId,
|
|
2547
|
+
title: `lessThanOrEqualTo(${maximum})`,
|
|
2501
2548
|
description: maximum === 0 ? "a non-positive number" : `a number less than or equal to ${maximum}`,
|
|
2502
2549
|
jsonSchema: {
|
|
2503
2550
|
maximum
|
|
@@ -2518,6 +2565,7 @@ const BetweenSchemaId = exports.BetweenSchemaId = schemaId_.BetweenSchemaId;
|
|
|
2518
2565
|
*/
|
|
2519
2566
|
const between = (minimum, maximum, annotations) => self => self.pipe(filter(a => a >= minimum && a <= maximum, {
|
|
2520
2567
|
schemaId: BetweenSchemaId,
|
|
2568
|
+
title: `between(${minimum}, ${maximum})`,
|
|
2521
2569
|
description: `a number between ${minimum} and ${maximum}`,
|
|
2522
2570
|
jsonSchema: {
|
|
2523
2571
|
minimum,
|
|
@@ -2537,6 +2585,7 @@ const NonNaNSchemaId = exports.NonNaNSchemaId = schemaId_.NonNaNSchemaId;
|
|
|
2537
2585
|
*/
|
|
2538
2586
|
const nonNaN = annotations => self => self.pipe(filter(a => !Number.isNaN(a), {
|
|
2539
2587
|
schemaId: NonNaNSchemaId,
|
|
2588
|
+
title: "nonNaN",
|
|
2540
2589
|
description: "a number excluding NaN",
|
|
2541
2590
|
...annotations
|
|
2542
2591
|
}));
|
|
@@ -2545,25 +2594,37 @@ const nonNaN = annotations => self => self.pipe(filter(a => !Number.isNaN(a), {
|
|
|
2545
2594
|
* @since 3.10.0
|
|
2546
2595
|
*/
|
|
2547
2596
|
exports.nonNaN = nonNaN;
|
|
2548
|
-
const positive = annotations => greaterThan(0,
|
|
2597
|
+
const positive = annotations => greaterThan(0, {
|
|
2598
|
+
title: "positive",
|
|
2599
|
+
...annotations
|
|
2600
|
+
});
|
|
2549
2601
|
/**
|
|
2550
2602
|
* @category number filters
|
|
2551
2603
|
* @since 3.10.0
|
|
2552
2604
|
*/
|
|
2553
2605
|
exports.positive = positive;
|
|
2554
|
-
const negative = annotations => lessThan(0,
|
|
2606
|
+
const negative = annotations => lessThan(0, {
|
|
2607
|
+
title: "negative",
|
|
2608
|
+
...annotations
|
|
2609
|
+
});
|
|
2555
2610
|
/**
|
|
2556
2611
|
* @category number filters
|
|
2557
2612
|
* @since 3.10.0
|
|
2558
2613
|
*/
|
|
2559
2614
|
exports.negative = negative;
|
|
2560
|
-
const nonPositive = annotations => lessThanOrEqualTo(0,
|
|
2615
|
+
const nonPositive = annotations => lessThanOrEqualTo(0, {
|
|
2616
|
+
title: "nonPositive",
|
|
2617
|
+
...annotations
|
|
2618
|
+
});
|
|
2561
2619
|
/**
|
|
2562
2620
|
* @category number filters
|
|
2563
2621
|
* @since 3.10.0
|
|
2564
2622
|
*/
|
|
2565
2623
|
exports.nonPositive = nonPositive;
|
|
2566
|
-
const nonNegative = annotations => greaterThanOrEqualTo(0,
|
|
2624
|
+
const nonNegative = annotations => greaterThanOrEqualTo(0, {
|
|
2625
|
+
title: "nonNegative",
|
|
2626
|
+
...annotations
|
|
2627
|
+
});
|
|
2567
2628
|
/**
|
|
2568
2629
|
* Clamps a number between a minimum and a maximum value.
|
|
2569
2630
|
*
|
|
@@ -2617,8 +2678,7 @@ class NumberFromString extends /*#__PURE__*/parseNumber(String$.annotations({
|
|
|
2617
2678
|
*/
|
|
2618
2679
|
exports.NumberFromString = NumberFromString;
|
|
2619
2680
|
class Finite extends /*#__PURE__*/Number$.pipe( /*#__PURE__*/finite({
|
|
2620
|
-
identifier: "Finite"
|
|
2621
|
-
title: "Finite"
|
|
2681
|
+
identifier: "Finite"
|
|
2622
2682
|
})) {}
|
|
2623
2683
|
/**
|
|
2624
2684
|
* @category number constructors
|
|
@@ -2626,8 +2686,7 @@ class Finite extends /*#__PURE__*/Number$.pipe( /*#__PURE__*/finite({
|
|
|
2626
2686
|
*/
|
|
2627
2687
|
exports.Finite = Finite;
|
|
2628
2688
|
class Int extends /*#__PURE__*/Number$.pipe( /*#__PURE__*/int({
|
|
2629
|
-
identifier: "Int"
|
|
2630
|
-
title: "Int"
|
|
2689
|
+
identifier: "Int"
|
|
2631
2690
|
})) {}
|
|
2632
2691
|
/**
|
|
2633
2692
|
* @category number constructors
|
|
@@ -2635,8 +2694,7 @@ class Int extends /*#__PURE__*/Number$.pipe( /*#__PURE__*/int({
|
|
|
2635
2694
|
*/
|
|
2636
2695
|
exports.Int = Int;
|
|
2637
2696
|
class NonNaN extends /*#__PURE__*/Number$.pipe( /*#__PURE__*/nonNaN({
|
|
2638
|
-
identifier: "NonNaN"
|
|
2639
|
-
title: "NonNaN"
|
|
2697
|
+
identifier: "NonNaN"
|
|
2640
2698
|
})) {}
|
|
2641
2699
|
/**
|
|
2642
2700
|
* @category number constructors
|
|
@@ -2644,8 +2702,7 @@ class NonNaN extends /*#__PURE__*/Number$.pipe( /*#__PURE__*/nonNaN({
|
|
|
2644
2702
|
*/
|
|
2645
2703
|
exports.NonNaN = NonNaN;
|
|
2646
2704
|
class Positive extends /*#__PURE__*/Number$.pipe( /*#__PURE__*/positive({
|
|
2647
|
-
identifier: "Positive"
|
|
2648
|
-
title: "Positive"
|
|
2705
|
+
identifier: "Positive"
|
|
2649
2706
|
})) {}
|
|
2650
2707
|
/**
|
|
2651
2708
|
* @category number constructors
|
|
@@ -2653,8 +2710,7 @@ class Positive extends /*#__PURE__*/Number$.pipe( /*#__PURE__*/positive({
|
|
|
2653
2710
|
*/
|
|
2654
2711
|
exports.Positive = Positive;
|
|
2655
2712
|
class Negative extends /*#__PURE__*/Number$.pipe( /*#__PURE__*/negative({
|
|
2656
|
-
identifier: "Negative"
|
|
2657
|
-
title: "Negative"
|
|
2713
|
+
identifier: "Negative"
|
|
2658
2714
|
})) {}
|
|
2659
2715
|
/**
|
|
2660
2716
|
* @category number constructors
|
|
@@ -2662,8 +2718,7 @@ class Negative extends /*#__PURE__*/Number$.pipe( /*#__PURE__*/negative({
|
|
|
2662
2718
|
*/
|
|
2663
2719
|
exports.Negative = Negative;
|
|
2664
2720
|
class NonPositive extends /*#__PURE__*/Number$.pipe( /*#__PURE__*/nonPositive({
|
|
2665
|
-
identifier: "NonPositive"
|
|
2666
|
-
title: "NonPositive"
|
|
2721
|
+
identifier: "NonPositive"
|
|
2667
2722
|
})) {}
|
|
2668
2723
|
/**
|
|
2669
2724
|
* @category number constructors
|
|
@@ -2671,8 +2726,7 @@ class NonPositive extends /*#__PURE__*/Number$.pipe( /*#__PURE__*/nonPositive({
|
|
|
2671
2726
|
*/
|
|
2672
2727
|
exports.NonPositive = NonPositive;
|
|
2673
2728
|
class NonNegative extends /*#__PURE__*/Number$.pipe( /*#__PURE__*/nonNegative({
|
|
2674
|
-
identifier: "NonNegative"
|
|
2675
|
-
title: "NonNegative"
|
|
2729
|
+
identifier: "NonNegative"
|
|
2676
2730
|
})) {}
|
|
2677
2731
|
/**
|
|
2678
2732
|
* @category schema id
|
|
@@ -2702,9 +2756,7 @@ const JsonNumberSchemaId = exports.JsonNumberSchemaId = schemaId_.JsonNumberSche
|
|
|
2702
2756
|
*/
|
|
2703
2757
|
class JsonNumber extends /*#__PURE__*/Number$.pipe( /*#__PURE__*/finite({
|
|
2704
2758
|
schemaId: JsonNumberSchemaId,
|
|
2705
|
-
identifier: "JsonNumber"
|
|
2706
|
-
title: "JSON-compatible number",
|
|
2707
|
-
description: "a JSON-compatible number, excluding NaN, +Infinity, and -Infinity"
|
|
2759
|
+
identifier: "JsonNumber"
|
|
2708
2760
|
})) {}
|
|
2709
2761
|
/**
|
|
2710
2762
|
* @category boolean transformations
|
|
@@ -2744,6 +2796,7 @@ const greaterThanBigInt = (min, annotations) => self => self.pipe(filter(a => a
|
|
|
2744
2796
|
[GreaterThanBigIntSchemaId]: {
|
|
2745
2797
|
min
|
|
2746
2798
|
},
|
|
2799
|
+
title: `greaterThanBigInt(${min})`,
|
|
2747
2800
|
description: min === 0n ? "a positive bigint" : `a bigint greater than ${min}n`,
|
|
2748
2801
|
...annotations
|
|
2749
2802
|
}));
|
|
@@ -2762,6 +2815,7 @@ const greaterThanOrEqualToBigInt = (min, annotations) => self => self.pipe(filte
|
|
|
2762
2815
|
[GreaterThanOrEqualToBigIntSchemaId]: {
|
|
2763
2816
|
min
|
|
2764
2817
|
},
|
|
2818
|
+
title: `greaterThanOrEqualToBigInt(${min})`,
|
|
2765
2819
|
description: min === 0n ? "a non-negative bigint" : `a bigint greater than or equal to ${min}n`,
|
|
2766
2820
|
...annotations
|
|
2767
2821
|
}));
|
|
@@ -2780,6 +2834,7 @@ const lessThanBigInt = (max, annotations) => self => self.pipe(filter(a => a < m
|
|
|
2780
2834
|
[LessThanBigIntSchemaId]: {
|
|
2781
2835
|
max
|
|
2782
2836
|
},
|
|
2837
|
+
title: `lessThanBigInt(${max})`,
|
|
2783
2838
|
description: max === 0n ? "a negative bigint" : `a bigint less than ${max}n`,
|
|
2784
2839
|
...annotations
|
|
2785
2840
|
}));
|
|
@@ -2798,6 +2853,7 @@ const lessThanOrEqualToBigInt = (max, annotations) => self => self.pipe(filter(a
|
|
|
2798
2853
|
[LessThanOrEqualToBigIntSchemaId]: {
|
|
2799
2854
|
max
|
|
2800
2855
|
},
|
|
2856
|
+
title: `lessThanOrEqualToBigInt(${max})`,
|
|
2801
2857
|
description: max === 0n ? "a non-positive bigint" : `a bigint less than or equal to ${max}n`,
|
|
2802
2858
|
...annotations
|
|
2803
2859
|
}));
|
|
@@ -2817,6 +2873,7 @@ const betweenBigInt = (min, max, annotations) => self => self.pipe(filter(a => a
|
|
|
2817
2873
|
min,
|
|
2818
2874
|
max
|
|
2819
2875
|
},
|
|
2876
|
+
title: `betweenBigInt(${min}, ${max})`,
|
|
2820
2877
|
description: `a bigint between ${min}n and ${max}n`,
|
|
2821
2878
|
...annotations
|
|
2822
2879
|
}));
|
|
@@ -2825,25 +2882,37 @@ const betweenBigInt = (min, max, annotations) => self => self.pipe(filter(a => a
|
|
|
2825
2882
|
* @since 3.10.0
|
|
2826
2883
|
*/
|
|
2827
2884
|
exports.betweenBigInt = betweenBigInt;
|
|
2828
|
-
const positiveBigInt = annotations => greaterThanBigInt(0n,
|
|
2885
|
+
const positiveBigInt = annotations => greaterThanBigInt(0n, {
|
|
2886
|
+
title: "positiveBigInt",
|
|
2887
|
+
...annotations
|
|
2888
|
+
});
|
|
2829
2889
|
/**
|
|
2830
2890
|
* @category bigint filters
|
|
2831
2891
|
* @since 3.10.0
|
|
2832
2892
|
*/
|
|
2833
2893
|
exports.positiveBigInt = positiveBigInt;
|
|
2834
|
-
const negativeBigInt = annotations => lessThanBigInt(0n,
|
|
2894
|
+
const negativeBigInt = annotations => lessThanBigInt(0n, {
|
|
2895
|
+
title: "negativeBigInt",
|
|
2896
|
+
...annotations
|
|
2897
|
+
});
|
|
2835
2898
|
/**
|
|
2836
2899
|
* @category bigint filters
|
|
2837
2900
|
* @since 3.10.0
|
|
2838
2901
|
*/
|
|
2839
2902
|
exports.negativeBigInt = negativeBigInt;
|
|
2840
|
-
const nonNegativeBigInt = annotations => greaterThanOrEqualToBigInt(0n,
|
|
2903
|
+
const nonNegativeBigInt = annotations => greaterThanOrEqualToBigInt(0n, {
|
|
2904
|
+
title: "nonNegativeBigInt",
|
|
2905
|
+
...annotations
|
|
2906
|
+
});
|
|
2841
2907
|
/**
|
|
2842
2908
|
* @category bigint filters
|
|
2843
2909
|
* @since 3.10.0
|
|
2844
2910
|
*/
|
|
2845
2911
|
exports.nonNegativeBigInt = nonNegativeBigInt;
|
|
2846
|
-
const nonPositiveBigInt = annotations => lessThanOrEqualToBigInt(0n,
|
|
2912
|
+
const nonPositiveBigInt = annotations => lessThanOrEqualToBigInt(0n, {
|
|
2913
|
+
title: "nonPositiveBigInt",
|
|
2914
|
+
...annotations
|
|
2915
|
+
});
|
|
2847
2916
|
/**
|
|
2848
2917
|
* Clamps a bigint between a minimum and a maximum value.
|
|
2849
2918
|
*
|
|
@@ -2876,64 +2945,56 @@ exports.BigInt = BigInt$;
|
|
|
2876
2945
|
* @since 3.10.0
|
|
2877
2946
|
*/
|
|
2878
2947
|
const PositiveBigIntFromSelf = exports.PositiveBigIntFromSelf = /*#__PURE__*/BigIntFromSelf.pipe( /*#__PURE__*/positiveBigInt({
|
|
2879
|
-
identifier: "PositiveBigintFromSelf"
|
|
2880
|
-
title: "PositiveBigintFromSelf"
|
|
2948
|
+
identifier: "PositiveBigintFromSelf"
|
|
2881
2949
|
}));
|
|
2882
2950
|
/**
|
|
2883
2951
|
* @category bigint constructors
|
|
2884
2952
|
* @since 3.10.0
|
|
2885
2953
|
*/
|
|
2886
2954
|
const PositiveBigInt = exports.PositiveBigInt = /*#__PURE__*/BigInt$.pipe( /*#__PURE__*/positiveBigInt({
|
|
2887
|
-
identifier: "PositiveBigint"
|
|
2888
|
-
title: "PositiveBigint"
|
|
2955
|
+
identifier: "PositiveBigint"
|
|
2889
2956
|
}));
|
|
2890
2957
|
/**
|
|
2891
2958
|
* @category bigint constructors
|
|
2892
2959
|
* @since 3.10.0
|
|
2893
2960
|
*/
|
|
2894
2961
|
const NegativeBigIntFromSelf = exports.NegativeBigIntFromSelf = /*#__PURE__*/BigIntFromSelf.pipe( /*#__PURE__*/negativeBigInt({
|
|
2895
|
-
identifier: "NegativeBigintFromSelf"
|
|
2896
|
-
title: "NegativeBigintFromSelf"
|
|
2962
|
+
identifier: "NegativeBigintFromSelf"
|
|
2897
2963
|
}));
|
|
2898
2964
|
/**
|
|
2899
2965
|
* @category bigint constructors
|
|
2900
2966
|
* @since 3.10.0
|
|
2901
2967
|
*/
|
|
2902
2968
|
const NegativeBigInt = exports.NegativeBigInt = /*#__PURE__*/BigInt$.pipe( /*#__PURE__*/negativeBigInt({
|
|
2903
|
-
identifier: "NegativeBigint"
|
|
2904
|
-
title: "NegativeBigint"
|
|
2969
|
+
identifier: "NegativeBigint"
|
|
2905
2970
|
}));
|
|
2906
2971
|
/**
|
|
2907
2972
|
* @category bigint constructors
|
|
2908
2973
|
* @since 3.10.0
|
|
2909
2974
|
*/
|
|
2910
2975
|
const NonPositiveBigIntFromSelf = exports.NonPositiveBigIntFromSelf = /*#__PURE__*/BigIntFromSelf.pipe( /*#__PURE__*/nonPositiveBigInt({
|
|
2911
|
-
identifier: "NonPositiveBigintFromSelf"
|
|
2912
|
-
title: "NonPositiveBigintFromSelf"
|
|
2976
|
+
identifier: "NonPositiveBigintFromSelf"
|
|
2913
2977
|
}));
|
|
2914
2978
|
/**
|
|
2915
2979
|
* @category bigint constructors
|
|
2916
2980
|
* @since 3.10.0
|
|
2917
2981
|
*/
|
|
2918
2982
|
const NonPositiveBigInt = exports.NonPositiveBigInt = /*#__PURE__*/BigInt$.pipe( /*#__PURE__*/nonPositiveBigInt({
|
|
2919
|
-
identifier: "NonPositiveBigint"
|
|
2920
|
-
title: "NonPositiveBigint"
|
|
2983
|
+
identifier: "NonPositiveBigint"
|
|
2921
2984
|
}));
|
|
2922
2985
|
/**
|
|
2923
2986
|
* @category bigint constructors
|
|
2924
2987
|
* @since 3.10.0
|
|
2925
2988
|
*/
|
|
2926
2989
|
const NonNegativeBigIntFromSelf = exports.NonNegativeBigIntFromSelf = /*#__PURE__*/BigIntFromSelf.pipe( /*#__PURE__*/nonNegativeBigInt({
|
|
2927
|
-
identifier: "NonNegativeBigintFromSelf"
|
|
2928
|
-
title: "NonNegativeBigintFromSelf"
|
|
2990
|
+
identifier: "NonNegativeBigintFromSelf"
|
|
2929
2991
|
}));
|
|
2930
2992
|
/**
|
|
2931
2993
|
* @category bigint constructors
|
|
2932
2994
|
* @since 3.10.0
|
|
2933
2995
|
*/
|
|
2934
2996
|
const NonNegativeBigInt = exports.NonNegativeBigInt = /*#__PURE__*/BigInt$.pipe( /*#__PURE__*/nonNegativeBigInt({
|
|
2935
|
-
identifier: "NonNegativeBigint"
|
|
2936
|
-
title: "NonNegativeBigint"
|
|
2997
|
+
identifier: "NonNegativeBigint"
|
|
2937
2998
|
}));
|
|
2938
2999
|
/**
|
|
2939
3000
|
* This schema transforms a `number` into a `bigint` by parsing the number using the `BigInt` function.
|
|
@@ -3034,21 +3095,28 @@ class DurationFromMillis extends /*#__PURE__*/transform(Number$.annotations({
|
|
|
3034
3095
|
}).annotations({
|
|
3035
3096
|
identifier: "DurationFromMillis"
|
|
3036
3097
|
}) {}
|
|
3098
|
+
/**
|
|
3099
|
+
* @category number constructors
|
|
3100
|
+
* @since 3.11.10
|
|
3101
|
+
*/
|
|
3037
3102
|
exports.DurationFromMillis = DurationFromMillis;
|
|
3038
|
-
const
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3103
|
+
const NonNegativeInt = exports.NonNegativeInt = /*#__PURE__*/NonNegative.pipe(int()).annotations({
|
|
3104
|
+
identifier: "NonNegativeInt"
|
|
3105
|
+
});
|
|
3106
|
+
const HRTime = /*#__PURE__*/Tuple(element(NonNegativeInt).annotations({
|
|
3107
|
+
title: "seconds"
|
|
3108
|
+
}), element(NonNegativeInt).annotations({
|
|
3109
|
+
title: "nanos"
|
|
3110
|
+
})).annotations({
|
|
3111
|
+
identifier: "HRTime"
|
|
3112
|
+
});
|
|
3045
3113
|
/**
|
|
3046
3114
|
* A schema that transforms a `[number, number]` tuple into a `Duration`.
|
|
3047
3115
|
*
|
|
3048
3116
|
* @category Duration transformations
|
|
3049
3117
|
* @since 3.10.0
|
|
3050
3118
|
*/
|
|
3051
|
-
class Duration extends /*#__PURE__*/transform(
|
|
3119
|
+
class Duration extends /*#__PURE__*/transform(HRTime.annotations({
|
|
3052
3120
|
description: "a tuple of seconds and nanos that will be parsed into a Duration"
|
|
3053
3121
|
}), DurationFromSelf, {
|
|
3054
3122
|
strict: true,
|
|
@@ -3087,6 +3155,7 @@ const lessThanDuration = (max, annotations) => self => self.pipe(filter(a => dur
|
|
|
3087
3155
|
[LessThanDurationSchemaId]: {
|
|
3088
3156
|
max
|
|
3089
3157
|
},
|
|
3158
|
+
title: `lessThanDuration(${max})`,
|
|
3090
3159
|
description: `a Duration less than ${duration_.decode(max)}`,
|
|
3091
3160
|
...annotations
|
|
3092
3161
|
}));
|
|
@@ -3105,6 +3174,7 @@ const lessThanOrEqualToDuration = (max, annotations) => self => self.pipe(filter
|
|
|
3105
3174
|
[LessThanDurationSchemaId]: {
|
|
3106
3175
|
max
|
|
3107
3176
|
},
|
|
3177
|
+
title: `lessThanOrEqualToDuration(${max})`,
|
|
3108
3178
|
description: `a Duration less than or equal to ${duration_.decode(max)}`,
|
|
3109
3179
|
...annotations
|
|
3110
3180
|
}));
|
|
@@ -3123,6 +3193,7 @@ const greaterThanDuration = (min, annotations) => self => self.pipe(filter(a =>
|
|
|
3123
3193
|
[GreaterThanDurationSchemaId]: {
|
|
3124
3194
|
min
|
|
3125
3195
|
},
|
|
3196
|
+
title: `greaterThanDuration(${min})`,
|
|
3126
3197
|
description: `a Duration greater than ${duration_.decode(min)}`,
|
|
3127
3198
|
...annotations
|
|
3128
3199
|
}));
|
|
@@ -3141,6 +3212,7 @@ const greaterThanOrEqualToDuration = (min, annotations) => self => self.pipe(fil
|
|
|
3141
3212
|
[GreaterThanOrEqualToDurationSchemaId]: {
|
|
3142
3213
|
min
|
|
3143
3214
|
},
|
|
3215
|
+
title: `greaterThanOrEqualToDuration(${min})`,
|
|
3144
3216
|
description: `a Duration greater than or equal to ${duration_.decode(min)}`,
|
|
3145
3217
|
...annotations
|
|
3146
3218
|
}));
|
|
@@ -3163,6 +3235,7 @@ const betweenDuration = (minimum, maximum, annotations) => self => self.pipe(fil
|
|
|
3163
3235
|
maximum,
|
|
3164
3236
|
minimum
|
|
3165
3237
|
},
|
|
3238
|
+
title: `betweenDuration(${minimum}, ${maximum})`,
|
|
3166
3239
|
description: `a Duration between ${duration_.decode(minimum)} and ${duration_.decode(maximum)}`,
|
|
3167
3240
|
...annotations
|
|
3168
3241
|
}));
|
|
@@ -3177,10 +3250,15 @@ const Uint8ArrayFromSelf = exports.Uint8ArrayFromSelf = /*#__PURE__*/declare(Pre
|
|
|
3177
3250
|
arbitrary: () => fc => fc.uint8Array(),
|
|
3178
3251
|
equivalence: () => array_.getEquivalence(Equal.equals)
|
|
3179
3252
|
});
|
|
3180
|
-
|
|
3181
|
-
|
|
3253
|
+
/**
|
|
3254
|
+
* @category number constructors
|
|
3255
|
+
* @since 3.11.10
|
|
3256
|
+
*/
|
|
3257
|
+
const Uint8 = exports.Uint8 = /*#__PURE__*/Number$.pipe( /*#__PURE__*/between(0, 255, {
|
|
3258
|
+
identifier: "Uint8",
|
|
3182
3259
|
description: "a 8-bit unsigned integer"
|
|
3183
|
-
}))
|
|
3260
|
+
}));
|
|
3261
|
+
const Uint8Array$ = exports.Uint8Array = /*#__PURE__*/transform(Array$(Uint8).annotations({
|
|
3184
3262
|
description: "an array of 8-bit unsigned integers that will be parsed into a Uint8Array"
|
|
3185
3263
|
}), Uint8ArrayFromSelf, {
|
|
3186
3264
|
strict: true,
|
|
@@ -3265,6 +3343,7 @@ const minItems = (n, annotations) => self => {
|
|
|
3265
3343
|
}
|
|
3266
3344
|
return self.pipe(filter(a => a.length >= minItems, {
|
|
3267
3345
|
schemaId: MinItemsSchemaId,
|
|
3346
|
+
title: `minItems(${minItems})`,
|
|
3268
3347
|
description: `an array of at least ${minItems} item(s)`,
|
|
3269
3348
|
jsonSchema: {
|
|
3270
3349
|
minItems
|
|
@@ -3285,6 +3364,7 @@ const MaxItemsSchemaId = exports.MaxItemsSchemaId = schemaId_.MaxItemsSchemaId;
|
|
|
3285
3364
|
*/
|
|
3286
3365
|
const maxItems = (n, annotations) => self => self.pipe(filter(a => a.length <= n, {
|
|
3287
3366
|
schemaId: MaxItemsSchemaId,
|
|
3367
|
+
title: `maxItems(${n})`,
|
|
3288
3368
|
description: `an array of at most ${n} item(s)`,
|
|
3289
3369
|
jsonSchema: {
|
|
3290
3370
|
maxItems: n
|
|
@@ -3304,6 +3384,7 @@ const ItemsCountSchemaId = exports.ItemsCountSchemaId = schemaId_.ItemsCountSche
|
|
|
3304
3384
|
*/
|
|
3305
3385
|
const itemsCount = (n, annotations) => self => self.pipe(filter(a => a.length === n, {
|
|
3306
3386
|
schemaId: ItemsCountSchemaId,
|
|
3387
|
+
title: `itemsCount(${n})`,
|
|
3307
3388
|
description: `an array of exactly ${n} item(s)`,
|
|
3308
3389
|
jsonSchema: {
|
|
3309
3390
|
minItems: n,
|
|
@@ -3366,6 +3447,7 @@ const validDate = annotations => self => self.pipe(filter(a => !Number.isNaN(a.g
|
|
|
3366
3447
|
[ValidDateSchemaId]: {
|
|
3367
3448
|
noInvalidDate: true
|
|
3368
3449
|
},
|
|
3450
|
+
title: "validDate",
|
|
3369
3451
|
description: "a valid Date",
|
|
3370
3452
|
...annotations
|
|
3371
3453
|
}));
|
|
@@ -3384,6 +3466,7 @@ const lessThanDate = (max, annotations) => self => self.pipe(filter(a => a < max
|
|
|
3384
3466
|
[LessThanDateSchemaId]: {
|
|
3385
3467
|
max
|
|
3386
3468
|
},
|
|
3469
|
+
title: `lessThanDate(${util_.formatDate(max)})`,
|
|
3387
3470
|
description: `a date before ${util_.formatDate(max)}`,
|
|
3388
3471
|
...annotations
|
|
3389
3472
|
}));
|
|
@@ -3402,6 +3485,7 @@ const lessThanOrEqualToDate = (max, annotations) => self => self.pipe(filter(a =
|
|
|
3402
3485
|
[LessThanDateSchemaId]: {
|
|
3403
3486
|
max
|
|
3404
3487
|
},
|
|
3488
|
+
title: `lessThanOrEqualToDate(${util_.formatDate(max)})`,
|
|
3405
3489
|
description: `a date before or equal to ${util_.formatDate(max)}`,
|
|
3406
3490
|
...annotations
|
|
3407
3491
|
}));
|
|
@@ -3420,6 +3504,7 @@ const greaterThanDate = (min, annotations) => self => self.pipe(filter(a => a >
|
|
|
3420
3504
|
[GreaterThanDateSchemaId]: {
|
|
3421
3505
|
min
|
|
3422
3506
|
},
|
|
3507
|
+
title: `greaterThanDate(${util_.formatDate(min)})`,
|
|
3423
3508
|
description: `a date after ${util_.formatDate(min)}`,
|
|
3424
3509
|
...annotations
|
|
3425
3510
|
}));
|
|
@@ -3438,6 +3523,7 @@ const greaterThanOrEqualToDate = (min, annotations) => self => self.pipe(filter(
|
|
|
3438
3523
|
[GreaterThanOrEqualToDateSchemaId]: {
|
|
3439
3524
|
min
|
|
3440
3525
|
},
|
|
3526
|
+
title: `greaterThanOrEqualToDate(${util_.formatDate(min)})`,
|
|
3441
3527
|
description: `a date after or equal to ${util_.formatDate(min)}`,
|
|
3442
3528
|
...annotations
|
|
3443
3529
|
}));
|
|
@@ -3457,6 +3543,7 @@ const betweenDate = (min, max, annotations) => self => self.pipe(filter(a => a <
|
|
|
3457
3543
|
max,
|
|
3458
3544
|
min
|
|
3459
3545
|
},
|
|
3546
|
+
title: `betweenDate(${util_.formatDate(min)}, ${util_.formatDate(max)})`,
|
|
3460
3547
|
description: `a date between ${util_.formatDate(min)} and ${util_.formatDate(max)}`,
|
|
3461
3548
|
...annotations
|
|
3462
3549
|
}));
|
|
@@ -4192,7 +4279,7 @@ class BigDecimalFromNumber extends /*#__PURE__*/transformOrFail(Number$.annotati
|
|
|
4192
4279
|
description: "a number that will be parsed into a BigDecimal"
|
|
4193
4280
|
}), BigDecimalFromSelf, {
|
|
4194
4281
|
strict: true,
|
|
4195
|
-
decode: num => ParseResult.succeed(bigDecimal_.
|
|
4282
|
+
decode: num => ParseResult.succeed(bigDecimal_.unsafeFromNumber(num)),
|
|
4196
4283
|
encode: val => ParseResult.succeed(bigDecimal_.unsafeToNumber(val))
|
|
4197
4284
|
}).annotations({
|
|
4198
4285
|
identifier: "BigDecimalFromNumber"
|
|
@@ -4207,14 +4294,18 @@ const GreaterThanBigDecimalSchemaId = exports.GreaterThanBigDecimalSchemaId = /*
|
|
|
4207
4294
|
* @category BigDecimal filters
|
|
4208
4295
|
* @since 3.10.0
|
|
4209
4296
|
*/
|
|
4210
|
-
const greaterThanBigDecimal = (min, annotations) => self =>
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
})
|
|
4297
|
+
const greaterThanBigDecimal = (min, annotations) => self => {
|
|
4298
|
+
const formatted = bigDecimal_.format(min);
|
|
4299
|
+
return self.pipe(filter(a => bigDecimal_.greaterThan(a, min), {
|
|
4300
|
+
schemaId: GreaterThanBigDecimalSchemaId,
|
|
4301
|
+
[GreaterThanBigDecimalSchemaId]: {
|
|
4302
|
+
min
|
|
4303
|
+
},
|
|
4304
|
+
title: `greaterThanBigDecimal(${formatted})`,
|
|
4305
|
+
description: `a BigDecimal greater than ${formatted}`,
|
|
4306
|
+
...annotations
|
|
4307
|
+
}));
|
|
4308
|
+
};
|
|
4218
4309
|
/**
|
|
4219
4310
|
* @category schema id
|
|
4220
4311
|
* @since 3.10.0
|
|
@@ -4225,14 +4316,18 @@ const GreaterThanOrEqualToBigDecimalSchemaId = exports.GreaterThanOrEqualToBigDe
|
|
|
4225
4316
|
* @category BigDecimal filters
|
|
4226
4317
|
* @since 3.10.0
|
|
4227
4318
|
*/
|
|
4228
|
-
const greaterThanOrEqualToBigDecimal = (min, annotations) => self =>
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
})
|
|
4319
|
+
const greaterThanOrEqualToBigDecimal = (min, annotations) => self => {
|
|
4320
|
+
const formatted = bigDecimal_.format(min);
|
|
4321
|
+
return self.pipe(filter(a => bigDecimal_.greaterThanOrEqualTo(a, min), {
|
|
4322
|
+
schemaId: GreaterThanOrEqualToBigDecimalSchemaId,
|
|
4323
|
+
[GreaterThanOrEqualToBigDecimalSchemaId]: {
|
|
4324
|
+
min
|
|
4325
|
+
},
|
|
4326
|
+
title: `greaterThanOrEqualToBigDecimal(${formatted})`,
|
|
4327
|
+
description: `a BigDecimal greater than or equal to ${formatted}`,
|
|
4328
|
+
...annotations
|
|
4329
|
+
}));
|
|
4330
|
+
};
|
|
4236
4331
|
/**
|
|
4237
4332
|
* @category schema id
|
|
4238
4333
|
* @since 3.10.0
|
|
@@ -4243,14 +4338,18 @@ const LessThanBigDecimalSchemaId = exports.LessThanBigDecimalSchemaId = /*#__PUR
|
|
|
4243
4338
|
* @category BigDecimal filters
|
|
4244
4339
|
* @since 3.10.0
|
|
4245
4340
|
*/
|
|
4246
|
-
const lessThanBigDecimal = (max, annotations) => self =>
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
})
|
|
4341
|
+
const lessThanBigDecimal = (max, annotations) => self => {
|
|
4342
|
+
const formatted = bigDecimal_.format(max);
|
|
4343
|
+
return self.pipe(filter(a => bigDecimal_.lessThan(a, max), {
|
|
4344
|
+
schemaId: LessThanBigDecimalSchemaId,
|
|
4345
|
+
[LessThanBigDecimalSchemaId]: {
|
|
4346
|
+
max
|
|
4347
|
+
},
|
|
4348
|
+
title: `lessThanBigDecimal(${formatted})`,
|
|
4349
|
+
description: `a BigDecimal less than ${formatted}`,
|
|
4350
|
+
...annotations
|
|
4351
|
+
}));
|
|
4352
|
+
};
|
|
4254
4353
|
/**
|
|
4255
4354
|
* @category schema id
|
|
4256
4355
|
* @since 3.10.0
|
|
@@ -4261,14 +4360,18 @@ const LessThanOrEqualToBigDecimalSchemaId = exports.LessThanOrEqualToBigDecimalS
|
|
|
4261
4360
|
* @category BigDecimal filters
|
|
4262
4361
|
* @since 3.10.0
|
|
4263
4362
|
*/
|
|
4264
|
-
const lessThanOrEqualToBigDecimal = (max, annotations) => self =>
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
})
|
|
4363
|
+
const lessThanOrEqualToBigDecimal = (max, annotations) => self => {
|
|
4364
|
+
const formatted = bigDecimal_.format(max);
|
|
4365
|
+
return self.pipe(filter(a => bigDecimal_.lessThanOrEqualTo(a, max), {
|
|
4366
|
+
schemaId: LessThanOrEqualToBigDecimalSchemaId,
|
|
4367
|
+
[LessThanOrEqualToBigDecimalSchemaId]: {
|
|
4368
|
+
max
|
|
4369
|
+
},
|
|
4370
|
+
title: `lessThanOrEqualToBigDecimal(${formatted})`,
|
|
4371
|
+
description: `a BigDecimal less than or equal to ${formatted}`,
|
|
4372
|
+
...annotations
|
|
4373
|
+
}));
|
|
4374
|
+
};
|
|
4272
4375
|
/**
|
|
4273
4376
|
* @category schema id
|
|
4274
4377
|
* @since 3.10.0
|
|
@@ -4281,6 +4384,7 @@ const PositiveBigDecimalSchemaId = exports.PositiveBigDecimalSchemaId = /*#__PUR
|
|
|
4281
4384
|
*/
|
|
4282
4385
|
const positiveBigDecimal = annotations => self => self.pipe(filter(a => bigDecimal_.isPositive(a), {
|
|
4283
4386
|
schemaId: PositiveBigDecimalSchemaId,
|
|
4387
|
+
title: "positiveBigDecimal",
|
|
4284
4388
|
description: `a positive BigDecimal`,
|
|
4285
4389
|
...annotations
|
|
4286
4390
|
}));
|
|
@@ -4290,8 +4394,7 @@ const positiveBigDecimal = annotations => self => self.pipe(filter(a => bigDecim
|
|
|
4290
4394
|
*/
|
|
4291
4395
|
exports.positiveBigDecimal = positiveBigDecimal;
|
|
4292
4396
|
const PositiveBigDecimalFromSelf = exports.PositiveBigDecimalFromSelf = /*#__PURE__*/BigDecimalFromSelf.pipe( /*#__PURE__*/positiveBigDecimal({
|
|
4293
|
-
identifier: "PositiveBigDecimalFromSelf"
|
|
4294
|
-
title: "PositiveBigDecimalFromSelf"
|
|
4397
|
+
identifier: "PositiveBigDecimalFromSelf"
|
|
4295
4398
|
}));
|
|
4296
4399
|
/**
|
|
4297
4400
|
* @category schema id
|
|
@@ -4304,6 +4407,7 @@ const NonNegativeBigDecimalSchemaId = exports.NonNegativeBigDecimalSchemaId = /*
|
|
|
4304
4407
|
*/
|
|
4305
4408
|
const nonNegativeBigDecimal = annotations => self => self.pipe(filter(a => a.value >= 0n, {
|
|
4306
4409
|
schemaId: NonNegativeBigDecimalSchemaId,
|
|
4410
|
+
title: "nonNegativeBigDecimal",
|
|
4307
4411
|
description: `a non-negative BigDecimal`,
|
|
4308
4412
|
...annotations
|
|
4309
4413
|
}));
|
|
@@ -4313,8 +4417,7 @@ const nonNegativeBigDecimal = annotations => self => self.pipe(filter(a => a.val
|
|
|
4313
4417
|
*/
|
|
4314
4418
|
exports.nonNegativeBigDecimal = nonNegativeBigDecimal;
|
|
4315
4419
|
const NonNegativeBigDecimalFromSelf = exports.NonNegativeBigDecimalFromSelf = /*#__PURE__*/BigDecimalFromSelf.pipe( /*#__PURE__*/nonNegativeBigDecimal({
|
|
4316
|
-
identifier: "NonNegativeBigDecimalFromSelf"
|
|
4317
|
-
title: "NonNegativeBigDecimalFromSelf"
|
|
4420
|
+
identifier: "NonNegativeBigDecimalFromSelf"
|
|
4318
4421
|
}));
|
|
4319
4422
|
/**
|
|
4320
4423
|
* @category schema id
|
|
@@ -4327,6 +4430,7 @@ const NegativeBigDecimalSchemaId = exports.NegativeBigDecimalSchemaId = /*#__PUR
|
|
|
4327
4430
|
*/
|
|
4328
4431
|
const negativeBigDecimal = annotations => self => self.pipe(filter(a => bigDecimal_.isNegative(a), {
|
|
4329
4432
|
schemaId: NegativeBigDecimalSchemaId,
|
|
4433
|
+
title: "negativeBigDecimal",
|
|
4330
4434
|
description: `a negative BigDecimal`,
|
|
4331
4435
|
...annotations
|
|
4332
4436
|
}));
|
|
@@ -4336,8 +4440,7 @@ const negativeBigDecimal = annotations => self => self.pipe(filter(a => bigDecim
|
|
|
4336
4440
|
*/
|
|
4337
4441
|
exports.negativeBigDecimal = negativeBigDecimal;
|
|
4338
4442
|
const NegativeBigDecimalFromSelf = exports.NegativeBigDecimalFromSelf = /*#__PURE__*/BigDecimalFromSelf.pipe( /*#__PURE__*/negativeBigDecimal({
|
|
4339
|
-
identifier: "NegativeBigDecimalFromSelf"
|
|
4340
|
-
title: "NegativeBigDecimalFromSelf"
|
|
4443
|
+
identifier: "NegativeBigDecimalFromSelf"
|
|
4341
4444
|
}));
|
|
4342
4445
|
/**
|
|
4343
4446
|
* @category schema id
|
|
@@ -4350,6 +4453,7 @@ const NonPositiveBigDecimalSchemaId = exports.NonPositiveBigDecimalSchemaId = /*
|
|
|
4350
4453
|
*/
|
|
4351
4454
|
const nonPositiveBigDecimal = annotations => self => self.pipe(filter(a => a.value <= 0n, {
|
|
4352
4455
|
schemaId: NonPositiveBigDecimalSchemaId,
|
|
4456
|
+
title: "nonPositiveBigDecimal",
|
|
4353
4457
|
description: `a non-positive BigDecimal`,
|
|
4354
4458
|
...annotations
|
|
4355
4459
|
}));
|
|
@@ -4359,8 +4463,7 @@ const nonPositiveBigDecimal = annotations => self => self.pipe(filter(a => a.val
|
|
|
4359
4463
|
*/
|
|
4360
4464
|
exports.nonPositiveBigDecimal = nonPositiveBigDecimal;
|
|
4361
4465
|
const NonPositiveBigDecimalFromSelf = exports.NonPositiveBigDecimalFromSelf = /*#__PURE__*/BigDecimalFromSelf.pipe( /*#__PURE__*/nonPositiveBigDecimal({
|
|
4362
|
-
identifier: "NonPositiveBigDecimalFromSelf"
|
|
4363
|
-
title: "NonPositiveBigDecimalFromSelf"
|
|
4466
|
+
identifier: "NonPositiveBigDecimalFromSelf"
|
|
4364
4467
|
}));
|
|
4365
4468
|
/**
|
|
4366
4469
|
* @category schema id
|
|
@@ -4371,18 +4474,23 @@ const BetweenBigDecimalSchemaId = exports.BetweenBigDecimalSchemaId = /*#__PURE_
|
|
|
4371
4474
|
* @category BigDecimal filters
|
|
4372
4475
|
* @since 3.10.0
|
|
4373
4476
|
*/
|
|
4374
|
-
const betweenBigDecimal = (minimum, maximum, annotations) => self =>
|
|
4375
|
-
minimum
|
|
4376
|
-
maximum
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
}
|
|
4477
|
+
const betweenBigDecimal = (minimum, maximum, annotations) => self => {
|
|
4478
|
+
const formattedMinimum = bigDecimal_.format(minimum);
|
|
4479
|
+
const formattedMaximum = bigDecimal_.format(maximum);
|
|
4480
|
+
return self.pipe(filter(a => bigDecimal_.between(a, {
|
|
4481
|
+
minimum,
|
|
4482
|
+
maximum
|
|
4483
|
+
}), {
|
|
4484
|
+
schemaId: BetweenBigDecimalSchemaId,
|
|
4485
|
+
[BetweenBigDecimalSchemaId]: {
|
|
4486
|
+
maximum,
|
|
4487
|
+
minimum
|
|
4488
|
+
},
|
|
4489
|
+
title: `betweenBigDecimal(${formattedMinimum}, ${formattedMaximum})`,
|
|
4490
|
+
description: `a BigDecimal between ${formattedMinimum} and ${formattedMaximum}`,
|
|
4491
|
+
...annotations
|
|
4492
|
+
}));
|
|
4493
|
+
};
|
|
4386
4494
|
/**
|
|
4387
4495
|
* Clamps a `BigDecimal` between a minimum and a maximum value.
|
|
4388
4496
|
*
|
|
@@ -4796,14 +4904,8 @@ const FiberIdNoneEncoded = /*#__PURE__*/Struct({
|
|
|
4796
4904
|
});
|
|
4797
4905
|
const FiberIdRuntimeEncoded = /*#__PURE__*/Struct({
|
|
4798
4906
|
_tag: Literal("Runtime"),
|
|
4799
|
-
id: Int
|
|
4800
|
-
|
|
4801
|
-
description: "id"
|
|
4802
|
-
}),
|
|
4803
|
-
startTimeMillis: Int.annotations({
|
|
4804
|
-
title: "startTimeMillis",
|
|
4805
|
-
description: "startTimeMillis"
|
|
4806
|
-
})
|
|
4907
|
+
id: Int,
|
|
4908
|
+
startTimeMillis: Int
|
|
4807
4909
|
}).annotations({
|
|
4808
4910
|
identifier: "FiberIdRuntimeEncoded"
|
|
4809
4911
|
});
|
|
@@ -5387,8 +5489,8 @@ class BooleanFromString extends /*#__PURE__*/transform(Literal("true", "false"),
|
|
|
5387
5489
|
*/
|
|
5388
5490
|
exports.BooleanFromString = BooleanFromString;
|
|
5389
5491
|
const Config = (name, schema) => {
|
|
5390
|
-
const
|
|
5391
|
-
return config_.string(name).pipe(config_.mapOrFail(
|
|
5492
|
+
const decodeUnknownEither = ParseResult.decodeUnknownEither(schema);
|
|
5493
|
+
return config_.string(name).pipe(config_.mapOrFail(s => decodeUnknownEither(s).pipe(either_.mapLeft(error => configError_.InvalidData([], ParseResult.TreeFormatter.formatIssueSync(error))))));
|
|
5392
5494
|
};
|
|
5393
5495
|
// ---------------------------------------------
|
|
5394
5496
|
// Serializable
|