gql-ast 2.6.0 → 3.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/esm/index.js CHANGED
@@ -1,12 +1,15 @@
1
+ import { Kind } from 'graphql';
2
+ // Re-export Kind and OperationTypeNode for consumers
3
+ export { Kind, OperationTypeNode } from 'graphql';
1
4
  export const document = ({ definitions }) => ({
2
- kind: 'Document',
5
+ kind: Kind.DOCUMENT,
3
6
  definitions
4
7
  });
5
8
  export const operationDefinition = ({ operation, name, variableDefinitions = [], directives = [], selectionSet }) => ({
6
- kind: 'OperationDefinition',
9
+ kind: Kind.OPERATION_DEFINITION,
7
10
  operation,
8
11
  name: {
9
- kind: 'Name',
12
+ kind: Kind.NAME,
10
13
  value: name
11
14
  },
12
15
  variableDefinitions,
@@ -14,68 +17,68 @@ export const operationDefinition = ({ operation, name, variableDefinitions = [],
14
17
  selectionSet
15
18
  });
16
19
  export const variableDefinition = ({ variable, type, directives }) => ({
17
- kind: 'VariableDefinition',
20
+ kind: Kind.VARIABLE_DEFINITION,
18
21
  variable,
19
22
  type,
20
23
  directives: directives || []
21
24
  });
22
25
  export const selectionSet = ({ selections }) => ({
23
- kind: 'SelectionSet',
26
+ kind: Kind.SELECTION_SET,
24
27
  selections
25
28
  });
26
29
  export const listType = ({ type }) => ({
27
- kind: 'ListType',
30
+ kind: Kind.LIST_TYPE,
28
31
  type
29
32
  });
30
33
  export const nonNullType = ({ type }) => ({
31
- kind: 'NonNullType',
34
+ kind: Kind.NON_NULL_TYPE,
32
35
  type
33
36
  });
34
37
  export const namedType = ({ type }) => ({
35
- kind: 'NamedType',
38
+ kind: Kind.NAMED_TYPE,
36
39
  name: {
37
- kind: 'Name',
40
+ kind: Kind.NAME,
38
41
  value: type
39
42
  }
40
43
  });
41
44
  export const variable = ({ name }) => ({
42
- kind: 'Variable',
45
+ kind: Kind.VARIABLE,
43
46
  name: {
44
- kind: 'Name',
47
+ kind: Kind.NAME,
45
48
  value: name
46
49
  }
47
50
  });
48
51
  export const objectValue = ({ fields }) => ({
49
- kind: 'ObjectValue',
52
+ kind: Kind.OBJECT,
50
53
  fields
51
54
  });
52
55
  export const stringValue = ({ value }) => ({
53
- kind: 'StringValue',
56
+ kind: Kind.STRING,
54
57
  value
55
58
  });
56
59
  export const intValue = ({ value }) => ({
57
- kind: 'IntValue',
60
+ kind: Kind.INT,
58
61
  value
59
62
  });
60
63
  export const booleanValue = ({ value }) => ({
61
- kind: 'BooleanValue',
64
+ kind: Kind.BOOLEAN,
62
65
  value
63
66
  });
64
67
  export const floatValue = ({ value }) => ({
65
- kind: 'FloatValue',
68
+ kind: Kind.FLOAT,
66
69
  value
67
70
  });
68
71
  export const listValue = ({ values }) => ({
69
- kind: 'ListValue',
72
+ kind: Kind.LIST,
70
73
  values
71
74
  });
72
75
  export const nullValue = () => ({
73
- kind: 'NullValue'
76
+ kind: Kind.NULL
74
77
  });
75
78
  export const fragmentDefinition = ({ name, typeCondition, directives = [], selectionSet }) => ({
76
- kind: 'FragmentDefinition',
79
+ kind: Kind.FRAGMENT_DEFINITION,
77
80
  name: {
78
- kind: 'Name',
81
+ kind: Kind.NAME,
79
82
  value: name
80
83
  },
81
84
  typeCondition,
@@ -83,17 +86,17 @@ export const fragmentDefinition = ({ name, typeCondition, directives = [], selec
83
86
  selectionSet
84
87
  });
85
88
  export const objectField = ({ name, value }) => ({
86
- kind: 'ObjectField',
89
+ kind: Kind.OBJECT_FIELD,
87
90
  name: {
88
- kind: 'Name',
91
+ kind: Kind.NAME,
89
92
  value: name
90
93
  },
91
94
  value
92
95
  });
93
96
  export const field = ({ name, args = [], directives = [], selectionSet }) => ({
94
- kind: 'Field',
97
+ kind: Kind.FIELD,
95
98
  name: {
96
- kind: 'Name',
99
+ kind: Kind.NAME,
97
100
  value: name
98
101
  },
99
102
  arguments: args,
@@ -101,9 +104,9 @@ export const field = ({ name, args = [], directives = [], selectionSet }) => ({
101
104
  selectionSet
102
105
  });
103
106
  export const argument = ({ name, value }) => ({
104
- kind: 'Argument',
107
+ kind: Kind.ARGUMENT,
105
108
  name: {
106
- kind: 'Name',
109
+ kind: Kind.NAME,
107
110
  value: name
108
111
  },
109
112
  value
package/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { ArgumentNode, BooleanValueNode, DefinitionNode, DirectiveNode, DocumentNode, FieldNode, FloatValueNode, FragmentDefinitionNode, IntValueNode, ListTypeNode, ListValueNode, NamedTypeNode, NullValueNode, ObjectFieldNode, ObjectValueNode, OperationDefinitionNode, OperationTypeNode, SelectionSetNode, StringValueNode, TypeNode, ValueNode, VariableDefinitionNode, VariableNode } from 'graphql';
1
+ import { ArgumentNode, BooleanValueNode, ConstDirectiveNode, DefinitionNode, DirectiveNode, DocumentNode, FieldNode, FloatValueNode, FragmentDefinitionNode, IntValueNode, ListTypeNode, ListValueNode, NamedTypeNode, NullValueNode, ObjectFieldNode, ObjectValueNode, OperationDefinitionNode, OperationTypeNode, SelectionSetNode, StringValueNode, TypeNode, ValueNode, VariableDefinitionNode, VariableNode } from 'graphql';
2
+ export { Kind, OperationTypeNode } from 'graphql';
2
3
  export declare const document: ({ definitions }: {
3
4
  definitions: DefinitionNode[];
4
5
  }) => DocumentNode;
@@ -12,7 +13,7 @@ export declare const operationDefinition: ({ operation, name, variableDefinition
12
13
  export declare const variableDefinition: ({ variable, type, directives }: {
13
14
  variable: VariableNode;
14
15
  type: TypeNode;
15
- directives?: DirectiveNode[];
16
+ directives?: ConstDirectiveNode[];
16
17
  }) => VariableDefinitionNode;
17
18
  export declare const selectionSet: ({ selections }: {
18
19
  selections: readonly FieldNode[];
package/index.js CHANGED
@@ -1,16 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.argument = exports.field = exports.objectField = exports.fragmentDefinition = exports.nullValue = exports.listValue = exports.floatValue = exports.booleanValue = exports.intValue = exports.stringValue = exports.objectValue = exports.variable = exports.namedType = exports.nonNullType = exports.listType = exports.selectionSet = exports.variableDefinition = exports.operationDefinition = exports.document = void 0;
3
+ exports.argument = exports.field = exports.objectField = exports.fragmentDefinition = exports.nullValue = exports.listValue = exports.floatValue = exports.booleanValue = exports.intValue = exports.stringValue = exports.objectValue = exports.variable = exports.namedType = exports.nonNullType = exports.listType = exports.selectionSet = exports.variableDefinition = exports.operationDefinition = exports.document = exports.OperationTypeNode = exports.Kind = void 0;
4
+ const graphql_1 = require("graphql");
5
+ // Re-export Kind and OperationTypeNode for consumers
6
+ var graphql_2 = require("graphql");
7
+ Object.defineProperty(exports, "Kind", { enumerable: true, get: function () { return graphql_2.Kind; } });
8
+ Object.defineProperty(exports, "OperationTypeNode", { enumerable: true, get: function () { return graphql_2.OperationTypeNode; } });
4
9
  const document = ({ definitions }) => ({
5
- kind: 'Document',
10
+ kind: graphql_1.Kind.DOCUMENT,
6
11
  definitions
7
12
  });
8
13
  exports.document = document;
9
14
  const operationDefinition = ({ operation, name, variableDefinitions = [], directives = [], selectionSet }) => ({
10
- kind: 'OperationDefinition',
15
+ kind: graphql_1.Kind.OPERATION_DEFINITION,
11
16
  operation,
12
17
  name: {
13
- kind: 'Name',
18
+ kind: graphql_1.Kind.NAME,
14
19
  value: name
15
20
  },
16
21
  variableDefinitions,
@@ -19,81 +24,81 @@ const operationDefinition = ({ operation, name, variableDefinitions = [], direct
19
24
  });
20
25
  exports.operationDefinition = operationDefinition;
21
26
  const variableDefinition = ({ variable, type, directives }) => ({
22
- kind: 'VariableDefinition',
27
+ kind: graphql_1.Kind.VARIABLE_DEFINITION,
23
28
  variable,
24
29
  type,
25
30
  directives: directives || []
26
31
  });
27
32
  exports.variableDefinition = variableDefinition;
28
33
  const selectionSet = ({ selections }) => ({
29
- kind: 'SelectionSet',
34
+ kind: graphql_1.Kind.SELECTION_SET,
30
35
  selections
31
36
  });
32
37
  exports.selectionSet = selectionSet;
33
38
  const listType = ({ type }) => ({
34
- kind: 'ListType',
39
+ kind: graphql_1.Kind.LIST_TYPE,
35
40
  type
36
41
  });
37
42
  exports.listType = listType;
38
43
  const nonNullType = ({ type }) => ({
39
- kind: 'NonNullType',
44
+ kind: graphql_1.Kind.NON_NULL_TYPE,
40
45
  type
41
46
  });
42
47
  exports.nonNullType = nonNullType;
43
48
  const namedType = ({ type }) => ({
44
- kind: 'NamedType',
49
+ kind: graphql_1.Kind.NAMED_TYPE,
45
50
  name: {
46
- kind: 'Name',
51
+ kind: graphql_1.Kind.NAME,
47
52
  value: type
48
53
  }
49
54
  });
50
55
  exports.namedType = namedType;
51
56
  const variable = ({ name }) => ({
52
- kind: 'Variable',
57
+ kind: graphql_1.Kind.VARIABLE,
53
58
  name: {
54
- kind: 'Name',
59
+ kind: graphql_1.Kind.NAME,
55
60
  value: name
56
61
  }
57
62
  });
58
63
  exports.variable = variable;
59
64
  const objectValue = ({ fields }) => ({
60
- kind: 'ObjectValue',
65
+ kind: graphql_1.Kind.OBJECT,
61
66
  fields
62
67
  });
63
68
  exports.objectValue = objectValue;
64
69
  const stringValue = ({ value }) => ({
65
- kind: 'StringValue',
70
+ kind: graphql_1.Kind.STRING,
66
71
  value
67
72
  });
68
73
  exports.stringValue = stringValue;
69
74
  const intValue = ({ value }) => ({
70
- kind: 'IntValue',
75
+ kind: graphql_1.Kind.INT,
71
76
  value
72
77
  });
73
78
  exports.intValue = intValue;
74
79
  const booleanValue = ({ value }) => ({
75
- kind: 'BooleanValue',
80
+ kind: graphql_1.Kind.BOOLEAN,
76
81
  value
77
82
  });
78
83
  exports.booleanValue = booleanValue;
79
84
  const floatValue = ({ value }) => ({
80
- kind: 'FloatValue',
85
+ kind: graphql_1.Kind.FLOAT,
81
86
  value
82
87
  });
83
88
  exports.floatValue = floatValue;
84
89
  const listValue = ({ values }) => ({
85
- kind: 'ListValue',
90
+ kind: graphql_1.Kind.LIST,
86
91
  values
87
92
  });
88
93
  exports.listValue = listValue;
89
94
  const nullValue = () => ({
90
- kind: 'NullValue'
95
+ kind: graphql_1.Kind.NULL
91
96
  });
92
97
  exports.nullValue = nullValue;
93
98
  const fragmentDefinition = ({ name, typeCondition, directives = [], selectionSet }) => ({
94
- kind: 'FragmentDefinition',
99
+ kind: graphql_1.Kind.FRAGMENT_DEFINITION,
95
100
  name: {
96
- kind: 'Name',
101
+ kind: graphql_1.Kind.NAME,
97
102
  value: name
98
103
  },
99
104
  typeCondition,
@@ -102,18 +107,18 @@ const fragmentDefinition = ({ name, typeCondition, directives = [], selectionSet
102
107
  });
103
108
  exports.fragmentDefinition = fragmentDefinition;
104
109
  const objectField = ({ name, value }) => ({
105
- kind: 'ObjectField',
110
+ kind: graphql_1.Kind.OBJECT_FIELD,
106
111
  name: {
107
- kind: 'Name',
112
+ kind: graphql_1.Kind.NAME,
108
113
  value: name
109
114
  },
110
115
  value
111
116
  });
112
117
  exports.objectField = objectField;
113
118
  const field = ({ name, args = [], directives = [], selectionSet }) => ({
114
- kind: 'Field',
119
+ kind: graphql_1.Kind.FIELD,
115
120
  name: {
116
- kind: 'Name',
121
+ kind: graphql_1.Kind.NAME,
117
122
  value: name
118
123
  },
119
124
  arguments: args,
@@ -122,9 +127,9 @@ const field = ({ name, args = [], directives = [], selectionSet }) => ({
122
127
  });
123
128
  exports.field = field;
124
129
  const argument = ({ name, value }) => ({
125
- kind: 'Argument',
130
+ kind: graphql_1.Kind.ARGUMENT,
126
131
  name: {
127
- kind: 'Name',
132
+ kind: graphql_1.Kind.NAME,
128
133
  value: name
129
134
  },
130
135
  value
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gql-ast",
3
- "version": "2.6.0",
3
+ "version": "3.0.0",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "GraphQL ASTs",
6
6
  "main": "index.js",
@@ -29,7 +29,7 @@
29
29
  "test:watch": "jest --watch"
30
30
  },
31
31
  "dependencies": {
32
- "graphql": "15.10.1"
32
+ "graphql": "^16.9.0"
33
33
  },
34
34
  "keywords": [
35
35
  "graphql",
@@ -41,5 +41,5 @@
41
41
  "devDependencies": {
42
42
  "makage": "^0.1.10"
43
43
  },
44
- "gitHead": "481b3a50b4eec2da6b376c4cd1868065e1e28edb"
44
+ "gitHead": "b2daeefe49cdefb3d01ea63cf778fb9b847ab5fe"
45
45
  }