@graphitation/supermassive 0.2.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/.eslintcache +1 -1
  2. package/CHANGELOG.json +155 -0
  3. package/CHANGELOG.md +34 -2
  4. package/NOTICE +27 -0
  5. package/README.md +179 -5
  6. package/lib/ast/addTypesToRequestDocument.mjs +3 -1
  7. package/lib/benchmarks/index.mjs +16 -14
  8. package/lib/benchmarks/nice-benchmark.mjs +6 -3
  9. package/lib/benchmarks/swapi-schema/index.mjs +3 -2
  10. package/lib/benchmarks/swapi-schema/models.mjs +1 -0
  11. package/lib/benchmarks/swapi-schema/resolvers.mjs +23 -24
  12. package/lib/bin/supermassive.d.ts.map +1 -1
  13. package/lib/bin/supermassive.mjs +3 -1
  14. package/lib/collectFields.mjs +1 -0
  15. package/lib/executeWithSchema.d.ts.map +1 -1
  16. package/lib/executeWithSchema.js +8 -8
  17. package/lib/executeWithSchema.mjs +6 -4
  18. package/lib/executeWithoutSchema.mjs +15 -17
  19. package/lib/extractImplicitTypesRuntime.mjs +1 -0
  20. package/lib/extractImplicitTypesToTypescript.mjs +2 -1
  21. package/lib/index.d.ts +1 -1
  22. package/lib/index.d.ts.map +1 -1
  23. package/lib/index.js +0 -2
  24. package/lib/index.mjs +7 -8
  25. package/lib/jsutils/Path.mjs +1 -0
  26. package/lib/jsutils/devAssert.mjs +1 -0
  27. package/lib/jsutils/didYouMean.mjs +2 -1
  28. package/lib/jsutils/identityFunc.mjs +1 -0
  29. package/lib/jsutils/inspect.mjs +3 -2
  30. package/lib/jsutils/instanceOf.mjs +3 -2
  31. package/lib/jsutils/invariant.mjs +1 -0
  32. package/lib/jsutils/isAsyncIterable.mjs +1 -0
  33. package/lib/jsutils/isIterableObject.mjs +1 -0
  34. package/lib/jsutils/isObjectLike.mjs +1 -0
  35. package/lib/jsutils/isPromise.mjs +1 -0
  36. package/lib/jsutils/keyMap.mjs +1 -0
  37. package/lib/jsutils/keyValMap.mjs +1 -0
  38. package/lib/jsutils/mapValue.mjs +1 -0
  39. package/lib/jsutils/memoize3.mjs +1 -0
  40. package/lib/jsutils/naturalCompare.mjs +3 -2
  41. package/lib/jsutils/printPathArray.mjs +1 -0
  42. package/lib/jsutils/promiseForObject.mjs +1 -0
  43. package/lib/jsutils/promiseReduce.mjs +2 -1
  44. package/lib/jsutils/suggestionList.mjs +4 -3
  45. package/lib/jsutils/toObjMap.mjs +1 -0
  46. package/lib/transforms/annotateDocumentGraphQLTransform.mjs +3 -2
  47. package/lib/transforms/transformerTestUtils.mjs +14 -8
  48. package/lib/utilities/typeNameFromAST.mjs +1 -0
  49. package/lib/values.mjs +5 -4
  50. package/package.json +13 -3
  51. package/starwars.json +1 -0
  52. package/graphitation-supermassive-0.1.3-1.tgz +0 -0
  53. package/graphitation-supermassive-0.1.3-2.tgz +0 -0
  54. package/graphitation-supermassive-0.1.3.tgz +0 -0
  55. package/lib/bin/typeDefsToImplicitResolvers.d.ts +0 -3
  56. package/lib/bin/typeDefsToImplicitResolvers.d.ts.map +0 -1
  57. package/lib/bin/typeDefsToImplicitResolvers.js +0 -82
  58. package/lib/bin/typeDefsToImplicitResolvers.mjs +0 -59
  59. package/lib/execute.d.ts +0 -128
  60. package/lib/execute.d.ts.map +0 -1
  61. package/lib/execute.js +0 -376
  62. package/lib/execute.mjs +0 -365
  63. package/lib/extractImplicitTypes.d.ts +0 -6
  64. package/lib/extractImplicitTypes.d.ts.map +0 -1
  65. package/lib/extractImplicitTypes.js +0 -246
  66. package/lib/extractImplicitTypes.mjs +0 -233
