import * as Types from '@sidewinder/type'; import { ValueError } from '@sidewinder/type/errors'; import { Assignable } from './assign'; import { Edit } from './delta'; export { Edit, Insert, Update, Delete } from './delta'; /** The value namespace runs operations on values */ export declare namespace Value { /** Performs a mutable transform of the current value into the next value by assigning values from next on current and preserves the current values internal object and array references. */ function Assign(current: Assignable, next: Assignable): void; /** Casts a value into a given type. The return value will retain as much information of the original value as possible. Cast will convert string, number and boolean values if a reasonable conversion is possible. */ function Cast(schema: T, references: [...R], value: unknown): Types.Static; /** Casts a value into a given type. The return value will retain as much information of the original value as possible. Cast will convert string, number and boolean values if a reasonable conversion is possible. */ function Cast(schema: T, value: unknown): Types.Static; /** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */ function Clean(schema: Types.TSchema, references: Types.TSchema[], value: unknown): unknown; /** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */ function Clean(schema: Types.TSchema, value: unknown): unknown; /** Converts any type mismatched values to their target type if a reasonable conversion is possible. */ function Convert(schema: Types.TSchema, references: Types.TSchema[], value: unknown): unknown; /** Converts any type mismatched values to their target type if a reasonable conversion is possible. */ function Convert(schema: Types.TSchema, value: unknown): unknown; /** Creates a value from the given type */ function Create(schema: T, references: [...R]): Types.Static; /** Creates a value from the given type */ function Create(schema: T): Types.Static; /** Returns true if the value matches the given type. */ function Check(schema: T, references: [...R], value: unknown): value is Types.Static; /** Returns true if the value matches the given type. */ function Check(schema: T, value: unknown): value is Types.Static; /** `[Mutable]` Generates missing properties on a value using default schema annotations if available. This function does not check the value and returns an unknown type. You should Check the result before use. Default is a mutable operation. To avoid mutation, Clone the value first. */ function Default(schema: Types.TSchema, references: Types.TSchema[], value: unknown): unknown; /** `[Mutable]` Generates missing properties on a value using default schema annotations if available. This function does not check the value and returns an unknown type. You should Check the result before use. Default is a mutable operation. To avoid mutation, Clone the value first. */ function Default(schema: Types.TSchema, value: unknown): unknown; /** Returns an iterator for each error in this value. */ function Errors(schema: T, references: [...R], value: unknown): IterableIterator; /** Returns an iterator for each error in this value. */ function Errors(schema: T, value: unknown): IterableIterator; /** Returns true if left and right values are structurally equal */ function Equal(left: T, right: unknown): right is T; /** Returns a structural clone of the given value */ function Clone(value: T): T; /** Returns edits to transform the current value into the next value */ function Diff(current: T, next: T): Edit[]; /** Returns a computed 64-bit hash code for the given value. This function uses the fnv1a64 non-cryptographic hashing algorithm */ function Hash(value: unknown): bigint; /** Returns a new value with edits applied to the given value */ function Patch(current: T, edits: Edit[]): T; }