{"version":3,"sources":["../../../src/utils/types.ts"],"sourcesContent":["export type DeepOmit<T, K, A = never> = T extends any[]\n\t? DeepOmit<T[number], K, A>[]\n\t: T extends (...args: any[]) => any\n\t\t? T\n\t\t: T extends Array<infer U>\n\t\t\t? DeepOmit<U, K, A>[]\n\t\t\t: {\n\t\t\t\t\t[P in keyof T as P extends K | A ? never : P]: DeepOmit<\n\t\t\t\t\t\tT[P],\n\t\t\t\t\t\tK extends `${Exclude<P, symbol>}.${infer R}` ? R : never,\n\t\t\t\t\t\tA\n\t\t\t\t\t>\n\t\t\t\t}\n\nexport type ConditionalObjectKeys<T> =\n\tT extends Array<infer I>\n\t\t? Array<ConditionalObjectKeys<I>>\n\t\t: T extends object\n\t\t\t? Prettify<\n\t\t\t\t\t{\n\t\t\t\t\t\t[K in keyof T as undefined extends T[K] ? never : K]: ConditionalObjectKeys<T[K]>\n\t\t\t\t\t} & {\n\t\t\t\t\t\t[K in keyof T as undefined extends T[K] ? K : never]?: ConditionalObjectKeys<T[K]>\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t: T\n\nexport class JSONRedacted<T> {\n\tprivate constructor (public value: T) {}\n\tvalueOf() {\n\t\treturn this.value\n\t}\n\ttoBSON() {\n\t\treturn this.value\n\t}\n\ttoJSON() {\n\t\treturn undefined as never\n\t}\n\tstatic from<T> (value: T | JSONRedacted<T>) {\n\t\tif (value instanceof JSONRedacted) return value\n\t\treturn new JSONRedacted(value)\n\t}\n}\n\ntype Format<T, Primitives, FactoryKey extends PropertyKey> = Prettify<\n\tIsAny<T> extends true\n\t\t? any\n\t\t: T extends Primitives\n\t\t\t? T\n\t\t\t: IsInUnion<T, undefined> extends true\n\t\t\t\t? Format<Exclude<T, undefined>, Primitives, FactoryKey> | undefined\n\t\t\t\t: T extends Array<infer U>\n\t\t\t\t\t? Format<U, Primitives, FactoryKey>[]\n\t\t\t\t\t: T extends Record<FactoryKey, (...args: any[]) => any>\n\t\t\t\t\t\t? Format<ReturnType<T[FactoryKey]>, Primitives, FactoryKey>\n\t\t\t\t\t\t: T extends Function\n\t\t\t\t\t\t\t? never\n\t\t\t\t\t\t\t: T extends object\n\t\t\t\t\t\t\t\t? ConditionalObjectKeys<{\n\t\t\t\t\t\t\t\t\t\t[K in keyof T as IsInTypeList<Format<T[K], Primitives, FactoryKey>, [never, undefined]> extends true\n\t\t\t\t\t\t\t\t\t\t\t? never\n\t\t\t\t\t\t\t\t\t\t\t: K]: Format<T[K], Primitives, FactoryKey>\n\t\t\t\t\t\t\t\t\t}>\n\t\t\t\t\t\t\t\t: never\n>\n\ntype JSONPrimitives = string | number | boolean | null\nexport type JSONValueOf<T> = Format<T, JSONPrimitives, 'toJSON'>\nexport type BSONValueOf<T> = Format<T, JSONPrimitives, 'toBSON'>\n\nexport type Prettify<T> =\n\tT extends Array<infer I>\n\t\t? Array<Prettify<I>>\n\t\t: IsClassInstance<T> extends true\n\t\t\t? T\n\t\t\t: T extends object\n\t\t\t\t? {\n\t\t\t\t\t\t[K in keyof T]: Prettify<T[K]>\n\t\t\t\t\t} & {}\n\t\t\t\t: T\n\nexport type EnumToStringUnion<T extends Record<string, string | number>> = `${T[keyof T]}`\n\nexport type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]> }\n\nexport type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : never\n\ntype IsInUnion<T, U> = U extends T ? true : false\nexport type IsInTypeList<T, L extends any[]> = L extends [infer First, ...infer Remaining]\n\t? IsType<First, T> extends true\n\t\t? true\n\t\t: IsInTypeList<T, Remaining>\n\t: false\n\ntype IsAny<T> = 0 extends 1 & T ? true : false\ntype CheckSameType<A, B> = Exclude<A, B> | Exclude<B, A> extends never ? true : false\nexport type IsType<A, B> = IsAny<A> extends true ? (IsAny<B> extends true ? true : CheckSameType<A, B>) : CheckSameType<A, B>\n\nexport type IsPlainObject<T> = T extends object\n\t? T extends (...args: any[]) => any\n\t\t? false\n\t\t: T extends any[]\n\t\t\t? false\n\t\t\t: T extends Date | RegExp | Error\n\t\t\t\t? false\n\t\t\t\t: true\n\t: false\n\nexport type IsClassInstance<T> = T extends object ? (IsPlainObject<T> extends true ? false : true) : false\n\ntype StopTypes = number | string | boolean | symbol | bigint | Date\ntype ExcludedTypes = (...args: any[]) => any\ntype Dot<T extends string, U extends string> = '' extends U ? T : `${T}.${U}`\nexport type Paths<T, D = never> = T extends StopTypes\n\t? ''\n\t: T extends object\n\t\t? {\n\t\t\t\t[K in keyof T & string]: T[K] extends StopTypes ? K : T[K] extends ExcludedTypes ? D : K | Dot<K, Paths<T[K]>>\n\t\t\t}[keyof T & string]\n\t\t: T extends readonly any[]\n\t\t\t? Paths<T[number]>\n\t\t\t: D\n\nexport interface JsonSchema {\n\t$ref?: string\n\t$refId?: string\n\ttype?: string | string[]\n\tformat?: string\n\tpattern?: string\n\tminimum?: number\n\tmaximum?: number\n\texclusiveMinimum?: number\n\texclusiveMaximum?: number\n\tminLength?: number\n\tmaxLength?: number\n\tminItems?: number\n\tmaxItems?: number\n\titems?: JsonSchema | JsonSchema[]\n\tproperties?: Record<string, JsonSchema>\n\trequired?: string[]\n\tadditionalProperties?: boolean | JsonSchema\n\tpropertyNames?: JsonSchema\n\tenum?: any[]\n\tanyOf?: JsonSchema[]\n\tallOf?: JsonSchema[]\n\toneOf?: JsonSchema[]\n\tconst?: any\n\tnot?: JsonSchema\n\ttitle?: string\n\tdescription?: string\n\tdefault?: any\n\texamples?: any[]\n\tcontentMediaType?: string | string[]\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GA2BO,MAAME,CAAgB,CACpB,YAAoBE,EAAU,CAAV,WAAAA,CAAW,CACvC,SAAU,CACT,OAAO,KAAK,KACb,CACA,QAAS,CACR,OAAO,KAAK,KACb,CACA,QAAS,CAET,CACA,OAAO,KAASA,EAA4B,CAC3C,OAAIA,aAAiBF,EAAqBE,EACnC,IAAIF,EAAaE,CAAK,CAC9B,CACD","names":["types_exports","__export","JSONRedacted","__toCommonJS","value"]}