@@ -1,9 +1,10 @@
1
+ // src/benchmarks/swapi-schema/index.ts
1
2
  import {makeExecutableSchema} from "@graphql-tools/schema";
2
3
  import {parse} from "graphql";
3
4
  import {join} from "path";
4
5
  import {readFileSync} from "fs";
5
- import resolvers from "./resolvers";
6
- const typeDefs = parse(readFileSync(join(__dirname, "./schema.graphql"), {
6
+ import resolvers from "./resolvers.mjs";
7
+ var typeDefs = parse(readFileSync(join(__dirname, "./schema.graphql"), {
7
8
  encoding: "utf-8"
8
9
  }));
9
10
  var swapi_schema_default = makeExecutableSchema({
@@ -1,3 +1,4 @@
1
+ // src/benchmarks/swapi-schema/models.ts
1
2
  import path from "path";
2
3
  import {JsonDB} from "node-json-db";
3
4
  var models_default = new JsonDB(path.join(__dirname, "./starwars"));
@@ -14,10 +14,12 @@ var __objSpread = (a, b) => {
14
14
  }
15
15
  return a;
16
16
  };
17
- const films = (parent, args, {models}) => {
17
+
18
+ // src/benchmarks/swapi-schema/resolvers.ts
19
+ var films = (parent, args, {models}) => {
18
20
  return models.getData("/films").filter(({id}) => parent.films.includes(id));
19
21
  };
20
- const starships = (parent, {id}, {models}) => {
22
+ var starships = (parent, {id}, {models}) => {
21
23
  return models.getData("/starships").filter(({id: id2}) => parent.starships.includes(id2));
22
24
  };
23
25
  function people(key) {
@@ -25,61 +27,58 @@ function people(key) {
25
27
  return models.getData("/people").filter(({id}) => parent[key].includes(id));
26
28
  };
27
29
  }
28
- const vehicles = (parent, args, {models}) => {
30
+ var vehicles = (parent, args, {models}) => {
29
31
  return models.getData("/vehicles").filter(({id}) => parent.vehicles.includes(id));
30
32
  };
31
- const transports = (parent, args, {models}) => {
32
- return models.getData("/transport").filter(({id}) => parent.starships.includes(id));
33
- };
34
- const planets = (parent, args, {models}) => {
33
+ var planets = (parent, args, {models}) => {
35
34
  return models.getData("/planets").filter(({id}) => parent.planets.includes(id));
36
35
  };
37
- const species = (parent, args, {models}) => {
36
+ var species = (parent, args, {models}) => {
38
37
  return models.getData("/species").filter(({id}) => parent.species.includes(id));
39
38
  };
40
- const homeworld = (parent, args, {models}) => {
39
+ var homeworld = (parent, args, {models}) => {
41
40
  return models.getData("/planets").find((planet2) => planet2.id === parent.homeworld);
42
41
  };
43
- const person = (parent, {id}, {models}) => {
42
+ var person = (parent, {id}, {models}) => {
44
43
  return models.getData("/people").find((person2) => person2.id === id);
45
44
  };
46
- const planet = (parent, {id}, {models}) => {
45
+ var planet = (parent, {id}, {models}) => {
47
46
  return models.getData("/planets").find((planet2) => planet2.id === id);
48
47
  };
49
- const film = (parent, {id}, {models}) => {
48
+ var film = (parent, {id}, {models}) => {
50
49
  return models.getData("/films").find((film2) => film2.id === id);
51
50
  };
52
- const starship = (parent, {id}, {models}) => {
51
+ var starship = (parent, {id}, {models}) => {
53
52
  return models.getData("/starships").find((starship2) => starship2.id === id);
54
53
  };
55
- const transport = (parent, {id}, {models}) => {
54
+ var transport = (parent, {id}, {models}) => {
56
55
  return models.getData("/transport").find((transport2) => transport2.id === id);
57
56
  };
58
- const vehicle = (parent, {id}, {models}) => {
57
+ var vehicle = (parent, {id}, {models}) => {
59
58
  return models.getData("/vehicles").find((vehicle2) => vehicle2.id === id);
60
59
  };
61
- const searchPeopleByName = (parent, {search}, {models}) => {
60
+ var searchPeopleByName = (parent, {search}, {models}) => {
62
61
  return models.getData("/people").filter((person2) => new RegExp(search, "i").test(person2.name));
63
62
  };
64
- const searchPlanetsByName = (parent, {search}, {models}) => {
63
+ var searchPlanetsByName = (parent, {search}, {models}) => {
65
64
  return models.getData("/planets").filter((planet2) => new RegExp(search, "i").test(planet2.name));
66
65
  };
67
- const searchFilmsByTitle = (parent, {search}, {models}) => {
66
+ var searchFilmsByTitle = (parent, {search}, {models}) => {
68
67
  return models.getData("/films").filter((film2) => new RegExp(search, "i").test(film2.title));
69
68
  };
70
- const searchSpeciesByName = (parent, {search}, {models}) => {
69
+ var searchSpeciesByName = (parent, {search}, {models}) => {
71
70
  return models.getData("/species").filter((species2) => new RegExp(search, "i").test(species2.name));
72
71
  };
73
- const searchStarshipsByName = (parent, {search}, {models}) => {
72
+ var searchStarshipsByName = (parent, {search}, {models}) => {
74
73
  return models.getData("/starships").filter((starship2) => new RegExp(search, "i").test(starship2.name));
75
74
  };
76
- const searchVehiclesByName = (parent, {search}, {models}) => {
75
+ var searchVehiclesByName = (parent, {search}, {models}) => {
77
76
  return models.getData("/vehicles").filter((vehicle2) => new RegExp(search, "i").test(vehicle2.name));
78
77
  };
79
- const searchTransportsByName = (parent, {search}, {models}) => {
78
+ var searchTransportsByName = (parent, {search}, {models}) => {
80
79
  return models.getData("/transport").filter((transport2) => new RegExp(search, "i").test(transport2.name));
81
80
  };
82
- const resolvers = {
81
+ var resolvers = {
83
82
  SearchResult: {
84
83
  __resolveType(parent) {
85
84
  return parent.__typename;
@@ -224,7 +223,7 @@ const resolvers = {
224
223
  cost_in_credits: (vehicle2) => +vehicle2.cost_in_credits
225
224
  }
226
225
  };
227
- const forceNumber = (i) => Number(i.split(",").join("").split("-")[0]) || -1;
226
+ var forceNumber = (i) => Number(i.split(",").join("").split("-")[0]) || -1;
228
227
  var resolvers_default = resolvers;
229
228
  export {
230
229
  resolvers_default as default
@@ -1 +1 @@
1
- {"version":3,"file":"supermassive.d.ts","sourceRoot":"","sources":["../../src/bin/supermassive.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,YAAY,IAAI,OAAO,CAUtC"}
1
+ {"version":3,"file":"supermassive.d.ts","sourceRoot":"","sources":["../../src/bin/supermassive.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,OAAO,EAAE,MAAM,WAAW,CAAC;AAI7C,wBAAgB,YAAY,IAAI,OAAO,CAYtC"}
@@ -18,11 +18,13 @@ var __async = (__this, __arguments, generator) => {
18
18
  step((generator = generator.apply(__this, __arguments)).next());
19
19
  });
20
20
  };
21
+
22
+ // src/bin/supermassive.ts
21
23
  import path from "path";
22
24
  import fs from "fs/promises";
23
25
  import ts from "typescript";
24
26
  import {program, Command} from "commander";
25
- import {extractImplicitTypesToTypescript} from "../extractImplicitTypesToTypescript";
27
+ import {extractImplicitTypesToTypescript} from "../extractImplicitTypesToTypescript.mjs";
26
28
  import {parse} from "graphql";
27
29
  function supermassive() {
28
30
  const command = new Command();
@@ -1,3 +1,4 @@
1
+ // src/collectFields.ts
1
2
  import {Kind} from "graphql";
2
3
  function collectFields(resolvers, fragments, variableValues, runtimeTypeName, selectionSet, fields, visitedFragmentNames) {
3
4
  for (const selection of selectionSet.selections) {
@@ -1 +1 @@
1
- {"version":3,"file":"executeWithSchema.d.ts","sourceRoot":"","sources":["../src/executeWithSchema.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAIL,eAAe,EACf,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,QAAQ,EAAE,WAAW,EACrB,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,GACb,EAAE,uBAAuB,GAAG,cAAc,CAAC,eAAe,CAAC,CA2B3D"}
1
+ {"version":3,"file":"executeWithSchema.d.ts","sourceRoot":"","sources":["../src/executeWithSchema.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAa,eAAe,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAE9E,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,QAAQ,EAAE,WAAW,EACrB,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,GACb,EAAE,uBAAuB,GAAG,cAAc,CAAC,eAAe,CAAC,CA2B3D"}
@@ -40,10 +40,10 @@ __export(exports, {
40
40
  });
41
41
  var import_schema = __toModule(require("@graphql-tools/schema"));
42
42
  var import_graphql = __toModule(require("graphql"));
43
- var import__ = __toModule(require("."));
43
+ var import_index = __toModule(require("./index"));
44
44
  function executeWithSchema({
45
45
  typeDefs,
46
- resolvers: resolvers2,
46
+ resolvers,
47
47
  document: rawDocument,
48
48
  rootValue,
49
49
  contextValue,
@@ -52,20 +52,20 @@ function executeWithSchema({
52
52
  fieldResolver,
53
53
  typeResolver
54
54
  }) {
55
- const schema = (0, import_schema.makeExecutableSchema)({typeDefs, resolvers: resolvers2});
55
+ const schema = (0, import_schema.makeExecutableSchema)({typeDefs, resolvers});
56
56
  let extractedResolvers = {};
57
57
  const getTypeByName = (name) => {
58
- const type = import__.specifiedScalars[name] || extractedResolvers[name];
58
+ const type = import_index.specifiedScalars[name] || extractedResolvers[name];
59
59
  if ((0, import_graphql.isInputType)(type)) {
60
60
  return type;
61
61
  } else {
62
62
  throw new Error("Invalid type");
63
63
  }
64
64
  };
65
- extractedResolvers = (0, import__.extractImplicitTypes)(typeDefs, getTypeByName);
66
- const fullResolvers = __objSpread(__objSpread({}, extractedResolvers), resolvers2);
67
- const document = (0, import__.addTypesToRequestDocument)(schema, rawDocument);
68
- return (0, import__.executeWithoutSchema)({
65
+ extractedResolvers = (0, import_index.extractImplicitTypes)(typeDefs, getTypeByName);
66
+ const fullResolvers = __objSpread(__objSpread({}, extractedResolvers), resolvers);
67
+ const document = (0, import_index.addTypesToRequestDocument)(schema, rawDocument);
68
+ return (0, import_index.executeWithoutSchema)({
69
69
  document,
70
70
  resolvers: fullResolvers,
71
71
  rootValue,
@@ -14,6 +14,8 @@ var __objSpread = (a, b) => {
14
14
  }
15
15
  return a;
16
16
  };
17
+
18
+ // src/executeWithSchema.ts
17
19
  import {makeExecutableSchema} from "@graphql-tools/schema";
18
20
  import {isInputType} from "graphql";
19
21
  import {
@@ -21,10 +23,10 @@ import {
21
23
  executeWithoutSchema,
22
24
  extractImplicitTypes,
23
25
  specifiedScalars
24
- } from ".";
26
+ } from "./index.mjs";
25
27
  function executeWithSchema({
26
28
  typeDefs,
27
- resolvers: resolvers2,
29
+ resolvers,
28
30
  document: rawDocument,
29
31
  rootValue,
30
32
  contextValue,
@@ -33,7 +35,7 @@ function executeWithSchema({
33
35
  fieldResolver,
34
36
  typeResolver
35
37
  }) {
36
- const schema = makeExecutableSchema({typeDefs, resolvers: resolvers2});
38
+ const schema = makeExecutableSchema({typeDefs, resolvers});
37
39
  let extractedResolvers = {};
38
40
  const getTypeByName = (name) => {
39
41
  const type = specifiedScalars[name] || extractedResolvers[name];
@@ -44,7 +46,7 @@ function executeWithSchema({
44
46
  }
45
47
  };
46
48
  extractedResolvers = extractImplicitTypes(typeDefs, getTypeByName);
47
- const fullResolvers = __objSpread(__objSpread({}, extractedResolvers), resolvers2);
49
+ const fullResolvers = __objSpread(__objSpread({}, extractedResolvers), resolvers);
48
50
  const document = addTypesToRequestDocument(schema, rawDocument);
49
51
  return executeWithoutSchema({
50
52
  document,
@@ -1,3 +1,4 @@
1
+ // src/executeWithoutSchema.ts
1
2
  import {
2
3
  GraphQLEnumType,
3
4
  GraphQLError,
@@ -7,22 +8,22 @@ import {
7
8
  Kind,
8
9
  locatedError
9
10
  } from "graphql";
10
- import {collectFields} from "./collectFields";
11
- import {devAssert} from "./jsutils/devAssert";
12
- import {inspect} from "./jsutils/inspect";
13
- import {invariant} from "./jsutils/invariant";
14
- import {isIterableObject} from "./jsutils/isIterableObject";
15
- import {isObjectLike} from "./jsutils/isObjectLike";
16
- import {isPromise} from "./jsutils/isPromise";
17
- import {addPath, pathToArray} from "./jsutils/Path";
18
- import {promiseForObject} from "./jsutils/promiseForObject";
19
- import {promiseReduce} from "./jsutils/promiseReduce";
20
- import {typeNameFromAST} from "./utilities/typeNameFromAST";
11
+ import {collectFields} from "./collectFields.mjs";
12
+ import {devAssert} from "./jsutils/devAssert.mjs";
13
+ import {inspect} from "./jsutils/inspect.mjs";
14
+ import {invariant} from "./jsutils/invariant.mjs";
15
+ import {isIterableObject} from "./jsutils/isIterableObject.mjs";
16
+ import {isObjectLike} from "./jsutils/isObjectLike.mjs";
17
+ import {isPromise} from "./jsutils/isPromise.mjs";
18
+ import {addPath, pathToArray} from "./jsutils/Path.mjs";
19
+ import {promiseForObject} from "./jsutils/promiseForObject.mjs";
20
+ import {promiseReduce} from "./jsutils/promiseReduce.mjs";
21
+ import {typeNameFromAST} from "./utilities/typeNameFromAST.mjs";
21
22
  import {
22
23
  getArgumentValues,
23
24
  getVariableValues,
24
25
  specifiedScalars
25
- } from "./values";
26
+ } from "./values.mjs";
26
27
  function executeWithoutSchema(args) {
27
28
  const {
28
29
  resolvers,
@@ -318,9 +319,6 @@ function completeObjectValue(exeContext, returnTypeName, fieldNodes, info, path,
318
319
  const subFieldNodes = collectSubfields(exeContext, returnTypeName, fieldNodes);
319
320
  return executeFields(exeContext, returnTypeName, result, path, subFieldNodes);
320
321
  }
321
- function invalidReturnTypeError(returnType, result, fieldNodes) {
322
- return new GraphQLError(`Expected value of type "${returnType.name}" but got: ${inspect(result)}.`, fieldNodes);
323
- }
324
322
  function collectSubfields(exeContext, returnTypeName, fieldNodes) {
325
323
  let subFieldNodes = new Map();
326
324
  const visitedFragmentNames = new Set();
@@ -331,12 +329,12 @@ function collectSubfields(exeContext, returnTypeName, fieldNodes) {
331
329
  }
332
330
  return subFieldNodes;
333
331
  }
334
- const defaultTypeResolver = function(value) {
332
+ var defaultTypeResolver = function(value) {
335
333
  if (isObjectLike(value) && typeof value.__typename === "string") {
336
334
  return value.__typename;
337
335
  }
338
336
  };
339
- const defaultFieldResolver = function(source, args, contextValue, info) {
337
+ var defaultFieldResolver = function(source, args, contextValue, info) {
340
338
  if (isObjectLike(source) || typeof source === "function") {
341
339
  const property = source[info.fieldName];
342
340
  if (typeof property === "function") {
@@ -1,3 +1,4 @@
1
+ // src/extractImplicitTypesRuntime.ts
1
2
  import {
2
3
  getDirectiveValues,
3
4
  GraphQLDeprecatedDirective,
@@ -1,8 +1,9 @@
1
+ // src/extractImplicitTypesToTypescript.ts
1
2
  import ts, {factory} from "typescript";
2
3
  import {
3
4
  Kind
4
5
  } from "graphql";
5
- const SPECIFIED_SCALARS = {
6
+ var SPECIFIED_SCALARS = {
6
7
  ID: "GraphQLID",
7
8
  String: "GraphQLString",
8
9
  Int: "GraphQLInt",
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";
@@ -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,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,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"}
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
- import {executeWithoutSchema} from "./executeWithoutSchema";
2
- import {executeWithSchema} from "./executeWithSchema";
3
- import {Resolvers} from "./types";
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,
@@ -1,3 +1,4 @@
1
+ // src/jsutils/Path.ts
1
2
  function addPath(prev, key, typename) {
2
3
  return {prev, key, typename};
3
4
  }
@@ -1,3 +1,4 @@
1
+ // src/jsutils/devAssert.ts
1
2
  function devAssert(condition, message) {
2
3
  const booleanCondition = Boolean(condition);
3
4
  if (!booleanCondition) {
@@ -1,4 +1,5 @@
1
- const MAX_SUGGESTIONS = 5;
1
+ // src/jsutils/didYouMean.ts
2
+ var MAX_SUGGESTIONS = 5;
2
3
  function didYouMean(firstArg, secondArg) {
3
4
  const [subMessage, suggestionsArg] = secondArg ? [firstArg, secondArg] : [void 0, firstArg];
4
5
  let message = " Did you mean ";
@@ -1,3 +1,4 @@
1
+ // src/jsutils/identityFunc.ts
1
2
  function identityFunc(x) {
2
3
  return x;
3
4
  }
@@ -1,5 +1,6 @@
1
- const MAX_ARRAY_LENGTH = 10;
2
- const MAX_RECURSIVE_DEPTH = 2;
1
+ // src/jsutils/inspect.ts
2
+ var MAX_ARRAY_LENGTH = 10;
3
+ var MAX_RECURSIVE_DEPTH = 2;
3
4
  function inspect(value) {
4
5
  return formatValue(value, []);
5
6
  }
@@ -1,5 +1,6 @@
1
- import {inspect} from "./inspect";
2
- const instanceOf = false ? function instanceOf2(value, constructor) {
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;
@@ -1,3 +1,4 @@
1
+ // src/jsutils/invariant.ts
1
2
  function invariant(condition, message) {
2
3
  const booleanCondition = Boolean(condition);
3
4
  if (!booleanCondition) {
@@ -1,3 +1,4 @@
1
+ // src/jsutils/isAsyncIterable.ts
1
2
  function isAsyncIterable(maybeAsyncIterable) {
2
3
  return typeof (maybeAsyncIterable == null ? void 0 : maybeAsyncIterable[Symbol.asyncIterator]) === "function";
3
4
  }
@@ -1,3 +1,4 @@
1
+ // src/jsutils/isIterableObject.ts
1
2
  function isIterableObject(maybeIterable) {
2
3
  return typeof maybeIterable === "object" && typeof (maybeIterable == null ? void 0 : maybeIterable[Symbol.iterator]) === "function";
3
4
  }
@@ -1,3 +1,4 @@
1
+ // src/jsutils/isObjectLike.ts
1
2
  function isObjectLike(value) {
2
3
  return typeof value == "object" && value !== null;
3
4
  }
@@ -1,3 +1,4 @@
1
+ // src/jsutils/isPromise.ts
1
2
  function isPromise(value) {
2
3
  return typeof (value == null ? void 0 : value.then) === "function";
3
4
  }
@@ -1,3 +1,4 @@
1
+ // src/jsutils/keyMap.ts
1
2
  function keyMap(list, keyFn) {
2
3
  const result = Object.create(null);
3
4
  for (const item of list) {
@@ -1,3 +1,4 @@
1
+ // src/jsutils/keyValMap.ts
1
2
  function keyValMap(list, keyFn, valFn) {
2
3
  const result = Object.create(null);
3
4
  for (const item of list) {
@@ -1,3 +1,4 @@
1
+ // src/jsutils/mapValue.ts
1
2
  function mapValue(map, fn) {
2
3
  const result = Object.create(null);
3
4
  for (const [key, value] of Object.entries(map)) {
@@ -1,3 +1,4 @@
1
+ // src/jsutils/memoize3.ts
1
2
  function memoize3(fn) {
2
3
  let cache0;
3
4
  return function memoized(a1, a2, a3) {
@@ -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
- const DIGIT_0 = 48;
40
- const DIGIT_9 = 57;
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,3 +1,4 @@
1
+ // src/jsutils/printPathArray.ts
1
2
  function printPathArray(path) {
2
3
  return path.map((key) => typeof key === "number" ? "[" + key.toString() + "]" : "." + key).join("");
3
4
  }
@@ -1,3 +1,4 @@
1
+ // src/jsutils/promiseForObject.ts
1
2
  function promiseForObject(object) {
2
3
  return Promise.all(Object.values(object)).then((resolvedValues) => {
3
4
  const resolvedObject = Object.create(null);
@@ -1,4 +1,5 @@
1
- import {isPromise} from "./isPromise";
1
+ // src/jsutils/promiseReduce.ts
2
+ import {isPromise} from "./isPromise.mjs";
2
3
  function promiseReduce(values, callbackFn, initialValue) {
3
4
  let accumulator = initialValue;
4
5
  for (const value of values) {
@@ -1,4 +1,5 @@
1
- import {naturalCompare} from "./naturalCompare";
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
- class LexicalDistance {
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);
@@ -1,3 +1,4 @@
1
+ // src/jsutils/toObjMap.ts
1
2
  function toObjMap(obj) {
2
3
  if (Object.getPrototypeOf(obj) === null) {
3
4
  return obj;
@@ -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
- const annotateDocumentGraphQLTransform = (schema) => {
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 * as Path from "path";
20
+ import {
21
+ basename,
22
+ extname,
23
+ join
24
+ } from "path";
19
25
  import {createProjectSync} from "@ts-morph/bootstrap";
20
- class Transformer {
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
- const transformFile = (file, options) => {
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 extname = Path.extname(file.fileName);
146
- const basename = Path.basename(file.fileName, extname);
147
- const artifactExtname = extname === ".tsx" && options.jsx === Ts.JsxEmit.Preserve ? ".jsx" : ".js";
148
- return Path.join(options.outDir || ".", `${basename}${artifactExtname}`);
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,
@@ -1,3 +1,4 @@
1
+ // src/utilities/typeNameFromAST.ts
1
2
  import {Kind} from "graphql";
2
3
  function typeNameFromAST(typeAst) {
3
4
  if (typeAst.kind === Kind.LIST_TYPE || typeAst.kind === Kind.NON_NULL_TYPE) {
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
- const specifiedScalars = {
115
+ var specifiedScalars = {
115
116
  ID: GraphQLID,
116
117
  String: GraphQLString,
117
118
  Int: GraphQLInt,