@graphitation/supermassive 0.8.3 → 1.0.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 +26 -2
- package/README.md +24 -29
- package/lib/ast/TypedAST.js +14 -2
- package/lib/ast/addTypesToRequestDocument.js +23 -23
- package/lib/ast/addTypesToRequestDocument.mjs +8 -5
- package/lib/benchmarks/index.js +33 -36
- package/lib/benchmarks/index.mjs +101 -92
- package/lib/benchmarks/nice-benchmark.js +14 -18
- package/lib/benchmarks/nice-benchmark.mjs +2 -3
- package/lib/benchmarks/swapi-schema/index.js +19 -20
- package/lib/benchmarks/swapi-schema/index.mjs +4 -4
- package/lib/benchmarks/swapi-schema/models.js +16 -17
- package/lib/benchmarks/swapi-schema/models.mjs +1 -1
- package/lib/benchmarks/swapi-schema/resolvers.js +65 -66
- package/lib/benchmarks/swapi-schema/resolvers.mjs +51 -48
- package/lib/bin/supermassive.js +23 -24
- package/lib/bin/supermassive.mjs +6 -6
- package/lib/collectFields.js +23 -27
- package/lib/collectFields.mjs +10 -10
- package/lib/definition.js +15 -19
- package/lib/definition.mjs +2 -2
- package/lib/directives.js +21 -25
- package/lib/directives.mjs +7 -7
- package/lib/executeWithSchema.js +15 -19
- package/lib/executeWithSchema.mjs +1 -1
- package/lib/executeWithoutSchema.js +37 -41
- package/lib/executeWithoutSchema.mjs +22 -22
- package/lib/extractImplicitTypesRuntime.js +17 -21
- package/lib/extractImplicitTypesRuntime.mjs +3 -3
- package/lib/extractImplicitTypesToTypescript.js +16 -17
- package/lib/extractImplicitTypesToTypescript.mjs +1 -1
- package/lib/extractors/index.d.ts +2 -0
- package/lib/extractors/index.d.ts.map +1 -0
- package/lib/extractors/index.js +23 -0
- package/lib/extractors/index.mjs +5 -0
- package/lib/index.js +21 -25
- package/lib/index.mjs +8 -8
- package/lib/jsutils/Maybe.js +14 -2
- package/lib/jsutils/ObjMap.js +14 -2
- package/lib/jsutils/Path.js +17 -5
- package/lib/jsutils/Path.mjs +1 -1
- package/lib/jsutils/PromiseOrValue.js +14 -2
- package/lib/jsutils/devAssert.js +16 -4
- package/lib/jsutils/didYouMean.js +16 -4
- package/lib/jsutils/identityFunc.js +16 -4
- package/lib/jsutils/inspect.js +16 -4
- package/lib/jsutils/instanceOf.js +14 -18
- package/lib/jsutils/instanceOf.mjs +1 -1
- package/lib/jsutils/invariant.js +16 -4
- package/lib/jsutils/isAsyncIterable.js +16 -4
- package/lib/jsutils/isIterableObject.js +16 -4
- package/lib/jsutils/isObjectLike.js +16 -4
- package/lib/jsutils/isPromise.js +16 -4
- package/lib/jsutils/keyMap.js +17 -5
- package/lib/jsutils/keyMap.mjs +1 -1
- package/lib/jsutils/keyValMap.js +17 -5
- package/lib/jsutils/keyValMap.mjs +1 -1
- package/lib/jsutils/mapValue.js +17 -5
- package/lib/jsutils/mapValue.mjs +1 -1
- package/lib/jsutils/memoize3.js +19 -7
- package/lib/jsutils/memoize3.mjs +3 -3
- package/lib/jsutils/naturalCompare.js +16 -4
- package/lib/jsutils/printPathArray.js +16 -4
- package/lib/jsutils/promiseForObject.js +17 -5
- package/lib/jsutils/promiseForObject.mjs +1 -1
- package/lib/jsutils/promiseReduce.js +14 -18
- package/lib/jsutils/promiseReduce.mjs +1 -1
- package/lib/jsutils/suggestionList.js +15 -19
- package/lib/jsutils/suggestionList.mjs +2 -2
- package/lib/jsutils/toObjMap.js +17 -5
- package/lib/jsutils/toObjMap.mjs +1 -1
- package/lib/subscribeWithSchema.js +15 -19
- package/lib/subscribeWithSchema.mjs +1 -1
- package/lib/subscribeWithoutSchema.js +26 -30
- package/lib/subscribeWithoutSchema.mjs +11 -11
- package/lib/transforms/annotateDocumentGraphQLTransform.js +15 -19
- package/lib/transforms/annotateDocumentGraphQLTransform.mjs +1 -1
- package/lib/transforms/transformerTestUtils.js +24 -25
- package/lib/transforms/transformerTestUtils.mjs +12 -16
- package/lib/types.js +14 -2
- package/lib/utilities/mapAsyncIterator.js +18 -6
- package/lib/utilities/mapAsyncIterator.mjs +2 -2
- package/lib/utilities/mergeResolvers.js +20 -9
- package/lib/utilities/mergeResolvers.mjs +5 -5
- package/lib/utilities/typeNameFromAST.js +14 -18
- package/lib/utilities/typeNameFromAST.mjs +1 -1
- package/lib/values.js +19 -23
- package/lib/values.mjs +5 -5
- package/package.json +13 -8
- package/.eslintcache +0 -1
- package/lib/benchmarks/swapi-schema/__generated__/schema.d.ts +0 -3
- package/lib/benchmarks/swapi-schema/__generated__/schema.d.ts.map +0 -1
- package/lib/benchmarks/swapi-schema/__generated__/schema.js +0 -41
- package/lib/benchmarks/swapi-schema/__generated__/schema.mjs +0 -19
package/lib/jsutils/toObjMap.js
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3
5
|
var __export = (target, all) => {
|
|
4
6
|
for (var name in all)
|
|
5
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
8
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var toObjMap_exports = {};
|
|
19
|
+
__export(toObjMap_exports, {
|
|
9
20
|
toObjMap: () => toObjMap
|
|
10
21
|
});
|
|
22
|
+
module.exports = __toCommonJS(toObjMap_exports);
|
|
11
23
|
function toObjMap(obj) {
|
|
12
24
|
if (Object.getPrototypeOf(obj) === null) {
|
|
13
25
|
return obj;
|
|
14
26
|
}
|
|
15
|
-
const map = Object.create(null);
|
|
27
|
+
const map = /* @__PURE__ */ Object.create(null);
|
|
16
28
|
for (const [key, value] of Object.entries(obj)) {
|
|
17
29
|
map[key] = value;
|
|
18
30
|
}
|
package/lib/jsutils/toObjMap.mjs
CHANGED
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
5
|
var __export = (target, all) => {
|
|
9
6
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
8
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
14
|
}
|
|
18
|
-
return
|
|
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);
|
|
15
|
+
return to;
|
|
22
16
|
};
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var subscribeWithSchema_exports = {};
|
|
19
|
+
__export(subscribeWithSchema_exports, {
|
|
25
20
|
subscribeWithSchema: () => subscribeWithSchema
|
|
26
21
|
});
|
|
27
|
-
|
|
28
|
-
var
|
|
22
|
+
module.exports = __toCommonJS(subscribeWithSchema_exports);
|
|
23
|
+
var import_graphql = require("graphql");
|
|
24
|
+
var import_index = require("./index");
|
|
29
25
|
function subscribeWithSchema({
|
|
30
26
|
typeDefs,
|
|
31
27
|
resolvers,
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
5
|
var __export = (target, all) => {
|
|
9
6
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
8
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
14
|
}
|
|
18
|
-
return
|
|
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);
|
|
15
|
+
return to;
|
|
22
16
|
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
18
|
var __async = (__this, __arguments, generator) => {
|
|
24
19
|
return new Promise((resolve, reject) => {
|
|
25
20
|
var fulfilled = (value) => {
|
|
@@ -40,21 +35,22 @@ var __async = (__this, __arguments, generator) => {
|
|
|
40
35
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
41
36
|
});
|
|
42
37
|
};
|
|
43
|
-
|
|
44
|
-
__export(
|
|
38
|
+
var subscribeWithoutSchema_exports = {};
|
|
39
|
+
__export(subscribeWithoutSchema_exports, {
|
|
45
40
|
createSourceEventStream: () => createSourceEventStream,
|
|
46
41
|
subscribeWithoutSchema: () => subscribeWithoutSchema
|
|
47
42
|
});
|
|
48
|
-
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
var
|
|
43
|
+
module.exports = __toCommonJS(subscribeWithoutSchema_exports);
|
|
44
|
+
var import_inspect = require("./jsutils/inspect");
|
|
45
|
+
var import_isAsyncIterable = require("./jsutils/isAsyncIterable");
|
|
46
|
+
var import_Path = require("./jsutils/Path");
|
|
47
|
+
var import_graphql = require("graphql");
|
|
48
|
+
var import_executeWithoutSchema = require("./executeWithoutSchema");
|
|
49
|
+
var import_collectFields = require("./collectFields");
|
|
50
|
+
var import_values = require("./values");
|
|
51
|
+
var import_typeNameFromAST = require("./utilities/typeNameFromAST");
|
|
52
|
+
var import_mergeResolvers = require("./utilities/mergeResolvers");
|
|
53
|
+
var import_mapAsyncIterator = require("./utilities/mapAsyncIterator");
|
|
58
54
|
function subscribeWithoutSchema(args) {
|
|
59
55
|
return __async(this, null, function* () {
|
|
60
56
|
const {
|
|
@@ -92,7 +88,7 @@ function createSourceEventStream(resolvers, document, rootValue, contextValue, v
|
|
|
92
88
|
try {
|
|
93
89
|
const exeContext = (0, import_executeWithoutSchema.buildExecutionContext)(resolvers, document, rootValue, contextValue, variableValues, operationName, fieldResolver);
|
|
94
90
|
if (!("resolvers" in exeContext)) {
|
|
95
|
-
return {errors: exeContext};
|
|
91
|
+
return { errors: exeContext };
|
|
96
92
|
}
|
|
97
93
|
const eventStream = yield executeSubscription(exeContext);
|
|
98
94
|
if (!(0, import_isAsyncIterable.isAsyncIterable)(eventStream)) {
|
|
@@ -101,7 +97,7 @@ function createSourceEventStream(resolvers, document, rootValue, contextValue, v
|
|
|
101
97
|
return eventStream;
|
|
102
98
|
} catch (error) {
|
|
103
99
|
if (error instanceof import_graphql.GraphQLError) {
|
|
104
|
-
return {errors: [error]};
|
|
100
|
+
return { errors: [error] };
|
|
105
101
|
}
|
|
106
102
|
throw error;
|
|
107
103
|
}
|
|
@@ -117,7 +113,7 @@ function executeSubscription(exeContext) {
|
|
|
117
113
|
rootValue
|
|
118
114
|
} = exeContext;
|
|
119
115
|
const typeName = (0, import_executeWithoutSchema.getOperationRootTypeName)(operation);
|
|
120
|
-
const fields = (0, import_collectFields.collectFields)(resolvers, fragments, variableValues, typeName, operation.selectionSet, new Map(), new Set());
|
|
116
|
+
const fields = (0, import_collectFields.collectFields)(resolvers, fragments, variableValues, typeName, operation.selectionSet, /* @__PURE__ */ new Map(), /* @__PURE__ */ new Set());
|
|
121
117
|
const [responseName, fieldNodes] = [...fields.entries()][0];
|
|
122
118
|
const fieldName = fieldNodes[0].name.value;
|
|
123
119
|
let resolveFn;
|
|
@@ -20,9 +20,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
// src/subscribeWithoutSchema.ts
|
|
23
|
-
import {inspect} from "./jsutils/inspect.mjs";
|
|
24
|
-
import {isAsyncIterable} from "./jsutils/isAsyncIterable.mjs";
|
|
25
|
-
import {addPath, pathToArray} from "./jsutils/Path.mjs";
|
|
23
|
+
import { inspect } from "./jsutils/inspect.mjs";
|
|
24
|
+
import { isAsyncIterable } from "./jsutils/isAsyncIterable.mjs";
|
|
25
|
+
import { addPath, pathToArray } from "./jsutils/Path.mjs";
|
|
26
26
|
import {
|
|
27
27
|
GraphQLError,
|
|
28
28
|
locatedError,
|
|
@@ -35,11 +35,11 @@ import {
|
|
|
35
35
|
executeWithoutSchema,
|
|
36
36
|
getOperationRootTypeName
|
|
37
37
|
} from "./executeWithoutSchema.mjs";
|
|
38
|
-
import {collectFields} from "./collectFields.mjs";
|
|
39
|
-
import {getArgumentValues} from "./values.mjs";
|
|
40
|
-
import {typeNameFromAST} from "./utilities/typeNameFromAST.mjs";
|
|
41
|
-
import {mergeResolvers} from "./utilities/mergeResolvers.mjs";
|
|
42
|
-
import {mapAsyncIterator} from "./utilities/mapAsyncIterator.mjs";
|
|
38
|
+
import { collectFields } from "./collectFields.mjs";
|
|
39
|
+
import { getArgumentValues } from "./values.mjs";
|
|
40
|
+
import { typeNameFromAST } from "./utilities/typeNameFromAST.mjs";
|
|
41
|
+
import { mergeResolvers } from "./utilities/mergeResolvers.mjs";
|
|
42
|
+
import { mapAsyncIterator } from "./utilities/mapAsyncIterator.mjs";
|
|
43
43
|
function subscribeWithoutSchema(args) {
|
|
44
44
|
return __async(this, null, function* () {
|
|
45
45
|
const {
|
|
@@ -77,7 +77,7 @@ function createSourceEventStream(resolvers, document, rootValue, contextValue, v
|
|
|
77
77
|
try {
|
|
78
78
|
const exeContext = buildExecutionContext(resolvers, document, rootValue, contextValue, variableValues, operationName, fieldResolver);
|
|
79
79
|
if (!("resolvers" in exeContext)) {
|
|
80
|
-
return {errors: exeContext};
|
|
80
|
+
return { errors: exeContext };
|
|
81
81
|
}
|
|
82
82
|
const eventStream = yield executeSubscription(exeContext);
|
|
83
83
|
if (!isAsyncIterable(eventStream)) {
|
|
@@ -86,7 +86,7 @@ function createSourceEventStream(resolvers, document, rootValue, contextValue, v
|
|
|
86
86
|
return eventStream;
|
|
87
87
|
} catch (error) {
|
|
88
88
|
if (error instanceof GraphQLError) {
|
|
89
|
-
return {errors: [error]};
|
|
89
|
+
return { errors: [error] };
|
|
90
90
|
}
|
|
91
91
|
throw error;
|
|
92
92
|
}
|
|
@@ -102,7 +102,7 @@ function executeSubscription(exeContext) {
|
|
|
102
102
|
rootValue
|
|
103
103
|
} = exeContext;
|
|
104
104
|
const typeName = getOperationRootTypeName(operation);
|
|
105
|
-
const fields = collectFields(resolvers, fragments, variableValues, typeName, operation.selectionSet, new Map(), new Set());
|
|
105
|
+
const fields = collectFields(resolvers, fragments, variableValues, typeName, operation.selectionSet, /* @__PURE__ */ new Map(), /* @__PURE__ */ new Set());
|
|
106
106
|
const [responseName, fieldNodes] = [...fields.entries()][0];
|
|
107
107
|
const fieldName = fieldNodes[0].name.value;
|
|
108
108
|
let resolveFn;
|
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
5
|
var __export = (target, all) => {
|
|
9
6
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
8
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
14
|
}
|
|
18
|
-
return
|
|
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);
|
|
15
|
+
return to;
|
|
22
16
|
};
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var annotateDocumentGraphQLTransform_exports = {};
|
|
19
|
+
__export(annotateDocumentGraphQLTransform_exports, {
|
|
25
20
|
annotateDocumentGraphQLTransform: () => annotateDocumentGraphQLTransform
|
|
26
21
|
});
|
|
27
|
-
|
|
28
|
-
var
|
|
22
|
+
module.exports = __toCommonJS(annotateDocumentGraphQLTransform_exports);
|
|
23
|
+
var import_graphql = require("graphql");
|
|
24
|
+
var import_addTypesToRequestDocument = require("../ast/addTypesToRequestDocument");
|
|
29
25
|
const annotateDocumentGraphQLTransform = (schema) => {
|
|
30
26
|
return (node) => {
|
|
31
27
|
const document = (0, import_addTypesToRequestDocument.addTypesToRequestDocument)(schema, {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
Kind
|
|
4
4
|
} from "graphql";
|
|
5
|
-
import {addTypesToRequestDocument} from "../ast/addTypesToRequestDocument.mjs";
|
|
5
|
+
import { addTypesToRequestDocument } from "../ast/addTypesToRequestDocument.mjs";
|
|
6
6
|
var annotateDocumentGraphQLTransform = (schema) => {
|
|
7
7
|
return (node) => {
|
|
8
8
|
const document = addTypesToRequestDocument(schema, {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
5
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
10
|
-
var
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
11
|
for (var prop in b || (b = {}))
|
|
12
12
|
if (__hasOwnProp.call(b, prop))
|
|
13
13
|
__defNormalProp(a, prop, b[prop]);
|
|
@@ -18,31 +18,30 @@ var __objSpread = (a, b) => {
|
|
|
18
18
|
}
|
|
19
19
|
return a;
|
|
20
20
|
};
|
|
21
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
22
21
|
var __export = (target, all) => {
|
|
23
22
|
for (var name in all)
|
|
24
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
23
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
24
|
};
|
|
26
|
-
var
|
|
27
|
-
if (
|
|
28
|
-
for (let key of __getOwnPropNames(
|
|
29
|
-
if (!__hasOwnProp.call(
|
|
30
|
-
__defProp(
|
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
|
+
for (let key of __getOwnPropNames(from))
|
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
29
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
30
|
}
|
|
32
|
-
return
|
|
33
|
-
};
|
|
34
|
-
var __toModule = (module2) => {
|
|
35
|
-
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);
|
|
31
|
+
return to;
|
|
36
32
|
};
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
var transformerTestUtils_exports = {};
|
|
36
|
+
__export(transformerTestUtils_exports, {
|
|
39
37
|
Transformer: () => Transformer,
|
|
40
38
|
getCompilerOptions: () => getCompilerOptions,
|
|
41
39
|
transformFile: () => transformFile
|
|
42
40
|
});
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
var
|
|
41
|
+
module.exports = __toCommonJS(transformerTestUtils_exports);
|
|
42
|
+
var import_typescript = __toESM(require("typescript"));
|
|
43
|
+
var Path = __toESM(require("path"));
|
|
44
|
+
var import_bootstrap = require("@ts-morph/bootstrap");
|
|
46
45
|
class Transformer {
|
|
47
46
|
constructor() {
|
|
48
47
|
this.compilerOptions = {};
|
|
@@ -106,7 +105,7 @@ class Transformer {
|
|
|
106
105
|
compilerOptions: getCompilerOptions(this.compilerOptions)
|
|
107
106
|
});
|
|
108
107
|
const filePath = typeof this.filePath === "string" ? this.filePath : "/index.ts";
|
|
109
|
-
const file = typeof input === "string" ? {path: filePath, contents: input} : this.file;
|
|
108
|
+
const file = typeof input === "string" ? { path: filePath, contents: input } : this.file;
|
|
110
109
|
if (!file) {
|
|
111
110
|
throw new Error(`transform must be called on Transformer with file or with string input`);
|
|
112
111
|
}
|
|
@@ -129,10 +128,10 @@ const transformFile = (file, options) => {
|
|
|
129
128
|
(options.mocks || []).forEach((mock) => {
|
|
130
129
|
const base = `/node_modules/${mock.name}`;
|
|
131
130
|
project.createSourceFile(`${base}/index.ts`, mock.content);
|
|
132
|
-
project.fileSystem.writeFileSync(`${base}/package.json`, JSON.stringify({name: mock.name, main: "./src/index.ts"}));
|
|
131
|
+
project.fileSystem.writeFileSync(`${base}/package.json`, JSON.stringify({ name: mock.name, main: "./src/index.ts" }));
|
|
133
132
|
});
|
|
134
133
|
const program = project.createProgram();
|
|
135
|
-
const {emitSkipped, diagnostics} = program.emit(program.getSourceFile(file.path), void 0, void 0, false, {
|
|
134
|
+
const { emitSkipped, diagnostics } = program.emit(program.getSourceFile(file.path), void 0, void 0, false, {
|
|
136
135
|
before: options.transforms.map((t) => t(program))
|
|
137
136
|
});
|
|
138
137
|
if (emitSkipped) {
|
|
@@ -152,7 +151,7 @@ const transformFile = (file, options) => {
|
|
|
152
151
|
return String(project.fileSystem.readFileSync(fileArtifactPath));
|
|
153
152
|
};
|
|
154
153
|
function getCompilerOptions(options) {
|
|
155
|
-
return
|
|
154
|
+
return __spreadValues({
|
|
156
155
|
outDir: "/dist",
|
|
157
156
|
lib: ["/node_modules/typescript/lib/lib.esnext.full.d.ts"],
|
|
158
157
|
module: import_typescript.default.ModuleKind.ESNext,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3
2
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
4
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
6
|
-
var
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
7
|
for (var prop in b || (b = {}))
|
|
8
8
|
if (__hasOwnProp.call(b, prop))
|
|
9
9
|
__defNormalProp(a, prop, b[prop]);
|
|
@@ -17,12 +17,8 @@ var __objSpread = (a, b) => {
|
|
|
17
17
|
|
|
18
18
|
// src/transforms/transformerTestUtils.ts
|
|
19
19
|
import Ts from "typescript";
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
extname,
|
|
23
|
-
join
|
|
24
|
-
} from "path";
|
|
25
|
-
import {createProjectSync} from "@ts-morph/bootstrap";
|
|
20
|
+
import * as Path from "path";
|
|
21
|
+
import { createProjectSync } from "@ts-morph/bootstrap";
|
|
26
22
|
var Transformer = class {
|
|
27
23
|
constructor() {
|
|
28
24
|
this.compilerOptions = {};
|
|
@@ -86,7 +82,7 @@ var Transformer = class {
|
|
|
86
82
|
compilerOptions: getCompilerOptions(this.compilerOptions)
|
|
87
83
|
});
|
|
88
84
|
const filePath = typeof this.filePath === "string" ? this.filePath : "/index.ts";
|
|
89
|
-
const file = typeof input === "string" ? {path: filePath, contents: input} : this.file;
|
|
85
|
+
const file = typeof input === "string" ? { path: filePath, contents: input } : this.file;
|
|
90
86
|
if (!file) {
|
|
91
87
|
throw new Error(`transform must be called on Transformer with file or with string input`);
|
|
92
88
|
}
|
|
@@ -109,10 +105,10 @@ var transformFile = (file, options) => {
|
|
|
109
105
|
(options.mocks || []).forEach((mock) => {
|
|
110
106
|
const base = `/node_modules/${mock.name}`;
|
|
111
107
|
project.createSourceFile(`${base}/index.ts`, mock.content);
|
|
112
|
-
project.fileSystem.writeFileSync(`${base}/package.json`, JSON.stringify({name: mock.name, main: "./src/index.ts"}));
|
|
108
|
+
project.fileSystem.writeFileSync(`${base}/package.json`, JSON.stringify({ name: mock.name, main: "./src/index.ts" }));
|
|
113
109
|
});
|
|
114
110
|
const program = project.createProgram();
|
|
115
|
-
const {emitSkipped, diagnostics} = program.emit(program.getSourceFile(file.path), void 0, void 0, false, {
|
|
111
|
+
const { emitSkipped, diagnostics } = program.emit(program.getSourceFile(file.path), void 0, void 0, false, {
|
|
116
112
|
before: options.transforms.map((t) => t(program))
|
|
117
113
|
});
|
|
118
114
|
if (emitSkipped) {
|
|
@@ -132,7 +128,7 @@ var transformFile = (file, options) => {
|
|
|
132
128
|
return String(project.fileSystem.readFileSync(fileArtifactPath));
|
|
133
129
|
};
|
|
134
130
|
function getCompilerOptions(options) {
|
|
135
|
-
return
|
|
131
|
+
return __spreadValues({
|
|
136
132
|
outDir: "/dist",
|
|
137
133
|
lib: ["/node_modules/typescript/lib/lib.esnext.full.d.ts"],
|
|
138
134
|
module: Ts.ModuleKind.ESNext,
|
|
@@ -148,10 +144,10 @@ function getCompilerOptions(options) {
|
|
|
148
144
|
}
|
|
149
145
|
function getFileArtifactPath(file, program) {
|
|
150
146
|
const options = program.getCompilerOptions();
|
|
151
|
-
const extname2 = extname(file.fileName);
|
|
152
|
-
const basename2 = basename(file.fileName, extname2);
|
|
147
|
+
const extname2 = Path.extname(file.fileName);
|
|
148
|
+
const basename2 = Path.basename(file.fileName, extname2);
|
|
153
149
|
const artifactExtname = extname2 === ".tsx" && options.jsx === Ts.JsxEmit.Preserve ? ".jsx" : ".js";
|
|
154
|
-
return join(options.outDir || ".", `${basename2}${artifactExtname}`);
|
|
150
|
+
return Path.join(options.outDir || ".", `${basename2}${artifactExtname}`);
|
|
155
151
|
}
|
|
156
152
|
export {
|
|
157
153
|
Transformer,
|
package/lib/types.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var types_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3
5
|
var __export = (target, all) => {
|
|
4
6
|
for (var name in all)
|
|
5
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
8
|
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
7
18
|
var __async = (__this, __arguments, generator) => {
|
|
8
19
|
return new Promise((resolve, reject) => {
|
|
9
20
|
var fulfilled = (value) => {
|
|
@@ -24,10 +35,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
24
35
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
25
36
|
});
|
|
26
37
|
};
|
|
27
|
-
|
|
28
|
-
__export(
|
|
38
|
+
var mapAsyncIterator_exports = {};
|
|
39
|
+
__export(mapAsyncIterator_exports, {
|
|
29
40
|
mapAsyncIterator: () => mapAsyncIterator
|
|
30
41
|
});
|
|
42
|
+
module.exports = __toCommonJS(mapAsyncIterator_exports);
|
|
31
43
|
function mapAsyncIterator(iterable, callback) {
|
|
32
44
|
const iterator = iterable[Symbol.asyncIterator]();
|
|
33
45
|
function mapResult(result) {
|
|
@@ -36,7 +48,7 @@ function mapAsyncIterator(iterable, callback) {
|
|
|
36
48
|
return result;
|
|
37
49
|
}
|
|
38
50
|
try {
|
|
39
|
-
return {value: yield callback(result.value), done: false};
|
|
51
|
+
return { value: yield callback(result.value), done: false };
|
|
40
52
|
} catch (error) {
|
|
41
53
|
if (typeof iterator.return === "function") {
|
|
42
54
|
try {
|
|
@@ -56,7 +68,7 @@ function mapAsyncIterator(iterable, callback) {
|
|
|
56
68
|
},
|
|
57
69
|
return() {
|
|
58
70
|
return __async(this, null, function* () {
|
|
59
|
-
return typeof iterator.return === "function" ? mapResult(yield iterator.return()) : {value: void 0, done: true};
|
|
71
|
+
return typeof iterator.return === "function" ? mapResult(yield iterator.return()) : { value: void 0, done: true };
|
|
60
72
|
});
|
|
61
73
|
},
|
|
62
74
|
throw(error) {
|
|
@@ -28,7 +28,7 @@ function mapAsyncIterator(iterable, callback) {
|
|
|
28
28
|
return result;
|
|
29
29
|
}
|
|
30
30
|
try {
|
|
31
|
-
return {value: yield callback(result.value), done: false};
|
|
31
|
+
return { value: yield callback(result.value), done: false };
|
|
32
32
|
} catch (error) {
|
|
33
33
|
if (typeof iterator.return === "function") {
|
|
34
34
|
try {
|
|
@@ -48,7 +48,7 @@ function mapAsyncIterator(iterable, callback) {
|
|
|
48
48
|
},
|
|
49
49
|
return() {
|
|
50
50
|
return __async(this, null, function* () {
|
|
51
|
-
return typeof iterator.return === "function" ? mapResult(yield iterator.return()) : {value: void 0, done: true};
|
|
51
|
+
return typeof iterator.return === "function" ? mapResult(yield iterator.return()) : { value: void 0, done: true };
|
|
52
52
|
});
|
|
53
53
|
},
|
|
54
54
|
throw(error) {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
6
|
-
var
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
7
9
|
for (var prop in b || (b = {}))
|
|
8
10
|
if (__hasOwnProp.call(b, prop))
|
|
9
11
|
__defNormalProp(a, prop, b[prop]);
|
|
@@ -14,20 +16,29 @@ var __objSpread = (a, b) => {
|
|
|
14
16
|
}
|
|
15
17
|
return a;
|
|
16
18
|
};
|
|
17
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
18
19
|
var __export = (target, all) => {
|
|
19
20
|
for (var name in all)
|
|
20
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
21
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
|
+
};
|
|
23
|
+
var __copyProps = (to, from, except, desc) => {
|
|
24
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
25
|
+
for (let key of __getOwnPropNames(from))
|
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
27
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
28
|
+
}
|
|
29
|
+
return to;
|
|
21
30
|
};
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
var mergeResolvers_exports = {};
|
|
33
|
+
__export(mergeResolvers_exports, {
|
|
24
34
|
mergeResolvers: () => mergeResolvers
|
|
25
35
|
});
|
|
36
|
+
module.exports = __toCommonJS(mergeResolvers_exports);
|
|
26
37
|
function mergeResolvers(resolvers, extractedResolvers) {
|
|
27
|
-
const fullResolvers =
|
|
38
|
+
const fullResolvers = __spreadValues({}, extractedResolvers);
|
|
28
39
|
Object.keys(resolvers).forEach((resolverKey) => {
|
|
29
40
|
if (fullResolvers[resolverKey] && typeof resolvers[resolverKey] === "object" && resolvers[resolverKey].constructor === Object) {
|
|
30
|
-
fullResolvers[resolverKey] =
|
|
41
|
+
fullResolvers[resolverKey] = __spreadValues(__spreadValues({}, fullResolvers[resolverKey]), resolvers[resolverKey]);
|
|
31
42
|
} else {
|
|
32
43
|
fullResolvers[resolverKey] = resolvers[resolverKey];
|
|
33
44
|
}
|