/** * @since 1.0.0 */ import * as BigDecimal from "effect/BigDecimal"; import * as Brand from "effect/Brand"; import * as Cause from "effect/Cause"; import * as Chunk from "effect/Chunk"; import * as Data from "effect/Data"; import * as Duration from "effect/Duration"; import * as Effect from "effect/Effect"; import * as Either from "effect/Either"; import * as Equivalence from "effect/Equivalence"; import * as Exit from "effect/Exit"; import * as FiberId from "effect/FiberId"; import type { LazyArg } from "effect/Function"; import * as HashMap from "effect/HashMap"; import * as HashSet from "effect/HashSet"; import * as List from "effect/List"; import * as Option from "effect/Option"; import type { Pipeable } from "effect/Pipeable"; import * as Predicate from "effect/Predicate"; import * as ReadonlyArray from "effect/ReadonlyArray"; import * as Request from "effect/Request"; import * as Secret from "effect/Secret"; import type { Covariant, Equals, Invariant, Mutable, NoInfer, Simplify } from "effect/Types"; import type { Arbitrary } from "./Arbitrary.js"; import type { ParseOptions } from "./AST.js"; import * as AST from "./AST.js"; import * as ParseResult from "./ParseResult.js"; import * as Pretty from "./Pretty.js"; import type * as Serializable from "./Serializable.js"; /** * @since 1.0.0 * @category symbol */ export declare const TypeId: unique symbol; /** * @since 1.0.0 * @category symbol */ export type TypeId = typeof TypeId; /** * @category model * @since 1.0.0 */ export interface Schema extends Schema.Variance, Pipeable { readonly ast: AST.AST; } /** * @category hashing * @since 1.0.0 */ export declare const hash: (schema: Schema) => number; /** * @category formatting * @since 1.0.0 */ export declare const format: (schema: Schema) => string; /** * @since 1.0.0 */ export declare namespace Schema { /** * @since 1.0.0 */ interface Variance { readonly [TypeId]: { readonly R: Covariant; readonly From: Invariant; readonly To: Invariant; }; } /** * @since 1.0.0 */ type Context = S extends Schema.Variance ? R : never; /** * @since 1.0.0 */ type From = S extends Schema.Variance ? From : never; /** * @since 1.0.0 */ type To = S extends Schema.Variance ? To : never; /** * @since 1.0.0 */ type ToAsserts> = (input: unknown, options?: AST.ParseOptions) => asserts input is Schema.To; } /** * @since 1.0.0 */ export declare const from: (schema: Schema) => Schema; /** * @since 1.0.0 */ export declare const to: (schema: Schema) => Schema; export { /** * @category validation * @since 1.0.0 */ asserts, /** * @category decoding * @since 1.0.0 */ decodeOption, /** * @category decoding * @since 1.0.0 */ decodeSync, /** * @category decoding * @since 1.0.0 */ decodeUnknownOption, /** * @category decoding * @since 1.0.0 */ decodeUnknownSync, /** * @category encoding * @since 1.0.0 */ encodeOption, /** * @category encoding * @since 1.0.0 */ encodeSync, /** * @category encoding * @since 1.0.0 */ encodeUnknownOption, /** * @category encoding * @since 1.0.0 */ encodeUnknownSync, /** * @category validation * @since 1.0.0 */ is, /** * @category validation * @since 1.0.0 */ validateOption, /** * @category validation * @since 1.0.0 */ validateSync } from "./Parser.js"; /** * @category encoding * @since 1.0.0 */ export declare const encodeUnknown: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Effect.Effect; /** * @category encoding * @since 1.0.0 */ export declare const encodeUnknownEither: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Either.Either; /** * @category encoding * @since 1.0.0 */ export declare const encodeUnknownPromise: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Promise; /** * @category encoding * @since 1.0.0 */ export declare const encode: (schema: Schema, options?: ParseOptions) => (a: A, overrideOptions?: ParseOptions) => Effect.Effect; /** * @category encoding * @since 1.0.0 */ export declare const encodeEither: (schema: Schema, options?: ParseOptions) => (a: A, overrideOptions?: ParseOptions) => Either.Either; /** * @category encoding * @since 1.0.0 */ export declare const encodePromise: (schema: Schema, options?: ParseOptions) => (a: A, overrideOptions?: ParseOptions) => Promise; /** * @category decoding * @since 1.0.0 */ export declare const decodeUnknown: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Effect.Effect; /** * @category decoding * @since 1.0.0 */ export declare const decodeUnknownEither: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Either.Either; /** * @category decoding * @since 1.0.0 */ export declare const decodeUnknownPromise: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Promise; /** * @category decoding * @since 1.0.0 */ export declare const decode: (schema: Schema, options?: ParseOptions) => (i: I, overrideOptions?: ParseOptions) => Effect.Effect; /** * @category decoding * @since 1.0.0 */ export declare const decodeEither: (schema: Schema, options?: ParseOptions) => (i: I, overrideOptions?: ParseOptions) => Either.Either; /** * @category decoding * @since 1.0.0 */ export declare const decodePromise: (schema: Schema, options?: ParseOptions) => (i: I, overrideOptions?: ParseOptions) => Promise; /** * @category validation * @since 1.0.0 */ export declare const validate: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Effect.Effect; /** * @category validation * @since 1.0.0 */ export declare const validateEither: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Either.Either; /** * @category validation * @since 1.0.0 */ export declare const validatePromise: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Promise; /** * Tests if a value is a `Schema`. * * @category guards * @since 1.0.0 */ export declare const isSchema: (u: unknown) => u is Schema; /** * @category constructors * @since 1.0.0 */ export declare const make: (ast: AST.AST) => Schema; /** * @category constructors * @since 1.0.0 */ export declare const literal: (...literals: Literals) => Schema; /** * @category constructors * @since 1.0.0 */ export declare const uniqueSymbol: (symbol: S, annotations?: AST.Annotations) => Schema; /** * @category constructors * @since 1.0.0 */ export declare const enums: (enums: A) => Schema; /** * @since 1.0.0 */ export type Join = T extends [infer Head, ...infer Tail] ? `${Head & (string | number | bigint | boolean | null | undefined)}${Tail extends [] ? "" : Join}` : never; /** * @category constructors * @since 1.0.0 */ export declare const templateLiteral: , ...Schema[]]>(...[head, ...tail]: T) => Schema; }>, Join<{ [K in keyof T]: Schema.To; }>>; /** * @since 1.0.0 */ export interface DeclareAnnotations

