@graphitation/supermassive 0.1.3 → 0.2.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 (208) hide show
  1. package/.eslintcache +1 -1
  2. package/CHANGELOG.md +10 -2
  3. package/README.md +88 -0
  4. package/bin/supermassive.js +5 -0
  5. package/graphitation-supermassive-0.1.3-1.tgz +0 -0
  6. package/graphitation-supermassive-0.1.3-2.tgz +0 -0
  7. package/graphitation-supermassive-0.1.3.tgz +0 -0
  8. package/lib/{src/ast → ast}/TypedAST.d.ts +2 -0
  9. package/lib/ast/TypedAST.d.ts.map +1 -0
  10. package/lib/{src/ast → ast}/addTypesToRequestDocument.d.ts +0 -0
  11. package/lib/ast/addTypesToRequestDocument.d.ts.map +1 -0
  12. package/lib/ast/addTypesToRequestDocument.js +8 -5
  13. package/lib/ast/addTypesToRequestDocument.mjs +9 -5
  14. package/lib/benchmarks/index.d.ts.map +1 -1
  15. package/lib/benchmarks/index.js +127 -0
  16. package/lib/benchmarks/index.mjs +109 -0
  17. package/lib/benchmarks/nice-benchmark.d.ts +1 -1
  18. package/lib/benchmarks/nice-benchmark.d.ts.map +1 -1
  19. package/lib/benchmarks/nice-benchmark.js +72 -0
  20. package/lib/benchmarks/nice-benchmark.mjs +49 -0
  21. package/lib/benchmarks/swapi-schema/index.d.ts +1 -0
  22. package/lib/benchmarks/swapi-schema/index.d.ts.map +1 -1
  23. package/lib/benchmarks/swapi-schema/index.js +39 -0
  24. package/lib/benchmarks/swapi-schema/index.mjs +16 -0
  25. package/lib/benchmarks/swapi-schema/models.d.ts.map +1 -1
  26. package/lib/benchmarks/swapi-schema/models.js +29 -0
  27. package/lib/benchmarks/swapi-schema/models.mjs +6 -0
  28. package/lib/benchmarks/swapi-schema/resolvers.d.ts.map +1 -1
  29. package/lib/benchmarks/swapi-schema/resolvers.js +237 -0
  30. package/lib/benchmarks/swapi-schema/resolvers.mjs +231 -0
  31. package/lib/bin/supermassive.d.ts +3 -0
  32. package/lib/bin/supermassive.d.ts.map +1 -0
  33. package/lib/bin/supermassive.js +83 -0
  34. package/lib/bin/supermassive.mjs +60 -0
  35. package/lib/bin/typeDefsToImplicitResolvers.d.ts +3 -0
  36. package/lib/bin/typeDefsToImplicitResolvers.d.ts.map +1 -0
  37. package/lib/bin/typeDefsToImplicitResolvers.js +82 -0
  38. package/lib/bin/typeDefsToImplicitResolvers.mjs +59 -0
  39. package/lib/collectFields.d.ts +17 -0
  40. package/lib/collectFields.d.ts.map +1 -0
  41. package/lib/collectFields.js +83 -0
  42. package/lib/collectFields.mjs +60 -0
  43. package/lib/compiledQuery.d.ts +1 -0
  44. package/lib/compiledQuery.d.ts.map +1 -0
  45. package/lib/compiledQuery.js +0 -0
  46. package/lib/compiledQuery.mjs +0 -0
  47. package/lib/execute.d.ts +128 -0
  48. package/lib/execute.d.ts.map +1 -0
  49. package/lib/execute.js +376 -0
  50. package/lib/execute.mjs +365 -0
  51. package/lib/executeWithSchema.d.ts +4 -0
  52. package/lib/executeWithSchema.d.ts.map +1 -0
  53. package/lib/{index.test.js → executeWithSchema.js} +44 -45
  54. package/lib/executeWithSchema.mjs +62 -0
  55. package/lib/executeWithoutSchema.d.ts +99 -0
  56. package/lib/executeWithoutSchema.d.ts.map +1 -0
  57. package/lib/executeWithoutSchema.js +376 -0
  58. package/lib/executeWithoutSchema.mjs +365 -0
  59. package/lib/extractImplicitTypes.d.ts +6 -0
  60. package/lib/extractImplicitTypes.d.ts.map +1 -0
  61. package/lib/extractImplicitTypes.js +246 -0
  62. package/lib/extractImplicitTypes.mjs +233 -0
  63. package/lib/extractImplicitTypesRuntime.d.ts +4 -0
  64. package/lib/extractImplicitTypesRuntime.d.ts.map +1 -0
  65. package/lib/extractImplicitTypesRuntime.js +103 -0
  66. package/lib/extractImplicitTypesRuntime.mjs +90 -0
  67. package/lib/extractImplicitTypesToTypescript.d.ts +4 -0
  68. package/lib/extractImplicitTypesToTypescript.d.ts.map +1 -0
  69. package/lib/extractImplicitTypesToTypescript.js +169 -0
  70. package/lib/extractImplicitTypesToTypescript.mjs +148 -0
  71. package/lib/index.d.ts +8 -0
  72. package/lib/index.d.ts.map +1 -0
  73. package/lib/index.js +14 -29
  74. package/lib/index.mjs +14 -29
  75. package/lib/jsutils/Maybe.d.ts +3 -0
  76. package/lib/jsutils/Maybe.d.ts.map +1 -0
  77. package/lib/jsutils/Maybe.js +3 -0
  78. package/lib/jsutils/Maybe.mjs +0 -0
  79. package/lib/jsutils/ObjMap.d.ts +13 -0
  80. package/lib/jsutils/ObjMap.d.ts.map +1 -0
  81. package/lib/jsutils/ObjMap.js +3 -0
  82. package/lib/jsutils/ObjMap.mjs +0 -0
  83. package/lib/jsutils/Path.d.ts +15 -0
  84. package/lib/jsutils/Path.d.ts.map +1 -0
  85. package/lib/jsutils/Path.js +23 -0
  86. package/lib/jsutils/Path.mjs +16 -0
  87. package/lib/jsutils/PromiseOrValue.d.ts +2 -0
  88. package/lib/jsutils/PromiseOrValue.d.ts.map +1 -0
  89. package/lib/jsutils/PromiseOrValue.js +3 -0
  90. package/lib/jsutils/PromiseOrValue.mjs +0 -0
  91. package/lib/jsutils/devAssert.d.ts +2 -0
  92. package/lib/jsutils/devAssert.d.ts.map +1 -0
  93. package/lib/jsutils/devAssert.js +16 -0
  94. package/lib/jsutils/devAssert.mjs +9 -0
  95. package/lib/jsutils/didYouMean.d.ts +6 -0
  96. package/lib/jsutils/didYouMean.d.ts.map +1 -0
  97. package/lib/jsutils/didYouMean.js +30 -0
  98. package/lib/jsutils/didYouMean.mjs +23 -0
  99. package/lib/jsutils/identityFunc.d.ts +5 -0
  100. package/lib/jsutils/identityFunc.d.ts.map +1 -0
  101. package/lib/jsutils/identityFunc.js +13 -0
  102. package/lib/jsutils/identityFunc.mjs +6 -0
  103. package/lib/jsutils/inspect.d.ts +5 -0
  104. package/lib/jsutils/inspect.d.ts.map +1 -0
  105. package/lib/jsutils/inspect.js +89 -0
  106. package/lib/jsutils/inspect.mjs +82 -0
  107. package/lib/jsutils/instanceOf.d.ts +14 -0
  108. package/lib/jsutils/instanceOf.d.ts.map +1 -0
  109. package/lib/jsutils/instanceOf.js +55 -0
  110. package/lib/jsutils/instanceOf.mjs +32 -0
  111. package/lib/jsutils/invariant.d.ts +2 -0
  112. package/lib/jsutils/invariant.d.ts.map +1 -0
  113. package/lib/jsutils/invariant.js +16 -0
  114. package/lib/jsutils/invariant.mjs +9 -0
  115. package/lib/jsutils/isAsyncIterable.d.ts +6 -0
  116. package/lib/jsutils/isAsyncIterable.d.ts.map +1 -0
  117. package/lib/jsutils/isAsyncIterable.js +13 -0
  118. package/lib/jsutils/isAsyncIterable.mjs +6 -0
  119. package/lib/jsutils/isIterableObject.d.ts +18 -0
  120. package/lib/jsutils/isIterableObject.d.ts.map +1 -0
  121. package/lib/jsutils/isIterableObject.js +13 -0
  122. package/lib/jsutils/isIterableObject.mjs +6 -0
  123. package/lib/jsutils/isObjectLike.d.ts +8 -0
  124. package/lib/jsutils/isObjectLike.d.ts.map +1 -0
  125. package/lib/jsutils/isObjectLike.js +13 -0
  126. package/lib/jsutils/isObjectLike.mjs +6 -0
  127. package/lib/jsutils/isPromise.d.ts +6 -0
  128. package/lib/jsutils/isPromise.d.ts.map +1 -0
  129. package/lib/jsutils/isPromise.js +13 -0
  130. package/lib/jsutils/isPromise.mjs +6 -0
  131. package/lib/jsutils/keyMap.d.ts +26 -0
  132. package/lib/jsutils/keyMap.d.ts.map +1 -0
  133. package/lib/jsutils/keyMap.js +17 -0
  134. package/lib/jsutils/keyMap.mjs +10 -0
  135. package/lib/jsutils/keyValMap.d.ts +20 -0
  136. package/lib/jsutils/keyValMap.d.ts.map +1 -0
  137. package/lib/jsutils/keyValMap.js +17 -0
  138. package/lib/jsutils/keyValMap.mjs +10 -0
  139. package/lib/jsutils/mapValue.d.ts +7 -0
  140. package/lib/jsutils/mapValue.d.ts.map +1 -0
  141. package/lib/jsutils/mapValue.js +17 -0
  142. package/lib/jsutils/mapValue.mjs +10 -0
  143. package/lib/jsutils/memoize3.d.ts +5 -0
  144. package/lib/jsutils/memoize3.d.ts.map +1 -0
  145. package/lib/jsutils/memoize3.js +34 -0
  146. package/lib/jsutils/memoize3.mjs +27 -0
  147. package/lib/jsutils/naturalCompare.d.ts +9 -0
  148. package/lib/jsutils/naturalCompare.d.ts.map +1 -0
  149. package/lib/jsutils/naturalCompare.js +53 -0
  150. package/lib/jsutils/naturalCompare.mjs +46 -0
  151. package/lib/jsutils/printPathArray.d.ts +5 -0
  152. package/lib/jsutils/printPathArray.d.ts.map +1 -0
  153. package/lib/jsutils/printPathArray.js +13 -0
  154. package/lib/jsutils/printPathArray.mjs +6 -0
  155. package/lib/jsutils/promiseForObject.d.ts +10 -0
  156. package/lib/jsutils/promiseForObject.d.ts.map +1 -0
  157. package/lib/jsutils/promiseForObject.js +19 -0
  158. package/lib/jsutils/promiseForObject.mjs +12 -0
  159. package/lib/jsutils/promiseReduce.d.ts +10 -0
  160. package/lib/jsutils/promiseReduce.d.ts.map +1 -0
  161. package/lib/jsutils/promiseReduce.js +34 -0
  162. package/lib/jsutils/promiseReduce.mjs +11 -0
  163. package/lib/jsutils/suggestionList.d.ts +6 -0
  164. package/lib/jsutils/suggestionList.d.ts.map +1 -0
  165. package/lib/jsutils/suggestionList.js +109 -0
  166. package/lib/jsutils/suggestionList.mjs +86 -0
  167. package/lib/jsutils/toObjMap.d.ts +4 -0
  168. package/lib/jsutils/toObjMap.d.ts.map +1 -0
  169. package/lib/jsutils/toObjMap.js +20 -0
  170. package/lib/jsutils/toObjMap.mjs +13 -0
  171. package/lib/transforms/annotateDocumentGraphQLTransform.d.ts +3 -0
  172. package/lib/transforms/annotateDocumentGraphQLTransform.d.ts.map +1 -0
  173. package/lib/transforms/annotateDocumentGraphQLTransform.js +37 -0
  174. package/lib/transforms/annotateDocumentGraphQLTransform.mjs +16 -0
  175. package/lib/transforms/transformerTestUtils.d.ts +79 -0
  176. package/lib/transforms/transformerTestUtils.d.ts.map +1 -0
  177. package/lib/transforms/transformerTestUtils.js +175 -0
  178. package/lib/transforms/transformerTestUtils.mjs +154 -0
  179. package/lib/types.d.ts +74 -0
  180. package/lib/types.d.ts.map +1 -0
  181. package/lib/types.js +3 -0
  182. package/lib/types.mjs +0 -0
  183. package/lib/utilities/typeNameFromAST.d.ts +3 -0
  184. package/lib/utilities/typeNameFromAST.d.ts.map +1 -0
  185. package/lib/utilities/typeNameFromAST.js +34 -0
  186. package/lib/utilities/typeNameFromAST.mjs +11 -0
  187. package/lib/values.d.ts +64 -0
  188. package/lib/values.d.ts.map +1 -0
  189. package/lib/values.js +145 -0
  190. package/lib/values.mjs +137 -0
  191. package/package.json +9 -4
  192. package/CHANGELOG.json +0 -65
  193. package/benchmarks/fixtures/query1.graphql +0 -20
  194. package/benchmarks/index.ts +0 -68
  195. package/benchmarks/nice-benchmark.ts +0 -32
  196. package/benchmarks/swapi-schema/index.ts +0 -13
  197. package/benchmarks/swapi-schema/models.ts +0 -4
  198. package/benchmarks/swapi-schema/resolvers.ts +0 -331
  199. package/benchmarks/swapi-schema/schema.graphql +0 -164
  200. package/benchmarks/swapi-schema/starwars.json +0 -5991
  201. package/lib/index.test.mjs +0 -63
  202. package/lib/src/ast/TypedAST.d.ts.map +0 -1
  203. package/lib/src/ast/addTypesToRequestDocument.d.ts.map +0 -1
  204. package/lib/src/index.d.ts +0 -16
  205. package/lib/src/index.d.ts.map +0 -1
  206. package/lib/src/index.test.d.ts +0 -2
  207. package/lib/src/index.test.d.ts.map +0 -1
  208. package/starwars.json +0 -1
