@graphitation/supermassive 0.2.0 → 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 +10 -2
- package/README.md +179 -5
- package/bin/supermassive.js +3 -1
- package/lib/ast/addTypesToRequestDocument.mjs +3 -1
- package/lib/benchmarks/index.mjs +16 -14
- package/lib/benchmarks/nice-benchmark.mjs +6 -3
- package/lib/benchmarks/swapi-schema/index.mjs +3 -2
- package/lib/benchmarks/swapi-schema/models.mjs +1 -0
- package/lib/benchmarks/swapi-schema/resolvers.mjs +23 -24
- package/lib/bin/supermassive.d.ts.map +1 -1
- package/lib/bin/supermassive.js +0 -0
- package/lib/bin/supermassive.mjs +3 -1
- package/lib/collectFields.mjs +1 -0
- package/lib/executeWithSchema.d.ts.map +1 -1
- package/lib/executeWithSchema.js +8 -8
- package/lib/executeWithSchema.mjs +6 -4
- package/lib/executeWithoutSchema.mjs +15 -17
- package/lib/extractImplicitTypesRuntime.mjs +1 -0
- package/lib/extractImplicitTypesToTypescript.mjs +2 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -2
- package/lib/index.mjs +7 -8
- package/lib/jsutils/Path.mjs +1 -0
- package/lib/jsutils/devAssert.mjs +1 -0
- package/lib/jsutils/didYouMean.mjs +2 -1
- package/lib/jsutils/identityFunc.mjs +1 -0
- package/lib/jsutils/inspect.mjs +3 -2
- package/lib/jsutils/instanceOf.mjs +3 -2
- package/lib/jsutils/invariant.mjs +1 -0
- package/lib/jsutils/isAsyncIterable.mjs +1 -0
- package/lib/jsutils/isIterableObject.mjs +1 -0
- package/lib/jsutils/isObjectLike.mjs +1 -0
- package/lib/jsutils/isPromise.mjs +1 -0
- package/lib/jsutils/keyMap.mjs +1 -0
- package/lib/jsutils/keyValMap.mjs +1 -0
- package/lib/jsutils/mapValue.mjs +1 -0
- package/lib/jsutils/memoize3.mjs +1 -0
- package/lib/jsutils/naturalCompare.mjs +3 -2
- package/lib/jsutils/printPathArray.mjs +1 -0
- package/lib/jsutils/promiseForObject.mjs +1 -0
- package/lib/jsutils/promiseReduce.mjs +2 -1
- package/lib/jsutils/suggestionList.mjs +4 -3
- package/lib/jsutils/toObjMap.mjs +1 -0
- package/lib/transforms/annotateDocumentGraphQLTransform.mjs +3 -2
- package/lib/transforms/transformerTestUtils.mjs +14 -8
- package/lib/utilities/typeNameFromAST.mjs +1 -0
- package/lib/values.mjs +5 -4
- package/package.json +13 -3
- package/starwars.json +1 -0
- package/.eslintcache +0 -1
- package/graphitation-supermassive-0.1.3-1.tgz +0 -0
- package/graphitation-supermassive-0.1.3-2.tgz +0 -0
- package/graphitation-supermassive-0.1.3.tgz +0 -0
- package/lib/bin/typeDefsToImplicitResolvers.d.ts +0 -3
- package/lib/bin/typeDefsToImplicitResolvers.d.ts.map +0 -1
- package/lib/bin/typeDefsToImplicitResolvers.js +0 -82
- package/lib/bin/typeDefsToImplicitResolvers.mjs +0 -59
- package/lib/execute.d.ts +0 -128
- package/lib/execute.d.ts.map +0 -1
- package/lib/execute.js +0 -376
- package/lib/execute.mjs +0 -365
- package/lib/extractImplicitTypes.d.ts +0 -6
- package/lib/extractImplicitTypes.d.ts.map +0 -1
- package/lib/extractImplicitTypes.js +0 -246
- package/lib/extractImplicitTypes.mjs +0 -233
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { executeWithoutSchema } from "./executeWithoutSchema";
|
|
2
2
|
export { executeWithSchema } from "./executeWithSchema";
|
|
3
|
-
export { Resolvers } from "./types";
|
|
3
|
+
export type { Resolvers } from "./types";
|
|
4
4
|
export { addTypesToRequestDocument } from "./ast/addTypesToRequestDocument";
|
|
5
5
|
export { extractImplicitTypes } from "./extractImplicitTypesRuntime";
|
|
6
6
|
export { specifiedScalars } from "./values";
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,gCAAgC,EAAE,MAAM,+CAA+C,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -22,7 +22,6 @@ var __toModule = (module2) => {
|
|
|
22
22
|
};
|
|
23
23
|
__markAsModule(exports);
|
|
24
24
|
__export(exports, {
|
|
25
|
-
Resolvers: () => import_types.Resolvers,
|
|
26
25
|
addTypesToRequestDocument: () => import_addTypesToRequestDocument.addTypesToRequestDocument,
|
|
27
26
|
annotateDocumentGraphQLTransform: () => import_annotateDocumentGraphQLTransform.annotateDocumentGraphQLTransform,
|
|
28
27
|
executeWithSchema: () => import_executeWithSchema.executeWithSchema,
|
|
@@ -32,7 +31,6 @@ __export(exports, {
|
|
|
32
31
|
});
|
|
33
32
|
var import_executeWithoutSchema = __toModule(require("./executeWithoutSchema"));
|
|
34
33
|
var import_executeWithSchema = __toModule(require("./executeWithSchema"));
|
|
35
|
-
var import_types = __toModule(require("./types"));
|
|
36
34
|
var import_addTypesToRequestDocument = __toModule(require("./ast/addTypesToRequestDocument"));
|
|
37
35
|
var import_extractImplicitTypesRuntime = __toModule(require("./extractImplicitTypesRuntime"));
|
|
38
36
|
var import_values = __toModule(require("./values"));
|
package/lib/index.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {addTypesToRequestDocument} from "./ast/addTypesToRequestDocument";
|
|
5
|
-
import {extractImplicitTypes} from "./extractImplicitTypesRuntime";
|
|
6
|
-
import {specifiedScalars} from "./values";
|
|
7
|
-
import {annotateDocumentGraphQLTransform} from "./transforms/annotateDocumentGraphQLTransform";
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import {executeWithoutSchema} from "./executeWithoutSchema.mjs";
|
|
3
|
+
import {executeWithSchema} from "./executeWithSchema.mjs";
|
|
4
|
+
import {addTypesToRequestDocument} from "./ast/addTypesToRequestDocument.mjs";
|
|
5
|
+
import {extractImplicitTypes} from "./extractImplicitTypesRuntime.mjs";
|
|
6
|
+
import {specifiedScalars} from "./values.mjs";
|
|
7
|
+
import {annotateDocumentGraphQLTransform} from "./transforms/annotateDocumentGraphQLTransform.mjs";
|
|
8
8
|
export {
|
|
9
|
-
Resolvers,
|
|
10
9
|
addTypesToRequestDocument,
|
|
11
10
|
annotateDocumentGraphQLTransform,
|
|
12
11
|
executeWithSchema,
|
package/lib/jsutils/Path.mjs
CHANGED
package/lib/jsutils/inspect.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// src/jsutils/instanceOf.ts
|
|
2
|
+
import {inspect} from "./inspect.mjs";
|
|
3
|
+
var instanceOf = false ? function instanceOf2(value, constructor) {
|
|
3
4
|
return value instanceof constructor;
|
|
4
5
|
} : function instanceOf3(value, constructor) {
|
|
5
6
|
var _a;
|
package/lib/jsutils/keyMap.mjs
CHANGED
package/lib/jsutils/mapValue.mjs
CHANGED
package/lib/jsutils/memoize3.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// src/jsutils/naturalCompare.ts
|
|
1
2
|
function naturalCompare(aStr, bStr) {
|
|
2
3
|
let aIndex = 0;
|
|
3
4
|
let bIndex = 0;
|
|
@@ -36,8 +37,8 @@ function naturalCompare(aStr, bStr) {
|
|
|
36
37
|
}
|
|
37
38
|
return aStr.length - bStr.length;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
var DIGIT_0 = 48;
|
|
41
|
+
var DIGIT_9 = 57;
|
|
41
42
|
function isDigit(code) {
|
|
42
43
|
return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9;
|
|
43
44
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// src/jsutils/suggestionList.ts
|
|
2
|
+
import {naturalCompare} from "./naturalCompare.mjs";
|
|
2
3
|
function suggestionList(input, options) {
|
|
3
4
|
const optionsByDistance = Object.create(null);
|
|
4
5
|
const lexicalDistance = new LexicalDistance(input);
|
|
@@ -14,7 +15,7 @@ function suggestionList(input, options) {
|
|
|
14
15
|
return distanceDiff !== 0 ? distanceDiff : naturalCompare(a, b);
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
+
var LexicalDistance = class {
|
|
18
19
|
constructor(input) {
|
|
19
20
|
this._input = input;
|
|
20
21
|
this._inputLowerCase = input.toLowerCase();
|
|
@@ -72,7 +73,7 @@ class LexicalDistance {
|
|
|
72
73
|
const distance = rows[aLength % 3][bLength];
|
|
73
74
|
return distance <= threshold ? distance : void 0;
|
|
74
75
|
}
|
|
75
|
-
}
|
|
76
|
+
};
|
|
76
77
|
function stringToArray(str) {
|
|
77
78
|
const strLength = str.length;
|
|
78
79
|
const array = new Array(strLength);
|
package/lib/jsutils/toObjMap.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
// src/transforms/annotateDocumentGraphQLTransform.ts
|
|
1
2
|
import {
|
|
2
3
|
Kind
|
|
3
4
|
} from "graphql";
|
|
4
|
-
import {addTypesToRequestDocument} from "../ast/addTypesToRequestDocument";
|
|
5
|
-
|
|
5
|
+
import {addTypesToRequestDocument} from "../ast/addTypesToRequestDocument.mjs";
|
|
6
|
+
var annotateDocumentGraphQLTransform = (schema) => {
|
|
6
7
|
return (node) => {
|
|
7
8
|
const document = addTypesToRequestDocument(schema, {
|
|
8
9
|
kind: Kind.DOCUMENT,
|
|
@@ -14,10 +14,16 @@ var __objSpread = (a, b) => {
|
|
|
14
14
|
}
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
|
+
|
|
18
|
+
// src/transforms/transformerTestUtils.ts
|
|
17
19
|
import Ts from "typescript";
|
|
18
|
-
import
|
|
20
|
+
import {
|
|
21
|
+
basename,
|
|
22
|
+
extname,
|
|
23
|
+
join
|
|
24
|
+
} from "path";
|
|
19
25
|
import {createProjectSync} from "@ts-morph/bootstrap";
|
|
20
|
-
|
|
26
|
+
var Transformer = class {
|
|
21
27
|
constructor() {
|
|
22
28
|
this.compilerOptions = {};
|
|
23
29
|
this.mocks = [];
|
|
@@ -92,8 +98,8 @@ class Transformer {
|
|
|
92
98
|
transforms: this.transformers
|
|
93
99
|
});
|
|
94
100
|
}
|
|
95
|
-
}
|
|
96
|
-
|
|
101
|
+
};
|
|
102
|
+
var transformFile = (file, options) => {
|
|
97
103
|
const project = options.project || createProjectSync({
|
|
98
104
|
useInMemoryFileSystem: true,
|
|
99
105
|
compilerOptions: getCompilerOptions(options.compilerOptions)
|
|
@@ -142,10 +148,10 @@ function getCompilerOptions(options) {
|
|
|
142
148
|
}
|
|
143
149
|
function getFileArtifactPath(file, program) {
|
|
144
150
|
const options = program.getCompilerOptions();
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const artifactExtname =
|
|
148
|
-
return
|
|
151
|
+
const extname2 = extname(file.fileName);
|
|
152
|
+
const basename2 = basename(file.fileName, extname2);
|
|
153
|
+
const artifactExtname = extname2 === ".tsx" && options.jsx === Ts.JsxEmit.Preserve ? ".jsx" : ".js";
|
|
154
|
+
return join(options.outDir || ".", `${basename2}${artifactExtname}`);
|
|
149
155
|
}
|
|
150
156
|
export {
|
|
151
157
|
Transformer,
|
package/lib/values.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// src/values.ts
|
|
1
2
|
import {
|
|
2
3
|
GraphQLBoolean,
|
|
3
4
|
GraphQLError,
|
|
@@ -14,9 +15,9 @@ import {
|
|
|
14
15
|
valueFromAST,
|
|
15
16
|
coerceInputValue
|
|
16
17
|
} from "graphql";
|
|
17
|
-
import {inspect} from "./jsutils/inspect";
|
|
18
|
-
import {keyMap} from "./jsutils/keyMap";
|
|
19
|
-
import {printPathArray} from "./jsutils/printPathArray";
|
|
18
|
+
import {inspect} from "./jsutils/inspect.mjs";
|
|
19
|
+
import {keyMap} from "./jsutils/keyMap.mjs";
|
|
20
|
+
import {printPathArray} from "./jsutils/printPathArray.mjs";
|
|
20
21
|
function getVariableValues(resolvers, varDefNodes, inputs, options) {
|
|
21
22
|
const errors = [];
|
|
22
23
|
const maxErrors = options == null ? void 0 : options.maxErrors;
|
|
@@ -111,7 +112,7 @@ function getDirectiveValues(resolvers, node, variableValues) {
|
|
|
111
112
|
function hasOwnProperty(obj, prop) {
|
|
112
113
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
113
114
|
}
|
|
114
|
-
|
|
115
|
+
var specifiedScalars = {
|
|
115
116
|
ID: GraphQLID,
|
|
116
117
|
String: GraphQLString,
|
|
117
118
|
Int: GraphQLInt,
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphitation/supermassive",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"
|
|
4
|
+
"version": "0.3.0",
|
|
5
|
+
"bin": {
|
|
6
|
+
"supermassive": "./bin/supermassive.js"
|
|
7
|
+
},
|
|
8
|
+
"main": "./lib/index.js",
|
|
6
9
|
"scripts": {
|
|
7
10
|
"build": "monorepo-scripts build",
|
|
8
11
|
"lint": "monorepo-scripts lint",
|
|
@@ -32,5 +35,12 @@
|
|
|
32
35
|
"graphql": "^15.6.1",
|
|
33
36
|
"typescript": "4.4.3"
|
|
34
37
|
},
|
|
35
|
-
"types": "./lib/index.d.ts"
|
|
38
|
+
"types": "./lib/index.d.ts",
|
|
39
|
+
"module": "./lib/index.mjs",
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"import": "./lib/index.mjs",
|
|
43
|
+
"require": "./lib/index.js"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
36
46
|
}
|
package/starwars.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/.eslintcache
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"/home/freiksenet/work/graphitation/packages/supermassive/src/__tests__/index.test.ts":"1","/home/freiksenet/work/graphitation/packages/supermassive/src/ast/TypedAST.ts":"2","/home/freiksenet/work/graphitation/packages/supermassive/src/ast/__tests__/addTypesToRequestDocument.test.ts":"3","/home/freiksenet/work/graphitation/packages/supermassive/src/ast/addTypesToRequestDocument.ts":"4","/home/freiksenet/work/graphitation/packages/supermassive/src/collectFields.ts":"5","/home/freiksenet/work/graphitation/packages/supermassive/src/compiledQuery.ts":"6","/home/freiksenet/work/graphitation/packages/supermassive/src/execute.ts":"7","/home/freiksenet/work/graphitation/packages/supermassive/src/extractImplicitTypes.ts":"8","/home/freiksenet/work/graphitation/packages/supermassive/src/index.ts":"9","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/Maybe.ts":"10","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/ObjMap.ts":"11","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/Path.ts":"12","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/PromiseOrValue.ts":"13","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/devAssert.ts":"14","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/didYouMean.ts":"15","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/identityFunc.ts":"16","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/inspect.ts":"17","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/instanceOf.ts":"18","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/invariant.ts":"19","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/isAsyncIterable.ts":"20","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/isIterableObject.ts":"21","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/isObjectLike.ts":"22","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/isPromise.ts":"23","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/keyMap.ts":"24","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/keyValMap.ts":"25","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/mapValue.ts":"26","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/memoize3.ts":"27","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/naturalCompare.ts":"28","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/printPathArray.ts":"29","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/promiseForObject.ts":"30","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/promiseReduce.ts":"31","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/suggestionList.ts":"32","/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/toObjMap.ts":"33","/home/freiksenet/work/graphitation/packages/supermassive/src/types.ts":"34","/home/freiksenet/work/graphitation/packages/supermassive/src/utilities/typeNameFromAST.ts":"35","/home/freiksenet/work/graphitation/packages/supermassive/src/values.ts":"36"},{"size":3633,"mtime":1633682073513,"results":"37","hashOfConfig":"38"},{"size":14345,"mtime":1633336297415,"results":"39","hashOfConfig":"38"},{"size":5291,"mtime":1633336274575,"results":"40","hashOfConfig":"38"},{"size":2186,"mtime":1633336297415,"results":"41","hashOfConfig":"38"},{"size":3928,"mtime":1633336297415,"results":"42","hashOfConfig":"38"},{"size":3431,"mtime":1633681213683,"results":"43","hashOfConfig":"38"},{"size":27627,"mtime":1633682313353,"results":"44","hashOfConfig":"38"},{"size":4073,"mtime":1633336297415,"results":"45","hashOfConfig":"38"},{"size":217,"mtime":1633680984513,"results":"46","hashOfConfig":"38"},{"size":134,"mtime":1633336297395,"results":"47","hashOfConfig":"38"},{"size":277,"mtime":1633336297395,"results":"48","hashOfConfig":"38"},{"size":711,"mtime":1633336297395,"results":"49","hashOfConfig":"38"},{"size":48,"mtime":1633336297395,"results":"50","hashOfConfig":"38"},{"size":269,"mtime":1633336297395,"results":"51","hashOfConfig":"38"},{"size":1038,"mtime":1633336297395,"results":"52","hashOfConfig":"38"},{"size":108,"mtime":1633336297395,"results":"53","hashOfConfig":"38"},{"size":2797,"mtime":1633336297395,"results":"54","hashOfConfig":"38"},{"size":2294,"mtime":1633336297395,"results":"55","hashOfConfig":"38"},{"size":357,"mtime":1633336297395,"results":"56","hashOfConfig":"38"},{"size":325,"mtime":1633336297395,"results":"57","hashOfConfig":"38"},{"size":778,"mtime":1633336297395,"results":"58","hashOfConfig":"38"},{"size":278,"mtime":1633336297395,"results":"59","hashOfConfig":"38"},{"size":227,"mtime":1633336297395,"results":"60","hashOfConfig":"38"},{"size":921,"mtime":1633336297395,"results":"61","hashOfConfig":"38"},{"size":764,"mtime":1633336297395,"results":"62","hashOfConfig":"38"},{"size":441,"mtime":1633336297395,"results":"63","hashOfConfig":"38"},{"size":821,"mtime":1633336297395,"results":"64","hashOfConfig":"38"},{"size":1314,"mtime":1633336297395,"results":"65","hashOfConfig":"38"},{"size":253,"mtime":1633336297395,"results":"66","hashOfConfig":"38"},{"size":650,"mtime":1633336297395,"results":"67","hashOfConfig":"38"},{"size":803,"mtime":1633336297395,"results":"68","hashOfConfig":"38"},{"size":3938,"mtime":1633336297395,"results":"69","hashOfConfig":"38"},{"size":503,"mtime":1633336297395,"results":"70","hashOfConfig":"38"},{"size":2140,"mtime":1633336297415,"results":"71","hashOfConfig":"38"},{"size":308,"mtime":1633336297415,"results":"72","hashOfConfig":"38"},{"size":9317,"mtime":1633681340393,"results":"73","hashOfConfig":"38"},{"filePath":"74","messages":"75","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1cj2clg",{"filePath":"76","messages":"77","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"78","messages":"79","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"80","messages":"81","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"82","messages":"83","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"84","messages":"85","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"86","messages":"87","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"88","messages":"89","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"90","messages":"91","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"92","messages":"93","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"94","messages":"95","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"96","messages":"97","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"98","messages":"99","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"100","messages":"101","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"102","messages":"103","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"104","messages":"105","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"106","messages":"107","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"108","messages":"109","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"110","messages":"111","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"112","messages":"113","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"114","messages":"115","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"116","messages":"117","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"118","messages":"119","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"120","messages":"121","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"122","messages":"123","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"124","messages":"125","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"126","messages":"127","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"128","messages":"129","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"130","messages":"131","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"132","messages":"133","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"134","messages":"135","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"136","messages":"137","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"138","messages":"139","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"140","messages":"141","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"142","messages":"143","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"144","messages":"145","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/freiksenet/work/graphitation/packages/supermassive/src/__tests__/index.test.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/ast/TypedAST.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/ast/__tests__/addTypesToRequestDocument.test.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/ast/addTypesToRequestDocument.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/collectFields.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/compiledQuery.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/execute.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/extractImplicitTypes.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/index.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/Maybe.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/ObjMap.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/Path.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/PromiseOrValue.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/devAssert.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/didYouMean.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/identityFunc.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/inspect.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/instanceOf.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/invariant.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/isAsyncIterable.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/isIterableObject.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/isObjectLike.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/isPromise.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/keyMap.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/keyValMap.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/mapValue.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/memoize3.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/naturalCompare.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/printPathArray.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/promiseForObject.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/promiseReduce.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/suggestionList.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/jsutils/toObjMap.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/types.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/utilities/typeNameFromAST.ts",[],"/home/freiksenet/work/graphitation/packages/supermassive/src/values.ts",[]]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typeDefsToImplicitResolvers.d.ts","sourceRoot":"","sources":["../../src/bin/typeDefsToImplicitResolvers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,2BAA2B,IAAI,OAAO,CAOrD"}
|
|
@@ -1,82 +0,0 @@
|
|
|
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
|
-
var __async = (__this, __arguments, generator) => {
|
|
24
|
-
return new Promise((resolve, reject) => {
|
|
25
|
-
var fulfilled = (value) => {
|
|
26
|
-
try {
|
|
27
|
-
step(generator.next(value));
|
|
28
|
-
} catch (e) {
|
|
29
|
-
reject(e);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
var rejected = (value) => {
|
|
33
|
-
try {
|
|
34
|
-
step(generator.throw(value));
|
|
35
|
-
} catch (e) {
|
|
36
|
-
reject(e);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
40
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
__markAsModule(exports);
|
|
44
|
-
__export(exports, {
|
|
45
|
-
typeDefsToImplicitResolvers: () => typeDefsToImplicitResolvers
|
|
46
|
-
});
|
|
47
|
-
var import_path = __toModule(require("path"));
|
|
48
|
-
var import_promises = __toModule(require("fs/promises"));
|
|
49
|
-
var import_typescript = __toModule(require("typescript"));
|
|
50
|
-
var import_commander = __toModule(require("commander"));
|
|
51
|
-
var import_extractImplicitTypes = __toModule(require("../extractImplicitTypes"));
|
|
52
|
-
var import_graphql = __toModule(require("graphql"));
|
|
53
|
-
function typeDefsToImplicitResolvers() {
|
|
54
|
-
const program = new import_commander.Command();
|
|
55
|
-
return program.argument("<files...>", "graphql typedef files to convert").action((files) => __async(this, null, function* () {
|
|
56
|
-
yield typeDefsToImplicitResolversImpl(files);
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
function typeDefsToImplicitResolversImpl(files) {
|
|
60
|
-
return __async(this, null, function* () {
|
|
61
|
-
for (const file of files) {
|
|
62
|
-
let fullPath;
|
|
63
|
-
if (import_path.default.isAbsolute(file)) {
|
|
64
|
-
fullPath = file;
|
|
65
|
-
} else {
|
|
66
|
-
fullPath = import_path.default.join(process.cwd(), file);
|
|
67
|
-
}
|
|
68
|
-
const stat = yield import_promises.default.stat(fullPath);
|
|
69
|
-
if (!stat.isFile) {
|
|
70
|
-
throw new Error(`Invalid file ${file}`);
|
|
71
|
-
}
|
|
72
|
-
const content = yield import_promises.default.readFile(fullPath, {encoding: "utf-8"});
|
|
73
|
-
const document = (0, import_graphql.parse)(content);
|
|
74
|
-
const tsContents = (0, import_extractImplicitTypes.extractImplicitTypesToTypescript)(document);
|
|
75
|
-
const tsDir = import_path.default.join(import_path.default.dirname(fullPath), "__generated__");
|
|
76
|
-
yield import_promises.default.mkdir(tsDir, {recursive: true});
|
|
77
|
-
const tsFileName = import_path.default.join(tsDir, import_path.default.basename(fullPath, import_path.default.extname(fullPath)) + ".ts");
|
|
78
|
-
const printer = import_typescript.default.createPrinter();
|
|
79
|
-
yield import_promises.default.writeFile(tsFileName, printer.printNode(import_typescript.default.EmitHint.SourceFile, tsContents, tsContents), {encoding: "utf-8"});
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
import path from "path";
|
|
22
|
-
import fs from "fs/promises";
|
|
23
|
-
import ts from "typescript";
|
|
24
|
-
import {Command} from "commander";
|
|
25
|
-
import {extractImplicitTypesToTypescript} from "../extractImplicitTypes";
|
|
26
|
-
import {parse} from "graphql";
|
|
27
|
-
function typeDefsToImplicitResolvers() {
|
|
28
|
-
const program = new Command();
|
|
29
|
-
return program.argument("<files...>", "graphql typedef files to convert").action((files) => __async(this, null, function* () {
|
|
30
|
-
yield typeDefsToImplicitResolversImpl(files);
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
function typeDefsToImplicitResolversImpl(files) {
|
|
34
|
-
return __async(this, null, function* () {
|
|
35
|
-
for (const file of files) {
|
|
36
|
-
let fullPath;
|
|
37
|
-
if (path.isAbsolute(file)) {
|
|
38
|
-
fullPath = file;
|
|
39
|
-
} else {
|
|
40
|
-
fullPath = path.join(process.cwd(), file);
|
|
41
|
-
}
|
|
42
|
-
const stat = yield fs.stat(fullPath);
|
|
43
|
-
if (!stat.isFile) {
|
|
44
|
-
throw new Error(`Invalid file ${file}`);
|
|
45
|
-
}
|
|
46
|
-
const content = yield fs.readFile(fullPath, {encoding: "utf-8"});
|
|
47
|
-
const document = parse(content);
|
|
48
|
-
const tsContents = extractImplicitTypesToTypescript(document);
|
|
49
|
-
const tsDir = path.join(path.dirname(fullPath), "__generated__");
|
|
50
|
-
yield fs.mkdir(tsDir, {recursive: true});
|
|
51
|
-
const tsFileName = path.join(tsDir, path.basename(fullPath, path.extname(fullPath)) + ".ts");
|
|
52
|
-
const printer = ts.createPrinter();
|
|
53
|
-
yield fs.writeFile(tsFileName, printer.printNode(ts.EmitHint.SourceFile, tsContents, tsContents), {encoding: "utf-8"});
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
typeDefsToImplicitResolvers
|
|
59
|
-
};
|