@graphitation/supermassive 0.1.1 → 0.3.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.
Files changed (192) hide show
  1. package/CHANGELOG.md +34 -2
  2. package/README.md +264 -2
  3. package/bin/supermassive.js +7 -0
  4. package/lib/{src/ast → ast}/TypedAST.d.ts +2 -0
  5. package/lib/ast/TypedAST.d.ts.map +1 -0
  6. package/lib/{src/ast → ast}/addTypesToRequestDocument.d.ts +0 -0
  7. package/lib/ast/addTypesToRequestDocument.d.ts.map +1 -0
  8. package/lib/ast/addTypesToRequestDocument.js +8 -5
  9. package/lib/ast/addTypesToRequestDocument.mjs +12 -6
  10. package/lib/benchmarks/index.d.ts.map +1 -1
  11. package/lib/benchmarks/index.js +127 -0
  12. package/lib/benchmarks/index.mjs +111 -0
  13. package/lib/benchmarks/nice-benchmark.d.ts +1 -1
  14. package/lib/benchmarks/nice-benchmark.d.ts.map +1 -1
  15. package/lib/benchmarks/nice-benchmark.js +72 -0
  16. package/lib/benchmarks/nice-benchmark.mjs +52 -0
  17. package/lib/benchmarks/swapi-schema/index.d.ts +1 -0
  18. package/lib/benchmarks/swapi-schema/index.d.ts.map +1 -1
  19. package/lib/benchmarks/swapi-schema/index.js +39 -0
  20. package/lib/benchmarks/swapi-schema/index.mjs +17 -0
  21. package/lib/benchmarks/swapi-schema/models.d.ts.map +1 -1
  22. package/lib/benchmarks/swapi-schema/models.js +29 -0
  23. package/lib/benchmarks/swapi-schema/models.mjs +7 -0
  24. package/lib/benchmarks/swapi-schema/resolvers.d.ts.map +1 -1
  25. package/lib/benchmarks/swapi-schema/resolvers.js +237 -0
  26. package/lib/benchmarks/swapi-schema/resolvers.mjs +230 -0
  27. package/lib/bin/supermassive.d.ts +3 -0
  28. package/lib/bin/supermassive.d.ts.map +1 -0
  29. package/lib/bin/supermassive.js +83 -0
  30. package/lib/bin/supermassive.mjs +62 -0
  31. package/lib/collectFields.d.ts +17 -0
  32. package/lib/collectFields.d.ts.map +1 -0
  33. package/lib/collectFields.js +83 -0
  34. package/lib/collectFields.mjs +61 -0
  35. package/lib/compiledQuery.d.ts +1 -0
  36. package/lib/compiledQuery.d.ts.map +1 -0
  37. package/lib/compiledQuery.js +0 -0
  38. package/lib/compiledQuery.mjs +0 -0
  39. package/lib/executeWithSchema.d.ts +4 -0
  40. package/lib/executeWithSchema.d.ts.map +1 -0
  41. package/lib/{index.test.js → executeWithSchema.js} +45 -46
  42. package/lib/executeWithSchema.mjs +64 -0
  43. package/lib/executeWithoutSchema.d.ts +99 -0
  44. package/lib/executeWithoutSchema.d.ts.map +1 -0
  45. package/lib/executeWithoutSchema.js +376 -0
  46. package/lib/executeWithoutSchema.mjs +363 -0
  47. package/lib/extractImplicitTypesRuntime.d.ts +4 -0
  48. package/lib/extractImplicitTypesRuntime.d.ts.map +1 -0
  49. package/lib/extractImplicitTypesRuntime.js +103 -0
  50. package/lib/extractImplicitTypesRuntime.mjs +91 -0
  51. package/lib/extractImplicitTypesToTypescript.d.ts +4 -0
  52. package/lib/extractImplicitTypesToTypescript.d.ts.map +1 -0
  53. package/lib/extractImplicitTypesToTypescript.js +169 -0
  54. package/lib/extractImplicitTypesToTypescript.mjs +149 -0
  55. package/lib/index.d.ts +8 -0
  56. package/lib/index.d.ts.map +1 -0
  57. package/lib/index.js +12 -29
  58. package/lib/index.mjs +13 -29
  59. package/lib/jsutils/Maybe.d.ts +3 -0
  60. package/lib/jsutils/Maybe.d.ts.map +1 -0
  61. package/lib/jsutils/Maybe.js +3 -0
  62. package/lib/jsutils/Maybe.mjs +0 -0
  63. package/lib/jsutils/ObjMap.d.ts +13 -0
  64. package/lib/jsutils/ObjMap.d.ts.map +1 -0
  65. package/lib/jsutils/ObjMap.js +3 -0
  66. package/lib/jsutils/ObjMap.mjs +0 -0
  67. package/lib/jsutils/Path.d.ts +15 -0
  68. package/lib/jsutils/Path.d.ts.map +1 -0
  69. package/lib/jsutils/Path.js +23 -0
  70. package/lib/jsutils/Path.mjs +17 -0
  71. package/lib/jsutils/PromiseOrValue.d.ts +2 -0
  72. package/lib/jsutils/PromiseOrValue.d.ts.map +1 -0
  73. package/lib/jsutils/PromiseOrValue.js +3 -0
  74. package/lib/jsutils/PromiseOrValue.mjs +0 -0
  75. package/lib/jsutils/devAssert.d.ts +2 -0
  76. package/lib/jsutils/devAssert.d.ts.map +1 -0
  77. package/lib/jsutils/devAssert.js +16 -0
  78. package/lib/jsutils/devAssert.mjs +10 -0
  79. package/lib/jsutils/didYouMean.d.ts +6 -0
  80. package/lib/jsutils/didYouMean.d.ts.map +1 -0
  81. package/lib/jsutils/didYouMean.js +30 -0
  82. package/lib/jsutils/didYouMean.mjs +24 -0
  83. package/lib/jsutils/identityFunc.d.ts +5 -0
  84. package/lib/jsutils/identityFunc.d.ts.map +1 -0
  85. package/lib/jsutils/identityFunc.js +13 -0
  86. package/lib/jsutils/identityFunc.mjs +7 -0
  87. package/lib/jsutils/inspect.d.ts +5 -0
  88. package/lib/jsutils/inspect.d.ts.map +1 -0
  89. package/lib/jsutils/inspect.js +89 -0
  90. package/lib/jsutils/inspect.mjs +83 -0
  91. package/lib/jsutils/instanceOf.d.ts +14 -0
  92. package/lib/jsutils/instanceOf.d.ts.map +1 -0
  93. package/lib/jsutils/instanceOf.js +55 -0
  94. package/lib/jsutils/instanceOf.mjs +33 -0
  95. package/lib/jsutils/invariant.d.ts +2 -0
  96. package/lib/jsutils/invariant.d.ts.map +1 -0
  97. package/lib/jsutils/invariant.js +16 -0
  98. package/lib/jsutils/invariant.mjs +10 -0
  99. package/lib/jsutils/isAsyncIterable.d.ts +6 -0
  100. package/lib/jsutils/isAsyncIterable.d.ts.map +1 -0
  101. package/lib/jsutils/isAsyncIterable.js +13 -0
  102. package/lib/jsutils/isAsyncIterable.mjs +7 -0
  103. package/lib/jsutils/isIterableObject.d.ts +18 -0
  104. package/lib/jsutils/isIterableObject.d.ts.map +1 -0
  105. package/lib/jsutils/isIterableObject.js +13 -0
  106. package/lib/jsutils/isIterableObject.mjs +7 -0
  107. package/lib/jsutils/isObjectLike.d.ts +8 -0
  108. package/lib/jsutils/isObjectLike.d.ts.map +1 -0
  109. package/lib/jsutils/isObjectLike.js +13 -0
  110. package/lib/jsutils/isObjectLike.mjs +7 -0
  111. package/lib/jsutils/isPromise.d.ts +6 -0
  112. package/lib/jsutils/isPromise.d.ts.map +1 -0
  113. package/lib/jsutils/isPromise.js +13 -0
  114. package/lib/jsutils/isPromise.mjs +7 -0
  115. package/lib/jsutils/keyMap.d.ts +26 -0
  116. package/lib/jsutils/keyMap.d.ts.map +1 -0
  117. package/lib/jsutils/keyMap.js +17 -0
  118. package/lib/jsutils/keyMap.mjs +11 -0
  119. package/lib/jsutils/keyValMap.d.ts +20 -0
  120. package/lib/jsutils/keyValMap.d.ts.map +1 -0
  121. package/lib/jsutils/keyValMap.js +17 -0
  122. package/lib/jsutils/keyValMap.mjs +11 -0
  123. package/lib/jsutils/mapValue.d.ts +7 -0
  124. package/lib/jsutils/mapValue.d.ts.map +1 -0
  125. package/lib/jsutils/mapValue.js +17 -0
  126. package/lib/jsutils/mapValue.mjs +11 -0
  127. package/lib/jsutils/memoize3.d.ts +5 -0
  128. package/lib/jsutils/memoize3.d.ts.map +1 -0
  129. package/lib/jsutils/memoize3.js +34 -0
  130. package/lib/jsutils/memoize3.mjs +28 -0
  131. package/lib/jsutils/naturalCompare.d.ts +9 -0
  132. package/lib/jsutils/naturalCompare.d.ts.map +1 -0
  133. package/lib/jsutils/naturalCompare.js +53 -0
  134. package/lib/jsutils/naturalCompare.mjs +47 -0
  135. package/lib/jsutils/printPathArray.d.ts +5 -0
  136. package/lib/jsutils/printPathArray.d.ts.map +1 -0
  137. package/lib/jsutils/printPathArray.js +13 -0
  138. package/lib/jsutils/printPathArray.mjs +7 -0
  139. package/lib/jsutils/promiseForObject.d.ts +10 -0
  140. package/lib/jsutils/promiseForObject.d.ts.map +1 -0
  141. package/lib/jsutils/promiseForObject.js +19 -0
  142. package/lib/jsutils/promiseForObject.mjs +13 -0
  143. package/lib/jsutils/promiseReduce.d.ts +10 -0
  144. package/lib/jsutils/promiseReduce.d.ts.map +1 -0
  145. package/lib/jsutils/promiseReduce.js +34 -0
  146. package/lib/jsutils/promiseReduce.mjs +12 -0
  147. package/lib/jsutils/suggestionList.d.ts +6 -0
  148. package/lib/jsutils/suggestionList.d.ts.map +1 -0
  149. package/lib/jsutils/suggestionList.js +109 -0
  150. package/lib/jsutils/suggestionList.mjs +87 -0
  151. package/lib/jsutils/toObjMap.d.ts +4 -0
  152. package/lib/jsutils/toObjMap.d.ts.map +1 -0
  153. package/lib/jsutils/toObjMap.js +20 -0
  154. package/lib/jsutils/toObjMap.mjs +14 -0
  155. package/lib/transforms/annotateDocumentGraphQLTransform.d.ts +3 -0
  156. package/lib/transforms/annotateDocumentGraphQLTransform.d.ts.map +1 -0
  157. package/lib/transforms/annotateDocumentGraphQLTransform.js +37 -0
  158. package/lib/transforms/annotateDocumentGraphQLTransform.mjs +17 -0
  159. package/lib/transforms/transformerTestUtils.d.ts +79 -0
  160. package/lib/transforms/transformerTestUtils.d.ts.map +1 -0
  161. package/lib/transforms/transformerTestUtils.js +175 -0
  162. package/lib/transforms/transformerTestUtils.mjs +160 -0
  163. package/lib/types.d.ts +74 -0
  164. package/lib/types.d.ts.map +1 -0
  165. package/lib/types.js +3 -0
  166. package/lib/types.mjs +0 -0
  167. package/lib/utilities/typeNameFromAST.d.ts +3 -0
  168. package/lib/utilities/typeNameFromAST.d.ts.map +1 -0
  169. package/lib/utilities/typeNameFromAST.js +34 -0
  170. package/lib/utilities/typeNameFromAST.mjs +12 -0
  171. package/lib/values.d.ts +64 -0
  172. package/lib/values.d.ts.map +1 -0
  173. package/lib/values.js +145 -0
  174. package/lib/values.mjs +138 -0
  175. package/package.json +21 -6
  176. package/.eslintcache +0 -1
  177. package/CHANGELOG.json +0 -35
  178. package/benchmarks/fixtures/query1.graphql +0 -20
  179. package/benchmarks/index.ts +0 -68
  180. package/benchmarks/nice-benchmark.ts +0 -32
  181. package/benchmarks/swapi-schema/index.ts +0 -13
  182. package/benchmarks/swapi-schema/models.ts +0 -4
  183. package/benchmarks/swapi-schema/resolvers.ts +0 -331
  184. package/benchmarks/swapi-schema/schema.graphql +0 -164
  185. package/benchmarks/swapi-schema/starwars.json +0 -5991
  186. package/lib/index.test.mjs +0 -63
  187. package/lib/src/ast/TypedAST.d.ts.map +0 -1
  188. package/lib/src/ast/addTypesToRequestDocument.d.ts.map +0 -1
  189. package/lib/src/index.d.ts +0 -16
  190. package/lib/src/index.d.ts.map +0 -1
  191. package/lib/src/index.test.d.ts +0 -2
  192. package/lib/src/index.test.d.ts.map +0 -1
