@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.
- package/CHANGELOG.md +34 -2
- 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 -35
- 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,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 @@
|
|
|
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,28 @@
|
|
|
1
|
+
// src/jsutils/memoize3.ts
|
|
2
|
+
function memoize3(fn) {
|
|
3
|
+
let cache0;
|
|
4
|
+
return function memoized(a1, a2, a3) {
|
|
5
|
+
if (cache0 === void 0) {
|
|
6
|
+
cache0 = new WeakMap();
|
|
7
|
+
}
|
|
8
|
+
let cache1 = cache0.get(a1);
|
|
9
|
+
if (cache1 === void 0) {
|
|
10
|
+
cache1 = new WeakMap();
|
|
11
|
+
cache0.set(a1, cache1);
|
|
12
|
+
}
|
|
13
|
+
let cache2 = cache1.get(a2);
|
|
14
|
+
if (cache2 === void 0) {
|
|
15
|
+
cache2 = new WeakMap();
|
|
16
|
+
cache1.set(a2, cache2);
|
|
17
|
+
}
|
|
18
|
+
let fnResult = cache2.get(a3);
|
|
19
|
+
if (fnResult === void 0) {
|
|
20
|
+
fnResult = fn(a1, a2, a3);
|
|
21
|
+
cache2.set(a3, fnResult);
|
|
22
|
+
}
|
|
23
|
+
return fnResult;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
memoize3
|
|
28
|
+
};
|
|
@@ -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"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
naturalCompare: () => naturalCompare
|
|
10
|
+
});
|
|
11
|
+
function naturalCompare(aStr, bStr) {
|
|
12
|
+
let aIndex = 0;
|
|
13
|
+
let bIndex = 0;
|
|
14
|
+
while (aIndex < aStr.length && bIndex < bStr.length) {
|
|
15
|
+
let aChar = aStr.charCodeAt(aIndex);
|
|
16
|
+
let bChar = bStr.charCodeAt(bIndex);
|
|
17
|
+
if (isDigit(aChar) && isDigit(bChar)) {
|
|
18
|
+
let aNum = 0;
|
|
19
|
+
do {
|
|
20
|
+
++aIndex;
|
|
21
|
+
aNum = aNum * 10 + aChar - DIGIT_0;
|
|
22
|
+
aChar = aStr.charCodeAt(aIndex);
|
|
23
|
+
} while (isDigit(aChar) && aNum > 0);
|
|
24
|
+
let bNum = 0;
|
|
25
|
+
do {
|
|
26
|
+
++bIndex;
|
|
27
|
+
bNum = bNum * 10 + bChar - DIGIT_0;
|
|
28
|
+
bChar = bStr.charCodeAt(bIndex);
|
|
29
|
+
} while (isDigit(bChar) && bNum > 0);
|
|
30
|
+
if (aNum < bNum) {
|
|
31
|
+
return -1;
|
|
32
|
+
}
|
|
33
|
+
if (aNum > bNum) {
|
|
34
|
+
return 1;
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
if (aChar < bChar) {
|
|
38
|
+
return -1;
|
|
39
|
+
}
|
|
40
|
+
if (aChar > bChar) {
|
|
41
|
+
return 1;
|
|
42
|
+
}
|
|
43
|
+
++aIndex;
|
|
44
|
+
++bIndex;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return aStr.length - bStr.length;
|
|
48
|
+
}
|
|
49
|
+
const DIGIT_0 = 48;
|
|
50
|
+
const DIGIT_9 = 57;
|
|
51
|
+
function isDigit(code) {
|
|
52
|
+
return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9;
|
|
53
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// src/jsutils/naturalCompare.ts
|
|
2
|
+
function naturalCompare(aStr, bStr) {
|
|
3
|
+
let aIndex = 0;
|
|
4
|
+
let bIndex = 0;
|
|
5
|
+
while (aIndex < aStr.length && bIndex < bStr.length) {
|
|
6
|
+
let aChar = aStr.charCodeAt(aIndex);
|
|
7
|
+
let bChar = bStr.charCodeAt(bIndex);
|
|
8
|
+
if (isDigit(aChar) && isDigit(bChar)) {
|
|
9
|
+
let aNum = 0;
|
|
10
|
+
do {
|
|
11
|
+
++aIndex;
|
|
12
|
+
aNum = aNum * 10 + aChar - DIGIT_0;
|
|
13
|
+
aChar = aStr.charCodeAt(aIndex);
|
|
14
|
+
} while (isDigit(aChar) && aNum > 0);
|
|
15
|
+
let bNum = 0;
|
|
16
|
+
do {
|
|
17
|
+
++bIndex;
|
|
18
|
+
bNum = bNum * 10 + bChar - DIGIT_0;
|
|
19
|
+
bChar = bStr.charCodeAt(bIndex);
|
|
20
|
+
} while (isDigit(bChar) && bNum > 0);
|
|
21
|
+
if (aNum < bNum) {
|
|
22
|
+
return -1;
|
|
23
|
+
}
|
|
24
|
+
if (aNum > bNum) {
|
|
25
|
+
return 1;
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
if (aChar < bChar) {
|
|
29
|
+
return -1;
|
|
30
|
+
}
|
|
31
|
+
if (aChar > bChar) {
|
|
32
|
+
return 1;
|
|
33
|
+
}
|
|
34
|
+
++aIndex;
|
|
35
|
+
++bIndex;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return aStr.length - bStr.length;
|
|
39
|
+
}
|
|
40
|
+
var DIGIT_0 = 48;
|
|
41
|
+
var DIGIT_9 = 57;
|
|
42
|
+
function isDigit(code) {
|
|
43
|
+
return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9;
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
naturalCompare
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printPathArray.d.ts","sourceRoot":"","sources":["../../src/jsutils/printPathArray.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAM3E"}
|
|
@@ -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
|
+
printPathArray: () => printPathArray
|
|
10
|
+
});
|
|
11
|
+
function printPathArray(path) {
|
|
12
|
+
return path.map((key) => typeof key === "number" ? "[" + key.toString() + "]" : "." + key).join("");
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ObjMap } from './ObjMap';
|
|
2
|
+
/**
|
|
3
|
+
* This function transforms a JS object `ObjMap<Promise<T>>` into
|
|
4
|
+
* a `Promise<ObjMap<T>>`
|
|
5
|
+
*
|
|
6
|
+
* This is akin to bluebird's `Promise.props`, but implemented only using
|
|
7
|
+
* `Promise.all` so it will work with any implementation of ES6 promises.
|
|
8
|
+
*/
|
|
9
|
+
export declare function promiseForObject<T>(object: ObjMap<Promise<T>>): Promise<ObjMap<T>>;
|
|
10
|
+
//# sourceMappingURL=promiseForObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promiseForObject.d.ts","sourceRoot":"","sources":["../../src/jsutils/promiseForObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAQpB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
promiseForObject: () => promiseForObject
|
|
10
|
+
});
|
|
11
|
+
function promiseForObject(object) {
|
|
12
|
+
return Promise.all(Object.values(object)).then((resolvedValues) => {
|
|
13
|
+
const resolvedObject = Object.create(null);
|
|
14
|
+
for (const [i, key] of Object.keys(object).entries()) {
|
|
15
|
+
resolvedObject[key] = resolvedValues[i];
|
|
16
|
+
}
|
|
17
|
+
return resolvedObject;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/jsutils/promiseForObject.ts
|
|
2
|
+
function promiseForObject(object) {
|
|
3
|
+
return Promise.all(Object.values(object)).then((resolvedValues) => {
|
|
4
|
+
const resolvedObject = Object.create(null);
|
|
5
|
+
for (const [i, key] of Object.keys(object).entries()) {
|
|
6
|
+
resolvedObject[key] = resolvedValues[i];
|
|
7
|
+
}
|
|
8
|
+
return resolvedObject;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
promiseForObject
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PromiseOrValue } from './PromiseOrValue';
|
|
2
|
+
/**
|
|
3
|
+
* Similar to Array.prototype.reduce(), however the reducing callback may return
|
|
4
|
+
* a Promise, in which case reduction will continue after each promise resolves.
|
|
5
|
+
*
|
|
6
|
+
* If the callback does not return a Promise, then this function will also not
|
|
7
|
+
* return a Promise.
|
|
8
|
+
*/
|
|
9
|
+
export declare function promiseReduce<T, U>(values: Iterable<T>, callbackFn: (accumulator: U, currentValue: T) => PromiseOrValue<U>, initialValue: PromiseOrValue<U>): PromiseOrValue<U>;
|
|
10
|
+
//# sourceMappingURL=promiseReduce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promiseReduce.d.ts","sourceRoot":"","sources":["../../src/jsutils/promiseReduce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIvD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAChC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EACnB,UAAU,EAAE,CAAC,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,EAClE,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC,GAC9B,cAAc,CAAC,CAAC,CAAC,CAQnB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
promiseReduce: () => promiseReduce
|
|
26
|
+
});
|
|
27
|
+
var import_isPromise = __toModule(require("./isPromise"));
|
|
28
|
+
function promiseReduce(values, callbackFn, initialValue) {
|
|
29
|
+
let accumulator = initialValue;
|
|
30
|
+
for (const value of values) {
|
|
31
|
+
accumulator = (0, import_isPromise.isPromise)(accumulator) ? accumulator.then((resolved) => callbackFn(resolved, value)) : callbackFn(accumulator, value);
|
|
32
|
+
}
|
|
33
|
+
return accumulator;
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/jsutils/promiseReduce.ts
|
|
2
|
+
import {isPromise} from "./isPromise.mjs";
|
|
3
|
+
function promiseReduce(values, callbackFn, initialValue) {
|
|
4
|
+
let accumulator = initialValue;
|
|
5
|
+
for (const value of values) {
|
|
6
|
+
accumulator = isPromise(accumulator) ? accumulator.then((resolved) => callbackFn(resolved, value)) : callbackFn(accumulator, value);
|
|
7
|
+
}
|
|
8
|
+
return accumulator;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
promiseReduce
|
|
12
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Given an invalid input string and a list of valid options, returns a filtered
|
|
3
|
+
* list of valid options sorted based on their similarity with the input.
|
|
4
|
+
*/
|
|
5
|
+
export declare function suggestionList(input: string, options: ReadonlyArray<string>): Array<string>;
|
|
6
|
+
//# sourceMappingURL=suggestionList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggestionList.d.ts","sourceRoot":"","sources":["../../src/jsutils/suggestionList.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,GAC7B,KAAK,CAAC,MAAM,CAAC,CAgBf"}
|
|
@@ -0,0 +1,109 @@
|
|
|
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
|
+
suggestionList: () => suggestionList
|
|
26
|
+
});
|
|
27
|
+
var import_naturalCompare = __toModule(require("./naturalCompare"));
|
|
28
|
+
function suggestionList(input, options) {
|
|
29
|
+
const optionsByDistance = Object.create(null);
|
|
30
|
+
const lexicalDistance = new LexicalDistance(input);
|
|
31
|
+
const threshold = Math.floor(input.length * 0.4) + 1;
|
|
32
|
+
for (const option of options) {
|
|
33
|
+
const distance = lexicalDistance.measure(option, threshold);
|
|
34
|
+
if (distance !== void 0) {
|
|
35
|
+
optionsByDistance[option] = distance;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return Object.keys(optionsByDistance).sort((a, b) => {
|
|
39
|
+
const distanceDiff = optionsByDistance[a] - optionsByDistance[b];
|
|
40
|
+
return distanceDiff !== 0 ? distanceDiff : (0, import_naturalCompare.naturalCompare)(a, b);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
class LexicalDistance {
|
|
44
|
+
constructor(input) {
|
|
45
|
+
this._input = input;
|
|
46
|
+
this._inputLowerCase = input.toLowerCase();
|
|
47
|
+
this._inputArray = stringToArray(this._inputLowerCase);
|
|
48
|
+
this._rows = [
|
|
49
|
+
new Array(input.length + 1).fill(0),
|
|
50
|
+
new Array(input.length + 1).fill(0),
|
|
51
|
+
new Array(input.length + 1).fill(0)
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
measure(option, threshold) {
|
|
55
|
+
if (this._input === option) {
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
const optionLowerCase = option.toLowerCase();
|
|
59
|
+
if (this._inputLowerCase === optionLowerCase) {
|
|
60
|
+
return 1;
|
|
61
|
+
}
|
|
62
|
+
let a = stringToArray(optionLowerCase);
|
|
63
|
+
let b = this._inputArray;
|
|
64
|
+
if (a.length < b.length) {
|
|
65
|
+
const tmp = a;
|
|
66
|
+
a = b;
|
|
67
|
+
b = tmp;
|
|
68
|
+
}
|
|
69
|
+
const aLength = a.length;
|
|
70
|
+
const bLength = b.length;
|
|
71
|
+
if (aLength - bLength > threshold) {
|
|
72
|
+
return void 0;
|
|
73
|
+
}
|
|
74
|
+
const rows = this._rows;
|
|
75
|
+
for (let j = 0; j <= bLength; j++) {
|
|
76
|
+
rows[0][j] = j;
|
|
77
|
+
}
|
|
78
|
+
for (let i = 1; i <= aLength; i++) {
|
|
79
|
+
const upRow = rows[(i - 1) % 3];
|
|
80
|
+
const currentRow = rows[i % 3];
|
|
81
|
+
let smallestCell = currentRow[0] = i;
|
|
82
|
+
for (let j = 1; j <= bLength; j++) {
|
|
83
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
84
|
+
let currentCell = Math.min(upRow[j] + 1, currentRow[j - 1] + 1, upRow[j - 1] + cost);
|
|
85
|
+
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
|
|
86
|
+
const doubleDiagonalCell = rows[(i - 2) % 3][j - 2];
|
|
87
|
+
currentCell = Math.min(currentCell, doubleDiagonalCell + 1);
|
|
88
|
+
}
|
|
89
|
+
if (currentCell < smallestCell) {
|
|
90
|
+
smallestCell = currentCell;
|
|
91
|
+
}
|
|
92
|
+
currentRow[j] = currentCell;
|
|
93
|
+
}
|
|
94
|
+
if (smallestCell > threshold) {
|
|
95
|
+
return void 0;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const distance = rows[aLength % 3][bLength];
|
|
99
|
+
return distance <= threshold ? distance : void 0;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function stringToArray(str) {
|
|
103
|
+
const strLength = str.length;
|
|
104
|
+
const array = new Array(strLength);
|
|
105
|
+
for (let i = 0; i < strLength; ++i) {
|
|
106
|
+
array[i] = str.charCodeAt(i);
|
|
107
|
+
}
|
|
108
|
+
return array;
|
|
109
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// src/jsutils/suggestionList.ts
|
|
2
|
+
import {naturalCompare} from "./naturalCompare.mjs";
|
|
3
|
+
function suggestionList(input, options) {
|
|
4
|
+
const optionsByDistance = Object.create(null);
|
|
5
|
+
const lexicalDistance = new LexicalDistance(input);
|
|
6
|
+
const threshold = Math.floor(input.length * 0.4) + 1;
|
|
7
|
+
for (const option of options) {
|
|
8
|
+
const distance = lexicalDistance.measure(option, threshold);
|
|
9
|
+
if (distance !== void 0) {
|
|
10
|
+
optionsByDistance[option] = distance;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return Object.keys(optionsByDistance).sort((a, b) => {
|
|
14
|
+
const distanceDiff = optionsByDistance[a] - optionsByDistance[b];
|
|
15
|
+
return distanceDiff !== 0 ? distanceDiff : naturalCompare(a, b);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
var LexicalDistance = class {
|
|
19
|
+
constructor(input) {
|
|
20
|
+
this._input = input;
|
|
21
|
+
this._inputLowerCase = input.toLowerCase();
|
|
22
|
+
this._inputArray = stringToArray(this._inputLowerCase);
|
|
23
|
+
this._rows = [
|
|
24
|
+
new Array(input.length + 1).fill(0),
|
|
25
|
+
new Array(input.length + 1).fill(0),
|
|
26
|
+
new Array(input.length + 1).fill(0)
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
measure(option, threshold) {
|
|
30
|
+
if (this._input === option) {
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
const optionLowerCase = option.toLowerCase();
|
|
34
|
+
if (this._inputLowerCase === optionLowerCase) {
|
|
35
|
+
return 1;
|
|
36
|
+
}
|
|
37
|
+
let a = stringToArray(optionLowerCase);
|
|
38
|
+
let b = this._inputArray;
|
|
39
|
+
if (a.length < b.length) {
|
|
40
|
+
const tmp = a;
|
|
41
|
+
a = b;
|
|
42
|
+
b = tmp;
|
|
43
|
+
}
|
|
44
|
+
const aLength = a.length;
|
|
45
|
+
const bLength = b.length;
|
|
46
|
+
if (aLength - bLength > threshold) {
|
|
47
|
+
return void 0;
|
|
48
|
+
}
|
|
49
|
+
const rows = this._rows;
|
|
50
|
+
for (let j = 0; j <= bLength; j++) {
|
|
51
|
+
rows[0][j] = j;
|
|
52
|
+
}
|
|
53
|
+
for (let i = 1; i <= aLength; i++) {
|
|
54
|
+
const upRow = rows[(i - 1) % 3];
|
|
55
|
+
const currentRow = rows[i % 3];
|
|
56
|
+
let smallestCell = currentRow[0] = i;
|
|
57
|
+
for (let j = 1; j <= bLength; j++) {
|
|
58
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
59
|
+
let currentCell = Math.min(upRow[j] + 1, currentRow[j - 1] + 1, upRow[j - 1] + cost);
|
|
60
|
+
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
|
|
61
|
+
const doubleDiagonalCell = rows[(i - 2) % 3][j - 2];
|
|
62
|
+
currentCell = Math.min(currentCell, doubleDiagonalCell + 1);
|
|
63
|
+
}
|
|
64
|
+
if (currentCell < smallestCell) {
|
|
65
|
+
smallestCell = currentCell;
|
|
66
|
+
}
|
|
67
|
+
currentRow[j] = currentCell;
|
|
68
|
+
}
|
|
69
|
+
if (smallestCell > threshold) {
|
|
70
|
+
return void 0;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const distance = rows[aLength % 3][bLength];
|
|
74
|
+
return distance <= threshold ? distance : void 0;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
function stringToArray(str) {
|
|
78
|
+
const strLength = str.length;
|
|
79
|
+
const array = new Array(strLength);
|
|
80
|
+
for (let i = 0; i < strLength; ++i) {
|
|
81
|
+
array[i] = str.charCodeAt(i);
|
|
82
|
+
}
|
|
83
|
+
return array;
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
suggestionList
|
|
87
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ObjMap, ObjMapLike, ReadOnlyObjMap, ReadOnlyObjMapLike } from './ObjMap';
|
|
2
|
+
export declare function toObjMap<T>(obj: ObjMapLike<T>): ObjMap<T>;
|
|
3
|
+
export declare function toObjMap<T>(obj: ReadOnlyObjMapLike<T>): ReadOnlyObjMap<T>;
|
|
4
|
+
//# sourceMappingURL=toObjMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toObjMap.d.ts","sourceRoot":"","sources":["../../src/jsutils/toObjMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,cAAc,EACd,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAC3D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
toObjMap: () => toObjMap
|
|
10
|
+
});
|
|
11
|
+
function toObjMap(obj) {
|
|
12
|
+
if (Object.getPrototypeOf(obj) === null) {
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
const map = Object.create(null);
|
|
16
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
17
|
+
map[key] = value;
|
|
18
|
+
}
|
|
19
|
+
return map;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/jsutils/toObjMap.ts
|
|
2
|
+
function toObjMap(obj) {
|
|
3
|
+
if (Object.getPrototypeOf(obj) === null) {
|
|
4
|
+
return obj;
|
|
5
|
+
}
|
|
6
|
+
const map = Object.create(null);
|
|
7
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
8
|
+
map[key] = value;
|
|
9
|
+
}
|
|
10
|
+
return map;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
toObjMap
|
|
14
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FragmentDefinitionNode, GraphQLSchema, OperationDefinitionNode } from "graphql";
|
|
2
|
+
export declare const annotateDocumentGraphQLTransform: (schema: GraphQLSchema) => (node: FragmentDefinitionNode | OperationDefinitionNode) => import("../ast/TypedAST").DefinitionNode;
|
|
3
|
+
//# sourceMappingURL=annotateDocumentGraphQLTransform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotateDocumentGraphQLTransform.d.ts","sourceRoot":"","sources":["../../src/transforms/annotateDocumentGraphQLTransform.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,aAAa,EAEb,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,gCAAgC,WAAY,aAAa,YACtD,sBAAsB,GAAG,uBAAuB,6CAO/D,CAAC"}
|