@0no-co/graphql.web 0.1.5 → 1.0.0
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/README.md +14 -0
- package/dist/graphql.web.d.ts +112 -112
- package/dist/graphql.web.js +38 -48
- package/dist/graphql.web.js.map +1 -1
- package/dist/graphql.web.mjs +19 -27
- package/dist/graphql.web.mjs.map +1 -1
- package/package.json +13 -4
package/README.md
CHANGED
|
@@ -31,6 +31,20 @@ spec-compliant or compatible with GraphQL.js’ implementation.
|
|
|
31
31
|
> project](https://github.com/0no-co/graphql-web-lite) is maintained to be
|
|
32
32
|
> a full shim/alias for the `graphql` package.
|
|
33
33
|
|
|
34
|
+
### Overview
|
|
35
|
+
|
|
36
|
+
`@0no-co/graphql.web` aims to provide a minimal set of exports to implement
|
|
37
|
+
client-side GraphQL utilities, mostly including parsing, printing, and visiting
|
|
38
|
+
the GraphQL AST, and the `GraphQLError` class.
|
|
39
|
+
|
|
40
|
+
Currently, `graphql.web` compresses to under 4kB and doesn’t regress on
|
|
41
|
+
GraphQL.js’ performance when parsing, printing, or visiting the AST.
|
|
42
|
+
|
|
43
|
+
For all primary APIs we aim to hit 100% test coverage and match the output,
|
|
44
|
+
types, and API compatibility of GraphQL.js, including — as far as possible
|
|
45
|
+
— TypeScript type compatibility of the AST types with the currently stable
|
|
46
|
+
version of GraphQL.js.
|
|
47
|
+
|
|
34
48
|
### API
|
|
35
49
|
|
|
36
50
|
Currently, only a select few exports are provided — namely, the ones listed here
|
package/dist/graphql.web.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/*!@ts-ignore*/
|
|
2
|
+
import * as GraphQL from 'graphql';
|
|
3
|
+
|
|
4
|
+
type Or<T, U> = 0 extends 1 & T ? U : T;
|
|
1
5
|
type Maybe<T> = T | undefined | null;
|
|
2
6
|
interface Extensions {
|
|
3
7
|
[extension: string]: unknown;
|
|
@@ -80,30 +84,30 @@ declare enum OperationTypeNode {
|
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
/** Type System Definition */
|
|
83
|
-
declare type TypeSystemDefinitionNode = SchemaDefinitionNode | TypeDefinitionNode | DirectiveDefinitionNode
|
|
84
|
-
|
|
87
|
+
declare type TypeSystemDefinitionNode = Or<GraphQL.TypeSystemDefinitionNode, SchemaDefinitionNode | TypeDefinitionNode | DirectiveDefinitionNode>;
|
|
88
|
+
type SchemaDefinitionNode = Or<GraphQL.SchemaDefinitionNode, {
|
|
85
89
|
readonly kind: Kind.SCHEMA_DEFINITION;
|
|
86
90
|
readonly loc?: Location;
|
|
87
91
|
readonly description?: StringValueNode;
|
|
88
92
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
89
93
|
readonly operationTypes: ReadonlyArray<OperationTypeDefinitionNode>;
|
|
90
|
-
}
|
|
91
|
-
|
|
94
|
+
}>;
|
|
95
|
+
type OperationTypeDefinitionNode = Or<GraphQL.OperationTypeDefinitionNode, {
|
|
92
96
|
readonly kind: Kind.OPERATION_TYPE_DEFINITION;
|
|
93
97
|
readonly loc?: Location;
|
|
94
98
|
readonly operation: OperationTypeNode;
|
|
95
99
|
readonly type: NamedTypeNode;
|
|
96
|
-
}
|
|
100
|
+
}>;
|
|
97
101
|
/** Type Definition */
|
|
98
|
-
declare type TypeDefinitionNode = ScalarTypeDefinitionNode | ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode | UnionTypeDefinitionNode | EnumTypeDefinitionNode | InputObjectTypeDefinitionNode
|
|
99
|
-
|
|
102
|
+
declare type TypeDefinitionNode = Or<GraphQL.TypeDefinitionNode, ScalarTypeDefinitionNode | ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode | UnionTypeDefinitionNode | EnumTypeDefinitionNode | InputObjectTypeDefinitionNode>;
|
|
103
|
+
type ScalarTypeDefinitionNode = Or<GraphQL.ScalarTypeDefinitionNode, {
|
|
100
104
|
readonly kind: Kind.SCALAR_TYPE_DEFINITION;
|
|
101
105
|
readonly loc?: Location;
|
|
102
106
|
readonly description?: StringValueNode;
|
|
103
107
|
readonly name: NameNode;
|
|
104
108
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
105
|
-
}
|
|
106
|
-
|
|
109
|
+
}>;
|
|
110
|
+
type ObjectTypeDefinitionNode = Or<GraphQL.ObjectTypeDefinitionNode, {
|
|
107
111
|
readonly kind: Kind.OBJECT_TYPE_DEFINITION;
|
|
108
112
|
readonly loc?: Location;
|
|
109
113
|
readonly description?: StringValueNode;
|
|
@@ -111,8 +115,8 @@ interface ObjectTypeDefinitionNode {
|
|
|
111
115
|
readonly interfaces?: ReadonlyArray<NamedTypeNode>;
|
|
112
116
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
113
117
|
readonly fields?: ReadonlyArray<FieldDefinitionNode>;
|
|
114
|
-
}
|
|
115
|
-
|
|
118
|
+
}>;
|
|
119
|
+
type FieldDefinitionNode = Or<GraphQL.FieldDefinitionNode, {
|
|
116
120
|
readonly kind: Kind.FIELD_DEFINITION;
|
|
117
121
|
readonly loc?: Location;
|
|
118
122
|
readonly description?: StringValueNode;
|
|
@@ -120,8 +124,8 @@ interface FieldDefinitionNode {
|
|
|
120
124
|
readonly arguments?: ReadonlyArray<InputValueDefinitionNode>;
|
|
121
125
|
readonly type: TypeNode;
|
|
122
126
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
123
|
-
}
|
|
124
|
-
|
|
127
|
+
}>;
|
|
128
|
+
type InputValueDefinitionNode = Or<GraphQL.InputValueDefinitionNode, {
|
|
125
129
|
readonly kind: Kind.INPUT_VALUE_DEFINITION;
|
|
126
130
|
readonly loc?: Location;
|
|
127
131
|
readonly description?: StringValueNode;
|
|
@@ -129,8 +133,8 @@ interface InputValueDefinitionNode {
|
|
|
129
133
|
readonly type: TypeNode;
|
|
130
134
|
readonly defaultValue?: ConstValueNode;
|
|
131
135
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
132
|
-
}
|
|
133
|
-
|
|
136
|
+
}>;
|
|
137
|
+
type InterfaceTypeDefinitionNode = Or<GraphQL.InterfaceTypeDefinitionNode, {
|
|
134
138
|
readonly kind: Kind.INTERFACE_TYPE_DEFINITION;
|
|
135
139
|
readonly loc?: Location;
|
|
136
140
|
readonly description?: StringValueNode;
|
|
@@ -138,40 +142,39 @@ interface InterfaceTypeDefinitionNode {
|
|
|
138
142
|
readonly interfaces?: ReadonlyArray<NamedTypeNode>;
|
|
139
143
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
140
144
|
readonly fields?: ReadonlyArray<FieldDefinitionNode>;
|
|
141
|
-
}
|
|
142
|
-
|
|
145
|
+
}>;
|
|
146
|
+
type UnionTypeDefinitionNode = Or<GraphQL.UnionTypeDefinitionNode, {
|
|
143
147
|
readonly kind: Kind.UNION_TYPE_DEFINITION;
|
|
144
148
|
readonly loc?: Location;
|
|
145
149
|
readonly description?: StringValueNode;
|
|
146
150
|
readonly name: NameNode;
|
|
147
151
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
148
152
|
readonly types?: ReadonlyArray<NamedTypeNode>;
|
|
149
|
-
}
|
|
150
|
-
|
|
153
|
+
}>;
|
|
154
|
+
type EnumTypeDefinitionNode = Or<GraphQL.EnumTypeDefinitionNode, {
|
|
151
155
|
readonly kind: Kind.ENUM_TYPE_DEFINITION;
|
|
152
156
|
readonly loc?: Location;
|
|
153
157
|
readonly description?: StringValueNode;
|
|
154
158
|
readonly name: NameNode;
|
|
155
159
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
156
160
|
readonly values?: ReadonlyArray<EnumValueDefinitionNode>;
|
|
157
|
-
}
|
|
158
|
-
|
|
161
|
+
}>;
|
|
162
|
+
type EnumValueDefinitionNode = Or<GraphQL.EnumValueDefinitionNode, {
|
|
159
163
|
readonly kind: Kind.ENUM_VALUE_DEFINITION;
|
|
160
164
|
readonly loc?: Location;
|
|
161
165
|
readonly description?: StringValueNode;
|
|
162
166
|
readonly name: NameNode;
|
|
163
167
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
164
|
-
}
|
|
165
|
-
|
|
168
|
+
}>;
|
|
169
|
+
type InputObjectTypeDefinitionNode = Or<GraphQL.InputObjectTypeDefinitionNode, {
|
|
166
170
|
readonly kind: Kind.INPUT_OBJECT_TYPE_DEFINITION;
|
|
167
171
|
readonly loc?: Location;
|
|
168
172
|
readonly description?: StringValueNode;
|
|
169
173
|
readonly name: NameNode;
|
|
170
174
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
171
175
|
readonly fields?: ReadonlyArray<InputValueDefinitionNode>;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
interface DirectiveDefinitionNode {
|
|
176
|
+
}>;
|
|
177
|
+
type DirectiveDefinitionNode = Or<GraphQL.DirectiveDefinitionNode, {
|
|
175
178
|
readonly kind: Kind.DIRECTIVE_DEFINITION;
|
|
176
179
|
readonly loc?: Location;
|
|
177
180
|
readonly description?: StringValueNode;
|
|
@@ -179,75 +182,73 @@ interface DirectiveDefinitionNode {
|
|
|
179
182
|
readonly arguments?: ReadonlyArray<InputValueDefinitionNode>;
|
|
180
183
|
readonly repeatable: boolean;
|
|
181
184
|
readonly locations: ReadonlyArray<NameNode>;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
interface SchemaExtensionNode {
|
|
185
|
+
}>;
|
|
186
|
+
type TypeSystemExtensionNode = Or<GraphQL.TypeSystemExtensionNode, SchemaExtensionNode | TypeExtensionNode>;
|
|
187
|
+
type SchemaExtensionNode = Or<GraphQL.SchemaExtensionNode, {
|
|
186
188
|
readonly kind: Kind.SCHEMA_EXTENSION;
|
|
187
189
|
readonly loc?: Location;
|
|
188
190
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
189
191
|
readonly operationTypes?: ReadonlyArray<OperationTypeDefinitionNode>;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
interface ScalarTypeExtensionNode {
|
|
192
|
+
}>;
|
|
193
|
+
declare type TypeExtensionNode = Or<GraphQL.TypeExtensionNode, ScalarTypeExtensionNode | ObjectTypeExtensionNode | InterfaceTypeExtensionNode | UnionTypeExtensionNode | EnumTypeExtensionNode | InputObjectTypeExtensionNode>;
|
|
194
|
+
type ScalarTypeExtensionNode = Or<GraphQL.ScalarTypeExtensionNode, {
|
|
194
195
|
readonly kind: Kind.SCALAR_TYPE_EXTENSION;
|
|
195
196
|
readonly loc?: Location;
|
|
196
197
|
readonly name: NameNode;
|
|
197
198
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
198
|
-
}
|
|
199
|
-
|
|
199
|
+
}>;
|
|
200
|
+
type ObjectTypeExtensionNode = Or<GraphQL.ObjectTypeExtensionNode, {
|
|
200
201
|
readonly kind: Kind.OBJECT_TYPE_EXTENSION;
|
|
201
202
|
readonly loc?: Location;
|
|
202
203
|
readonly name: NameNode;
|
|
203
204
|
readonly interfaces?: ReadonlyArray<NamedTypeNode>;
|
|
204
205
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
205
206
|
readonly fields?: ReadonlyArray<FieldDefinitionNode>;
|
|
206
|
-
}
|
|
207
|
-
|
|
207
|
+
}>;
|
|
208
|
+
type InterfaceTypeExtensionNode = Or<GraphQL.InterfaceTypeExtensionNode, {
|
|
208
209
|
readonly kind: Kind.INTERFACE_TYPE_EXTENSION;
|
|
209
210
|
readonly loc?: Location;
|
|
210
211
|
readonly name: NameNode;
|
|
211
212
|
readonly interfaces?: ReadonlyArray<NamedTypeNode>;
|
|
212
213
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
213
214
|
readonly fields?: ReadonlyArray<FieldDefinitionNode>;
|
|
214
|
-
}
|
|
215
|
-
|
|
215
|
+
}>;
|
|
216
|
+
type UnionTypeExtensionNode = Or<GraphQL.UnionTypeExtensionNode, {
|
|
216
217
|
readonly kind: Kind.UNION_TYPE_EXTENSION;
|
|
217
218
|
readonly loc?: Location;
|
|
218
219
|
readonly name: NameNode;
|
|
219
220
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
220
221
|
readonly types?: ReadonlyArray<NamedTypeNode>;
|
|
221
|
-
}
|
|
222
|
-
|
|
222
|
+
}>;
|
|
223
|
+
type EnumTypeExtensionNode = Or<GraphQL.EnumTypeExtensionNode, {
|
|
223
224
|
readonly kind: Kind.ENUM_TYPE_EXTENSION;
|
|
224
225
|
readonly loc?: Location;
|
|
225
226
|
readonly name: NameNode;
|
|
226
227
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
227
228
|
readonly values?: ReadonlyArray<EnumValueDefinitionNode>;
|
|
228
|
-
}
|
|
229
|
-
|
|
229
|
+
}>;
|
|
230
|
+
type InputObjectTypeExtensionNode = Or<GraphQL.InputObjectTypeExtensionNode, {
|
|
230
231
|
readonly kind: Kind.INPUT_OBJECT_TYPE_EXTENSION;
|
|
231
232
|
readonly loc?: Location;
|
|
232
233
|
readonly name: NameNode;
|
|
233
234
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
234
235
|
readonly fields?: ReadonlyArray<InputValueDefinitionNode>;
|
|
235
|
-
}
|
|
236
|
+
}>;
|
|
236
237
|
|
|
237
|
-
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 | SchemaDefinitionNode | OperationTypeDefinitionNode | ScalarTypeDefinitionNode | ObjectTypeDefinitionNode | FieldDefinitionNode | InputValueDefinitionNode | InterfaceTypeDefinitionNode | UnionTypeDefinitionNode | EnumTypeDefinitionNode | EnumValueDefinitionNode | InputObjectTypeDefinitionNode | DirectiveDefinitionNode | SchemaExtensionNode | ScalarTypeExtensionNode | ObjectTypeExtensionNode | InterfaceTypeExtensionNode | UnionTypeExtensionNode | EnumTypeExtensionNode | InputObjectTypeExtensionNode
|
|
238
|
-
|
|
238
|
+
type ASTNode = Or<GraphQL.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 | SchemaDefinitionNode | OperationTypeDefinitionNode | ScalarTypeDefinitionNode | ObjectTypeDefinitionNode | FieldDefinitionNode | InputValueDefinitionNode | InterfaceTypeDefinitionNode | UnionTypeDefinitionNode | EnumTypeDefinitionNode | EnumValueDefinitionNode | InputObjectTypeDefinitionNode | DirectiveDefinitionNode | SchemaExtensionNode | ScalarTypeExtensionNode | ObjectTypeExtensionNode | InterfaceTypeExtensionNode | UnionTypeExtensionNode | EnumTypeExtensionNode | InputObjectTypeExtensionNode>;
|
|
239
|
+
type NameNode = Or<GraphQL.NameNode, {
|
|
239
240
|
readonly kind: Kind.NAME;
|
|
240
241
|
readonly value: string;
|
|
241
242
|
readonly loc?: Location;
|
|
242
|
-
}
|
|
243
|
-
|
|
243
|
+
}>;
|
|
244
|
+
type DocumentNode = Or<GraphQL.DocumentNode, {
|
|
244
245
|
readonly kind: Kind.DOCUMENT;
|
|
245
246
|
readonly definitions: ReadonlyArray<DefinitionNode>;
|
|
246
247
|
readonly loc?: Location;
|
|
247
|
-
}
|
|
248
|
-
type DefinitionNode = ExecutableDefinitionNode | TypeSystemDefinitionNode | TypeSystemExtensionNode
|
|
249
|
-
type ExecutableDefinitionNode = OperationDefinitionNode | FragmentDefinitionNode
|
|
250
|
-
|
|
248
|
+
}>;
|
|
249
|
+
type DefinitionNode = Or<GraphQL.DefinitionNode, ExecutableDefinitionNode | TypeSystemDefinitionNode | TypeSystemExtensionNode>;
|
|
250
|
+
type ExecutableDefinitionNode = Or<GraphQL.ExecutableDefinitionNode, OperationDefinitionNode | FragmentDefinitionNode>;
|
|
251
|
+
type OperationDefinitionNode = Or<GraphQL.OperationDefinitionNode, {
|
|
251
252
|
readonly kind: Kind.OPERATION_DEFINITION;
|
|
252
253
|
readonly operation: OperationTypeNode;
|
|
253
254
|
readonly name?: NameNode;
|
|
@@ -255,27 +256,27 @@ interface OperationDefinitionNode {
|
|
|
255
256
|
readonly directives?: ReadonlyArray<DirectiveNode>;
|
|
256
257
|
readonly selectionSet: SelectionSetNode;
|
|
257
258
|
readonly loc?: Location;
|
|
258
|
-
}
|
|
259
|
-
|
|
259
|
+
}>;
|
|
260
|
+
type VariableDefinitionNode = Or<GraphQL.VariableDefinitionNode, {
|
|
260
261
|
readonly kind: Kind.VARIABLE_DEFINITION;
|
|
261
262
|
readonly variable: VariableNode;
|
|
262
263
|
readonly type: TypeNode;
|
|
263
264
|
readonly defaultValue?: ConstValueNode;
|
|
264
265
|
readonly directives?: ReadonlyArray<ConstDirectiveNode>;
|
|
265
266
|
readonly loc?: Location;
|
|
266
|
-
}
|
|
267
|
-
|
|
267
|
+
}>;
|
|
268
|
+
type VariableNode = Or<GraphQL.VariableNode, {
|
|
268
269
|
readonly kind: Kind.VARIABLE;
|
|
269
270
|
readonly name: NameNode;
|
|
270
271
|
readonly loc?: Location;
|
|
271
|
-
}
|
|
272
|
-
|
|
272
|
+
}>;
|
|
273
|
+
type SelectionSetNode = Or<GraphQL.SelectionSetNode, {
|
|
273
274
|
readonly kind: Kind.SELECTION_SET;
|
|
274
275
|
readonly selections: ReadonlyArray<SelectionNode>;
|
|
275
276
|
readonly loc?: Location;
|
|
276
|
-
}
|
|
277
|
-
declare type SelectionNode = FieldNode | FragmentSpreadNode | InlineFragmentNode
|
|
278
|
-
|
|
277
|
+
}>;
|
|
278
|
+
declare type SelectionNode = Or<GraphQL.SelectionNode, FieldNode | FragmentSpreadNode | InlineFragmentNode>;
|
|
279
|
+
type FieldNode = Or<GraphQL.FieldNode, {
|
|
279
280
|
readonly kind: Kind.FIELD;
|
|
280
281
|
readonly alias?: NameNode;
|
|
281
282
|
readonly name: NameNode;
|
|
@@ -283,132 +284,132 @@ interface FieldNode {
|
|
|
283
284
|
readonly directives?: ReadonlyArray<DirectiveNode>;
|
|
284
285
|
readonly selectionSet?: SelectionSetNode;
|
|
285
286
|
readonly loc?: Location;
|
|
286
|
-
}
|
|
287
|
-
|
|
287
|
+
}>;
|
|
288
|
+
type ArgumentNode = Or<GraphQL.ArgumentNode, {
|
|
288
289
|
readonly kind: Kind.ARGUMENT;
|
|
289
290
|
readonly name: NameNode;
|
|
290
291
|
readonly value: ValueNode;
|
|
291
292
|
readonly loc?: Location;
|
|
292
|
-
}
|
|
293
|
-
|
|
293
|
+
}>;
|
|
294
|
+
type ConstArgumentNode = Or<GraphQL.ConstArgumentNode, {
|
|
294
295
|
readonly kind: Kind.ARGUMENT;
|
|
295
296
|
readonly name: NameNode;
|
|
296
297
|
readonly value: ConstValueNode;
|
|
297
298
|
readonly loc?: Location;
|
|
298
|
-
}
|
|
299
|
-
|
|
299
|
+
}>;
|
|
300
|
+
type FragmentSpreadNode = Or<GraphQL.FragmentSpreadNode, {
|
|
300
301
|
readonly kind: Kind.FRAGMENT_SPREAD;
|
|
301
302
|
readonly name: NameNode;
|
|
302
303
|
readonly directives?: ReadonlyArray<DirectiveNode>;
|
|
303
304
|
readonly loc?: Location;
|
|
304
|
-
}
|
|
305
|
-
|
|
305
|
+
}>;
|
|
306
|
+
type InlineFragmentNode = Or<GraphQL.InlineFragmentNode, {
|
|
306
307
|
readonly kind: Kind.INLINE_FRAGMENT;
|
|
307
308
|
readonly typeCondition?: NamedTypeNode;
|
|
308
309
|
readonly directives?: ReadonlyArray<DirectiveNode>;
|
|
309
310
|
readonly selectionSet: SelectionSetNode;
|
|
310
311
|
readonly loc?: Location;
|
|
311
|
-
}
|
|
312
|
-
|
|
312
|
+
}>;
|
|
313
|
+
type FragmentDefinitionNode = Or<GraphQL.FragmentDefinitionNode, {
|
|
313
314
|
readonly kind: Kind.FRAGMENT_DEFINITION;
|
|
314
315
|
readonly name: NameNode;
|
|
315
316
|
readonly typeCondition: NamedTypeNode;
|
|
316
317
|
readonly directives?: ReadonlyArray<DirectiveNode>;
|
|
317
318
|
readonly selectionSet: SelectionSetNode;
|
|
318
319
|
readonly loc?: Location;
|
|
319
|
-
}
|
|
320
|
-
type ValueNode = VariableNode | IntValueNode | FloatValueNode | StringValueNode | BooleanValueNode | NullValueNode | EnumValueNode | ListValueNode | ObjectValueNode
|
|
321
|
-
type ConstValueNode = IntValueNode | FloatValueNode | StringValueNode | BooleanValueNode | NullValueNode | EnumValueNode | ConstListValueNode | ConstObjectValueNode
|
|
322
|
-
|
|
320
|
+
}>;
|
|
321
|
+
type ValueNode = Or<GraphQL.ValueNode, VariableNode | IntValueNode | FloatValueNode | StringValueNode | BooleanValueNode | NullValueNode | EnumValueNode | ListValueNode | ObjectValueNode>;
|
|
322
|
+
type ConstValueNode = Or<GraphQL.ConstValueNode, IntValueNode | FloatValueNode | StringValueNode | BooleanValueNode | NullValueNode | EnumValueNode | ConstListValueNode | ConstObjectValueNode>;
|
|
323
|
+
type IntValueNode = Or<GraphQL.IntValueNode, {
|
|
323
324
|
readonly kind: Kind.INT;
|
|
324
325
|
readonly value: string;
|
|
325
326
|
readonly loc?: Location;
|
|
326
|
-
}
|
|
327
|
-
|
|
327
|
+
}>;
|
|
328
|
+
type FloatValueNode = Or<GraphQL.FloatValueNode, {
|
|
328
329
|
readonly kind: Kind.FLOAT;
|
|
329
330
|
readonly value: string;
|
|
330
331
|
readonly loc?: Location;
|
|
331
|
-
}
|
|
332
|
-
|
|
332
|
+
}>;
|
|
333
|
+
type StringValueNode = Or<GraphQL.FloatValueNode, {
|
|
333
334
|
readonly kind: Kind.STRING;
|
|
334
335
|
readonly value: string;
|
|
335
336
|
readonly block?: boolean;
|
|
336
337
|
readonly loc?: Location;
|
|
337
|
-
}
|
|
338
|
-
|
|
338
|
+
}>;
|
|
339
|
+
type BooleanValueNode = Or<GraphQL.BooleanValueNode, {
|
|
339
340
|
readonly kind: Kind.BOOLEAN;
|
|
340
341
|
readonly value: boolean;
|
|
341
342
|
readonly loc?: Location;
|
|
342
|
-
}
|
|
343
|
-
|
|
343
|
+
}>;
|
|
344
|
+
type NullValueNode = Or<GraphQL.NullValueNode, {
|
|
344
345
|
readonly kind: Kind.NULL;
|
|
345
346
|
readonly loc?: Location;
|
|
346
|
-
}
|
|
347
|
-
|
|
347
|
+
}>;
|
|
348
|
+
type EnumValueNode = Or<GraphQL.EnumValueNode, {
|
|
348
349
|
readonly kind: Kind.ENUM;
|
|
349
350
|
readonly value: string;
|
|
350
351
|
readonly loc?: Location;
|
|
351
|
-
}
|
|
352
|
-
|
|
352
|
+
}>;
|
|
353
|
+
type ListValueNode = Or<GraphQL.ListValueNode, {
|
|
353
354
|
readonly kind: Kind.LIST;
|
|
354
355
|
readonly values: ReadonlyArray<ValueNode>;
|
|
355
356
|
readonly loc?: Location;
|
|
356
|
-
}
|
|
357
|
-
|
|
357
|
+
}>;
|
|
358
|
+
type ConstListValueNode = Or<GraphQL.ConstListValueNode, {
|
|
358
359
|
readonly kind: Kind.LIST;
|
|
359
360
|
readonly values: ReadonlyArray<ConstValueNode>;
|
|
360
361
|
readonly loc?: Location;
|
|
361
|
-
}
|
|
362
|
-
|
|
362
|
+
}>;
|
|
363
|
+
type ObjectValueNode = Or<GraphQL.ObjectValueNode, {
|
|
363
364
|
readonly kind: Kind.OBJECT;
|
|
364
365
|
readonly fields: ReadonlyArray<ObjectFieldNode>;
|
|
365
366
|
readonly loc?: Location;
|
|
366
|
-
}
|
|
367
|
-
|
|
367
|
+
}>;
|
|
368
|
+
type ConstObjectValueNode = Or<GraphQL.ConstObjectValueNode, {
|
|
368
369
|
readonly kind: Kind.OBJECT;
|
|
369
370
|
readonly fields: ReadonlyArray<ConstObjectFieldNode>;
|
|
370
371
|
readonly loc?: Location;
|
|
371
|
-
}
|
|
372
|
-
|
|
372
|
+
}>;
|
|
373
|
+
type ObjectFieldNode = Or<GraphQL.ObjectFieldNode, {
|
|
373
374
|
readonly kind: Kind.OBJECT_FIELD;
|
|
374
375
|
readonly name: NameNode;
|
|
375
376
|
readonly value: ValueNode;
|
|
376
377
|
readonly loc?: Location;
|
|
377
|
-
}
|
|
378
|
-
|
|
378
|
+
}>;
|
|
379
|
+
type ConstObjectFieldNode = Or<GraphQL.ConstObjectFieldNode, {
|
|
379
380
|
readonly kind: Kind.OBJECT_FIELD;
|
|
380
381
|
readonly name: NameNode;
|
|
381
382
|
readonly value: ConstValueNode;
|
|
382
383
|
readonly loc?: Location;
|
|
383
|
-
}
|
|
384
|
-
|
|
384
|
+
}>;
|
|
385
|
+
type DirectiveNode = Or<GraphQL.DirectiveNode, {
|
|
385
386
|
readonly kind: Kind.DIRECTIVE;
|
|
386
387
|
readonly name: NameNode;
|
|
387
388
|
readonly arguments?: ReadonlyArray<ArgumentNode>;
|
|
388
389
|
readonly loc?: Location;
|
|
389
|
-
}
|
|
390
|
-
|
|
390
|
+
}>;
|
|
391
|
+
type ConstDirectiveNode = Or<GraphQL.ConstDirectiveNode, {
|
|
391
392
|
readonly kind: Kind.DIRECTIVE;
|
|
392
393
|
readonly name: NameNode;
|
|
393
394
|
readonly arguments?: ReadonlyArray<ConstArgumentNode>;
|
|
394
395
|
readonly loc?: Location;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
|
|
396
|
+
}>;
|
|
397
|
+
type TypeNode = Or<GraphQL.TypeNode, NamedTypeNode | ListTypeNode | NonNullTypeNode>;
|
|
398
|
+
type NamedTypeNode = Or<GraphQL.NamedTypeNode, {
|
|
398
399
|
readonly kind: Kind.NAMED_TYPE;
|
|
399
400
|
readonly name: NameNode;
|
|
400
401
|
readonly loc?: Location;
|
|
401
|
-
}
|
|
402
|
-
|
|
402
|
+
}>;
|
|
403
|
+
type ListTypeNode = Or<GraphQL.ListTypeNode, {
|
|
403
404
|
readonly kind: Kind.LIST_TYPE;
|
|
404
405
|
readonly type: TypeNode;
|
|
405
406
|
readonly loc?: Location;
|
|
406
|
-
}
|
|
407
|
-
|
|
407
|
+
}>;
|
|
408
|
+
type NonNullTypeNode = Or<GraphQL.NonNullTypeNode, {
|
|
408
409
|
readonly kind: Kind.NON_NULL_TYPE;
|
|
409
410
|
readonly type: NamedTypeNode | ListTypeNode;
|
|
410
411
|
readonly loc?: Location;
|
|
411
|
-
}
|
|
412
|
+
}>;
|
|
412
413
|
|
|
413
414
|
declare class GraphQLError extends Error {
|
|
414
415
|
readonly locations: ReadonlyArray<any> | undefined;
|
|
@@ -424,7 +425,6 @@ declare class GraphQLError extends Error {
|
|
|
424
425
|
get [Symbol.toStringTag](): string;
|
|
425
426
|
}
|
|
426
427
|
|
|
427
|
-
declare function blockString(string: string): string;
|
|
428
428
|
type ParseOptions = {
|
|
429
429
|
[option: string]: any;
|
|
430
430
|
};
|
|
@@ -462,4 +462,4 @@ declare function print(node: ASTNode): string;
|
|
|
462
462
|
declare function valueFromASTUntyped(node: ValueNode, variables?: Maybe<Record<string, any>>): unknown;
|
|
463
463
|
declare function valueFromTypeNode(node: ValueNode, type: TypeNode, variables?: Maybe<Record<string, any>>): unknown;
|
|
464
464
|
|
|
465
|
-
export { ASTNode, ASTReducer, ASTVisitFn, ASTVisitor, ArgumentNode, BREAK, BooleanValueNode, ConstArgumentNode, ConstDirectiveNode, ConstListValueNode, ConstObjectFieldNode, ConstObjectValueNode, ConstValueNode, DefinitionNode, DirectiveDefinitionNode, DirectiveNode, DocumentNode, EnumTypeDefinitionNode, EnumTypeExtensionNode, EnumValueDefinitionNode, EnumValueNode, ExecutableDefinitionNode, FieldDefinitionNode, FieldNode, FloatValueNode, FragmentDefinitionNode, FragmentSpreadNode, GraphQLError, InlineFragmentNode, InputObjectTypeDefinitionNode, InputObjectTypeExtensionNode, InputValueDefinitionNode, IntValueNode, InterfaceTypeDefinitionNode, InterfaceTypeExtensionNode, Kind, ListTypeNode, ListValueNode, Location, NameNode, NamedTypeNode, NonNullTypeNode, NullValueNode, ObjectFieldNode, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, ObjectValueNode, OperationDefinitionNode, OperationTypeDefinitionNode, OperationTypeNode, ScalarTypeDefinitionNode, ScalarTypeExtensionNode, SchemaDefinitionNode, SchemaExtensionNode, SelectionNode, SelectionSetNode, Source, StringValueNode, TypeDefinitionNode, TypeExtensionNode, TypeNode, TypeSystemDefinitionNode, TypeSystemExtensionNode, UnionTypeDefinitionNode, UnionTypeExtensionNode, ValueNode, VariableDefinitionNode, VariableNode,
|
|
465
|
+
export { ASTNode, ASTReducer, ASTVisitFn, ASTVisitor, ArgumentNode, BREAK, BooleanValueNode, ConstArgumentNode, ConstDirectiveNode, ConstListValueNode, ConstObjectFieldNode, ConstObjectValueNode, ConstValueNode, DefinitionNode, DirectiveDefinitionNode, DirectiveNode, DocumentNode, EnumTypeDefinitionNode, EnumTypeExtensionNode, EnumValueDefinitionNode, EnumValueNode, ExecutableDefinitionNode, FieldDefinitionNode, FieldNode, FloatValueNode, FragmentDefinitionNode, FragmentSpreadNode, GraphQLError, InlineFragmentNode, InputObjectTypeDefinitionNode, InputObjectTypeExtensionNode, InputValueDefinitionNode, IntValueNode, InterfaceTypeDefinitionNode, InterfaceTypeExtensionNode, Kind, ListTypeNode, ListValueNode, Location, NameNode, NamedTypeNode, NonNullTypeNode, NullValueNode, ObjectFieldNode, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, ObjectValueNode, OperationDefinitionNode, OperationTypeDefinitionNode, OperationTypeNode, ScalarTypeDefinitionNode, ScalarTypeExtensionNode, SchemaDefinitionNode, SchemaExtensionNode, SelectionNode, SelectionSetNode, Source, StringValueNode, TypeDefinitionNode, TypeExtensionNode, TypeNode, TypeSystemDefinitionNode, TypeSystemExtensionNode, UnionTypeDefinitionNode, UnionTypeExtensionNode, ValueNode, VariableDefinitionNode, VariableNode, parse, parseType, parseValue, print, printBlockString, printString, valueFromASTUntyped, valueFromTypeNode, visit };
|
package/dist/graphql.web.js
CHANGED
|
@@ -33,7 +33,8 @@ class GraphQLError extends Error {
|
|
|
33
33
|
}
|
|
34
34
|
toJSON() {
|
|
35
35
|
return {
|
|
36
|
-
...this
|
|
36
|
+
...this,
|
|
37
|
+
message: this.message
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
40
|
toString() {
|
|
@@ -111,15 +112,15 @@ var t = /null|true|false/y;
|
|
|
111
112
|
|
|
112
113
|
var a = /\$[_\w][_\d\w]*/y;
|
|
113
114
|
|
|
114
|
-
var o =
|
|
115
|
+
var o = /-?\d+/y;
|
|
115
116
|
|
|
116
|
-
var l = /(
|
|
117
|
+
var l = /(?:\.\d+)?(?:[eE][+-]?\d+)?/y;
|
|
117
118
|
|
|
118
119
|
var u = /\\/g;
|
|
119
120
|
|
|
120
|
-
var
|
|
121
|
+
var v = /"""(?:[\s\S]+(?="""))?"""/y;
|
|
121
122
|
|
|
122
|
-
var
|
|
123
|
+
var d = /"(?:[^"\r\n]+)?"/y;
|
|
123
124
|
|
|
124
125
|
function value(i) {
|
|
125
126
|
var s;
|
|
@@ -139,28 +140,31 @@ function value(i) {
|
|
|
139
140
|
value: c.slice(1)
|
|
140
141
|
}
|
|
141
142
|
};
|
|
142
|
-
} else if (c = advance(l)) {
|
|
143
|
-
s = {
|
|
144
|
-
kind: "FloatValue",
|
|
145
|
-
value: c
|
|
146
|
-
};
|
|
147
143
|
} else if (c = advance(o)) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
144
|
+
var f = c;
|
|
145
|
+
if (c = advance(l)) {
|
|
146
|
+
s = {
|
|
147
|
+
kind: "FloatValue",
|
|
148
|
+
value: f + c
|
|
149
|
+
};
|
|
150
|
+
} else {
|
|
151
|
+
s = {
|
|
152
|
+
kind: "IntValue",
|
|
153
|
+
value: f
|
|
154
|
+
};
|
|
155
|
+
}
|
|
152
156
|
} else if (c = advance(n)) {
|
|
153
157
|
s = {
|
|
154
158
|
kind: "EnumValue",
|
|
155
159
|
value: c
|
|
156
160
|
};
|
|
157
|
-
} else if (c = advance(
|
|
161
|
+
} else if (c = advance(v)) {
|
|
158
162
|
s = {
|
|
159
163
|
kind: "StringValue",
|
|
160
164
|
value: blockString(c.slice(3, -3)),
|
|
161
165
|
block: !0
|
|
162
166
|
};
|
|
163
|
-
} else if (c = advance(
|
|
167
|
+
} else if (c = advance(d)) {
|
|
164
168
|
s = {
|
|
165
169
|
kind: "StringValue",
|
|
166
170
|
value: u.test(c) ? JSON.parse(c) : c.slice(1, -1),
|
|
@@ -453,9 +457,6 @@ function operationDefinition() {
|
|
|
453
457
|
throw error("VariableDefinition");
|
|
454
458
|
}
|
|
455
459
|
var t = type();
|
|
456
|
-
if (!t) {
|
|
457
|
-
throw error("VariableDefinition");
|
|
458
|
-
}
|
|
459
460
|
var o = void 0;
|
|
460
461
|
if (61 === e.charCodeAt(r)) {
|
|
461
462
|
r++;
|
|
@@ -683,24 +684,19 @@ exports.OperationTypeNode = {
|
|
|
683
684
|
SUBSCRIPTION: "subscription"
|
|
684
685
|
};
|
|
685
686
|
|
|
686
|
-
exports.blockString = blockString;
|
|
687
|
-
|
|
688
687
|
exports.parse = function parse(i, n) {
|
|
689
688
|
e = "string" == typeof i.body ? i.body : i;
|
|
690
689
|
r = 0;
|
|
691
690
|
return function document() {
|
|
692
|
-
var
|
|
691
|
+
var e;
|
|
693
692
|
ignored();
|
|
694
|
-
var
|
|
695
|
-
while (
|
|
696
|
-
|
|
697
|
-
}
|
|
698
|
-
if (r !== e.length) {
|
|
699
|
-
throw error("Document");
|
|
693
|
+
var r = [];
|
|
694
|
+
while (e = fragmentDefinition() || operationDefinition()) {
|
|
695
|
+
r.push(e);
|
|
700
696
|
}
|
|
701
697
|
return {
|
|
702
698
|
kind: "Document",
|
|
703
|
-
definitions:
|
|
699
|
+
definitions: r
|
|
704
700
|
};
|
|
705
701
|
}();
|
|
706
702
|
};
|
|
@@ -708,11 +704,7 @@ exports.parse = function parse(i, n) {
|
|
|
708
704
|
exports.parseType = function parseType(i, n) {
|
|
709
705
|
e = "string" == typeof i.body ? i.body : i;
|
|
710
706
|
r = 0;
|
|
711
|
-
|
|
712
|
-
if (!t) {
|
|
713
|
-
throw error("TypeNode");
|
|
714
|
-
}
|
|
715
|
-
return t;
|
|
707
|
+
return type();
|
|
716
708
|
};
|
|
717
709
|
|
|
718
710
|
exports.parseValue = function parseValue(i, n) {
|
|
@@ -789,8 +781,8 @@ exports.visit = function visit(e, r) {
|
|
|
789
781
|
if (a) {
|
|
790
782
|
i.push(a);
|
|
791
783
|
}
|
|
792
|
-
var
|
|
793
|
-
var
|
|
784
|
+
var v;
|
|
785
|
+
var d = {
|
|
794
786
|
...e
|
|
795
787
|
};
|
|
796
788
|
for (var s in e) {
|
|
@@ -802,29 +794,27 @@ exports.visit = function visit(e, r) {
|
|
|
802
794
|
if (null != c[p] && "string" == typeof c[p].kind) {
|
|
803
795
|
i.push(e);
|
|
804
796
|
n.push(p);
|
|
805
|
-
|
|
797
|
+
v = traverse(c[p], p, c);
|
|
806
798
|
n.pop();
|
|
807
799
|
i.pop();
|
|
808
|
-
if (
|
|
809
|
-
f.push(c[p]);
|
|
810
|
-
} else if (null === d) {
|
|
800
|
+
if (null == v) {
|
|
811
801
|
o = !0;
|
|
812
802
|
} else {
|
|
813
|
-
o = o ||
|
|
814
|
-
f.push(
|
|
803
|
+
o = o || v !== c[p];
|
|
804
|
+
f.push(v);
|
|
815
805
|
}
|
|
816
806
|
}
|
|
817
807
|
}
|
|
818
808
|
c = f;
|
|
819
809
|
} else if (null != c && "string" == typeof c.kind) {
|
|
820
|
-
if (void 0 !== (
|
|
821
|
-
o = o || c !==
|
|
822
|
-
c =
|
|
810
|
+
if (void 0 !== (v = traverse(c, s, e))) {
|
|
811
|
+
o = o || c !== v;
|
|
812
|
+
c = v;
|
|
823
813
|
}
|
|
824
814
|
}
|
|
825
815
|
n.pop();
|
|
826
816
|
if (o) {
|
|
827
|
-
|
|
817
|
+
d[s] = c;
|
|
828
818
|
}
|
|
829
819
|
}
|
|
830
820
|
if (a) {
|
|
@@ -837,9 +827,9 @@ exports.visit = function visit(e, r) {
|
|
|
837
827
|
} else if (void 0 !== h) {
|
|
838
828
|
return h;
|
|
839
829
|
} else if (void 0 !== u) {
|
|
840
|
-
return o ?
|
|
830
|
+
return o ? d : u;
|
|
841
831
|
} else {
|
|
842
|
-
return o ?
|
|
832
|
+
return o ? d : e;
|
|
843
833
|
}
|
|
844
834
|
}(e);
|
|
845
835
|
return void 0 !== t && !1 !== t ? t : e;
|