UNPKG

2.08 kBTypeScriptView Raw
1import { SelectionSet } from "apollo-codegen-core/lib/compiler";
2import { Set } from "immutable";
3import { GraphQLInputType } from "graphql";
4export declare type List<T> = {
5 kind: "List";
6 ofType: T;
7};
8export declare type Maybe<T> = {
9 kind: "Maybe";
10 ofType: T;
11};
12export declare type Typename = {
13 kind: "Typename";
14 possibleTypes: Set<string>;
15};
16export declare const Typename: (possibleTypes: Set<string>) => Typename;
17export declare type Field = {
18 name: string;
19 type: OutputType | Typename;
20};
21export declare type FragmentReference = {
22 kind: "FragmentReference";
23 name: string;
24 possibleTypes: Set<string>;
25};
26export declare type InlineSelection = {
27 kind: "InlineSelection";
28 possibleTypes: Set<string>;
29 intersections: FragmentReference[];
30 fields: Field[];
31 booleanConditions: FragmentOrSelection[];
32 typeConditions: FragmentOrSelection[];
33};
34export declare type FragmentOrSelection = FragmentReference | InlineSelection;
35export declare type InputObject = {
36 kind: "InputObject";
37 name: string;
38};
39export declare type Enum = {
40 kind: "Enum";
41 name: string;
42 values: string[];
43};
44export declare type Scalar = {
45 kind: "Scalar";
46 name: string;
47 isTypename: boolean;
48};
49export declare type Leaf = Enum | Scalar;
50export interface MaybeType<T> extends Maybe<Type<T>> {
51}
52export interface ListType<T> extends List<Type<T>> {
53}
54export declare type Type<T> = T | MaybeType<T> | ListType<T>;
55export declare type OutputType = Type<FragmentOrSelection | Leaf>;
56export declare type InputType = Type<InputObject | Leaf>;
57export declare const List: <T>(ofType: T) => List<T>;
58export declare const Maybe: <T>(ofType: T) => Maybe<T>;
59export declare const InputType: (type: GraphQLInputType) => Type<Enum | Scalar | InputObject>;
60export declare const FragmentReference: (name: string, possibleTypes: Set<string>) => FragmentReference;
61export declare const InlineSelection: (selectionSet: SelectionSet) => InlineSelection;
62export declare const AnyObject: (selectionSet: SelectionSet) => FragmentOrSelection;