Update app and tooling
This commit is contained in:
parent
3046531bdd
commit
e620ec7349
4950 changed files with 2975120 additions and 10 deletions
1
node_modules/json-schema-to-ts/lib/definitions/index.d.ts
generated
vendored
Normal file
1
node_modules/json-schema-to-ts/lib/definitions/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { JSONSchema6DefinitionWithoutInterface } from "./jsonSchema6";
|
||||
3
node_modules/json-schema-to-ts/lib/definitions/jsonSchema6.d.ts
generated
vendored
Normal file
3
node_modules/json-schema-to-ts/lib/definitions/jsonSchema6.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import { JSONSchema6Definition, JSONSchema6 } from "json-schema";
|
||||
import { Replace } from "../utils";
|
||||
export declare type JSONSchema6DefinitionWithoutInterface = JSONSchema6Definition extends infer S ? S extends JSONSchema6 ? Replace<S, "const" | "enum" | "not", unknown> : S : never;
|
||||
15
node_modules/json-schema-to-ts/lib/index.d.ts
generated
vendored
Normal file
15
node_modules/json-schema-to-ts/lib/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { JSONSchema6Definition } from "json-schema";
|
||||
import { JSONSchema6DefinitionWithoutInterface } from "./definitions";
|
||||
import { Resolve } from "./meta-types";
|
||||
import { ParseSchema } from "./parse-schema";
|
||||
import { DeepWriteable, DeepReadonly } from "./utils";
|
||||
/**
|
||||
* Unwided JSON schema (e.g. defined with the `as const` statement)
|
||||
*/
|
||||
export declare type JSONSchema = JSONSchema6Definition | DeepReadonly<JSONSchema6DefinitionWithoutInterface>;
|
||||
/**
|
||||
* Given a JSON schema defined with the `as const` statement, infers the type of valid instances
|
||||
*
|
||||
* @param S JSON schema
|
||||
*/
|
||||
export declare type FromSchema<S extends JSONSchema> = Resolve<ParseSchema<DeepWriteable<S>>>;
|
||||
5
node_modules/json-schema-to-ts/lib/meta-types/any.d.ts
generated
vendored
Normal file
5
node_modules/json-schema-to-ts/lib/meta-types/any.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
export declare type AnyType = "any";
|
||||
export declare type Any = {
|
||||
type: AnyType;
|
||||
};
|
||||
export declare type ResolveAny = unknown;
|
||||
9
node_modules/json-schema-to-ts/lib/meta-types/array.d.ts
generated
vendored
Normal file
9
node_modules/json-schema-to-ts/lib/meta-types/array.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { Get, Prettify } from "../utils";
|
||||
import { Resolve, Any } from ".";
|
||||
export declare type ArrType = "array";
|
||||
export declare type Arr<V = Any> = {
|
||||
type: ArrType;
|
||||
values: V;
|
||||
};
|
||||
export declare type Values<A> = Get<A, "values">;
|
||||
export declare type ResolveArr<T> = Prettify<Resolve<Values<T>>[]>;
|
||||
8
node_modules/json-schema-to-ts/lib/meta-types/const.d.ts
generated
vendored
Normal file
8
node_modules/json-schema-to-ts/lib/meta-types/const.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import { Get } from "../utils";
|
||||
export declare type ConstType = "const";
|
||||
export declare type Const<V> = {
|
||||
type: ConstType;
|
||||
value: V;
|
||||
};
|
||||
export declare type Value<C> = Get<C, "value">;
|
||||
export declare type ResolveConst<T> = Value<T>;
|
||||
10
node_modules/json-schema-to-ts/lib/meta-types/enum.d.ts
generated
vendored
Normal file
10
node_modules/json-schema-to-ts/lib/meta-types/enum.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { A, B } from "ts-toolbelt";
|
||||
import { Get } from "../utils";
|
||||
export declare type EnumType = "enum";
|
||||
export declare type Enum<V> = {
|
||||
type: EnumType;
|
||||
values: V;
|
||||
};
|
||||
export declare type Values<E> = Get<E, "values">;
|
||||
export declare type ResolveEnum<T> = Values<T>;
|
||||
export declare type IsEnumRepresentable<E> = A.Equals<Values<E>, never> extends B.True ? false : true;
|
||||
7
node_modules/json-schema-to-ts/lib/meta-types/error.d.ts
generated
vendored
Normal file
7
node_modules/json-schema-to-ts/lib/meta-types/error.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { Get } from "../utils";
|
||||
export declare type ErrorType = "error";
|
||||
export declare type Error<M = "Unknown error"> = {
|
||||
type: ErrorType;
|
||||
message: M;
|
||||
};
|
||||
export declare type Message<E> = Get<E, "message">;
|
||||
20
node_modules/json-schema-to-ts/lib/meta-types/exclusion/any.d.ts
generated
vendored
Normal file
20
node_modules/json-schema-to-ts/lib/meta-types/exclusion/any.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { Get } from "../../utils";
|
||||
import { MetaType, Never, Error } from "..";
|
||||
import { ExcludeUnion } from "./union";
|
||||
import { ExcludeIntersection } from "./intersection";
|
||||
import { ExcludeExclusion } from "./exclusion";
|
||||
export declare type ExcludeFromAny<Source, Excluded> = {
|
||||
any: Never;
|
||||
never: Source;
|
||||
const: Source;
|
||||
enum: Source;
|
||||
primitive: Source;
|
||||
array: Source;
|
||||
tuple: Source;
|
||||
object: Source;
|
||||
union: ExcludeUnion<Source, Excluded>;
|
||||
intersection: ExcludeIntersection<Source, Excluded>;
|
||||
exclusion: ExcludeExclusion<Source, Excluded>;
|
||||
error: Excluded;
|
||||
errorTypeProperty: Error<"Missing type property">;
|
||||
}[Get<Excluded, "type"> extends MetaType ? Get<Excluded, "type"> : "errorTypeProperty"];
|
||||
27
node_modules/json-schema-to-ts/lib/meta-types/exclusion/array.d.ts
generated
vendored
Normal file
27
node_modules/json-schema-to-ts/lib/meta-types/exclusion/array.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { A, B } from "ts-toolbelt";
|
||||
import { Get, And, DoesExtend } from "../../utils";
|
||||
import { MetaType, Never, Const, Error } from "..";
|
||||
import { Arr, Values } from "../array";
|
||||
import { Values as TupleValues, IsOpen, OpenProps } from "../tuple";
|
||||
import { Exclude } from ".";
|
||||
import { ExcludeUnion } from "./union";
|
||||
import { ExcludeIntersection } from "./intersection";
|
||||
import { ExcludeExclusion } from "./exclusion";
|
||||
import { IsRepresentable } from "../utils";
|
||||
export declare type ExcludeFromArray<Source, Excluded> = {
|
||||
any: Never;
|
||||
never: Source;
|
||||
const: Source;
|
||||
enum: Source;
|
||||
primitive: Source;
|
||||
array: ExcludeArrs<Source, Excluded>;
|
||||
tuple: And<DoesExtend<A.Equals<TupleValues<Excluded>, []>, B.True>, IsOpen<Excluded>> extends true ? ExcludeArrs<Source, Arr<OpenProps<Excluded>>> : Source;
|
||||
object: Source;
|
||||
union: ExcludeUnion<Source, Excluded>;
|
||||
intersection: ExcludeIntersection<Source, Excluded>;
|
||||
exclusion: ExcludeExclusion<Source, Excluded>;
|
||||
error: Excluded;
|
||||
errorTypeProperty: Error<"Missing type property">;
|
||||
}[Get<Excluded, "type"> extends MetaType ? Get<Excluded, "type"> : "errorTypeProperty"];
|
||||
declare type ExcludeArrs<Source, Excluded, ExcludedValues = Exclude<Values<Source>, Values<Excluded>>> = IsRepresentable<ExcludedValues> extends true ? Source : Const<[]>;
|
||||
export {};
|
||||
34
node_modules/json-schema-to-ts/lib/meta-types/exclusion/const.d.ts
generated
vendored
Normal file
34
node_modules/json-schema-to-ts/lib/meta-types/exclusion/const.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { Get, IsObject } from "../../utils";
|
||||
import { Resolve, MetaType, Never, Error } from "..";
|
||||
import { Const, Value } from "../const";
|
||||
import { Values, Required, IsOpen, OpenProps } from "../object";
|
||||
import { IsRepresentable } from "../utils";
|
||||
import { Exclude } from ".";
|
||||
import { ExcludeUnion } from "./union";
|
||||
import { ExcludeIntersection } from "./intersection";
|
||||
import { ExcludeExclusion } from "./exclusion";
|
||||
export declare type ExcludeFromConst<Source, Excluded> = {
|
||||
any: Never;
|
||||
never: Source;
|
||||
const: CheckNotExtendsResolved<Source, Excluded>;
|
||||
enum: CheckNotExtendsResolved<Source, Excluded>;
|
||||
primitive: CheckNotExtendsResolved<Source, Excluded>;
|
||||
array: CheckNotExtendsResolved<Source, Excluded>;
|
||||
tuple: CheckNotExtendsResolved<Source, Excluded>;
|
||||
object: ExcludeObject<Source, Excluded>;
|
||||
union: ExcludeUnion<Source, Excluded>;
|
||||
intersection: ExcludeIntersection<Source, Excluded>;
|
||||
exclusion: ExcludeExclusion<Source, Excluded>;
|
||||
error: Excluded;
|
||||
errorTypeProperty: Error<"Missing type property">;
|
||||
}[Get<Excluded, "type"> extends MetaType ? Get<Excluded, "type"> : "errorTypeProperty"];
|
||||
declare type CheckNotExtendsResolved<Source, Excluded> = Value<Source> extends Resolve<Excluded> ? Never : Source;
|
||||
declare type ExcludeObject<Source, Excluded> = IsObject<Value<Source>> extends true ? Required<Source> extends keyof Value<Source> ? ExcludeObjectFromConst<Source, Excluded> : Source : Source;
|
||||
declare type ExcludeObjectFromConst<Source, Excluded, ExcludedValues = ExcludeConstValues<Value<Source>, Excluded>> = RepresentableKeys<ExcludedValues> extends never ? Never : Source;
|
||||
declare type ExcludeConstValues<SourceValue, Excluded> = {
|
||||
[key in keyof SourceValue]: key extends keyof Values<Excluded> ? Exclude<Const<SourceValue[key]>, Values<Excluded>[key]> : IsOpen<Excluded> extends true ? Exclude<Const<SourceValue[key]>, OpenProps<Excluded>> : SourceValue[key];
|
||||
};
|
||||
declare type RepresentableKeys<O> = {
|
||||
[key in keyof O]: IsRepresentable<O[key]> extends true ? key : never;
|
||||
}[keyof O];
|
||||
export {};
|
||||
30
node_modules/json-schema-to-ts/lib/meta-types/exclusion/enum.d.ts
generated
vendored
Normal file
30
node_modules/json-schema-to-ts/lib/meta-types/exclusion/enum.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { A, B, U } from "ts-toolbelt";
|
||||
import { Get } from "../../utils";
|
||||
import { MetaType, Never, Const, Error } from "..";
|
||||
import { Enum, Values } from "../enum";
|
||||
import { Intersect } from "../intersection";
|
||||
import { IsRepresentable } from "../utils";
|
||||
import { Exclude } from ".";
|
||||
import { ExcludeUnion } from "./union";
|
||||
import { ExcludeIntersection } from "./intersection";
|
||||
import { ExcludeExclusion } from "./exclusion";
|
||||
export declare type ExcludeFromEnum<Source, Excluded> = {
|
||||
any: Never;
|
||||
never: Source;
|
||||
const: FilterExcluded<Source, Excluded>;
|
||||
enum: FilterExcluded<Source, Excluded>;
|
||||
primitive: FilterExcluded<Source, Excluded>;
|
||||
array: FilterExcluded<Source, Excluded>;
|
||||
tuple: FilterExcluded<Source, Excluded>;
|
||||
object: FilterExcluded<Source, Excluded>;
|
||||
union: ExcludeUnion<Source, Excluded>;
|
||||
intersection: ExcludeIntersection<Source, Excluded>;
|
||||
exclusion: ExcludeExclusion<Source, Excluded>;
|
||||
error: Excluded;
|
||||
errorTypeProperty: Error<"Missing type property">;
|
||||
}[Get<Excluded, "type"> extends MetaType ? Get<Excluded, "type"> : "errorTypeProperty"];
|
||||
declare type FilterExcluded<SourceEnum, Excluded> = Enum<RecurseOnEnumValues<Values<SourceEnum>, Excluded>>;
|
||||
declare type RecurseOnEnumValues<EnumValues, Excluded> = EnumValues extends infer EnumValue ? IsRepresentable<Exclude<Const<EnumValue>, Excluded>> extends false ? never : EnumValue : never;
|
||||
export declare type ExcludeEnum<Source, ExcludedEnum, ExcludedEnumValues = Values<ExcludedEnum>> = A.Equals<ExcludedEnumValues, never> extends B.True ? Source : ExcludeEnumValue<Source, U.Last<ExcludedEnumValues>, ExcludedEnumValues>;
|
||||
declare type ExcludeEnumValue<Source, LastEnumValue, ExcludedEnumValues> = Intersect<Exclude<Source, Const<LastEnumValue>>, Exclude<Source, Enum<U.Exclude<ExcludedEnumValues, LastEnumValue>>>>;
|
||||
export {};
|
||||
2
node_modules/json-schema-to-ts/lib/meta-types/exclusion/exclusion.d.ts
generated
vendored
Normal file
2
node_modules/json-schema-to-ts/lib/meta-types/exclusion/exclusion.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import { Exclude, Value, Excluded } from ".";
|
||||
export declare type ExcludeExclusion<Source, ExcludedExclusion> = Exclude<Source, Exclude<Value<ExcludedExclusion>, Excluded<ExcludedExclusion>>>;
|
||||
37
node_modules/json-schema-to-ts/lib/meta-types/exclusion/index.d.ts
generated
vendored
Normal file
37
node_modules/json-schema-to-ts/lib/meta-types/exclusion/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import { Get } from "../../utils";
|
||||
import { Resolve, MetaType, Never, Error } from "..";
|
||||
import { ClearIntersections } from "../intersection";
|
||||
import { ExcludeFromAny } from "./any";
|
||||
import { ExcludeFromConst } from "./const";
|
||||
import { ExcludeFromEnum } from "./enum";
|
||||
import { ExcludeFromPrimitive } from "./primitive";
|
||||
import { ExcludeFromArray } from "./array";
|
||||
import { ExcludeFromTuple } from "./tuple";
|
||||
import { ExcludeFromObject } from "./object";
|
||||
import { DistributeUnion } from "./union";
|
||||
import { IsRepresentable } from "../utils";
|
||||
export declare type ExclusionType = "exclusion";
|
||||
export declare type Exclusion<V, E> = {
|
||||
type: ExclusionType;
|
||||
value: V;
|
||||
excluded: E;
|
||||
};
|
||||
export declare type Value<E> = Get<E, "value">;
|
||||
export declare type Excluded<E> = Get<E, "excluded">;
|
||||
export declare type ResolveExclusion<E> = Resolve<Exclude<Value<E>, Excluded<E>>>;
|
||||
export declare type Exclude<A, B> = {
|
||||
any: ExcludeFromAny<A, B>;
|
||||
never: Never;
|
||||
const: ExcludeFromConst<A, B>;
|
||||
enum: ExcludeFromEnum<A, B>;
|
||||
primitive: ExcludeFromPrimitive<A, B>;
|
||||
array: ExcludeFromArray<A, B>;
|
||||
tuple: ExcludeFromTuple<A, B>;
|
||||
object: ExcludeFromObject<A, B>;
|
||||
union: DistributeUnion<A, B>;
|
||||
intersection: Exclude<ClearIntersections<A>, B>;
|
||||
exclusion: Exclude<Exclude<Value<A>, Excluded<A>>, B>;
|
||||
error: A;
|
||||
errorMissingType: Error<"Missing type property in Exclusion source value">;
|
||||
}[Get<A, "type"> extends MetaType ? Get<A, "type"> : "errorMissingType"];
|
||||
export declare type IsExclusionRepresentable<E> = IsRepresentable<Exclude<Value<E>, Excluded<E>>>;
|
||||
3
node_modules/json-schema-to-ts/lib/meta-types/exclusion/intersection.d.ts
generated
vendored
Normal file
3
node_modules/json-schema-to-ts/lib/meta-types/exclusion/intersection.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import { Exclude } from ".";
|
||||
import { ClearIntersections } from "../intersection";
|
||||
export declare type ExcludeIntersection<Source, ExcludedIntersection> = Exclude<Source, ClearIntersections<ExcludedIntersection>>;
|
||||
65
node_modules/json-schema-to-ts/lib/meta-types/exclusion/object.d.ts
generated
vendored
Normal file
65
node_modules/json-schema-to-ts/lib/meta-types/exclusion/object.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
import { A, B, U } from "ts-toolbelt";
|
||||
import { Get, And, Or, Not, DoesExtend, IsObject } from "../../utils";
|
||||
import { MetaType, Never, Error } from "..";
|
||||
import { Const, Value as ConstValue } from "../const";
|
||||
import { Object, Values, Value, Required, IsOpen, OpenProps } from "../object";
|
||||
import { IsRepresentable } from "../utils";
|
||||
import { Exclude } from ".";
|
||||
import { ExcludeEnum } from "./enum";
|
||||
import { ExcludeUnion } from "./union";
|
||||
import { ExcludeIntersection } from "./intersection";
|
||||
import { ExcludeExclusion } from "./exclusion";
|
||||
import { CrossValue, SourceValue, IsExclusionValueRepresentable, IsOutsideOfSourceScope, IsOutsideOfExcludedScope, Propagate, IsOmittable } from "./utils";
|
||||
export declare type ExcludeFromObject<S, E> = {
|
||||
any: Never;
|
||||
never: S;
|
||||
const: ExcludeConst<S, E>;
|
||||
enum: ExcludeEnum<S, E>;
|
||||
primitive: S;
|
||||
array: S;
|
||||
tuple: S;
|
||||
object: ExcludeObjects<S, E>;
|
||||
union: ExcludeUnion<S, E>;
|
||||
intersection: ExcludeIntersection<S, E>;
|
||||
exclusion: ExcludeExclusion<S, E>;
|
||||
error: E;
|
||||
errorTypeProperty: Error<"Missing type property">;
|
||||
}[Get<E, "type"> extends MetaType ? Get<E, "type"> : "errorTypeProperty"];
|
||||
declare type ExcludeObjects<S, E, C = CrossObjectValues<S, E>, R = RepresentableKeys<C>, P = Exclude<OpenProps<S>, OpenProps<E>>> = DoesObjectSizesMatch<S, E, C> extends true ? {
|
||||
moreThanTwo: S;
|
||||
onlyOne: PropagateExclusion<S, C>;
|
||||
none: OmitOmittableKeys<S, C>;
|
||||
}[And<IsOpen<S>, IsRepresentable<P>> extends true ? "moreThanTwo" : GetUnionLength<R>] : S;
|
||||
declare type CrossObjectValues<S, E> = {
|
||||
[key in keyof Values<S> | keyof Values<E> | Required<S> | Required<E>]: CrossValue<Value<S, key>, IsPossibleIn<S, key>, IsRequiredIn<S, key>, Value<E, key>, IsPossibleIn<E, key>, IsRequiredIn<E, key>>;
|
||||
};
|
||||
declare type GetUnionLength<Union> = A.Equals<Union, never> extends B.True ? "none" : A.Equals<U.Pop<Union>, never> extends B.True ? "onlyOne" : "moreThanTwo";
|
||||
declare type IsPossibleIn<O, K> = Or<DoesExtend<K, keyof Values<O>>, IsOpen<O>>;
|
||||
declare type IsRequiredIn<O, K> = DoesExtend<K, Required<O>>;
|
||||
declare type DoesObjectSizesMatch<S, E, C> = And<IsOpen<S>, Not<IsOpen<E>>> extends true ? false : And<IsExcludedSmallEnough<C>, IsExcludedBigEnough<C>>;
|
||||
declare type IsExcludedSmallEnough<C> = Not<DoesExtend<true, {
|
||||
[key in keyof C]: IsOutsideOfSourceScope<C[key]>;
|
||||
}[keyof C]>>;
|
||||
declare type IsExcludedBigEnough<C> = Not<DoesExtend<true, {
|
||||
[key in keyof C]: IsOutsideOfExcludedScope<C[key]>;
|
||||
}[keyof C]>>;
|
||||
declare type RepresentableKeys<C> = {
|
||||
[key in keyof C]: IsExclusionValueRepresentable<C[key]> extends true ? key : never;
|
||||
}[keyof C];
|
||||
declare type PropagateExclusion<S, C> = Object<{
|
||||
[key in keyof C]: Propagate<C[key]>;
|
||||
}, Required<S>, IsOpen<S>, OpenProps<S>>;
|
||||
declare type OmitOmittableKeys<S, C, K = OmittableKeys<C>> = {
|
||||
moreThanTwo: S;
|
||||
onlyOne: Object<{
|
||||
[key in keyof C]: key extends K ? Never : SourceValue<C[key]>;
|
||||
}, Required<S>, IsOpen<S>, OpenProps<S>>;
|
||||
none: Never;
|
||||
}[GetUnionLength<K>];
|
||||
declare type OmittableKeys<C> = {
|
||||
[key in keyof C]: IsOmittable<C[key]> extends true ? key : never;
|
||||
}[keyof C];
|
||||
declare type ExcludeConst<S, E, V = ConstValue<E>> = IsObject<V> extends true ? Exclude<S, Object<{
|
||||
[key in keyof V]: Const<V[key]>;
|
||||
}, keyof V, false, Never>> : S;
|
||||
export {};
|
||||
21
node_modules/json-schema-to-ts/lib/meta-types/exclusion/primitive.d.ts
generated
vendored
Normal file
21
node_modules/json-schema-to-ts/lib/meta-types/exclusion/primitive.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { Get } from "../../utils";
|
||||
import { MetaType, Never, Error } from "..";
|
||||
import { Value } from "../primitive";
|
||||
import { ExcludeUnion } from "./union";
|
||||
import { ExcludeIntersection } from "./intersection";
|
||||
import { ExcludeExclusion } from "./exclusion";
|
||||
export declare type ExcludeFromPrimitive<A, B> = {
|
||||
any: Never;
|
||||
never: A;
|
||||
const: A;
|
||||
enum: A;
|
||||
primitive: Value<A> extends Value<B> ? Never : A;
|
||||
array: A;
|
||||
tuple: A;
|
||||
object: A;
|
||||
union: ExcludeUnion<A, B>;
|
||||
intersection: ExcludeIntersection<A, B>;
|
||||
exclusion: ExcludeExclusion<A, B>;
|
||||
error: B;
|
||||
errorTypeProperty: Error<"Missing type property">;
|
||||
}[Get<B, "type"> extends MetaType ? Get<B, "type"> : "errorTypeProperty"];
|
||||
77
node_modules/json-schema-to-ts/lib/meta-types/exclusion/tuple.d.ts
generated
vendored
Normal file
77
node_modules/json-schema-to-ts/lib/meta-types/exclusion/tuple.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
import { A, B } from "ts-toolbelt";
|
||||
import { Get, And, Not, IsArray, Head, Tail, Prepend, Reverse } from "../../utils";
|
||||
import { MetaType, Never, Error } from "..";
|
||||
import { Const, Value as ConstValue } from "../const";
|
||||
import { Values as ArrayValues } from "../array";
|
||||
import { Tuple, Values, IsOpen, OpenProps } from "../tuple";
|
||||
import { IsRepresentable } from "../utils";
|
||||
import { Exclude } from ".";
|
||||
import { ExcludeEnum } from "./enum";
|
||||
import { ExcludeUnion } from "./union";
|
||||
import { ExcludeIntersection } from "./intersection";
|
||||
import { ExcludeExclusion } from "./exclusion";
|
||||
import { CrossValue, SourceValue, IsExclusionValueRepresentable, IsOutsideOfSourceScope, IsOutsideOfExcludedScope, Propagate, IsOmittable } from "./utils";
|
||||
export declare type ExcludeFromTuple<S, E> = {
|
||||
any: Never;
|
||||
never: S;
|
||||
const: ExcludeConst<S, E>;
|
||||
enum: ExcludeEnum<S, E>;
|
||||
primitive: S;
|
||||
array: ExcludeArray<S, E>;
|
||||
tuple: ExcludeTuples<S, E>;
|
||||
object: S;
|
||||
union: ExcludeUnion<S, E>;
|
||||
intersection: ExcludeIntersection<S, E>;
|
||||
exclusion: ExcludeExclusion<S, E>;
|
||||
error: E;
|
||||
errorMissingType: Error<"Missing type property in Exclusion excluded value">;
|
||||
}[Get<E, "type"> extends MetaType ? Get<E, "type"> : "errorMissingType"];
|
||||
declare type ExcludeArray<S, E> = ExcludeTuples<S, Tuple<[], true, ArrayValues<E>>>;
|
||||
declare type ExcludeTuples<S, E, C = CrossTupleValues<Values<S>, Values<E>, IsOpen<S>, IsOpen<E>, OpenProps<S>, OpenProps<E>>, R = RepresentableItems<C>, P = Exclude<OpenProps<S>, OpenProps<E>>, I = IsRepresentable<P>> = DoesTupleSizesMatch<S, E, C> extends true ? {
|
||||
moreThanTwo: S;
|
||||
onlyOne: Tuple<PropagateExclusion<C>, I extends true ? IsOpen<S> : false, P>;
|
||||
none: OmitOmittableItems<S, C>;
|
||||
}[And<IsOpen<S>, I> extends true ? "moreThanTwo" : GetTupleLength<R>] : S;
|
||||
declare type CrossTupleValues<V1, V2, O1, O2, P1, P2, R extends any[] = []> = {
|
||||
stop: Reverse<R>;
|
||||
continue1: CrossTupleValues<Tail<V1>, [], O1, O2, P1, P2, Prepend<CrossValue<Head<V1>, true, true, P2, O2, false>, R>>;
|
||||
continue2: CrossTupleValues<[], Tail<V2>, O1, O2, P1, P2, Prepend<CrossValue<P1, O1, false, Head<V2>, true, true>, R>>;
|
||||
continueBoth: CrossTupleValues<Tail<V1>, Tail<V2>, O1, O2, P1, P2, Prepend<CrossValue<Head<V1>, true, true, Head<V2>, true, true>, R>>;
|
||||
}[V1 extends [any, ...any[]] ? V2 extends [any, ...any[]] ? "continueBoth" : "continue1" : V2 extends [any, ...any[]] ? "continue2" : "stop"];
|
||||
declare type GetTupleLength<T> = A.Equals<T, []> extends B.True ? "none" : A.Equals<Tail<T>, []> extends B.True ? "onlyOne" : "moreThanTwo";
|
||||
declare type DoesTupleSizesMatch<S, E, C> = And<IsOpen<S>, Not<IsOpen<E>>> extends true ? false : And<IsExcludedSmallEnough<C>, IsExcludedBigEnough<C>>;
|
||||
declare type IsExcludedSmallEnough<C> = {
|
||||
stop: true;
|
||||
continue: IsOutsideOfSourceScope<Head<C>> extends true ? false : IsExcludedSmallEnough<Tail<C>>;
|
||||
}[C extends [any, ...any[]] ? "continue" : "stop"];
|
||||
declare type IsExcludedBigEnough<C> = {
|
||||
stop: true;
|
||||
continue: IsOutsideOfExcludedScope<Head<C>> extends true ? false : IsExcludedBigEnough<Tail<C>>;
|
||||
}[C extends [any, ...any[]] ? "continue" : "stop"];
|
||||
declare type RepresentableItems<C, R extends any[] = []> = {
|
||||
stop: R;
|
||||
continue: IsExclusionValueRepresentable<Head<C>> extends true ? RepresentableItems<Tail<C>, Prepend<Head<C>, R>> : RepresentableItems<Tail<C>, R>;
|
||||
}[C extends [any, ...any[]] ? "continue" : "stop"];
|
||||
declare type PropagateExclusion<C, R extends any[] = []> = {
|
||||
stop: Reverse<R>;
|
||||
continue: PropagateExclusion<Tail<C>, Prepend<Propagate<Head<C>>, R>>;
|
||||
}[C extends [any, ...any[]] ? "continue" : "stop"];
|
||||
declare type OmitOmittableItems<S, C, I = OmittableItems<C>> = {
|
||||
moreThanTwo: S;
|
||||
onlyOne: Tuple<RequiredTupleValues<S, C>, false, OpenProps<S>>;
|
||||
none: Never;
|
||||
}[GetTupleLength<I>];
|
||||
declare type OmittableItems<C, R extends any[] = []> = {
|
||||
stop: R;
|
||||
continue: IsOmittable<Head<C>> extends true ? OmittableItems<Tail<C>, Prepend<Head<C>, R>> : OmittableItems<Tail<C>, R>;
|
||||
}[C extends [any, ...any[]] ? "continue" : "stop"];
|
||||
declare type RequiredTupleValues<S, C, R extends any[] = []> = {
|
||||
stop: Reverse<R>;
|
||||
continue: IsOmittable<Head<C>> extends true ? Reverse<R> : RequiredTupleValues<Tail<S>, Tail<C>, Prepend<SourceValue<Head<C>>, R>>;
|
||||
}[C extends [any, ...any[]] ? "continue" : "stop"];
|
||||
declare type ExcludeConst<S, E, V = ConstValue<E>> = IsArray<V> extends true ? Exclude<S, Tuple<ExtractConstValues<V>, false, Never>> : S;
|
||||
declare type ExtractConstValues<V, R extends any[] = []> = {
|
||||
stop: Reverse<R>;
|
||||
continue: ExtractConstValues<Tail<V>, Prepend<Const<Head<V>>, R>>;
|
||||
}[V extends [any, ...any[]] ? "continue" : "stop"];
|
||||
export {};
|
||||
9
node_modules/json-schema-to-ts/lib/meta-types/exclusion/union.d.ts
generated
vendored
Normal file
9
node_modules/json-schema-to-ts/lib/meta-types/exclusion/union.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { A, B, U } from "ts-toolbelt";
|
||||
import { Union, Values } from "../union";
|
||||
import { Intersect } from "../intersection";
|
||||
import { Exclude } from ".";
|
||||
export declare type DistributeUnion<U, E> = Union<RecurseOnUnion<Values<U>, E>>;
|
||||
declare type RecurseOnUnion<V, E> = V extends infer T ? Exclude<T, E> : never;
|
||||
export declare type ExcludeUnion<V, U> = A.Equals<Values<U>, never> extends B.True ? V : ExcludeUnionValue<V, U.Last<Values<U>>, U>;
|
||||
declare type ExcludeUnionValue<V, L, U> = Intersect<Exclude<V, L>, Exclude<V, Union<U.Exclude<Values<U>, L>>>>;
|
||||
export {};
|
||||
24
node_modules/json-schema-to-ts/lib/meta-types/exclusion/utils.d.ts
generated
vendored
Normal file
24
node_modules/json-schema-to-ts/lib/meta-types/exclusion/utils.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { Get, And, Not } from "../../utils";
|
||||
import { IsRepresentable } from "../utils";
|
||||
import { Exclude } from ".";
|
||||
export declare type CrossValue<V1, P1, R1, V2, P2, R2, X = Exclude<V1, V2>> = {
|
||||
sourceValue: V1;
|
||||
isPossibleInSource: P1;
|
||||
isRequiredInSource: R1;
|
||||
isPossibleInExcluded: P2;
|
||||
isRequiredInExcluded: R2;
|
||||
exclusionValue: X;
|
||||
isExclusionValueRepresentable: IsRepresentable<X>;
|
||||
};
|
||||
export declare type SourceValue<C> = Get<C, "sourceValue">;
|
||||
declare type IsPossibleInSource<C> = Get<C, "isPossibleInSource">;
|
||||
declare type IsRequiredInSource<C> = Get<C, "isRequiredInSource">;
|
||||
declare type IsPossibleInExcluded<C> = Get<C, "isPossibleInExcluded">;
|
||||
declare type IsRequiredInExcluded<C> = Get<C, "isRequiredInExcluded">;
|
||||
export declare type ExclusionValue<C> = Get<C, "exclusionValue">;
|
||||
export declare type IsExclusionValueRepresentable<C> = Get<C, "isExclusionValueRepresentable">;
|
||||
export declare type IsOutsideOfSourceScope<C> = And<IsRequiredInExcluded<C>, Not<IsPossibleInSource<C>>>;
|
||||
export declare type IsOutsideOfExcludedScope<C> = And<IsRequiredInSource<C>, Not<IsPossibleInExcluded<C>>>;
|
||||
export declare type Propagate<C> = IsExclusionValueRepresentable<C> extends true ? ExclusionValue<C> : SourceValue<C>;
|
||||
export declare type IsOmittable<C> = And<Not<IsRequiredInSource<C>>, IsRequiredInExcluded<C>>;
|
||||
export {};
|
||||
29
node_modules/json-schema-to-ts/lib/meta-types/index.d.ts
generated
vendored
Normal file
29
node_modules/json-schema-to-ts/lib/meta-types/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { Get } from "../utils";
|
||||
import { Any, AnyType, ResolveAny } from "./any";
|
||||
import { Never, NeverType, ResolveNever } from "./never";
|
||||
import { Const, ConstType, ResolveConst } from "./const";
|
||||
import { Enum, EnumType, ResolveEnum } from "./enum";
|
||||
import { Primitive, PrimitiveType, ResolvePrimitive } from "./primitive";
|
||||
import { Arr, ArrType, ResolveArr } from "./array";
|
||||
import { Tuple, TupleType, ResolveTuple } from "./tuple";
|
||||
import { Object, ObjectType, ResolveObject } from "./object";
|
||||
import { Union, UnionType, ResolveUnion } from "./union";
|
||||
import { Intersection, IntersectionType, ResolveIntersection } from "./intersection";
|
||||
import { Error, ErrorType } from "./error";
|
||||
import { Exclusion, ExclusionType, ResolveExclusion } from "./exclusion";
|
||||
export declare type MetaType = AnyType | NeverType | ConstType | EnumType | PrimitiveType | ArrType | TupleType | ObjectType | UnionType | IntersectionType | ExclusionType | ErrorType;
|
||||
export declare type Resolve<T, D = Exclude<T, undefined>> = {
|
||||
any: ResolveAny;
|
||||
never: ResolveNever;
|
||||
const: ResolveConst<D>;
|
||||
enum: ResolveEnum<D>;
|
||||
primitive: ResolvePrimitive<D>;
|
||||
array: ResolveArr<D>;
|
||||
tuple: ResolveTuple<D>;
|
||||
object: ResolveObject<D>;
|
||||
union: ResolveUnion<D>;
|
||||
intersection: ResolveIntersection<D>;
|
||||
exclusion: ResolveExclusion<D>;
|
||||
error: never;
|
||||
}[Get<D, "type"> extends MetaType ? Get<D, "type"> : "error"];
|
||||
export { Any, Never, Const, Enum, Primitive, Arr, Tuple, Object, Union, Intersection, Exclusion, Error, };
|
||||
27
node_modules/json-schema-to-ts/lib/meta-types/intersection/array.d.ts
generated
vendored
Normal file
27
node_modules/json-schema-to-ts/lib/meta-types/intersection/array.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { Get } from "../../utils";
|
||||
import { MetaType, Never, Arr, Error } from "..";
|
||||
import { Values } from "../array";
|
||||
import { IntersectConst } from "./const";
|
||||
import { IntersectEnum } from "./enum";
|
||||
import { IntersectTuple } from "./tuple";
|
||||
import { IntersectUnion } from "./union";
|
||||
import { IntersectExclusion } from "./exclusion";
|
||||
import { ClearIntersections, Intersect } from "./index";
|
||||
export declare type ClearArrIntersections<A> = Arr<ClearIntersections<Values<A>>>;
|
||||
export declare type IntersectArr<A, B> = {
|
||||
any: A;
|
||||
never: Never;
|
||||
const: IntersectConst<B, A>;
|
||||
enum: IntersectEnum<B, A>;
|
||||
primitive: Never;
|
||||
array: IntersectArrs<A, B>;
|
||||
tuple: IntersectTuple<B, A>;
|
||||
object: Never;
|
||||
union: IntersectUnion<B, A>;
|
||||
exclusion: IntersectExclusion<B, A>;
|
||||
intersection: Error<"Cannot intersect intersection">;
|
||||
error: B;
|
||||
errorTypeProperty: Error<"Missing type property">;
|
||||
}[Get<B, "type"> extends MetaType ? Get<B, "type"> : "errorTypeProperty"];
|
||||
declare type IntersectArrs<A, B, I = Intersect<Values<A>, Values<B>>> = I extends Never ? Never : Arr<I>;
|
||||
export {};
|
||||
32
node_modules/json-schema-to-ts/lib/meta-types/intersection/const.d.ts
generated
vendored
Normal file
32
node_modules/json-schema-to-ts/lib/meta-types/intersection/const.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { Get, IsObject } from "../../utils";
|
||||
import { Resolve, MetaType, Never, Error } from "..";
|
||||
import { Const, Value } from "../const";
|
||||
import { Values, Required, IsOpen, OpenProps } from "../object";
|
||||
import { IntersectUnion } from "./union";
|
||||
import { IntersectExclusion } from "./exclusion";
|
||||
import { Intersect } from "./index";
|
||||
export declare type IntersectConst<A, B> = {
|
||||
any: A;
|
||||
never: Never;
|
||||
const: CheckExtendsResolved<A, B>;
|
||||
enum: CheckExtendsResolved<A, B>;
|
||||
primitive: CheckExtendsResolved<A, B>;
|
||||
array: CheckExtendsResolved<A, B>;
|
||||
tuple: CheckExtendsResolved<A, B>;
|
||||
object: ToObject<A, B>;
|
||||
union: IntersectUnion<B, A>;
|
||||
exclusion: IntersectExclusion<B, A>;
|
||||
intersection: Error<"Cannot intersect intersection">;
|
||||
error: B;
|
||||
errorTypeProperty: Error<"Missing type property">;
|
||||
}[Get<B, "type"> extends MetaType ? Get<B, "type"> : "errorTypeProperty"];
|
||||
declare type CheckExtendsResolved<A, B> = Value<A> extends Resolve<B> ? A : Never;
|
||||
declare type ToObject<A, B> = IsObject<Value<A>> extends true ? IntersectConstToObject<A, B> : Never;
|
||||
declare type IntersectConstToObject<A, B, V = IntersectConstValues<Value<A>, B>> = NeverKeys<V> extends never ? A : Never;
|
||||
declare type IntersectConstValues<V, B> = {
|
||||
[key in keyof V | Required<B>]: key extends keyof V ? key extends keyof Values<B> ? Intersect<Const<V[key]>, Values<B>[key]> : IsOpen<B> extends true ? Intersect<Const<V[key]>, OpenProps<B>> : Never : Never;
|
||||
};
|
||||
declare type NeverKeys<O> = {
|
||||
[key in keyof O]: O[key] extends Never ? key : never;
|
||||
}[keyof O];
|
||||
export {};
|
||||
25
node_modules/json-schema-to-ts/lib/meta-types/intersection/enum.d.ts
generated
vendored
Normal file
25
node_modules/json-schema-to-ts/lib/meta-types/intersection/enum.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { Get } from "../../utils";
|
||||
import { MetaType, Never, Const, Error } from "..";
|
||||
import { Enum, Values } from "../enum";
|
||||
import { IntersectConst } from "./const";
|
||||
import { IntersectUnion } from "./union";
|
||||
import { IntersectExclusion } from "./exclusion";
|
||||
import { Intersect } from "./index";
|
||||
export declare type IntersectEnum<A, B> = {
|
||||
any: A;
|
||||
never: Never;
|
||||
const: IntersectConst<B, A>;
|
||||
enum: FilterUnintersecting<A, B>;
|
||||
primitive: FilterUnintersecting<A, B>;
|
||||
array: FilterUnintersecting<A, B>;
|
||||
tuple: FilterUnintersecting<A, B>;
|
||||
object: FilterUnintersecting<A, B>;
|
||||
union: IntersectUnion<B, A>;
|
||||
exclusion: IntersectExclusion<B, A>;
|
||||
intersection: Error<"Cannot intersect intersection">;
|
||||
error: B;
|
||||
errorTypeProperty: Error<"Missing type property">;
|
||||
}[Get<B, "type"> extends MetaType ? Get<B, "type"> : "errorTypeProperty"];
|
||||
declare type FilterUnintersecting<A, B> = Enum<RecurseOnEnumValues<Values<A>, B>>;
|
||||
declare type RecurseOnEnumValues<V, B> = V extends infer T ? Intersect<Const<T>, B> extends Never ? never : T : never;
|
||||
export {};
|
||||
21
node_modules/json-schema-to-ts/lib/meta-types/intersection/exclusion.d.ts
generated
vendored
Normal file
21
node_modules/json-schema-to-ts/lib/meta-types/intersection/exclusion.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { Get } from "../../utils";
|
||||
import { MetaType, Never, Error, Union } from "..";
|
||||
import { Exclusion, Value, Excluded } from "../exclusion";
|
||||
import { IntersectUnion } from "./union";
|
||||
import { ClearIntersections, Intersect } from "./index";
|
||||
export declare type ClearExclusionIntersections<A> = Exclusion<ClearIntersections<Value<A>>, ClearIntersections<Excluded<A>>>;
|
||||
export declare type IntersectExclusion<A, B> = {
|
||||
any: A;
|
||||
never: Never;
|
||||
const: Exclusion<Intersect<Value<A>, B>, Excluded<A>>;
|
||||
enum: Exclusion<Intersect<Value<A>, B>, Excluded<A>>;
|
||||
primitive: Exclusion<Intersect<Value<A>, B>, Excluded<A>>;
|
||||
array: Exclusion<Intersect<Value<A>, B>, Excluded<A>>;
|
||||
tuple: Exclusion<Intersect<Value<A>, B>, Excluded<A>>;
|
||||
object: Exclusion<Intersect<Value<A>, B>, Excluded<A>>;
|
||||
union: IntersectUnion<B, A>;
|
||||
intersection: Error<"Cannot intersect intersection">;
|
||||
exclusion: Exclusion<Intersect<Value<A>, Value<B>>, Union<Excluded<A> | Excluded<B>>>;
|
||||
error: B;
|
||||
errorTypeProperty: Error<"Missing type property">;
|
||||
}[Get<B, "type"> extends MetaType ? Get<B, "type"> : "errorTypeProperty"];
|
||||
53
node_modules/json-schema-to-ts/lib/meta-types/intersection/index.d.ts
generated
vendored
Normal file
53
node_modules/json-schema-to-ts/lib/meta-types/intersection/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
import { DoesExtend, Get } from "../../utils";
|
||||
import { Resolve, MetaType, Never, Error } from "..";
|
||||
import { ErrorType } from "../error";
|
||||
import { IntersectConst } from "./const";
|
||||
import { IntersectEnum } from "./enum";
|
||||
import { IntersectPrimitive } from "./primitive";
|
||||
import { ClearArrIntersections, IntersectArr } from "./array";
|
||||
import { ClearTupleIntersections, IntersectTuple } from "./tuple";
|
||||
import { ClearObjectIntersections, IntersectObject } from "./object";
|
||||
import { ClearUnionIntersections, IntersectUnion } from "./union";
|
||||
import { ClearExclusionIntersections, IntersectExclusion } from "./exclusion";
|
||||
import { IsRepresentable } from "../utils";
|
||||
export declare type IntersectionType = "intersection";
|
||||
export declare type Intersection<L, R> = {
|
||||
type: IntersectionType;
|
||||
left: L;
|
||||
right: R;
|
||||
};
|
||||
export declare type IsIntersection<I> = DoesExtend<Get<I, "type">, IntersectionType>;
|
||||
export declare type Left<I> = Get<I, "left">;
|
||||
export declare type Right<I> = Get<I, "right">;
|
||||
export declare type ResolveIntersection<T> = Resolve<ClearIntersections<T>>;
|
||||
export declare type ClearIntersections<T> = {
|
||||
any: T;
|
||||
never: T;
|
||||
const: T;
|
||||
enum: T;
|
||||
primitive: T;
|
||||
array: ClearArrIntersections<T>;
|
||||
tuple: ClearTupleIntersections<T>;
|
||||
object: ClearObjectIntersections<T>;
|
||||
union: ClearUnionIntersections<T>;
|
||||
intersection: Intersect<ClearIntersections<Left<T>>, ClearIntersections<Right<T>>>;
|
||||
exclusion: ClearExclusionIntersections<T>;
|
||||
error: T;
|
||||
errorMissingType: Error<"Missing type property">;
|
||||
}[Get<T, "type"> extends MetaType ? Get<T, "type"> : "errorMissingType"];
|
||||
export declare type Intersect<A, B> = {
|
||||
any: B;
|
||||
never: Get<B, "type"> extends ErrorType ? B : Never;
|
||||
const: IntersectConst<A, B>;
|
||||
enum: IntersectEnum<A, B>;
|
||||
primitive: IntersectPrimitive<A, B>;
|
||||
array: IntersectArr<A, B>;
|
||||
tuple: IntersectTuple<A, B>;
|
||||
object: IntersectObject<A, B>;
|
||||
union: IntersectUnion<A, B>;
|
||||
intersection: Error<"Cannot intersect intersection">;
|
||||
exclusion: IntersectExclusion<A, B>;
|
||||
error: A;
|
||||
errorMissingType: Error<"Missing type property">;
|
||||
}[Get<A, "type"> extends MetaType ? Get<A, "type"> : "errorMissingType"];
|
||||
export declare type IsIntersectionRepresentable<A> = IsRepresentable<ClearIntersections<A>>;
|
||||
40
node_modules/json-schema-to-ts/lib/meta-types/intersection/object.d.ts
generated
vendored
Normal file
40
node_modules/json-schema-to-ts/lib/meta-types/intersection/object.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import { Get, And } from "../../utils";
|
||||
import { MetaType, Never, Error } from "..";
|
||||
import { Object, Values, Required, IsOpen, OpenProps } from "../object";
|
||||
import { IntersectConst } from "./const";
|
||||
import { IntersectEnum } from "./enum";
|
||||
import { DistributeIntersection } from "./union";
|
||||
import { IntersectExclusion } from "./exclusion";
|
||||
import { ClearIntersections, Intersect } from "./index";
|
||||
export declare type ClearObjectIntersections<A, V = ClearObjectValuesIntersections<Values<A>>, N = NeverKeys<V>, O = ClearIntersections<OpenProps<A>>> = Required<A> extends Exclude<Required<A>, N> ? Object<{
|
||||
[key in Exclude<keyof V, N>]: V[key];
|
||||
}, Required<A>, O extends Never ? false : IsOpen<A>, O> : Never;
|
||||
declare type ClearObjectValuesIntersections<V> = {
|
||||
[key in keyof V]: ClearIntersections<V[key]>;
|
||||
};
|
||||
export declare type IntersectObject<A, B> = {
|
||||
any: A;
|
||||
never: Never;
|
||||
const: IntersectConst<B, A>;
|
||||
enum: IntersectEnum<B, A>;
|
||||
primitive: Never;
|
||||
array: Never;
|
||||
tuple: Never;
|
||||
object: IntersectObjects<A, B>;
|
||||
union: DistributeIntersection<B, A>;
|
||||
intersection: Error<"Cannot intersect intersection">;
|
||||
exclusion: IntersectExclusion<B, A>;
|
||||
error: B;
|
||||
errorTypeProperty: Error<"Missing type property">;
|
||||
}[Get<B, "type"> extends MetaType ? Get<B, "type"> : "errorTypeProperty"];
|
||||
declare type IntersectObjects<A, B, V = IntersectValues<A, B>, N = NeverKeys<V>, O = IntersectOpenProps<A, B>> = Required<A> | Required<B> extends Exclude<Required<A> | Required<B>, N> ? Object<{
|
||||
[key in Exclude<keyof V, N>]: V[key];
|
||||
}, Required<A> | Required<B>, O extends Never ? false : And<IsOpen<A>, IsOpen<B>>, O> : Never;
|
||||
declare type IntersectValues<A, B> = {
|
||||
[key in keyof Values<A> | keyof Values<B>]: key extends keyof Values<A> ? key extends keyof Values<B> ? Intersect<Values<A>[key], Values<B>[key]> : IsOpen<B> extends true ? Intersect<Values<A>[key], OpenProps<B>> : Never : key extends keyof Values<B> ? IsOpen<A> extends true ? Intersect<OpenProps<A>, Values<B>[key]> : Never : Never;
|
||||
};
|
||||
declare type NeverKeys<O> = {
|
||||
[key in keyof O]: O[key] extends Never ? key : never;
|
||||
}[keyof O];
|
||||
declare type IntersectOpenProps<A, B> = Intersect<OpenProps<A>, OpenProps<B>>;
|
||||
export {};
|
||||
22
node_modules/json-schema-to-ts/lib/meta-types/intersection/primitive.d.ts
generated
vendored
Normal file
22
node_modules/json-schema-to-ts/lib/meta-types/intersection/primitive.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { Get } from "../../utils";
|
||||
import { MetaType, Never, Error } from "..";
|
||||
import { Value } from "../primitive";
|
||||
import { IntersectConst } from "./const";
|
||||
import { IntersectEnum } from "./enum";
|
||||
import { IntersectExclusion } from "./exclusion";
|
||||
import { Intersect } from ".";
|
||||
export declare type IntersectPrimitive<A, B> = {
|
||||
any: A;
|
||||
never: Never;
|
||||
const: IntersectConst<B, A>;
|
||||
enum: IntersectEnum<B, A>;
|
||||
primitive: Value<A> extends Value<B> ? A : Value<B> extends Value<A> ? B : Never;
|
||||
array: Never;
|
||||
tuple: Never;
|
||||
object: Never;
|
||||
union: Intersect<B, A>;
|
||||
intersection: Error<"Cannot intersect intersection">;
|
||||
exclusion: IntersectExclusion<B, A>;
|
||||
error: B;
|
||||
errorTypeProperty: Error<"Missing type property">;
|
||||
}[Get<B, "type"> extends MetaType ? Get<B, "type"> : "errorTypeProperty"];
|
||||
46
node_modules/json-schema-to-ts/lib/meta-types/intersection/tuple.d.ts
generated
vendored
Normal file
46
node_modules/json-schema-to-ts/lib/meta-types/intersection/tuple.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import { Get, Head, Tail, Prepend, Reverse, And } from "../../utils";
|
||||
import { MetaType, Never, Tuple, Error } from "..";
|
||||
import { Values as ArrValues } from "../array";
|
||||
import { Values, IsOpen, OpenProps } from "../tuple";
|
||||
import { IntersectConst } from "./const";
|
||||
import { IntersectEnum } from "./enum";
|
||||
import { DistributeIntersection } from "./union";
|
||||
import { IntersectExclusion } from "./exclusion";
|
||||
import { ClearIntersections, Intersect } from ".";
|
||||
export declare type ClearTupleIntersections<T, O = ClearIntersections<OpenProps<T>>> = Tuple<ClearTupleValuesIntersections<Values<T>>, O extends Never ? false : IsOpen<T>, O>;
|
||||
declare type ClearTupleValuesIntersections<V, R extends any[] = []> = {
|
||||
stop: Reverse<R>;
|
||||
continue: ClearTupleValuesIntersections<Tail<V>, Prepend<ClearIntersections<Head<V>>, R>>;
|
||||
}[V extends [any, ...any[]] ? "continue" : "stop"];
|
||||
export declare type IntersectTuple<A, B> = {
|
||||
any: A;
|
||||
never: Never;
|
||||
const: IntersectConst<B, A>;
|
||||
enum: IntersectEnum<B, A>;
|
||||
primitive: Never;
|
||||
array: IntersectTupleToArray<A, B>;
|
||||
tuple: IntersectTuples<A, B>;
|
||||
object: Never;
|
||||
union: DistributeIntersection<B, A>;
|
||||
intersection: Error<"Cannot intersect intersection">;
|
||||
exclusion: IntersectExclusion<B, A>;
|
||||
error: B;
|
||||
errorTypeProperty: Error<"Missing type property">;
|
||||
}[Get<B, "type"> extends MetaType ? Get<B, "type"> : "errorTypeProperty"];
|
||||
declare type IntersectTupleToArray<T, A, V = IntersectTupleToArrValues<Values<T>, ArrValues<A>>, N = HasNeverValue<V>, O = Intersect<OpenProps<T>, ArrValues<A>>> = N extends true ? Never : Tuple<V, IsOpen<T> extends true ? (O extends Never ? false : true) : false, O>;
|
||||
declare type IntersectTupleToArrValues<V, T, R = []> = {
|
||||
stop: Reverse<R>;
|
||||
continue: R extends any[] ? IntersectTupleToArrValues<Tail<V>, T, Prepend<Intersect<Head<V>, T>, R>> : never;
|
||||
}[V extends [any, ...any[]] ? "continue" : "stop"];
|
||||
declare type HasNeverValue<V, R = false> = {
|
||||
stop: R;
|
||||
continue: Head<V> extends Never ? true : HasNeverValue<Tail<V>>;
|
||||
}[V extends [any, ...any[]] ? "continue" : "stop"];
|
||||
declare type IntersectTuples<A, B, V = IntersectTupleValues<Values<A>, Values<B>, IsOpen<A>, IsOpen<B>, OpenProps<A>, OpenProps<B>>, N = HasNeverValue<V>, O = Intersect<OpenProps<A>, OpenProps<B>>> = N extends true ? Never : Tuple<V, O extends Never ? false : And<IsOpen<A>, IsOpen<B>>, O>;
|
||||
declare type IntersectTupleValues<V1, V2, O1, O2, P1, P2, R extends any[] = []> = {
|
||||
stop: Reverse<R>;
|
||||
continue1: IntersectTupleValues<Tail<V1>, V2, O1, O2, P1, P2, Prepend<O2 extends true ? Intersect<Head<V1>, P2> : Never, R>>;
|
||||
continue2: IntersectTupleValues<V1, Tail<V2>, O1, O2, P1, P2, Prepend<O1 extends true ? Intersect<Head<V2>, P1> : Never, R>>;
|
||||
continueBoth: IntersectTupleValues<Tail<V1>, Tail<V2>, O1, O2, P1, P2, Prepend<Intersect<Head<V1>, Head<V2>>, R>>;
|
||||
}[V1 extends [any, ...any[]] ? V2 extends [any, ...any[]] ? "continueBoth" : "continue1" : V2 extends [any, ...any[]] ? "continue2" : "stop"];
|
||||
export {};
|
||||
24
node_modules/json-schema-to-ts/lib/meta-types/intersection/union.d.ts
generated
vendored
Normal file
24
node_modules/json-schema-to-ts/lib/meta-types/intersection/union.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { Get } from "../../utils";
|
||||
import { MetaType, Never, Error } from "..";
|
||||
import { Union, Values } from "../union";
|
||||
import { ClearIntersections, Intersect } from "./index";
|
||||
export declare type ClearUnionIntersections<A> = Union<ClearUnionValuesIntersections<Values<A>>>;
|
||||
declare type ClearUnionValuesIntersections<V> = V extends infer T ? ClearIntersections<T> : never;
|
||||
export declare type IntersectUnion<A, B> = {
|
||||
any: A;
|
||||
never: Never;
|
||||
const: DistributeIntersection<A, B>;
|
||||
enum: DistributeIntersection<A, B>;
|
||||
primitive: DistributeIntersection<A, B>;
|
||||
array: DistributeIntersection<A, B>;
|
||||
tuple: DistributeIntersection<A, B>;
|
||||
object: DistributeIntersection<A, B>;
|
||||
union: DistributeIntersection<A, B>;
|
||||
exclusion: DistributeIntersection<A, B>;
|
||||
intersection: Error<"Cannot intersect intersection">;
|
||||
error: B;
|
||||
errorTypeProperty: Error<"Missing type property">;
|
||||
}[Get<B, "type"> extends MetaType ? Get<B, "type"> : "errorTypeProperty"];
|
||||
export declare type DistributeIntersection<A, B> = Union<RecurseOnUnion<Values<A>, B>>;
|
||||
declare type RecurseOnUnion<V, B> = V extends infer T ? Intersect<T, B> : never;
|
||||
export {};
|
||||
5
node_modules/json-schema-to-ts/lib/meta-types/never.d.ts
generated
vendored
Normal file
5
node_modules/json-schema-to-ts/lib/meta-types/never.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
export declare type NeverType = "never";
|
||||
export declare type Never = {
|
||||
type: NeverType;
|
||||
};
|
||||
export declare type ResolveNever = never;
|
||||
34
node_modules/json-schema-to-ts/lib/meta-types/object.d.ts
generated
vendored
Normal file
34
node_modules/json-schema-to-ts/lib/meta-types/object.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { A, B } from "ts-toolbelt";
|
||||
import { DoesExtend, Or, Not, Get, DeepMergeUnsafe } from "../utils";
|
||||
import { Resolve, Any, Never } from ".";
|
||||
import { IsRepresentable } from "./utils";
|
||||
export declare type ObjectType = "object";
|
||||
export declare type Object<V = {}, R = never, O = true, P = Any> = {
|
||||
type: ObjectType;
|
||||
values: V;
|
||||
required: R;
|
||||
isOpen: O;
|
||||
openProps: P;
|
||||
};
|
||||
export declare type Values<O> = Get<O, "values">;
|
||||
export declare type Value<O, K> = K extends keyof Values<O> ? Values<O>[K] : IsOpen<O> extends true ? OpenProps<O> : Never;
|
||||
export declare type Required<O> = Get<O, "required"> extends string ? Get<O, "required"> : never;
|
||||
export declare type IsOpen<O> = Get<O, "isOpen">;
|
||||
export declare type OpenProps<O> = Get<O, "openProps">;
|
||||
declare type IsEmpty<O> = DoesExtend<Extract<keyof Values<O>, keyof Values<O>>, never>;
|
||||
export declare type ResolveObject<O> = IsObjectValid<O> extends true ? ResolveValidObject<O> : never;
|
||||
declare type IsObjectValid<O> = IsOpen<O> extends false ? Required<O> extends keyof Values<O> ? true : false : true;
|
||||
declare type ResolveValidObject<O> = DeepMergeUnsafe<IsOpen<O> extends true ? IsEmpty<O> extends true ? {
|
||||
[key: string]: Resolve<Get<O, "openProps">>;
|
||||
} : {
|
||||
[key: string]: Resolve<Any>;
|
||||
} : {}, DeepMergeUnsafe<{
|
||||
[key in Exclude<keyof Values<O>, Required<O>>]?: Resolve<Values<O>[key]>;
|
||||
}, {
|
||||
[key in Required<O>]: key extends keyof Values<O> ? Resolve<Values<O>[key]> : Resolve<Any>;
|
||||
}>>;
|
||||
declare type IsObjectValueRepresentable<O, K> = K extends keyof Values<O> ? IsRepresentable<Values<O>[K]> : IsOpen<O> extends true ? IsRepresentable<OpenProps<O>> : false;
|
||||
export declare type IsObjectRepresentable<O> = Or<DoesExtend<A.Equals<Required<O>, never>, B.True>, Not<DoesExtend<false, {
|
||||
[key in Required<O>]: IsObjectValueRepresentable<O, key>;
|
||||
}[Required<O>]>>>;
|
||||
export {};
|
||||
8
node_modules/json-schema-to-ts/lib/meta-types/primitive.d.ts
generated
vendored
Normal file
8
node_modules/json-schema-to-ts/lib/meta-types/primitive.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import { Get } from "../utils";
|
||||
export declare type PrimitiveType = "primitive";
|
||||
export declare type Primitive<L> = {
|
||||
type: PrimitiveType;
|
||||
value: L;
|
||||
};
|
||||
export declare type Value<L> = Get<L, "value">;
|
||||
export declare type ResolvePrimitive<T> = Get<T, "value">;
|
||||
24
node_modules/json-schema-to-ts/lib/meta-types/tuple.d.ts
generated
vendored
Normal file
24
node_modules/json-schema-to-ts/lib/meta-types/tuple.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { Get, Head, Tail, Prepend, Concat, Reverse } from "../utils";
|
||||
import { Resolve, Any } from ".";
|
||||
import { IsRepresentable } from "./utils";
|
||||
export declare type TupleType = "tuple";
|
||||
export declare type Tuple<V, O = true, P = Any> = {
|
||||
type: TupleType;
|
||||
values: V;
|
||||
isOpen: O;
|
||||
openProps: P;
|
||||
};
|
||||
export declare type Values<T> = Get<T, "values">;
|
||||
export declare type IsOpen<T> = Get<T, "isOpen">;
|
||||
export declare type OpenProps<T> = Get<T, "openProps">;
|
||||
export declare type ResolveTuple<T> = IsOpen<T> extends true ? Concat<RecurseOnTuple<Values<T>>, [...Resolve<OpenProps<T>>[]]> : RecurseOnTuple<Values<T>>;
|
||||
declare type RecurseOnTuple<V, R extends any[] = []> = {
|
||||
stop: Reverse<R>;
|
||||
continue: V extends any[] ? RecurseOnTuple<Tail<V>, Prepend<Resolve<Head<V>>, R>> : never;
|
||||
}[V extends [any, ...any[]] ? "continue" : "stop"];
|
||||
export declare type IsTupleRepresentable<T> = AreAllTupleValuesRepresentable<Values<T>>;
|
||||
declare type AreAllTupleValuesRepresentable<V> = {
|
||||
stop: true;
|
||||
continue: V extends any[] ? IsRepresentable<Head<V>> extends false ? false : AreAllTupleValuesRepresentable<Tail<V>> : never;
|
||||
}[V extends [any, ...any[]] ? "continue" : "stop"];
|
||||
export {};
|
||||
14
node_modules/json-schema-to-ts/lib/meta-types/union.d.ts
generated
vendored
Normal file
14
node_modules/json-schema-to-ts/lib/meta-types/union.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { DoesExtend, Get } from "../utils";
|
||||
import { Resolve } from ".";
|
||||
import { IsRepresentable } from "./utils";
|
||||
export declare type UnionType = "union";
|
||||
export declare type Union<V> = {
|
||||
type: UnionType;
|
||||
values: V;
|
||||
};
|
||||
export declare type Values<U> = Get<U, "values">;
|
||||
export declare type ResolveUnion<U> = RecurseOnUnion<Values<U>>;
|
||||
declare type RecurseOnUnion<V> = V extends infer T ? Resolve<T> : never;
|
||||
export declare type IsUnionRepresentable<U> = DoesExtend<true, AreUnionValuesRepresentable<Values<U>>>;
|
||||
declare type AreUnionValuesRepresentable<V> = V extends infer T ? IsRepresentable<T> : never;
|
||||
export {};
|
||||
23
node_modules/json-schema-to-ts/lib/meta-types/utils.d.ts
generated
vendored
Normal file
23
node_modules/json-schema-to-ts/lib/meta-types/utils.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { Get } from "../utils";
|
||||
import { MetaType } from ".";
|
||||
import { IsEnumRepresentable } from "./enum";
|
||||
import { IsTupleRepresentable } from "./tuple";
|
||||
import { IsObjectRepresentable } from "./object";
|
||||
import { IsUnionRepresentable } from "./union";
|
||||
import { IsIntersectionRepresentable } from "./intersection";
|
||||
import { IsExclusionRepresentable } from "./exclusion";
|
||||
export declare type IsRepresentable<A> = {
|
||||
any: true;
|
||||
never: false;
|
||||
const: true;
|
||||
enum: IsEnumRepresentable<A>;
|
||||
primitive: true;
|
||||
array: true;
|
||||
tuple: IsTupleRepresentable<A>;
|
||||
object: IsObjectRepresentable<A>;
|
||||
union: IsUnionRepresentable<A>;
|
||||
intersection: IsIntersectionRepresentable<A>;
|
||||
exclusion: IsExclusionRepresentable<A>;
|
||||
error: false;
|
||||
errorMissingType: false;
|
||||
}[Get<A, "type"> extends MetaType ? Get<A, "type"> : "errorMissingType"];
|
||||
10
node_modules/json-schema-to-ts/lib/parse-schema/allOf.d.ts
generated
vendored
Normal file
10
node_modules/json-schema-to-ts/lib/parse-schema/allOf.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { Any, Intersection } from "../meta-types";
|
||||
import { Tail, Head, Get, HasKeyIn } from "../utils";
|
||||
import { ParseSchema } from ".";
|
||||
import { MergeSubSchema } from "./utils";
|
||||
export declare type ParseAllOfSchema<S> = RecurseOnAllOfSchema<Get<S, "allOf">, S, HasKeyIn<S, "enum" | "const" | "type" | "anyOf" | "oneOf"> extends true ? ParseSchema<Omit<S, "allOf">> : Any>;
|
||||
declare type RecurseOnAllOfSchema<V, S, R> = {
|
||||
stop: R;
|
||||
continue: V extends any[] ? RecurseOnAllOfSchema<Tail<V>, S, Intersection<ParseSchema<MergeSubSchema<Omit<S, "allOf">, Head<V>>>, R>> : never;
|
||||
}[V extends [any, ...any[]] ? "continue" : "stop"];
|
||||
export {};
|
||||
10
node_modules/json-schema-to-ts/lib/parse-schema/anyOf.d.ts
generated
vendored
Normal file
10
node_modules/json-schema-to-ts/lib/parse-schema/anyOf.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { Intersection, Union } from "../meta-types";
|
||||
import { Tail, Head, Get, HasKeyIn, Merge } from "../utils";
|
||||
import { ParseSchema } from ".";
|
||||
import { MergeSubSchema, RemoveInvalidAdditionalItems } from "./utils";
|
||||
export declare type ParseAnyOfSchema<S> = Union<RecurseOnAnyOfSchema<Get<S, "anyOf">, S>>;
|
||||
declare type RecurseOnAnyOfSchema<S, P, R = never> = {
|
||||
stop: R;
|
||||
continue: S extends any[] ? RecurseOnAnyOfSchema<Tail<S>, P, R | (HasKeyIn<P, "enum" | "const" | "type"> extends true ? Intersection<ParseSchema<Omit<P, "anyOf">>, ParseSchema<MergeSubSchema<Omit<P, "anyOf">, Head<S>>>> : ParseSchema<Merge<Omit<P, "anyOf">, RemoveInvalidAdditionalItems<Head<S>>>>)> : never;
|
||||
}[S extends [any, ...any[]] ? "continue" : "stop"];
|
||||
export {};
|
||||
24
node_modules/json-schema-to-ts/lib/parse-schema/array.d.ts
generated
vendored
Normal file
24
node_modules/json-schema-to-ts/lib/parse-schema/array.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { Arr, Tuple, Union, Error } from "../meta-types";
|
||||
import { Head, Tail, Reverse, DoesExtend, Get, Prepend, IsObject } from "../utils";
|
||||
import { ParseSchema } from ".";
|
||||
export declare type ParseArrSchema<S> = "items" extends keyof S ? IsObject<S["items"]> extends true ? Arr<ParseSchema<S["items"]>> : S["items"] extends any[] ? Union<FromTreeTuple<ParseTuple<S["items"]>, S>> : Error<'Invalid value in "items" property'> : Arr;
|
||||
export declare type ParseTuple<S, R extends any[] = []> = {
|
||||
stop: R;
|
||||
continue: S extends any[] ? ParseTuple<Tail<S>, Prepend<ParseSchema<Head<S>>, R>> : never;
|
||||
}[S extends [any, ...any[]] ? "continue" : "stop"];
|
||||
declare type FromTreeTuple<T, S> = T extends any[] ? ApplyAdditionalItems<ApplyBoundaries<T, "minItems" extends keyof S ? S["minItems"] : 0, "maxItems" extends keyof S ? S["maxItems"] : undefined>, "additionalItems" extends keyof S ? S["additionalItems"] : true> : never;
|
||||
declare type ApplyBoundaries<T extends any[], Min, Max, R = never, HasMin extends boolean = false, HasMax extends boolean = false, C = T> = {
|
||||
stop: {
|
||||
result: Max extends undefined ? R | Tuple<Reverse<T>, false> : HasMax extends true ? R | Tuple<Reverse<T>, false> : Max extends T["length"] ? Tuple<Reverse<T>, false> : IsLongerThan<Tail<T>, Max> extends true ? never : R | Tuple<Reverse<T>, false>;
|
||||
hasEncounteredMin: DoesExtend<Min, T["length"]>;
|
||||
hasEncounteredMax: HasMax extends true ? true : Max extends T["length"] ? true : IsLongerThan<Tail<T>, Max>;
|
||||
completeTuple: C;
|
||||
};
|
||||
continue: ApplyBoundaries<Tail<T>, Min, Max, T["length"] extends Max ? Tuple<Reverse<T>, false> : R | Tuple<Reverse<T>, false>, HasMin extends true ? true : DoesExtend<Min, T["length"]>, HasMax extends true ? true : DoesExtend<Max, T["length"]>, C>;
|
||||
}[Min extends T["length"] ? "stop" : T extends [any, ...any[]] ? "continue" : "stop"];
|
||||
declare type IsLongerThan<T extends any[], N, R = false> = {
|
||||
continue: T["length"] extends N ? true : IsLongerThan<Tail<T>, N>;
|
||||
stop: T["length"] extends N ? true : R;
|
||||
}[T extends [any, ...any[]] ? "continue" : "stop"];
|
||||
declare type ApplyAdditionalItems<R, A> = Get<R, "hasEncounteredMax"> extends true ? Get<R, "hasEncounteredMin"> extends true ? Get<R, "result"> : Error<'"minItems" property is lower than "maxItems"'> : A extends false ? Get<R, "hasEncounteredMin"> extends true ? Get<R, "result"> : Error<'"minItems" property is higher than allowed number of items'> : A extends true ? Get<R, "hasEncounteredMin"> extends true ? Get<R, "result"> | Tuple<Reverse<Get<R, "completeTuple">>> : Tuple<Reverse<Get<R, "completeTuple">>> : IsObject<A> extends true ? Get<R, "hasEncounteredMin"> extends true ? Get<R, "result"> | Tuple<Reverse<Get<R, "completeTuple">>, true, ParseSchema<A>> : Tuple<Reverse<Get<R, "completeTuple">>, true, ParseSchema<A>> : Error<'Invalid value in "additionalItems" property'>;
|
||||
export {};
|
||||
4
node_modules/json-schema-to-ts/lib/parse-schema/const.d.ts
generated
vendored
Normal file
4
node_modules/json-schema-to-ts/lib/parse-schema/const.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import { Const, Intersection } from "../meta-types";
|
||||
import { Get, HasKeyIn } from "../utils";
|
||||
import { ParseSchema } from ".";
|
||||
export declare type ParseConstSchema<S> = HasKeyIn<S, "type"> extends true ? Intersection<Const<Get<S, "const">>, ParseSchema<Omit<S, "const">>> : Const<Get<S, "const">>;
|
||||
4
node_modules/json-schema-to-ts/lib/parse-schema/enum.d.ts
generated
vendored
Normal file
4
node_modules/json-schema-to-ts/lib/parse-schema/enum.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import { Enum, Intersection } from "../meta-types";
|
||||
import { DeepGet, HasKeyIn } from "../utils";
|
||||
import { ParseSchema } from ".";
|
||||
export declare type ParseEnumSchema<S> = HasKeyIn<S, "const" | "type"> extends true ? Intersection<Enum<DeepGet<S, ["enum", number]>>, ParseSchema<Omit<S, "enum">>> : Enum<DeepGet<S, ["enum", number]>>;
|
||||
7
node_modules/json-schema-to-ts/lib/parse-schema/ifThenElse.d.ts
generated
vendored
Normal file
7
node_modules/json-schema-to-ts/lib/parse-schema/ifThenElse.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { ParseSchema } from "../parse-schema";
|
||||
import { Intersection, Union, Exclusion } from "../meta-types";
|
||||
import { HasKeyIn } from "../utils";
|
||||
import { MergeSubSchema } from "./utils";
|
||||
export declare type ParseIfThenElseSchema<S, R = Omit<S, "if" | "then" | "else">> = HasKeyIn<S, "enum" | "const" | "type" | "anyOf" | "oneOf" | "allOf" | "not"> extends true ? Intersection<ApplyIfThenElse<S, R>, ParseSchema<R>> : ApplyIfThenElse<S, R>;
|
||||
declare type ApplyIfThenElse<S, R, I = "if" extends keyof S ? MergeSubSchema<R, S["if"]> : never> = Union<("then" extends keyof S ? Intersection<ParseSchema<I>, ParseSchema<MergeSubSchema<R, S["then"]>>> : ParseSchema<I>) | Exclusion<"else" extends keyof S ? ParseSchema<MergeSubSchema<R, S["else"]>> : ParseSchema<R>, ParseSchema<I>>>;
|
||||
export {};
|
||||
31
node_modules/json-schema-to-ts/lib/parse-schema/index.d.ts
generated
vendored
Normal file
31
node_modules/json-schema-to-ts/lib/parse-schema/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import { Primitive, Any, Never } from "../meta-types";
|
||||
import { ParseConstSchema } from "./const";
|
||||
import { ParseEnumSchema } from "./enum";
|
||||
import { ParseMixedSchema } from "./mixed";
|
||||
import { ParseArrSchema } from "./array";
|
||||
import { ParseObjectSchema } from "./object";
|
||||
import { ParseAnyOfSchema } from "./anyOf";
|
||||
import { ParseOneOfSchema } from "./oneOf";
|
||||
import { ParseAllOfSchema } from "./allOf";
|
||||
import { ParseNotSchema } from "./not";
|
||||
import { ParseIfThenElseSchema } from "./ifThenElse";
|
||||
export declare type ParseSchema<S> = {
|
||||
any: Any;
|
||||
never: Never;
|
||||
null: Primitive<null>;
|
||||
boolean: Primitive<boolean>;
|
||||
number: Primitive<number>;
|
||||
string: Primitive<string>;
|
||||
mixed: ParseMixedSchema<S>;
|
||||
object: ParseObjectSchema<S>;
|
||||
array: ParseArrSchema<S>;
|
||||
const: ParseConstSchema<S>;
|
||||
enum: ParseEnumSchema<S>;
|
||||
anyOf: ParseAnyOfSchema<S>;
|
||||
oneOf: ParseOneOfSchema<S>;
|
||||
allOf: ParseAllOfSchema<S>;
|
||||
not: ParseNotSchema<S>;
|
||||
ifThenElse: ParseIfThenElseSchema<S>;
|
||||
}[InferSchemaType<S>];
|
||||
declare type InferSchemaType<S> = S extends true | string ? "any" : S extends false ? "never" : "if" extends keyof S ? "ifThenElse" : "not" extends keyof S ? "not" : "allOf" extends keyof S ? "allOf" : "oneOf" extends keyof S ? "oneOf" : "anyOf" extends keyof S ? "anyOf" : "enum" extends keyof S ? "enum" : "const" extends keyof S ? "const" : "type" extends keyof S ? S["type"] extends any[] ? "mixed" : S["type"] extends "null" ? "null" : S["type"] extends "boolean" ? "boolean" : S["type"] extends "integer" | "number" ? "number" : S["type"] extends "string" ? "string" : S["type"] extends "object" ? "object" : S["type"] extends "array" ? "array" : "never" : "any";
|
||||
export {};
|
||||
11
node_modules/json-schema-to-ts/lib/parse-schema/mixed.d.ts
generated
vendored
Normal file
11
node_modules/json-schema-to-ts/lib/parse-schema/mixed.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { Union } from "../meta-types";
|
||||
import { Get, Head, Tail, DeepMergeUnsafe } from "../utils";
|
||||
import { ParseSchema } from ".";
|
||||
export declare type ParseMixedSchema<S> = Union<RecurseOnMixedSchema<Get<S, "type">, S>>;
|
||||
declare type RecurseOnMixedSchema<T, S, R = never> = {
|
||||
stop: R;
|
||||
continue: T extends any[] ? RecurseOnMixedSchema<Tail<T>, S, R | ParseSchema<DeepMergeUnsafe<S, {
|
||||
type: Head<T>;
|
||||
}>>> : never;
|
||||
}[T extends [any, ...any[]] ? "continue" : "stop"];
|
||||
export {};
|
||||
8
node_modules/json-schema-to-ts/lib/parse-schema/not.d.ts
generated
vendored
Normal file
8
node_modules/json-schema-to-ts/lib/parse-schema/not.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import { Any, Primitive, Arr, Object, Union, Exclusion } from "../meta-types";
|
||||
import { IsRepresentable } from "../meta-types/utils";
|
||||
import { Get, HasKeyIn } from "../utils";
|
||||
import { ParseSchema } from ".";
|
||||
import { MergeSubSchema } from "./utils";
|
||||
declare type AllTypes = Union<Primitive<null> | Primitive<boolean> | Primitive<number> | Primitive<string> | Arr<Any> | Object>;
|
||||
export declare type ParseNotSchema<S, P = ParseSchema<Omit<S, "not">>, E = Exclusion<HasKeyIn<S, "enum" | "const" | "type" | "anyOf" | "oneOf" | "allOf"> extends true ? P : AllTypes, ParseSchema<MergeSubSchema<Omit<S, "not">, Get<S, "not">>>>> = IsRepresentable<E> extends true ? E : P;
|
||||
export {};
|
||||
23
node_modules/json-schema-to-ts/lib/parse-schema/object.d.ts
generated
vendored
Normal file
23
node_modules/json-schema-to-ts/lib/parse-schema/object.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { Object, Any, Never, Union, Error } from "../meta-types";
|
||||
import { IsObject } from "../utils";
|
||||
import { ParseSchema } from ".";
|
||||
export declare type ParseObjectSchema<S> = "properties" extends keyof S ? Object<{
|
||||
[key in keyof S["properties"]]: ParseSchema<S["properties"][key]>;
|
||||
}, GetRequired<S>, "additionalProperties" extends keyof S ? S["additionalProperties"] extends false ? false : true : true, GetOpenProps<S>> : Object<{}, GetRequired<S>, true, GetOpenProps<S>>;
|
||||
declare type GetRequired<S> = S extends {
|
||||
required: ReadonlyArray<string>;
|
||||
} ? S["required"][number] : never;
|
||||
declare type GetOpenProps<S> = "additionalProperties" extends keyof S ? "patternProperties" extends keyof S ? AdditionalAndPatternProps<S["additionalProperties"], S["patternProperties"]> : AdditionalProps<S["additionalProperties"]> : "patternProperties" extends keyof S ? PatternProps<S["patternProperties"]> : Any;
|
||||
declare type AdditionalProps<A> = A extends false ? Never : A extends true ? Any : IsObject<A> extends true ? ParseSchema<A> : Error<'Invalid value in "additionalProperties" property'>;
|
||||
declare type PatternProps<P> = {
|
||||
type: "union";
|
||||
values: {
|
||||
[key in keyof P]: ParseSchema<P[key]>;
|
||||
}[keyof P];
|
||||
};
|
||||
declare type AdditionalAndPatternProps<A, P> = A extends boolean ? Union<{
|
||||
[key in keyof P]: ParseSchema<P[key]>;
|
||||
}[keyof P]> : IsObject<A> extends true ? Union<ParseSchema<A> | {
|
||||
[key in keyof P]: ParseSchema<P[key]>;
|
||||
}[keyof P]> : never;
|
||||
export {};
|
||||
10
node_modules/json-schema-to-ts/lib/parse-schema/oneOf.d.ts
generated
vendored
Normal file
10
node_modules/json-schema-to-ts/lib/parse-schema/oneOf.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { Intersection, Union } from "../meta-types";
|
||||
import { Tail, Head, Get, HasKeyIn, Merge } from "../utils";
|
||||
import { ParseSchema } from ".";
|
||||
import { MergeSubSchema, RemoveInvalidAdditionalItems } from "./utils";
|
||||
export declare type ParseOneOfSchema<S> = Union<RecurseOnOneOfSchema<Get<S, "oneOf">, S>>;
|
||||
declare type RecurseOnOneOfSchema<S, P, R = never> = {
|
||||
stop: R;
|
||||
continue: S extends any[] ? RecurseOnOneOfSchema<Tail<S>, P, R | (HasKeyIn<P, "enum" | "const" | "type" | "anyOf"> extends true ? Intersection<ParseSchema<Omit<P, "oneOf">>, ParseSchema<MergeSubSchema<Omit<P, "oneOf">, Head<S>>>> : ParseSchema<Merge<Omit<P, "oneOf">, RemoveInvalidAdditionalItems<Head<S>>>>)> : never;
|
||||
}[S extends [any, ...any[]] ? "continue" : "stop"];
|
||||
export {};
|
||||
9
node_modules/json-schema-to-ts/lib/parse-schema/utils.d.ts
generated
vendored
Normal file
9
node_modules/json-schema-to-ts/lib/parse-schema/utils.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { Merge } from "../utils";
|
||||
export declare type RemoveInvalidAdditionalItems<S> = "items" extends keyof S ? "additionalItems" extends keyof S ? S : Merge<S, {
|
||||
additionalItems: true;
|
||||
}> : Omit<S, "additionalItems">;
|
||||
export declare type MergeSubSchema<P, C> = Merge<P, Merge<{
|
||||
properties: {};
|
||||
additionalProperties: true;
|
||||
required: [];
|
||||
}, RemoveInvalidAdditionalItems<C>>>;
|
||||
8
node_modules/json-schema-to-ts/lib/utils/and.d.ts
generated
vendored
Normal file
8
node_modules/json-schema-to-ts/lib/utils/and.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* Return `true` if `A` and `B` extend `true`, `false` otherwise
|
||||
*
|
||||
* @param A Type
|
||||
* @param B Type
|
||||
* @return Boolean
|
||||
*/
|
||||
export declare type And<A, B> = A extends true ? B extends true ? true : false : false;
|
||||
23
node_modules/json-schema-to-ts/lib/utils/concat.d.ts
generated
vendored
Normal file
23
node_modules/json-schema-to-ts/lib/utils/concat.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { Head } from "./head";
|
||||
import { Tail } from "./tail";
|
||||
import { Prepend } from "./prepend";
|
||||
import { Reverse } from "./reverse";
|
||||
/**
|
||||
* Concatenate the reverse of tuple `A` to tuple `B`
|
||||
*
|
||||
* @param A Tuple
|
||||
* @param B Tuple
|
||||
* @return Tuple
|
||||
*/
|
||||
export declare type ConcatReversed<A, B extends any[]> = {
|
||||
stop: B;
|
||||
continue: ConcatReversed<Tail<A>, Prepend<Head<A>, B>>;
|
||||
}[A extends [any, ...any[]] ? "continue" : "stop"];
|
||||
/**
|
||||
* Concatenate tuple `A` to tuple `B`
|
||||
*
|
||||
* @param A Tuple
|
||||
* @param B Tuple
|
||||
* @return Tuple
|
||||
*/
|
||||
export declare type Concat<A, B extends any[]> = A extends any[] ? ConcatReversed<Reverse<A>, B> : never;
|
||||
24
node_modules/json-schema-to-ts/lib/utils/extends.d.ts
generated
vendored
Normal file
24
node_modules/json-schema-to-ts/lib/utils/extends.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* Returns `true` if type `A` extends type `B`, `false` if not
|
||||
*
|
||||
* @param A Type
|
||||
* @param B Type
|
||||
* @return Boolean
|
||||
*/
|
||||
export declare type DoesExtend<A, B> = A extends B ? true : false;
|
||||
declare type ArrayKeys = keyof [];
|
||||
/**
|
||||
* Returns `true` if type is object, `false` if not (excludes arrays)
|
||||
*
|
||||
* @param T Type
|
||||
* @return Boolean
|
||||
*/
|
||||
export declare type IsObject<T> = T extends object ? ArrayKeys extends Extract<keyof T, ArrayKeys> ? false : true : false;
|
||||
/**
|
||||
* Returns `true` if type is array, `false` if not (excludes objects)
|
||||
*
|
||||
* @param T Type
|
||||
* @return Boolean
|
||||
*/
|
||||
export declare type IsArray<T> = T extends object ? ArrayKeys extends Extract<keyof T, ArrayKeys> ? true : false : false;
|
||||
export {};
|
||||
17
node_modules/json-schema-to-ts/lib/utils/filter.d.ts
generated
vendored
Normal file
17
node_modules/json-schema-to-ts/lib/utils/filter.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { Head } from "./head";
|
||||
import { Tail } from "./tail";
|
||||
import { Prepend } from "./prepend";
|
||||
import { Reverse } from "./reverse";
|
||||
/**
|
||||
* Filters out the values of a tuple `T` that don't extend type `F`
|
||||
*
|
||||
* Preserves the tuple original order
|
||||
*
|
||||
* @param T Tuple
|
||||
* @param F Type
|
||||
* @return Tuple
|
||||
*/
|
||||
export declare type FilterExtending<T, F, R extends any[] = []> = {
|
||||
continue: FilterExtending<Tail<T>, F, Head<T> extends F ? Prepend<Head<T>, R> : R>;
|
||||
stop: Reverse<R>;
|
||||
}[T extends [any, ...any[]] ? "continue" : "stop"];
|
||||
23
node_modules/json-schema-to-ts/lib/utils/get.d.ts
generated
vendored
Normal file
23
node_modules/json-schema-to-ts/lib/utils/get.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { Head } from "./head";
|
||||
import { Tail } from "./tail";
|
||||
/**
|
||||
* Returns the value at key `K` in object `O`, `F` if `K` misses from object
|
||||
*
|
||||
* @param O Object
|
||||
* @param K Property key
|
||||
* @param F _(optional:_ `never` _)_ Fallback type
|
||||
* @return Type
|
||||
*/
|
||||
export declare type Get<O, K, F = never> = K extends keyof O ? O[K] : F;
|
||||
/**
|
||||
* Returns the value at path `P` in object `O`, `F` if `P` misses from object
|
||||
*
|
||||
* @param O Object
|
||||
* @param P Path
|
||||
* @param F _(optional:_ `never` _)_ Fallback type
|
||||
* @return Type
|
||||
*/
|
||||
export declare type DeepGet<O, P, F = never> = {
|
||||
continue: Head<P> extends keyof O ? DeepGet<O[Head<P>], Tail<P>, F> : F;
|
||||
stop: O;
|
||||
}[P extends [any, ...any[]] ? "continue" : "stop"];
|
||||
8
node_modules/json-schema-to-ts/lib/utils/hasKeyIn.d.ts
generated
vendored
Normal file
8
node_modules/json-schema-to-ts/lib/utils/hasKeyIn.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* Returns `true` if object `O` has a property key in `K` (union), `false` if not
|
||||
*
|
||||
* @param O Object
|
||||
* @param K Union of property keys
|
||||
* @return Type
|
||||
*/
|
||||
export declare type HasKeyIn<O, K> = Extract<keyof O, K> extends never ? false : true;
|
||||
7
node_modules/json-schema-to-ts/lib/utils/head.d.ts
generated
vendored
Normal file
7
node_modules/json-schema-to-ts/lib/utils/head.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* Returns the first element of a tuple `T`
|
||||
*
|
||||
* @param T Tuple
|
||||
* @return Type
|
||||
*/
|
||||
export declare type Head<T> = T extends any[] ? T[0] : never;
|
||||
19
node_modules/json-schema-to-ts/lib/utils/index.d.ts
generated
vendored
Normal file
19
node_modules/json-schema-to-ts/lib/utils/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
export { And } from "./and";
|
||||
export { ConcatReversed, Concat } from "./concat";
|
||||
export { DoesExtend, IsObject, IsArray } from "./extends";
|
||||
export { FilterExtending } from "./filter";
|
||||
export { Get, DeepGet } from "./get";
|
||||
export { HasKeyIn } from "./hasKeyIn";
|
||||
export { Head } from "./head";
|
||||
export { DeepMergeSafe, DeepMergeUnsafe, Merge } from "./merge";
|
||||
export { Not } from "./not";
|
||||
export { OptionalProps } from "./optionalProps";
|
||||
export { Or } from "./or";
|
||||
export { Prepend } from "./prepend";
|
||||
export { Prettify } from "./prettify";
|
||||
export { DeepReadonly } from "./readonly";
|
||||
export { Replace } from "./replace";
|
||||
export { RequiredProps } from "./requiredProps";
|
||||
export { Reverse } from "./reverse";
|
||||
export { Tail } from "./tail";
|
||||
export { DeepWriteable } from "./writeable";
|
||||
45
node_modules/json-schema-to-ts/lib/utils/merge.d.ts
generated
vendored
Normal file
45
node_modules/json-schema-to-ts/lib/utils/merge.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import { Concat } from "./concat";
|
||||
import { IsObject, IsArray } from "./extends";
|
||||
/**
|
||||
* Recursively merge two types `A` and `B`:
|
||||
* - Returns `B` if `A` and `B` are not both objects or arrays
|
||||
* - Recursively merge `A` and `B` properties if both are objects
|
||||
* - Concat `A` and `B` if both are arrays
|
||||
*
|
||||
* `DeepMergeUnsafe` preserves non-required properties, but can return `never` if TS infers that `A & B = never` (which can happen if some properties are incompatible)
|
||||
*
|
||||
* @param A Type
|
||||
* @param B Type
|
||||
* @return Type
|
||||
*/
|
||||
export declare type DeepMergeUnsafe<A, B> = IsObject<A> extends true ? IsObject<B> extends true ? {
|
||||
[K in keyof (A & B)]: K extends keyof B ? K extends keyof A ? DeepMergeUnsafe<A[K], B[K]> : B[K] : K extends keyof A ? A[K] : never;
|
||||
} : B : IsArray<A> extends true ? IsArray<B> extends true ? B extends any[] ? Concat<A, B> : never : B : B;
|
||||
/**
|
||||
* Recursively merge two types `A` and `B`:
|
||||
* - Returns `B` if `A` and `B` are not both objects or arrays
|
||||
* - Recursively merge `A` and `B` properties if both are objects
|
||||
* - Concat `A` and `B` if both are arrays
|
||||
*
|
||||
* Contrary to `DeepMergeUnsafe`, `DeepMergeSafe` never returns `never`, but doesn't preserve non-required properties
|
||||
*
|
||||
* @param A Type
|
||||
* @param B Type
|
||||
* @return Type
|
||||
*/
|
||||
export declare type DeepMergeSafe<A, B> = IsObject<A> extends true ? IsObject<B> extends true ? {
|
||||
[K in keyof A | keyof B]: K extends keyof B ? K extends keyof A ? DeepMergeSafe<A[K], B[K]> : B[K] : K extends keyof A ? A[K] : never;
|
||||
} : B : IsArray<A> extends true ? IsArray<B> extends true ? B extends any[] ? Concat<A, B> : never : B : B;
|
||||
/**
|
||||
* Merge two types `A` and `B`:
|
||||
* - Returns `B` if `A` and `B` are not both objects
|
||||
* - Merge `A` and `B` properties if both are objects
|
||||
* - Merging is not recursive: Properties of `B` erase properties of `A`
|
||||
*
|
||||
* @param A Type
|
||||
* @param B Type
|
||||
* @return Type
|
||||
*/
|
||||
export declare type Merge<A, B> = IsObject<A> extends true ? IsObject<B> extends true ? {
|
||||
[K in keyof A | keyof B]: K extends keyof B ? B[K] : K extends keyof A ? A[K] : never;
|
||||
} : B : B;
|
||||
7
node_modules/json-schema-to-ts/lib/utils/not.d.ts
generated
vendored
Normal file
7
node_modules/json-schema-to-ts/lib/utils/not.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* Return `true` if `A` extends `false`, `false` if `A` extends `true`, `never` otherwise
|
||||
*
|
||||
* @param A Type
|
||||
* @return Boolean
|
||||
*/
|
||||
export declare type Not<A> = A extends false ? true : A extends true ? false : never;
|
||||
9
node_modules/json-schema-to-ts/lib/utils/optionalProps.d.ts
generated
vendored
Normal file
9
node_modules/json-schema-to-ts/lib/utils/optionalProps.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* Extract the names of an object's optional properties
|
||||
*
|
||||
* @param O Object
|
||||
* @return Property names
|
||||
*/
|
||||
export declare type OptionalProps<O extends Record<string | number | symbol, unknown>> = Exclude<{
|
||||
[K in keyof O]: undefined extends O[K] ? K : never;
|
||||
}[keyof O], undefined>;
|
||||
8
node_modules/json-schema-to-ts/lib/utils/or.d.ts
generated
vendored
Normal file
8
node_modules/json-schema-to-ts/lib/utils/or.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* Return `true` if `A` or `B` extend `true`, `false` otherwise
|
||||
*
|
||||
* @param A Type
|
||||
* @param B Type
|
||||
* @return Boolean
|
||||
*/
|
||||
export declare type Or<A, B> = A extends true ? true : B extends true ? true : false;
|
||||
8
node_modules/json-schema-to-ts/lib/utils/prepend.d.ts
generated
vendored
Normal file
8
node_modules/json-schema-to-ts/lib/utils/prepend.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* Inserts an element at the start of a tuple
|
||||
*
|
||||
* @param E Element (type)
|
||||
* @param T Tuple
|
||||
* @return Tuple
|
||||
*/
|
||||
export declare type Prepend<E, T extends any[]> = ((element: E, ...tail: T) => void) extends (...tuple: infer R) => void ? R : never;
|
||||
10
node_modules/json-schema-to-ts/lib/utils/prettify.d.ts
generated
vendored
Normal file
10
node_modules/json-schema-to-ts/lib/utils/prettify.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { IsObject } from "./extends";
|
||||
/**
|
||||
* Resolves generic definitions in hover windows to human-friendly results
|
||||
*
|
||||
* @param T Type
|
||||
* @return Type
|
||||
*/
|
||||
export declare type Prettify<T> = IsObject<T> extends true ? {
|
||||
[K in keyof T]: K extends keyof T ? T[K] : never;
|
||||
} : T;
|
||||
9
node_modules/json-schema-to-ts/lib/utils/readonly.d.ts
generated
vendored
Normal file
9
node_modules/json-schema-to-ts/lib/utils/readonly.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* Recursively add the `readonly` directive from an object properties or tuple items
|
||||
*
|
||||
* @param O Object / Tuple
|
||||
* @return Object / Tuple
|
||||
*/
|
||||
export declare type DeepReadonly<O> = O extends object ? {
|
||||
readonly [K in keyof O]: DeepReadonly<O[K]>;
|
||||
} : O;
|
||||
16
node_modules/json-schema-to-ts/lib/utils/replace.d.ts
generated
vendored
Normal file
16
node_modules/json-schema-to-ts/lib/utils/replace.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { DeepMergeUnsafe } from "./merge";
|
||||
import { OptionalProps } from "./optionalProps";
|
||||
import { RequiredProps } from "./requiredProps";
|
||||
/**
|
||||
* Set a specified value to an object property or properties
|
||||
*
|
||||
* @param O Object
|
||||
* @param P Properties
|
||||
* @param V Value (type)
|
||||
* @return Object
|
||||
*/
|
||||
export declare type Replace<O extends Record<string | number | symbol, any>, P extends keyof O, V, Req extends keyof O = RequiredProps<O>, Opt extends keyof O = OptionalProps<O>> = DeepMergeUnsafe<DeepMergeUnsafe<Omit<O, P>, {
|
||||
[key in P & Req]: V;
|
||||
}>, {
|
||||
[key in P & Opt]?: V;
|
||||
}>;
|
||||
9
node_modules/json-schema-to-ts/lib/utils/requiredProps.d.ts
generated
vendored
Normal file
9
node_modules/json-schema-to-ts/lib/utils/requiredProps.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* Extract the names of an object's required properties
|
||||
*
|
||||
* @param O Object
|
||||
* @return Property names
|
||||
*/
|
||||
export declare type RequiredProps<O extends Record<string | number | symbol, unknown>> = Exclude<{
|
||||
[K in keyof O]: undefined extends O[K] ? never : K;
|
||||
}[keyof O], undefined>;
|
||||
13
node_modules/json-schema-to-ts/lib/utils/reverse.d.ts
generated
vendored
Normal file
13
node_modules/json-schema-to-ts/lib/utils/reverse.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { Head } from "./head";
|
||||
import { Tail } from "./tail";
|
||||
import { Prepend } from "./prepend";
|
||||
/**
|
||||
* Reverses a tuple `T`
|
||||
*
|
||||
* @param T Tuple
|
||||
* @return Tuple
|
||||
*/
|
||||
export declare type Reverse<T, R extends any[] = []> = {
|
||||
stop: R;
|
||||
continue: T extends any[] ? Reverse<Tail<T>, Prepend<Head<T>, R>> : never;
|
||||
}[T extends [any, ...any[]] ? "continue" : "stop"];
|
||||
7
node_modules/json-schema-to-ts/lib/utils/tail.d.ts
generated
vendored
Normal file
7
node_modules/json-schema-to-ts/lib/utils/tail.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* Remove the first element of a tuple
|
||||
*
|
||||
* @param T Tuple
|
||||
* @return Tuple
|
||||
*/
|
||||
export declare type Tail<T> = T extends any[] ? ((...args: T) => void) extends (head: any, ...tail: infer R) => void ? R : T : never;
|
||||
9
node_modules/json-schema-to-ts/lib/utils/writeable.d.ts
generated
vendored
Normal file
9
node_modules/json-schema-to-ts/lib/utils/writeable.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* Recursively remove the `readonly` directive from an object properties or tuple items
|
||||
*
|
||||
* @param O Object / Tuple
|
||||
* @return Object / Tuple
|
||||
*/
|
||||
export declare type DeepWriteable<O> = O extends object ? {
|
||||
-readonly [K in keyof O]: DeepWriteable<O[K]>;
|
||||
} : O;
|
||||
Loading…
Add table
Add a link
Reference in a new issue