effect 3.12.4 → 3.12.5
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 +72 -14
- package/dist/cjs/Arbitrary.js.map +1 -1
- package/dist/cjs/Inspectable.js +0 -4
- package/dist/cjs/Inspectable.js.map +1 -1
- package/dist/cjs/ParseResult.js +2 -2
- package/dist/cjs/ParseResult.js.map +1 -1
- package/dist/cjs/Schema.js +154 -93
- package/dist/cjs/Schema.js.map +1 -1
- package/dist/cjs/internal/dateTime.js +12 -3
- package/dist/cjs/internal/dateTime.js.map +1 -1
- package/dist/cjs/internal/effect/circular.js +15 -2
- package/dist/cjs/internal/effect/circular.js.map +1 -1
- package/dist/cjs/internal/fiberRuntime.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Arbitrary.d.ts.map +1 -1
- package/dist/dts/Inspectable.d.ts.map +1 -1
- package/dist/dts/ParseResult.d.ts +11 -0
- package/dist/dts/ParseResult.d.ts.map +1 -1
- package/dist/dts/Schema.d.ts +34 -15
- package/dist/dts/Schema.d.ts.map +1 -1
- package/dist/esm/Arbitrary.js +72 -14
- package/dist/esm/Arbitrary.js.map +1 -1
- package/dist/esm/Inspectable.js +0 -3
- package/dist/esm/Inspectable.js.map +1 -1
- package/dist/esm/ParseResult.js +2 -2
- package/dist/esm/ParseResult.js.map +1 -1
- package/dist/esm/Schema.js +149 -86
- package/dist/esm/Schema.js.map +1 -1
- package/dist/esm/internal/dateTime.js +11 -2
- package/dist/esm/internal/dateTime.js.map +1 -1
- package/dist/esm/internal/effect/circular.js +15 -2
- package/dist/esm/internal/effect/circular.js.map +1 -1
- package/dist/esm/internal/fiberRuntime.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/Arbitrary.ts +84 -14
- package/src/Inspectable.ts +0 -1
- package/src/ParseResult.ts +15 -2
- package/src/Schema.ts +191 -93
- package/src/internal/dateTime.ts +12 -2
- package/src/internal/effect/circular.ts +19 -17
- package/src/internal/fiberRuntime.ts +2 -1
- package/src/internal/version.ts +1 -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.DateTimeUtcFromDate = 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;
|
|
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.DateTimeUtcFromDate = 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.ArrayFormatterIssue = exports.ArrayEnsure = exports.Array = exports.Any = void 0;
|
|
7
7
|
exports.Literal = Literal;
|
|
8
|
-
exports.
|
|
9
|
-
exports.StringFromUriComponent = 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 = exports.MaxLengthSchemaId = void 0;
|
|
8
|
+
exports.MapFromSelf = exports.MapFromRecord = exports.Map = exports.LowercasedSchemaId = exports.Lowercased = exports.Lowercase = void 0;
|
|
9
|
+
exports.StringFromUriComponent = 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.PropertyKey = 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 = exports.MaxLengthSchemaId = exports.MaxItemsSchemaId = 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 = exports.Uncapitalize = exports.Uint8ArrayFromSelf = exports.Uint8ArrayFromHex = exports.Uint8ArrayFromBase64Url = void 0;
|
|
13
|
+
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 = exports.Uint8ArrayFromHex = exports.Uint8ArrayFromBase64Url = exports.Uint8ArrayFromBase64 = exports.Uint8Array = 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 = exports.lessThanOrEqualTo = exports.lessThanDuration = exports.lessThanDate = exports.lessThanBigInt = exports.lessThanBigDecimal = void 0;
|
|
88
|
+
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 = exports.lessThanDate = exports.lessThanBigInt = exports.lessThanBigDecimal = exports.lessThan = exports.length = 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", {
|
|
@@ -2283,22 +2283,21 @@ const split = separator => transform(String$.annotations({
|
|
|
2283
2283
|
encode: array_.join(separator)
|
|
2284
2284
|
});
|
|
2285
2285
|
exports.split = split;
|
|
2286
|
-
const
|
|
2287
|
-
|
|
2288
|
-
[AST.
|
|
2289
|
-
|
|
2290
|
-
});
|
|
2291
|
-
const getParseJsonTransformation = options => transformOrFail(JsonString, Unknown, {
|
|
2286
|
+
const getErrorMessage = e => e instanceof Error ? e.message : String(e);
|
|
2287
|
+
const getParseJsonTransformation = options => transformOrFail(String$.annotations({
|
|
2288
|
+
[AST.DescriptionAnnotationId]: "a string to be decoded into JSON"
|
|
2289
|
+
}), Unknown, {
|
|
2292
2290
|
strict: true,
|
|
2293
2291
|
decode: (s, _, ast) => ParseResult.try({
|
|
2294
2292
|
try: () => JSON.parse(s, options?.reviver),
|
|
2295
|
-
catch: e => new ParseResult.Type(ast, s, e
|
|
2293
|
+
catch: e => new ParseResult.Type(ast, s, getErrorMessage(e))
|
|
2296
2294
|
}),
|
|
2297
2295
|
encode: (u, _, ast) => ParseResult.try({
|
|
2298
2296
|
try: () => JSON.stringify(u, options?.replacer, options?.space),
|
|
2299
|
-
catch: e => new ParseResult.Type(ast, u, e
|
|
2297
|
+
catch: e => new ParseResult.Type(ast, u, getErrorMessage(e))
|
|
2300
2298
|
})
|
|
2301
2299
|
}).annotations({
|
|
2300
|
+
title: "parseJson",
|
|
2302
2301
|
schemaId: AST.ParseJsonSchemaId
|
|
2303
2302
|
});
|
|
2304
2303
|
/**
|
|
@@ -2391,12 +2390,12 @@ class URLFromSelf extends /*#__PURE__*/instanceOf(URL, {
|
|
|
2391
2390
|
/** @ignore */
|
|
2392
2391
|
exports.URLFromSelf = URLFromSelf;
|
|
2393
2392
|
class URL$ extends /*#__PURE__*/transformOrFail(String$.annotations({
|
|
2394
|
-
description: "a string
|
|
2393
|
+
description: "a string to be decoded into a URL"
|
|
2395
2394
|
}), URLFromSelf, {
|
|
2396
2395
|
strict: true,
|
|
2397
|
-
decode: (
|
|
2398
|
-
try: () => new URL(
|
|
2399
|
-
catch:
|
|
2396
|
+
decode: (s, _, ast) => ParseResult.try({
|
|
2397
|
+
try: () => new URL(s),
|
|
2398
|
+
catch: e => new ParseResult.Type(ast, s, `Unable to decode ${JSON.stringify(s)} into a URL. ${getErrorMessage(e)}`)
|
|
2400
2399
|
}),
|
|
2401
2400
|
encode: url => ParseResult.succeed(url.toString())
|
|
2402
2401
|
}).annotations({
|
|
@@ -2653,7 +2652,7 @@ const clamp = (minimum, maximum) => self => transform(self, self.pipe(typeSchema
|
|
|
2653
2652
|
exports.clamp = clamp;
|
|
2654
2653
|
const parseNumber = self => transformOrFail(self, Number$, {
|
|
2655
2654
|
strict: false,
|
|
2656
|
-
decode: (s, _, ast) => ParseResult.fromOption(number_.parse(s), () => new ParseResult.Type(ast, s)),
|
|
2655
|
+
decode: (s, _, ast) => ParseResult.fromOption(number_.parse(s), () => new ParseResult.Type(ast, s, `Unable to decode ${JSON.stringify(s)} into a number`)),
|
|
2657
2656
|
encode: n => ParseResult.succeed(String(n))
|
|
2658
2657
|
});
|
|
2659
2658
|
/**
|
|
@@ -2668,7 +2667,7 @@ const parseNumber = self => transformOrFail(self, Number$, {
|
|
|
2668
2667
|
*/
|
|
2669
2668
|
exports.parseNumber = parseNumber;
|
|
2670
2669
|
class NumberFromString extends /*#__PURE__*/parseNumber(String$.annotations({
|
|
2671
|
-
description: "a string
|
|
2670
|
+
description: "a string to be decoded into a number"
|
|
2672
2671
|
})).annotations({
|
|
2673
2672
|
identifier: "NumberFromString"
|
|
2674
2673
|
}) {}
|
|
@@ -2770,18 +2769,37 @@ class Not extends /*#__PURE__*/transform( /*#__PURE__*/Boolean$.annotations({
|
|
|
2770
2769
|
decode: boolean_.not,
|
|
2771
2770
|
encode: boolean_.not
|
|
2772
2771
|
}) {}
|
|
2773
|
-
/** @ignore */
|
|
2774
2772
|
exports.Not = Not;
|
|
2775
|
-
|
|
2776
|
-
|
|
2773
|
+
const encodeSymbol = (sym, _, ast) => {
|
|
2774
|
+
const key = Symbol.keyFor(sym);
|
|
2775
|
+
return key === undefined ? ParseResult.fail(new ParseResult.Type(ast, sym, `Unable to encode a unique symbol ${String(sym)} into a string`)) : ParseResult.succeed(key);
|
|
2776
|
+
};
|
|
2777
|
+
const decodeSymbol = s => ParseResult.succeed(Symbol.for(s));
|
|
2778
|
+
/** @ignore */
|
|
2779
|
+
class Symbol$ extends /*#__PURE__*/transformOrFail(String$.annotations({
|
|
2780
|
+
description: "a string to be decoded into a globally shared symbol"
|
|
2777
2781
|
}), SymbolFromSelf, {
|
|
2778
2782
|
strict: false,
|
|
2779
|
-
decode:
|
|
2780
|
-
encode:
|
|
2783
|
+
decode: decodeSymbol,
|
|
2784
|
+
encode: encodeSymbol
|
|
2781
2785
|
}).annotations({
|
|
2782
|
-
identifier: "
|
|
2786
|
+
identifier: "Symbol"
|
|
2783
2787
|
}) {}
|
|
2784
2788
|
exports.Symbol = Symbol$;
|
|
2789
|
+
const SymbolStruct = /*#__PURE__*/TaggedStruct("symbol", {
|
|
2790
|
+
key: String$
|
|
2791
|
+
}).annotations({
|
|
2792
|
+
description: "an object to be decoded into a globally shared symbol"
|
|
2793
|
+
});
|
|
2794
|
+
const SymbolFromStruct = /*#__PURE__*/transformOrFail(SymbolStruct, SymbolFromSelf, {
|
|
2795
|
+
strict: true,
|
|
2796
|
+
decode: ({
|
|
2797
|
+
key
|
|
2798
|
+
}) => decodeSymbol(key),
|
|
2799
|
+
encode: (sym, _, ast) => ParseResult.map(encodeSymbol(sym, _, ast), key => SymbolStruct.make({
|
|
2800
|
+
key
|
|
2801
|
+
}))
|
|
2802
|
+
});
|
|
2785
2803
|
/**
|
|
2786
2804
|
* @category schema id
|
|
2787
2805
|
* @since 3.10.0
|
|
@@ -2931,13 +2949,13 @@ const clampBigInt = (minimum, maximum) => self => transform(self, self.pipe(type
|
|
|
2931
2949
|
/** @ignore */
|
|
2932
2950
|
exports.clampBigInt = clampBigInt;
|
|
2933
2951
|
class BigInt$ extends /*#__PURE__*/transformOrFail(String$.annotations({
|
|
2934
|
-
description: "a string
|
|
2952
|
+
description: "a string to be decoded into a bigint"
|
|
2935
2953
|
}), BigIntFromSelf, {
|
|
2936
2954
|
strict: true,
|
|
2937
|
-
decode: (s, _, ast) => ParseResult.fromOption(bigInt_.fromString(s), () => new ParseResult.Type(ast, s)),
|
|
2955
|
+
decode: (s, _, ast) => ParseResult.fromOption(bigInt_.fromString(s), () => new ParseResult.Type(ast, s, `Unable to decode ${JSON.stringify(s)} into a bigint`)),
|
|
2938
2956
|
encode: n => ParseResult.succeed(String(n))
|
|
2939
2957
|
}).annotations({
|
|
2940
|
-
identifier: "
|
|
2958
|
+
identifier: "BigInt"
|
|
2941
2959
|
}) {}
|
|
2942
2960
|
exports.BigInt = BigInt$;
|
|
2943
2961
|
/**
|
|
@@ -3005,13 +3023,13 @@ const NonNegativeBigInt = exports.NonNegativeBigInt = /*#__PURE__*/BigInt$.pipe(
|
|
|
3005
3023
|
* @since 3.10.0
|
|
3006
3024
|
*/
|
|
3007
3025
|
class BigIntFromNumber extends /*#__PURE__*/transformOrFail(Number$.annotations({
|
|
3008
|
-
description: "a number
|
|
3026
|
+
description: "a number to be decoded into a bigint"
|
|
3009
3027
|
}), BigIntFromSelf, {
|
|
3010
3028
|
strict: true,
|
|
3011
|
-
decode: (n, _, ast) => ParseResult.fromOption(bigInt_.fromNumber(n), () => new ParseResult.Type(ast, n)),
|
|
3012
|
-
encode: (b, _, ast) => ParseResult.fromOption(bigInt_.toNumber(b), () => new ParseResult.Type(ast, b))
|
|
3029
|
+
decode: (n, _, ast) => ParseResult.fromOption(bigInt_.fromNumber(n), () => new ParseResult.Type(ast, n, `Unable to decode ${n} into a bigint`)),
|
|
3030
|
+
encode: (b, _, ast) => ParseResult.fromOption(bigInt_.toNumber(b), () => new ParseResult.Type(ast, b, `Unable to encode ${b}n into a number`))
|
|
3013
3031
|
}).annotations({
|
|
3014
|
-
identifier: "
|
|
3032
|
+
identifier: "BigIntFromNumber"
|
|
3015
3033
|
}) {}
|
|
3016
3034
|
exports.BigIntFromNumber = BigIntFromNumber;
|
|
3017
3035
|
const redactedArbitrary = value => fc => value(fc).map(redacted_.make);
|
|
@@ -3067,12 +3085,12 @@ class DurationFromSelf extends /*#__PURE__*/declare(duration_.isDuration, {
|
|
|
3067
3085
|
*/
|
|
3068
3086
|
exports.DurationFromSelf = DurationFromSelf;
|
|
3069
3087
|
class DurationFromNanos extends /*#__PURE__*/transformOrFail(BigIntFromSelf.annotations({
|
|
3070
|
-
description: "a bigint
|
|
3088
|
+
description: "a bigint to be decoded into a Duration"
|
|
3071
3089
|
}), DurationFromSelf, {
|
|
3072
3090
|
strict: true,
|
|
3073
3091
|
decode: nanos => ParseResult.succeed(duration_.nanos(nanos)),
|
|
3074
3092
|
encode: (duration, _, ast) => option_.match(duration_.toNanos(duration), {
|
|
3075
|
-
onNone: () => ParseResult.fail(new ParseResult.Type(ast, duration)),
|
|
3093
|
+
onNone: () => ParseResult.fail(new ParseResult.Type(ast, duration, `Unable to encode ${duration} into a bigint`)),
|
|
3076
3094
|
onSome: val => ParseResult.succeed(val)
|
|
3077
3095
|
})
|
|
3078
3096
|
}).annotations({
|
|
@@ -3087,7 +3105,7 @@ class DurationFromNanos extends /*#__PURE__*/transformOrFail(BigIntFromSelf.anno
|
|
|
3087
3105
|
*/
|
|
3088
3106
|
exports.DurationFromNanos = DurationFromNanos;
|
|
3089
3107
|
class DurationFromMillis extends /*#__PURE__*/transform(Number$.annotations({
|
|
3090
|
-
description: "a number
|
|
3108
|
+
description: "a number to be decoded into a Duration"
|
|
3091
3109
|
}), DurationFromSelf, {
|
|
3092
3110
|
strict: true,
|
|
3093
3111
|
decode: ms => duration_.millis(ms),
|
|
@@ -3117,7 +3135,7 @@ const HRTime = /*#__PURE__*/Tuple(element(NonNegativeInt).annotations({
|
|
|
3117
3135
|
* @since 3.10.0
|
|
3118
3136
|
*/
|
|
3119
3137
|
class Duration extends /*#__PURE__*/transform(HRTime.annotations({
|
|
3120
|
-
description: "a tuple of seconds and nanos
|
|
3138
|
+
description: "a tuple of seconds and nanos to be decoded into a Duration"
|
|
3121
3139
|
}), DurationFromSelf, {
|
|
3122
3140
|
strict: true,
|
|
3123
3141
|
decode: ([seconds, nanos]) => duration_.nanos(BigInt(seconds) * BigInt(1e9) + BigInt(nanos)),
|
|
@@ -3259,7 +3277,7 @@ const Uint8 = exports.Uint8 = /*#__PURE__*/Number$.pipe( /*#__PURE__*/between(0,
|
|
|
3259
3277
|
description: "a 8-bit unsigned integer"
|
|
3260
3278
|
}));
|
|
3261
3279
|
const Uint8Array$ = exports.Uint8Array = /*#__PURE__*/transform(Array$(Uint8).annotations({
|
|
3262
|
-
description: "an array of 8-bit unsigned integers
|
|
3280
|
+
description: "an array of 8-bit unsigned integers to be decoded into a Uint8Array"
|
|
3263
3281
|
}), Uint8ArrayFromSelf, {
|
|
3264
3282
|
strict: true,
|
|
3265
3283
|
decode: numbers => Uint8Array.from(numbers),
|
|
@@ -3268,7 +3286,7 @@ const Uint8Array$ = exports.Uint8Array = /*#__PURE__*/transform(Array$(Uint8).an
|
|
|
3268
3286
|
identifier: "Uint8Array"
|
|
3269
3287
|
});
|
|
3270
3288
|
const makeUint8ArrayTransformation = (id, decode, encode) => transformOrFail(String$.annotations({
|
|
3271
|
-
description: "a string
|
|
3289
|
+
description: "a string to be decoded into a Uint8Array"
|
|
3272
3290
|
}), Uint8ArrayFromSelf, {
|
|
3273
3291
|
strict: true,
|
|
3274
3292
|
decode: (s, _, ast) => either_.mapLeft(decode(s), decodeException => new ParseResult.Type(ast, s, decodeException.message)),
|
|
@@ -3393,16 +3411,22 @@ const MaxItemsSchemaId = exports.MaxItemsSchemaId = schemaId_.MaxItemsSchemaId;
|
|
|
3393
3411
|
* @category ReadonlyArray filters
|
|
3394
3412
|
* @since 3.10.0
|
|
3395
3413
|
*/
|
|
3396
|
-
const maxItems = (n, annotations) => self =>
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3414
|
+
const maxItems = (n, annotations) => self => {
|
|
3415
|
+
const maxItems = Math.floor(n);
|
|
3416
|
+
if (maxItems < 1) {
|
|
3417
|
+
throw new Error(errors_.getInvalidArgumentErrorMessage(`Expected an integer greater than or equal to 1, actual ${n}`));
|
|
3418
|
+
}
|
|
3419
|
+
return self.pipe(filter(a => a.length <= maxItems, {
|
|
3420
|
+
schemaId: MaxItemsSchemaId,
|
|
3421
|
+
title: `maxItems(${maxItems})`,
|
|
3422
|
+
description: `an array of at most ${maxItems} item(s)`,
|
|
3423
|
+
jsonSchema: {
|
|
3424
|
+
maxItems
|
|
3425
|
+
},
|
|
3426
|
+
[AST.StableFilterAnnotationId]: true,
|
|
3427
|
+
...annotations
|
|
3428
|
+
}));
|
|
3429
|
+
};
|
|
3406
3430
|
/**
|
|
3407
3431
|
* @category schema id
|
|
3408
3432
|
* @since 3.10.0
|
|
@@ -3413,17 +3437,23 @@ const ItemsCountSchemaId = exports.ItemsCountSchemaId = schemaId_.ItemsCountSche
|
|
|
3413
3437
|
* @category ReadonlyArray filters
|
|
3414
3438
|
* @since 3.10.0
|
|
3415
3439
|
*/
|
|
3416
|
-
const itemsCount = (n, annotations) => self =>
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3440
|
+
const itemsCount = (n, annotations) => self => {
|
|
3441
|
+
const itemsCount = Math.floor(n);
|
|
3442
|
+
if (itemsCount < 1) {
|
|
3443
|
+
throw new Error(errors_.getInvalidArgumentErrorMessage(`Expected an integer greater than or equal to 1, actual ${n}`));
|
|
3444
|
+
}
|
|
3445
|
+
return self.pipe(filter(a => a.length === itemsCount, {
|
|
3446
|
+
schemaId: ItemsCountSchemaId,
|
|
3447
|
+
title: `itemsCount(${itemsCount})`,
|
|
3448
|
+
description: `an array of exactly ${itemsCount} item(s)`,
|
|
3449
|
+
jsonSchema: {
|
|
3450
|
+
minItems: itemsCount,
|
|
3451
|
+
maxItems: itemsCount
|
|
3452
|
+
},
|
|
3453
|
+
[AST.StableFilterAnnotationId]: true,
|
|
3454
|
+
...annotations
|
|
3455
|
+
}));
|
|
3456
|
+
};
|
|
3427
3457
|
/**
|
|
3428
3458
|
* @category ReadonlyArray transformations
|
|
3429
3459
|
* @since 3.10.0
|
|
@@ -3468,7 +3498,7 @@ const headNonEmpty = self => transform(self, getNumberIndexedAccess(typeSchema(s
|
|
|
3468
3498
|
exports.headNonEmpty = headNonEmpty;
|
|
3469
3499
|
const headOrElse = exports.headOrElse = /*#__PURE__*/(0, _Function.dual)(args => isSchema(args[0]), (self, fallback) => transformOrFail(self, getNumberIndexedAccess(typeSchema(self)), {
|
|
3470
3500
|
strict: true,
|
|
3471
|
-
decode: (as, _, ast) => as.length > 0 ? ParseResult.succeed(as[0]) : fallback ? ParseResult.succeed(fallback()) : ParseResult.fail(new ParseResult.Type(ast, as)),
|
|
3501
|
+
decode: (as, _, ast) => as.length > 0 ? ParseResult.succeed(as[0]) : fallback ? ParseResult.succeed(fallback()) : ParseResult.fail(new ParseResult.Type(ast, as, "Unable to retrieve the first element of an empty array")),
|
|
3472
3502
|
encode: a => ParseResult.succeed(array_.of(a))
|
|
3473
3503
|
}));
|
|
3474
3504
|
/**
|
|
@@ -3642,7 +3672,7 @@ class ValidDateFromSelf extends /*#__PURE__*/DateFromSelf.pipe( /*#__PURE__*/val
|
|
|
3642
3672
|
*/
|
|
3643
3673
|
exports.ValidDateFromSelf = ValidDateFromSelf;
|
|
3644
3674
|
class DateFromString extends /*#__PURE__*/transform(String$.annotations({
|
|
3645
|
-
description: "a string
|
|
3675
|
+
description: "a string to be decoded into a Date"
|
|
3646
3676
|
}), DateFromSelf, {
|
|
3647
3677
|
strict: true,
|
|
3648
3678
|
decode: s => new Date(s),
|
|
@@ -3667,7 +3697,7 @@ exports.Date = Date$;
|
|
|
3667
3697
|
* @since 3.10.0
|
|
3668
3698
|
*/
|
|
3669
3699
|
class DateFromNumber extends /*#__PURE__*/transform(Number$.annotations({
|
|
3670
|
-
description: "a number
|
|
3700
|
+
description: "a number to be decoded into a Date"
|
|
3671
3701
|
}), DateFromSelf, {
|
|
3672
3702
|
strict: true,
|
|
3673
3703
|
decode: n => new Date(n),
|
|
@@ -3686,13 +3716,15 @@ class DateTimeUtcFromSelf extends /*#__PURE__*/declare(u => dateTime.isDateTime(
|
|
|
3686
3716
|
identifier: "DateTimeUtcFromSelf",
|
|
3687
3717
|
description: "a DateTime.Utc instance",
|
|
3688
3718
|
pretty: () => dateTime => dateTime.toString(),
|
|
3689
|
-
arbitrary: () => fc => fc.date(
|
|
3719
|
+
arbitrary: () => fc => fc.date({
|
|
3720
|
+
noInvalidDate: true
|
|
3721
|
+
}).map(date => dateTime.unsafeFromDate(date)),
|
|
3690
3722
|
equivalence: () => dateTime.Equivalence
|
|
3691
3723
|
}) {}
|
|
3692
3724
|
exports.DateTimeUtcFromSelf = DateTimeUtcFromSelf;
|
|
3693
|
-
const
|
|
3725
|
+
const decodeDateTimeUtc = (input, _, ast) => ParseResult.try({
|
|
3694
3726
|
try: () => dateTime.unsafeMake(input),
|
|
3695
|
-
catch: () => new ParseResult.Type(ast, input)
|
|
3727
|
+
catch: () => new ParseResult.Type(ast, input, `Unable to decode ${util_.formatUnknown(input)} into a DateTime.Utc`)
|
|
3696
3728
|
});
|
|
3697
3729
|
/**
|
|
3698
3730
|
* Defines a schema that attempts to convert a `number` to a `DateTime.Utc` instance using the `DateTime.unsafeMake` constructor.
|
|
@@ -3701,10 +3733,10 @@ const decodeDateTime = (input, _, ast) => ParseResult.try({
|
|
|
3701
3733
|
* @since 3.10.0
|
|
3702
3734
|
*/
|
|
3703
3735
|
class DateTimeUtcFromNumber extends /*#__PURE__*/transformOrFail(Number$.annotations({
|
|
3704
|
-
description: "a number
|
|
3736
|
+
description: "a number to be decoded into a DateTime.Utc"
|
|
3705
3737
|
}), DateTimeUtcFromSelf, {
|
|
3706
3738
|
strict: true,
|
|
3707
|
-
decode:
|
|
3739
|
+
decode: decodeDateTimeUtc,
|
|
3708
3740
|
encode: dt => ParseResult.succeed(dateTime.toEpochMillis(dt))
|
|
3709
3741
|
}).annotations({
|
|
3710
3742
|
identifier: "DateTimeUtcFromNumber"
|
|
@@ -3717,10 +3749,10 @@ class DateTimeUtcFromNumber extends /*#__PURE__*/transformOrFail(Number$.annotat
|
|
|
3717
3749
|
*/
|
|
3718
3750
|
exports.DateTimeUtcFromNumber = DateTimeUtcFromNumber;
|
|
3719
3751
|
class DateTimeUtcFromDate extends /*#__PURE__*/transformOrFail(DateFromSelf.annotations({
|
|
3720
|
-
description: "a Date
|
|
3752
|
+
description: "a Date to be decoded into a DateTime.Utc"
|
|
3721
3753
|
}), DateTimeUtcFromSelf, {
|
|
3722
3754
|
strict: true,
|
|
3723
|
-
decode:
|
|
3755
|
+
decode: decodeDateTimeUtc,
|
|
3724
3756
|
encode: dt => ParseResult.succeed(dateTime.toDateUtc(dt))
|
|
3725
3757
|
}).annotations({
|
|
3726
3758
|
identifier: "DateTimeUtcFromDate"
|
|
@@ -3733,10 +3765,10 @@ class DateTimeUtcFromDate extends /*#__PURE__*/transformOrFail(DateFromSelf.anno
|
|
|
3733
3765
|
*/
|
|
3734
3766
|
exports.DateTimeUtcFromDate = DateTimeUtcFromDate;
|
|
3735
3767
|
class DateTimeUtc extends /*#__PURE__*/transformOrFail(String$.annotations({
|
|
3736
|
-
description: "a string
|
|
3768
|
+
description: "a string to be decoded into a DateTime.Utc"
|
|
3737
3769
|
}), DateTimeUtcFromSelf, {
|
|
3738
3770
|
strict: true,
|
|
3739
|
-
decode:
|
|
3771
|
+
decode: decodeDateTimeUtc,
|
|
3740
3772
|
encode: dt => ParseResult.succeed(dateTime.formatIso(dt))
|
|
3741
3773
|
}).annotations({
|
|
3742
3774
|
identifier: "DateTimeUtc"
|
|
@@ -3744,7 +3776,7 @@ class DateTimeUtc extends /*#__PURE__*/transformOrFail(String$.annotations({
|
|
|
3744
3776
|
exports.DateTimeUtc = DateTimeUtc;
|
|
3745
3777
|
const timeZoneOffsetArbitrary = () => fc => fc.integer({
|
|
3746
3778
|
min: -12 * 60 * 60 * 1000,
|
|
3747
|
-
max:
|
|
3779
|
+
max: 14 * 60 * 60 * 1000
|
|
3748
3780
|
}).map(dateTime.zoneMakeOffset);
|
|
3749
3781
|
/**
|
|
3750
3782
|
* Describes a schema that represents a `TimeZone.Offset` instance.
|
|
@@ -3766,7 +3798,7 @@ class TimeZoneOffsetFromSelf extends /*#__PURE__*/declare(dateTime.isTimeZoneOff
|
|
|
3766
3798
|
*/
|
|
3767
3799
|
exports.TimeZoneOffsetFromSelf = TimeZoneOffsetFromSelf;
|
|
3768
3800
|
class TimeZoneOffset extends /*#__PURE__*/transform(Number$.annotations({
|
|
3769
|
-
description: "a number
|
|
3801
|
+
description: "a number to be decoded into a TimeZone.Offset"
|
|
3770
3802
|
}), TimeZoneOffsetFromSelf, {
|
|
3771
3803
|
strict: true,
|
|
3772
3804
|
decode: dateTime.zoneMakeOffset,
|
|
@@ -3796,12 +3828,12 @@ class TimeZoneNamedFromSelf extends /*#__PURE__*/declare(dateTime.isTimeZoneName
|
|
|
3796
3828
|
*/
|
|
3797
3829
|
exports.TimeZoneNamedFromSelf = TimeZoneNamedFromSelf;
|
|
3798
3830
|
class TimeZoneNamed extends /*#__PURE__*/transformOrFail(String$.annotations({
|
|
3799
|
-
description: "a string
|
|
3831
|
+
description: "a string to be decoded into a TimeZone.Named"
|
|
3800
3832
|
}), TimeZoneNamedFromSelf, {
|
|
3801
3833
|
strict: true,
|
|
3802
3834
|
decode: (s, _, ast) => ParseResult.try({
|
|
3803
3835
|
try: () => dateTime.zoneUnsafeMakeNamed(s),
|
|
3804
|
-
catch: () => new ParseResult.Type(ast, s)
|
|
3836
|
+
catch: () => new ParseResult.Type(ast, s, `Unable to decode ${JSON.stringify(s)} into a TimeZone.Named`)
|
|
3805
3837
|
}),
|
|
3806
3838
|
encode: tz => ParseResult.succeed(tz.id)
|
|
3807
3839
|
}).annotations({
|
|
@@ -3812,19 +3844,20 @@ class TimeZoneNamed extends /*#__PURE__*/transformOrFail(String$.annotations({
|
|
|
3812
3844
|
* @since 3.10.0
|
|
3813
3845
|
*/
|
|
3814
3846
|
exports.TimeZoneNamed = TimeZoneNamed;
|
|
3815
|
-
|
|
3847
|
+
class TimeZoneFromSelf extends /*#__PURE__*/Union(TimeZoneOffsetFromSelf, TimeZoneNamedFromSelf) {}
|
|
3816
3848
|
/**
|
|
3817
3849
|
* Defines a schema that attempts to convert a `string` to a `TimeZone` using the `DateTime.zoneFromString` constructor.
|
|
3818
3850
|
*
|
|
3819
3851
|
* @category TimeZone transformations
|
|
3820
3852
|
* @since 3.10.0
|
|
3821
3853
|
*/
|
|
3854
|
+
exports.TimeZoneFromSelf = TimeZoneFromSelf;
|
|
3822
3855
|
class TimeZone extends /*#__PURE__*/transformOrFail(String$.annotations({
|
|
3823
|
-
description: "a string
|
|
3856
|
+
description: "a string to be decoded into a TimeZone"
|
|
3824
3857
|
}), TimeZoneFromSelf, {
|
|
3825
3858
|
strict: true,
|
|
3826
3859
|
decode: (s, _, ast) => option_.match(dateTime.zoneFromString(s), {
|
|
3827
|
-
onNone: () => ParseResult.fail(new ParseResult.Type(ast, s)),
|
|
3860
|
+
onNone: () => ParseResult.fail(new ParseResult.Type(ast, s, `Unable to decode ${JSON.stringify(s)} into a TimeZone`)),
|
|
3828
3861
|
onSome: ParseResult.succeed
|
|
3829
3862
|
}),
|
|
3830
3863
|
encode: tz => ParseResult.succeed(dateTime.zoneToString(tz))
|
|
@@ -3843,9 +3876,13 @@ class DateTimeZonedFromSelf extends /*#__PURE__*/declare(u => dateTime.isDateTim
|
|
|
3843
3876
|
identifier: "DateTimeZonedFromSelf",
|
|
3844
3877
|
description: "a DateTime.Zoned instance",
|
|
3845
3878
|
pretty: () => dateTime => dateTime.toString(),
|
|
3846
|
-
arbitrary: () => fc => fc.
|
|
3879
|
+
arbitrary: () => fc => fc.tuple(fc.integer({
|
|
3880
|
+
// time zone db supports +/- 1000 years or so
|
|
3881
|
+
min: -31536000000000,
|
|
3882
|
+
max: 31536000000000
|
|
3883
|
+
}), timeZoneArbitrary(fc)).map(([millis, timeZone]) => dateTime.unsafeMakeZoned(millis, {
|
|
3847
3884
|
timeZone
|
|
3848
|
-
}))
|
|
3885
|
+
})),
|
|
3849
3886
|
equivalence: () => dateTime.Equivalence
|
|
3850
3887
|
}) {}
|
|
3851
3888
|
/**
|
|
@@ -3856,11 +3893,11 @@ class DateTimeZonedFromSelf extends /*#__PURE__*/declare(u => dateTime.isDateTim
|
|
|
3856
3893
|
*/
|
|
3857
3894
|
exports.DateTimeZonedFromSelf = DateTimeZonedFromSelf;
|
|
3858
3895
|
class DateTimeZoned extends /*#__PURE__*/transformOrFail(String$.annotations({
|
|
3859
|
-
description: "a string
|
|
3896
|
+
description: "a string to be decoded into a DateTime.Zoned"
|
|
3860
3897
|
}), DateTimeZonedFromSelf, {
|
|
3861
3898
|
strict: true,
|
|
3862
3899
|
decode: (s, _, ast) => option_.match(dateTime.makeZonedFromString(s), {
|
|
3863
|
-
onNone: () => ParseResult.fail(new ParseResult.Type(ast, s)),
|
|
3900
|
+
onNone: () => ParseResult.fail(new ParseResult.Type(ast, s, `Unable to decode ${JSON.stringify(s)} into a DateTime.Zoned`)),
|
|
3864
3901
|
onSome: ParseResult.succeed
|
|
3865
3902
|
}),
|
|
3866
3903
|
encode: dt => ParseResult.succeed(dateTime.formatIsoZoned(dt))
|
|
@@ -4207,7 +4244,7 @@ const ReadonlyMapFromRecord = ({
|
|
|
4207
4244
|
key: encodedBoundSchema(key),
|
|
4208
4245
|
value
|
|
4209
4246
|
}).annotations({
|
|
4210
|
-
description: "a record
|
|
4247
|
+
description: "a record to be decoded into a ReadonlyMap"
|
|
4211
4248
|
}), ReadonlyMapFromSelf({
|
|
4212
4249
|
key,
|
|
4213
4250
|
value: typeSchema(value)
|
|
@@ -4228,7 +4265,7 @@ const MapFromRecord = ({
|
|
|
4228
4265
|
key: encodedBoundSchema(key),
|
|
4229
4266
|
value
|
|
4230
4267
|
}).annotations({
|
|
4231
|
-
description: "a record
|
|
4268
|
+
description: "a record to be decoded into a Map"
|
|
4232
4269
|
}), MapFromSelf({
|
|
4233
4270
|
key,
|
|
4234
4271
|
value: typeSchema(value)
|
|
@@ -4312,11 +4349,11 @@ class BigDecimalFromSelf extends /*#__PURE__*/declare(bigDecimal_.isBigDecimal,
|
|
|
4312
4349
|
*/
|
|
4313
4350
|
exports.BigDecimalFromSelf = BigDecimalFromSelf;
|
|
4314
4351
|
class BigDecimal extends /*#__PURE__*/transformOrFail(String$.annotations({
|
|
4315
|
-
description: "a string
|
|
4352
|
+
description: "a string to be decoded into a BigDecimal"
|
|
4316
4353
|
}), BigDecimalFromSelf, {
|
|
4317
4354
|
strict: true,
|
|
4318
|
-
decode: (
|
|
4319
|
-
onNone: () => ParseResult.fail(new ParseResult.Type(ast,
|
|
4355
|
+
decode: (s, _, ast) => bigDecimal_.fromString(s).pipe(option_.match({
|
|
4356
|
+
onNone: () => ParseResult.fail(new ParseResult.Type(ast, s, `Unable to decode ${JSON.stringify(s)} into a BigDecimal`)),
|
|
4320
4357
|
onSome: val => ParseResult.succeed(bigDecimal_.normalize(val))
|
|
4321
4358
|
})),
|
|
4322
4359
|
encode: val => ParseResult.succeed(bigDecimal_.format(bigDecimal_.normalize(val)))
|
|
@@ -4331,12 +4368,12 @@ class BigDecimal extends /*#__PURE__*/transformOrFail(String$.annotations({
|
|
|
4331
4368
|
* @since 3.10.0
|
|
4332
4369
|
*/
|
|
4333
4370
|
exports.BigDecimal = BigDecimal;
|
|
4334
|
-
class BigDecimalFromNumber extends /*#__PURE__*/
|
|
4335
|
-
description: "a number
|
|
4371
|
+
class BigDecimalFromNumber extends /*#__PURE__*/transform(Number$.annotations({
|
|
4372
|
+
description: "a number to be decoded into a BigDecimal"
|
|
4336
4373
|
}), BigDecimalFromSelf, {
|
|
4337
4374
|
strict: true,
|
|
4338
|
-
decode:
|
|
4339
|
-
encode:
|
|
4375
|
+
decode: bigDecimal_.unsafeFromNumber,
|
|
4376
|
+
encode: bigDecimal_.unsafeToNumber
|
|
4340
4377
|
}).annotations({
|
|
4341
4378
|
identifier: "BigDecimalFromNumber"
|
|
4342
4379
|
}) {}
|
|
@@ -5893,4 +5930,28 @@ const go = (ast, path) => {
|
|
|
5893
5930
|
}
|
|
5894
5931
|
}
|
|
5895
5932
|
};
|
|
5933
|
+
/** @ignore */
|
|
5934
|
+
class PropertyKey$ extends /*#__PURE__*/Union(String$, Number$, SymbolFromStruct).annotations({
|
|
5935
|
+
identifier: "PropertyKey"
|
|
5936
|
+
}) {}
|
|
5937
|
+
exports.PropertyKey = PropertyKey$;
|
|
5938
|
+
/**
|
|
5939
|
+
* @category ArrayFormatter
|
|
5940
|
+
* @since 3.12.5
|
|
5941
|
+
*/
|
|
5942
|
+
class ArrayFormatterIssue extends /*#__PURE__*/Struct({
|
|
5943
|
+
_tag: propertySignature(Literal("Pointer", "Unexpected", "Missing", "Composite", "Refinement", "Transformation", "Type", "Forbidden")).annotations({
|
|
5944
|
+
description: "The tag identifying the type of parse issue"
|
|
5945
|
+
}),
|
|
5946
|
+
path: propertySignature(Array$(PropertyKey$)).annotations({
|
|
5947
|
+
description: "The path to the property where the issue occurred"
|
|
5948
|
+
}),
|
|
5949
|
+
message: propertySignature(String$).annotations({
|
|
5950
|
+
description: "A descriptive message explaining the issue"
|
|
5951
|
+
})
|
|
5952
|
+
}).annotations({
|
|
5953
|
+
identifier: "ArrayFormatterIssue",
|
|
5954
|
+
description: "Represents an issue returned by the ArrayFormatter formatter"
|
|
5955
|
+
}) {}
|
|
5956
|
+
exports.ArrayFormatterIssue = ArrayFormatterIssue;
|
|
5896
5957
|
//# sourceMappingURL=Schema.js.map
|