@0no-co/graphql.web 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 0no.co
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,250 @@
1
+ declare enum Kind {
2
+ /** Name */
3
+ NAME = "Name",
4
+ /** Document */
5
+ DOCUMENT = "Document",
6
+ OPERATION_DEFINITION = "OperationDefinition",
7
+ VARIABLE_DEFINITION = "VariableDefinition",
8
+ SELECTION_SET = "SelectionSet",
9
+ FIELD = "Field",
10
+ ARGUMENT = "Argument",
11
+ /** Fragments */
12
+ FRAGMENT_SPREAD = "FragmentSpread",
13
+ INLINE_FRAGMENT = "InlineFragment",
14
+ FRAGMENT_DEFINITION = "FragmentDefinition",
15
+ /** Values */
16
+ VARIABLE = "Variable",
17
+ INT = "IntValue",
18
+ FLOAT = "FloatValue",
19
+ STRING = "StringValue",
20
+ BOOLEAN = "BooleanValue",
21
+ NULL = "NullValue",
22
+ ENUM = "EnumValue",
23
+ LIST = "ListValue",
24
+ OBJECT = "ObjectValue",
25
+ OBJECT_FIELD = "ObjectField",
26
+ /** Directives */
27
+ DIRECTIVE = "Directive",
28
+ /** Types */
29
+ NAMED_TYPE = "NamedType",
30
+ LIST_TYPE = "ListType",
31
+ NON_NULL_TYPE = "NonNullType"
32
+ }
33
+
34
+ interface Location {
35
+ readonly start: number;
36
+ readonly end: number;
37
+ readonly source: Source;
38
+ }
39
+ interface Source {
40
+ body: string;
41
+ name: string;
42
+ locationOffset: {
43
+ line: number;
44
+ column: number;
45
+ };
46
+ }
47
+ declare type ASTNode = NameNode | DocumentNode | OperationDefinitionNode | VariableDefinitionNode | VariableNode | SelectionSetNode | FieldNode | ArgumentNode | FragmentSpreadNode | InlineFragmentNode | FragmentDefinitionNode | IntValueNode | FloatValueNode | StringValueNode | BooleanValueNode | NullValueNode | EnumValueNode | ListValueNode | ObjectValueNode | ObjectFieldNode | DirectiveNode | NamedTypeNode | ListTypeNode | NonNullTypeNode;
48
+ interface NameNode {
49
+ readonly kind: Kind.NAME;
50
+ readonly value: string;
51
+ }
52
+ interface DocumentNode {
53
+ readonly kind: Kind.DOCUMENT;
54
+ readonly definitions: ReadonlyArray<ExecutableDefinitionNode>;
55
+ readonly loc?: Location;
56
+ }
57
+ type DefinitionNode = OperationDefinitionNode | FragmentDefinitionNode;
58
+ type ExecutableDefinitionNode = OperationDefinitionNode | FragmentDefinitionNode;
59
+ interface OperationDefinitionNode {
60
+ readonly kind: Kind.OPERATION_DEFINITION;
61
+ readonly operation: OperationTypeNode;
62
+ readonly name?: NameNode;
63
+ readonly variableDefinitions?: ReadonlyArray<VariableDefinitionNode>;
64
+ readonly directives?: ReadonlyArray<DirectiveNode>;
65
+ readonly selectionSet: SelectionSetNode;
66
+ }
67
+ declare const enum OperationTypeNode {
68
+ QUERY = "query",
69
+ MUTATION = "mutation",
70
+ SUBSCRIPTION = "subscription"
71
+ }
72
+ interface VariableDefinitionNode {
73
+ readonly kind: Kind.VARIABLE_DEFINITION;
74
+ readonly variable: VariableNode;
75
+ readonly type: TypeNode;
76
+ readonly defaultValue?: ConstValueNode;
77
+ readonly directives?: ReadonlyArray<ConstDirectiveNode>;
78
+ }
79
+ interface VariableNode {
80
+ readonly kind: Kind.VARIABLE;
81
+ readonly name: NameNode;
82
+ }
83
+ interface SelectionSetNode {
84
+ kind: Kind.SELECTION_SET;
85
+ selections: ReadonlyArray<SelectionNode>;
86
+ }
87
+ declare type SelectionNode = FieldNode | FragmentSpreadNode | InlineFragmentNode;
88
+ interface FieldNode {
89
+ readonly kind: Kind.FIELD;
90
+ readonly alias?: NameNode;
91
+ readonly name: NameNode;
92
+ readonly arguments?: ReadonlyArray<ArgumentNode>;
93
+ readonly directives?: ReadonlyArray<DirectiveNode>;
94
+ readonly selectionSet?: SelectionSetNode;
95
+ }
96
+ interface ArgumentNode {
97
+ readonly kind: Kind.ARGUMENT;
98
+ readonly name: NameNode;
99
+ readonly value: ValueNode;
100
+ }
101
+ interface ConstArgumentNode {
102
+ readonly kind: Kind.ARGUMENT;
103
+ readonly name: NameNode;
104
+ readonly value: ConstValueNode;
105
+ }
106
+ interface FragmentSpreadNode {
107
+ readonly kind: Kind.FRAGMENT_SPREAD;
108
+ readonly name: NameNode;
109
+ readonly directives?: ReadonlyArray<DirectiveNode>;
110
+ }
111
+ interface InlineFragmentNode {
112
+ readonly kind: Kind.INLINE_FRAGMENT;
113
+ readonly typeCondition?: NamedTypeNode;
114
+ readonly directives?: ReadonlyArray<DirectiveNode>;
115
+ readonly selectionSet: SelectionSetNode;
116
+ }
117
+ interface FragmentDefinitionNode {
118
+ readonly kind: Kind.FRAGMENT_DEFINITION;
119
+ readonly name: NameNode;
120
+ readonly typeCondition: NamedTypeNode;
121
+ readonly directives?: ReadonlyArray<DirectiveNode>;
122
+ readonly selectionSet: SelectionSetNode;
123
+ }
124
+ type ValueNode = VariableNode | IntValueNode | FloatValueNode | StringValueNode | BooleanValueNode | NullValueNode | EnumValueNode | ListValueNode | ObjectValueNode;
125
+ type ConstValueNode = IntValueNode | FloatValueNode | StringValueNode | BooleanValueNode | NullValueNode | EnumValueNode | ConstListValueNode | ConstObjectValueNode;
126
+ interface IntValueNode {
127
+ readonly kind: Kind.INT;
128
+ readonly value: string;
129
+ }
130
+ interface FloatValueNode {
131
+ readonly kind: Kind.FLOAT;
132
+ readonly value: string;
133
+ }
134
+ interface StringValueNode {
135
+ readonly kind: Kind.STRING;
136
+ readonly value: string;
137
+ readonly block?: boolean;
138
+ }
139
+ interface BooleanValueNode {
140
+ readonly kind: Kind.BOOLEAN;
141
+ readonly value: boolean;
142
+ }
143
+ interface NullValueNode {
144
+ readonly kind: Kind.NULL;
145
+ }
146
+ interface EnumValueNode {
147
+ readonly kind: Kind.ENUM;
148
+ readonly value: string;
149
+ }
150
+ interface ListValueNode {
151
+ readonly kind: Kind.LIST;
152
+ readonly values: ReadonlyArray<ValueNode>;
153
+ }
154
+ interface ConstListValueNode {
155
+ readonly kind: Kind.LIST;
156
+ readonly values: ReadonlyArray<ConstValueNode>;
157
+ }
158
+ interface ObjectValueNode {
159
+ readonly kind: Kind.OBJECT;
160
+ readonly fields: ReadonlyArray<ObjectFieldNode>;
161
+ }
162
+ interface ConstObjectValueNode {
163
+ readonly kind: Kind.OBJECT;
164
+ readonly fields: ReadonlyArray<ConstObjectFieldNode>;
165
+ }
166
+ interface ObjectFieldNode {
167
+ readonly kind: Kind.OBJECT_FIELD;
168
+ readonly name: NameNode;
169
+ readonly value: ValueNode;
170
+ }
171
+ interface ConstObjectFieldNode {
172
+ readonly kind: Kind.OBJECT_FIELD;
173
+ readonly name: NameNode;
174
+ readonly value: ConstValueNode;
175
+ }
176
+ interface DirectiveNode {
177
+ readonly kind: Kind.DIRECTIVE;
178
+ readonly name: NameNode;
179
+ readonly arguments?: ReadonlyArray<ArgumentNode>;
180
+ }
181
+ interface ConstDirectiveNode {
182
+ readonly kind: Kind.DIRECTIVE;
183
+ readonly name: NameNode;
184
+ readonly arguments?: ReadonlyArray<ConstArgumentNode>;
185
+ }
186
+ declare type TypeNode = NamedTypeNode | ListTypeNode | NonNullTypeNode;
187
+ interface NamedTypeNode {
188
+ readonly kind: Kind.NAMED_TYPE;
189
+ readonly name: NameNode;
190
+ }
191
+ interface ListTypeNode {
192
+ readonly kind: Kind.LIST_TYPE;
193
+ readonly type: TypeNode;
194
+ }
195
+ interface NonNullTypeNode {
196
+ readonly kind: Kind.NON_NULL_TYPE;
197
+ readonly type: NamedTypeNode | ListTypeNode;
198
+ }
199
+
200
+ type Maybe<T> = T | undefined | null;
201
+ interface Extensions {
202
+ [extension: string]: unknown;
203
+ }
204
+
205
+ declare class GraphQLError extends Error {
206
+ readonly locations: undefined;
207
+ readonly path: ReadonlyArray<string | number> | undefined;
208
+ readonly nodes: ReadonlyArray<ASTNode> | undefined;
209
+ readonly source: Source | undefined;
210
+ readonly positions: ReadonlyArray<number> | undefined;
211
+ readonly originalError: Error | undefined;
212
+ readonly extensions: Extensions;
213
+ constructor(message: string, nodes?: ReadonlyArray<ASTNode> | ASTNode | null, source?: Maybe<Source>, positions?: Maybe<ReadonlyArray<number>>, path?: Maybe<ReadonlyArray<string | number>>, originalError?: Maybe<Error>, extensions?: Maybe<Extensions>);
214
+ toJSON(): this;
215
+ toString(): string;
216
+ }
217
+
218
+ declare function blockString(string: string): string;
219
+ declare function parse(string: string): DocumentNode;
220
+ declare function parseValue(string: string): ValueNode | undefined;
221
+ declare function parseType(string: string): TypeNode | undefined;
222
+
223
+ declare const BREAK: {};
224
+ declare function visit<N extends ASTNode>(root: N, visitor: ASTVisitor): N;
225
+ declare function visit<R>(root: ASTNode, visitor: ASTReducer<R>): R;
226
+ type ASTVisitor = EnterLeaveVisitor<ASTNode> | KindVisitor;
227
+ type KindVisitor = {
228
+ readonly [NodeT in ASTNode as NodeT['kind']]?: ASTVisitFn<NodeT> | EnterLeaveVisitor<NodeT>;
229
+ };
230
+ interface EnterLeaveVisitor<TVisitedNode extends ASTNode> {
231
+ readonly enter?: ASTVisitFn<TVisitedNode> | undefined;
232
+ readonly leave?: ASTVisitFn<TVisitedNode> | undefined;
233
+ }
234
+ type ASTVisitFn<Node extends ASTNode> = (node: Node, key: string | number | undefined, parent: ASTNode | ReadonlyArray<ASTNode> | undefined, path: ReadonlyArray<string | number>, ancestors: ReadonlyArray<ASTNode | ReadonlyArray<ASTNode>>) => any;
235
+ type ASTReducer<R> = {
236
+ readonly [NodeT in ASTNode as NodeT['kind']]?: {
237
+ readonly enter?: ASTVisitFn<NodeT>;
238
+ readonly leave: ASTReducerFn<NodeT, R>;
239
+ };
240
+ };
241
+ type ASTReducerFn<TReducedNode extends ASTNode, R> = (node: {
242
+ [K in keyof TReducedNode]: ReducedField<TReducedNode[K], R>;
243
+ }, key: string | number | undefined, parent: ASTNode | ReadonlyArray<ASTNode> | undefined, path: ReadonlyArray<string | number>, ancestors: ReadonlyArray<ASTNode | ReadonlyArray<ASTNode>>) => R;
244
+ type ReducedField<T, R> = T extends null | undefined ? T : T extends ReadonlyArray<any> ? ReadonlyArray<R> : R;
245
+
246
+ declare function printString(string: string): string;
247
+ declare function printBlockString(string: string): string;
248
+ declare function print(node: ASTNode): string;
249
+
250
+ export { ASTNode, ASTReducer, ASTVisitFn, ASTVisitor, ArgumentNode, BREAK, BooleanValueNode, ConstArgumentNode, ConstDirectiveNode, ConstListValueNode, ConstObjectFieldNode, ConstObjectValueNode, ConstValueNode, DefinitionNode, DirectiveNode, DocumentNode, EnumValueNode, ExecutableDefinitionNode, FieldNode, FloatValueNode, FragmentDefinitionNode, FragmentSpreadNode, GraphQLError, InlineFragmentNode, IntValueNode, Kind, ListTypeNode, ListValueNode, Location, NameNode, NamedTypeNode, NonNullTypeNode, NullValueNode, ObjectFieldNode, ObjectValueNode, OperationDefinitionNode, OperationTypeNode, SelectionNode, SelectionSetNode, Source, StringValueNode, TypeNode, ValueNode, VariableDefinitionNode, VariableNode, blockString, parse, parseType, parseValue, print, printBlockString, printString, visit };