@luvio/graphql-parser 0.126.0 → 0.126.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/dist/argument-node.d.ts +4 -0
- package/dist/ast.d.ts +95 -0
- package/dist/constants.d.ts +12 -0
- package/dist/directive-node.d.ts +5 -0
- package/dist/document.d.ts +3 -0
- package/dist/field-node.d.ts +4 -0
- package/dist/fragment-spread-node.d.ts +4 -0
- package/dist/fragment.d.ts +3 -0
- package/dist/gql.d.ts +51 -0
- package/dist/inline-fragment-node.d.ts +4 -0
- package/dist/luvioGraphqlParser.js +12945 -0
- package/dist/luvioGraphqlParser.mjs +12923 -0
- package/dist/main.d.ts +18 -0
- package/dist/metaschema.d.ts +10 -0
- package/dist/operation/index.d.ts +3 -0
- package/dist/operation/query/index.d.ts +6 -0
- package/dist/type-node.d.ts +3 -0
- package/dist/util/language.d.ts +9 -0
- package/dist/value-node.d.ts +4 -0
- package/dist/variable-definition.d.ts +4 -0
- package/dist/visitor.d.ts +4 -0
- package/package.json +4 -1
- package/babel.config.js +0 -1
- package/jest.config.js +0 -8
- package/project.json +0 -7
- package/rollup.config.js +0 -24
- package/scripts/cli.mjs +0 -18
- package/src/__tests__/ast.json +0 -403
- package/src/__tests__/ast.spec.ts +0 -109
- package/src/__tests__/astNoLoc.json +0 -147
- package/src/__tests__/gql.spec.ts +0 -665
- package/src/__tests__/main.spec.ts +0 -651
- package/src/__tests__/metaschema.spec.ts +0 -230
- package/src/__tests__/type-node.spec.ts +0 -82
- package/src/argument-node.ts +0 -18
- package/src/ast.ts +0 -200
- package/src/constants.ts +0 -14
- package/src/directive-node.ts +0 -36
- package/src/document.ts +0 -29
- package/src/field-node.ts +0 -72
- package/src/fragment-spread-node.ts +0 -28
- package/src/fragment.ts +0 -46
- package/src/gql.ts +0 -222
- package/src/inline-fragment-node.ts +0 -31
- package/src/main.ts +0 -134
- package/src/metaschema.ts +0 -162
- package/src/operation/index.ts +0 -12
- package/src/operation/query/index.ts +0 -78
- package/src/type-node.ts +0 -40
- package/src/util/language.ts +0 -10
- package/src/value-node.ts +0 -71
- package/src/variable-definition.ts +0 -37
- package/src/visitor.ts +0 -63
- package/tsconfig.json +0 -9
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isOperationDefinitionNode,
|
|
3
|
-
isFragmentDefinitionNode,
|
|
4
|
-
isNamedTypeNode,
|
|
5
|
-
isListTypeNode,
|
|
6
|
-
isNonNullTypeNode,
|
|
7
|
-
} from '../ast';
|
|
8
|
-
|
|
9
|
-
describe('Luvio GraphQL AST', () => {
|
|
10
|
-
describe('utility functions', () => {
|
|
11
|
-
it('isOperationDefinitionNode returns true if input is GrahpQL OperationDefinitionNode', () => {
|
|
12
|
-
const target = isOperationDefinitionNode({
|
|
13
|
-
kind: 'OperationDefinition',
|
|
14
|
-
operation: 'query',
|
|
15
|
-
selectionSet: {
|
|
16
|
-
kind: 'SelectionSet',
|
|
17
|
-
selections: [],
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
expect(target).toBe(true);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('isOperationDefinitionNode returns false if input is not GrahpQL OperationDefinitionNode', () => {
|
|
24
|
-
const target = isOperationDefinitionNode({
|
|
25
|
-
kind: 'FragmentDefinition',
|
|
26
|
-
name: { kind: 'Name', value: 'test' },
|
|
27
|
-
typeCondition: {
|
|
28
|
-
kind: 'NamedType',
|
|
29
|
-
name: { kind: 'Name', value: 'testType' },
|
|
30
|
-
},
|
|
31
|
-
selectionSet: {
|
|
32
|
-
kind: 'SelectionSet',
|
|
33
|
-
selections: [],
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
expect(target).toBe(false);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('isFragmentDefinitionNode returns true if input is GrahpQL FragmentDefinitionNode', () => {
|
|
40
|
-
const target = isFragmentDefinitionNode({
|
|
41
|
-
kind: 'FragmentDefinition',
|
|
42
|
-
name: { kind: 'Name', value: 'test' },
|
|
43
|
-
typeCondition: {
|
|
44
|
-
kind: 'NamedType',
|
|
45
|
-
name: { kind: 'Name', value: 'testType' },
|
|
46
|
-
},
|
|
47
|
-
selectionSet: {
|
|
48
|
-
kind: 'SelectionSet',
|
|
49
|
-
selections: [],
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
expect(target).toBe(true);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('isFragmentDefinitionNode returns false if input is not GrahpQL FragmentDefinitionNode', () => {
|
|
56
|
-
const target = isFragmentDefinitionNode({
|
|
57
|
-
kind: 'OperationDefinition',
|
|
58
|
-
operation: 'query',
|
|
59
|
-
selectionSet: {
|
|
60
|
-
kind: 'SelectionSet',
|
|
61
|
-
selections: [],
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
expect(target).toBe(false);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('isNamedTypeNode returns true if input is GraphQL NamedTypeNode', () => {
|
|
68
|
-
expect(
|
|
69
|
-
isNamedTypeNode({
|
|
70
|
-
kind: 'NamedType',
|
|
71
|
-
name: {
|
|
72
|
-
kind: 'Name',
|
|
73
|
-
value: 'test',
|
|
74
|
-
},
|
|
75
|
-
})
|
|
76
|
-
).toBe(true);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('isListTypeNode returns true if input is GraphQL ListTypeNode', () => {
|
|
80
|
-
expect(
|
|
81
|
-
isListTypeNode({
|
|
82
|
-
kind: 'ListType',
|
|
83
|
-
type: {
|
|
84
|
-
kind: 'NamedType',
|
|
85
|
-
name: {
|
|
86
|
-
kind: 'Name',
|
|
87
|
-
value: 'test',
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
})
|
|
91
|
-
).toBe(true);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('isNonNullTypeNode returns true if input is Graphql NonNullTypeNode', () => {
|
|
95
|
-
expect(
|
|
96
|
-
isNonNullTypeNode({
|
|
97
|
-
kind: 'NonNullType',
|
|
98
|
-
type: {
|
|
99
|
-
kind: 'NamedType',
|
|
100
|
-
name: {
|
|
101
|
-
kind: 'Name',
|
|
102
|
-
value: 'test',
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
})
|
|
106
|
-
).toBe(true);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
});
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"kind": "Document",
|
|
3
|
-
"definitions": [
|
|
4
|
-
{
|
|
5
|
-
"kind": "OperationDefinition",
|
|
6
|
-
"operation": "query",
|
|
7
|
-
"name": { "kind": "Name", "value": "GetUser" },
|
|
8
|
-
"variableDefinitions": [
|
|
9
|
-
{
|
|
10
|
-
"kind": "VariableDefinition",
|
|
11
|
-
"variable": {
|
|
12
|
-
"kind": "Variable",
|
|
13
|
-
"name": { "kind": "Name", "value": "userId" }
|
|
14
|
-
},
|
|
15
|
-
"type": {
|
|
16
|
-
"kind": "NonNullType",
|
|
17
|
-
"type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } }
|
|
18
|
-
},
|
|
19
|
-
"directives": []
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
"directives": [],
|
|
23
|
-
"selectionSet": {
|
|
24
|
-
"kind": "SelectionSet",
|
|
25
|
-
"selections": [
|
|
26
|
-
{
|
|
27
|
-
"kind": "Field",
|
|
28
|
-
"name": { "kind": "Name", "value": "user" },
|
|
29
|
-
"arguments": [
|
|
30
|
-
{
|
|
31
|
-
"kind": "Argument",
|
|
32
|
-
"name": { "kind": "Name", "value": "id" },
|
|
33
|
-
"value": {
|
|
34
|
-
"kind": "Variable",
|
|
35
|
-
"name": { "kind": "Name", "value": "userId" }
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
],
|
|
39
|
-
"directives": [],
|
|
40
|
-
"selectionSet": {
|
|
41
|
-
"kind": "SelectionSet",
|
|
42
|
-
"selections": [
|
|
43
|
-
{
|
|
44
|
-
"kind": "Field",
|
|
45
|
-
"name": { "kind": "Name", "value": "id" },
|
|
46
|
-
"arguments": [],
|
|
47
|
-
"directives": []
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"kind": "Field",
|
|
51
|
-
"name": { "kind": "Name", "value": "name" },
|
|
52
|
-
"arguments": [],
|
|
53
|
-
"directives": []
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"kind": "Field",
|
|
57
|
-
"name": { "kind": "Name", "value": "isViewerFriend" },
|
|
58
|
-
"arguments": [],
|
|
59
|
-
"directives": []
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"kind": "Field",
|
|
63
|
-
"name": { "kind": "Name", "value": "profilePicture" },
|
|
64
|
-
"arguments": [
|
|
65
|
-
{
|
|
66
|
-
"kind": "Argument",
|
|
67
|
-
"name": { "kind": "Name", "value": "size" },
|
|
68
|
-
"value": { "kind": "IntValue", "value": "50" }
|
|
69
|
-
}
|
|
70
|
-
],
|
|
71
|
-
"directives": [],
|
|
72
|
-
"selectionSet": {
|
|
73
|
-
"kind": "SelectionSet",
|
|
74
|
-
"selections": [
|
|
75
|
-
{
|
|
76
|
-
"kind": "FragmentSpread",
|
|
77
|
-
"name": {
|
|
78
|
-
"kind": "Name",
|
|
79
|
-
"value": "PictureFragment"
|
|
80
|
-
},
|
|
81
|
-
"directives": []
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"kind": "FragmentSpread",
|
|
85
|
-
"name": {
|
|
86
|
-
"kind": "Name",
|
|
87
|
-
"value": "PictureFragmentHeight"
|
|
88
|
-
},
|
|
89
|
-
"directives": []
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
]
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"kind": "FragmentDefinition",
|
|
102
|
-
"name": { "kind": "Name", "value": "PictureFragment" },
|
|
103
|
-
"typeCondition": {
|
|
104
|
-
"kind": "NamedType",
|
|
105
|
-
"name": { "kind": "Name", "value": "Picture" }
|
|
106
|
-
},
|
|
107
|
-
"directives": [],
|
|
108
|
-
"selectionSet": {
|
|
109
|
-
"kind": "SelectionSet",
|
|
110
|
-
"selections": [
|
|
111
|
-
{
|
|
112
|
-
"kind": "Field",
|
|
113
|
-
"name": { "kind": "Name", "value": "uri" },
|
|
114
|
-
"arguments": [],
|
|
115
|
-
"directives": []
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
"kind": "Field",
|
|
119
|
-
"name": { "kind": "Name", "value": "width" },
|
|
120
|
-
"arguments": [],
|
|
121
|
-
"directives": []
|
|
122
|
-
}
|
|
123
|
-
]
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
"kind": "FragmentDefinition",
|
|
128
|
-
"name": { "kind": "Name", "value": "PictureFragmentHeight" },
|
|
129
|
-
"typeCondition": {
|
|
130
|
-
"kind": "NamedType",
|
|
131
|
-
"name": { "kind": "Name", "value": "Picture" }
|
|
132
|
-
},
|
|
133
|
-
"directives": [],
|
|
134
|
-
"selectionSet": {
|
|
135
|
-
"kind": "SelectionSet",
|
|
136
|
-
"selections": [
|
|
137
|
-
{
|
|
138
|
-
"kind": "Field",
|
|
139
|
-
"name": { "kind": "Name", "value": "height" },
|
|
140
|
-
"arguments": [],
|
|
141
|
-
"directives": []
|
|
142
|
-
}
|
|
143
|
-
]
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
]
|
|
147
|
-
}
|