Comparing version 1.2.0 to 1.2.1-canary-4eff6edc48c3388e76460d499c761251c9daf03a
@@ -258,14 +258,6 @@ import { Kind, OperationTypeNode, DocumentNode } from '@0no-co/graphql.web'; | ||
}; | ||
type getScalarTypeNames<Schema extends IntrospectionLikeType> = | ||
Schema['types'][keyof Schema['types']] extends infer Type | ||
? Type extends { | ||
kind: 'SCALAR' | 'ENUM'; | ||
name: any; | ||
} | ||
? Type['name'] | ||
: never | ||
: never; | ||
type getScalarType$1< | ||
Schema extends IntrospectionLikeType, | ||
Name extends keyof Schema['types'], | ||
Name extends string, | ||
OrType = never, | ||
> = Schema['types'][Name] extends { | ||
@@ -275,3 +267,3 @@ kind: 'SCALAR'; | ||
} | ||
? Type | ||
? Type | OrType | ||
: Schema['types'][Name] extends { | ||
@@ -281,3 +273,3 @@ kind: 'ENUM'; | ||
} | ||
? Type | ||
? Type | OrType | ||
: never; | ||
@@ -1169,50 +1161,58 @@ type ScalarsLike = { | ||
}, | ||
SelectionAcc = {}, | ||
> = Selections extends [infer Node, ...infer Rest] | ||
? (Node extends { | ||
kind: Kind.FRAGMENT_SPREAD | Kind.INLINE_FRAGMENT; | ||
} | ||
? getSpreadSubtype<Node, Type, Introspection, Fragments> extends infer Subtype extends | ||
ObjectLikeType | ||
? PossibleType extends getTypenameOfType<Subtype> | ||
? | ||
| (isOptional<Node> extends true ? {} : never) | ||
| getFragmentSelection<Node, Subtype, Introspection, Fragments> | ||
: {} | ||
? _getPossibleTypeSelectionRec< | ||
Rest, | ||
PossibleType, | ||
Type, | ||
Introspection, | ||
Fragments, | ||
(Node extends { | ||
kind: Kind.FRAGMENT_SPREAD | Kind.INLINE_FRAGMENT; | ||
} | ||
? getSpreadSubtype<Node, Type, Introspection, Fragments> extends infer Subtype extends | ||
ObjectLikeType | ||
? PossibleType extends getTypenameOfType<Subtype> | ||
? | ||
| (isOptional<Node> extends true ? {} : never) | ||
| getFragmentSelection<Node, Subtype, Introspection, Fragments> | ||
: {} | ||
: Node extends { | ||
kind: Kind.FRAGMENT_SPREAD; | ||
name: any; | ||
} | ||
? makeUndefinedFragmentRef<Node['name']['value']> | ||
: {} | ||
: Node extends { | ||
kind: Kind.FRAGMENT_SPREAD; | ||
kind: Kind.FIELD; | ||
name: any; | ||
selectionSet: any; | ||
} | ||
? makeUndefinedFragmentRef<Node['name']['value']> | ||
: {} | ||
: Node extends { | ||
kind: Kind.FIELD; | ||
name: any; | ||
selectionSet: any; | ||
} | ||
? isOptional<Node> extends true | ||
? { | ||
[Prop in getFieldAlias<Node>]?: Node['name']['value'] extends '__typename' | ||
? PossibleType | ||
: unwrapType$1< | ||
Type['fields'][Node['name']['value']]['type'], | ||
Node['selectionSet'], | ||
Introspection, | ||
Fragments, | ||
getTypeDirective<Node> | ||
>; | ||
} | ||
: { | ||
[Prop in getFieldAlias<Node>]: Node['name']['value'] extends '__typename' | ||
? PossibleType | ||
: unwrapType$1< | ||
Type['fields'][Node['name']['value']]['type'], | ||
Node['selectionSet'], | ||
Introspection, | ||
Fragments, | ||
getTypeDirective<Node> | ||
>; | ||
} | ||
: {}) & | ||
_getPossibleTypeSelectionRec<Rest, PossibleType, Type, Introspection, Fragments> | ||
: {}; | ||
? isOptional<Node> extends true | ||
? { | ||
[Prop in getFieldAlias<Node>]?: Node['name']['value'] extends '__typename' | ||
? PossibleType | ||
: unwrapType$1< | ||
Type['fields'][Node['name']['value']]['type'], | ||
Node['selectionSet'], | ||
Introspection, | ||
Fragments, | ||
getTypeDirective<Node> | ||
>; | ||
} | ||
: { | ||
[Prop in getFieldAlias<Node>]: Node['name']['value'] extends '__typename' | ||
? PossibleType | ||
: unwrapType$1< | ||
Type['fields'][Node['name']['value']]['type'], | ||
Node['selectionSet'], | ||
Introspection, | ||
Fragments, | ||
getTypeDirective<Node> | ||
>; | ||
} | ||
: {}) & | ||
SelectionAcc | ||
> | ||
: SelectionAcc; | ||
type getOperationSelectionType< | ||
@@ -1282,19 +1282,24 @@ Definition, | ||
Introspection extends IntrospectionLikeType, | ||
InputObject = {}, | ||
> = InputFields extends [infer InputField, ...infer Rest] | ||
? (InputField extends { | ||
name: any; | ||
type: any; | ||
} | ||
? InputField['type'] extends { | ||
kind: 'NON_NULL'; | ||
} | ||
? { | ||
[Name in InputField['name']]: unwrapType<InputField['type'], Introspection>; | ||
? getInputObjectTypeRec< | ||
Rest, | ||
Introspection, | ||
(InputField extends { | ||
name: any; | ||
type: any; | ||
} | ||
? InputField['type'] extends { | ||
kind: 'NON_NULL'; | ||
} | ||
: { | ||
[Name in InputField['name']]?: unwrapType<InputField['type'], Introspection>; | ||
} | ||
: {}) & | ||
getInputObjectTypeRec<Rest, Introspection> | ||
: {}; | ||
? { | ||
[Name in InputField['name']]: unwrapType<InputField['type'], Introspection>; | ||
} | ||
: { | ||
[Name in InputField['name']]?: unwrapType<InputField['type'], Introspection>; | ||
} | ||
: {}) & | ||
InputObject | ||
> | ||
: InputObject; | ||
type getScalarType< | ||
@@ -1359,32 +1364,37 @@ TypeName, | ||
: null | _unwrapTypeRefRec<Type, Introspection>; | ||
type getVariablesRec<Variables, Introspection extends IntrospectionLikeType> = Variables extends [ | ||
infer Variable, | ||
...infer Rest, | ||
] | ||
? (Variable extends { | ||
kind: Kind.VARIABLE_DEFINITION; | ||
variable: any; | ||
type: any; | ||
} | ||
? Variable extends { | ||
defaultValue: undefined; | ||
type: { | ||
kind: Kind.NON_NULL_TYPE; | ||
}; | ||
} | ||
? { | ||
[Name in Variable['variable']['name']['value']]: unwrapTypeRef< | ||
Variable['type'], | ||
Introspection | ||
>; | ||
type _getVariablesRec< | ||
Variables, | ||
Introspection extends IntrospectionLikeType, | ||
VariablesObject = {}, | ||
> = Variables extends [infer Variable, ...infer Rest] | ||
? _getVariablesRec< | ||
Rest, | ||
Introspection, | ||
(Variable extends { | ||
kind: Kind.VARIABLE_DEFINITION; | ||
variable: any; | ||
type: any; | ||
} | ||
? Variable extends { | ||
defaultValue: undefined; | ||
type: { | ||
kind: Kind.NON_NULL_TYPE; | ||
}; | ||
} | ||
: { | ||
[Name in Variable['variable']['name']['value']]?: unwrapTypeRef< | ||
Variable['type'], | ||
Introspection | ||
>; | ||
} | ||
: {}) & | ||
getVariablesRec<Rest, Introspection> | ||
: {}; | ||
? { | ||
[Name in Variable['variable']['name']['value']]: unwrapTypeRef< | ||
Variable['type'], | ||
Introspection | ||
>; | ||
} | ||
: { | ||
[Name in Variable['variable']['name']['value']]?: unwrapTypeRef< | ||
Variable['type'], | ||
Introspection | ||
>; | ||
} | ||
: {}) & | ||
VariablesObject | ||
> | ||
: VariablesObject; | ||
type getVariablesType< | ||
@@ -1397,3 +1407,3 @@ Document extends DocumentNodeLike, | ||
} | ||
? obj<getVariablesRec<Document['definitions'][0]['variableDefinitions'], Introspection>> | ||
? obj<_getVariablesRec<Document['definitions'][0]['variableDefinitions'], Introspection>> | ||
: {}; | ||
@@ -1524,4 +1534,4 @@ | ||
scalar< | ||
const Name extends getScalarTypeNames<Schema>, | ||
const Value extends getScalarType$1<Schema, Name> | null | undefined, | ||
const Name extends stringLiteral<Name>, | ||
const Value extends getScalarType$1<Schema, Name, null | undefined>, | ||
>( | ||
@@ -1531,5 +1541,5 @@ name: Name, | ||
): Value; | ||
scalar<const Name extends getScalarTypeNames<Schema>>( | ||
scalar<const Name extends stringLiteral<Name>>( | ||
name: Name, | ||
value: getScalarType$1<Schema, Name> | ||
value?: getScalarType$1<Schema, Name> | ||
): getScalarType$1<Schema, Name>; | ||
@@ -1536,0 +1546,0 @@ } |
{ | ||
"name": "gql.tada", | ||
"description": "The spec-compliant & magical GraphQL query language engine in the TypeScript type system", | ||
"version": "1.2.0", | ||
"version": "1.2.1-canary-4eff6edc48c3388e76460d499c761251c9daf03a", | ||
"author": "0no.co <hi@0no.co>", | ||
@@ -6,0 +6,0 @@ "source": "./src/index.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103300
1931
2