@graphitation/graphql-codegen-supermassive-typed-document-node-plugin 0.7.2 → 1.0.1

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.
@@ -0,0 +1,228 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var print_exports = {};
20
+ __export(print_exports, {
21
+ print: () => print
22
+ });
23
+ module.exports = __toCommonJS(print_exports);
24
+ var import_graphql = require("graphql");
25
+ var import_block_string = require("./block-string");
26
+ var import_print_string = require("./print-string");
27
+ function print(ast) {
28
+ return (0, import_graphql.visit)(ast, createPrintReducer());
29
+ }
30
+ function createPrintReducer() {
31
+ return {
32
+ Name: { leave: (node) => node.value },
33
+ Variable: { leave: (node) => "$" + node.name },
34
+ Document: {
35
+ leave: (node) => join(node.definitions, " ")
36
+ },
37
+ OperationDefinition: {
38
+ leave(node) {
39
+ const varDefs = wrap("(", join(node.variableDefinitions, ","), ")");
40
+ const prefix = join(
41
+ [
42
+ node.operation,
43
+ join([node.name, varDefs]),
44
+ join(node.directives, " ")
45
+ ],
46
+ " "
47
+ );
48
+ return (prefix === "query" ? "" : prefix + " ") + node.selectionSet;
49
+ }
50
+ },
51
+ VariableDefinition: {
52
+ leave: ({ variable, type, defaultValue, directives }) => variable + ":" + type + wrap("=", defaultValue) + wrap(" ", join(directives, " "))
53
+ },
54
+ SelectionSet: { leave: ({ selections }) => block(selections) },
55
+ Field: {
56
+ leave({ alias, name, arguments: args, directives, selectionSet }) {
57
+ const prefix = wrap("", alias, ":") + name;
58
+ const argsLine = prefix + wrap("(", join(args, ","), ")");
59
+ return join([argsLine, join(directives, " "), selectionSet], " ");
60
+ }
61
+ },
62
+ Argument: { leave: ({ name, value }) => name + ":" + value },
63
+ FragmentSpread: {
64
+ leave: ({ name, directives }) => "..." + name + wrap(" ", join(directives, " "))
65
+ },
66
+ InlineFragment: {
67
+ leave: ({ typeCondition, directives, selectionSet }) => join(
68
+ [
69
+ "...",
70
+ wrap("on ", typeCondition),
71
+ join(directives, " "),
72
+ selectionSet
73
+ ],
74
+ " "
75
+ )
76
+ },
77
+ FragmentDefinition: {
78
+ leave: ({
79
+ name,
80
+ typeCondition,
81
+ variableDefinitions,
82
+ directives,
83
+ selectionSet
84
+ }) => (
85
+ // Note: fragment variable definitions are experimental and may be changed
86
+ // or removed in the future.
87
+ `fragment ${name}${wrap("(", join(variableDefinitions, ","), ")")} on ${typeCondition} ${wrap("", join(directives, " "), " ")}` + selectionSet
88
+ )
89
+ },
90
+ IntValue: { leave: ({ value }) => value },
91
+ FloatValue: { leave: ({ value }) => value },
92
+ StringValue: {
93
+ leave: ({ value, block: isBlockString }) => isBlockString ? (0, import_block_string.printBlockString)(value, { minimize: true }) : (0, import_print_string.printString)(value)
94
+ },
95
+ BooleanValue: { leave: ({ value }) => value ? "true" : "false" },
96
+ NullValue: { leave: () => "null" },
97
+ EnumValue: { leave: ({ value }) => value },
98
+ ListValue: { leave: ({ values }) => "[" + join(values, ",") + "]" },
99
+ ObjectValue: { leave: ({ fields }) => "{" + join(fields, ",") + "}" },
100
+ ObjectField: { leave: ({ name, value }) => name + ":" + value },
101
+ Directive: {
102
+ leave: ({ name, arguments: args }) => "@" + name + wrap("(", join(args, ","), ")")
103
+ },
104
+ NamedType: { leave: ({ name }) => name },
105
+ ListType: { leave: ({ type }) => "[" + type + "]" },
106
+ NonNullType: { leave: ({ type }) => type + "!" },
107
+ SchemaDefinition: {
108
+ leave: ({ description, directives, operationTypes }) => wrap("", description, " ") + join(["schema", join(directives, " "), block(operationTypes)], " ")
109
+ },
110
+ OperationTypeDefinition: {
111
+ leave: ({ operation, type }) => operation + ":" + type
112
+ },
113
+ ScalarTypeDefinition: {
114
+ leave: ({ description, name, directives }) => wrap("", description, " ") + join(["scalar", name, join(directives, " ")], " ")
115
+ },
116
+ ObjectTypeDefinition: {
117
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, " ") + join(
118
+ [
119
+ "type",
120
+ name,
121
+ wrap("implements ", join(interfaces, " & ")),
122
+ join(directives, " "),
123
+ block(fields)
124
+ ],
125
+ " "
126
+ )
127
+ },
128
+ FieldDefinition: {
129
+ leave: ({ description, name, arguments: args, type, directives }) => wrap("", description, " ") + name + wrap("(", join(args, ","), ")") + ": " + type + wrap(" ", join(directives, " "))
130
+ },
131
+ InputValueDefinition: {
132
+ leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, " ") + join(
133
+ [name + ":" + type, wrap("=", defaultValue), join(directives, " ")],
134
+ " "
135
+ )
136
+ },
137
+ InterfaceTypeDefinition: {
138
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, " ") + join(
139
+ [
140
+ "interface",
141
+ name,
142
+ wrap("implements ", join(interfaces, " & ")),
143
+ join(directives, " "),
144
+ block(fields)
145
+ ],
146
+ " "
147
+ )
148
+ },
149
+ UnionTypeDefinition: {
150
+ leave: ({ description, name, directives, types }) => wrap("", description, " ") + join(
151
+ ["union", name, join(directives, " "), wrap("=", join(types, " | "))],
152
+ " "
153
+ )
154
+ },
155
+ EnumTypeDefinition: {
156
+ leave: ({ description, name, directives, values }) => wrap("", description, " ") + join(["enum", name, join(directives, " "), block(values)], " ")
157
+ },
158
+ EnumValueDefinition: {
159
+ leave: ({ description, name, directives }) => wrap("", description, " ") + join([name, join(directives, " ")], " ")
160
+ },
161
+ InputObjectTypeDefinition: {
162
+ leave: ({ description, name, directives, fields }) => wrap("", description, " ") + join(["input", name, join(directives, " "), block(fields)], " ")
163
+ },
164
+ DirectiveDefinition: {
165
+ leave: ({ description, name, arguments: args, repeatable, locations }) => wrap("", description, " ") + "directive @" + name + wrap("(", join(args, ","), ")") + (repeatable ? " repeatable" : "") + " on " + join(locations, " | ")
166
+ },
167
+ SchemaExtension: {
168
+ leave: ({ directives, operationTypes }) => join(
169
+ ["extend schema", join(directives, " "), block(operationTypes)],
170
+ " "
171
+ )
172
+ },
173
+ ScalarTypeExtension: {
174
+ leave: ({ name, directives }) => join(["extend scalar", name, join(directives, " ")], " ")
175
+ },
176
+ ObjectTypeExtension: {
177
+ leave: ({ name, interfaces, directives, fields }) => join(
178
+ [
179
+ "extend type",
180
+ name,
181
+ wrap("implements ", join(interfaces, " & ")),
182
+ join(directives, " "),
183
+ block(fields)
184
+ ],
185
+ " "
186
+ )
187
+ },
188
+ InterfaceTypeExtension: {
189
+ leave: ({ name, interfaces, directives, fields }) => join(
190
+ [
191
+ "extend interface",
192
+ name,
193
+ wrap("implements ", join(interfaces, " & ")),
194
+ join(directives, " "),
195
+ block(fields)
196
+ ],
197
+ " "
198
+ )
199
+ },
200
+ UnionTypeExtension: {
201
+ leave: ({ name, directives, types }) => join(
202
+ [
203
+ "extend union",
204
+ name,
205
+ join(directives, " "),
206
+ wrap("=", join(types, " | "))
207
+ ],
208
+ " "
209
+ )
210
+ },
211
+ EnumTypeExtension: {
212
+ leave: ({ name, directives, values }) => join(["extend enum", name, join(directives, " "), block(values)], " ")
213
+ },
214
+ InputObjectTypeExtension: {
215
+ leave: ({ name, directives, fields }) => join(["extend input", name, join(directives, " "), block(fields)], " ")
216
+ }
217
+ };
218
+ }
219
+ function join(maybeArray, separator = "") {
220
+ var _a;
221
+ return (_a = maybeArray == null ? void 0 : maybeArray.filter((x) => x).join(separator)) != null ? _a : "";
222
+ }
223
+ function block(array) {
224
+ return wrap("{", join(array, ","), "}");
225
+ }
226
+ function wrap(start, maybeString, end = "") {
227
+ return maybeString != null && maybeString !== "" ? start + maybeString + end : "";
228
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/print.ts"],
4
+ "sourcesContent": ["/**\n * Source: https://github.com/graphql/graphql-js/blob/16.x.x/src/language/printer.ts\n */\n\nimport type { ASTNode, ASTKindToNode, Visitor } from \"graphql\";\nimport { visit } from \"graphql\";\nimport type { ASTReducer } from \"./types\";\nimport { printBlockString } from \"./block-string\";\nimport { printString } from \"./print-string\";\n\ntype Maybe<T> = T | undefined | null;\n\n/**\n * Converts an AST into a compact string\n */\nexport function print(ast: ASTNode): string {\n return visit(ast, createPrintReducer() as Visitor<ASTKindToNode>);\n}\n\nfunction createPrintReducer(): ASTReducer<string> {\n return {\n Name: { leave: (node) => node.value },\n Variable: { leave: (node) => \"$\" + node.name },\n\n Document: {\n leave: (node) => join(node.definitions, \" \"),\n },\n\n OperationDefinition: {\n leave(node) {\n const varDefs = wrap(\"(\", join(node.variableDefinitions, \",\"), \")\");\n const prefix = join(\n [\n node.operation,\n join([node.name, varDefs]),\n join(node.directives, \" \"),\n ],\n \" \",\n );\n\n // Anonymous queries with no directives or variable definitions can use\n // the query short form.\n return (prefix === \"query\" ? \"\" : prefix + \" \") + node.selectionSet;\n },\n },\n\n VariableDefinition: {\n leave: ({ variable, type, defaultValue, directives }) =>\n variable +\n \":\" +\n type +\n wrap(\"=\", defaultValue) +\n wrap(\" \", join(directives, \" \")),\n },\n SelectionSet: { leave: ({ selections }) => block(selections) },\n\n Field: {\n leave({ alias, name, arguments: args, directives, selectionSet }) {\n const prefix = wrap(\"\", alias, \":\") + name;\n const argsLine = prefix + wrap(\"(\", join(args, \",\"), \")\");\n\n return join([argsLine, join(directives, \" \"), selectionSet], \" \");\n },\n },\n\n Argument: { leave: ({ name, value }) => name + \":\" + value },\n\n FragmentSpread: {\n leave: ({ name, directives }) =>\n \"...\" + name + wrap(\" \", join(directives, \" \")),\n },\n\n InlineFragment: {\n leave: ({ typeCondition, directives, selectionSet }) =>\n join(\n [\n \"...\",\n wrap(\"on \", typeCondition),\n join(directives, \" \"),\n selectionSet,\n ],\n \" \",\n ),\n },\n\n FragmentDefinition: {\n leave: ({\n name,\n typeCondition,\n variableDefinitions,\n directives,\n selectionSet,\n }) =>\n // Note: fragment variable definitions are experimental and may be changed\n // or removed in the future.\n `fragment ${name}${wrap(\"(\", join(variableDefinitions, \",\"), \")\")} ` +\n `on ${typeCondition} ${wrap(\"\", join(directives, \" \"), \" \")}` +\n selectionSet,\n },\n\n IntValue: { leave: ({ value }) => value },\n FloatValue: { leave: ({ value }) => value },\n StringValue: {\n leave: ({ value, block: isBlockString }) =>\n isBlockString\n ? printBlockString(value, { minimize: true })\n : printString(value),\n },\n BooleanValue: { leave: ({ value }) => (value ? \"true\" : \"false\") },\n NullValue: { leave: () => \"null\" },\n EnumValue: { leave: ({ value }) => value },\n ListValue: { leave: ({ values }) => \"[\" + join(values, \",\") + \"]\" },\n ObjectValue: { leave: ({ fields }) => \"{\" + join(fields, \",\") + \"}\" },\n ObjectField: { leave: ({ name, value }) => name + \":\" + value },\n\n Directive: {\n leave: ({ name, arguments: args }) =>\n \"@\" + name + wrap(\"(\", join(args, \",\"), \")\"),\n },\n\n NamedType: { leave: ({ name }) => name },\n ListType: { leave: ({ type }) => \"[\" + type + \"]\" },\n NonNullType: { leave: ({ type }) => type + \"!\" },\n\n SchemaDefinition: {\n leave: ({ description, directives, operationTypes }) =>\n wrap(\"\", description, \" \") +\n join([\"schema\", join(directives, \" \"), block(operationTypes)], \" \"),\n },\n\n OperationTypeDefinition: {\n leave: ({ operation, type }) => operation + \":\" + type,\n },\n\n ScalarTypeDefinition: {\n leave: ({ description, name, directives }) =>\n wrap(\"\", description, \" \") +\n join([\"scalar\", name, join(directives, \" \")], \" \"),\n },\n\n ObjectTypeDefinition: {\n leave: ({ description, name, interfaces, directives, fields }) =>\n wrap(\"\", description, \" \") +\n join(\n [\n \"type\",\n name,\n wrap(\"implements \", join(interfaces, \" & \")),\n join(directives, \" \"),\n block(fields),\n ],\n \" \",\n ),\n },\n\n FieldDefinition: {\n leave: ({ description, name, arguments: args, type, directives }) =>\n wrap(\"\", description, \" \") +\n name +\n wrap(\"(\", join(args, \",\"), \")\") +\n \": \" +\n type +\n wrap(\" \", join(directives, \" \")),\n },\n\n InputValueDefinition: {\n leave: ({ description, name, type, defaultValue, directives }) =>\n wrap(\"\", description, \" \") +\n join(\n [name + \":\" + type, wrap(\"=\", defaultValue), join(directives, \" \")],\n \" \",\n ),\n },\n\n InterfaceTypeDefinition: {\n leave: ({ description, name, interfaces, directives, fields }) =>\n wrap(\"\", description, \" \") +\n join(\n [\n \"interface\",\n name,\n wrap(\"implements \", join(interfaces, \" & \")),\n join(directives, \" \"),\n block(fields),\n ],\n \" \",\n ),\n },\n\n UnionTypeDefinition: {\n leave: ({ description, name, directives, types }) =>\n wrap(\"\", description, \" \") +\n join(\n [\"union\", name, join(directives, \" \"), wrap(\"=\", join(types, \" | \"))],\n \" \",\n ),\n },\n\n EnumTypeDefinition: {\n leave: ({ description, name, directives, values }) =>\n wrap(\"\", description, \" \") +\n join([\"enum\", name, join(directives, \" \"), block(values)], \" \"),\n },\n\n EnumValueDefinition: {\n leave: ({ description, name, directives }) =>\n wrap(\"\", description, \" \") + join([name, join(directives, \" \")], \" \"),\n },\n\n InputObjectTypeDefinition: {\n leave: ({ description, name, directives, fields }) =>\n wrap(\"\", description, \" \") +\n join([\"input\", name, join(directives, \" \"), block(fields)], \" \"),\n },\n\n DirectiveDefinition: {\n leave: ({ description, name, arguments: args, repeatable, locations }) =>\n wrap(\"\", description, \" \") +\n \"directive @\" +\n name +\n wrap(\"(\", join(args, \",\"), \")\") +\n (repeatable ? \" repeatable\" : \"\") +\n \" on \" +\n join(locations, \" | \"),\n },\n\n SchemaExtension: {\n leave: ({ directives, operationTypes }) =>\n join(\n [\"extend schema\", join(directives, \" \"), block(operationTypes)],\n \" \",\n ),\n },\n\n ScalarTypeExtension: {\n leave: ({ name, directives }) =>\n join([\"extend scalar\", name, join(directives, \" \")], \" \"),\n },\n\n ObjectTypeExtension: {\n leave: ({ name, interfaces, directives, fields }) =>\n join(\n [\n \"extend type\",\n name,\n wrap(\"implements \", join(interfaces, \" & \")),\n join(directives, \" \"),\n block(fields),\n ],\n \" \",\n ),\n },\n\n InterfaceTypeExtension: {\n leave: ({ name, interfaces, directives, fields }) =>\n join(\n [\n \"extend interface\",\n name,\n wrap(\"implements \", join(interfaces, \" & \")),\n join(directives, \" \"),\n block(fields),\n ],\n \" \",\n ),\n },\n\n UnionTypeExtension: {\n leave: ({ name, directives, types }) =>\n join(\n [\n \"extend union\",\n name,\n join(directives, \" \"),\n wrap(\"=\", join(types, \" | \")),\n ],\n \" \",\n ),\n },\n\n EnumTypeExtension: {\n leave: ({ name, directives, values }) =>\n join([\"extend enum\", name, join(directives, \" \"), block(values)], \" \"),\n },\n\n InputObjectTypeExtension: {\n leave: ({ name, directives, fields }) =>\n join([\"extend input\", name, join(directives, \" \"), block(fields)], \" \"),\n },\n };\n}\n\n/**\n * Given maybeArray, print an empty string if it is null or empty, otherwise\n * print all items together separated by separator if provided\n */\nfunction join(\n maybeArray: Maybe<ReadonlyArray<string | undefined>>,\n separator = \"\",\n): string {\n return maybeArray?.filter((x) => x).join(separator) ?? \"\";\n}\n\n/**\n * Given array, print each item on its own line, wrapped in an indented `{ }` block.\n */\nfunction block(array: Maybe<ReadonlyArray<string | undefined>>): string {\n return wrap(\"{\", join(array, \",\"), \"}\");\n}\n\n/**\n * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string.\n */\nfunction wrap(start: string, maybeString: Maybe<string>, end = \"\"): string {\n return maybeString != null && maybeString !== \"\"\n ? start + maybeString + end\n : \"\";\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAA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AAwB;AAAA,MACtB,OAAO,CAAC,EAAE,MAAM,YAAY,YAAY,OAAO,MAC7C;AAAA,QACE;AAAA,UACE;AAAA,UACA;AAAA,UACA,KAAK,eAAe,KAAK,YAAY,KAAK,CAAC;AAAA,UAC3C,KAAK,YAAY,GAAG;AAAA,UACpB,MAAM,MAAM;AAAA,QACd;AAAA,QACA;AAAA,MACF;AAAA,IACJ;AAAA,IAEA,oBAAoB;AAAA,MAClB,OAAO,CAAC,EAAE,MAAM,YAAY,MAAM,MAChC;AAAA,QACE;AAAA,UACE;AAAA,UACA;AAAA,UACA,KAAK,YAAY,GAAG;AAAA,UACpB,KAAK,KAAK,KAAK,OAAO,KAAK,CAAC;AAAA,QAC9B;AAAA,QACA;AAAA,MACF;AAAA,IACJ;AAAA,IAEA,mBAAmB;AAAA,MACjB,OAAO,CAAC,EAAE,MAAM,YAAY,OAAO,MACjC,KAAK,CAAC,eAAe,MAAM,KAAK,YAAY,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,GAAG;AAAA,IACzE;AAAA,IAEA,0BAA0B;AAAA,MACxB,OAAO,CAAC,EAAE,MAAM,YAAY,OAAO,MACjC,KAAK,CAAC,gBAAgB,MAAM,KAAK,YAAY,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,GAAG;AAAA,IAC1E;AAAA,EACF;AACF;AAMA,SAAS,KACP,YACA,YAAY,IACJ;AA3SV;AA4SE,UAAO,8CAAY,OAAO,CAAC,MAAM,GAAG,KAAK,eAAlC,YAAgD;AACzD;AAKA,SAAS,MAAM,OAAyD;AACtE,SAAO,KAAK,KAAK,KAAK,OAAO,GAAG,GAAG,GAAG;AACxC;AAKA,SAAS,KAAK,OAAe,aAA4B,MAAM,IAAY;AACzE,SAAO,eAAe,QAAQ,gBAAgB,KAC1C,QAAQ,cAAc,MACtB;AACN;",
6
+ "names": []
7
+ }
@@ -0,0 +1,209 @@
1
+ // src/utils/print.ts
2
+ import { visit } from "graphql";
3
+ import { printBlockString } from "./block-string.mjs";
4
+ import { printString } from "./print-string.mjs";
5
+ function print(ast) {
6
+ return visit(ast, createPrintReducer());
7
+ }
8
+ function createPrintReducer() {
9
+ return {
10
+ Name: { leave: (node) => node.value },
11
+ Variable: { leave: (node) => "$" + node.name },
12
+ Document: {
13
+ leave: (node) => join(node.definitions, " ")
14
+ },
15
+ OperationDefinition: {
16
+ leave(node) {
17
+ const varDefs = wrap("(", join(node.variableDefinitions, ","), ")");
18
+ const prefix = join(
19
+ [
20
+ node.operation,
21
+ join([node.name, varDefs]),
22
+ join(node.directives, " ")
23
+ ],
24
+ " "
25
+ );
26
+ return (prefix === "query" ? "" : prefix + " ") + node.selectionSet;
27
+ }
28
+ },
29
+ VariableDefinition: {
30
+ leave: ({ variable, type, defaultValue, directives }) => variable + ":" + type + wrap("=", defaultValue) + wrap(" ", join(directives, " "))
31
+ },
32
+ SelectionSet: { leave: ({ selections }) => block(selections) },
33
+ Field: {
34
+ leave({ alias, name, arguments: args, directives, selectionSet }) {
35
+ const prefix = wrap("", alias, ":") + name;
36
+ const argsLine = prefix + wrap("(", join(args, ","), ")");
37
+ return join([argsLine, join(directives, " "), selectionSet], " ");
38
+ }
39
+ },
40
+ Argument: { leave: ({ name, value }) => name + ":" + value },
41
+ FragmentSpread: {
42
+ leave: ({ name, directives }) => "..." + name + wrap(" ", join(directives, " "))
43
+ },
44
+ InlineFragment: {
45
+ leave: ({ typeCondition, directives, selectionSet }) => join(
46
+ [
47
+ "...",
48
+ wrap("on ", typeCondition),
49
+ join(directives, " "),
50
+ selectionSet
51
+ ],
52
+ " "
53
+ )
54
+ },
55
+ FragmentDefinition: {
56
+ leave: ({
57
+ name,
58
+ typeCondition,
59
+ variableDefinitions,
60
+ directives,
61
+ selectionSet
62
+ }) => (
63
+ // Note: fragment variable definitions are experimental and may be changed
64
+ // or removed in the future.
65
+ `fragment ${name}${wrap("(", join(variableDefinitions, ","), ")")} on ${typeCondition} ${wrap("", join(directives, " "), " ")}` + selectionSet
66
+ )
67
+ },
68
+ IntValue: { leave: ({ value }) => value },
69
+ FloatValue: { leave: ({ value }) => value },
70
+ StringValue: {
71
+ leave: ({ value, block: isBlockString }) => isBlockString ? printBlockString(value, { minimize: true }) : printString(value)
72
+ },
73
+ BooleanValue: { leave: ({ value }) => value ? "true" : "false" },
74
+ NullValue: { leave: () => "null" },
75
+ EnumValue: { leave: ({ value }) => value },
76
+ ListValue: { leave: ({ values }) => "[" + join(values, ",") + "]" },
77
+ ObjectValue: { leave: ({ fields }) => "{" + join(fields, ",") + "}" },
78
+ ObjectField: { leave: ({ name, value }) => name + ":" + value },
79
+ Directive: {
80
+ leave: ({ name, arguments: args }) => "@" + name + wrap("(", join(args, ","), ")")
81
+ },
82
+ NamedType: { leave: ({ name }) => name },
83
+ ListType: { leave: ({ type }) => "[" + type + "]" },
84
+ NonNullType: { leave: ({ type }) => type + "!" },
85
+ SchemaDefinition: {
86
+ leave: ({ description, directives, operationTypes }) => wrap("", description, " ") + join(["schema", join(directives, " "), block(operationTypes)], " ")
87
+ },
88
+ OperationTypeDefinition: {
89
+ leave: ({ operation, type }) => operation + ":" + type
90
+ },
91
+ ScalarTypeDefinition: {
92
+ leave: ({ description, name, directives }) => wrap("", description, " ") + join(["scalar", name, join(directives, " ")], " ")
93
+ },
94
+ ObjectTypeDefinition: {
95
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, " ") + join(
96
+ [
97
+ "type",
98
+ name,
99
+ wrap("implements ", join(interfaces, " & ")),
100
+ join(directives, " "),
101
+ block(fields)
102
+ ],
103
+ " "
104
+ )
105
+ },
106
+ FieldDefinition: {
107
+ leave: ({ description, name, arguments: args, type, directives }) => wrap("", description, " ") + name + wrap("(", join(args, ","), ")") + ": " + type + wrap(" ", join(directives, " "))
108
+ },
109
+ InputValueDefinition: {
110
+ leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, " ") + join(
111
+ [name + ":" + type, wrap("=", defaultValue), join(directives, " ")],
112
+ " "
113
+ )
114
+ },
115
+ InterfaceTypeDefinition: {
116
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, " ") + join(
117
+ [
118
+ "interface",
119
+ name,
120
+ wrap("implements ", join(interfaces, " & ")),
121
+ join(directives, " "),
122
+ block(fields)
123
+ ],
124
+ " "
125
+ )
126
+ },
127
+ UnionTypeDefinition: {
128
+ leave: ({ description, name, directives, types }) => wrap("", description, " ") + join(
129
+ ["union", name, join(directives, " "), wrap("=", join(types, " | "))],
130
+ " "
131
+ )
132
+ },
133
+ EnumTypeDefinition: {
134
+ leave: ({ description, name, directives, values }) => wrap("", description, " ") + join(["enum", name, join(directives, " "), block(values)], " ")
135
+ },
136
+ EnumValueDefinition: {
137
+ leave: ({ description, name, directives }) => wrap("", description, " ") + join([name, join(directives, " ")], " ")
138
+ },
139
+ InputObjectTypeDefinition: {
140
+ leave: ({ description, name, directives, fields }) => wrap("", description, " ") + join(["input", name, join(directives, " "), block(fields)], " ")
141
+ },
142
+ DirectiveDefinition: {
143
+ leave: ({ description, name, arguments: args, repeatable, locations }) => wrap("", description, " ") + "directive @" + name + wrap("(", join(args, ","), ")") + (repeatable ? " repeatable" : "") + " on " + join(locations, " | ")
144
+ },
145
+ SchemaExtension: {
146
+ leave: ({ directives, operationTypes }) => join(
147
+ ["extend schema", join(directives, " "), block(operationTypes)],
148
+ " "
149
+ )
150
+ },
151
+ ScalarTypeExtension: {
152
+ leave: ({ name, directives }) => join(["extend scalar", name, join(directives, " ")], " ")
153
+ },
154
+ ObjectTypeExtension: {
155
+ leave: ({ name, interfaces, directives, fields }) => join(
156
+ [
157
+ "extend type",
158
+ name,
159
+ wrap("implements ", join(interfaces, " & ")),
160
+ join(directives, " "),
161
+ block(fields)
162
+ ],
163
+ " "
164
+ )
165
+ },
166
+ InterfaceTypeExtension: {
167
+ leave: ({ name, interfaces, directives, fields }) => join(
168
+ [
169
+ "extend interface",
170
+ name,
171
+ wrap("implements ", join(interfaces, " & ")),
172
+ join(directives, " "),
173
+ block(fields)
174
+ ],
175
+ " "
176
+ )
177
+ },
178
+ UnionTypeExtension: {
179
+ leave: ({ name, directives, types }) => join(
180
+ [
181
+ "extend union",
182
+ name,
183
+ join(directives, " "),
184
+ wrap("=", join(types, " | "))
185
+ ],
186
+ " "
187
+ )
188
+ },
189
+ EnumTypeExtension: {
190
+ leave: ({ name, directives, values }) => join(["extend enum", name, join(directives, " "), block(values)], " ")
191
+ },
192
+ InputObjectTypeExtension: {
193
+ leave: ({ name, directives, fields }) => join(["extend input", name, join(directives, " "), block(fields)], " ")
194
+ }
195
+ };
196
+ }
197
+ function join(maybeArray, separator = "") {
198
+ var _a;
199
+ return (_a = maybeArray == null ? void 0 : maybeArray.filter((x) => x).join(separator)) != null ? _a : "";
200
+ }
201
+ function block(array) {
202
+ return wrap("{", join(array, ","), "}");
203
+ }
204
+ function wrap(start, maybeString, end = "") {
205
+ return maybeString != null && maybeString !== "" ? start + maybeString + end : "";
206
+ }
207
+ export {
208
+ print
209
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/print.ts"],
4
+ "sourcesContent": ["/**\n * Source: https://github.com/graphql/graphql-js/blob/16.x.x/src/language/printer.ts\n */\n\nimport type { ASTNode, ASTKindToNode, Visitor } from \"graphql\";\nimport { visit } from \"graphql\";\nimport type { ASTReducer } from \"./types\";\nimport { printBlockString } from \"./block-string\";\nimport { printString } from \"./print-string\";\n\ntype Maybe<T> = T | undefined | null;\n\n/**\n * Converts an AST into a compact string\n */\nexport function print(ast: ASTNode): string {\n return visit(ast, createPrintReducer() as Visitor<ASTKindToNode>);\n}\n\nfunction createPrintReducer(): ASTReducer<string> {\n return {\n Name: { leave: (node) => node.value },\n Variable: { leave: (node) => \"$\" + node.name },\n\n Document: {\n leave: (node) => join(node.definitions, \" \"),\n },\n\n OperationDefinition: {\n leave(node) {\n const varDefs = wrap(\"(\", join(node.variableDefinitions, \",\"), \")\");\n const prefix = join(\n [\n node.operation,\n join([node.name, varDefs]),\n join(node.directives, \" \"),\n ],\n \" \",\n );\n\n // Anonymous queries with no directives or variable definitions can use\n // the query short form.\n return (prefix === \"query\" ? \"\" : prefix + \" \") + node.selectionSet;\n },\n },\n\n VariableDefinition: {\n leave: ({ variable, type, defaultValue, directives }) =>\n variable +\n \":\" +\n type +\n wrap(\"=\", defaultValue) +\n wrap(\" \", join(directives, \" \")),\n },\n SelectionSet: { leave: ({ selections }) => block(selections) },\n\n Field: {\n leave({ alias, name, arguments: args, directives, selectionSet }) {\n const prefix = wrap(\"\", alias, \":\") + name;\n const argsLine = prefix + wrap(\"(\", join(args, \",\"), \")\");\n\n return join([argsLine, join(directives, \" \"), selectionSet], \" \");\n },\n },\n\n Argument: { leave: ({ name, value }) => name + \":\" + value },\n\n FragmentSpread: {\n leave: ({ name, directives }) =>\n \"...\" + name + wrap(\" \", join(directives, \" \")),\n },\n\n InlineFragment: {\n leave: ({ typeCondition, directives, selectionSet }) =>\n join(\n [\n \"...\",\n wrap(\"on \", typeCondition),\n join(directives, \" \"),\n selectionSet,\n ],\n \" \",\n ),\n },\n\n FragmentDefinition: {\n leave: ({\n name,\n typeCondition,\n variableDefinitions,\n directives,\n selectionSet,\n }) =>\n // Note: fragment variable definitions are experimental and may be changed\n // or removed in the future.\n `fragment ${name}${wrap(\"(\", join(variableDefinitions, \",\"), \")\")} ` +\n `on ${typeCondition} ${wrap(\"\", join(directives, \" \"), \" \")}` +\n selectionSet,\n },\n\n IntValue: { leave: ({ value }) => value },\n FloatValue: { leave: ({ value }) => value },\n StringValue: {\n leave: ({ value, block: isBlockString }) =>\n isBlockString\n ? printBlockString(value, { minimize: true })\n : printString(value),\n },\n BooleanValue: { leave: ({ value }) => (value ? \"true\" : \"false\") },\n NullValue: { leave: () => \"null\" },\n EnumValue: { leave: ({ value }) => value },\n ListValue: { leave: ({ values }) => \"[\" + join(values, \",\") + \"]\" },\n ObjectValue: { leave: ({ fields }) => \"{\" + join(fields, \",\") + \"}\" },\n ObjectField: { leave: ({ name, value }) => name + \":\" + value },\n\n Directive: {\n leave: ({ name, arguments: args }) =>\n \"@\" + name + wrap(\"(\", join(args, \",\"), \")\"),\n },\n\n NamedType: { leave: ({ name }) => name },\n ListType: { leave: ({ type }) => \"[\" + type + \"]\" },\n NonNullType: { leave: ({ type }) => type + \"!\" },\n\n SchemaDefinition: {\n leave: ({ description, directives, operationTypes }) =>\n wrap(\"\", description, \" \") +\n join([\"schema\", join(directives, \" \"), block(operationTypes)], \" \"),\n },\n\n OperationTypeDefinition: {\n leave: ({ operation, type }) => operation + \":\" + type,\n },\n\n ScalarTypeDefinition: {\n leave: ({ description, name, directives }) =>\n wrap(\"\", description, \" \") +\n join([\"scalar\", name, join(directives, \" \")], \" \"),\n },\n\n ObjectTypeDefinition: {\n leave: ({ description, name, interfaces, directives, fields }) =>\n wrap(\"\", description, \" \") +\n join(\n [\n \"type\",\n name,\n wrap(\"implements \", join(interfaces, \" & \")),\n join(directives, \" \"),\n block(fields),\n ],\n \" \",\n ),\n },\n\n FieldDefinition: {\n leave: ({ description, name, arguments: args, type, directives }) =>\n wrap(\"\", description, \" \") +\n name +\n wrap(\"(\", join(args, \",\"), \")\") +\n \": \" +\n type +\n wrap(\" \", join(directives, \" \")),\n },\n\n InputValueDefinition: {\n leave: ({ description, name, type, defaultValue, directives }) =>\n wrap(\"\", description, \" \") +\n join(\n [name + \":\" + type, wrap(\"=\", defaultValue), join(directives, \" \")],\n \" \",\n ),\n },\n\n InterfaceTypeDefinition: {\n leave: ({ description, name, interfaces, directives, fields }) =>\n wrap(\"\", description, \" \") +\n join(\n [\n \"interface\",\n name,\n wrap(\"implements \", join(interfaces, \" & \")),\n join(directives, \" \"),\n block(fields),\n ],\n \" \",\n ),\n },\n\n UnionTypeDefinition: {\n leave: ({ description, name, directives, types }) =>\n wrap(\"\", description, \" \") +\n join(\n [\"union\", name, join(directives, \" \"), wrap(\"=\", join(types, \" | \"))],\n \" \",\n ),\n },\n\n EnumTypeDefinition: {\n leave: ({ description, name, directives, values }) =>\n wrap(\"\", description, \" \") +\n join([\"enum\", name, join(directives, \" \"), block(values)], \" \"),\n },\n\n EnumValueDefinition: {\n leave: ({ description, name, directives }) =>\n wrap(\"\", description, \" \") + join([name, join(directives, \" \")], \" \"),\n },\n\n InputObjectTypeDefinition: {\n leave: ({ description, name, directives, fields }) =>\n wrap(\"\", description, \" \") +\n join([\"input\", name, join(directives, \" \"), block(fields)], \" \"),\n },\n\n DirectiveDefinition: {\n leave: ({ description, name, arguments: args, repeatable, locations }) =>\n wrap(\"\", description, \" \") +\n \"directive @\" +\n name +\n wrap(\"(\", join(args, \",\"), \")\") +\n (repeatable ? \" repeatable\" : \"\") +\n \" on \" +\n join(locations, \" | \"),\n },\n\n SchemaExtension: {\n leave: ({ directives, operationTypes }) =>\n join(\n [\"extend schema\", join(directives, \" \"), block(operationTypes)],\n \" \",\n ),\n },\n\n ScalarTypeExtension: {\n leave: ({ name, directives }) =>\n join([\"extend scalar\", name, join(directives, \" \")], \" \"),\n },\n\n ObjectTypeExtension: {\n leave: ({ name, interfaces, directives, fields }) =>\n join(\n [\n \"extend type\",\n name,\n wrap(\"implements \", join(interfaces, \" & \")),\n join(directives, \" \"),\n block(fields),\n ],\n \" \",\n ),\n },\n\n InterfaceTypeExtension: {\n leave: ({ name, interfaces, directives, fields }) =>\n join(\n [\n \"extend interface\",\n name,\n wrap(\"implements \", join(interfaces, \" & \")),\n join(directives, \" \"),\n block(fields),\n ],\n \" \",\n ),\n },\n\n UnionTypeExtension: {\n leave: ({ name, directives, types }) =>\n join(\n [\n \"extend union\",\n name,\n join(directives, \" \"),\n wrap(\"=\", join(types, \" | \")),\n ],\n \" \",\n ),\n },\n\n EnumTypeExtension: {\n leave: ({ name, directives, values }) =>\n join([\"extend enum\", name, join(directives, \" \"), block(values)], \" \"),\n },\n\n InputObjectTypeExtension: {\n leave: ({ name, directives, fields }) =>\n join([\"extend input\", name, join(directives, \" \"), block(fields)], \" \"),\n },\n };\n}\n\n/**\n * Given maybeArray, print an empty string if it is null or empty, otherwise\n * print all items together separated by separator if provided\n */\nfunction join(\n maybeArray: Maybe<ReadonlyArray<string | undefined>>,\n separator = \"\",\n): string {\n return maybeArray?.filter((x) => x).join(separator) ?? \"\";\n}\n\n/**\n * Given array, print each item on its own line, wrapped in an indented `{ }` block.\n */\nfunction block(array: Maybe<ReadonlyArray<string | undefined>>): string {\n return wrap(\"{\", join(array, \",\"), \"}\");\n}\n\n/**\n * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string.\n */\nfunction wrap(start: string, maybeString: Maybe<string>, end = \"\"): string {\n return maybeString != null && maybeString !== \"\"\n ? start + maybeString + end\n : \"\";\n}\n"],
5
+ "mappings": ";AAKA,SAAS,aAAa;AAEtB,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAOrB,SAAS,MAAM,KAAsB;AAC1C,SAAO,MAAM,KAAK,mBAAmB,CAA2B;AAClE;AAEA,SAAS,qBAAyC;AAChD,SAAO;AAAA,IACL,MAAM,EAAE,OAAO,CAAC,SAAS,KAAK,MAAM;AAAA,IACpC,UAAU,EAAE,OAAO,CAAC,SAAS,MAAM,KAAK,KAAK;AAAA,IAE7C,UAAU;AAAA,MACR,OAAO,CAAC,SAAS,KAAK,KAAK,aAAa,GAAG;AAAA,IAC7C;AAAA,IAEA,qBAAqB;AAAA,MACnB,MAAM,MAAM;AACV,cAAM,UAAU,KAAK,KAAK,KAAK,KAAK,qBAAqB,GAAG,GAAG,GAAG;AAClE,cAAM,SAAS;AAAA,UACb;AAAA,YACE,KAAK;AAAA,YACL,KAAK,CAAC,KAAK,MAAM,OAAO,CAAC;AAAA,YACzB,KAAK,KAAK,YAAY,GAAG;AAAA,UAC3B;AAAA,UACA;AAAA,QACF;AAIA,gBAAQ,WAAW,UAAU,KAAK,SAAS,OAAO,KAAK;AAAA,MACzD;AAAA,IACF;AAAA,IAEA,oBAAoB;AAAA,MAClB,OAAO,CAAC,EAAE,UAAU,MAAM,cAAc,WAAW,MACjD,WACA,MACA,OACA,KAA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F;AACF;AAMA,SAAS,KACP,YACA,YAAY,IACJ;AA3SV;AA4SE,UAAO,8CAAY,OAAO,CAAC,MAAM,GAAG,KAAK,eAAlC,YAAgD;AACzD;AAKA,SAAS,MAAM,OAAyD;AACtE,SAAO,KAAK,KAAK,KAAK,OAAO,GAAG,GAAG,GAAG;AACxC;AAKA,SAAS,KAAK,OAAe,aAA4B,MAAM,IAAY;AACzE,SAAO,eAAe,QAAQ,gBAAgB,KAC1C,QAAQ,cAAc,MACtB;AACN;",
6
+ "names": []
7
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Source: https://github.com/graphql/graphql-js/blob/16.x.x/src/language/visitor.ts
3
+ */
4
+ import type { ASTNode } from "graphql";
5
+ /**
6
+ * A visitor is comprised of visit functions, which are called on each node
7
+ * during the visitor's traversal.
8
+ */
9
+ export type ASTVisitFn<TVisitedNode extends ASTNode> = (
10
+ /** The current node being visiting. */
11
+ node: TVisitedNode,
12
+ /** The index or key to this node from the parent node or Array. */
13
+ key: string | number | undefined,
14
+ /** The parent immediately above this node, which may be an Array. */
15
+ parent: ASTNode | ReadonlyArray<ASTNode> | undefined,
16
+ /** The key path to get to this node from the root node. */
17
+ path: ReadonlyArray<string | number>,
18
+ /**
19
+ * All nodes and Arrays visited before reaching parent of this node.
20
+ * These correspond to array indices in `path`.
21
+ * Note: ancestors includes arrays which contain the parent of visited node.
22
+ */
23
+ ancestors: ReadonlyArray<ASTNode | ReadonlyArray<ASTNode>>) => any;
24
+ /**
25
+ * A reducer is comprised of reducer functions which convert AST nodes into
26
+ * another form.
27
+ */
28
+ export type ASTReducer<R> = {
29
+ readonly [NodeT in ASTNode as NodeT["kind"]]?: {
30
+ readonly enter?: ASTVisitFn<NodeT>;
31
+ readonly leave: ASTReducerFn<NodeT, R>;
32
+ };
33
+ };
34
+ type ASTReducerFn<TReducedNode extends ASTNode, R> = (
35
+ /** The current node being visiting. */
36
+ node: {
37
+ [K in keyof TReducedNode]: ReducedField<TReducedNode[K], R>;
38
+ },
39
+ /** The index or key to this node from the parent node or Array. */
40
+ key: string | number | undefined,
41
+ /** The parent immediately above this node, which may be an Array. */
42
+ parent: ASTNode | ReadonlyArray<ASTNode> | undefined,
43
+ /** The key path to get to this node from the root node. */
44
+ path: ReadonlyArray<string | number>,
45
+ /**
46
+ * All nodes and Arrays visited before reaching parent of this node.
47
+ * These correspond to array indices in `path`.
48
+ * Note: ancestors includes arrays which contain the parent of visited node.
49
+ */
50
+ ancestors: ReadonlyArray<ASTNode | ReadonlyArray<ASTNode>>) => R;
51
+ type ReducedField<T, R> = T extends null | undefined ? T : T extends ReadonlyArray<any> ? ReadonlyArray<R> : R;
52
+ export {};
53
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,YAAY,SAAS,OAAO,IAAI;AACrD,uCAAuC;AACvC,IAAI,EAAE,YAAY;AAClB,mEAAmE;AACnE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;AAChC,qEAAqE;AACrE,MAAM,EAAE,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,SAAS;AACpD,2DAA2D;AAC3D,IAAI,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC;AACpC;;;;GAIG;AACH,SAAS,EAAE,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,KACvD,GAAG,CAAC;AAET;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAC1B,QAAQ,EAAE,KAAK,IAAI,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;QAC7C,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;QACnC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;KACxC;CACF,CAAC;AAEF,KAAK,YAAY,CAAC,YAAY,SAAS,OAAO,EAAE,CAAC,IAAI;AACnD,uCAAuC;AACvC,IAAI,EAAE;KAAG,CAAC,IAAI,MAAM,YAAY,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;CAAE;AACrE,mEAAmE;AACnE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;AAChC,qEAAqE;AACrE,MAAM,EAAE,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,SAAS;AACpD,2DAA2D;AAC3D,IAAI,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC;AACpC;;;;GAIG;AACH,SAAS,EAAE,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,KACvD,CAAC,CAAC;AAEP,KAAK,YAAY,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,IAAI,GAAG,SAAS,GAChD,CAAC,GACD,CAAC,SAAS,aAAa,CAAC,GAAG,CAAC,GAC5B,aAAa,CAAC,CAAC,CAAC,GAChB,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/types.ts"],
4
+ "sourcesContent": ["/**\n * Source: https://github.com/graphql/graphql-js/blob/16.x.x/src/language/visitor.ts\n */\n\nimport type { ASTNode } from \"graphql\";\n\n/**\n * A visitor is comprised of visit functions, which are called on each node\n * during the visitor's traversal.\n */\nexport type ASTVisitFn<TVisitedNode extends ASTNode> = (\n /** The current node being visiting. */\n node: TVisitedNode,\n /** The index or key to this node from the parent node or Array. */\n key: string | number | undefined,\n /** The parent immediately above this node, which may be an Array. */\n parent: ASTNode | ReadonlyArray<ASTNode> | undefined,\n /** The key path to get to this node from the root node. */\n path: ReadonlyArray<string | number>,\n /**\n * All nodes and Arrays visited before reaching parent of this node.\n * These correspond to array indices in `path`.\n * Note: ancestors includes arrays which contain the parent of visited node.\n */\n ancestors: ReadonlyArray<ASTNode | ReadonlyArray<ASTNode>>,\n) => any;\n\n/**\n * A reducer is comprised of reducer functions which convert AST nodes into\n * another form.\n */\nexport type ASTReducer<R> = {\n readonly [NodeT in ASTNode as NodeT[\"kind\"]]?: {\n readonly enter?: ASTVisitFn<NodeT>;\n readonly leave: ASTReducerFn<NodeT, R>;\n };\n};\n\ntype ASTReducerFn<TReducedNode extends ASTNode, R> = (\n /** The current node being visiting. */\n node: { [K in keyof TReducedNode]: ReducedField<TReducedNode[K], R> },\n /** The index or key to this node from the parent node or Array. */\n key: string | number | undefined,\n /** The parent immediately above this node, which may be an Array. */\n parent: ASTNode | ReadonlyArray<ASTNode> | undefined,\n /** The key path to get to this node from the root node. */\n path: ReadonlyArray<string | number>,\n /**\n * All nodes and Arrays visited before reaching parent of this node.\n * These correspond to array indices in `path`.\n * Note: ancestors includes arrays which contain the parent of visited node.\n */\n ancestors: ReadonlyArray<ASTNode | ReadonlyArray<ASTNode>>,\n) => R;\n\ntype ReducedField<T, R> = T extends null | undefined\n ? T\n : T extends ReadonlyArray<any>\n ? ReadonlyArray<R>\n : R;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
File without changes
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }