/** * @since 0.67.0 */ import * as array_ from "effect/Array"; import * as bigDecimal_ from "effect/BigDecimal"; import type { Brand } from "effect/Brand"; import * as cause_ from "effect/Cause"; import * as chunk_ from "effect/Chunk"; import * as config_ from "effect/Config"; import * as dateTime from "effect/DateTime"; 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 * as Order from "effect/Order"; import type { Pipeable } from "effect/Pipeable"; import * as redacted_ from "effect/Redacted"; import * as Request from "effect/Request"; import * as sortedSet_ from "effect/SortedSet"; import type * as Types from "effect/Types"; import type { GenerationContext, LazyArbitrary } 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 0.68.2 */ export type Simplify = { [K in keyof A]: A[K]; } & {}; /** * @since 0.67.0 */ export type SimplifyMutable = { -readonly [K in keyof A]: A[K]; } extends infer B ? B : never; /** * @since 0.67.0 * @category symbol */ export declare const TypeId: unique symbol; /** * @since 0.67.0 * @category symbol */ export type TypeId = typeof TypeId; /** * @category model * @since 0.67.0 */ export interface Schema extends Schema.Variance, Pipeable { readonly Type: A; readonly Encoded: I; /** @since 0.69.3 */ readonly Context: R; readonly ast: AST.AST; /** * Merges a set of new annotations with existing ones, potentially overwriting * any duplicates. */ annotations(annotations: Annotations.Schema): Schema; } /** * @category model * @since 0.67.0 */ export interface SchemaClass extends AnnotableClass, A, I, R> { } /** * @category constructors * @since 0.67.0 */ export declare const make: (ast: AST.AST) => SchemaClass; /** * @category annotations * @since 0.67.0 */ export declare namespace Annotable { /** * @since 0.67.0 */ type Self = ReturnType; /** * @since 0.67.0 */ type Any = Annotable; /** * @since 0.67.0 */ type All = Any | Annotable | Annotable | Annotable; } /** * @category annotations * @since 0.67.0 */ export interface Annotable, A, I = A, R = never> extends Schema { annotations(annotations: Annotations.Schema): Self; } /** * @category annotations * @since 0.67.0 */ export interface AnnotableClass, A, I = A, R = never> extends Annotable { new (_: never): Schema.Variance; } /** * @since 0.67.0 */ export declare const asSchema: (schema: S) => Schema, Schema.Encoded, Schema.Context>; /** * @category formatting * @since 0.67.0 */ export declare const format: (schema: S) => string; /** * @since 0.67.0 */ export declare namespace Schema { /** * @since 0.67.0 */ interface Variance { readonly [TypeId]: { readonly _A: Types.Invariant; readonly _I: Types.Invariant; readonly _R: Types.Covariant; }; } /** * @since 0.67.0 */ type Type = S extends Schema.Variance ? A : never; /** * @since 0.67.0 */ type Encoded = S extends Schema.Variance ? I : never; /** * @since 0.67.0 */ type Context = S extends Schema.Variance ? R : never; /** * @since 0.67.0 */ type ToAsserts = (input: unknown, options?: AST.ParseOptions) => asserts input is Schema.Type; /** * Any schema, except for `never`. * * @since 0.67.0 */ type Any = Schema; /** * Any schema with `Context = never`, except for `never`. * * @since 0.67.0 */ type AnyNoContext = Schema; /** * Any schema, including `never`. * * @since 0.67.0 */ type All = Any | Schema | Schema | Schema; /** * Type-level counterpart of `Schema.asSchema` function. * * @since 0.67.0 */ type AsSchema = Schema, Encoded, Context>; } /** * The `encodedSchema` function allows you to extract the `Encoded` portion of a * schema, creating a new schema that conforms to the properties defined in the * original schema without retaining any refinements or transformations that * were applied previously. * * @since 0.67.0 */ export declare const encodedSchema: (schema: Schema) => SchemaClass; /** * The `encodedBoundSchema` function is similar to `encodedSchema` but preserves * the refinements up to the first transformation point in the original schema. * * @since 0.67.17 */ export declare const encodedBoundSchema: (schema: Schema) => SchemaClass; /** * The `typeSchema` function allows you to extract the `Type` portion of a * schema, creating a new schema that conforms to the properties defined in the * original schema without considering the initial encoding or transformation * processes. * * @since 0.67.0 */ export declare const typeSchema: (schema: Schema) => SchemaClass; export { /** * By default the option `exact` is set to `true`. * * @throws `ParseError` * @category validation * @since 0.67.0 */ asserts, /** * @category decoding * @since 0.67.0 */ decodeOption, /** * @throws `ParseError` * @category decoding * @since 0.67.0 */ decodeSync, /** * @category decoding * @since 0.67.0 */ decodeUnknownOption, /** * @throws `ParseError` * @category decoding * @since 0.67.0 */ decodeUnknownSync, /** * @category encoding * @since 0.67.0 */ encodeOption, /** * @throws `ParseError` * @category encoding * @since 0.67.0 */ encodeSync, /** * @category encoding * @since 0.67.0 */ encodeUnknownOption, /** * @throws `ParseError` * @category encoding * @since 0.67.0 */ encodeUnknownSync, /** * By default the option `exact` is set to `true`. * * @category validation * @since 0.67.0 */ is, /** * @category validation * @since 0.67.0 */ validateOption, /** * @throws `ParseError` * @category validation * @since 0.67.0 */ validateSync } from "./ParseResult.js"; /** * @category encoding * @since 0.67.0 */ export declare const encodeUnknown: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Effect.Effect; /** * @category encoding * @since 0.67.0 */ export declare const encodeUnknownEither: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => either_.Either; /** * @category encoding * @since 0.67.0 */ export declare const encodeUnknownPromise: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Promise; /** * @category encoding * @since 0.67.0 */ export declare const encode: (schema: Schema, options?: ParseOptions) => (a: A, overrideOptions?: ParseOptions) => Effect.Effect; /** * @category encoding * @since 0.67.0 */ export declare const encodeEither: (schema: Schema, options?: ParseOptions) => (a: A, overrideOptions?: ParseOptions) => either_.Either; /** * @category encoding * @since 0.67.0 */ export declare const encodePromise: (schema: Schema, options?: ParseOptions) => (a: A, overrideOptions?: ParseOptions) => Promise; /** * @category decoding * @since 0.67.0 */ export declare const decodeUnknown: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Effect.Effect; /** * @category decoding * @since 0.67.0 */ export declare const decodeUnknownEither: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => either_.Either; /** * @category decoding * @since 0.67.0 */ export declare const decodeUnknownPromise: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Promise; /** * @category decoding * @since 0.67.0 */ export declare const decode: (schema: Schema, options?: ParseOptions) => (i: I, overrideOptions?: ParseOptions) => Effect.Effect; /** * @category decoding * @since 0.67.0 */ export declare const decodeEither: (schema: Schema, options?: ParseOptions) => (i: I, overrideOptions?: ParseOptions) => either_.Either; /** * @category decoding * @since 0.67.0 */ export declare const decodePromise: (schema: Schema, options?: ParseOptions) => (i: I, overrideOptions?: ParseOptions) => Promise; /** * @category validation * @since 0.67.0 */ export declare const validate: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Effect.Effect; /** * @category validation * @since 0.67.0 */ export declare const validateEither: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => either_.Either; /** * @category validation * @since 0.67.0 */ export declare const validatePromise: (schema: Schema, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Promise; /** * Tests if a value is a `Schema`. * * @category guards * @since 0.67.0 */ export declare const isSchema: (u: unknown) => u is Schema.Any; /** * @category api interface * @since 0.67.0 */ export interface Literal> extends AnnotableClass, Literals[number]> { readonly literals: Readonly; } /** * @category constructors * @since 0.67.0 */ export declare function Literal>(...literals: Literals): Literal; export declare function Literal(): Never; export declare function Literal>(...literals: Literals): Schema; /** * Creates a new `Schema` from a literal schema. * * @example * import * as S from "@effect/schema/Schema" * import { Either } from "effect" * * const schema = S.Literal("a", "b", "c").pipe(S.pickLiteral("a", "b")) * * assert.deepStrictEqual(S.decodeSync(schema)("a"), "a") * assert.deepStrictEqual(S.decodeSync(schema)("b"), "b") * assert.strictEqual(Either.isLeft(S.decodeUnknownEither(schema)("c")), true) * * @category constructors * @since 0.67.0 */ export declare const pickLiteral: >(...literals: L) => (_schema: Schema) => Literal<[...L]>; /** * @category constructors * @since 0.67.0 */ export declare const UniqueSymbolFromSelf: (symbol: S) => SchemaClass; /** * @category api interface * @since 0.67.0 */ export interface Enums extends AnnotableClass, A[keyof A]> { readonly enums: A; } /** * @since 0.67.0 */ export type EnumsDefinition = { [x: string]: string | number; }; /** * @category constructors * @since 0.67.0 */ export declare const Enums: (enums: A) => Enums; type Join = Params extends [infer Head, ...infer Tail] ? `${(Head extends Schema ? A : Head) & (AST.LiteralValue)}${Join}` : ""; /** * @category API interface * @since 0.67.17 */ export interface TemplateLiteral extends SchemaClass { } type TemplateLiteralParameter = Schema.AnyNoContext | AST.LiteralValue; /** * @category template literal * @since 0.67.0 */ export declare const TemplateLiteral: >(...[head, ...tail]: Params) => TemplateLiteral>; type TemplateLiteralParserParameters = Schema.Any | AST.LiteralValue; type TemplateLiteralParserParametersType = T extends [infer Head, ...infer Tail] ? readonly [Head extends Schema ? A : Head, ...TemplateLiteralParserParametersType] : []; type TemplateLiteralParserParametersEncoded = T extends [infer Head, ...infer Tail] ? `${(Head extends Schema ? I : Head) & (AST.LiteralValue)}${TemplateLiteralParserParametersEncoded}` : ""; /** * @category API interface * @since 0.70.1 */ export interface TemplateLiteralParser> extends Schema, TemplateLiteralParserParametersEncoded, Schema.Context> { readonly params: Params; } /** * @category template literal * @since 0.70.1 */ export declare const TemplateLiteralParser: >(...params: Params) => TemplateLiteralParser; /** * 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 0.67.0 */ export declare const declare: { /** * 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 0.67.0 */ (is: (input: unknown) => input is A, annotations?: Annotations.Schema): SchemaClass; /** * 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 0.67.0 */ , I, A>(typeParameters: P, options: { readonly decode: (...typeParameters: { readonly [K in keyof P]: Schema, Schema.Encoded, never>; }) => (input: unknown, options: ParseOptions, ast: AST.Declaration) => Effect.Effect; readonly encode: (...typeParameters: { readonly [K in keyof P]: Schema, Schema.Encoded, never>; }) => (input: unknown, options: ParseOptions, ast: AST.Declaration) => Effect.Effect; }, annotations?: Annotations.Schema; }>): SchemaClass>; }; /** * @category type id * @since 0.67.0 */ export declare const BrandTypeId: unique symbol; /** * @category constructors * @since 0.67.0 */ export declare const fromBrand: , A extends Brand.Unbranded>(constructor: Brand.Constructor, annotations?: Annotations.Filter) => (self: Schema) => BrandSchema; /** * @category type id * @since 0.67.0 */ export declare const InstanceOfTypeId: unique symbol; /** * @category api interface * @since 0.67.0 */ export interface instanceOf extends AnnotableClass, A> { } /** * @category constructors * @since 0.67.0 */ export declare const instanceOf: any>(constructor: A, annotations?: Annotations.Schema>) => instanceOf>; declare const Undefined_base: SchemaClass; /** * @category primitives * @since 0.67.0 */ export declare class Undefined extends Undefined_base { } declare const Void_base: SchemaClass; /** * @category primitives * @since 0.67.0 */ export declare class Void extends Void_base { } declare const Null_base: SchemaClass; /** * @category primitives * @since 0.67.0 */ export declare class Null extends Null_base { } declare const Never_base: SchemaClass; /** * @category primitives * @since 0.67.0 */ export declare class Never extends Never_base { } declare const Unknown_base: SchemaClass; /** * @category primitives * @since 0.67.0 */ export declare class Unknown extends Unknown_base { } declare const Any_base: SchemaClass; /** * @category primitives * @since 0.67.0 */ export declare class Any extends Any_base { } declare const BigIntFromSelf_base: SchemaClass; /** * @category primitives * @since 0.67.0 */ export declare class BigIntFromSelf extends BigIntFromSelf_base { } declare const SymbolFromSelf_base: SchemaClass; /** * @category primitives * @since 0.67.0 */ export declare class SymbolFromSelf extends SymbolFromSelf_base { } declare const String$_base: SchemaClass; /** @ignore */ declare class String$ extends String$_base { } declare const Number$_base: SchemaClass; /** @ignore */ declare class Number$ extends Number$_base { } declare const Boolean$_base: SchemaClass; /** @ignore */ declare class Boolean$ extends Boolean$_base { } declare const Object$_base: SchemaClass; /** @ignore */ declare class Object$ extends Object$_base { } export { /** * @category primitives * @since 0.67.0 */ Boolean$ as Boolean, /** * @category primitives * @since 0.67.0 */ Number$ as Number, /** * @category primitives * @since 0.67.0 */ Object$ as Object, /** * @category primitives * @since 0.67.0 */ String$ as String }; /** * @category api interface * @since 0.67.0 */ export interface Union> extends AnnotableClass, Schema.Type, Schema.Encoded, Schema.Context> { readonly members: Readonly; annotations(annotations: Annotations.Schema>): Union; } /** * @category combinators * @since 0.67.0 */ export declare function Union>(...members: Members): Union; export declare function Union(member: Member): Member; export declare function Union(): typeof Never; export declare function Union>(...members: Members): Schema, Schema.Encoded, Schema.Context>; /** * @category api interface * @since 0.67.0 */ export interface NullOr extends Union<[S, typeof Null]> { annotations(annotations: Annotations.Schema | null>): NullOr; } /** * @category combinators * @since 0.67.0 */ export declare const NullOr: (self: S) => NullOr; /** * @category api interface * @since 0.67.0 */ export interface UndefinedOr extends Union<[S, typeof Undefined]> { annotations(annotations: Annotations.Schema | undefined>): UndefinedOr; } /** * @category combinators * @since 0.67.0 */ export declare const UndefinedOr: (self: S) => UndefinedOr; /** * @category api interface * @since 0.67.0 */ export interface NullishOr extends Union<[S, typeof Null, typeof Undefined]> { annotations(annotations: Annotations.Schema | null | undefined>): NullishOr; } /** * @category combinators * @since 0.67.0 */ export declare const NullishOr: (self: S) => NullishOr; /** * @category combinators * @since 0.67.0 */ export declare const keyof: (self: Schema) => SchemaClass; /** * @since 0.68.0 */ export declare namespace Element { /** * @since 0.68.0 */ interface Annotations extends Annotations.Doc { readonly missingMessage?: AST.MissingMessageAnnotation; } /** * @since 0.68.0 */ type Token = "" | "?"; } /** * @category API interface * @since 0.68.0 */ export interface Element extends Schema.Variance, Schema.Encoded, Schema.Context> { readonly _Token: Token; readonly ast: AST.OptionalType; readonly from: S; annotations(annotations: Element.Annotations>): Element; } /** * @since 0.68.0 */ export declare const element: (self: S) => Element; /** * @since 0.67.0 */ export declare const optionalElement: (self: S) => Element; /** * @since 0.67.0 */ export declare namespace TupleType { type ElementsType = readonly []> = Elements extends readonly [infer Head, ...infer Tail] ? Head extends Element ? ElementsType?]> : ElementsType]> : Out; type ElementsEncoded = readonly []> = Elements extends readonly [infer Head, ...infer Tail] ? Head extends Element ? ElementsEncoded?]> : ElementsEncoded]> : Out; /** * @since 0.67.0 */ type Elements = ReadonlyArray>; /** * @since 0.68.0 */ type Rest = ReadonlyArray>; /** * @since 0.67.0 */ type Type = Rest extends [ infer Head, ...infer Tail ] ? Readonly<[ ...ElementsType, ...ReadonlyArray>, ...{ readonly [K in keyof Tail]: Schema.Type; } ]> : ElementsType; /** * @since 0.67.0 */ type Encoded = Rest extends [ infer Head, ...infer Tail ] ? Readonly<[ ...ElementsEncoded, ...ReadonlyArray>, ...{ readonly [K in keyof Tail]: Schema.Encoded; } ]> : ElementsEncoded; } /** * @category api interface * @since 0.67.0 */ export interface TupleType extends AnnotableClass, TupleType.Type, TupleType.Encoded, Schema.Context | Schema.Context> { readonly elements: Readonly; readonly rest: Readonly; } /** * @category api interface * @since 0.67.0 */ export interface Tuple extends TupleType { annotations(annotations: Annotations.Schema>): Tuple; } /** * @category constructors * @since 0.67.0 */ export declare function Tuple>(elements: Elements, ...rest: Rest): TupleType; export declare function Tuple(...elements: Elements): Tuple; /** * @category api interface * @since 0.67.0 */ export interface Array$ extends TupleType<[], [Value]> { readonly value: Value; annotations(annotations: Annotations.Schema>): Array$; } declare const Array$: (value: Value) => Array$; export { /** * @category constructors * @since 0.67.0 */ Array$ as Array }; /** * @category api interface * @since 0.67.0 */ export interface NonEmptyArray extends TupleType<[Value], [Value]> { readonly value: Value; annotations(annotations: Annotations.Schema>): NonEmptyArray; } /** * @category constructors * @since 0.67.0 */ export declare const NonEmptyArray: (value: Value) => NonEmptyArray; /** * @category api interface * @since 0.71.0 */ export interface ArrayEnsure extends AnnotableClass, ReadonlyArray>, Schema.Encoded | ReadonlyArray>, Schema.Context> { } /** * @category constructors * @since 0.71.0 */ export declare const ArrayEnsure: (value: Value) => ArrayEnsure; /** * @category api interface * @since 0.71.0 */ export interface NonEmptyArrayEnsure extends AnnotableClass, array_.NonEmptyReadonlyArray>, Schema.Encoded | array_.NonEmptyReadonlyArray>, Schema.Context> { } /** * @category constructors * @since 0.71.0 */ export declare const NonEmptyArrayEnsure: (value: Value) => NonEmptyArrayEnsure; /** * @since 0.67.0 */ export declare namespace PropertySignature { /** * @since 0.67.0 */ type Token = "?:" | ":"; /** * @since 0.67.0 */ type Any = PropertySignature; /** * @since 0.67.0 */ type All = Any | PropertySignature | PropertySignature | PropertySignature; /** * @since 0.67.0 */ type AST = PropertySignatureDeclaration | PropertySignatureTransformation; /** * @since 0.67.0 */ interface Annotations extends Annotations.Doc { readonly missingMessage?: AST.MissingMessageAnnotation; } } /** * @category PropertySignature * @since 0.67.0 */ export declare class PropertySignatureDeclaration extends AST.OptionalType { readonly isReadonly: boolean; readonly defaultValue: (() => unknown) | undefined; /** * @since 0.67.0 */ readonly _tag = "PropertySignatureDeclaration"; constructor(type: AST.AST, isOptional: boolean, isReadonly: boolean, annotations: AST.Annotations, defaultValue: (() => unknown) | undefined); /** * @since 0.67.0 */ toString(): string; } /** * @category PropertySignature * @since 0.67.0 */ export declare class FromPropertySignature extends AST.OptionalType { readonly isReadonly: boolean; readonly fromKey?: PropertyKey | undefined; constructor(type: AST.AST, isOptional: boolean, isReadonly: boolean, annotations: AST.Annotations, fromKey?: PropertyKey | undefined); } /** * @category PropertySignature * @since 0.67.0 */ export declare class ToPropertySignature extends AST.OptionalType { readonly isReadonly: boolean; readonly defaultValue: (() => unknown) | undefined; constructor(type: AST.AST, isOptional: boolean, isReadonly: boolean, annotations: AST.Annotations, defaultValue: (() => unknown) | undefined); } /** * @category PropertySignature * @since 0.67.0 */ export declare class PropertySignatureTransformation { readonly from: FromPropertySignature; readonly to: ToPropertySignature; readonly decode: AST.PropertySignatureTransformation["decode"]; readonly encode: AST.PropertySignatureTransformation["encode"]; /** * @since 0.67.0 */ readonly _tag = "PropertySignatureTransformation"; constructor(from: FromPropertySignature, to: ToPropertySignature, decode: AST.PropertySignatureTransformation["decode"], encode: AST.PropertySignatureTransformation["encode"]); /** * @since 0.67.0 */ toString(): string; } /** * @since 0.68.0 * @category symbol */ export declare const PropertySignatureTypeId: unique symbol; /** * @since 0.68.0 * @category symbol */ export type PropertySignatureTypeId = typeof PropertySignatureTypeId; /** * @since 0.69.3 * @category guards */ export declare const isPropertySignature: (u: unknown) => u is PropertySignature.All; /** * @category PropertySignature * @since 0.67.0 */ export interface PropertySignature extends Schema.Variance, Pipeable { readonly [PropertySignatureTypeId]: null; readonly _TypeToken: TypeToken; readonly _EncodedToken: EncodedToken; readonly _HasDefault: HasDefault; readonly _Key: Key; readonly ast: PropertySignature.AST; annotations(annotations: PropertySignature.Annotations): PropertySignature; } declare class PropertySignatureImpl implements PropertySignature { readonly ast: PropertySignature.AST; readonly [TypeId]: Schema.Variance[TypeId]; readonly [PropertySignatureTypeId]: null; readonly _TypeToken: TypeToken; readonly _Key: Key; readonly _EncodedToken: EncodedToken; readonly _HasDefault: HasDefault; constructor(ast: PropertySignature.AST); pipe(): unknown; annotations(annotations: PropertySignature.Annotations): PropertySignature; toString(): string; } /** * @category PropertySignature * @since 0.67.15 */ export declare const makePropertySignature: (ast: PropertySignature.AST) => PropertySignatureImpl; /** * @category API interface * @since 1.0.0 */ export interface propertySignature extends PropertySignature<":", Schema.Type, never, ":", Schema.Encoded, false, Schema.Context> { readonly from: S; annotations(annotations: PropertySignature.Annotations>): propertySignature; } /** * Lifts a `Schema` into a `PropertySignature`. * * @category PropertySignature * @since 0.67.0 */ export declare const propertySignature: (self: S) => propertySignature; /** * Enhances a property signature with a default constructor value. * * @category PropertySignature * @since 0.67.0 */ export declare const withConstructorDefault: { /** * Enhances a property signature with a default constructor value. * * @category PropertySignature * @since 0.67.0 */ (defaultValue: () => Types.NoInfer): (self: PropertySignature) => PropertySignature; /** * Enhances a property signature with a default constructor value. * * @category PropertySignature * @since 0.67.0 */ (self: PropertySignature, defaultValue: () => Types.NoInfer): PropertySignature; }; /** * Enhances a property signature with a default decoding value. * * @category PropertySignature * @since 0.67.0 */ export declare const withDecodingDefault: { /** * Enhances a property signature with a default decoding value. * * @category PropertySignature * @since 0.67.0 */ (defaultValue: () => Types.NoInfer): (self: PropertySignature<"?:", Type, Key, "?:", Encoded, HasDefault, R>) => PropertySignature<":", Exclude, Key, "?:", Encoded, HasDefault, R>; /** * Enhances a property signature with a default decoding value. * * @category PropertySignature * @since 0.67.0 */ (self: PropertySignature<"?:", Type, Key, "?:", Encoded, HasDefault, R>, defaultValue: () => Types.NoInfer): PropertySignature<":", Exclude, Key, "?:", Encoded, HasDefault, R>; }; /** * Enhances a property signature with a default decoding value and a default constructor value. * * @category PropertySignature * @since 0.67.0 */ export declare const withDefaults: { /** * Enhances a property signature with a default decoding value and a default constructor value. * * @category PropertySignature * @since 0.67.0 */ (defaults: { constructor: () => Types.NoInfer>; decoding: () => Types.NoInfer; }): (self: PropertySignature<"?:", Type, Key, "?:", Encoded, boolean, R>) => PropertySignature<":", Exclude, Key, "?:", Encoded, true, R>; /** * Enhances a property signature with a default decoding value and a default constructor value. * * @category PropertySignature * @since 0.67.0 */ (self: PropertySignature<"?:", Type, Key, "?:", Encoded, boolean, R>, defaults: { constructor: () => Types.NoInfer>; decoding: () => Types.NoInfer; }): PropertySignature<":", Exclude, Key, "?:", Encoded, true, R>; }; /** * Enhances a property signature by specifying a different key for it in the Encoded type. * * @category PropertySignature * @since 0.67.0 */ export declare const fromKey: { /** * Enhances a property signature by specifying a different key for it in the Encoded type. * * @category PropertySignature * @since 0.67.0 */ (key: Key): (self: PropertySignature) => PropertySignature; /** * Enhances a property signature by specifying a different key for it in the Encoded type. * * @category PropertySignature * @since 0.67.0 */ (self: PropertySignature, key: Key): PropertySignature; }; /** * Converts an optional property to a required one through a transformation `Option -> Type`. * * - `decode`: `none` as argument means the value is missing in the input. * - `encode`: `none` as return value means the value will be missing in the output. * * @category PropertySignature * @since 0.67.0 */ export declare const optionalToRequired: (from: Schema, to: Schema, options: { readonly decode: (o: option_.Option) => TI; readonly encode: (ti: TI) => option_.Option; }) => PropertySignature<":", TA, never, "?:", FI, false, FR | TR>; /** * Converts an optional property to a required one through a transformation `Type -> Option`. * * - `decode`: `none` as return value means the value will be missing in the output. * - `encode`: `none` as argument means the value is missing in the input. * * @category PropertySignature * @since 0.67.15 */ export declare const requiredToOptional: (from: Schema, to: Schema, options: { readonly decode: (fa: FA) => option_.Option; readonly encode: (o: option_.Option) => FA; }) => PropertySignature<"?:", TA, never, ":", FI, false, FR | TR>; /** * Converts an optional property to another optional property through a transformation `Option -> Option`. * * - `decode`: * - `none` as argument means the value is missing in the input. * - `none` as return value means the value will be missing in the output. * - `encode`: * - `none` as argument means the value is missing in the input. * - `none` as return value means the value will be missing in the output. * * @category PropertySignature * @since 0.67.0 */ export declare const optionalToOptional: (from: Schema, to: Schema, options: { readonly decode: (o: option_.Option) => option_.Option; readonly encode: (o: option_.Option) => option_.Option; }) => PropertySignature<"?:", TA, never, "?:", FI, false, FR | TR>; /** * @since 0.67.0 */ export type OptionalOptions = { readonly default?: never; readonly as?: never; readonly exact?: true; readonly nullable?: true; } | { readonly default: LazyArg; readonly as?: never; readonly exact?: true; readonly nullable?: true; } | { readonly as: "Option"; readonly default?: never; readonly exact?: never; readonly nullable?: never; readonly onNoneEncoding?: LazyArg>; } | { readonly as: "Option"; readonly default?: never; readonly exact?: never; readonly nullable: true; readonly onNoneEncoding?: LazyArg>; } | { readonly as: "Option"; readonly default?: never; readonly exact: true; readonly nullable?: never; readonly onNoneEncoding?: never; } | { readonly as: "Option"; readonly default?: never; readonly exact: true; readonly nullable: true; readonly onNoneEncoding?: LazyArg>; } | undefined; /** * @category api interface * @since 0.67.10 */ export interface optional extends PropertySignature<"?:", Schema.Type | undefined, never, "?:", Schema.Encoded | undefined, false, Schema.Context> { readonly from: S; annotations(annotations: PropertySignature.Annotations | undefined>): optional; } /** * @category api interface * @since 0.69.0 */ export interface optionalWith extends PropertySignature extends true ? ":" : "?:", (Types.Has extends true ? option_.Option> : Schema.Type) | (Types.Has extends true ? never : undefined), never, "?:", Schema.Encoded | (Types.Has extends true ? null : never) | (Types.Has extends true ? never : undefined), Types.Has, Schema.Context> { readonly from: S; annotations(annotations: PropertySignature.Annotations<(Types.Has extends true ? option_.Option> : Schema.Type) | (Types.Has extends true ? never : undefined)>): optionalWith; } /** * @category PropertySignature * @since 0.69.0 */ export declare const optional: (self: S) => optional; /** * @category PropertySignature * @since 0.69.0 */ export declare const optionalWith: { /** * @category PropertySignature * @since 0.69.0 */ >>(options: Options): (self: S) => optionalWith; /** * @category PropertySignature * @since 0.69.0 */ >>(self: S, options: Options): optionalWith; }; /** * @since 0.67.0 */ export declare namespace Struct { /** * @since 0.67.0 */ type Fields = { readonly [x: PropertyKey]: Schema.All | PropertySignature.All; }; type Key = [K] extends [never] ? never : F[K] extends PropertySignature.All ? [Key] extends [never] ? K : Key : K; type EncodedTokenKeys = { [K in keyof Fields]: Fields[K] extends PropertySignature | PropertySignature | PropertySignature | PropertySignature ? K : never; }[keyof Fields]; type TypeTokenKeys = { [K in keyof Fields]: Fields[K] extends OptionalPropertySignature ? K : never; }[keyof Fields]; type OptionalPropertySignature = PropertySignature<"?:", any, PropertyKey, PropertySignature.Token, any, boolean, unknown> | PropertySignature<"?:", any, PropertyKey, PropertySignature.Token, never, boolean, unknown> | PropertySignature<"?:", never, PropertyKey, PropertySignature.Token, any, boolean, unknown> | PropertySignature<"?:", never, PropertyKey, PropertySignature.Token, never, boolean, unknown>; /** * @since 0.67.0 */ type Type = Types.UnionToIntersection<{ [K in keyof F]: F[K] extends OptionalPropertySignature ? { readonly [H in K]?: Schema.Type; } : { readonly [h in K]: Schema.Type; }; }[keyof F]> extends infer Q ? Q : never; /** * @since 0.67.0 */ type Encoded = { readonly [K in Exclude> as Key]: Schema.Encoded; } & { readonly [K in EncodedTokenKeys as Key]?: Schema.Encoded; }; /** * @since 0.67.0 */ type Context = Schema.Context; type PropertySignatureWithDefault = PropertySignature | PropertySignature | PropertySignature | PropertySignature; /** * @since 0.67.0 */ type Constructor = Types.UnionToIntersection<{ [K in keyof F]: F[K] extends OptionalPropertySignature ? { readonly [H in K]?: Schema.Type; } : F[K] extends PropertySignatureWithDefault ? { readonly [H in K]?: Schema.Type; } : { readonly [h in K]: Schema.Type; }; }[keyof F]> extends infer Q ? Q : never; } /** * @since 0.67.0 */ export declare namespace IndexSignature { /** * @since 0.67.0 */ type Record = { readonly key: Schema.All; readonly value: Schema.All; }; /** * @since 0.67.0 */ type Records = ReadonlyArray; /** * @since 0.67.0 */ type NonEmptyRecords = array_.NonEmptyReadonlyArray; /** * @since 0.67.0 */ type Type = Types.UnionToIntersection<{ [K in keyof Records]: { readonly [P in Schema.Type]: Schema.Type; }; }[number]>; /** * @since 0.67.0 */ type Encoded = Types.UnionToIntersection<{ [K in keyof Records]: { readonly [P in Schema.Encoded]: Schema.Encoded; }; }[number]>; /** * @since 0.67.0 */ type Context = { [K in keyof Records]: Schema.Context | Schema.Context; }[number]; } /** * @since 0.67.0 */ export declare namespace TypeLiteral { /** * @since 0.67.0 */ type Type = Struct.Type & IndexSignature.Type; /** * @since 0.67.0 */ type Encoded = Struct.Encoded & IndexSignature.Encoded; /** * @since 0.67.0 */ type Constructor = Struct.Constructor & IndexSignature.Type; } /** * @category api interface * @since 0.67.0 */ export interface TypeLiteral extends AnnotableClass, Simplify>, Simplify>, Struct.Context | IndexSignature.Context> { readonly fields: { readonly [K in keyof Fields]: Fields[K]; }; readonly records: Readonly; annotations(annotations: Annotations.Schema>>): TypeLiteral; make(props: Simplify>, options?: MakeOptions): Simplify>; } /** * @category api interface * @since 0.67.0 */ export interface Struct extends TypeLiteral { annotations(annotations: Annotations.Schema>>): Struct; /** @since 0.68.17 */ pick>(...keys: Keys): Struct>>; /** @since 0.68.17 */ omit>(...keys: Keys): Struct>>; } /** * @category constructors * @since 0.67.0 */ export declare function Struct(fields: Fields, ...records: Records): TypeLiteral; export declare function Struct(fields: Fields): Struct; /** * @category api interface * @since 0.67.14 */ export interface tag extends PropertySignature<":", Tag, never, ":", Tag, true, never> { } /** * Returns a property signature that represents a tag. * A tag is a literal value that is used to distinguish between different types of objects. * The tag is optional when using the `make` method. * * @see {@link TaggedStruct} * * @example * import { Schema } from "@effect/schema" * * const User = Schema.Struct({ * _tag: Schema.tag("User"), * name: Schema.String, * age: Schema.Number * }) * * assert.deepStrictEqual(User.make({ name: "John", age: 44 }), { _tag: "User", name: "John", age: 44 }) * * @since 0.67.14 */ export declare const tag: (tag: Tag) => tag; /** * @category api interface * @since 0.67.14 */ export type TaggedStruct = Struct<{ _tag: tag; } & Fields>; /** * A tagged struct is a struct that has a tag property that is used to distinguish between different types of objects. * * The tag is optional when using the `make` method. * * @example * import { Schema } from "@effect/schema" * * const User = Schema.TaggedStruct("User", { * name: Schema.String, * age: Schema.Number * }) * * assert.deepStrictEqual(User.make({ name: "John", age: 44 }), { _tag: "User", name: "John", age: 44 }) * * @category constructors * @since 0.67.14 */ export declare const TaggedStruct: (value: Tag, fields: Fields) => TaggedStruct; /** * @category api interface * @since 0.67.0 */ export interface Record$ extends TypeLiteral<{}, [{ key: K; value: V; }]> { readonly key: K; readonly value: V; annotations(annotations: Annotations.Schema>>): Record$; } /** * @category constructors * @since 0.67.0 */ export declare const Record: (options: { readonly key: K; readonly value: V; }) => Record$; /** * @category struct transformations * @since 0.67.0 */ export declare const pick: >(...keys: Keys) => (self: Schema) => SchemaClass>, Simplify>, R>; /** * @category struct transformations * @since 0.67.0 */ export declare const omit: >(...keys: Keys) => (self: Schema) => SchemaClass>, Simplify>, R>; /** * Given a schema `Schema` and a key `key: K`, this function extracts a specific field from the `A` type, * producing a new schema that represents a transformation from the `{ readonly [key]: I[K] }` type to `A[K]`. * * @example * import * as S from "@effect/schema/Schema" * * // --------------------------------------------- * // use case: pull out a single field from a * // struct through a transformation * // --------------------------------------------- * * const mytable = S.Struct({ * column1: S.NumberFromString, * column2: S.Number * }) * * // const pullOutColumn: S.Schema * const pullOutColumn = mytable.pipe(S.pluck("column1")) * * console.log(S.decodeUnknownEither(S.Array(pullOutColumn))([{ column1: "1", column2: 100 }, { column1: "2", column2: 300 }])) * // Output: { _id: 'Either', _tag: 'Right', right: [ 1, 2 ] } * * @category struct transformations * @since 0.67.0 */ export declare const pluck: { /** * Given a schema `Schema` and a key `key: K`, this function extracts a specific field from the `A` type, * producing a new schema that represents a transformation from the `{ readonly [key]: I[K] }` type to `A[K]`. * * @example * import * as S from "@effect/schema/Schema" * * // --------------------------------------------- * // use case: pull out a single field from a * // struct through a transformation * // --------------------------------------------- * * const mytable = S.Struct({ * column1: S.NumberFromString, * column2: S.Number * }) * * // const pullOutColumn: S.Schema * const pullOutColumn = mytable.pipe(S.pluck("column1")) * * console.log(S.decodeUnknownEither(S.Array(pullOutColumn))([{ column1: "1", column2: 100 }, { column1: "2", column2: 300 }])) * // Output: { _id: 'Either', _tag: 'Right', right: [ 1, 2 ] } * * @category struct transformations * @since 0.67.0 */ (key: K): (schema: Schema) => Schema; /** * Given a schema `Schema` and a key `key: K`, this function extracts a specific field from the `A` type, * producing a new schema that represents a transformation from the `{ readonly [key]: I[K] }` type to `A[K]`. * * @example * import * as S from "@effect/schema/Schema" * * // --------------------------------------------- * // use case: pull out a single field from a * // struct through a transformation * // --------------------------------------------- * * const mytable = S.Struct({ * column1: S.NumberFromString, * column2: S.Number * }) * * // const pullOutColumn: S.Schema * const pullOutColumn = mytable.pipe(S.pluck("column1")) * * console.log(S.decodeUnknownEither(S.Array(pullOutColumn))([{ column1: "1", column2: 100 }, { column1: "2", column2: 300 }])) * // Output: { _id: 'Either', _tag: 'Right', right: [ 1, 2 ] } * * @category struct transformations * @since 0.67.0 */ (schema: Schema, key: K): Schema; }; /** * @category branding * @since 0.67.0 */ export interface BrandSchema, I = A, R = never> extends AnnotableClass, A, I, R> { make(a: Brand.Unbranded, options?: MakeOptions): A; } /** * @category api interface * @since 0.67.0 */ export interface brand extends BrandSchema & Brand, Schema.Encoded, Schema.Context> { annotations(annotations: Annotations.Schema & Brand>): brand; } /** * 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.Type // number & Brand<"Int"> * * @category branding * @since 0.67.0 */ export declare const brand: (brand: B, annotations?: Annotations.Schema & Brand>) => (self: S) => brand; /** * @category combinators * @since 0.69.0 */ export declare const partial: (self: Schema) => SchemaClass<{ [K in keyof A]?: A[K] | undefined; }, { [K in keyof I]?: I[K] | undefined; }, R>; /** * @category combinators * @since 0.69.0 */ export declare const partialWith: { /** * @category combinators * @since 0.69.0 */ (options: Options): (self: Schema) => SchemaClass<{ [K in keyof A]?: A[K]; }, { [K in keyof I]?: I[K]; }, R>; /** * @category combinators * @since 0.69.0 */ (self: Schema, options: Options): SchemaClass<{ [K in keyof A]?: A[K]; }, { [K in keyof I]?: I[K]; }, R>; }; /** * @category combinators * @since 0.67.0 */ export declare const required: (self: Schema) => SchemaClass<{ [K in keyof A]-?: A[K]; }, { [K in keyof I]-?: I[K]; }, R>; /** * @category api interface * @since 0.67.0 */ export interface mutable extends AnnotableClass, SimplifyMutable>, SimplifyMutable>, Schema.Context> { } /** * Creates a new schema with shallow mutability applied to its properties. * * @param schema - The original schema to make properties mutable (shallowly). * * @category combinators * @since 0.67.0 */ export declare const mutable: (schema: S) => mutable; /** * @category api interface * @since 0.67.0 */ export interface extend extends AnnotableClass, Schema.Type & Schema.Type, Schema.Encoded & Schema.Encoded, Schema.Context | Schema.Context> { } /** * Extends a schema with another schema. * * Not all extensions are supported, and their support depends on the nature of the involved schemas. * * Possible extensions include: * - `Schema.String` with another `Schema.String` refinement or a string literal * - `Schema.Number` with another `Schema.Number` refinement or a number literal * - `Schema.Boolean` with another `Schema.Boolean` refinement or a boolean literal * - A struct with another struct where overlapping fields support extension * - A struct with in index signature * - A struct with a union of supported schemas * - A refinement of a struct with a supported schema * - A suspend of a struct with a supported schema * * @example * import * as Schema from "@effect/schema/Schema" * * const schema = Schema.Struct({ * a: Schema.String, * b: Schema.String * }) * * // const extended: Schema.Schema< * // { * // readonly a: string * // readonly b: string * // } & { * // readonly c: string * // } & { * // readonly [x: string]: string * // } * // > * const extended = Schema.asSchema(schema.pipe( * Schema.extend(Schema.Struct({ c: Schema.String })), // <= you can add more fields * Schema.extend(Schema.Record({ key: Schema.String, value: Schema.String })) // <= you can add index signatures * )) * * @category combinators * @since 0.67.0 */ export declare const extend: { /** * Extends a schema with another schema. * * Not all extensions are supported, and their support depends on the nature of the involved schemas. * * Possible extensions include: * - `Schema.String` with another `Schema.String` refinement or a string literal * - `Schema.Number` with another `Schema.Number` refinement or a number literal * - `Schema.Boolean` with another `Schema.Boolean` refinement or a boolean literal * - A struct with another struct where overlapping fields support extension * - A struct with in index signature * - A struct with a union of supported schemas * - A refinement of a struct with a supported schema * - A suspend of a struct with a supported schema * * @example * import * as Schema from "@effect/schema/Schema" * * const schema = Schema.Struct({ * a: Schema.String, * b: Schema.String * }) * * // const extended: Schema.Schema< * // { * // readonly a: string * // readonly b: string * // } & { * // readonly c: string * // } & { * // readonly [x: string]: string * // } * // > * const extended = Schema.asSchema(schema.pipe( * Schema.extend(Schema.Struct({ c: Schema.String })), // <= you can add more fields * Schema.extend(Schema.Record({ key: Schema.String, value: Schema.String })) // <= you can add index signatures * )) * * @category combinators * @since 0.67.0 */ (that: That): (self: Self) => extend; /** * Extends a schema with another schema. * * Not all extensions are supported, and their support depends on the nature of the involved schemas. * * Possible extensions include: * - `Schema.String` with another `Schema.String` refinement or a string literal * - `Schema.Number` with another `Schema.Number` refinement or a number literal * - `Schema.Boolean` with another `Schema.Boolean` refinement or a boolean literal * - A struct with another struct where overlapping fields support extension * - A struct with in index signature * - A struct with a union of supported schemas * - A refinement of a struct with a supported schema * - A suspend of a struct with a supported schema * * @example * import * as Schema from "@effect/schema/Schema" * * const schema = Schema.Struct({ * a: Schema.String, * b: Schema.String * }) * * // const extended: Schema.Schema< * // { * // readonly a: string * // readonly b: string * // } & { * // readonly c: string * // } & { * // readonly [x: string]: string * // } * // > * const extended = Schema.asSchema(schema.pipe( * Schema.extend(Schema.Struct({ c: Schema.String })), // <= you can add more fields * Schema.extend(Schema.Record({ key: Schema.String, value: Schema.String })) // <= you can add index signatures * )) * * @category combinators * @since 0.67.0 */ (self: Self, that: That): extend; }; /** * @category combinators * @since 0.67.0 */ export declare const compose: { /** * @category combinators * @since 0.67.0 */ (to: Schema): (from: Schema) => SchemaClass; /** * @category combinators * @since 0.67.0 */ (to: Schema): (from: Schema) => SchemaClass; /** * @category combinators * @since 0.67.0 */ (to: Schema, options?: { readonly strict: true; }): (from: Schema) => SchemaClass; /** * @category combinators * @since 0.67.0 */ (to: Schema, options: { readonly strict: false; }): (from: Schema) => SchemaClass; /** * @category combinators * @since 0.67.0 */ (from: Schema, to: Schema): SchemaClass; /** * @category combinators * @since 0.67.0 */ (from: Schema, to: Schema): SchemaClass; /** * @category combinators * @since 0.67.0 */ (from: Schema, to: Schema, options?: { readonly strict: true; }): SchemaClass; /** * @category combinators * @since 0.67.0 */ (from: Schema, to: Schema, options: { readonly strict: false; }): SchemaClass; }; /** * @category api interface * @since 0.67.0 */ export interface suspend extends AnnotableClass, A, I, R> { } /** * @category constructors * @since 0.67.0 */ export declare const suspend: (f: () => Schema) => suspend; /** * @since 0.68.8 * @category symbol */ export declare const refineTypeId: unique symbol; /** * @since 0.68.8 * @category symbol */ export type refineTypeId = typeof refineTypeId; /** * @category api interface * @since 0.67.0 */ export interface refine extends AnnotableClass, A, Schema.Encoded, Schema.Context> { readonly [refineTypeId]: From; readonly from: From; readonly filter: (a: Schema.Type, options: ParseOptions, self: AST.Refinement) => option_.Option; make(a: Schema.Type, options?: MakeOptions): A; } /** * @category api interface * @since 0.67.0 */ export interface filter extends refine, From> { } /** * @category filtering * @since 0.68.0 */ export interface FilterIssue { readonly path: ReadonlyArray; readonly message: string; } /** * @category filtering * @since 0.68.0 */ export type FilterOutput = undefined | boolean | string | ParseResult.ParseIssue | FilterIssue; type FilterReturnType = FilterOutput | ReadonlyArray; /** * @category filtering * @since 0.67.0 */ export declare function filter(refinement: (a: A, options: ParseOptions, self: AST.Refinement) => a is B, annotations?: Annotations.Filter): (self: Schema) => refine>; export declare function filter(refinement: (a: A, options: ParseOptions, self: AST.Refinement) => a is B, annotations?: Annotations.Filter): (self: Schema) => refine>; export declare function filter(predicate: (a: Types.NoInfer>, options: ParseOptions, self: AST.Refinement) => FilterReturnType, annotations?: Annotations.Filter>>): (self: S) => filter; /** * @category api interface * @since 0.68.17 */ export interface filterEffect extends transformOrFail>, FD> { } /** * @category transformations * @since 0.68.17 */ export declare const filterEffect: { /** * @category transformations * @since 0.68.17 */ (f: (a: Types.NoInfer>, options: ParseOptions, self: AST.Transformation) => Effect.Effect): (self: S) => filterEffect; /** * @category transformations * @since 0.68.17 */ (self: S, f: (a: Types.NoInfer>, options: ParseOptions, self: AST.Transformation) => Effect.Effect): filterEffect; }; /** * @category api interface * @since 0.67.0 */ export interface transformOrFail extends AnnotableClass, Schema.Type, Schema.Encoded, Schema.Context | Schema.Context | R> { readonly from: From; readonly to: To; } /** * Create a new `Schema` by transforming the input and output of an existing `Schema` * using the provided decoding functions. * * @category transformations * @since 0.67.0 */ export declare const transformOrFail: { /** * Create a new `Schema` by transforming the input and output of an existing `Schema` * using the provided decoding functions. * * @category transformations * @since 0.67.0 */ (to: To, options: { readonly decode: (fromA: Schema.Type, options: ParseOptions, ast: AST.Transformation, fromI: Schema.Encoded) => Effect.Effect, ParseResult.ParseIssue, RD>; readonly encode: (toI: Schema.Encoded, options: ParseOptions, ast: AST.Transformation, toA: Schema.Type) => Effect.Effect, ParseResult.ParseIssue, RE>; readonly strict?: true; } | { readonly decode: (fromA: Schema.Type, options: ParseOptions, ast: AST.Transformation, fromI: Schema.Encoded) => Effect.Effect; readonly encode: (toI: Schema.Encoded, options: ParseOptions, ast: AST.Transformation, toA: Schema.Type) => Effect.Effect; readonly strict: false; }): (from: From) => transformOrFail; /** * Create a new `Schema` by transforming the input and output of an existing `Schema` * using the provided decoding functions. * * @category transformations * @since 0.67.0 */ (from: From, to: To, options: { readonly decode: (fromA: Schema.Type, options: ParseOptions, ast: AST.Transformation, fromI: Schema.Encoded) => Effect.Effect, ParseResult.ParseIssue, RD>; readonly encode: (toI: Schema.Encoded, options: ParseOptions, ast: AST.Transformation, toA: Schema.Type) => Effect.Effect, ParseResult.ParseIssue, RE>; readonly strict?: true; } | { readonly decode: (fromA: Schema.Type, options: ParseOptions, ast: AST.Transformation, fromI: Schema.Encoded) => Effect.Effect; readonly encode: (toI: Schema.Encoded, options: ParseOptions, ast: AST.Transformation, toA: Schema.Type) => Effect.Effect; readonly strict: false; }): transformOrFail; }; /** * @category api interface * @since 0.67.0 */ export interface transform extends transformOrFail { annotations(annotations: Annotations.Schema>): transform; } /** * Create a new `Schema` by transforming the input and output of an existing `Schema` * using the provided mapping functions. * * @category transformations * @since 0.67.0 */ export declare const transform: { /** * Create a new `Schema` by transforming the input and output of an existing `Schema` * using the provided mapping functions. * * @category transformations * @since 0.67.0 */ (to: To, options: { readonly decode: (fromA: Schema.Type, fromI: Schema.Encoded) => Schema.Encoded; readonly encode: (toI: Schema.Encoded, toA: Schema.Type) => Schema.Type; readonly strict?: true; } | { readonly decode: (fromA: Schema.Type, fromI: Schema.Encoded) => unknown; readonly encode: (toI: Schema.Encoded, toA: Schema.Type) => unknown; readonly strict: false; }): (from: From) => transform; /** * Create a new `Schema` by transforming the input and output of an existing `Schema` * using the provided mapping functions. * * @category transformations * @since 0.67.0 */ (from: From, to: To, options: { readonly decode: (fromA: Schema.Type, fromI: Schema.Encoded) => Schema.Encoded; readonly encode: (toI: Schema.Encoded, toA: Schema.Type) => Schema.Type; readonly strict?: true; } | { readonly decode: (fromA: Schema.Type, fromI: Schema.Encoded) => unknown; readonly encode: (toI: Schema.Encoded, toA: Schema.Type) => unknown; readonly strict: false; }): transform; }; /** * @category api interface * @since 0.67.0 */ export interface transformLiteral extends Annotable, Type, Encoded> { } /** * 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 0.67.0 */ export declare const transformLiteral: (from: Encoded, to: Type) => transformLiteral; /** * 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 0.67.0 */ export declare function transformLiterals>(...pairs: A): Union<{ -readonly [I in keyof A]: transformLiteral; }>; export declare function transformLiterals(pairs: [Encoded, Type]): transformLiteral; export declare function 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 0.67.0 */ export declare const attachPropertySignature: { /** * 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 0.67.0 */ (key: K, value: V, annotations?: Annotations.Schema>): (schema: SchemaClass) => SchemaClass, I, R>; /** * 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 0.67.0 */ (schema: Schema, key: K, value: V, annotations?: Annotations.Schema>): SchemaClass, I, R>; }; /** * @category annotations * @since 0.67.0 */ export declare namespace Annotations { /** * @category annotations * @since 0.67.0 */ interface Doc extends AST.Annotations { readonly title?: AST.TitleAnnotation; readonly description?: AST.DescriptionAnnotation; readonly documentation?: AST.DocumentationAnnotation; readonly examples?: AST.ExamplesAnnotation; readonly default?: AST.DefaultAnnotation; } /** * @since 0.67.0 */ interface Schema = readonly []> extends Doc { readonly identifier?: AST.IdentifierAnnotation; readonly message?: AST.MessageAnnotation; readonly typeId?: AST.TypeAnnotation | { id: AST.TypeAnnotation; annotation: unknown; }; readonly jsonSchema?: AST.JSONSchemaAnnotation; readonly arbitrary?: (...arbitraries: [ ...{ readonly [K in keyof TypeParameters]: LazyArbitrary; }, ctx: GenerationContext ]) => LazyArbitrary; readonly pretty?: (...pretties: { readonly [K in keyof TypeParameters]: pretty_.Pretty; }) => pretty_.Pretty; readonly equivalence?: (...equivalences: { readonly [K in keyof TypeParameters]: Equivalence.Equivalence; }) => Equivalence.Equivalence; readonly concurrency?: AST.ConcurrencyAnnotation; readonly batching?: AST.BatchingAnnotation; readonly parseIssueTitle?: AST.ParseIssueTitleAnnotation; readonly parseOptions?: AST.ParseOptions; readonly decodingFallback?: AST.DecodingFallbackAnnotation; } /** * @since 0.67.0 */ interface Filter extends Schema { } } /** * Merges a set of new annotations with existing ones, potentially overwriting * any duplicates. * * @category annotations * @since 0.67.0 */ export declare const annotations: { /** * Merges a set of new annotations with existing ones, potentially overwriting * any duplicates. * * @category annotations * @since 0.67.0 */ (annotations: Annotations.Schema>): (self: S) => Annotable.Self; /** * Merges a set of new annotations with existing ones, potentially overwriting * any duplicates. * * @category annotations * @since 0.67.0 */ (self: S, annotations: Annotations.Schema>): Annotable.Self; }; type Rename = { [K in keyof A as K extends keyof M ? M[K] extends PropertyKey ? M[K] : never : K]: A[K]; }; /** * @category renaming * @since 0.67.0 */ export declare const rename: { /** * @category renaming * @since 0.67.0 */ ]: never; }>(mapping: M): (self: Schema) => SchemaClass>, I, R>; /** * @category renaming * @since 0.67.0 */ ]: never; }>(self: Schema, mapping: M): SchemaClass>, I, R>; }; /** * @category type id * @since 0.67.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 0.67.0 */ export declare const trimmed: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const MaxLengthTypeId: unique symbol; /** * @category type id * @since 0.67.0 */ export type MaxLengthTypeId = typeof MaxLengthTypeId; /** * @category string filters * @since 0.67.0 */ export declare const maxLength: (maxLength: number, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const MinLengthTypeId: unique symbol; /** * @category type id * @since 0.67.0 */ export type MinLengthTypeId = typeof MinLengthTypeId; /** * @category string filters * @since 0.67.0 */ export declare const minLength: (minLength: number, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const PatternTypeId: unique symbol; /** * @category string filters * @since 0.67.0 */ export declare const pattern: (regex: RegExp, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const StartsWithTypeId: unique symbol; /** * @category string filters * @since 0.67.0 */ export declare const startsWith: (startsWith: string, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const EndsWithTypeId: unique symbol; /** * @category string filters * @since 0.67.0 */ export declare const endsWith: (endsWith: string, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const IncludesTypeId: unique symbol; /** * @category string filters * @since 0.67.0 */ export declare const includes: (searchString: string, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const LowercasedTypeId: unique symbol; /** * Verifies that a string is lowercased. * * @category string filters * @since 0.67.0 */ export declare const lowercased: (annotations?: Annotations.Filter) => (self: Schema) => filter>; declare const Lowercased_base: filter>; /** * @category string constructors * @since 0.67.0 */ export declare class Lowercased extends Lowercased_base { } /** * @category type id * @since 0.68.18 */ export declare const CapitalizedTypeId: unique symbol; /** * Verifies that a string is capitalized. * * @category string filters * @since 0.68.18 */ export declare const capitalized: (annotations?: Annotations.Filter) => (self: Schema) => filter>; declare const Capitalized_base: filter>; /** * @category string constructors * @since 0.68.18 */ export declare class Capitalized extends Capitalized_base { } /** * @category type id * @since 0.68.18 */ export declare const UncapitalizedTypeId: unique symbol; /** * Verifies that a string is uncapitalized. * * @category string filters * @since 0.68.18 */ export declare const uncapitalized: (annotations?: Annotations.Filter) => (self: Schema) => filter>; declare const Uncapitalized_base: filter>; /** * @category string constructors * @since 0.68.18 */ export declare class Uncapitalized extends Uncapitalized_base { } /** * @category type id * @since 0.67.0 */ export declare const UppercasedTypeId: unique symbol; /** * Verifies that a string is uppercased. * * @category string filters * @since 0.67.0 */ export declare const uppercased: (annotations?: Annotations.Filter) => (self: Schema) => filter>; declare const Uppercased_base: filter>; /** * @category string constructors * @since 0.67.0 */ export declare class Uppercased extends Uppercased_base { } /** * @category type id * @since 0.67.0 */ export declare const LengthTypeId: unique symbol; /** * @category type id * @since 0.67.0 */ export type LengthTypeId = typeof LengthTypeId; /** * @category string filters * @since 0.67.0 */ export declare const length: (length: number | { readonly min: number; readonly max: number; }, annotations?: Annotations.Filter) => (self: Schema) => filter>; declare const Char_base: filter>; /** * A schema representing a single character. * * @category string constructors * @since 0.67.0 */ export declare class Char extends Char_base { } /** * @category string filters * @since 0.69.0 */ export declare const nonEmptyString: (annotations?: Annotations.Filter) => (self: Schema) => filter>; declare const Lowercase_base: transform, typeof Lowercased>; /** * This schema converts a string to lowercase. * * @category string transformations * @since 0.67.0 */ export declare class Lowercase extends Lowercase_base { } declare const Uppercase_base: transform, typeof Uppercased>; /** * This schema converts a string to uppercase. * * @category string transformations * @since 0.67.0 */ export declare class Uppercase extends Uppercase_base { } declare const Capitalize_base: transform, typeof Capitalized>; /** * This schema converts a string to capitalized one. * * @category string transformations * @since 0.68.18 */ export declare class Capitalize extends Capitalize_base { } declare const Uncapitalize_base: transform, typeof Uncapitalized>; /** * This schema converts a string to uncapitalized one. * * @category string transformations * @since 0.68.18 */ export declare class Uncapitalize extends Uncapitalize_base { } declare const Trimmed_base: filter>; /** * @category string constructors * @since 0.67.0 */ export declare class Trimmed extends Trimmed_base { } declare const NonEmptyTrimmedString_base: filter>; /** * Useful for validating strings that must contain meaningful characters without * leading or trailing whitespace. * * @example * import { Schema } from "@effect/schema" * * console.log(Schema.decodeOption(Schema.NonEmptyTrimmedString)("")) // Option.none() * console.log(Schema.decodeOption(Schema.NonEmptyTrimmedString)(" a ")) // Option.none() * console.log(Schema.decodeOption(Schema.NonEmptyTrimmedString)("a")) // Option.some("a") * * @category string constructors * @since 0.69.3 */ export declare class NonEmptyTrimmedString extends NonEmptyTrimmedString_base { } declare const Trim_base: transform, typeof Trimmed>; /** * This schema allows removing whitespaces from the beginning and end of a string. * * @category string transformations * @since 0.67.0 */ export declare class Trim extends Trim_base { } /** * Returns a schema that allows splitting a string into an array of strings. * * @category string transformations * @since 0.67.0 */ export declare const split: (separator: string) => transform>; /** * @since 0.67.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 0.67.0 */ export declare const parseJson: { /** * 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 0.67.0 */ (schema: Schema, options?: ParseJsonOptions): SchemaClass; /** * 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 0.67.0 */ (options?: ParseJsonOptions): SchemaClass; }; declare const NonEmptyString_base: filter>; /** * @category string constructors * @since 0.69.0 */ export declare class NonEmptyString extends NonEmptyString_base { } /** * @category type id * @since 0.67.0 */ export declare const UUIDTypeId: unique symbol; declare const UUID_base: filter>; /** * Represents a Universally Unique Identifier (UUID). * * This schema ensures that the provided string adheres to the standard UUID format. * * @category string constructors * @since 0.67.0 */ export declare class UUID extends UUID_base { } /** * @category type id * @since 0.67.0 */ export declare const ULIDTypeId: unique symbol; declare const ULID_base: filter>; /** * 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 0.67.0 */ export declare class ULID extends ULID_base { } /** * @category type id * @since 0.67.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 0.67.0 */ export declare const finite: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const GreaterThanTypeId: unique symbol; /** * @category type id * @since 0.67.0 */ export type GreaterThanTypeId = typeof GreaterThanTypeId; /** * This filter checks whether the provided number is greater than the specified minimum. * * @category number filters * @since 0.67.0 */ export declare const greaterThan: (min: number, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const GreaterThanOrEqualToTypeId: unique symbol; /** * @category type id * @since 0.67.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 0.67.0 */ export declare const greaterThanOrEqualTo: (min: number, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const MultipleOfTypeId: unique symbol; /** * @category number filters * @since 0.67.0 */ export declare const multipleOf: (divisor: number, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const IntTypeId: unique symbol; /** * @category type id * @since 0.67.0 */ export type IntTypeId = typeof IntTypeId; /** * @category number filters * @since 0.67.0 */ export declare const int: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const LessThanTypeId: unique symbol; /** * @category type id * @since 0.67.0 */ export type LessThanTypeId = typeof LessThanTypeId; /** * This filter checks whether the provided number is less than the specified maximum. * * @category number filters * @since 0.67.0 */ export declare const lessThan: (max: number, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const LessThanOrEqualToTypeId: unique symbol; /** * @category type id * @since 0.67.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 0.67.0 */ export declare const lessThanOrEqualTo: (max: number, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const BetweenTypeId: unique symbol; /** * @category type id * @since 0.67.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 0.67.0 */ export declare const between: (min: number, max: number, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const NonNaNTypeId: unique symbol; /** * @category number filters * @since 0.67.0 */ export declare const nonNaN: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category number filters * @since 0.67.0 */ export declare const positive: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category number filters * @since 0.67.0 */ export declare const negative: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category number filters * @since 0.67.0 */ export declare const nonPositive: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category number filters * @since 0.67.0 */ export declare const nonNegative: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * Clamps a number between a minimum and a maximum value. * * @category number transformations * @since 0.67.0 */ export declare const clamp: (minimum: number, maximum: number) => (self: Schema) => transform, filter>>; /** * Transforms a `string` into a `number` by parsing the string using the `parse` function of the `effect/Number` module. * * 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 transformations * @since 0.67.0 */ export declare const parseNumber: (self: Schema) => transformOrFail, typeof Number$>; declare const NumberFromString_base: transformOrFail, typeof Number$, never>; /** * This schema transforms a `string` into a `number` by parsing the string using the `parse` function of the `effect/Number` module. * * 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 0.67.0 */ export declare class NumberFromString extends NumberFromString_base { } declare const Finite_base: filter>; /** * @category number constructors * @since 0.67.0 */ export declare class Finite extends Finite_base { } declare const Int_base: filter>; /** * @category number constructors * @since 0.67.0 */ export declare class Int extends Int_base { } declare const NonNaN_base: filter>; /** * @category number constructors * @since 0.67.0 */ export declare class NonNaN extends NonNaN_base { } declare const Positive_base: filter>; /** * @category number constructors * @since 0.67.0 */ export declare class Positive extends Positive_base { } declare const Negative_base: filter>; /** * @category number constructors * @since 0.67.0 */ export declare class Negative extends Negative_base { } declare const NonPositive_base: filter>; /** * @category number constructors * @since 0.67.0 */ export declare class NonPositive extends NonPositive_base { } declare const NonNegative_base: filter>; /** * @category number constructors * @since 0.67.0 */ export declare class NonNegative extends NonNegative_base { } /** * @category type id * @since 0.67.0 */ export declare const JsonNumberTypeId: unique symbol; declare const JsonNumber_base: filter; /** * 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 0.67.0 */ export declare class JsonNumber extends JsonNumber_base { } declare const Not_base: transform, typeof Boolean$>; /** * @category boolean transformations * @since 0.67.0 */ export declare class Not extends Not_base { } declare const Symbol$_base: transform, typeof SymbolFromSelf>; /** @ignore */ declare class Symbol$ extends Symbol$_base { } export { /** * This schema transforms a `string` into a `symbol`. * * @category symbol transformations * @since 0.67.0 */ Symbol$ as Symbol }; /** * @category type id * @since 0.67.0 */ export declare const GreaterThanBigIntTypeId: unique symbol; /** * @category type id * @since 0.67.0 */ export type GreaterThanBigIntTypeId = typeof GreaterThanBigIntTypeId; /** * @category bigint filters * @since 0.67.0 */ export declare const greaterThanBigInt: (min: bigint, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const GreaterThanOrEqualToBigIntTypeId: unique symbol; /** * @category type id * @since 0.67.0 */ export type GreaterThanOrEqualToBigIntTypeId = typeof GreaterThanOrEqualToBigIntTypeId; /** * @category bigint filters * @since 0.67.0 */ export declare const greaterThanOrEqualToBigInt: (min: bigint, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const LessThanBigIntTypeId: unique symbol; /** * @category type id * @since 0.67.0 */ export type LessThanBigIntTypeId = typeof LessThanBigIntTypeId; /** * @category bigint filters * @since 0.67.0 */ export declare const lessThanBigInt: (max: bigint, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const LessThanOrEqualToBigIntTypeId: unique symbol; /** * @category type id * @since 0.67.0 */ export type LessThanOrEqualToBigIntTypeId = typeof LessThanOrEqualToBigIntTypeId; /** * @category bigint filters * @since 0.67.0 */ export declare const lessThanOrEqualToBigInt: (max: bigint, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const BetweenBigIntTypeId: unique symbol; /** * @category type id * @since 0.67.0 */ export type BetweenBigIntTypeId = typeof BetweenBigIntTypeId; /** * @category bigint filters * @since 0.67.0 */ export declare const betweenBigInt: (min: bigint, max: bigint, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category bigint filters * @since 0.67.0 */ export declare const positiveBigInt: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category bigint filters * @since 0.67.0 */ export declare const negativeBigInt: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category bigint filters * @since 0.67.0 */ export declare const nonNegativeBigInt: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category bigint filters * @since 0.67.0 */ export declare const nonPositiveBigInt: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * Clamps a bigint between a minimum and a maximum value. * * @category bigint transformations * @since 0.67.0 */ export declare const clampBigInt: (minimum: bigint, maximum: bigint) => (self: Schema) => transform, filter>>; declare const BigInt$_base: transformOrFail, typeof BigIntFromSelf, never>; /** @ignore */ declare class BigInt$ extends BigInt$_base { } export { /** * 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 0.67.0 */ BigInt$ as BigInt }; /** * @category bigint constructors * @since 0.67.0 */ export declare const PositiveBigIntFromSelf: filter>; /** * @category bigint constructors * @since 0.67.0 */ export declare const PositiveBigInt: filter>; /** * @category bigint constructors * @since 0.67.0 */ export declare const NegativeBigIntFromSelf: filter>; /** * @category bigint constructors * @since 0.67.0 */ export declare const NegativeBigInt: filter>; /** * @category bigint constructors * @since 0.67.0 */ export declare const NonPositiveBigIntFromSelf: filter>; /** * @category bigint constructors * @since 0.67.0 */ export declare const NonPositiveBigInt: filter>; /** * @category bigint constructors * @since 0.67.0 */ export declare const NonNegativeBigIntFromSelf: filter>; /** * @category bigint constructors * @since 0.67.0 */ export declare const NonNegativeBigInt: filter>; declare const BigIntFromNumber_base: transformOrFail, typeof BigIntFromSelf, never>; /** * 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 0.67.0 */ export declare class BigIntFromNumber extends BigIntFromNumber_base { } /** * @category api interface * @since 0.67.21 */ export interface RedactedFromSelf extends AnnotableClass, redacted_.Redacted>, redacted_.Redacted>, Schema.Context> { } /** * @category Redacted constructors * @since 0.67.21 */ export declare const RedactedFromSelf: (value: Value) => RedactedFromSelf; /** * @category api interface * @since 0.67.21 */ export interface Redacted extends AnnotableClass, redacted_.Redacted>, Schema.Encoded, Schema.Context> { } /** * A schema that transforms any type `A` into a `Redacted`. * * @category Redacted transformations * @since 0.67.21 */ export declare const Redacted: (value: Value) => Redacted; declare const DurationFromSelf_base: SchemaClass; /** * @category Duration constructors * @since 0.67.0 */ export declare class DurationFromSelf extends DurationFromSelf_base { } declare const DurationFromNanos_base: transformOrFail, typeof DurationFromSelf, never>; /** * A schema that transforms a `bigint` tuple into a `Duration`. * Treats the value as the number of nanoseconds. * * @category Duration transformations * @since 0.67.0 */ export declare class DurationFromNanos extends DurationFromNanos_base { } declare const DurationFromMillis_base: transform, typeof DurationFromSelf>; /** * A schema that transforms a `number` tuple into a `Duration`. * Treats the value as the number of milliseconds. * * @category Duration transformations * @since 0.67.0 */ export declare class DurationFromMillis extends DurationFromMillis_base { } declare const Duration_base: transform, typeof DurationFromSelf>; /** * A schema that transforms a `[number, number]` tuple into a `Duration`. * * @category Duration transformations * @since 0.67.0 */ export declare class Duration extends Duration_base { } /** * Clamps a `Duration` between a minimum and a maximum value. * * @category Duration transformations * @since 0.67.0 */ export declare const clampDuration: (minimum: duration_.DurationInput, maximum: duration_.DurationInput) => (self: Schema) => transform, filter>>; /** * @category type id * @since 0.67.0 */ export declare const LessThanDurationTypeId: unique symbol; /** * @category Duration filters * @since 0.67.0 */ export declare const lessThanDuration: (max: duration_.DurationInput, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const LessThanOrEqualToDurationTypeId: unique symbol; /** * @category Duration filters * @since 0.67.0 */ export declare const lessThanOrEqualToDuration: (max: duration_.DurationInput, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const GreaterThanDurationTypeId: unique symbol; /** * @category Duration filters * @since 0.67.0 */ export declare const greaterThanDuration: (min: duration_.DurationInput, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const GreaterThanOrEqualToDurationTypeId: unique symbol; /** * @category Duration filters * @since 0.67.0 */ export declare const greaterThanOrEqualToDuration: (min: duration_.DurationInput, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const BetweenDurationTypeId: unique symbol; /** * @category Duration filters * @since 0.67.0 */ export declare const betweenDuration: (minimum: duration_.DurationInput, maximum: duration_.DurationInput, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category Uint8Array constructors * @since 0.67.0 */ export declare const Uint8ArrayFromSelf: Schema; declare const Uint8Array$: Schema>; export { /** * A schema that transforms an array of numbers into a `Uint8Array`. * * @category Uint8Array transformations * @since 0.67.0 */ Uint8Array$ as Uint8Array }; /** * Decodes a base64 (RFC4648) encoded string into a `Uint8Array`. * * @category Uint8Array transformations * @since 0.67.0 */ export declare const Uint8ArrayFromBase64: Schema; /** * Decodes a base64 (URL) encoded string into a `Uint8Array`. * * @category Uint8Array transformations * @since 0.67.0 */ export declare const Uint8ArrayFromBase64Url: Schema; /** * Decodes a hex encoded string into a `Uint8Array`. * * @category Uint8Array transformations * @since 0.67.0 */ export declare const Uint8ArrayFromHex: Schema; /** * Decodes a base64 (RFC4648) encoded string into a UTF-8 string. * * @category string transformations * @since 0.67.0 */ export declare const StringFromBase64: Schema; /** * Decodes a base64 (URL) encoded string into a UTF-8 string. * * @category string transformations * @since 0.67.0 */ export declare const StringFromBase64Url: Schema; /** * Decodes a hex encoded string into a UTF-8 string. * * @category string transformations * @since 0.67.0 */ export declare const StringFromHex: Schema; /** * @category type id * @since 0.67.0 */ export declare const MinItemsTypeId: unique symbol; /** * @category type id * @since 0.67.0 */ export type MinItemsTypeId = typeof MinItemsTypeId; /** * @category ReadonlyArray filters * @since 0.67.0 */ export declare const minItems: (n: number, annotations?: Annotations.Filter>) => (self: Schema, I, R>) => filter, I, R>>; /** * @category type id * @since 0.67.0 */ export declare const MaxItemsTypeId: unique symbol; /** * @category type id * @since 0.67.0 */ export type MaxItemsTypeId = typeof MaxItemsTypeId; /** * @category ReadonlyArray filters * @since 0.67.0 */ export declare const maxItems: (n: number, annotations?: Annotations.Filter>) => (self: Schema, I, R>) => filter, I, R>>; /** * @category type id * @since 0.67.0 */ export declare const ItemsCountTypeId: unique symbol; /** * @category type id * @since 0.67.0 */ export type ItemsCountTypeId = typeof ItemsCountTypeId; /** * @category ReadonlyArray filters * @since 0.67.0 */ export declare const itemsCount: (n: number, annotations?: Annotations.Filter>) => (self: Schema, I, R>) => filter, I, R>>; /** * @category ReadonlyArray transformations * @since 0.67.0 */ export declare const getNumberIndexedAccess: , I extends ReadonlyArray, R>(self: Schema) => SchemaClass; /** * Get the first element of a `ReadonlyArray`, or `None` if the array is empty. * * @category ReadonlyArray transformations * @since 0.67.0 */ export declare const head: (self: Schema, I, R>) => SchemaClass, I, R>; /** * 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 0.67.0 */ export declare const headOrElse: { /** * 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 0.67.0 */ (fallback?: LazyArg): (self: Schema, I, R>) => SchemaClass; /** * 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 0.67.0 */ (self: Schema, I, R>, fallback?: LazyArg): SchemaClass; }; /** * @category type id * @since 0.67.0 */ export declare const ValidDateTypeId: unique symbol; /** * Defines a filter that specifically rejects invalid dates, such as `new * Date("Invalid Date")`. This filter ensures that only properly formatted and * valid date objects are accepted, enhancing data integrity by preventing * erroneous date values from being processed. * * @category Date filters * @since 0.67.0 */ export declare const validDate: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.73.1 */ export declare const LessThanDateTypeId: unique symbol; /** * @category Date filters * @since 0.73.1 */ export declare const lessThanDate: (max: Date, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.73.1 */ export declare const LessThanOrEqualToDateTypeId: unique symbol; /** * @category Date filters * @since 0.73.1 */ export declare const lessThanOrEqualToDate: (max: Date, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.73.1 */ export declare const GreaterThanDateTypeId: unique symbol; /** * @category Date filters * @since 0.73.1 */ export declare const greaterThanDate: (min: Date, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.73.1 */ export declare const GreaterThanOrEqualToDateTypeId: unique symbol; /** * @category Date filters * @since 0.73.1 */ export declare const greaterThanOrEqualToDate: (min: Date, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.73.1 */ export declare const BetweenDateTypeId: unique symbol; /** * @category Date filters * @since 0.73.1 */ export declare const betweenDate: (minimum: Date, maximum: Date, annotations?: Annotations.Filter) => (self: Schema) => filter>; declare const DateFromSelf_base: SchemaClass; /** * Describes a schema that accommodates potentially invalid `Date` instances, * such as `new Date("Invalid Date")`, without rejection. * * @category Date constructors * @since 0.67.0 */ export declare class DateFromSelf extends DateFromSelf_base { } declare const ValidDateFromSelf_base: filter>; /** * Defines a schema that ensures only valid dates are accepted. This schema * rejects values like `new Date("Invalid Date")`, which, despite being a `Date` * instance, represents an invalid date. Such stringent validation ensures that * all date objects processed through this schema are properly formed and * represent real dates. * * @category Date constructors * @since 0.67.0 */ export declare class ValidDateFromSelf extends ValidDateFromSelf_base { } declare const DateFromString_base: transform, typeof DateFromSelf>; /** * Defines a schema that attempts to convert a `string` to a `Date` object using * the `new Date` constructor. This conversion is lenient, meaning it does not * reject strings that do not form valid dates (e.g., using `new Date("Invalid * Date")` results in a `Date` object, despite being invalid). * * @category Date transformations * @since 0.67.0 */ export declare class DateFromString extends DateFromString_base { } declare const Date$_base: filter>; /** @ignore */ declare class Date$ extends Date$_base { } export { /** * This schema converts a `string` into a `Date` object using the `new Date` * constructor. It ensures that only valid date strings are accepted, * rejecting any strings that would result in an invalid date, such as `new * Date("Invalid Date")`. * * @category Date transformations * @since 0.67.0 */ Date$ as Date }; declare const DateFromNumber_base: transform, typeof DateFromSelf>; /** * Defines a schema that converts a `number` into a `Date` object using the `new * Date` constructor. This schema does not validate the numerical input, * allowing potentially invalid values such as `NaN`, `Infinity`, and * `-Infinity` to be converted into `Date` objects. During the encoding process, * any invalid `Date` object will be encoded to `NaN`. * * @category Date transformations * @since 0.67.0 */ export declare class DateFromNumber extends DateFromNumber_base { } declare const DateTimeUtcFromSelf_base: SchemaClass; /** * Describes a schema that represents a `DateTime.Utc` instance. * * @category DateTime.Utc constructors * @since 0.70.0 */ export declare class DateTimeUtcFromSelf extends DateTimeUtcFromSelf_base { } declare const DateTimeUtcFromNumber_base: transformOrFail, typeof DateTimeUtcFromSelf, never>; /** * Defines a schema that attempts to convert a `number` to a `DateTime.Utc` instance using the `DateTime.unsafeMake` constructor. * * @category DateTime.Utc transformations * @since 0.70.0 */ export declare class DateTimeUtcFromNumber extends DateTimeUtcFromNumber_base { } declare const DateTimeUtc_base: transformOrFail, typeof DateTimeUtcFromSelf, never>; /** * Defines a schema that attempts to convert a `string` to a `DateTime.Utc` instance using the `DateTime.unsafeMake` constructor. * * @category DateTime.Utc transformations * @since 0.70.0 */ export declare class DateTimeUtc extends DateTimeUtc_base { } declare const TimeZoneOffsetFromSelf_base: SchemaClass; /** * Describes a schema that represents a `TimeZone.Offset` instance. * * @category TimeZone constructors * @since 0.70.0 */ export declare class TimeZoneOffsetFromSelf extends TimeZoneOffsetFromSelf_base { } declare const TimeZoneOffset_base: transform, typeof TimeZoneOffsetFromSelf>; /** * Defines a schema that converts a `number` to a `TimeZone.Offset` instance using the `DateTime.zoneMakeOffset` constructor. * * @category TimeZone transformations * @since 0.70.0 */ export declare class TimeZoneOffset extends TimeZoneOffset_base { } declare const TimeZoneNamedFromSelf_base: SchemaClass; /** * Describes a schema that represents a `TimeZone.Named` instance. * * @category TimeZone constructors * @since 0.70.0 */ export declare class TimeZoneNamedFromSelf extends TimeZoneNamedFromSelf_base { } declare const TimeZoneNamed_base: transformOrFail, typeof TimeZoneNamedFromSelf, never>; /** * Defines a schema that attempts to convert a `string` to a `TimeZone.Named` instance using the `DateTime.zoneUnsafeMakeNamed` constructor. * * @category TimeZone transformations * @since 0.70.0 */ export declare class TimeZoneNamed extends TimeZoneNamed_base { } /** * @category api interface * @since 0.70.0 */ export interface TimeZoneFromSelf extends Union<[typeof TimeZoneOffsetFromSelf, typeof TimeZoneNamedFromSelf]> { annotations(annotations: Annotations.Schema): TimeZoneFromSelf; } /** * @category TimeZone constructors * @since 0.70.0 */ export declare const TimeZoneFromSelf: TimeZoneFromSelf; declare const TimeZone_base: transformOrFail, TimeZoneFromSelf, never>; /** * Defines a schema that attempts to convert a `string` to a `TimeZone` using the `DateTime.zoneFromString` constructor. * * @category TimeZone transformations * @since 0.70.0 */ export declare class TimeZone extends TimeZone_base { } declare const DateTimeZonedFromSelf_base: SchemaClass; /** * Describes a schema that represents a `DateTime.Zoned` instance. * * @category DateTime.Zoned constructors * @since 0.70.0 */ export declare class DateTimeZonedFromSelf extends DateTimeZonedFromSelf_base { } declare const DateTimeZoned_base: transformOrFail, typeof DateTimeZonedFromSelf, never>; /** * Defines a schema that attempts to convert a `string` to a `DateTime.Zoned` instance. * * @category DateTime.Zoned transformations * @since 0.70.0 */ export declare class DateTimeZoned extends DateTimeZoned_base { } /** * @category Option utils * @since 0.67.0 */ export type OptionEncoded = { readonly _tag: "None"; } | { readonly _tag: "Some"; readonly value: I; }; /** * @category api interface * @since 0.67.0 */ export interface OptionFromSelf extends AnnotableClass, option_.Option>, option_.Option>, Schema.Context> { } /** * @category Option transformations * @since 0.67.0 */ export declare const OptionFromSelf: (value: Value) => OptionFromSelf; /** * @category api interface * @since 0.67.0 */ export interface Option extends AnnotableClass, option_.Option>, OptionEncoded>, Schema.Context> { } /** * @category Option transformations * @since 0.67.0 */ export declare const Option: (value: Value) => Option; /** * @category api interface * @since 0.67.0 */ export interface OptionFromNullOr extends AnnotableClass, option_.Option>, Schema.Encoded | null, Schema.Context> { } /** * @category Option transformations * @since 0.67.0 */ export declare const OptionFromNullOr: (value: Value) => OptionFromNullOr; /** * @category api interface * @since 0.67.0 */ export interface OptionFromNullishOr extends AnnotableClass, option_.Option>, Schema.Encoded | null | undefined, Schema.Context> { } /** * @category Option transformations * @since 0.67.0 */ export declare const OptionFromNullishOr: (value: Value, onNoneEncoding: null | undefined) => OptionFromNullishOr; /** * @category api interface * @since 0.67.0 */ export interface OptionFromUndefinedOr extends AnnotableClass, option_.Option>, Schema.Encoded | undefined, Schema.Context> { } /** * @category Option transformations * @since 0.67.0 */ export declare const OptionFromUndefinedOr: (value: Value) => OptionFromUndefinedOr; /** * Transforms strings into an Option type, effectively filtering out empty or * whitespace-only strings by trimming them and checking their length. Returns * `none` for invalid inputs and `some` for valid non-empty strings. * * @example * import { Schema } from "@effect/schema" * * console.log(Schema.decodeSync(Schema.OptionFromNonEmptyTrimmedString)("")) // Option.none() * console.log(Schema.decodeSync(Schema.OptionFromNonEmptyTrimmedString)(" a ")) // Option.some("a") * console.log(Schema.decodeSync(Schema.OptionFromNonEmptyTrimmedString)("a")) // Option.some("a") * * @category Option transformations * @since 0.69.3 */ export declare const OptionFromNonEmptyTrimmedString: transform>; /** * @category Either utils * @since 0.67.0 */ export type RightEncoded = { readonly _tag: "Right"; readonly right: IA; }; /** * @category Either utils * @since 0.67.0 */ export type LeftEncoded = { readonly _tag: "Left"; readonly left: IE; }; /** * @category Either utils * @since 0.67.0 */ export type EitherEncoded = RightEncoded | LeftEncoded; /** * @category api interface * @since 0.67.0 */ export interface EitherFromSelf extends AnnotableClass, either_.Either, Schema.Type>, either_.Either, Schema.Encoded>, Schema.Context | Schema.Context> { } /** * @category Either transformations * @since 0.67.0 */ export declare const EitherFromSelf: ({ left, right }: { readonly left: L; readonly right: R; }) => EitherFromSelf; /** * @category api interface * @since 0.67.0 */ export interface Either extends AnnotableClass, either_.Either, Schema.Type>, EitherEncoded, Schema.Encoded>, Schema.Context | Schema.Context> { } /** * @category Either transformations * @since 0.67.0 */ export declare const Either: ({ left, right }: { readonly left: L; readonly right: R; }) => Either; /** * @category api interface * @since 0.67.0 */ export interface EitherFromUnion extends AnnotableClass, either_.Either, Schema.Type>, Schema.Encoded | Schema.Encoded, Schema.Context | Schema.Context> { } /** * @example * import * as Schema from "@effect/schema/Schema" * * // Schema> * Schema.EitherFromUnion({ left: Schema.String, right: Schema.Number }) * * @category Either transformations * @since 0.67.0 */ export declare const EitherFromUnion: ({ left, right }: { readonly left: L; readonly right: R; }) => EitherFromUnion; /** * @category api interface * @since 0.67.0 */ export interface ReadonlyMapFromSelf extends AnnotableClass, ReadonlyMap, Schema.Type>, ReadonlyMap, Schema.Encoded>, Schema.Context | Schema.Context> { } /** * @category ReadonlyMap * @since 0.67.0 */ export declare const ReadonlyMapFromSelf: ({ key, value }: { readonly key: K; readonly value: V; }) => ReadonlyMapFromSelf; /** * @category api interface * @since 0.67.0 */ export interface MapFromSelf extends AnnotableClass, Map, Schema.Type>, ReadonlyMap, Schema.Encoded>, Schema.Context | Schema.Context> { } /** * @category Map * @since 0.67.0 */ export declare const MapFromSelf: ({ key, value }: { readonly key: K; readonly value: V; }) => MapFromSelf; /** * @category api interface * @since 0.67.0 */ export interface ReadonlyMap$ extends AnnotableClass, ReadonlyMap, Schema.Type>, ReadonlyArray, Schema.Encoded]>, Schema.Context | Schema.Context> { } /** * @category ReadonlyMap transformations * @since 0.67.0 */ export declare const ReadonlyMap: ({ key, value }: { readonly key: K; readonly value: V; }) => ReadonlyMap$; /** * @category api interface * @since 0.67.0 */ export interface Map$ extends AnnotableClass, Map, Schema.Type>, ReadonlyArray, Schema.Encoded]>, Schema.Context | Schema.Context> { } declare const map: ({ key, value }: { readonly key: K; readonly value: V; }) => Map$; export { /** * @category Map transformations * @since 0.67.0 */ map as Map }; /** * @category ReadonlyMap transformations * @since 0.68.15 */ export declare const ReadonlyMapFromRecord: ({ key, value }: { key: Schema; value: Schema; }) => Schema, { readonly [x: string]: VI; }, KR | VR>; /** * @category Map transformations * @since 0.68.15 */ export declare const MapFromRecord: ({ key, value }: { key: Schema; value: Schema; }) => Schema, { readonly [x: string]: VI; }, KR | VR>; /** * @category api interface * @since 0.67.0 */ export interface ReadonlySetFromSelf extends AnnotableClass, ReadonlySet>, ReadonlySet>, Schema.Context> { } /** * @category ReadonlySet * @since 0.67.0 */ export declare const ReadonlySetFromSelf: (value: Value) => ReadonlySetFromSelf; /** * @category api interface * @since 0.67.0 */ export interface SetFromSelf extends AnnotableClass, Set>, ReadonlySet>, Schema.Context> { } /** * @category Set * @since 0.67.0 */ export declare const SetFromSelf: (value: Value) => SetFromSelf; /** * @category api interface * @since 0.67.0 */ export interface ReadonlySet$ extends AnnotableClass, ReadonlySet>, ReadonlyArray>, Schema.Context> { } /** * @category ReadonlySet transformations * @since 0.67.0 */ export declare const ReadonlySet: (value: Value) => ReadonlySet$; /** * @category api interface * @since 0.67.0 */ export interface Set$ extends AnnotableClass, Set>, ReadonlyArray>, Schema.Context> { } declare const set: (value: Value) => Set$; export { /** * @category Set transformations * @since 0.67.0 */ set as Set }; declare const BigDecimalFromSelf_base: SchemaClass; /** * @category BigDecimal constructors * @since 0.67.0 */ export declare class BigDecimalFromSelf extends BigDecimalFromSelf_base { } declare const BigDecimal_base: transformOrFail, typeof BigDecimalFromSelf, never>; /** * @category BigDecimal transformations * @since 0.67.0 */ export declare class BigDecimal extends BigDecimal_base { } declare const BigDecimalFromNumber_base: transformOrFail, typeof BigDecimalFromSelf, never>; /** * 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 0.67.0 */ export declare class BigDecimalFromNumber extends BigDecimalFromNumber_base { } /** * @category type id * @since 0.67.0 */ export declare const GreaterThanBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 0.67.0 */ export declare const greaterThanBigDecimal: (min: bigDecimal_.BigDecimal, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const GreaterThanOrEqualToBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 0.67.0 */ export declare const greaterThanOrEqualToBigDecimal: (min: bigDecimal_.BigDecimal, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const LessThanBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 0.67.0 */ export declare const lessThanBigDecimal: (max: bigDecimal_.BigDecimal, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const LessThanOrEqualToBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 0.67.0 */ export declare const lessThanOrEqualToBigDecimal: (max: bigDecimal_.BigDecimal, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category type id * @since 0.67.0 */ export declare const PositiveBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 0.67.0 */ export declare const positiveBigDecimal: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category BigDecimal constructors * @since 0.67.0 */ export declare const PositiveBigDecimalFromSelf: filter>; /** * @category type id * @since 0.67.0 */ export declare const NonNegativeBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 0.67.0 */ export declare const nonNegativeBigDecimal: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category BigDecimal constructors * @since 0.67.0 */ export declare const NonNegativeBigDecimalFromSelf: filter>; /** * @category type id * @since 0.67.0 */ export declare const NegativeBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 0.67.0 */ export declare const negativeBigDecimal: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category BigDecimal constructors * @since 0.67.0 */ export declare const NegativeBigDecimalFromSelf: filter>; /** * @category type id * @since 0.67.0 */ export declare const NonPositiveBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 0.67.0 */ export declare const nonPositiveBigDecimal: (annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * @category BigDecimal constructors * @since 0.67.0 */ export declare const NonPositiveBigDecimalFromSelf: filter>; /** * @category type id * @since 0.67.0 */ export declare const BetweenBigDecimalTypeId: unique symbol; /** * @category BigDecimal filters * @since 0.67.0 */ export declare const betweenBigDecimal: (minimum: bigDecimal_.BigDecimal, maximum: bigDecimal_.BigDecimal, annotations?: Annotations.Filter) => (self: Schema) => filter>; /** * Clamps a `BigDecimal` between a minimum and a maximum value. * * @category BigDecimal transformations * @since 0.67.0 */ export declare const clampBigDecimal: (minimum: bigDecimal_.BigDecimal, maximum: bigDecimal_.BigDecimal) => (self: Schema) => transform, filter>>; /** * @category api interface * @since 0.67.0 */ export interface ChunkFromSelf extends AnnotableClass, chunk_.Chunk>, chunk_.Chunk>, Schema.Context> { } /** * @category Chunk * @since 0.67.0 */ export declare const ChunkFromSelf: (value: Value) => ChunkFromSelf; /** * @category api interface * @since 0.67.0 */ export interface Chunk extends AnnotableClass, chunk_.Chunk>, ReadonlyArray>, Schema.Context> { } /** * @category Chunk transformations * @since 0.67.0 */ export declare const Chunk: (value: Value) => Chunk; /** * @category api interface * @since 0.67.23 */ export interface NonEmptyChunkFromSelf extends AnnotableClass, chunk_.NonEmptyChunk>, chunk_.NonEmptyChunk>, Schema.Context> { } /** * @category Chunk * @since 0.67.23 */ export declare const NonEmptyChunkFromSelf: (value: Value) => NonEmptyChunkFromSelf; /** * @category api interface * @since 0.67.23 */ export interface NonEmptyChunk extends AnnotableClass, chunk_.NonEmptyChunk>, array_.NonEmptyReadonlyArray>, Schema.Context> { } /** * @category Chunk transformations * @since 0.67.23 */ export declare const NonEmptyChunk: (value: Value) => NonEmptyChunk; /** * @category Data transformations * @since 0.67.0 */ export declare const DataFromSelf: > | ReadonlyArray, A extends Readonly> | ReadonlyArray>(item: Schema) => SchemaClass; /** * @category Data transformations * @since 0.67.0 */ export declare const Data: > | ReadonlyArray, A extends Readonly> | ReadonlyArray>(item: Schema) => SchemaClass; type MissingSelfGeneric = `Missing \`Self\` generic - use \`class Self extends ${Usage}()(${Params}{ ... })\``; type RequiredKeys = { [K in keyof T]-?: {} extends Pick ? never : K; }[keyof T]; /** * @category api interface * @since 0.67.0 */ export interface Class extends Schema, R> { new (props: RequiredKeys extends never ? void | Simplify : Simplify, options?: MakeOptions): Struct.Type & Omit & Proto; /** @since 0.69.3 */ readonly ast: AST.Transformation; make, X>(this: { new (...args: Args): X; }, ...args: Args): X; annotations(annotations: Annotations.Schema): SchemaClass, R>; readonly fields: { readonly [K in keyof Fields]: Fields[K]; }; readonly identifier: string; extend(identifier: string): (fields: newFields | HasFields, annotations?: Annotations.Schema) => [Extended] extends [never] ? MissingSelfGeneric<"Base.extend"> : Class, R | Struct.Context, C & Struct.Constructor, Self, Proto>; transformOrFail(identifier: string): (fields: newFields, options: { readonly decode: (input: Simplify>, options: ParseOptions, ast: AST.Transformation) => Effect.Effect>, ParseResult.ParseIssue, R2>; readonly encode: (input: Simplify>, options: ParseOptions, ast: AST.Transformation) => Effect.Effect, ParseResult.ParseIssue, R3>; }, annotations?: Annotations.Schema) => [Transformed] extends [never] ? MissingSelfGeneric<"Base.transformOrFail"> : Class | R2 | R3, C & Struct.Constructor, Self, Proto>; transformOrFailFrom(identifier: string): (fields: newFields, options: { readonly decode: (input: Simplify, options: ParseOptions, ast: AST.Transformation) => Effect.Effect>, ParseResult.ParseIssue, R2>; readonly encode: (input: Simplify>, options: ParseOptions, ast: AST.Transformation) => Effect.Effect; }, annotations?: Annotations.Schema) => [Transformed] extends [never] ? MissingSelfGeneric<"Base.transformOrFailFrom"> : Class | R2 | R3, C & Struct.Constructor, Self, Proto>; } type HasFields = Struct | { readonly [refineTypeId]: HasFields; }; /** * @category classes * @since 0.67.0 */ export declare const Class: (identifier: string) => (fieldsOr: Fields | HasFields, annotations?: Annotations.Schema) => [Self] extends [never] ? MissingSelfGeneric<"Class"> : Class, Struct.Context, Struct.Constructor, {}, {}>; /** * @category api interface * @since 0.67.0 */ export interface TaggedClass extends Class, Struct.Context, Struct.Constructor>, {}, {}> { readonly _tag: Tag; } /** * @category classes * @since 0.67.0 */ export declare const TaggedClass: (identifier?: string) => (tag: Tag, fieldsOr: Fields | HasFields, annotations?: Annotations.Schema) => [Self] extends [never] ? MissingSelfGeneric<"TaggedClass", `"Tag", `> : TaggedClass; } & Fields>; /** * @category api interface * @since 0.67.0 */ export interface TaggedErrorClass extends Class, Struct.Context, Struct.Constructor>, {}, cause_.YieldableError> { readonly _tag: Tag; } /** * @category classes * @since 0.67.0 */ export declare const TaggedError: (identifier?: string) => (tag: Tag, fieldsOr: Fields | HasFields, annotations?: Annotations.Schema) => [Self] extends [never] ? MissingSelfGeneric<"TaggedError", `"Tag", `> : TaggedErrorClass; } & Fields>; /** * @since 0.67.0 */ export interface TaggedRequest extends Request.Request, Serializable.SerializableWithResult { readonly _tag: Tag; } /** * @since 0.67.0 */ export declare namespace TaggedRequest { /** * @since 0.69.0 */ type Any = TaggedRequest; /** * @since 0.69.0 */ type All = Any | TaggedRequest; } /** * @category api interface * @since 0.67.0 */ export interface TaggedRequestClass extends Class, Struct.Context, Struct.Constructor>, TaggedRequest, Struct.Context, Schema.Type, Schema.Encoded, Schema.Type, Schema.Encoded, Schema.Context | Schema.Context>, {}> { readonly _tag: Tag; /** @since 0.69.1 */ readonly success: Success; /** @since 0.69.1 */ readonly failure: Failure; } /** * @category classes * @since 0.67.0 */ export declare const TaggedRequest: (identifier?: string) => (tag: Tag, options: { failure: Failure; success: Success; payload: Payload; }, annotations?: Annotations.Schema) => [Self] extends [never] ? MissingSelfGeneric<"TaggedRequest", `"Tag", SuccessSchema, FailureSchema, `> : TaggedRequestClass; } & Payload, Success, Failure>; type MakeOptions = boolean | { readonly disableValidation?: boolean; }; /** * @category FiberId * @since 0.67.0 */ export type FiberIdEncoded = { readonly _tag: "Composite"; readonly left: FiberIdEncoded; readonly right: FiberIdEncoded; } | { readonly _tag: "None"; } | { readonly _tag: "Runtime"; readonly id: number; readonly startTimeMillis: number; }; declare const FiberIdFromSelf_base: SchemaClass; /** * @category FiberId constructors * @since 0.67.0 */ export declare class FiberIdFromSelf extends FiberIdFromSelf_base { } declare const FiberId_base: transform, typeof FiberIdFromSelf>; /** * @category FiberId transformations * @since 0.67.0 */ export declare class FiberId extends FiberId_base { } /** * @category Cause utils * @since 0.69.0 */ export type CauseEncoded = { readonly _tag: "Empty"; } | { readonly _tag: "Fail"; readonly error: E; } | { readonly _tag: "Die"; readonly defect: D; } | { readonly _tag: "Interrupt"; readonly fiberId: FiberIdEncoded; } | { readonly _tag: "Sequential"; readonly left: CauseEncoded; readonly right: CauseEncoded; } | { readonly _tag: "Parallel"; readonly left: CauseEncoded; readonly right: CauseEncoded; }; /** * @category api interface * @since 0.69.0 */ export interface CauseFromSelf extends AnnotableClass, cause_.Cause>, cause_.Cause>, Schema.Context | Schema.Context> { } /** * @category Cause transformations * @since 0.69.0 */ export declare const CauseFromSelf: ({ defect, error }: { readonly error: E; readonly defect: D; }) => CauseFromSelf; /** * @category api interface * @since 0.69.0 */ export interface Cause extends AnnotableClass, cause_.Cause>, CauseEncoded, Schema.Encoded>, Schema.Context | Schema.Context> { } /** * @category Cause transformations * @since 0.69.0 */ export declare const Cause: ({ defect, error }: { readonly error: E; readonly defect: D; }) => Cause; /** * @category api interface * @since 0.69.0 */ export interface Defect extends transform { } /** * Defines a schema for handling JavaScript errors (`Error` instances) and other types of defects. * It decodes objects into Error instances if they match the expected structure (i.e., have a `message` and optionally a `name` and `stack`), * or converts other values to their string representations. * * When encoding, it converts `Error` instances back into plain objects containing only the error's name and message, * or other values into their string forms. * * This is useful for serializing and deserializing errors across network boundaries where error objects do not natively serialize. * * @category defect * @since 0.69.0 */ export declare const Defect: Defect; /** * @category Exit utils * @since 0.69.0 */ export type ExitEncoded = { readonly _tag: "Failure"; readonly cause: CauseEncoded; } | { readonly _tag: "Success"; readonly value: A; }; /** * @category api interface * @since 0.69.0 */ export interface ExitFromSelf extends AnnotableClass, exit_.Exit, Schema.Type>, exit_.Exit, Schema.Encoded>, Schema.Context | Schema.Context | Schema.Context> { } /** * @category Exit transformations * @since 0.69.0 */ export declare const ExitFromSelf: ({ defect, failure, success }: { readonly failure: E; readonly success: A; readonly defect: D; }) => ExitFromSelf; /** * @category api interface * @since 0.69.0 */ export interface Exit extends AnnotableClass, exit_.Exit, Schema.Type>, ExitEncoded, Schema.Encoded, Schema.Encoded>, Schema.Context | Schema.Context | Schema.Context> { } /** * @category Exit transformations * @since 0.69.0 */ export declare const Exit: ({ defect, failure, success }: { readonly failure: E; readonly success: A; readonly defect: D; }) => Exit; /** * @category api interface * @since 0.67.0 */ export interface HashSetFromSelf extends AnnotableClass, hashSet_.HashSet>, hashSet_.HashSet>, Schema.Context> { } /** * @category HashSet transformations * @since 0.67.0 */ export declare const HashSetFromSelf: (value: Value) => HashSetFromSelf; /** * @category api interface * @since 0.67.0 */ export interface HashSet extends AnnotableClass, hashSet_.HashSet>, ReadonlyArray>, Schema.Context> { } /** * @category HashSet transformations * @since 0.67.0 */ export declare const HashSet: (value: Value) => HashSet; /** * @category api interface * @since 0.67.0 */ export interface HashMapFromSelf extends AnnotableClass, hashMap_.HashMap, Schema.Type>, hashMap_.HashMap, Schema.Encoded>, Schema.Context | Schema.Context> { } /** * @category HashMap transformations * @since 0.67.0 */ export declare const HashMapFromSelf: ({ key, value }: { readonly key: K; readonly value: V; }) => HashMapFromSelf; /** * @category api interface * @since 0.67.0 */ export interface HashMap extends AnnotableClass, hashMap_.HashMap, Schema.Type>, ReadonlyArray, Schema.Encoded]>, Schema.Context | Schema.Context> { } /** * @category HashMap transformations * @since 0.67.0 */ export declare const HashMap: ({ key, value }: { readonly key: K; readonly value: V; }) => HashMap; /** * @category api interface * @since 0.67.0 */ export interface ListFromSelf extends AnnotableClass, list_.List>, list_.List>, Schema.Context> { } /** * @category List transformations * @since 0.67.0 */ export declare const ListFromSelf: (value: Value) => ListFromSelf; /** * @category api interface * @since 0.67.0 */ export interface List extends AnnotableClass, list_.List>, ReadonlyArray>, Schema.Context> { } /** * @category List transformations * @since 0.67.0 */ export declare const List: (value: Value) => List; /** * @category api interface * @since 0.67.0 */ export interface SortedSetFromSelf extends AnnotableClass, sortedSet_.SortedSet>, sortedSet_.SortedSet>, Schema.Context> { } /** * @category SortedSet transformations * @since 0.67.0 */ export declare const SortedSetFromSelf: (value: Value, ordA: Order.Order>, ordI: Order.Order>) => SortedSetFromSelf; /** * @category api interface * @since 0.67.0 */ export interface SortedSet extends AnnotableClass, sortedSet_.SortedSet>, ReadonlyArray>, Schema.Context> { } /** * @category SortedSet transformations * @since 0.67.0 */ export declare const SortedSet: (value: Value, ordA: Order.Order>) => SortedSet; declare const BooleanFromUnknown_base: transform; /** * Converts an arbitrary value to a `boolean` by testing whether it is truthy. * Uses `!!val` to coerce the value to a `boolean`. * * @see https://developer.mozilla.org/docs/Glossary/Truthy * @category boolean constructors * @since 0.67.0 */ export declare class BooleanFromUnknown extends BooleanFromUnknown_base { } /** * @category Config validations * @since 0.67.12 */ export declare const Config: (name: string, schema: Schema) => config_.Config; //# sourceMappingURL=Schema.d.ts.map