, A> extends DocAnnotations { readonly message?: AST.MessageAnnotation; readonly typeId?: AST.TypeAnnotation | { id: AST.TypeAnnotation; annotation: unknown; }; readonly arbitrary?: (...arbitraries: { readonly [K in keyof P]: Arbitrary; }) => Arbitrary; readonly pretty?: (...pretties: { readonly [K in keyof P]: Pretty.Pretty; }) => Pretty.Pretty; readonly equivalence?: (...equivalences: { readonly [K in keyof P]: Equivalence.Equivalence; }) => Equivalence.Equivalence; } /** * The constraint `R extends Schema.Context` enforces dependencies solely from `typeParameters`. * This ensures that when you call `Schema.to` or `Schema.from`, you receive a schema with a `never` context. * * @category constructors * @since 1.0.0 */ export declare const declare: { (is: (input: unknown) => input is A, annotations?: DeclareAnnotations): Schema; >, R extends Schema.Context, I, A>(typeParameters: P, decodeUnknown: (...typeParameters: P) => (input: unknown, options: ParseOptions, ast: AST.Declaration) => Effect.Effect, encodeUnknown: (...typeParameters: P) => (input: unknown, options: ParseOptions, ast: AST.Declaration) => Effect.Effect, annotations?: DeclareAnnotations<{ readonly [K in keyof P]: Schema.To; }, A>): Schema, I, A>; }; /** * @category type id * @since 1.0.0 */ export declare const BrandTypeId: unique symbol; /** * @category constructors * @since 1.0.0 */ export declare const fromBrand: >(constructor: Brand.Brand.Constructor, options?: FilterAnnotations> | undefined) => >(self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const InstanceOfTypeId: unique symbol; /** * @category constructors * @since 1.0.0 */ export declare const instanceOf: any>(constructor: A, options?: DeclareAnnotations<[], InstanceType> | undefined) => Schema, InstanceType>; declare const _undefined: Schema; declare const _void: Schema; declare const _null: Schema; export { /** * @category primitives * @since 1.0.0 */ _null as null, /** * @category primitives * @since 1.0.0 */ _undefined as undefined, /** * @category primitives * @since 1.0.0 */ _void as void }; /** * @category primitives * @since 1.0.0 */ export declare const never: Schema; /** * @category primitives * @since 1.0.0 */ export declare const unknown: Schema; /** * @category primitives * @since 1.0.0 */ export declare const any: Schema; /** * @category primitives * @since 1.0.0 */ export declare const string: Schema; /** * @category primitives * @since 1.0.0 */ export declare const number: Schema; /** * @category primitives * @since 1.0.0 */ export declare const boolean: Schema; /** * @category primitives * @since 1.0.0 */ export declare const bigintFromSelf: Schema; /** * @category primitives * @since 1.0.0 */ export declare const symbolFromSelf: Schema; /** * @category primitives * @since 1.0.0 */ export declare const object: Schema; /** * @category combinators * @since 1.0.0 */ export declare const union: []>(...members: Members) => Schema, Schema.From, Schema.To>; /** * @category combinators * @since 1.0.0 */ export declare const nullable: (self: Schema) => Schema; /** * @category combinators * @since 1.0.0 */ export declare const orUndefined: (self: Schema) => Schema; /** * @category combinators * @since 1.0.0 */ export declare const nullish: (self: Schema) => Schema; /** * @category combinators * @since 1.0.0 */ export declare const keyof: (schema: Schema) => Schema; /** * @category combinators * @since 1.0.0 */ export declare const tuple: []>(...elements: Elements) => Schema, { readonly [K in keyof Elements]: Schema.From; }, { readonly [K_1 in keyof Elements]: Schema.To; }>; /** * @category combinators * @since 1.0.0 */ export declare const rest: (rest: Schema) => (self: Schema) => Schema; /** * @category combinators * @since 1.0.0 */ export declare const element: (element: Schema) => (self: Schema) => Schema; /** * @category combinators * @since 1.0.0 */ export declare const optionalElement: (element: Schema) => (self: Schema) => Schema; /** * @category combinators * @since 1.0.0 */ export declare const array: (item: Schema) => Schema; /** * @category combinators * @since 1.0.0 */ export declare const nonEmptyArray: (item: Schema) => Schema; /** * @since 1.0.0 */ export interface PropertySignature extends Schema.Variance, Pipeable { readonly FromIsOptional: FromIsOptional; readonly ToIsOptional: ToIsOptional; } /** * @since 1.0.0 */ export declare const propertySignatureAnnotations: (annotations: DocAnnotations) => | Schema | PropertySignature | PropertySignature | ConstructorPropertyDescriptor | MapFromPropertyDescriptor>(self: S) => S extends Schema ? PropertySignature : S; /** * @category optional * @since 1.0.0 */ export declare const optionalToRequired: (from: Schema, to: Schema, decode: (o: Option.Option) => B, encode: (b: B) => Option.Option, options?: DocAnnotations) => PropertySignature; /** * @since 1.0.0 */ export declare const optional: { (schema: Schema, options: { readonly exact: true; readonly default: () => A; readonly nullable: true; }): PropertySignature; (schema: Schema, options: { readonly exact: true; readonly default: () => A; }): PropertySignature; (schema: Schema, options: { readonly exact: true; readonly nullable: true; readonly as: "Option"; }): PropertySignature, false>; (schema: Schema, options: { readonly exact: true; readonly as: "Option"; }): PropertySignature, false>; (schema: Schema, options: { readonly exact: true; }): PropertySignature; (schema: Schema, options: { readonly default: () => A; readonly nullable: true; }): PropertySignature; (schema: Schema, options: { readonly nullable: true; readonly as: "Option"; }): PropertySignature, false>; (schema: Schema, options: { readonly as: "Option"; }): PropertySignature, false>; (schema: Schema, options: { readonly default: () => A; }): PropertySignature; (schema: Schema): PropertySignature; }; /** * @since 1.0.0 */ export type FromOptionalKeys = { [K in keyof Fields]: Fields[K] extends PropertySignature | PropertySignature ? K : never; }[keyof Fields]; /** * @since 1.0.0 */ export type ToOptionalKeys = { [K in keyof Fields]: Fields[K] extends PropertySignature | PropertySignature ? K : never; }[keyof Fields]; /** * @since 1.0.0 */ export type StructFields = Record | Schema | PropertySignature | PropertySignature | ConstructorPropertyDescriptor | MapFromPropertyDescriptor>; type GetKey = T[K] extends MapFromPropertyDescriptor ? T[K]["mapFrom"] : K; /** * @since 1.0.0 */ export type FromStruct = { readonly [K in Exclude> as GetKey]: Schema.From; } & { readonly [K in FromOptionalKeys as GetKey]?: Schema.From; }; /** * @since 1.0.0 */ export type ToStruct = { readonly [K in Exclude>]: Schema.To; } & { readonly [K in ToOptionalKeys]?: Schema.To; }; /** * @category combinators * @since 1.0.0 */ export declare const struct: (fields: Fields) => Schema, Simplify>, Simplify>>; /** * @category struct transformations * @since 1.0.0 */ export declare const pick: (...keys: Keys) => (self: Schema) => Schema>, Simplify>>; /** * @category struct transformations * @since 1.0.0 */ export declare const omit: (...keys: Keys) => (self: Schema) => Schema>, Simplify>>; /** * @category struct transformations * @since 1.0.0 */ export declare const pluck: { (key: K): (schema: Schema) => Schema; (schema: Schema, key: K): Schema; }; /** * @category model * @since 1.0.0 */ export interface BrandSchema> extends Schema, Brand.Brand.Constructor { } /** * Returns a nominal branded schema by applying a brand to a given schema. * * ``` * Schema + B -> Schema> * ``` * * @param self - The input schema to be combined with the brand. * @param brand - The brand to apply. * * @example * import * as Schema from "@effect/schema/Schema" * * const Int = Schema.number.pipe(Schema.int(), Schema.brand("Int")) * type Int = Schema.Schema.To // number & Brand<"Int"> * * @category combinators * @since 1.0.0 */ export declare const brand: (brand: B, options?: DocAnnotations) => (self: Schema) => BrandSchema>; /** * @category combinators * @since 1.0.0 */ export declare const partial: (self: Schema) => Schema>, Simplify>>; /** * @category combinators * @since 1.0.0 */ export declare const required: (self: Schema) => Schema>, Simplify>>; /** * Creates a new schema with shallow mutability applied to its properties. * * @param schema - The original schema to make properties mutable (shallowly). * * @category combinators * @since 1.0.0 */ export declare const mutable: (schema: Schema) => Schema>, Simplify>>; /** * @category combinators * @since 1.0.0 */ export declare const record: (key: Schema, value: Schema) => Schema; /** * @category combinators * @since 1.0.0 */ export declare const extend: { (that: Schema): (self: Schema) => Schema, Simplify>; (self: Schema, that: Schema): Schema, Simplify>; }; /** * @category combinators * @since 1.0.0 */ export declare const compose: { (bc: Schema): (ab: Schema) => Schema; (bc: Schema, options: { strict: false; }): (ab: Schema) => Schema; (ab: Schema, cd: Schema): Schema; (ab: Schema, cd: Schema, options: { strict: false; }): Schema; }; /** * @category combinators * @since 1.0.0 */ export declare const suspend: (f: () => Schema, annotations?: AST.Annotations) => Schema; /** * @category combinators * @since 1.0.0 */ export declare function filter(f: (a: A, options: ParseOptions, self: AST.Refinement) => Option.Option, options?: FilterAnnotations): (self: Schema) => Schema; export declare function filter(refinement: Predicate.Refinement, options?: FilterAnnotations): (self: Schema) => Schema; export declare function filter(predicate: Predicate.Predicate>, options?: FilterAnnotations>): (self: Schema) => Schema; /** * Create a new `Schema` by transforming the input and output of an existing `Schema` * using the provided decoding functions. * * @category combinators * @since 1.0.0 */ export declare const transformOrFail: { (to: Schema, decode: (b: B, options: ParseOptions, ast: AST.Transform) => Effect.Effect, encode: (c: C, options: ParseOptions, ast: AST.Transform) => Effect.Effect): (self: Schema) => Schema; (to: Schema, decode: (b: B, options: ParseOptions, ast: AST.Transform) => Effect.Effect, encode: (c: C, options: ParseOptions, ast: AST.Transform) => Effect.Effect, options: { strict: false; }): (self: Schema) => Schema; (from: Schema, to: Schema, decode: (b: B, options: ParseOptions, ast: AST.Transform) => Effect.Effect, encode: (c: C, options: ParseOptions, ast: AST.Transform) => Effect.Effect): Schema; (from: Schema, to: Schema, decode: (b: B, options: ParseOptions, ast: AST.Transform) => Effect.Effect, encode: (c: C, options: ParseOptions, ast: AST.Transform) => Effect.Effect, options: { strict: false; }): Schema; }; /** * Create a new `Schema` by transforming the input and output of an existing `Schema` * using the provided mapping functions. * * @category combinators * @since 1.0.0 */ export declare const transform: { (to: Schema, decode: (b: B) => C, encode: (c: C) => B): (self: Schema) => Schema; (to: Schema, decode: (b: B) => unknown, encode: (c: C) => unknown, options: { strict: false; }): (self: Schema) => Schema; (from: Schema, to: Schema, decode: (b: B) => C, encode: (c: C) => B): Schema; (from: Schema, to: Schema, decode: (b: B) => unknown, encode: (c: C) => unknown, options: { strict: false; }): Schema; }; /** * Creates a new `Schema` which transforms literal values. * * @example * import * as S from "@effect/schema/Schema" * * const schema = S.transformLiteral(0, "a") * * assert.deepStrictEqual(S.decodeSync(schema)(0), "a") * * @category constructors * @since 1.0.0 */ export declare const transformLiteral: (from: From, to: To) => Schema; /** * Creates a new `Schema` which maps between corresponding literal values. * * @example * import * as S from "@effect/schema/Schema" * * const Animal = S.transformLiterals( * [0, "cat"], * [1, "dog"], * [2, "cow"] * ) * * assert.deepStrictEqual(S.decodeSync(Animal)(1), "dog") * * @category constructors * @since 1.0.0 */ export declare const transformLiterals: (...pairs: A) => Schema; /** * Attaches a property signature with the specified key and value to the schema. * This API is useful when you want to add a property to your schema which doesn't describe the shape of the input, * but rather maps to another schema, for example when you want to add a discriminant to a simple union. * * @param self - The input schema. * @param key - The name of the property to add to the schema. * @param value - The value of the property to add to the schema. * * @example * import * as S from "@effect/schema/Schema" * import { pipe } from "effect/Function" * * const Circle = S.struct({ radius: S.number }) * const Square = S.struct({ sideLength: S.number }) * const Shape = S.union( * Circle.pipe(S.attachPropertySignature("kind", "circle")), * Square.pipe(S.attachPropertySignature("kind", "square")) * ) * * assert.deepStrictEqual(S.decodeSync(Shape)({ radius: 10 }), { * kind: "circle", * radius: 10 * }) * * @category combinators * @since 1.0.0 */ export declare const attachPropertySignature: { (key: K, value: V, options?: DocAnnotations): (schema: Schema) => Schema>; (schema: Schema, key: K, value: V, options?: DocAnnotations): Schema>; }; /** * @since 1.0.0 */ export interface DocAnnotations extends AST.Annotations { readonly identifier?: AST.IdentifierAnnotation; readonly title?: AST.TitleAnnotation; readonly description?: AST.DescriptionAnnotation; readonly examples?: AST.ExamplesAnnotation; readonly default?: AST.DefaultAnnotation; readonly documentation?: AST.DocumentationAnnotation; } /** * @since 1.0.0 */ export interface FilterAnnotations extends DeclareAnnotations { /** * Attaches a JSON Schema annotation to this refinement. * * If the schema is composed of more than one refinement, the corresponding annotations will be merged. */ readonly jsonSchema?: AST.JSONSchemaAnnotation; } /** * @category annotations * @since 1.0.0 */ export declare const annotations: (annotations: AST.Annotations) => (self: Schema) => Schema; /** * @category annotations * @since 1.0.0 */ export declare const message: (message: AST.MessageAnnotation) => (self: Schema) => Schema; /** * @category annotations * @since 1.0.0 */ export declare const identifier: (identifier: AST.IdentifierAnnotation) => (self: Schema) => Schema; /** * @category annotations * @since 1.0.0 */ export declare const title: (title: AST.TitleAnnotation) => (self: Schema) => Schema; /** * @category annotations * @since 1.0.0 */ export declare const description: (description: AST.DescriptionAnnotation) => (self: Schema) => Schema; /** * @category annotations * @since 1.0.0 */ export declare const examples: (examples: AST.ExamplesAnnotation) => (self: Schema) => Schema; declare const _default: (value: A) => (self: Schema) => Schema; export { /** * @category annotations * @since 1.0.0 */ _default as default }; /** * @category annotations * @since 1.0.0 */ export declare const documentation: (documentation: AST.DocumentationAnnotation) => (self: Schema) => Schema; /** * Attaches a JSON Schema annotation to a schema that represents a refinement. * * If the schema is composed of more than one refinement, the corresponding annotations will be merged. * * @category annotations * @since 1.0.0 */ export declare const jsonSchema: (jsonSchema: AST.JSONSchemaAnnotation) => (self: Schema) => Schema; /** * @category annotations * @since 1.0.0 */ export declare const equivalence: (equivalence: Equivalence.Equivalence) => (self: Schema) => Schema; type Rename = { [K in keyof A as K extends keyof M ? M[K] extends PropertyKey ? M[K] : never : K]: A[K]; }; /** * @category renaming * @since 1.0.0 */ export declare const rename: { ]: never; }>(mapping: M): (self: Schema) => Schema>>; ]: never; }>(self: Schema, mapping: M): Schema>>; }; /** * @category type id * @since 1.0.0 */ export declare const TrimmedTypeId: unique symbol; /** * Verifies that a string contains no leading or trailing whitespaces. * * Note. This combinator does not make any transformations, it only validates. * If what you were looking for was a combinator to trim strings, then check out the `trim` combinator. * * @category string filters * @since 1.0.0 */ export declare const trimmed: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const MaxLengthTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type MaxLengthTypeId = typeof MaxLengthTypeId; /** * @category string filters * @since 1.0.0 */ export declare const maxLength: (maxLength: number, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const MinLengthTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type MinLengthTypeId = typeof MinLengthTypeId; /** * @category string filters * @since 1.0.0 */ export declare const minLength: (minLength: number, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const PatternTypeId: unique symbol; /** * @category string filters * @since 1.0.0 */ export declare const pattern: (regex: RegExp, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const StartsWithTypeId: unique symbol; /** * @category string filters * @since 1.0.0 */ export declare const startsWith: (startsWith: string, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const EndsWithTypeId: unique symbol; /** * @category string filters * @since 1.0.0 */ export declare const endsWith: (endsWith: string, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const IncludesTypeId: unique symbol; /** * @category string filters * @since 1.0.0 */ export declare const includes: (searchString: string, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const LowercasedTypeId: unique symbol; /** * Verifies that a string is lowercased. * * @category string filters * @since 1.0.0 */ export declare const lowercased: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category string constructors * @since 1.0.0 */ export declare const Lowercased: Schema; /** * @category type id * @since 1.0.0 */ export declare const UppercasedTypeId: unique symbol; /** * Verifies that a string is uppercased. * * @category string filters * @since 1.0.0 */ export declare const uppercased: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category string constructors * @since 1.0.0 */ export declare const Uppercased: Schema; /** * @category type id * @since 1.0.0 */ export declare const LengthTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type LengthTypeId = typeof LengthTypeId; /** * @category string filters * @since 1.0.0 */ export declare const length: (length: number, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * A schema representing a single character. * * @category string constructors * @since 1.0.0 */ export declare const Char: Schema; /** * @category string filters * @since 1.0.0 */ export declare const nonEmpty: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * This schema converts a string to lowercase. * * @category string transformations * @since 1.0.0 */ export declare const Lowercase: Schema; /** * This schema converts a string to uppercase. * * @category string transformations * @since 1.0.0 */ export declare const Uppercase: Schema; /** * @category string constructors * @since 1.0.0 */ export declare const Trimmed: Schema; /** * This schema allows removing whitespaces from the beginning and end of a string. * * @category string transformations * @since 1.0.0 */ export declare const Trim: Schema; /** * Returns a achema that allows splitting a string into an array of strings. * * @category string transformations * @since 1.0.0 */ export declare const split: (separator: string) => Schema>; /** * @since 1.0.0 */ export type ParseJsonOptions = { readonly reviver?: Parameters[1]; readonly replacer?: Parameters[1]; readonly space?: Parameters[2]; }; /** * The `parseJson` combinator provides a method to convert JSON strings into the `unknown` type using the underlying * functionality of `JSON.parse`. It also utilizes `JSON.stringify` for encoding. * * You can optionally provide a `ParseJsonOptions` to configure both `JSON.parse` and `JSON.stringify` executions. * * Optionally, you can pass a schema `Schema` to obtain an `A` type instead of `unknown`. * * @example * import * as S from "@effect/schema/Schema" * * assert.deepStrictEqual(S.decodeUnknownSync(S.parseJson())(`{"a":"1"}`), { a: "1" }) * assert.deepStrictEqual(S.decodeUnknownSync(S.parseJson(S.struct({ a: S.NumberFromString })))(`{"a":"1"}`), { a: 1 }) * * @category string transformations * @since 1.0.0 */ export declare const parseJson: { (schema: Schema, options?: ParseJsonOptions): Schema; (options?: ParseJsonOptions): Schema; }; /** * @category string constructors * @since 1.0.0 */ export declare const NonEmpty: Schema; /** * @category type id * @since 1.0.0 */ export declare const UUIDTypeId: unique symbol; /** * Represents a Universally Unique Identifier (UUID). * * This schema ensures that the provided string adheres to the standard UUID format. * * @category string constructors * @since 1.0.0 */ export declare const UUID: Schema; /** * @category type id * @since 1.0.0 */ export declare const ULIDTypeId: unique symbol; /** * Represents a Universally Unique Lexicographically Sortable Identifier (ULID). * * ULIDs are designed to be compact, URL-safe, and ordered, making them suitable for use as identifiers. * This schema ensures that the provided string adheres to the standard ULID format. * * @category string constructors * @since 1.0.0 */ export declare const ULID: Schema; /** * @category type id * @since 1.0.0 */ export declare const FiniteTypeId: unique symbol; /** * Ensures that the provided value is a finite number. * * This schema filters out non-finite numeric values, allowing only finite numbers to pass through. * * @category number filters * @since 1.0.0 */ export declare const finite: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const GreaterThanTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type GreaterThanTypeId = typeof GreaterThanTypeId; /** * This filter checks whether the provided number is greater than the specified minimum. * * @category number filters * @since 1.0.0 */ export declare const greaterThan: (min: number, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const GreaterThanOrEqualToTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type GreaterThanOrEqualToTypeId = typeof GreaterThanOrEqualToTypeId; /** * This filter checks whether the provided number is greater than or equal to the specified minimum. * * @category number filters * @since 1.0.0 */ export declare const greaterThanOrEqualTo: (min: number, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const MultipleOfTypeId: unique symbol; /** * @category number filters * @since 1.0.0 */ export declare const multipleOf: (divisor: number, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const IntTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type IntTypeId = typeof IntTypeId; /** * @category number filters * @since 1.0.0 */ export declare const int: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const LessThanTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type LessThanTypeId = typeof LessThanTypeId; /** * This filter checks whether the provided number is less than the specified maximum. * * @category number filters * @since 1.0.0 */ export declare const lessThan: (max: number, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const LessThanOrEqualToTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type LessThanOrEqualToTypeId = typeof LessThanOrEqualToTypeId; /** * This schema checks whether the provided number is less than or equal to the specified maximum. * * @category number filters * @since 1.0.0 */ export declare const lessThanOrEqualTo: (max: number, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const BetweenTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type BetweenTypeId = typeof BetweenTypeId; /** * This filter checks whether the provided number falls within the specified minimum and maximum values. * * @category number filters * @since 1.0.0 */ export declare const between: (min: number, max: number, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const NonNaNTypeId: unique symbol; /** * @category number filters * @since 1.0.0 */ export declare const nonNaN: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category number filters * @since 1.0.0 */ export declare const positive: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category number filters * @since 1.0.0 */ export declare const negative: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category number filters * @since 1.0.0 */ export declare const nonPositive: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category number filters * @since 1.0.0 */ export declare const nonNegative: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * Clamps a number between a minimum and a maximum value. * * @category number transformations * @since 1.0.0 */ export declare const clamp: (minimum: number, maximum: number) => (self: Schema) => Schema; /** * This schema transforms a `string` into a `number` by parsing the string using the `Number` function. * * It returns an error if the value can't be converted (for example when non-numeric characters are provided). * * The following special string values are supported: "NaN", "Infinity", "-Infinity". * * @category number constructors * @since 1.0.0 */ export declare const NumberFromString: Schema; /** * @category number constructors * @since 1.0.0 */ export declare const Finite: Schema; /** * @category number constructors * @since 1.0.0 */ export declare const Int: Schema; /** * @category number constructors * @since 1.0.0 */ export declare const NonNaN: Schema; /** * @category number constructors * @since 1.0.0 */ export declare const Positive: Schema; /** * @category number constructors * @since 1.0.0 */ export declare const Negative: Schema; /** * @category number constructors * @since 1.0.0 */ export declare const NonPositive: Schema; /** * @category number constructors * @since 1.0.0 */ export declare const NonNegative: Schema; /** * @category type id * @since 1.0.0 */ export declare const JsonNumberTypeId: unique symbol; /** * The `JsonNumber` is a schema for representing JSON numbers. It ensures that the provided value is a valid * number by filtering out `NaN` and `(+/-) Infinity`. This is useful when you want to validate and represent numbers in JSON * format. * * @example * import * as S from "@effect/schema/Schema" * * const is = S.is(S.JsonNumber) * * assert.deepStrictEqual(is(42), true) * assert.deepStrictEqual(is(Number.NaN), false) * assert.deepStrictEqual(is(Number.POSITIVE_INFINITY), false) * assert.deepStrictEqual(is(Number.NEGATIVE_INFINITY), false) * * @category number constructors * @since 1.0.0 */ export declare const JsonNumber: Schema; /** * @category boolean transformations * @since 1.0.0 */ export declare const Not: Schema; /** * This schema transforms a `string` into a `symbol`. * * @category symbol transformations * @since 1.0.0 */ export declare const symbol: Schema; /** * @category type id * @since 1.0.0 */ export declare const GreaterThanBigintTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type GreaterThanBigintTypeId = typeof GreaterThanBigintTypeId; /** * @category bigint filters * @since 1.0.0 */ export declare const greaterThanBigint: (min: bigint, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const GreaterThanOrEqualToBigintTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type GreaterThanOrEqualToBigintTypeId = typeof GreaterThanOrEqualToBigintTypeId; /** * @category bigint filters * @since 1.0.0 */ export declare const greaterThanOrEqualToBigint: (min: bigint, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const LessThanBigintTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type LessThanBigintTypeId = typeof LessThanBigintTypeId; /** * @category bigint filters * @since 1.0.0 */ export declare const lessThanBigint: (max: bigint, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const LessThanOrEqualToBigintTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type LessThanOrEqualToBigintTypeId = typeof LessThanOrEqualToBigintTypeId; /** * @category bigint filters * @since 1.0.0 */ export declare const lessThanOrEqualToBigint: (max: bigint, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const BetweenBigintTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type BetweenBigintTypeId = typeof BetweenBigintTypeId; /** * @category bigint filters * @since 1.0.0 */ export declare const betweenBigint: (min: bigint, max: bigint, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category bigint filters * @since 1.0.0 */ export declare const positiveBigint: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category bigint filters * @since 1.0.0 */ export declare const negativeBigint: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category bigint filters * @since 1.0.0 */ export declare const nonNegativeBigint: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category bigint filters * @since 1.0.0 */ export declare const nonPositiveBigint: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * Clamps a bigint between a minimum and a maximum value. * * @category bigint transformations * @since 1.0.0 */ export declare const clampBigint: (minimum: bigint, maximum: bigint) => (self: Schema) => Schema; /** * This schema transforms a `string` into a `bigint` by parsing the string using the `BigInt` function. * * It returns an error if the value can't be converted (for example when non-numeric characters are provided). * * @category bigint transformations * @since 1.0.0 */ export declare const bigint: Schema; /** * @category bigint constructors * @since 1.0.0 */ export declare const PositiveBigintFromSelf: Schema; /** * @category bigint constructors * @since 1.0.0 */ export declare const PositiveBigint: Schema; /** * @category bigint constructors * @since 1.0.0 */ export declare const NegativeBigintFromSelf: Schema; /** * @category bigint constructors * @since 1.0.0 */ export declare const NegativeBigint: Schema; /** * @category bigint constructors * @since 1.0.0 */ export declare const NonPositiveBigintFromSelf: Schema; /** * @category bigint constructors * @since 1.0.0 */ export declare const NonPositiveBigint: Schema; /** * @category bigint constructors * @since 1.0.0 */ export declare const NonNegativeBigintFromSelf: Schema; /** * @category bigint constructors * @since 1.0.0 */ export declare const NonNegativeBigint: Schema; /** * This schema transforms a `number` into a `bigint` by parsing the number using the `BigInt` function. * * It returns an error if the value can't be safely encoded as a `number` due to being out of range. * * @category bigint transformations * @since 1.0.0 */ export declare const BigintFromNumber: Schema; /** * @category Secret constructors * @since 1.0.0 */ export declare const SecretFromSelf: Schema; declare const _Secret: Schema; export { /** * A schema that transforms a `string` into a `Secret`. * * @category Secret transformations * @since 1.0.0 */ _Secret as Secret }; /** * @category Duration constructors * @since 1.0.0 */ export declare const DurationFromSelf: Schema; /** * A schema that transforms a `bigint` tuple into a `Duration`. * Treats the value as the number of nanoseconds. * * @category Duration transformations * @since 1.0.0 */ export declare const DurationFromNanos: Schema; /** * A schema that transforms a `number` tuple into a `Duration`. * Treats the value as the number of milliseconds. * * @category Duration transformations * @since 1.0.0 */ export declare const DurationFromMillis: Schema; declare const _Duration: Schema; export { /** * A schema that transforms a `[number, number]` tuple into a `Duration`. * * @category Duration transformations * @since 1.0.0 */ _Duration as Duration }; /** * Clamps a `Duration` between a minimum and a maximum value. * * @category Duration transformations * @since 1.0.0 */ export declare const clampDuration: (minimum: Duration.DurationInput, maximum: Duration.DurationInput) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const LessThanDurationTypeId: unique symbol; /** * @category Duration filters * @since 1.0.0 */ export declare const lessThanDuration: (max: Duration.DurationInput, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const LessThanOrEqualToDurationTypeId: unique symbol; /** * @category Duration filters * @since 1.0.0 */ export declare const lessThanOrEqualToDuration: (max: Duration.DurationInput, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const GreaterThanDurationTypeId: unique symbol; /** * @category Duration filters * @since 1.0.0 */ export declare const greaterThanDuration: (min: Duration.DurationInput, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const GreaterThanOrEqualToDurationTypeId: unique symbol; /** * @category Duration filters * @since 1.0.0 */ export declare const greaterThanOrEqualToDuration: (min: Duration.DurationInput, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const BetweenDurationTypeId: unique symbol; /** * @category Duration filters * @since 1.0.0 */ export declare const betweenDuration: (minimum: Duration.DurationInput, maximum: Duration.DurationInput, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category Uint8Array constructors * @since 1.0.0 */ export declare const Uint8ArrayFromSelf: Schema; declare const _Uint8Array: Schema, Uint8Array>; export { /** * A schema that transforms a `number` array into a `Uint8Array`. * * @category Uint8Array transformations * @since 1.0.0 */ _Uint8Array as Uint8Array }; /** * @category Encoding transformations * @since 1.0.0 */ export declare const Base64: Schema; /** * @category Encoding transformations * @since 1.0.0 */ export declare const Base64Url: Schema; /** * @category Encoding transformations * @since 1.0.0 */ export declare const Hex: Schema; /** * @category type id * @since 1.0.0 */ export declare const MinItemsTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type MinItemsTypeId = typeof MinItemsTypeId; /** * @category ReadonlyArray filters * @since 1.0.0 */ export declare const minItems: (n: number, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const MaxItemsTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type MaxItemsTypeId = typeof MaxItemsTypeId; /** * @category ReadonlyArray filters * @since 1.0.0 */ export declare const maxItems: (n: number, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const ItemsCountTypeId: unique symbol; /** * @category type id * @since 1.0.0 */ export type ItemsCountTypeId = typeof ItemsCountTypeId; /** * @category ReadonlyArray filters * @since 1.0.0 */ export declare const itemsCount: (n: number, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category ReadonlyArray transformations * @since 1.0.0 */ export declare const getNumberIndexedAccess: (self: Schema) => Schema; /** * Get the first element of a `ReadonlyArray`, or `None` if the array is empty. * * @category ReadonlyArray transformations * @since 1.0.0 */ export declare const head: (self: Schema) => Schema>; /** * Retrieves the first element of a `ReadonlyArray`. * * If the array is empty, it returns the `fallback` argument if provided; otherwise, it fails. * * @category ReadonlyArray transformations * @since 1.0.0 */ export declare const headOr: (self: Schema, fallback?: LazyArg | undefined) => Schema; /** * @category type id * @since 1.0.0 */ export declare const ValidDateTypeId: unique symbol; /** * A filter that **excludes invalid** dates (e.g., `new Date("Invalid Date")` is rejected). * * @category Date filters * @since 1.0.0 */ export declare const validDate: (options?: FilterAnnotations) => (self: Schema) => Schema; /** * Represents a schema for handling potentially **invalid** `Date` instances (e.g., `new Date("Invalid Date")` is not rejected). * * @category Date constructors * @since 1.0.0 */ export declare const DateFromSelf: Schema; /** * Represents a schema for handling only **valid** dates. For example, `new Date("Invalid Date")` is rejected, even though it is an instance of `Date`. * * @category Date constructors * @since 1.0.0 */ export declare const ValidDateFromSelf: Schema; /** * Represents a schema that converts a `string` into a (potentially invalid) `Date` (e.g., `new Date("Invalid Date")` is not rejected). * * @category Date transformations * @since 1.0.0 */ export declare const DateFromString: Schema; declare const _Date: Schema; export { /** * A schema that transforms a `string` into a **valid** `Date`, ensuring that invalid dates, such as `new Date("Invalid Date")`, are rejected. * * @category Date transformations * @since 1.0.0 */ _Date as Date }; /** * @category Option utils * @since 1.0.0 */ export type OptionFrom = { readonly _tag: "None"; } | { readonly _tag: "Some"; readonly value: I; }; /** * @category Option transformations * @since 1.0.0 */ export declare const optionFromSelf: (value: Schema) => Schema, Option.Option>; /** * @category Option transformations * @since 1.0.0 */ export declare const option: (value: Schema) => Schema, Option.Option>; /** * @category Option transformations * @since 1.0.0 */ export declare const optionFromNullable: (value: Schema) => Schema>; /** * @category Option transformations * @since 1.0.0 */ export declare const optionFromNullish: (value: Schema, onNoneEncoding: null | undefined) => Schema>; /** * @category Option transformations * @since 1.0.0 */ export declare const optionFromOrUndefined: (value: Schema) => Schema>; /** * @category Either utils * @since 1.0.0 */ export type RightFrom = { readonly _tag: "Right"; readonly right: IA; }; /** * @category Either utils * @since 1.0.0 */ export type LeftFrom = { readonly _tag: "Left"; readonly left: IE; }; /** * @category Either utils * @since 1.0.0 */ export type EitherFrom = LeftFrom | RightFrom; /** * @category Either transformations * @since 1.0.0 */ export declare const eitherFromSelf: (left: Schema, right: Schema) => Schema, Either.Either>; /** * @category Either transformations * @since 1.0.0 */ export declare const either: (left: Schema, right: Schema) => Schema, Either.Either>; /** * @example * import * as Schema from "@effect/schema/Schema" * * // Schema> * Schema.eitherFromUnion(Schema.string, Schema.number) * * @category Either transformations * @since 1.0.0 */ export declare const eitherFromUnion: (left: Schema, right: Schema) => Schema>; /** * @category ReadonlyMap transformations * @since 1.0.0 */ export declare const readonlyMapFromSelf: (key: Schema, value: Schema) => Schema, ReadonlyMap>; /** * @category ReadonlyMap transformations * @since 1.0.0 */ export declare const readonlyMap: (key: Schema, value: Schema) => Schema>; /** * @category ReadonlySet transformations * @since 1.0.0 */ export declare const readonlySetFromSelf: (item: Schema) => Schema, ReadonlySet>; /** * @category ReadonlySet transformations * @since 1.0.0 */ export declare const readonlySet: (item: Schema) => Schema>; /** * @category BigDecimal constructors * @since 1.0.0 */ export declare const BigDecimalFromSelf: Schema; declare const _BigDecimal: Schema; export { /** * @category BigDecimal transformations * @since 1.0.0 */ _BigDecimal as BigDecimal }; /** * A schema that transforms a `number` into a `BigDecimal`. * When encoding, this Schema will produce incorrect results if the BigDecimal exceeds the 64-bit range of a number. * * @category BigDecimal transformations * @since 1.0.0 */ export declare const BigDecimalFromNumber: Schema; /** * @category type id * @since 1.0.0 */ export declare const GreaterThanBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 1.0.0 */ export declare const greaterThanBigDecimal: (min: BigDecimal.BigDecimal, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const GreaterThanOrEqualToBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 1.0.0 */ export declare const greaterThanOrEqualToBigDecimal: (min: BigDecimal.BigDecimal, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const LessThanBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 1.0.0 */ export declare const lessThanBigDecimal: (max: BigDecimal.BigDecimal, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const LessThanOrEqualToBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 1.0.0 */ export declare const lessThanOrEqualToBigDecimal: (max: BigDecimal.BigDecimal, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category type id * @since 1.0.0 */ export declare const PositiveBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 1.0.0 */ export declare const positiveBigDecimal: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category BigDecimal constructors * @since 1.0.0 */ export declare const PositiveBigDecimalFromSelf: Schema; /** * @category type id * @since 1.0.0 */ export declare const NonNegativeBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 1.0.0 */ export declare const nonNegativeBigDecimal: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category BigDecimal constructors * @since 1.0.0 */ export declare const NonNegativeBigDecimalFromSelf: Schema; /** * @category type id * @since 1.0.0 */ export declare const NegativeBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 1.0.0 */ export declare const negativeBigDecimal: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category BigDecimal constructors * @since 1.0.0 */ export declare const NegativeBigDecimalFromSelf: Schema; /** * @category type id * @since 1.0.0 */ export declare const NonPositiveBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 1.0.0 */ export declare const nonPositiveBigDecimal: (options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * @category BigDecimal constructors * @since 1.0.0 */ export declare const NonPositiveBigDecimalFromSelf: Schema; /** * @category type id * @since 1.0.0 */ export declare const BetweenBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 1.0.0 */ export declare const betweenBigDecimal: (minimum: BigDecimal.BigDecimal, maximum: BigDecimal.BigDecimal, options?: FilterAnnotations | undefined) => (self: Schema) => Schema; /** * Clamps a `BigDecimal` between a minimum and a maximum value. * * @category BigDecimal transformations * @since 1.0.0 */ export declare const clampBigDecimal: (minimum: BigDecimal.BigDecimal, maximum: BigDecimal.BigDecimal) => (self: Schema) => Schema; /** * Negates a `BigDecimal`. * * @category BigDecimal transformations * @since 1.0.0 */ export declare const negateBigDecimal: (self: Schema) => Schema; /** * @category Chunk transformations * @since 1.0.0 */ export declare const chunkFromSelf: (item: Schema) => Schema, Chunk.Chunk>; /** * @category Chunk transformations * @since 1.0.0 */ export declare const chunk: (item: Schema) => Schema>; /** * @category Data transformations * @since 1.0.0 */ export declare const dataFromSelf: >, A extends readonly any[] | Readonly>>(item: Schema) => Schema, Data.Data>; /** * @category Data transformations * @since 1.0.0 */ export declare const data: >, A extends readonly any[] | Readonly>>(item: Schema) => Schema>; type MissingSelfGeneric = `Missing \`Self\` generic - use \`class Self extends ${Usage}()(${Params}{ ... })\``; type _OptionalKeys = { [K in keyof O]-?: {} extends Pick ? K : never; }[keyof O]; type FilterOptionalKeys = Omit>; /** * @category classes * @since 1.0.0 */ export interface Class extends Schema { new (...args: [R] extends [never] ? [ props: Equals extends true ? void | {} : Equals, {}> extends true ? void | C : C, disableValidation?: boolean | undefined ] : [ props: Equals extends true ? void | {} : Equals, {}> extends true ? void | C : C, disableValidation: true ]): A & Omit; readonly struct: Schema; readonly fields: Fields; readonly extend: () => (fields: FieldsB) => [unknown] extends [Extended] ? MissingSelfGeneric<"Base.extend"> : Class, Simplify & FromStruct>, Simplify & ToStruct>, Simplify & ToStructConstructor>, Extended, Simplify & FieldsB>, Self>; readonly transformOrFail: () => (fields: FieldsB, decode: (input: A, options: ParseOptions, ast: AST.Transform) => Effect.Effect & ToStruct>, encode: (input: Simplify & ToStruct>, options: ParseOptions, ast: AST.Transform) => Effect.Effect) => [unknown] extends [Transformed] ? MissingSelfGeneric<"Base.transform"> : Class | R2 | R3, I, Simplify & ToStruct>, Simplify & ToStructConstructor>, Transformed, Simplify & FieldsB>, Self>; readonly transformOrFailFrom: () => (fields: FieldsB, decode: (input: I, options: ParseOptions, ast: AST.Transform) => Effect.Effect & FromStruct>, encode: (input: Simplify & FromStruct>, options: ParseOptions, ast: AST.Transform) => Effect.Effect) => [unknown] extends [Transformed] ? MissingSelfGeneric<"Base.transformFrom"> : Class | R2 | R3, I, Simplify & ToStruct>, Simplify & ToStructConstructor>, Transformed, Simplify & FieldsB>, Self>; } /** * @category classes * @since 1.0.0 */ export declare const Class: () => (fields: Fields) => [unknown] extends [Self] ? "Missing `Self` generic - use `class Self extends Class()({ ... })`" : Class, Simplify>, Simplify>, Simplify>, Self, Fields, {}>; /** * @since 1.0.0 */ export interface ConstructorPropertyDescriptor extends Schema.Variance, Pipeable { make: () => To; } /** * @since 1.0.0 */ export interface MapFromPropertyDescriptor extends Schema.Variance, Pipeable { mapFrom: FromKey; } /** * @category classes * @since 1.0.0 */ export declare const withDefaultConstructor: { >(make: () => Schema.To): (s: S) => S & ConstructorPropertyDescriptor, Schema.From, Schema.To>; >(s: S, make: () => Schema.To): S & ConstructorPropertyDescriptor, Schema.From, Schema.To>; }; /** * @category classes * @since 1.0.0 */ export declare const mapFrom: { , FromKey extends PropertyKey>(from: FromKey): (s: S) => S & MapFromPropertyDescriptor, Schema.From, Schema.To, FromKey>; , FromKey extends PropertyKey>(s: S, from: FromKey): S & MapFromPropertyDescriptor, Schema.From, Schema.To, FromKey>; }; /** * @since 1.0.0 */ export type ToOptionalConstructorKeys = { [K in keyof Fields]: Fields[K] extends ConstructorPropertyDescriptor ? K : never; }[keyof Fields]; /** * @since 1.0.0 */ export type ToStructConstructor = { readonly [K in Exclude | ToOptionalConstructorKeys>]: Schema.To; } & { readonly [K in ToOptionalKeys]?: Schema.To; } & { readonly [K in ToOptionalConstructorKeys]?: Schema.To; }; /** * @category classes * @since 1.0.0 */ export declare const TaggedClass: () => (tag: Tag, fields: Fields) => [unknown] extends [Self] ? "Missing `Self` generic - use `class Self extends TaggedClass()(\"Tag\", { ... })`" : Class, Simplify<{ readonly _tag: Tag; } & { readonly [K in Exclude> as GetKey]: Schema.From; } & { readonly [K_1 in FromOptionalKeys as GetKey]?: Schema.From; }>, Simplify<{ readonly _tag: Tag; } & { readonly [K_2 in Exclude>]: Schema.To; } & { readonly [K_3 in ToOptionalKeys]?: Schema.To; }>, Simplify>, Self, Fields, {}>; /** * @category classes * @since 1.0.0 */ export declare const TaggedError: () => (tag: Tag, fields: Fields) => [unknown] extends [Self] ? "Missing `Self` generic - use `class Self extends TaggedError()(\"Tag\", { ... })`" : Class, Simplify<{ readonly _tag: Tag; } & { readonly [K in Exclude> as GetKey]: Schema.From; } & { readonly [K_1 in FromOptionalKeys as GetKey]?: Schema.From; }>, Simplify<{ readonly _tag: Tag; } & { readonly [K_2 in Exclude>]: Schema.To; } & { readonly [K_3 in ToOptionalKeys]?: Schema.To; }>, Simplify>, Self, Fields, Effect.Effect & Error>; /** * @category classes * @since 1.0.0 */ export interface TaggedRequest extends Request.Request, Serializable.SerializableWithResult { readonly _tag: Tag; } /** * @category classes * @since 1.0.0 */ export declare namespace TaggedRequest { /** * @category classes * @since 1.0.0 */ type Any = TaggedRequest | TaggedRequest; } /** * @category classes * @since 1.0.0 */ export declare const TaggedRequest: () => (tag: Tag, Failure: Schema, Success: Schema, fields: Fields) => [unknown] extends [Self] ? "Missing `Self` generic - use `class Self extends TaggedRequest()(\"Tag\", SuccessSchema, FailureSchema, { ... })`" : Class, Simplify<{ readonly _tag: Tag; } & { readonly [K in Exclude> as GetKey]: Schema.From; } & { readonly [K_1 in FromOptionalKeys as GetKey]?: Schema.From; }>, Simplify<{ readonly _tag: Tag; } & { readonly [K_2 in Exclude>]: Schema.To; } & { readonly [K_3 in ToOptionalKeys]?: Schema.To; }>, Simplify>, Self, Fields, TaggedRequest, Simplify<{ readonly _tag: Tag; } & { readonly [K in Exclude> as GetKey]: Schema.From; } & { readonly [K_1 in FromOptionalKeys as GetKey]?: Schema.From; }>, Self, ER | AR, EI, EA, AI, AA>>; /** * @category FiberId * @since 1.0.0 */ export type FiberIdFrom = { readonly _tag: "Composite"; readonly left: FiberIdFrom; readonly right: FiberIdFrom; } | { readonly _tag: "None"; } | { readonly _tag: "Runtime"; readonly id: number; readonly startTimeMillis: number; }; /** * @category FiberId constructors * @since 1.0.0 */ export declare const FiberIdFromSelf: Schema; declare const _FiberId: Schema; export { /** * @category FiberId transformations * @since 1.0.0 */ _FiberId as FiberId }; /** * @category Cause utils * @since 1.0.0 */ export type CauseFrom = { readonly _tag: "Die"; readonly defect: unknown; } | { readonly _tag: "Empty"; } | { readonly _tag: "Fail"; readonly error: E; } | { readonly _tag: "Interrupt"; readonly fiberId: FiberIdFrom; } | { readonly _tag: "Parallel"; readonly left: CauseFrom; readonly right: CauseFrom; } | { readonly _tag: "Sequential"; readonly left: CauseFrom; readonly right: CauseFrom; }; /** * @category Cause transformations * @since 1.0.0 */ export declare const causeFromSelf: (error: Schema, defect?: Schema) => Schema, Cause.Cause>; /** * @category Cause transformations * @since 1.0.0 */ export declare const cause: (error: Schema, defect?: Schema) => Schema, Cause.Cause>; /** * @category Exit utils * @since 1.0.0 */ export type ExitFrom = { readonly _tag: "Failure"; readonly cause: CauseFrom; } | { readonly _tag: "Success"; readonly value: A; }; /** * @category Exit transformations * @since 1.0.0 */ export declare const exitFromSelf: (error: Schema, value: Schema, defect?: Schema) => Schema, Exit.Exit>; /** * @category Exit transformations * @since 1.0.0 */ export declare const exit: (error: Schema, value: Schema, defect?: Schema) => Schema, Exit.Exit>; /** * @category HashSet transformations * @since 1.0.0 */ export declare const hashSetFromSelf: (item: Schema) => Schema, HashSet.HashSet>; /** * @category HashSet transformations * @since 1.0.0 */ export declare const hashSet: (item: Schema) => Schema>; /** * @category HashMap transformations * @since 1.0.0 */ export declare const hashMapFromSelf: (key: Schema, value: Schema) => Schema, HashMap.HashMap>; /** * @category HashMap transformations * @since 1.0.0 */ export declare const hashMap: (key: Schema, value: Schema) => Schema>; /** * @category List transformations * @since 1.0.0 */ export declare const listFromSelf: (item: Schema) => Schema, List.List>; /** * @category List transformations * @since 1.0.0 */ export declare const list: (item: Schema) => Schema>; //# sourceMappingURL=Schema.d.ts.map