@graphitation/supermassive 0.1.3 → 0.4.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.
- package/CHANGELOG.md +34 -2
- package/NOTICE +27 -0
- package/README.md +264 -2
- package/bin/supermassive.js +7 -0
- package/lib/{src/ast → ast}/TypedAST.d.ts +2 -0
- package/lib/ast/TypedAST.d.ts.map +1 -0
- package/lib/{src/ast → ast}/addTypesToRequestDocument.d.ts +0 -0
- package/lib/ast/addTypesToRequestDocument.d.ts.map +1 -0
- package/lib/ast/addTypesToRequestDocument.js +8 -5
- package/lib/ast/addTypesToRequestDocument.mjs +12 -6
- package/lib/benchmarks/index.d.ts.map +1 -1
- package/lib/benchmarks/index.js +127 -0
- package/lib/benchmarks/index.mjs +111 -0
- package/lib/benchmarks/nice-benchmark.d.ts +1 -1
- package/lib/benchmarks/nice-benchmark.d.ts.map +1 -1
- package/lib/benchmarks/nice-benchmark.js +72 -0
- package/lib/benchmarks/nice-benchmark.mjs +52 -0
- package/lib/benchmarks/swapi-schema/index.d.ts +1 -0
- package/lib/benchmarks/swapi-schema/index.d.ts.map +1 -1
- package/lib/benchmarks/swapi-schema/index.js +39 -0
- package/lib/benchmarks/swapi-schema/index.mjs +17 -0
- package/lib/benchmarks/swapi-schema/models.d.ts.map +1 -1
- package/lib/benchmarks/swapi-schema/models.js +29 -0
- package/lib/benchmarks/swapi-schema/models.mjs +7 -0
- package/lib/benchmarks/swapi-schema/resolvers.d.ts.map +1 -1
- package/lib/benchmarks/swapi-schema/resolvers.js +237 -0
- package/lib/benchmarks/swapi-schema/resolvers.mjs +230 -0
- package/lib/bin/supermassive.d.ts +3 -0
- package/lib/bin/supermassive.d.ts.map +1 -0
- package/lib/bin/supermassive.js +83 -0
- package/lib/bin/supermassive.mjs +62 -0
- package/lib/collectFields.d.ts +17 -0
- package/lib/collectFields.d.ts.map +1 -0
- package/lib/collectFields.js +83 -0
- package/lib/collectFields.mjs +61 -0
- package/lib/compiledQuery.d.ts +1 -0
- package/lib/compiledQuery.d.ts.map +1 -0
- package/lib/compiledQuery.js +0 -0
- package/lib/compiledQuery.mjs +0 -0
- package/lib/executeWithSchema.d.ts +4 -0
- package/lib/executeWithSchema.d.ts.map +1 -0
- package/lib/{index.test.js → executeWithSchema.js} +45 -46
- package/lib/executeWithSchema.mjs +64 -0
- package/lib/executeWithoutSchema.d.ts +99 -0
- package/lib/executeWithoutSchema.d.ts.map +1 -0
- package/lib/executeWithoutSchema.js +376 -0
- package/lib/executeWithoutSchema.mjs +363 -0
- package/lib/extractImplicitTypesRuntime.d.ts +4 -0
- package/lib/extractImplicitTypesRuntime.d.ts.map +1 -0
- package/lib/extractImplicitTypesRuntime.js +103 -0
- package/lib/extractImplicitTypesRuntime.mjs +91 -0
- package/lib/extractImplicitTypesToTypescript.d.ts +4 -0
- package/lib/extractImplicitTypesToTypescript.d.ts.map +1 -0
- package/lib/extractImplicitTypesToTypescript.js +169 -0
- package/lib/extractImplicitTypesToTypescript.mjs +149 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +12 -29
- package/lib/index.mjs +13 -29
- package/lib/jsutils/Maybe.d.ts +3 -0
- package/lib/jsutils/Maybe.d.ts.map +1 -0
- package/lib/jsutils/Maybe.js +3 -0
- package/lib/jsutils/Maybe.mjs +0 -0
- package/lib/jsutils/ObjMap.d.ts +13 -0
- package/lib/jsutils/ObjMap.d.ts.map +1 -0
- package/lib/jsutils/ObjMap.js +3 -0
- package/lib/jsutils/ObjMap.mjs +0 -0
- package/lib/jsutils/Path.d.ts +15 -0
- package/lib/jsutils/Path.d.ts.map +1 -0
- package/lib/jsutils/Path.js +23 -0
- package/lib/jsutils/Path.mjs +17 -0
- package/lib/jsutils/PromiseOrValue.d.ts +2 -0
- package/lib/jsutils/PromiseOrValue.d.ts.map +1 -0
- package/lib/jsutils/PromiseOrValue.js +3 -0
- package/lib/jsutils/PromiseOrValue.mjs +0 -0
- package/lib/jsutils/devAssert.d.ts +2 -0
- package/lib/jsutils/devAssert.d.ts.map +1 -0
- package/lib/jsutils/devAssert.js +16 -0
- package/lib/jsutils/devAssert.mjs +10 -0
- package/lib/jsutils/didYouMean.d.ts +6 -0
- package/lib/jsutils/didYouMean.d.ts.map +1 -0
- package/lib/jsutils/didYouMean.js +30 -0
- package/lib/jsutils/didYouMean.mjs +24 -0
- package/lib/jsutils/identityFunc.d.ts +5 -0
- package/lib/jsutils/identityFunc.d.ts.map +1 -0
- package/lib/jsutils/identityFunc.js +13 -0
- package/lib/jsutils/identityFunc.mjs +7 -0
- package/lib/jsutils/inspect.d.ts +5 -0
- package/lib/jsutils/inspect.d.ts.map +1 -0
- package/lib/jsutils/inspect.js +89 -0
- package/lib/jsutils/inspect.mjs +83 -0
- package/lib/jsutils/instanceOf.d.ts +14 -0
- package/lib/jsutils/instanceOf.d.ts.map +1 -0
- package/lib/jsutils/instanceOf.js +55 -0
- package/lib/jsutils/instanceOf.mjs +33 -0
- package/lib/jsutils/invariant.d.ts +2 -0
- package/lib/jsutils/invariant.d.ts.map +1 -0
- package/lib/jsutils/invariant.js +16 -0
- package/lib/jsutils/invariant.mjs +10 -0
- package/lib/jsutils/isAsyncIterable.d.ts +6 -0
- package/lib/jsutils/isAsyncIterable.d.ts.map +1 -0
- package/lib/jsutils/isAsyncIterable.js +13 -0
- package/lib/jsutils/isAsyncIterable.mjs +7 -0
- package/lib/jsutils/isIterableObject.d.ts +18 -0
- package/lib/jsutils/isIterableObject.d.ts.map +1 -0
- package/lib/jsutils/isIterableObject.js +13 -0
- package/lib/jsutils/isIterableObject.mjs +7 -0
- package/lib/jsutils/isObjectLike.d.ts +8 -0
- package/lib/jsutils/isObjectLike.d.ts.map +1 -0
- package/lib/jsutils/isObjectLike.js +13 -0
- package/lib/jsutils/isObjectLike.mjs +7 -0
- package/lib/jsutils/isPromise.d.ts +6 -0
- package/lib/jsutils/isPromise.d.ts.map +1 -0
- package/lib/jsutils/isPromise.js +13 -0
- package/lib/jsutils/isPromise.mjs +7 -0
- package/lib/jsutils/keyMap.d.ts +26 -0
- package/lib/jsutils/keyMap.d.ts.map +1 -0
- package/lib/jsutils/keyMap.js +17 -0
- package/lib/jsutils/keyMap.mjs +11 -0
- package/lib/jsutils/keyValMap.d.ts +20 -0
- package/lib/jsutils/keyValMap.d.ts.map +1 -0
- package/lib/jsutils/keyValMap.js +17 -0
- package/lib/jsutils/keyValMap.mjs +11 -0
- package/lib/jsutils/mapValue.d.ts +7 -0
- package/lib/jsutils/mapValue.d.ts.map +1 -0
- package/lib/jsutils/mapValue.js +17 -0
- package/lib/jsutils/mapValue.mjs +11 -0
- package/lib/jsutils/memoize3.d.ts +5 -0
- package/lib/jsutils/memoize3.d.ts.map +1 -0
- package/lib/jsutils/memoize3.js +34 -0
- package/lib/jsutils/memoize3.mjs +28 -0
- package/lib/jsutils/naturalCompare.d.ts +9 -0
- package/lib/jsutils/naturalCompare.d.ts.map +1 -0
- package/lib/jsutils/naturalCompare.js +53 -0
- package/lib/jsutils/naturalCompare.mjs +47 -0
- package/lib/jsutils/printPathArray.d.ts +5 -0
- package/lib/jsutils/printPathArray.d.ts.map +1 -0
- package/lib/jsutils/printPathArray.js +13 -0
- package/lib/jsutils/printPathArray.mjs +7 -0
- package/lib/jsutils/promiseForObject.d.ts +10 -0
- package/lib/jsutils/promiseForObject.d.ts.map +1 -0
- package/lib/jsutils/promiseForObject.js +19 -0
- package/lib/jsutils/promiseForObject.mjs +13 -0
- package/lib/jsutils/promiseReduce.d.ts +10 -0
- package/lib/jsutils/promiseReduce.d.ts.map +1 -0
- package/lib/jsutils/promiseReduce.js +34 -0
- package/lib/jsutils/promiseReduce.mjs +12 -0
- package/lib/jsutils/suggestionList.d.ts +6 -0
- package/lib/jsutils/suggestionList.d.ts.map +1 -0
- package/lib/jsutils/suggestionList.js +109 -0
- package/lib/jsutils/suggestionList.mjs +87 -0
- package/lib/jsutils/toObjMap.d.ts +4 -0
- package/lib/jsutils/toObjMap.d.ts.map +1 -0
- package/lib/jsutils/toObjMap.js +20 -0
- package/lib/jsutils/toObjMap.mjs +14 -0
- package/lib/transforms/annotateDocumentGraphQLTransform.d.ts +3 -0
- package/lib/transforms/annotateDocumentGraphQLTransform.d.ts.map +1 -0
- package/lib/transforms/annotateDocumentGraphQLTransform.js +37 -0
- package/lib/transforms/annotateDocumentGraphQLTransform.mjs +17 -0
- package/lib/transforms/transformerTestUtils.d.ts +79 -0
- package/lib/transforms/transformerTestUtils.d.ts.map +1 -0
- package/lib/transforms/transformerTestUtils.js +175 -0
- package/lib/transforms/transformerTestUtils.mjs +160 -0
- package/lib/types.d.ts +74 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +3 -0
- package/lib/types.mjs +0 -0
- package/lib/utilities/typeNameFromAST.d.ts +3 -0
- package/lib/utilities/typeNameFromAST.d.ts.map +1 -0
- package/lib/utilities/typeNameFromAST.js +34 -0
- package/lib/utilities/typeNameFromAST.mjs +12 -0
- package/lib/values.d.ts +64 -0
- package/lib/values.d.ts.map +1 -0
- package/lib/values.js +145 -0
- package/lib/values.mjs +138 -0
- package/package.json +21 -6
- package/.eslintcache +0 -1
- package/CHANGELOG.json +0 -65
- package/benchmarks/fixtures/query1.graphql +0 -20
- package/benchmarks/index.ts +0 -68
- package/benchmarks/nice-benchmark.ts +0 -32
- package/benchmarks/swapi-schema/index.ts +0 -13
- package/benchmarks/swapi-schema/models.ts +0 -4
- package/benchmarks/swapi-schema/resolvers.ts +0 -331
- package/benchmarks/swapi-schema/schema.graphql +0 -164
- package/benchmarks/swapi-schema/starwars.json +0 -5991
- package/lib/index.test.mjs +0 -63
- package/lib/src/ast/TypedAST.d.ts.map +0 -1
- package/lib/src/ast/addTypesToRequestDocument.d.ts.map +0 -1
- package/lib/src/index.d.ts +0 -16
- package/lib/src/index.d.ts.map +0 -1
- package/lib/src/index.test.d.ts +0 -2
- 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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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,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,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 @@
|
|
|
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,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,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
|
+
}
|