@@ -0,0 +1,24 @@
1
+ // src/jsutils/didYouMean.ts
2
+ var MAX_SUGGESTIONS = 5;
3
+ function didYouMean(firstArg, secondArg) {
4
+ const [subMessage, suggestionsArg] = secondArg ? [firstArg, secondArg] : [void 0, firstArg];
5
+ let message = " Did you mean ";
6
+ if (subMessage) {
7
+ message += subMessage + " ";
8
+ }
9
+ const suggestions = suggestionsArg.map((x) => `"${x}"`);
10
+ switch (suggestions.length) {
11
+ case 0:
12
+ return "";
13
+ case 1:
14
+ return message + suggestions[0] + "?";
15
+ case 2:
16
+ return message + suggestions[0] + " or " + suggestions[1] + "?";
17
+ }
18
+ const selected = suggestions.slice(0, MAX_SUGGESTIONS);
19
+ const lastItem = selected.pop();
20
+ return message + selected.join(", ") + ", or " + lastItem + "?";
21
+ }
22
+ export {
23
+ didYouMean
24
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Returns the first argument it receives.
3
+ */
4
+ export declare function identityFunc<T>(x: T): T;
5
+ //# sourceMappingURL=identityFunc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identityFunc.d.ts","sourceRoot":"","sources":["../../src/jsutils/identityFunc.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAEvC"}
@@ -0,0 +1,13 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, {get: all[name], enumerable: true});
6
+ };
7
+ __markAsModule(exports);
8
+ __export(exports, {
9
+ identityFunc: () => identityFunc
10
+ });
11
+ function identityFunc(x) {
12
+ return x;
13
+ }
@@ -0,0 +1,7 @@
1
+ // src/jsutils/identityFunc.ts
2
+ function identityFunc(x) {
3
+ return x;
4
+ }
5
+ export {
6
+ identityFunc
7
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Used to print values in error messages.
3
+ */
4
+ export declare function inspect(value: unknown): string;
5
+ //# sourceMappingURL=inspect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/jsutils/inspect.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE9C"}
@@ -0,0 +1,89 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, {get: all[name], enumerable: true});
6
+ };
7
+ __markAsModule(exports);
8
+ __export(exports, {
9
+ inspect: () => inspect
10
+ });
11
+ const MAX_ARRAY_LENGTH = 10;
12
+ const MAX_RECURSIVE_DEPTH = 2;
13
+ function inspect(value) {
14
+ return formatValue(value, []);
15
+ }
16
+ function formatValue(value, seenValues) {
17
+ switch (typeof value) {
18
+ case "string":
19
+ return JSON.stringify(value);
20
+ case "function":
21
+ return value.name ? `[function ${value.name}]` : "[function]";
22
+ case "object":
23
+ return formatObjectValue(value, seenValues);
24
+ default:
25
+ return String(value);
26
+ }
27
+ }
28
+ function formatObjectValue(value, previouslySeenValues) {
29
+ if (value === null) {
30
+ return "null";
31
+ }
32
+ if (previouslySeenValues.includes(value)) {
33
+ return "[Circular]";
34
+ }
35
+ const seenValues = [...previouslySeenValues, value];
36
+ if (isJSONable(value)) {
37
+ const jsonValue = value.toJSON();
38
+ if (jsonValue !== value) {
39
+ return typeof jsonValue === "string" ? jsonValue : formatValue(jsonValue, seenValues);
40
+ }
41
+ } else if (Array.isArray(value)) {
42
+ return formatArray(value, seenValues);
43
+ }
44
+ return formatObject(value, seenValues);
45
+ }
46
+ function isJSONable(value) {
47
+ return typeof value.toJSON === "function";
48
+ }
49
+ function formatObject(object, seenValues) {
50
+ const entries = Object.entries(object);
51
+ if (entries.length === 0) {
52
+ return "{}";
53
+ }
54
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
55
+ return "[" + getObjectTag(object) + "]";
56
+ }
57
+ const properties = entries.map(([key, value]) => key + ": " + formatValue(value, seenValues));
58
+ return "{ " + properties.join(", ") + " }";
59
+ }
60
+ function formatArray(array, seenValues) {
61
+ if (array.length === 0) {
62
+ return "[]";
63
+ }
64
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
65
+ return "[Array]";
66
+ }
67
+ const len = Math.min(MAX_ARRAY_LENGTH, array.length);
68
+ const remaining = array.length - len;
69
+ const items = [];
70
+ for (let i = 0; i < len; ++i) {
71
+ items.push(formatValue(array[i], seenValues));
72
+ }
73
+ if (remaining === 1) {
74
+ items.push("... 1 more item");
75
+ } else if (remaining > 1) {
76
+ items.push(`... ${remaining} more items`);
77
+ }
78
+ return "[" + items.join(", ") + "]";
79
+ }
80
+ function getObjectTag(object) {
81
+ const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, "");
82
+ if (tag === "Object" && typeof object.constructor === "function") {
83
+ const name = object.constructor.name;
84
+ if (typeof name === "string" && name !== "") {
85
+ return name;
86
+ }
87
+ }
88
+ return tag;
89
+ }
@@ -0,0 +1,83 @@
1
+ // src/jsutils/inspect.ts
2
+ var MAX_ARRAY_LENGTH = 10;
3
+ var MAX_RECURSIVE_DEPTH = 2;
4
+ function inspect(value) {
5
+ return formatValue(value, []);
6
+ }
7
+ function formatValue(value, seenValues) {
8
+ switch (typeof value) {
9
+ case "string":
10
+ return JSON.stringify(value);
11
+ case "function":
12
+ return value.name ? `[function ${value.name}]` : "[function]";
13
+ case "object":
14
+ return formatObjectValue(value, seenValues);
15
+ default:
16
+ return String(value);
17
+ }
18
+ }
19
+ function formatObjectValue(value, previouslySeenValues) {
20
+ if (value === null) {
21
+ return "null";
22
+ }
23
+ if (previouslySeenValues.includes(value)) {
24
+ return "[Circular]";
25
+ }
26
+ const seenValues = [...previouslySeenValues, value];
27
+ if (isJSONable(value)) {
28
+ const jsonValue = value.toJSON();
29
+ if (jsonValue !== value) {
30
+ return typeof jsonValue === "string" ? jsonValue : formatValue(jsonValue, seenValues);
31
+ }
32
+ } else if (Array.isArray(value)) {
33
+ return formatArray(value, seenValues);
34
+ }
35
+ return formatObject(value, seenValues);
36
+ }
37
+ function isJSONable(value) {
38
+ return typeof value.toJSON === "function";
39
+ }
40
+ function formatObject(object, seenValues) {
41
+ const entries = Object.entries(object);
42
+ if (entries.length === 0) {
43
+ return "{}";
44
+ }
45
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
46
+ return "[" + getObjectTag(object) + "]";
47
+ }
48
+ const properties = entries.map(([key, value]) => key + ": " + formatValue(value, seenValues));
49
+ return "{ " + properties.join(", ") + " }";
50
+ }
51
+ function formatArray(array, seenValues) {
52
+ if (array.length === 0) {
53
+ return "[]";
54
+ }
55
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
56
+ return "[Array]";
57
+ }
58
+ const len = Math.min(MAX_ARRAY_LENGTH, array.length);
59
+ const remaining = array.length - len;
60
+ const items = [];
61
+ for (let i = 0; i < len; ++i) {
62
+ items.push(formatValue(array[i], seenValues));
63
+ }
64
+ if (remaining === 1) {
65
+ items.push("... 1 more item");
66
+ } else if (remaining > 1) {
67
+ items.push(`... ${remaining} more items`);
68
+ }
69
+ return "[" + items.join(", ") + "]";
70
+ }
71
+ function getObjectTag(object) {
72
+ const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, "");
73
+ if (tag === "Object" && typeof object.constructor === "function") {
74
+ const name = object.constructor.name;
75
+ if (typeof name === "string" && name !== "") {
76
+ return name;
77
+ }
78
+ }
79
+ return tag;
80
+ }
81
+ export {
82
+ inspect
83
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A replacement for instanceof which includes an error warning when multi-realm
3
+ * constructors are detected.
4
+ * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production
5
+ * See: https://webpack.js.org/guides/production/
6
+ */
7
+ export declare const instanceOf: (value: unknown, constructor: Constructor) => boolean;
8
+ interface Constructor extends Function {
9
+ prototype: {
10
+ [Symbol.toStringTag]: string;
11
+ };
12
+ }
13
+ export {};
14
+ //# sourceMappingURL=instanceOf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instanceOf.d.ts","sourceRoot":"","sources":["../../src/jsutils/instanceOf.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,KAAK,OAsChE,CAAC;AAER,UAAU,WAAY,SAAQ,QAAQ;IACpC,SAAS,EAAE;QACT,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;CACH"}
@@ -0,0 +1,55 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, {get: all[name], enumerable: true});
11
+ };
12
+ var __reExport = (target, module2, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && key !== "default")
16
+ __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
17
+ }
18
+ return target;
19
+ };
20
+ var __toModule = (module2) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
22
+ };
23
+ __markAsModule(exports);
24
+ __export(exports, {
25
+ instanceOf: () => instanceOf
26
+ });
27
+ var import_inspect = __toModule(require("./inspect"));
28
+ const instanceOf = false ? function instanceOf2(value, constructor) {
29
+ return value instanceof constructor;
30
+ } : function instanceOf3(value, constructor) {
31
+ var _a;
32
+ if (value instanceof constructor) {
33
+ return true;
34
+ }
35
+ if (typeof value === "object" && value !== null) {
36
+ const className = constructor.prototype[Symbol.toStringTag];
37
+ const valueClassName = Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_a = value.constructor) == null ? void 0 : _a.name;
38
+ if (className === valueClassName) {
39
+ const stringifiedValue = (0, import_inspect.inspect)(value);
40
+ throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm.
41
+
42
+ Ensure that there is only one instance of "graphql" in the node_modules
43
+ directory. If different versions of "graphql" are the dependencies of other
44
+ relied on modules, use "resolutions" to ensure only one version is installed.
45
+
46
+ https://yarnpkg.com/en/docs/selective-version-resolutions
47
+
48
+ Duplicate "graphql" modules cannot be used at the same time since different
49
+ versions may have different capabilities and behavior. The data from one
50
+ version used in the function from another could produce confusing and
51
+ spurious results.`);
52
+ }
53
+ }
54
+ return false;
55
+ };
@@ -0,0 +1,33 @@
1
+ // src/jsutils/instanceOf.ts
2
+ import {inspect} from "./inspect.mjs";
3
+ var instanceOf = false ? function instanceOf2(value, constructor) {
4
+ return value instanceof constructor;
5
+ } : function instanceOf3(value, constructor) {
6
+ var _a;
7
+ if (value instanceof constructor) {
8
+ return true;
9
+ }
10
+ if (typeof value === "object" && value !== null) {
11
+ const className = constructor.prototype[Symbol.toStringTag];
12
+ const valueClassName = Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_a = value.constructor) == null ? void 0 : _a.name;
13
+ if (className === valueClassName) {
14
+ const stringifiedValue = inspect(value);
15
+ throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm.
16
+
17
+ Ensure that there is only one instance of "graphql" in the node_modules
18
+ directory. If different versions of "graphql" are the dependencies of other
19
+ relied on modules, use "resolutions" to ensure only one version is installed.
20
+
21
+ https://yarnpkg.com/en/docs/selective-version-resolutions
22
+
23
+ Duplicate "graphql" modules cannot be used at the same time since different
24
+ versions may have different capabilities and behavior. The data from one
25
+ version used in the function from another could produce confusing and
26
+ spurious results.`);
27
+ }
28
+ }
29
+ return false;
30
+ };
31
+ export {
32
+ instanceOf
33
+ };
@@ -0,0 +1,2 @@
1
+ export declare function invariant(condition: unknown, message?: string): asserts condition;
2
+ //# sourceMappingURL=invariant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invariant.d.ts","sourceRoot":"","sources":["../../src/jsutils/invariant.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CACvB,SAAS,EAAE,OAAO,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,SAAS,CAQnB"}
@@ -0,0 +1,16 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, {get: all[name], enumerable: true});
6
+ };
7
+ __markAsModule(exports);
8
+ __export(exports, {
9
+ invariant: () => invariant
10
+ });
11
+ function invariant(condition, message) {
12
+ const booleanCondition = Boolean(condition);
13
+ if (!booleanCondition) {
14
+ throw new Error(message != null ? message : "Unexpected invariant triggered.");
15
+ }
16
+ }
@@ -0,0 +1,10 @@
1
+ // src/jsutils/invariant.ts
2
+ function invariant(condition, message) {
3
+ const booleanCondition = Boolean(condition);
4
+ if (!booleanCondition) {
5
+ throw new Error(message != null ? message : "Unexpected invariant triggered.");
6
+ }
7
+ }
8
+ export {
9
+ invariant
10
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns true if the provided object implements the AsyncIterator protocol via
3
+ * implementing a `Symbol.asyncIterator` method.
4
+ */
5
+ export declare function isAsyncIterable(maybeAsyncIterable: any): maybeAsyncIterable is AsyncIterable<unknown>;
6
+ //# sourceMappingURL=isAsyncIterable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isAsyncIterable.d.ts","sourceRoot":"","sources":["../../src/jsutils/isAsyncIterable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,kBAAkB,EAAE,GAAG,GACtB,kBAAkB,IAAI,aAAa,CAAC,OAAO,CAAC,CAE9C"}
@@ -0,0 +1,13 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, {get: all[name], enumerable: true});
6
+ };
7
+ __markAsModule(exports);
8
+ __export(exports, {
9
+ isAsyncIterable: () => isAsyncIterable
10
+ });
11
+ function isAsyncIterable(maybeAsyncIterable) {
12
+ return typeof (maybeAsyncIterable == null ? void 0 : maybeAsyncIterable[Symbol.asyncIterator]) === "function";
13
+ }
@@ -0,0 +1,7 @@
1
+ // src/jsutils/isAsyncIterable.ts
2
+ function isAsyncIterable(maybeAsyncIterable) {
3
+ return typeof (maybeAsyncIterable == null ? void 0 : maybeAsyncIterable[Symbol.asyncIterator]) === "function";
4
+ }
5
+ export {
6
+ isAsyncIterable
7
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Returns true if the provided object is an Object (i.e. not a string literal)
3
+ * and implements the Iterator protocol.
4
+ *
5
+ * This may be used in place of [Array.isArray()][isArray] to determine if
6
+ * an object should be iterated-over e.g. Array, Map, Set, Int8Array,
7
+ * TypedArray, etc. but excludes string literals.
8
+ *
9
+ * @example
10
+ *
11
+ * isIterableObject([ 1, 2, 3 ]) // true
12
+ * isIterableObject(new Map()) // true
13
+ * isIterableObject('ABC') // false
14
+ * isIterableObject({ key: 'value' }) // false
15
+ * isIterableObject({ length: 1, 0: 'Alpha' }) // false
16
+ */
17
+ export declare function isIterableObject(maybeIterable: any): maybeIterable is Iterable<unknown>;
18
+ //# sourceMappingURL=isIterableObject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isIterableObject.d.ts","sourceRoot":"","sources":["../../src/jsutils/isIterableObject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,GAAG,GACjB,aAAa,IAAI,QAAQ,CAAC,OAAO,CAAC,CAKpC"}
@@ -0,0 +1,13 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, {get: all[name], enumerable: true});
6
+ };
7
+ __markAsModule(exports);
8
+ __export(exports, {
9
+ isIterableObject: () => isIterableObject
10
+ });
11
+ function isIterableObject(maybeIterable) {
12
+ return typeof maybeIterable === "object" && typeof (maybeIterable == null ? void 0 : maybeIterable[Symbol.iterator]) === "function";
13
+ }
@@ -0,0 +1,7 @@
1
+ // src/jsutils/isIterableObject.ts
2
+ function isIterableObject(maybeIterable) {
3
+ return typeof maybeIterable === "object" && typeof (maybeIterable == null ? void 0 : maybeIterable[Symbol.iterator]) === "function";
4
+ }
5
+ export {
6
+ isIterableObject
7
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Return true if `value` is object-like. A value is object-like if it's not
3
+ * `null` and has a `typeof` result of "object".
4
+ */
5
+ export declare function isObjectLike(value: unknown): value is {
6
+ [key: string]: unknown;
7
+ };
8
+ //# sourceMappingURL=isObjectLike.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isObjectLike.d.ts","sourceRoot":"","sources":["../../src/jsutils/isObjectLike.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAErC"}
@@ -0,0 +1,13 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, {get: all[name], enumerable: true});
6
+ };
7
+ __markAsModule(exports);
8
+ __export(exports, {
9
+ isObjectLike: () => isObjectLike
10
+ });
11
+ function isObjectLike(value) {
12
+ return typeof value == "object" && value !== null;
13
+ }
@@ -0,0 +1,7 @@
1
+ // src/jsutils/isObjectLike.ts
2
+ function isObjectLike(value) {
3
+ return typeof value == "object" && value !== null;
4
+ }
5
+ export {
6
+ isObjectLike
7
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns true if the value acts like a Promise, i.e. has a "then" function,
3
+ * otherwise returns false.
4
+ */
5
+ export declare function isPromise(value: any): value is Promise<unknown>;
6
+ //# sourceMappingURL=isPromise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPromise.d.ts","sourceRoot":"","sources":["../../src/jsutils/isPromise.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,CAE/D"}
@@ -0,0 +1,13 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, {get: all[name], enumerable: true});
6
+ };
7
+ __markAsModule(exports);
8
+ __export(exports, {
9
+ isPromise: () => isPromise
10
+ });
11
+ function isPromise(value) {
12
+ return typeof (value == null ? void 0 : value.then) === "function";
13
+ }
@@ -0,0 +1,7 @@
1
+ // src/jsutils/isPromise.ts
2
+ function isPromise(value) {
3
+ return typeof (value == null ? void 0 : value.then) === "function";
4
+ }
5
+ export {
6
+ isPromise
7
+ };
@@ -0,0 +1,26 @@
1
+ import type { ObjMap } from './ObjMap';
2
+ /**
3
+ * Creates a keyed JS object from an array, given a function to produce the keys
4
+ * for each value in the array.
5
+ *
6
+ * This provides a convenient lookup for the array items if the key function
7
+ * produces unique results.
8
+ *
9
+ * const phoneBook = [
10
+ * { name: 'Jon', num: '555-1234' },
11
+ * { name: 'Jenny', num: '867-5309' }
12
+ * ]
13
+ *
14
+ * // { Jon: { name: 'Jon', num: '555-1234' },
15
+ * // Jenny: { name: 'Jenny', num: '867-5309' } }
16
+ * const entriesByName = keyMap(
17
+ * phoneBook,
18
+ * entry => entry.name
19
+ * )
20
+ *
21
+ * // { name: 'Jenny', num: '857-6309' }
22
+ * const jennyEntry = entriesByName['Jenny']
23
+ *
24
+ */
25
+ export declare function keyMap<T>(list: ReadonlyArray<T>, keyFn: (item: T) => string): ObjMap<T>;
26
+ //# sourceMappingURL=keyMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyMap.d.ts","sourceRoot":"","sources":["../../src/jsutils/keyMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACtB,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EACtB,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GACzB,MAAM,CAAC,CAAC,CAAC,CAMX"}
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, {get: all[name], enumerable: true});
6
+ };
7
+ __markAsModule(exports);
8
+ __export(exports, {
9
+ keyMap: () => keyMap
10
+ });
11
+ function keyMap(list, keyFn) {
12
+ const result = Object.create(null);
13
+ for (const item of list) {
14
+ result[keyFn(item)] = item;
15
+ }
16
+ return result;
17
+ }
@@ -0,0 +1,11 @@
1
+ // src/jsutils/keyMap.ts
2
+ function keyMap(list, keyFn) {
3
+ const result = Object.create(null);
4
+ for (const item of list) {
5
+ result[keyFn(item)] = item;
6
+ }
7
+ return result;
8
+ }
9
+ export {
10
+ keyMap
11
+ };
@@ -0,0 +1,20 @@
1
+ import type { ObjMap } from './ObjMap';
2
+ /**
3
+ * Creates a keyed JS object from an array, given a function to produce the keys
4
+ * and a function to produce the values from each item in the array.
5
+ *
6
+ * const phoneBook = [
7
+ * { name: 'Jon', num: '555-1234' },
8
+ * { name: 'Jenny', num: '867-5309' }
9
+ * ]
10
+ *
11
+ * // { Jon: '555-1234', Jenny: '867-5309' }
12
+ * const phonesByName = keyValMap(
13
+ * phoneBook,
14
+ * entry => entry.name,
15
+ * entry => entry.num
16
+ * )
17
+ *
18
+ */
19
+ export declare function keyValMap<T, V>(list: ReadonlyArray<T>, keyFn: (item: T) => string, valFn: (item: T) => V): ObjMap<V>;
20
+ //# sourceMappingURL=keyValMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyValMap.d.ts","sourceRoot":"","sources":["../../src/jsutils/keyValMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAC5B,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EACtB,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,EAC1B,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GACpB,MAAM,CAAC,CAAC,CAAC,CAMX"}
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, {get: all[name], enumerable: true});
6
+ };
7
+ __markAsModule(exports);
8
+ __export(exports, {
9
+ keyValMap: () => keyValMap
10
+ });
11
+ function keyValMap(list, keyFn, valFn) {
12
+ const result = Object.create(null);
13
+ for (const item of list) {
14
+ result[keyFn(item)] = valFn(item);
15
+ }
16
+ return result;
17
+ }