UNPKG

elysia-oauth2

Version:

Elysia plugin for OAuth 2.0 Authorization Flow with more than 48 providers

615 lines (561 loc) 60 kB
import * as elysia from 'elysia'; import { Elysia } from 'elysia'; import * as arctic from 'arctic'; export * from 'arctic'; import { ElysiaCookie } from 'elysia/cookies'; /** Symbol key applied to readonly types */ declare const ReadonlyKind: unique symbol; /** Symbol key applied to optional types */ declare const OptionalKind: unique symbol; /** Symbol key applied to types */ declare const Hint: unique symbol; /** Symbol key applied to types */ declare const Kind: unique symbol; interface TAny extends TSchema { [Kind]: 'Any'; static: any; } interface TMappedKey<T extends PropertyKey[] = PropertyKey[]> extends TSchema { [Kind]: 'MappedKey'; static: T[number]; keys: T; } interface TMappedResult<T extends TProperties = TProperties> extends TSchema { [Kind]: 'MappedResult'; properties: T; static: unknown; } interface TAsyncIterator<T extends TSchema = TSchema> extends TSchema { [Kind]: 'AsyncIterator'; static: AsyncIterableIterator<Static<T, this['params']>>; type: 'AsyncIterator'; items: T; } type TReadonly<T extends TSchema> = T & { [ReadonlyKind]: 'Readonly'; }; type TReadonlyOptional<T extends TSchema> = TOptional<T> & TReadonly<T>; type StaticReturnType$1<U extends TSchema, P extends unknown[]> = Static<U, P>; type StaticParameter$1<T extends TSchema, P extends unknown[]> = T extends TReadonlyOptional<T> ? [Readonly<Static<T, P>>?] : T extends TReadonly<T> ? [Readonly<Static<T, P>>] : T extends TOptional<T> ? [Static<T, P>?] : [ Static<T, P> ]; type StaticParameters$1<T extends TSchema[], P extends unknown[], Acc extends unknown[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? StaticParameters$1<R, P, [...Acc, ...StaticParameter$1<L, P>]> : Acc); type StaticConstructor<T extends TSchema[], U extends TSchema, P extends unknown[]> = Ensure<new (...param: StaticParameters$1<T, P>) => StaticReturnType$1<U, P>>; interface TConstructor<T extends TSchema[] = TSchema[], U extends TSchema = TSchema> extends TSchema { [Kind]: 'Constructor'; static: StaticConstructor<T, U, this['params']>; type: 'Constructor'; parameters: T; returns: U; } type TLiteralValue = boolean | number | string; interface TLiteral<T extends TLiteralValue = TLiteralValue> extends TSchema { [Kind]: 'Literal'; static: T; const: T; } type TEnumRecord = Record<TEnumKey, TEnumValue>; type TEnumValue = string | number; type TEnumKey = string; interface TEnum<T extends Record<string, string | number> = Record<string, string | number>> extends TSchema { [Kind]: 'Union'; [Hint]: 'Enum'; static: T[keyof T]; anyOf: TLiteral<T[keyof T]>[]; } type StaticReturnType<U extends TSchema, P extends unknown[]> = Static<U, P>; type StaticParameter<T extends TSchema, P extends unknown[]> = T extends TReadonlyOptional<T> ? [Readonly<Static<T, P>>?] : T extends TReadonly<T> ? [Readonly<Static<T, P>>] : T extends TOptional<T> ? [Static<T, P>?] : [ Static<T, P> ]; type StaticParameters<T extends TSchema[], P extends unknown[], Acc extends unknown[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? StaticParameters<R, P, [...Acc, ...StaticParameter<L, P>]> : Acc); type StaticFunction<T extends TSchema[], U extends TSchema, P extends unknown[]> = Ensure<(...param: StaticParameters<T, P>) => StaticReturnType<U, P>>; interface TFunction<T extends TSchema[] = TSchema[], U extends TSchema = TSchema> extends TSchema { [Kind]: 'Function'; static: StaticFunction<T, U, this['params']>; type: 'Function'; parameters: T; returns: U; } interface TComputed<Target extends string = string, Parameters extends TSchema[] = []> extends TSchema { [Kind]: 'Computed'; target: Target; parameters: Parameters; } interface TNever extends TSchema { [Kind]: 'Never'; static: never; not: {}; } type TIntersectStatic<T extends TSchema[], P extends unknown[], Acc extends unknown = unknown> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TIntersectStatic<R, P, Acc & Static<L, P>> : Acc; type TUnevaluatedProperties = undefined | TSchema | boolean; interface IntersectOptions extends SchemaOptions { unevaluatedProperties?: TUnevaluatedProperties; } interface TIntersect<T extends TSchema[] = TSchema[]> extends TSchema, IntersectOptions { [Kind]: 'Intersect'; static: TIntersectStatic<T, this['params']>; type?: 'object'; allOf: [...T]; } type TIsIntersectOptional<Types extends TSchema[]> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TOptional<TSchema> ? TIsIntersectOptional<Right> : false : true); type TRemoveOptionalFromType$1<Type extends TSchema> = (Type extends TReadonly<infer Type extends TSchema> ? TReadonly<TRemoveOptionalFromType$1<Type>> : Type extends TOptional<infer Type extends TSchema> ? TRemoveOptionalFromType$1<Type> : Type); type TRemoveOptionalFromRest$1<Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TOptional<infer Type extends TSchema> ? TRemoveOptionalFromRest$1<Right, [...Result, TRemoveOptionalFromType$1<Type>]> : TRemoveOptionalFromRest$1<Right, [...Result, Left]> : Result); type TResolveIntersect<Types extends TSchema[]> = (TIsIntersectOptional<Types> extends true ? TOptional<TIntersect<TRemoveOptionalFromRest$1<Types>>> : TIntersect<TRemoveOptionalFromRest$1<Types>>); type TIntersectEvaluated<Types extends TSchema[]> = (Types extends [TSchema] ? Types[0] : Types extends [] ? TNever : TResolveIntersect<Types>); type UnionStatic<T extends TSchema[], P extends unknown[]> = { [K in keyof T]: T[K] extends TSchema ? Static<T[K], P> : never; }[number]; interface TUnion<T extends TSchema[] = TSchema[]> extends TSchema { [Kind]: 'Union'; static: UnionStatic<T, this['params']>; anyOf: T; } type TIsUnionOptional<Types extends TSchema[]> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TOptional<TSchema> ? true : TIsUnionOptional<Right> : false); type TRemoveOptionalFromRest<Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TOptional<infer S extends TSchema> ? TRemoveOptionalFromRest<Right, [...Result, TRemoveOptionalFromType<S>]> : TRemoveOptionalFromRest<Right, [...Result, Left]> : Result); type TRemoveOptionalFromType<Type extends TSchema> = (Type extends TReadonly<infer Type extends TSchema> ? TReadonly<TRemoveOptionalFromType<Type>> : Type extends TOptional<infer Type extends TSchema> ? TRemoveOptionalFromType<Type> : Type); type TResolveUnion<Types extends TSchema[], Result extends TSchema[] = TRemoveOptionalFromRest<Types>, IsOptional extends boolean = TIsUnionOptional<Types>> = (IsOptional extends true ? TOptional<TUnion<Result>> : TUnion<Result>); type TUnionEvaluated<Types extends TSchema[]> = (Types extends [TSchema] ? Types[0] : Types extends [] ? TNever : TResolveUnion<Types>); type RecursiveStatic<T extends TSchema> = Static<T, [RecursiveStatic<T>]>; interface TRecursive<T extends TSchema> extends TSchema { [Hint]: 'Recursive'; static: RecursiveStatic<T>; } interface TRef<Ref extends string = string> extends TSchema { [Kind]: 'Ref'; static: unknown; $ref: Ref; } type TupleStatic<T extends TSchema[], P extends unknown[], Acc extends unknown[] = []> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TupleStatic<R, P, [...Acc, Static<L, P>]> : Acc; interface TTuple<T extends TSchema[] = TSchema[]> extends TSchema { [Kind]: 'Tuple'; static: TupleStatic<T, this['params']>; type: 'array'; items?: T; additionalItems?: false; minItems: number; maxItems: number; } type StringFormatOption = 'date-time' | 'time' | 'date' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'uuid' | 'iri-reference' | 'uri-template' | 'json-pointer' | 'relative-json-pointer' | 'regex' | ({} & string); type StringContentEncodingOption = '7bit' | '8bit' | 'binary' | 'quoted-printable' | 'base64' | ({} & string); interface StringOptions extends SchemaOptions { /** The maximum string length */ maxLength?: number; /** The minimum string length */ minLength?: number; /** A regular expression pattern this string should match */ pattern?: string; /** A format this string should match */ format?: StringFormatOption; /** The content encoding for this string */ contentEncoding?: StringContentEncodingOption; /** The content media type for this string */ contentMediaType?: string; } interface TString extends TSchema, StringOptions { [Kind]: 'String'; static: string; type: 'string'; } interface TBoolean extends TSchema { [Kind]: 'Boolean'; static: boolean; type: 'boolean'; } interface NumberOptions extends SchemaOptions { exclusiveMaximum?: number; exclusiveMinimum?: number; maximum?: number; minimum?: number; multipleOf?: number; } interface TNumber extends TSchema, NumberOptions { [Kind]: 'Number'; static: number; type: 'number'; } interface IntegerOptions extends SchemaOptions { exclusiveMaximum?: number; exclusiveMinimum?: number; maximum?: number; minimum?: number; multipleOf?: number; } interface TInteger extends TSchema, IntegerOptions { [Kind]: 'Integer'; static: number; type: 'integer'; } interface BigIntOptions extends SchemaOptions { exclusiveMaximum?: bigint; exclusiveMinimum?: bigint; maximum?: bigint; minimum?: bigint; multipleOf?: bigint; } interface TBigInt extends TSchema, BigIntOptions { [Kind]: 'BigInt'; static: bigint; type: 'bigint'; } type TFromTemplateLiteralKind<T> = T extends TTemplateLiteral<infer U extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds$1<U> : T extends TUnion<infer U extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds$1<U> : T extends TString ? false : T extends TNumber ? false : T extends TInteger ? false : T extends TBigInt ? false : T extends TBoolean ? true : T extends TLiteral ? true : false; type TFromTemplateLiteralKinds$1<T extends TTemplateLiteralKind[]> = T extends [infer L extends TTemplateLiteralKind, ...infer R extends TTemplateLiteralKind[]] ? TFromTemplateLiteralKind<L> extends false ? false : TFromTemplateLiteralKinds$1<R> : true; type TIsTemplateLiteralFinite<T> = T extends TTemplateLiteral<infer U> ? TFromTemplateLiteralKinds$1<U> : false; type TStringReduceUnary<L extends string, R extends string[], Acc extends string[] = []> = R extends [infer A extends string, ...infer B extends string[]] ? TStringReduceUnary<L, B, [...Acc, `${L}${A}`]> : Acc; type TStringReduceBinary<L extends string[], R extends string[], Acc extends string[] = []> = L extends [infer A extends string, ...infer B extends string[]] ? TStringReduceBinary<B, R, [...Acc, ...TStringReduceUnary<A, R>]> : Acc; type TStringReduceMany<T extends string[][]> = T extends [infer L extends string[], infer R extends string[], ...infer Rest extends string[][]] ? TStringReduceMany<[TStringReduceBinary<L, R>, ...Rest]> : T; type TStringReduce<T extends string[][], O = TStringReduceMany<T>> = 0 extends keyof O ? Assert<O[0], string[]> : []; type TFromTemplateLiteralUnionKinds<T extends TTemplateLiteralKind[]> = T extends [infer L extends TLiteral, ...infer R extends TLiteral[]] ? [`${L['const']}`, ...TFromTemplateLiteralUnionKinds<R>] : []; type TFromTemplateLiteralKinds<T extends TTemplateLiteralKind[], Acc extends TLiteralValue[][] = []> = T extends [infer L extends TTemplateLiteralKind, ...infer R extends TTemplateLiteralKind[]] ? (L extends TTemplateLiteral<infer S extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds<[...S, ...R], Acc> : L extends TLiteral<infer S extends TLiteralValue> ? TFromTemplateLiteralKinds<R, [...Acc, [S]]> : L extends TUnion<infer S extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds<R, [...Acc, TFromTemplateLiteralUnionKinds<S>]> : L extends TBoolean ? TFromTemplateLiteralKinds<R, [...Acc, ['true', 'false']]> : Acc) : Acc; type TTemplateLiteralGenerate<T extends TTemplateLiteral, F = TIsTemplateLiteralFinite<T>> = F extends true ? (T extends TTemplateLiteral<infer S extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds<S> extends infer R extends string[][] ? TStringReduce<R> : [] : []) : []; type TemplateLiteralStaticKind<T, Acc extends string> = T extends TUnion<infer U> ? { [K in keyof U]: TemplateLiteralStatic<Assert<[U[K]], TTemplateLiteralKind[]>, Acc>; }[number] : T extends TTemplateLiteral ? `${Static<T>}` : T extends TLiteral<infer U> ? `${U}` : T extends TString ? `${string}` : T extends TNumber ? `${number}` : T extends TBigInt ? `${bigint}` : T extends TBoolean ? `${boolean}` : never; type TemplateLiteralStatic<T extends TTemplateLiteralKind[], Acc extends string> = T extends [infer L, ...infer R] ? `${TemplateLiteralStaticKind<L, Acc>}${TemplateLiteralStatic<Assert<R, TTemplateLiteralKind[]>, Acc>}` : Acc; type TTemplateLiteralKind = TTemplateLiteral | TUnion | TLiteral | TInteger | TNumber | TBigInt | TString | TBoolean | TNever; interface TTemplateLiteral<T extends TTemplateLiteralKind[] = TTemplateLiteralKind[]> extends TSchema { [Kind]: 'TemplateLiteral'; static: TemplateLiteralStatic<T, EmptyString>; type: 'string'; pattern: string; } type TFromTemplateLiteral<TemplateLiteral extends TTemplateLiteral, Keys extends string[] = TTemplateLiteralGenerate<TemplateLiteral>> = (Keys); type TFromUnion$5<Types extends TSchema[], Result extends string[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromUnion$5<Right, [...Result, ...TIndexPropertyKeys<Left>]> : Result); type TFromLiteral<LiteralValue extends TLiteralValue> = (LiteralValue extends PropertyKey ? [`${LiteralValue}`] : []); type TIndexPropertyKeys<Type extends TSchema> = (Type extends TTemplateLiteral ? TFromTemplateLiteral<Type> : Type extends TUnion<infer Types extends TSchema[]> ? TFromUnion$5<Types> : Type extends TLiteral<infer Value extends TLiteralValue> ? TFromLiteral<Value> : Type extends TNumber ? ['[number]'] : Type extends TInteger ? ['[number]'] : [ ]); type TFromRest$5<Types extends TSchema[], Key extends PropertyKey, Result extends TSchema[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromRest$5<Right, Key, [...Result, Assert<TIndexFromPropertyKey<Left, Key>, TSchema>]> : Result); type TFromIntersectRest<Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TNever ? TFromIntersectRest<Right, [...Result]> : TFromIntersectRest<Right, [...Result, Left]> : Result); type TFromIntersect$4<Types extends TSchema[], Key extends PropertyKey> = (TIntersectEvaluated<TFromIntersectRest<TFromRest$5<Types, Key>>>); type TFromUnionRest<Types extends TSchema[], Result extends TSchema[] = []> = Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TNever ? [] : TFromUnionRest<Right, [Left, ...Result]> : Result; type TFromUnion$4<Types extends TSchema[], Key extends PropertyKey> = (TUnionEvaluated<TFromUnionRest<TFromRest$5<Types, Key>>>); type TFromTuple$2<Types extends TSchema[], Key extends PropertyKey> = (Key extends keyof Types ? Types[Key] : Key extends '[number]' ? TUnionEvaluated<Types> : TNever); type TFromArray$2<Type extends TSchema, Key extends PropertyKey> = (Key extends '[number]' ? Type : TNever); type AssertPropertyKey<T> = Assert<T, string | number>; type TFromProperty<Properties extends TProperties, Key extends PropertyKey> = (Key extends keyof Properties ? Properties[Key] : `${AssertPropertyKey<Key>}` extends `${AssertPropertyKey<keyof Properties>}` ? Properties[AssertPropertyKey<Key>] : TNever); type TIndexFromPropertyKey<Type extends TSchema, Key extends PropertyKey> = (Type extends TRecursive<infer Type extends TSchema> ? TIndexFromPropertyKey<Type, Key> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromIntersect$4<Types, Key> : Type extends TUnion<infer Types extends TSchema[]> ? TFromUnion$4<Types, Key> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTuple$2<Types, Key> : Type extends TArray<infer Type extends TSchema> ? TFromArray$2<Type, Key> : Type extends TObject<infer Properties extends TProperties> ? TFromProperty<Properties, Key> : TNever); type TIndexFromPropertyKeys<Type extends TSchema, PropertyKeys extends PropertyKey[], Result extends TSchema[] = []> = (PropertyKeys extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? TIndexFromPropertyKeys<Type, Right, [...Result, Assert<TIndexFromPropertyKey<Type, Left>, TSchema>]> : Result); type FromSchema<Type extends TSchema, PropertyKeys extends PropertyKey[]> = (TUnionEvaluated<TIndexFromPropertyKeys<Type, PropertyKeys>>); declare function FromSchema<Type extends TSchema, PropertyKeys extends PropertyKey[]>(type: Type, propertyKeys: [...PropertyKeys]): FromSchema<Type, PropertyKeys>; type TIndex<Type extends TSchema, PropertyKeys extends PropertyKey[]> = (FromSchema<Type, PropertyKeys>); interface TIterator<T extends TSchema = TSchema> extends TSchema { [Kind]: 'Iterator'; static: IterableIterator<Static<T, this['params']>>; type: 'Iterator'; items: T; } interface TPromise<T extends TSchema = TSchema> extends TSchema { [Kind]: 'Promise'; static: Promise$1<Static<T, this['params']>>; type: 'Promise'; item: TSchema; } /** `[JavaScript]` Creates a Promise type */ declare function Promise$1<T extends TSchema>(item: T, options?: SchemaOptions): TPromise<T>; type TSetIncludes<T extends PropertyKey[], S extends PropertyKey> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? S extends L ? true : TSetIncludes<R, S> : false); type TSetIntersect<T extends PropertyKey[], S extends PropertyKey[], Acc extends PropertyKey[] = []> = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TSetIncludes<S, L> extends true ? TSetIntersect<R, S, [...Acc, L]> : TSetIntersect<R, S, [...Acc]> : Acc); type TSetUnion<T extends PropertyKey[], S extends PropertyKey[]> = ([ ...T, ...S ]); type TSetIntersectManyResolve<T extends PropertyKey[][], Acc extends PropertyKey[]> = (T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? TSetIntersectManyResolve<R, TSetIntersect<Acc, L>> : Acc); type TSetIntersectMany<T extends PropertyKey[][]> = (T extends [infer L extends PropertyKey[]] ? L : T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? TSetIntersectManyResolve<R, L> : []); type TSetUnionMany<T extends PropertyKey[][], Acc extends PropertyKey[] = []> = (T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? TSetUnionMany<R, TSetUnion<Acc, L>> : Acc); type TOptional<T extends TSchema> = T & { [OptionalKind]: 'Optional'; }; interface TRegExp extends TSchema { [Kind]: 'RegExp'; static: `${string}`; type: 'RegExp'; source: string; flags: string; } type TFromTemplateLiteralKeyInfinite<Key extends TTemplateLiteral, Type extends TSchema> = Ensure<TRecord<Key, Type>>; type TFromTemplateLiteralKeyFinite<Key extends TTemplateLiteral, Type extends TSchema, I extends string = Static<Key>> = (Ensure<TObject<Evaluate<{ [_ in I]: Type; }>>>); type TFromTemplateLiteralKey<Key extends TTemplateLiteral, Type extends TSchema> = TIsTemplateLiteralFinite<Key> extends false ? TFromTemplateLiteralKeyInfinite<Key, Type> : TFromTemplateLiteralKeyFinite<Key, Type>; type TFromEnumKey<Key extends Record$1<string, string | number>, Type extends TSchema> = Ensure<TObject<{ [_ in Key[keyof Key]]: Type; }>>; type TFromUnionKeyLiteralString<Key extends TLiteral<string>, Type extends TSchema> = { [_ in Key['const']]: Type; }; type TFromUnionKeyLiteralNumber<Key extends TLiteral<number>, Type extends TSchema> = { [_ in Key['const']]: Type; }; type TFromUnionKeyRest<Keys extends TSchema[], Type extends TSchema> = Keys extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? (Left extends TUnion<infer Types extends TSchema[]> ? TFromUnionKeyRest<Types, Type> & TFromUnionKeyRest<Right, Type> : Left extends TLiteral<string> ? TFromUnionKeyLiteralString<Left, Type> & TFromUnionKeyRest<Right, Type> : Left extends TLiteral<number> ? TFromUnionKeyLiteralNumber<Left, Type> & TFromUnionKeyRest<Right, Type> : {}) : {}; type TFromUnionKey<Key extends TSchema[], Type extends TSchema, P extends TProperties = TFromUnionKeyRest<Key, Type>> = (Ensure<TObject<Evaluate<P>>>); type TFromLiteralKey<Key extends TLiteralValue, Type extends TSchema> = (Ensure<TObject<{ [_ in Assert<Key, PropertyKey>]: Type; }>>); type TFromRegExpKey<_Key extends TRegExp, Type extends TSchema> = (Ensure<TRecord<TRegExp, Type>>); type TFromStringKey<_Key extends TString, Type extends TSchema> = (Ensure<TRecord<TString, Type>>); type TFromAnyKey<_Key extends TAny, Type extends TSchema> = (Ensure<TRecord<TAny, Type>>); type TFromNeverKey<_Key extends TNever, Type extends TSchema> = (Ensure<TRecord<TNever, Type>>); type TFromIntegerKey<_Key extends TSchema, Type extends TSchema> = (Ensure<TRecord<TNumber, Type>>); type TFromNumberKey<_Key extends TSchema, Type extends TSchema> = (Ensure<TRecord<TNumber, Type>>); type RecordStatic<Key extends TSchema, Type extends TSchema, P extends unknown[]> = (Evaluate<{ [_ in Assert<Static<Key>, PropertyKey>]: Static<Type, P>; }>); interface TRecord<Key extends TSchema = TSchema, Type extends TSchema = TSchema> extends TSchema { [Kind]: 'Record'; static: RecordStatic<Key, Type, this['params']>; type: 'object'; patternProperties: { [pattern: string]: Type; }; additionalProperties: TAdditionalProperties; } type TRecordOrObject<Key extends TSchema, Type extends TSchema> = (Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TComputed<'Record', [Key, TComputed<Target, Parameters>]> : Key extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TComputed<'Record', [TComputed<Target, Parameters>, Type]> : Key extends TRef<infer Ref extends string> ? TComputed<'Record', [TRef<Ref>, Type]> : Key extends TTemplateLiteral ? TFromTemplateLiteralKey<Key, Type> : Key extends TEnum<infer Enum extends TEnumRecord> ? TFromEnumKey<Enum, Type> : Key extends TUnion<infer Types extends TSchema[]> ? TFromUnionKey<Types, Type> : Key extends TLiteral<infer Value extends TLiteralValue> ? TFromLiteralKey<Value, Type> : Key extends TInteger ? TFromIntegerKey<Key, Type> : Key extends TNumber ? TFromNumberKey<Key, Type> : Key extends TRegExp ? TFromRegExpKey<Key, Type> : Key extends TString ? TFromStringKey<Key, Type> : Key extends TAny ? TFromAnyKey<Key, Type> : Key extends TNever ? TFromNeverKey<Key, Type> : TNever); /** `[Json]` Creates a Record type */ declare function Record$1<Key extends TSchema, Type extends TSchema>(key: Key, type: Type, options?: ObjectOptions): TRecordOrObject<Key, Type>; /** Creates a static type from a TypeBox type */ type Static<T extends TSchema, P extends unknown[] = []> = (T & { params: P; })['static']; type ReadonlyOptionalPropertyKeys$1<T extends TProperties> = { [K in keyof T]: T[K] extends TReadonly<TSchema> ? (T[K] extends TOptional<T[K]> ? K : never) : never; }[keyof T]; type ReadonlyPropertyKeys$1<T extends TProperties> = { [K in keyof T]: T[K] extends TReadonly<TSchema> ? (T[K] extends TOptional<T[K]> ? never : K) : never; }[keyof T]; type OptionalPropertyKeys$1<T extends TProperties> = { [K in keyof T]: T[K] extends TOptional<TSchema> ? (T[K] extends TReadonly<T[K]> ? never : K) : never; }[keyof T]; type RequiredPropertyKeys$1<T extends TProperties> = keyof Omit<T, ReadonlyOptionalPropertyKeys$1<T> | ReadonlyPropertyKeys$1<T> | OptionalPropertyKeys$1<T>>; type ObjectStaticProperties<T extends TProperties, R extends Record<keyof any, unknown>> = Evaluate<(Readonly<Partial<Pick<R, ReadonlyOptionalPropertyKeys$1<T>>>> & Readonly<Pick<R, ReadonlyPropertyKeys$1<T>>> & Partial<Pick<R, OptionalPropertyKeys$1<T>>> & Required<Pick<R, RequiredPropertyKeys$1<T>>>)>; type ObjectStatic<T extends TProperties, P extends unknown[]> = ObjectStaticProperties<T, { [K in keyof T]: Static<T[K], P>; }>; type TPropertyKey = string | number; type TProperties = Record<TPropertyKey, TSchema>; type TAdditionalProperties = undefined | TSchema | boolean; interface ObjectOptions extends SchemaOptions { /** Additional property constraints for this object */ additionalProperties?: TAdditionalProperties; /** The minimum number of properties allowed on this object */ minProperties?: number; /** The maximum number of properties allowed on this object */ maxProperties?: number; } interface TObject<T extends TProperties = TProperties> extends TSchema, ObjectOptions { [Kind]: 'Object'; static: ObjectStatic<T, this['params']>; additionalProperties?: TAdditionalProperties; type: 'object'; properties: T; required?: string[]; } type TupleToUnion<T extends any[]> = { [K in keyof T]: T[K]; }[number]; type UnionToIntersect<U> = (U extends unknown ? (arg: U) => 0 : never) extends (arg: infer I) => 0 ? I : never; type UnionLast<U> = UnionToIntersect<U extends unknown ? (x: U) => 0 : never> extends (x: infer L) => 0 ? L : never; type UnionToTuple<U, Acc extends unknown[] = [], R = UnionLast<U>> = [U] extends [never] ? Acc : UnionToTuple<Exclude<U, R>, [Extract<U, R>, ...Acc]>; type Assert<T, E> = T extends E ? T : never; type Evaluate<T> = T extends infer O ? { [K in keyof O]: O[K]; } : never; type Ensure<T> = T extends infer U ? U : never; type EmptyString = ''; type ZeroString = '0'; type IncrementBase = { m: '9'; t: '01'; '0': '1'; '1': '2'; '2': '3'; '3': '4'; '4': '5'; '5': '6'; '6': '7'; '7': '8'; '8': '9'; '9': '0'; }; type IncrementTake<T extends keyof IncrementBase> = IncrementBase[T]; type IncrementStep<T extends string> = T extends IncrementBase['m'] ? IncrementBase['t'] : T extends `${infer L extends keyof IncrementBase}${infer R}` ? L extends IncrementBase['m'] ? `${IncrementTake<L>}${IncrementStep<R>}` : `${IncrementTake<L>}${R}` : never; type IncrementReverse<T extends string> = T extends `${infer L}${infer R}` ? `${IncrementReverse<R>}${L}` : T; type TIncrement<T extends string> = IncrementReverse<IncrementStep<IncrementReverse<T>>>; interface ArrayOptions extends SchemaOptions { /** The minimum number of items in this array */ minItems?: number; /** The maximum number of items in this array */ maxItems?: number; /** Should this schema contain unique items */ uniqueItems?: boolean; /** A schema for which some elements should match */ contains?: TSchema; /** A minimum number of contains schema matches */ minContains?: number; /** A maximum number of contains schema matches */ maxContains?: number; } type ArrayStatic<T extends TSchema, P extends unknown[]> = Ensure<Static<T, P>[]>; interface TArray<T extends TSchema = TSchema> extends TSchema, ArrayOptions { [Kind]: 'Array'; static: ArrayStatic<T, this['params']>; type: 'array'; items: T; } interface SchemaOptions { $schema?: string; /** Id for this schema */ $id?: string; /** Title of this schema */ title?: string; /** Description of this schema */ description?: string; /** Default value for this schema */ default?: any; /** Example values matching this schema */ examples?: any; /** Optional annotation for readOnly */ readOnly?: boolean; /** Optional annotation for writeOnly */ writeOnly?: boolean; [prop: string]: any; } interface TKind { [Kind]: string; } interface TSchema extends TKind, SchemaOptions { [ReadonlyKind]?: string; [OptionalKind]?: string; [Hint]?: string; params: unknown[]; static: unknown; } type TFromComputed$4<Target extends string, Parameters extends TSchema[]> = Ensure<(TComputed<'Awaited', [TComputed<Target, Parameters>]>)>; type TFromRef$3<Ref extends string> = Ensure<TComputed<'Awaited', [TRef<Ref>]>>; type TFromRest$4<Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromRest$4<Right, [...Result, TAwaited<Left>]> : Result); type TAwaited<Type extends TSchema> = (Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed$4<Target, Parameters> : Type extends TRef<infer Ref extends string> ? TFromRef$3<Ref> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromRest$4<Types>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromRest$4<Types>> : Type extends TPromise<infer Type extends TSchema> ? TAwaited<Type> : Type); type TFromRest$3<Types extends TSchema[], Result extends PropertyKey[][] = []> = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest$3<R, [...Result, TKeyOfPropertyKeys<L>]> : Result); type TFromIntersect$3<Types extends TSchema[], PropertyKeysArray extends PropertyKey[][] = TFromRest$3<Types>, PropertyKeys extends PropertyKey[] = TSetUnionMany<PropertyKeysArray>> = PropertyKeys; type TFromUnion$3<Types extends TSchema[], PropertyKeysArray extends PropertyKey[][] = TFromRest$3<Types>, PropertyKeys extends PropertyKey[] = TSetIntersectMany<PropertyKeysArray>> = PropertyKeys; type TFromTuple$1<Types extends TSchema[], Indexer extends string = ZeroString, Acc extends PropertyKey[] = []> = Types extends [infer _ extends TSchema, ...infer R extends TSchema[]] ? TFromTuple$1<R, TIncrement<Indexer>, [...Acc, Indexer]> : Acc; type TFromArray$1<_ extends TSchema> = ([ '[number]' ]); type TFromProperties$7<Properties extends TProperties> = (UnionToTuple<keyof Properties>); type TKeyOfPropertyKeys<Type extends TSchema> = (Type extends TRecursive<infer Type extends TSchema> ? TKeyOfPropertyKeys<Type> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromIntersect$3<Types> : Type extends TUnion<infer Types extends TSchema[]> ? TFromUnion$3<Types> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTuple$1<Types> : Type extends TArray<infer Type extends TSchema> ? TFromArray$1<Type> : Type extends TObject<infer Properties extends TProperties> ? TFromProperties$7<Properties> : [ ]); type TFromComputed$3<Target extends string, Parameters extends TSchema[]> = Ensure<TComputed<'KeyOf', [TComputed<Target, Parameters>]>>; type TFromRef$2<Ref extends string> = Ensure<TComputed<'KeyOf', [TRef<Ref>]>>; /** `[Internal]` Used by KeyOfFromMappedResult */ type TKeyOfFromType<Type extends TSchema, PropertyKeys extends PropertyKey[] = TKeyOfPropertyKeys<Type>, PropertyKeyTypes extends TSchema[] = TKeyOfPropertyKeysToRest<PropertyKeys>, Result = TUnionEvaluated<PropertyKeyTypes>> = Ensure<Result>; type TKeyOfPropertyKeysToRest<PropertyKeys extends PropertyKey[], Result extends TSchema[] = []> = (PropertyKeys extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? L extends '[number]' ? TKeyOfPropertyKeysToRest<R, [...Result, TNumber]> : TKeyOfPropertyKeysToRest<R, [...Result, TLiteral<Assert<L, TLiteralValue>>]> : Result); type TKeyOf<Type extends TSchema> = (Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed$3<Target, Parameters> : Type extends TRef<infer Ref extends string> ? TFromRef$2<Ref> : Type extends TMappedResult ? TKeyOfFromMappedResult<Type> : TKeyOfFromType<Type>); type TFromProperties$6<Properties extends TProperties> = ({ [K2 in keyof Properties]: TKeyOfFromType<Properties[K2]>; }); type TFromMappedResult$2<MappedResult extends TMappedResult> = (Evaluate<TFromProperties$6<MappedResult['properties']>>); type TKeyOfFromMappedResult<MappedResult extends TMappedResult, Properties extends TProperties = TFromMappedResult$2<MappedResult>> = (Ensure<TMappedResult<Properties>>); type TFromProperties$5<Properties extends TProperties, PropertyKeys extends PropertyKey[]> = ({ [K2 in keyof Properties]: TOmit<Properties[K2], PropertyKeys>; }); type TFromMappedResult$1<MappedResult extends TMappedResult, PropertyKeys extends PropertyKey[]> = (Evaluate<TFromProperties$5<MappedResult['properties'], PropertyKeys>>); type TOmitFromMappedResult<MappedResult extends TMappedResult, PropertyKeys extends PropertyKey[], Properties extends TProperties = TFromMappedResult$1<MappedResult, PropertyKeys>> = (Ensure<TMappedResult<Properties>>); type TFromIntersect$2<Types extends TSchema[], PropertyKeys extends PropertyKey[], Result extends TSchema[] = []> = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromIntersect$2<R, PropertyKeys, [...Result, TOmit<L, PropertyKeys>]> : Result); type TFromUnion$2<T extends TSchema[], K extends PropertyKey[], Result extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromUnion$2<R, K, [...Result, TOmit<L, K>]> : Result); type TFromProperties$4<Properties extends TProperties, PropertyKeys extends PropertyKey[], UnionKey extends PropertyKey = TupleToUnion<PropertyKeys>> = (Evaluate<Omit$1<Properties, UnionKey>>); type TFromObject$4<Type extends TObject, PropertyKeys extends PropertyKey[], Properties extends TProperties = Type['properties']> = Ensure<TObject<(TFromProperties$4<Properties, PropertyKeys>)>>; type TUnionFromPropertyKeys$1<PropertyKeys extends PropertyKey[], Result extends TLiteral[] = []> = (PropertyKeys extends [infer Key extends PropertyKey, ...infer Rest extends PropertyKey[]] ? Key extends TLiteralValue ? TUnionFromPropertyKeys$1<Rest, [...Result, TLiteral<Key>]> : TUnionFromPropertyKeys$1<Rest, [...Result]> : TUnion<Result>); type TOmitResolve<Properties extends TProperties, PropertyKeys extends PropertyKey[]> = (Properties extends TRecursive<infer Types extends TSchema> ? TRecursive<TOmitResolve<Types, PropertyKeys>> : Properties extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromIntersect$2<Types, PropertyKeys>> : Properties extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromUnion$2<Types, PropertyKeys>> : Properties extends TObject<infer Types extends TProperties> ? TFromObject$4<TObject<Types>, PropertyKeys> : TObject<{}>); type TResolvePropertyKeys$1<Key extends TSchema | PropertyKey[]> = Key extends TSchema ? TIndexPropertyKeys<Key> : Key; type TResolveTypeKey$1<Key extends TSchema | PropertyKey[]> = Key extends PropertyKey[] ? TUnionFromPropertyKeys$1<Key> : Key; type TOmit<Type extends TSchema, Key extends TSchema | PropertyKey[], IsTypeRef extends boolean = Type extends TRef ? true : false, IsKeyRef extends boolean = Key extends TRef ? true : false> = (Type extends TMappedResult ? TOmitFromMappedResult<Type, TResolvePropertyKeys$1<Key>> : Key extends TMappedKey ? TOmitFromMappedKey<Type, Key> : [ IsTypeRef, IsKeyRef ] extends [true, true] ? TComputed<'Omit', [Type, TResolveTypeKey$1<Key>]> : [ IsTypeRef, IsKeyRef ] extends [false, true] ? TComputed<'Omit', [Type, TResolveTypeKey$1<Key>]> : [ IsTypeRef, IsKeyRef ] extends [true, false] ? TComputed<'Omit', [Type, TResolveTypeKey$1<Key>]> : TOmitResolve<Type, TResolvePropertyKeys$1<Key>>); /** `[Json]` Constructs a type whose keys are picked from the given type */ declare function Omit$1<Type extends TSchema, Key extends PropertyKey[]>(type: Type, key: readonly [...Key], options?: SchemaOptions): TOmit<Type, Key>; /** `[Json]` Constructs a type whose keys are picked from the given type */ declare function Omit$1<Type extends TSchema, Key extends TSchema>(type: Type, key: Key, options?: SchemaOptions): TOmit<Type, Key>; type TFromPropertyKey$1<Type extends TSchema, Key extends PropertyKey> = { [_ in Key]: TOmit<Type, [Key]>; }; type TFromPropertyKeys$1<Type extends TSchema, PropertyKeys extends PropertyKey[], Result extends TProperties = {}> = (PropertyKeys extends [infer LK extends PropertyKey, ...infer RK extends PropertyKey[]] ? TFromPropertyKeys$1<Type, RK, Result & TFromPropertyKey$1<Type, LK>> : Result); type TFromMappedKey$1<Type extends TSchema, MappedKey extends TMappedKey> = (TFromPropertyKeys$1<Type, MappedKey['keys']>); type TOmitFromMappedKey<Type extends TSchema, MappedKey extends TMappedKey, Properties extends TProperties = TFromMappedKey$1<Type, MappedKey>> = (TMappedResult<Properties>); type TFromProperties$3<Properties extends TProperties, PropertyKeys extends PropertyKey[]> = ({ [K2 in keyof Properties]: TPick<Properties[K2], PropertyKeys>; }); type TFromMappedResult<MappedResult extends TMappedResult, PropertyKeys extends PropertyKey[]> = (Evaluate<TFromProperties$3<MappedResult['properties'], PropertyKeys>>); type TPickFromMappedResult<MappedResult extends TMappedResult, PropertyKeys extends PropertyKey[], Properties extends TProperties = TFromMappedResult<MappedResult, PropertyKeys>> = (Ensure<TMappedResult<Properties>>); type TFromIntersect$1<Types extends TSchema[], PropertyKeys extends PropertyKey[], Result extends TSchema[] = []> = Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromIntersect$1<R, PropertyKeys, [...Result, TPick<L, PropertyKeys>]> : Result; type TFromUnion$1<Types extends TSchema[], PropertyKeys extends PropertyKey[], Result extends TSchema[] = []> = Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromUnion$1<R, PropertyKeys, [...Result, TPick<L, PropertyKeys>]> : Result; type TFromProperties$2<Properties extends TProperties, PropertyKeys extends PropertyKey[], UnionKeys extends PropertyKey = TupleToUnion<PropertyKeys>> = (Evaluate<Pick$1<Properties, UnionKeys & keyof Properties>>); type TFromObject$3<Type extends TObject, Key extends PropertyKey[], Properties extends TProperties = Type['properties']> = Ensure<TObject<(TFromProperties$2<Properties, Key>)>>; type TUnionFromPropertyKeys<PropertyKeys extends PropertyKey[], Result extends TLiteral[] = []> = (PropertyKeys extends [infer Key extends PropertyKey, ...infer Rest extends PropertyKey[]] ? Key extends TLiteralValue ? TUnionFromPropertyKeys<Rest, [...Result, TLiteral<Key>]> : TUnionFromPropertyKeys<Rest, [...Result]> : TUnion<Result>); type TPickResolve<Properties extends TProperties, PropertyKeys extends PropertyKey[]> = (Properties extends TRecursive<infer Types extends TSchema> ? TRecursive<TPickResolve<Types, PropertyKeys>> : Properties extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromIntersect$1<Types, PropertyKeys>> : Properties extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromUnion$1<Types, PropertyKeys>> : Properties extends TObject<infer Types extends TProperties> ? TFromObject$3<TObject<Types>, PropertyKeys> : TObject<{}>); type TResolvePropertyKeys<Key extends TSchema | PropertyKey[]> = Key extends TSchema ? TIndexPropertyKeys<Key> : Key; type TResolveTypeKey<Key extends TSchema | PropertyKey[]> = Key extends PropertyKey[] ? TUnionFromPropertyKeys<Key> : Key; type TPick<Type extends TSchema, Key extends TSchema | PropertyKey[], IsTypeRef extends boolean = Type extends TRef ? true : false, IsKeyRef extends boolean = Key extends TRef ? true : false> = (Type extends TMappedResult ? TPickFromMappedResult<Type, TResolvePropertyKeys<Key>> : Key extends TMappedKey ? TPickFromMappedKey<Type, Key> : [ IsTypeRef, IsKeyRef ] extends [true, true] ? TComputed<'Pick', [Type, TResolveTypeKey<Key>]> : [ IsTypeRef, IsKeyRef ] extends [false, true] ? TComputed<'Pick', [Type, TResolveTypeKey<Key>]> : [ IsTypeRef, IsKeyRef ] extends [true, false] ? TComputed<'Pick', [Type, TResolveTypeKey<Key>]> : TPickResolve<Type, TResolvePropertyKeys<Key>>); /** `[Json]` Constructs a type whose keys are picked from the given type */ declare function Pick$1<Type extends TSchema, Key extends PropertyKey[]>(type: Type, key: readonly [...Key], options?: SchemaOptions): TPick<Type, Key>; /** `[Json]` Constructs a type whose keys are picked from the given type */ declare function Pick$1<Type extends TSchema, Key extends TSchema>(type: Type, key: Key, options?: SchemaOptions): TPick<Type, Key>; type TFromPropertyKey<Type extends TSchema, Key extends PropertyKey> = { [_ in Key]: TPick<Type, [Key]>; }; type TFromPropertyKeys<Type extends TSchema, PropertyKeys extends PropertyKey[], Result extends TProperties = {}> = (PropertyKeys extends [infer LeftKey extends PropertyKey, ...infer RightKeys extends PropertyKey[]] ? TFromPropertyKeys<Type, RightKeys, Result & TFromPropertyKey<Type, LeftKey>> : Result); type TFromMappedKey<Type extends TSchema, MappedKey extends TMappedKey> = (TFromPropertyKeys<Type, MappedKey['keys']>); type TPickFromMappedKey<Type extends TSchema, MappedKey extends TMappedKey, Properties extends TProperties = TFromMappedKey<Type, MappedKey>> = (TMappedResult<Properties>); type TFromComputed$2<Target extends string, Parameters extends TSchema[]> = Ensure<TComputed<'Partial', [TComputed<Target, Parameters>]>>; type TFromRef$1<Ref extends string> = Ensure<TComputed<'Partial', [TRef<Ref>]>>; type TFromProperties$1<Properties extends TProperties> = Evaluate<{ [K in keyof Properties]: Properties[K] extends (TReadonlyOptional<infer S>) ? TReadonlyOptional<S> : Properties[K] extends (TReadonly<infer S>) ? TReadonlyOptional<S> : Properties[K] extends (TOptional<infer S>) ? TOptional<S> : TOptional<Properties[K]>; }>; type TFromObject$2<Type extends TObject, Properties extends TProperties = Type['properties']> = Ensure<TObject<(TFromProperties$1<Properties>)>>; type TFromRest$2<Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest$2<R, [...Result, TPartial<L>]> : Result); type TPartial<T extends TSchema> = (T extends TRecursive<infer Type extends TSchema> ? TRecursive<TPartial<Type>> : T extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed$2<Target, Parameters> : T extends TRef<infer Ref extends string> ? TFromRef$1<Ref> : T extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromRest$2<Types>> : T extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromRest$2<Types>> : T extends TObject<infer Properties extends TProperties> ? TFromObject$2<TObject<Properties>> : TObject<{}>); type TFromComputed$1<Target extends string, Parameters extends TSchema[]> = Ensure<TComputed<'Required', [TComputed<Target, Parameters>]>>; type TFromRef<Ref extends string> = Ensure<TComputed<'Required', [TRef<Ref>]>>; type TFromProperties<Properties extends TProperties> = Evaluate<{ [K in keyof Properties]: Properties[K] extends (TReadonlyOptional<infer S>) ? TReadonly<S> : Properties[K] extends (TReadonly<infer S>) ? TReadonly<S> : Properties[K] extends (TOptional<infer S>) ? S : Properties[K]; }>; type TFromObject$1<Type extends TObject, Properties extends TProperties = Type['properties']> = Ensure<TObject<(TFromProperties<Properties>)>>; type TFromRest$1<Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest$1<R, [...Result, TRequired<L>]> : Result); type TRequired<Type extends TSchema> = (Type extends TRecursive<infer Type extends TSchema> ? TRecursive<TRequired<Type>> : Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed$1<Target, Parameters> : Type extends TRef<infer Ref extends string> ? TFromRef<Ref> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromRest$1<Types>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromRest$1<Types>> : Type extends TObject<infer Properties extends TProperties> ? TFromObject$1<TObject<Properties>> : TObject<{}>); type TDerefParameters<ModuleProperties extends TProperties, Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TRef<infer Key extends string> ? TDerefParameters<ModuleProperties, Right, [...Result, TDeref<ModuleProperties, Key>]> : TDerefParameters<ModuleProperties, Right, [...Result, TFromType<ModuleProperties, Left>]> : Result); type TDeref<ModuleProperties extends TProperties, Ref extends string, Result extends TSchema = (Ref extends keyof ModuleProperties ? ModuleProperties[Ref] extends TRef<infer Ref2 extends string> ? TDeref<ModuleProperties, Ref2> : TFromType<ModuleProperties, ModuleProperties[Ref]> : TNever)> = Result; type TFromAwaited<Parameters extends TSchema[]> = (Parameters extends [infer T0 extends TSchema] ? TAwaited<T0> : never); type TFromIndex<Parameters extends TSchema[]> = (Parameters extends [infer T0 extends TSchema, infer T1 extends TSchema] ? TIndex<T0, TIndexPropertyKeys<T1>> extends infer Result extends TSchema ? Result : never : never); type TFromKeyOf<Parameters extends TSchema[]> = (Parameters extends [infer T0 extends TSchema] ? TKeyOf<T0> : never); type TFromPartial<Parameters extends TSchema[]> = (Parameters extends [infer T0 extends TSchema] ? TPartial<T0> : never); type TFromOmit<Parameters extends TSchema[]> = (Parameters extends [infer T0 extends TSchema, infer T1 extends TSchema] ? TOmit<T0, T1> : never); type TFromPick<Parameters extends TSchema[]> = (Parameters extends [infer T0 extends TSchema, infer T1 extends TSchema] ? TPick<T0, T1> : never); type TFromRecord<Parameters extends TSchema[]> = (Parameters extends [infer T0 extends TSchema, infer T1 extends TSchema] ? TRecordOrObject<T0, T1> : never); type TFromRequired<Parameters extends TSchema[]> = (Parameters extends [infer T0 extends TSchema] ? TRequired<T0> : never); type TFromComputed<ModuleProperties extends TProperties, Target extends string, Parameters extends TSchema[], Dereferenced extends TSchema[] = TDerefParameters<ModuleProperties, Parameters>> = (Target extends 'Awaited' ? TFromAwaited<Dereferenced> : Target extends 'Index' ? TFromIndex<Dereferenced> : Target extends 'KeyOf' ? TFromKeyOf<Dereferenced> : Target extends 'Partial' ? TFromPartial<Dereferenced> : Target extends 'Omit' ? TFromOmit<Dereferenced> : Target extends 'Pick' ? TFromPick<Dereferenced> : Target extends 'Record' ? TFromRecord<Dereferenced> : Target extends 'Required' ? TFromRequired<Dereferenced> : TNever); type TFromObject<ModuleProperties extends TProperties, Properties extends TProperties> = Ensure<TObject<Evaluate<{ [Key in keyof Properties]: TFromType<ModuleProperties, Properties[Key]>; }>>>; type TFromConstructor<ModuleProperties extends TProperties, Parameters extends TSchema[], InstanceType extends TSchema> = (TConstructor<TFromRest<ModuleProperties, Parameters>, TFromType<ModuleProperties, InstanceType>>); type TFromFunction<ModuleProperties extends TProperties, Parameters extends TSchema[], ReturnType extends TSchema> = Ensure<Ensure<TFunction<TFromRest<ModuleProperties, Parameters>, TFromType<ModuleProperties, ReturnType>>>>; type TFromTuple<ModuleProperties extends TProperties, Types extends TSchema[]> = (Ensure<TTuple<TFromRest<ModuleProperties, Types>>>); type TFromIntersect<ModuleProperties extends TProperties, Types extends TSchema[]> = (Ensure<TIntersectEvaluated<TFromRest<ModuleProperties, Types>>>); type TFromUnion<ModuleProperties extends TProperties, Types extends TSchema[]> = (Ensure<TUnionEvaluated<TFromRest<ModuleProperties, Types>>>); type TFromArray<ModuleProperties extends TProperties, Type extends TSchema> = (Ensure<TArray<TFromType<ModuleProperties, Type>>>); type TFromAsyncIterator<ModuleProperties extends TProperties, Type extends TSchema> = (TAsyncIterator<TFromType<ModuleProperties, Type>>); type TFromIterator<ModuleProperties extends TProperties, Type extends TSchema> = (TIterator<TFromType<ModuleProperties, Type>>); type TFromRest<ModuleProperties extends TProperties, Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromRest<ModuleProperties, Right, [...Result, TFromType<ModuleProperties, Left>]> : Result); type TFromType<ModuleProperties extends TProperties, Type extends TSchema> = (Type extends TOptional<infer Type extends TSchema> ? TOptional<TFromType<ModuleProperties, Type>> : Type extends TReadonly<infer Type extends TSchema> ? TReadonly<TFromType<ModuleProperties, Type>> : Type extends TArray<infer Type extends TSchema> ? TFromArray<ModuleProperties, Type> : Type extends TAsyncIterator<infer Type extends TSchema> ? TFromAsyncIterator<ModuleProperties, Type> : Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed<ModuleProperties, Target, Parameters> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TFromConstructor<ModuleProperties, Parameters, InstanceType> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFromFunction<ModuleProperties, Parameters, ReturnType> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromIntersect<ModuleProperties, Types> : Type extends TIterator<infer Type extends TSchema> ? TFromIterator<ModuleProperties, Type> : Type extends TObject<infer Properties extends TProperties> ? TFromObject<ModuleProperties, Properties> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTuple<ModuleProperties, Types> : Type extends TEnum<infer _ extends TEnumRecord> ? Type : Type extends TUnion<infer Types extends TSchema[]> ? TFromUnion<ModuleProperties, Types> : Type); type TComputeType<ModuleProperties extends TProperties, Key extends PropertyKey> = (Key extends keyo