@@ -0,0 +1,82 @@
1
+ const MAX_ARRAY_LENGTH = 10;
2
+ const MAX_RECURSIVE_DEPTH = 2;
3
+ function inspect(value) {
4
+ return formatValue(value, []);
5
+ }
6
+ function formatValue(value, seenValues) {
7
+ switch (typeof value) {
8
+ case "string":
9
+ return JSON.stringify(value);
10
+ case "function":
11
+ return value.name ? `[function ${value.name}]` : "[function]";
12
+ case "object":
13
+ return formatObjectValue(value, seenValues);
14
+ default:
15
+ return String(value);
16
+ }
17
+ }
18
+ function formatObjectValue(value, previouslySeenValues) {
19
+ if (value === null) {
20
+ return "null";
21
+ }
22
+ if (previouslySeenValues.includes(value)) {
23
+ return "[Circular]";
24
+ }
25
+ const seenValues = [...previouslySeenValues, value];
26
+ if (isJSONable(value)) {
27
+ const jsonValue = value.toJSON();
28
+ if (jsonValue !== value) {
29
+ return typeof jsonValue === "string" ? jsonValue : formatValue(jsonValue, seenValues);
30
+ }
31
+ } else if (Array.isArray(value)) {
32
+ return formatArray(value, seenValues);
33
+ }
34
+ return formatObject(value, seenValues);
35
+ }
36
+ function isJSONable(value) {
37
+ return typeof value.toJSON === "function";
38
+ }
39
+ function formatObject(object, seenValues) {
40
+ const entries = Object.entries(object);
41
+ if (entries.length === 0) {
42
+ return "{}";
43
+ }
44
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
45
+ return "[" + getObjectTag(object) + "]";
46
+ }
47
+ const properties = entries.map(([key, value]) => key + ": " + formatValue(value, seenValues));
48
+ return "{ " + properties.join(", ") + " }";
49
+ }
50
+ function formatArray(array, seenValues) {
51
+ if (array.length === 0) {
52
+ return "[]";
53
+ }
54
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
55
+ return "[Array]";
56
+ }
57
+ const len = Math.min(MAX_ARRAY_LENGTH, array.length);
58
+ const remaining = array.length - len;
59
+ const items = [];
60
+ for (let i = 0; i < len; ++i) {
61
+ items.push(formatValue(array[i], seenValues));
62
+ }
63
+ if (remaining === 1) {
64
+ items.push("... 1 more item");
65
+ } else if (remaining > 1) {
66
+ items.push(`... ${remaining} more items`);
67
+ }
68
+ return "[" + items.join(", ") + "]";
69
+ }
70
+ function getObjectTag(object) {
71
+ const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, "");
72
+ if (tag === "Object" && typeof object.constructor === "function") {
73
+ const name = object.constructor.name;
74
+ if (typeof name === "string" && name !== "") {
75
+ return name;
76
+ }
77
+ }
78
+ return tag;
79
+ }
80
+ export {
81
+ inspect
82
+ };
@@ -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,32 @@
1
+ import {inspect} from "./inspect";
2
+ const instanceOf = false ? function instanceOf2(value, constructor) {
3
+ return value instanceof constructor;
4
+ } : function instanceOf3(value, constructor) {
5
+ var _a;
6
+ if (value instanceof constructor) {
7
+ return true;
8
+ }
9
+ if (typeof value === "object" && value !== null) {
10
+ const className = constructor.prototype[Symbol.toStringTag];
11
+ const valueClassName = Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_a = value.constructor) == null ? void 0 : _a.name;
12
+ if (className === valueClassName) {
13
+ const stringifiedValue = inspect(value);
14
+ throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm.
15
+
16
+ Ensure that there is only one instance of "graphql" in the node_modules
17
+ directory. If different versions of "graphql" are the dependencies of other
18
+ relied on modules, use "resolutions" to ensure only one version is installed.
19
+
20
+ https://yarnpkg.com/en/docs/selective-version-resolutions
21
+
22
+ Duplicate "graphql" modules cannot be used at the same time since different
23
+ versions may have different capabilities and behavior. The data from one
24
+ version used in the function from another could produce confusing and
25
+ spurious results.`);
26
+ }
27
+ }
28
+ return false;
29
+ };
30
+ export {
31
+ instanceOf
32
+ };
@@ -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,9 @@
1
+ function invariant(condition, message) {
2
+ const booleanCondition = Boolean(condition);
3
+ if (!booleanCondition) {
4
+ throw new Error(message != null ? message : "Unexpected invariant triggered.");
5
+ }
6
+ }
7
+ export {
8
+ invariant
9
+ };
@@ -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,6 @@
1
+ function isAsyncIterable(maybeAsyncIterable) {
2
+ return typeof (maybeAsyncIterable == null ? void 0 : maybeAsyncIterable[Symbol.asyncIterator]) === "function";
3
+ }
4
+ export {
5
+ isAsyncIterable
6
+ };
@@ -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,6 @@
1
+ function isIterableObject(maybeIterable) {
2
+ return typeof maybeIterable === "object" && typeof (maybeIterable == null ? void 0 : maybeIterable[Symbol.iterator]) === "function";
3
+ }
4
+ export {
5
+ isIterableObject
6
+ };
@@ -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,6 @@
1
+ function isObjectLike(value) {
2
+ return typeof value == "object" && value !== null;
3
+ }
4
+ export {
5
+ isObjectLike
6
+ };
@@ -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,6 @@
1
+ function isPromise(value) {
2
+ return typeof (value == null ? void 0 : value.then) === "function";
3
+ }
4
+ export {
5
+ isPromise
6
+ };
@@ -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,10 @@
1
+ function keyMap(list, keyFn) {
2
+ const result = Object.create(null);
3
+ for (const item of list) {
4
+ result[keyFn(item)] = item;
5
+ }
6
+ return result;
7
+ }
8
+ export {
9
+ keyMap
10
+ };
@@ -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
+ }
@@ -0,0 +1,10 @@
1
+ function keyValMap(list, keyFn, valFn) {
2
+ const result = Object.create(null);
3
+ for (const item of list) {
4
+ result[keyFn(item)] = valFn(item);
5
+ }
6
+ return result;
7
+ }
8
+ export {
9
+ keyValMap
10
+ };
@@ -0,0 +1,7 @@
1
+ import type { ObjMap, ReadOnlyObjMap } from './ObjMap';
2
+ /**
3
+ * Creates an object map with the same keys as `map` and values generated by
4
+ * running each value of `map` thru `fn`.
5
+ */
6
+ export declare function mapValue<T, V>(map: ReadOnlyObjMap<T>, fn: (value: T, key: string) => V): ObjMap<V>;
7
+ //# sourceMappingURL=mapValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapValue.d.ts","sourceRoot":"","sources":["../../src/jsutils/mapValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEvD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC,EACtB,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC,GAC/B,MAAM,CAAC,CAAC,CAAC,CAOX"}
@@ -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
+ mapValue: () => mapValue
10
+ });
11
+ function mapValue(map, fn) {
12
+ const result = Object.create(null);
13
+ for (const [key, value] of Object.entries(map)) {
14
+ result[key] = fn(value, key);
15
+ }
16
+ return result;
17
+ }
@@ -0,0 +1,10 @@
1
+ function mapValue(map, fn) {
2
+ const result = Object.create(null);
3
+ for (const [key, value] of Object.entries(map)) {
4
+ result[key] = fn(value, key);
5
+ }
6
+ return result;
7
+ }
8
+ export {
9
+ mapValue
10
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Memoizes the provided three-argument function.
3
+ */
4
+ export declare function memoize3<A1 extends object, A2 extends object, A3 extends object, R>(fn: (a1: A1, a2: A2, a3: A3) => R): (a1: A1, a2: A2, a3: A3) => R;
5
+ //# sourceMappingURL=memoize3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memoize3.d.ts","sourceRoot":"","sources":["../../src/jsutils/memoize3.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,QAAQ,CACtB,EAAE,SAAS,MAAM,EACjB,EAAE,SAAS,MAAM,EACjB,EAAE,SAAS,MAAM,EACjB,CAAC,EACD,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CA4BlE"}
@@ -0,0 +1,34 @@
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
+ memoize3: () => memoize3
10
+ });
11
+ function memoize3(fn) {
12
+ let cache0;
13
+ return function memoized(a1, a2, a3) {
14
+ if (cache0 === void 0) {
15
+ cache0 = new WeakMap();
16
+ }
17
+ let cache1 = cache0.get(a1);
18
+ if (cache1 === void 0) {
19
+ cache1 = new WeakMap();
20
+ cache0.set(a1, cache1);
21
+ }
22
+ let cache2 = cache1.get(a2);
23
+ if (cache2 === void 0) {
24
+ cache2 = new WeakMap();
25
+ cache1.set(a2, cache2);
26
+ }
27
+ let fnResult = cache2.get(a3);
28
+ if (fnResult === void 0) {
29
+ fnResult = fn(a1, a2, a3);
30
+ cache2.set(a3, fnResult);
31
+ }
32
+ return fnResult;
33
+ };
34
+ }
@@ -0,0 +1,27 @@
1
+ function memoize3(fn) {
2
+ let cache0;
3
+ return function memoized(a1, a2, a3) {
4
+ if (cache0 === void 0) {
5
+ cache0 = new WeakMap();
6
+ }
7
+ let cache1 = cache0.get(a1);
8
+ if (cache1 === void 0) {
9
+ cache1 = new WeakMap();
10
+ cache0.set(a1, cache1);
11
+ }
12
+ let cache2 = cache1.get(a2);
13
+ if (cache2 === void 0) {
14
+ cache2 = new WeakMap();
15
+ cache1.set(a2, cache2);
16
+ }
17
+ let fnResult = cache2.get(a3);
18
+ if (fnResult === void 0) {
19
+ fnResult = fn(a1, a2, a3);
20
+ cache2.set(a3, fnResult);
21
+ }
22
+ return fnResult;
23
+ };
24
+ }
25
+ export {
26
+ memoize3
27
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns a number indicating whether a reference string comes before, or after,
3
+ * or is the same as the given string in natural sort order.
4
+ *
5
+ * See: https://en.wikipedia.org/wiki/Natural_sort_order
6
+ *
7
+ */
8
+ export declare function naturalCompare(aStr: string, bStr: string): number;
9
+ //# sourceMappingURL=naturalCompare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"naturalCompare.d.ts","sourceRoot":"","sources":["../../src/jsutils/naturalCompare.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CA2CjE"}