@graphitation/supermassive 0.1.3 → 0.2.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.
Files changed (208) hide show
  1. package/.eslintcache +1 -1
  2. package/CHANGELOG.md +10 -2
  3. package/README.md +88 -0
  4. package/bin/supermassive.js +5 -0
  5. package/graphitation-supermassive-0.1.3-1.tgz +0 -0
  6. package/graphitation-supermassive-0.1.3-2.tgz +0 -0
  7. package/graphitation-supermassive-0.1.3.tgz +0 -0
  8. package/lib/{src/ast → ast}/TypedAST.d.ts +2 -0
  9. package/lib/ast/TypedAST.d.ts.map +1 -0
  10. package/lib/{src/ast → ast}/addTypesToRequestDocument.d.ts +0 -0
  11. package/lib/ast/addTypesToRequestDocument.d.ts.map +1 -0
  12. package/lib/ast/addTypesToRequestDocument.js +8 -5
  13. package/lib/ast/addTypesToRequestDocument.mjs +9 -5
  14. package/lib/benchmarks/index.d.ts.map +1 -1
  15. package/lib/benchmarks/index.js +127 -0
  16. package/lib/benchmarks/index.mjs +109 -0
  17. package/lib/benchmarks/nice-benchmark.d.ts +1 -1
  18. package/lib/benchmarks/nice-benchmark.d.ts.map +1 -1
  19. package/lib/benchmarks/nice-benchmark.js +72 -0
  20. package/lib/benchmarks/nice-benchmark.mjs +49 -0
  21. package/lib/benchmarks/swapi-schema/index.d.ts +1 -0
  22. package/lib/benchmarks/swapi-schema/index.d.ts.map +1 -1
  23. package/lib/benchmarks/swapi-schema/index.js +39 -0
  24. package/lib/benchmarks/swapi-schema/index.mjs +16 -0
  25. package/lib/benchmarks/swapi-schema/models.d.ts.map +1 -1
  26. package/lib/benchmarks/swapi-schema/models.js +29 -0
  27. package/lib/benchmarks/swapi-schema/models.mjs +6 -0
  28. package/lib/benchmarks/swapi-schema/resolvers.d.ts.map +1 -1
  29. package/lib/benchmarks/swapi-schema/resolvers.js +237 -0
  30. package/lib/benchmarks/swapi-schema/resolvers.mjs +231 -0
  31. package/lib/bin/supermassive.d.ts +3 -0
  32. package/lib/bin/supermassive.d.ts.map +1 -0
  33. package/lib/bin/supermassive.js +83 -0
  34. package/lib/bin/supermassive.mjs +60 -0
  35. package/lib/bin/typeDefsToImplicitResolvers.d.ts +3 -0
  36. package/lib/bin/typeDefsToImplicitResolvers.d.ts.map +1 -0
  37. package/lib/bin/typeDefsToImplicitResolvers.js +82 -0
  38. package/lib/bin/typeDefsToImplicitResolvers.mjs +59 -0
  39. package/lib/collectFields.d.ts +17 -0
  40. package/lib/collectFields.d.ts.map +1 -0
  41. package/lib/collectFields.js +83 -0
  42. package/lib/collectFields.mjs +60 -0
  43. package/lib/compiledQuery.d.ts +1 -0
  44. package/lib/compiledQuery.d.ts.map +1 -0
  45. package/lib/compiledQuery.js +0 -0
  46. package/lib/compiledQuery.mjs +0 -0
  47. package/lib/execute.d.ts +128 -0
  48. package/lib/execute.d.ts.map +1 -0
  49. package/lib/execute.js +376 -0
  50. package/lib/execute.mjs +365 -0
  51. package/lib/executeWithSchema.d.ts +4 -0
  52. package/lib/executeWithSchema.d.ts.map +1 -0
  53. package/lib/{index.test.js → executeWithSchema.js} +44 -45
  54. package/lib/executeWithSchema.mjs +62 -0
  55. package/lib/executeWithoutSchema.d.ts +99 -0
  56. package/lib/executeWithoutSchema.d.ts.map +1 -0
  57. package/lib/executeWithoutSchema.js +376 -0
  58. package/lib/executeWithoutSchema.mjs +365 -0
  59. package/lib/extractImplicitTypes.d.ts +6 -0
  60. package/lib/extractImplicitTypes.d.ts.map +1 -0
  61. package/lib/extractImplicitTypes.js +246 -0
  62. package/lib/extractImplicitTypes.mjs +233 -0
  63. package/lib/extractImplicitTypesRuntime.d.ts +4 -0
  64. package/lib/extractImplicitTypesRuntime.d.ts.map +1 -0
  65. package/lib/extractImplicitTypesRuntime.js +103 -0
  66. package/lib/extractImplicitTypesRuntime.mjs +90 -0
  67. package/lib/extractImplicitTypesToTypescript.d.ts +4 -0
  68. package/lib/extractImplicitTypesToTypescript.d.ts.map +1 -0
  69. package/lib/extractImplicitTypesToTypescript.js +169 -0
  70. package/lib/extractImplicitTypesToTypescript.mjs +148 -0
  71. package/lib/index.d.ts +8 -0
  72. package/lib/index.d.ts.map +1 -0
  73. package/lib/index.js +14 -29
  74. package/lib/index.mjs +14 -29
  75. package/lib/jsutils/Maybe.d.ts +3 -0
  76. package/lib/jsutils/Maybe.d.ts.map +1 -0
  77. package/lib/jsutils/Maybe.js +3 -0
  78. package/lib/jsutils/Maybe.mjs +0 -0
  79. package/lib/jsutils/ObjMap.d.ts +13 -0
  80. package/lib/jsutils/ObjMap.d.ts.map +1 -0
  81. package/lib/jsutils/ObjMap.js +3 -0
  82. package/lib/jsutils/ObjMap.mjs +0 -0
  83. package/lib/jsutils/Path.d.ts +15 -0
  84. package/lib/jsutils/Path.d.ts.map +1 -0
  85. package/lib/jsutils/Path.js +23 -0
  86. package/lib/jsutils/Path.mjs +16 -0
  87. package/lib/jsutils/PromiseOrValue.d.ts +2 -0
  88. package/lib/jsutils/PromiseOrValue.d.ts.map +1 -0
  89. package/lib/jsutils/PromiseOrValue.js +3 -0
  90. package/lib/jsutils/PromiseOrValue.mjs +0 -0
  91. package/lib/jsutils/devAssert.d.ts +2 -0
  92. package/lib/jsutils/devAssert.d.ts.map +1 -0
  93. package/lib/jsutils/devAssert.js +16 -0
  94. package/lib/jsutils/devAssert.mjs +9 -0
  95. package/lib/jsutils/didYouMean.d.ts +6 -0
  96. package/lib/jsutils/didYouMean.d.ts.map +1 -0
  97. package/lib/jsutils/didYouMean.js +30 -0
  98. package/lib/jsutils/didYouMean.mjs +23 -0
  99. package/lib/jsutils/identityFunc.d.ts +5 -0
  100. package/lib/jsutils/identityFunc.d.ts.map +1 -0
  101. package/lib/jsutils/identityFunc.js +13 -0
  102. package/lib/jsutils/identityFunc.mjs +6 -0
  103. package/lib/jsutils/inspect.d.ts +5 -0
  104. package/lib/jsutils/inspect.d.ts.map +1 -0
  105. package/lib/jsutils/inspect.js +89 -0
  106. package/lib/jsutils/inspect.mjs +82 -0
  107. package/lib/jsutils/instanceOf.d.ts +14 -0
  108. package/lib/jsutils/instanceOf.d.ts.map +1 -0
  109. package/lib/jsutils/instanceOf.js +55 -0
  110. package/lib/jsutils/instanceOf.mjs +32 -0
  111. package/lib/jsutils/invariant.d.ts +2 -0
  112. package/lib/jsutils/invariant.d.ts.map +1 -0
  113. package/lib/jsutils/invariant.js +16 -0
  114. package/lib/jsutils/invariant.mjs +9 -0
  115. package/lib/jsutils/isAsyncIterable.d.ts +6 -0
  116. package/lib/jsutils/isAsyncIterable.d.ts.map +1 -0
  117. package/lib/jsutils/isAsyncIterable.js +13 -0
  118. package/lib/jsutils/isAsyncIterable.mjs +6 -0
  119. package/lib/jsutils/isIterableObject.d.ts +18 -0
  120. package/lib/jsutils/isIterableObject.d.ts.map +1 -0
  121. package/lib/jsutils/isIterableObject.js +13 -0
  122. package/lib/jsutils/isIterableObject.mjs +6 -0
  123. package/lib/jsutils/isObjectLike.d.ts +8 -0
  124. package/lib/jsutils/isObjectLike.d.ts.map +1 -0
  125. package/lib/jsutils/isObjectLike.js +13 -0
  126. package/lib/jsutils/isObjectLike.mjs +6 -0
  127. package/lib/jsutils/isPromise.d.ts +6 -0
  128. package/lib/jsutils/isPromise.d.ts.map +1 -0
  129. package/lib/jsutils/isPromise.js +13 -0
  130. package/lib/jsutils/isPromise.mjs +6 -0
  131. package/lib/jsutils/keyMap.d.ts +26 -0
  132. package/lib/jsutils/keyMap.d.ts.map +1 -0
  133. package/lib/jsutils/keyMap.js +17 -0
  134. package/lib/jsutils/keyMap.mjs +10 -0
  135. package/lib/jsutils/keyValMap.d.ts +20 -0
  136. package/lib/jsutils/keyValMap.d.ts.map +1 -0
  137. package/lib/jsutils/keyValMap.js +17 -0
  138. package/lib/jsutils/keyValMap.mjs +10 -0
  139. package/lib/jsutils/mapValue.d.ts +7 -0
  140. package/lib/jsutils/mapValue.d.ts.map +1 -0
  141. package/lib/jsutils/mapValue.js +17 -0
  142. package/lib/jsutils/mapValue.mjs +10 -0
  143. package/lib/jsutils/memoize3.d.ts +5 -0
  144. package/lib/jsutils/memoize3.d.ts.map +1 -0
  145. package/lib/jsutils/memoize3.js +34 -0
  146. package/lib/jsutils/memoize3.mjs +27 -0
  147. package/lib/jsutils/naturalCompare.d.ts +9 -0
  148. package/lib/jsutils/naturalCompare.d.ts.map +1 -0
  149. package/lib/jsutils/naturalCompare.js +53 -0
  150. package/lib/jsutils/naturalCompare.mjs +46 -0
  151. package/lib/jsutils/printPathArray.d.ts +5 -0
  152. package/lib/jsutils/printPathArray.d.ts.map +1 -0
  153. package/lib/jsutils/printPathArray.js +13 -0
  154. package/lib/jsutils/printPathArray.mjs +6 -0
  155. package/lib/jsutils/promiseForObject.d.ts +10 -0
  156. package/lib/jsutils/promiseForObject.d.ts.map +1 -0
  157. package/lib/jsutils/promiseForObject.js +19 -0
  158. package/lib/jsutils/promiseForObject.mjs +12 -0
  159. package/lib/jsutils/promiseReduce.d.ts +10 -0
  160. package/lib/jsutils/promiseReduce.d.ts.map +1 -0
  161. package/lib/jsutils/promiseReduce.js +34 -0
  162. package/lib/jsutils/promiseReduce.mjs +11 -0
  163. package/lib/jsutils/suggestionList.d.ts +6 -0
  164. package/lib/jsutils/suggestionList.d.ts.map +1 -0
  165. package/lib/jsutils/suggestionList.js +109 -0
  166. package/lib/jsutils/suggestionList.mjs +86 -0
  167. package/lib/jsutils/toObjMap.d.ts +4 -0
  168. package/lib/jsutils/toObjMap.d.ts.map +1 -0
  169. package/lib/jsutils/toObjMap.js +20 -0
  170. package/lib/jsutils/toObjMap.mjs +13 -0
  171. package/lib/transforms/annotateDocumentGraphQLTransform.d.ts +3 -0
  172. package/lib/transforms/annotateDocumentGraphQLTransform.d.ts.map +1 -0
  173. package/lib/transforms/annotateDocumentGraphQLTransform.js +37 -0
  174. package/lib/transforms/annotateDocumentGraphQLTransform.mjs +16 -0
  175. package/lib/transforms/transformerTestUtils.d.ts +79 -0
  176. package/lib/transforms/transformerTestUtils.d.ts.map +1 -0
  177. package/lib/transforms/transformerTestUtils.js +175 -0
  178. package/lib/transforms/transformerTestUtils.mjs +154 -0
  179. package/lib/types.d.ts +74 -0
  180. package/lib/types.d.ts.map +1 -0
  181. package/lib/types.js +3 -0
  182. package/lib/types.mjs +0 -0
  183. package/lib/utilities/typeNameFromAST.d.ts +3 -0
  184. package/lib/utilities/typeNameFromAST.d.ts.map +1 -0
  185. package/lib/utilities/typeNameFromAST.js +34 -0
  186. package/lib/utilities/typeNameFromAST.mjs +11 -0
  187. package/lib/values.d.ts +64 -0
  188. package/lib/values.d.ts.map +1 -0
  189. package/lib/values.js +145 -0
  190. package/lib/values.mjs +137 -0
  191. package/package.json +9 -4
  192. package/CHANGELOG.json +0 -65
  193. package/benchmarks/fixtures/query1.graphql +0 -20
  194. package/benchmarks/index.ts +0 -68
  195. package/benchmarks/nice-benchmark.ts +0 -32
  196. package/benchmarks/swapi-schema/index.ts +0 -13
  197. package/benchmarks/swapi-schema/models.ts +0 -4
  198. package/benchmarks/swapi-schema/resolvers.ts +0 -331
  199. package/benchmarks/swapi-schema/schema.graphql +0 -164
  200. package/benchmarks/swapi-schema/starwars.json +0 -5991
  201. package/lib/index.test.mjs +0 -63
  202. package/lib/src/ast/TypedAST.d.ts.map +0 -1
  203. package/lib/src/ast/addTypesToRequestDocument.d.ts.map +0 -1
  204. package/lib/src/index.d.ts +0 -16
  205. package/lib/src/index.d.ts.map +0 -1
  206. package/lib/src/index.test.d.ts +0 -2
  207. package/lib/src/index.test.d.ts.map +0 -1
  208. package/starwars.json +0 -1
package/.eslintcache CHANGED
@@ -1 +1 @@
1
- [{"/home/runner/work/graphitation/graphitation/packages/supermassive/src/ast/TypedAST.ts":"1","/home/runner/work/graphitation/graphitation/packages/supermassive/src/ast/__tests__/addTypesToRequestDocument.test.ts":"2","/home/runner/work/graphitation/graphitation/packages/supermassive/src/ast/addTypesToRequestDocument.ts":"3","/home/runner/work/graphitation/graphitation/packages/supermassive/src/index.test.ts":"4","/home/runner/work/graphitation/graphitation/packages/supermassive/src/index.ts":"5"},{"size":14221,"mtime":1635282434567,"results":"6","hashOfConfig":"7"},{"size":5291,"mtime":1635282434567,"results":"8","hashOfConfig":"7"},{"size":2022,"mtime":1635282434567,"results":"9","hashOfConfig":"7"},{"size":756,"mtime":1635282434567,"results":"10","hashOfConfig":"7"},{"size":579,"mtime":1635282434567,"results":"11","hashOfConfig":"7"},{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1llc9j1",{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/runner/work/graphitation/graphitation/packages/supermassive/src/ast/TypedAST.ts",[],"/home/runner/work/graphitation/graphitation/packages/supermassive/src/ast/__tests__/addTypesToRequestDocument.test.ts",[],"/home/runner/work/graphitation/graphitation/packages/supermassive/src/ast/addTypesToRequestDocument.ts",[],"/home/runner/work/graphitation/graphitation/packages/supermassive/src/index.test.ts",[],"/home/runner/work/graphitation/graphitation/packages/supermassive/src/index.ts",[]]
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",[]]
package/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # Change Log - @graphitation/supermassive
2
2
 
3
- This log was last generated on Tue, 26 Oct 2021 21:09:16 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 26 Nov 2021 15:43:24 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.2.0
8
+
9
+ Fri, 26 Nov 2021 15:43:24 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Updated supermassive to be more suitable for usage (mnovikov@microsoft.com)
14
+
7
15
  ## 0.1.3
8
16
 
9
- Tue, 26 Oct 2021 21:09:16 GMT
17
+ Tue, 26 Oct 2021 21:09:29 GMT
10
18
 
11
19
  ### Patches
12
20
 
package/README.md CHANGED
@@ -3,3 +3,91 @@
3
3
  _Pack more performance into smaller space_
4
4
 
5
5
  Supermassive is lightweight schema-less GraphQL executor and query build-time compiler.
6
+
7
+ Running GraphQL executor on client can be expensive. Schema is a heavy object, typedefs, queries - it all can add up both in bundle size and performance. Supermassive aims to reduce that cost by removing the need to have a schema to run queries. It removes all runtime validation and accepts resolvers (like makeExecutableSchema resolvers) object. In addition it annotates GraphQL Documents to containt annotated type information. After that it proceeds to execute the queries without requiring actual schema. In future the plan is that GraphQL Documents are also eliminated and a inline functions are generated instead.
8
+
9
+ There are 3 main parts of supermassive - the executor, query annotator and implicit resolver extractor. Executor is the part that actually runs the queries. It takes resolvers object instead of schema and annotated documents instead of normal documents. Query annotator processes query to include type information inside them. It can be ran as part of query extraction stage in Relay Compiler or eg in `@graphitation/graphql-js-tag`. Implicit resolver extractor writes out resolvers for types that are only implicitly defined in GraphQL SDL, like Unions or Input Objects. It generates typescript file with extracted object that can be merged with the rest of the resolvers.
10
+
11
+ ## Usage
12
+
13
+ ### Executor
14
+
15
+ Two functions are provided - `executeWithSchema` and `executeWithoutSchema`. They attempt to match `graphql-js`'s `execute` function parameters. `executeWithSchema` fully matches it and is meant for development or testing. It does the transform and resolver extraction in runtime. `executeWithoutSchema` relies on those being done during compile/bundling time.
16
+
17
+ ```graphql
18
+ interface CommonExecutionArgs {
19
+ resolvers: Resolvers;
20
+ rootValue?: unknown;
21
+ contextValue?: unknown;
22
+ variableValues?: Maybe<{ [variable: string]: unknown }>;
23
+ operationName?: Maybe<string>;
24
+ fieldResolver?: Maybe<FieldResolver<any, any>>;
25
+ typeResolver?: Maybe<TypeResolver<any, any>>;
26
+ }
27
+ type ExecutionWithoutSchemaArgs = CommonExecutionArgs & {
28
+ document: DocumentNode;
29
+ };
30
+
31
+ type ExecutionWithSchemaArgs = CommonExecutionArgs & {
32
+ document: UntypedDocumentNode;
33
+ typeDefs: UntypedDocumentNode;
34
+ };
35
+
36
+ function executeWithoutSchema(args: ExecutionWithoutSchemaArgs): PromiseOrValue<ExecutionResult>
37
+
38
+ function executeWithSchema(args: ExecutionWithSchemaArgs): PromiseOrValue<ExecutionResult>
39
+ ```
40
+
41
+ ### Transform
42
+
43
+ `addTypesToRequestDocument` converts untyped graphql-js AST node into a supermassive typed one.
44
+
45
+ ```js
46
+ function addTypesToRequestDocument(
47
+ schema: GraphQLSchema,
48
+ document: TypelessAST.DocumentNode
49
+ ): TypedAST.DocumentNode
50
+ ```
51
+
52
+ With `@graphitation/graphql-js-tag` and `@graphitation/ts-transform-graphql-js-tag` (in webpack config)
53
+
54
+ ```js
55
+ import { buildASTSchema } from 'graphql'
56
+ import { getTransformer } from "@graphitation/ts-transform-graphql-js-tag";
57
+ import { annotateDocumentGraphQLTransform } from "@graphitation/supermassive";
58
+
59
+ // ...
60
+
61
+ {
62
+ test: /\.tsx?$/,
63
+ loader: "ts-loader",
64
+ options: {
65
+ getCustomTransformers: () => ({
66
+ before: [
67
+ getTransformer({
68
+ graphqlTagModuleExport: "graphql",
69
+ transformer: annotateDocumentGraphQLTransform(
70
+ buildASTSchema({
71
+ fs.readFileSync(
72
+ "PATH_TO_SCHEMA_TYPEDEFS.graphql",
73
+ { encoding: "utf-8" }
74
+ ),
75
+ )
76
+ ),
77
+ }),
78
+ ],
79
+ }),
80
+ },
81
+ },
82
+ }
83
+ ```
84
+
85
+ ### Resolver extractor
86
+
87
+ Supermassive provides a bin command to extract implicit resolvers.
88
+
89
+ ```sh
90
+ supermassive extract-schema PATH_TO_TYPEDEFS.graphql
91
+ ```
92
+
93
+ It generates `__generated__/NAME_OF_TYPEDEFS.ts` file, on top of which user provided resolvers can be merged when executing.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ (function () {
4
+ require("../lib/bin/supermassive").supermassive().parseAsync(process.argv);
5
+ })();
@@ -5,6 +5,7 @@
5
5
  *
6
6
  * Our changes MUST be annotated inline for ease of future merging.
7
7
  */
8
+ import { Maybe } from "../jsutils/Maybe";
8
9
  /**
9
10
  * [SUPERMASSIVE]
10
11
  *
@@ -116,6 +117,7 @@ export interface FieldNode {
116
117
  }
117
118
  export interface ArgumentNode {
118
119
  readonly __type: TypeNode;
120
+ readonly __defaultValue: Maybe<ValueNode>;
119
121
  readonly kind: "Argument";
120
122
  readonly loc?: Location;
121
123
  readonly name: NameNode;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypedAST.d.ts","sourceRoot":"","sources":["../../src/ast/TypedAST.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC;;;;GAIG;AACH,aAAK,QAAQ,GAAG,OAAO,CAAC;AAExB;;GAEG;AACH,oBAAY,OAAO,GACf,QAAQ,GACR,YAAY,GACZ,uBAAuB,GACvB,sBAAsB,GACtB,YAAY,GACZ,gBAAgB,GAChB,SAAS,GACT,YAAY,GACZ,kBAAkB,GAClB,kBAAkB,GAClB,sBAAsB,GACtB,YAAY,GACZ,cAAc,GACd,eAAe,GACf,gBAAgB,GAChB,aAAa,GACb,aAAa,GACb,aAAa,GACb,eAAe,GACf,eAAe,GACf,aAAa,GACb,aAAa,GACb,YAAY,GACZ,eAAe,GACf,oBAAoB,GACpB,2BAA2B,GAC3B,wBAAwB,GACxB,wBAAwB,GACxB,mBAAmB,GACnB,wBAAwB,GACxB,2BAA2B,GAC3B,uBAAuB,GACvB,sBAAsB,GACtB,uBAAuB,GACvB,6BAA6B,GAC7B,uBAAuB,GACvB,mBAAmB,GACnB,uBAAuB,GACvB,uBAAuB,GACvB,0BAA0B,GAC1B,sBAAsB,GACtB,q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AAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IACnD,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;CAC1D;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,EAAE,0BAA0B,CAAC;IAC1C,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IACnD,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,wBAAwB,CAAC,CAAC;CAC3D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addTypesToRequestDocument.d.ts","sourceRoot":"","sources":["../../src/ast/addTypesToRequestDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EASd,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,cAAc,YAAY,CAAC;AAE3B,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,WAAW,CAAC,YAAY,GACjC,QAAQ,CAAC,YAAY,CAsCvB"}
@@ -45,11 +45,14 @@ function addTypesToRequestDocument(schema, document) {
45
45
  return (0, import_graphql.visit)(document, (0, import_graphql.visitWithTypeInfo)(typeInfo, {
46
46
  Argument(node) {
47
47
  const argument = typeInfo.getArgument();
48
- const typeNode = generateTypeNode(argument.type);
49
- const newNode = __objSpread(__objSpread({}, node), {
50
- __type: typeNode
51
- });
52
- return newNode;
48
+ if (argument) {
49
+ const typeNode = generateTypeNode(argument.type);
50
+ const newNode = __objSpread(__objSpread({}, node), {
51
+ __type: typeNode,
52
+ __defaultValue: argument.defaultValue ? (0, import_graphql.parseValue)(JSON.stringify(argument.defaultValue)) : void 0
53
+ });
54
+ return newNode;
55
+ }
53
56
  },
54
57
  Field(node) {
55
58
  const type = typeInfo.getType();
@@ -18,6 +18,7 @@ import {
18
18
  isListType,
19
19
  isNamedType,
20
20
  isNonNullType,
21
+ parseValue,
21
22
  TypeInfo,
22
23
  visit,
23
24
  visitWithTypeInfo
@@ -28,11 +29,14 @@ function addTypesToRequestDocument(schema, document) {
28
29
  return visit(document, visitWithTypeInfo(typeInfo, {
29
30
  Argument(node) {
30
31
  const argument = typeInfo.getArgument();
31
- const typeNode = generateTypeNode(argument.type);
32
- const newNode = __objSpread(__objSpread({}, node), {
33
- __type: typeNode
34
- });
35
- return newNode;
32
+ if (argument) {
33
+ const typeNode = generateTypeNode(argument.type);
34
+ const newNode = __objSpread(__objSpread({}, node), {
35
+ __type: typeNode,
36
+ __defaultValue: argument.defaultValue ? parseValue(JSON.stringify(argument.defaultValue)) : void 0
37
+ });
38
+ return newNode;
39
+ }
36
40
  },
37
41
  Field(node) {
38
42
  const type = typeInfo.getType();
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../benchmarks/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/benchmarks/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,127 @@
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 __reExport = (target, module2, desc) => {
9
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
10
+ for (let key of __getOwnPropNames(module2))
11
+ if (!__hasOwnProp.call(target, key) && key !== "default")
12
+ __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
13
+ }
14
+ return target;
15
+ };
16
+ var __toModule = (module2) => {
17
+ 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);
18
+ };
19
+ var __async = (__this, __arguments, generator) => {
20
+ return new Promise((resolve, reject) => {
21
+ var fulfilled = (value) => {
22
+ try {
23
+ step(generator.next(value));
24
+ } catch (e) {
25
+ reject(e);
26
+ }
27
+ };
28
+ var rejected = (value) => {
29
+ try {
30
+ step(generator.throw(value));
31
+ } catch (e) {
32
+ reject(e);
33
+ }
34
+ };
35
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
36
+ step((generator = generator.apply(__this, __arguments)).next());
37
+ });
38
+ };
39
+ var import_fs = __toModule(require("fs"));
40
+ var import_path = __toModule(require("path"));
41
+ var import_nice_benchmark = __toModule(require("./nice-benchmark"));
42
+ var import_swapi_schema = __toModule(require("./swapi-schema"));
43
+ var import_resolvers = __toModule(require("./swapi-schema/resolvers"));
44
+ var import_models = __toModule(require("./swapi-schema/models"));
45
+ var import_graphql = __toModule(require("graphql"));
46
+ var import_graphql_jit = __toModule(require("graphql-jit"));
47
+ var import_executeWithoutSchema = __toModule(require("../executeWithoutSchema"));
48
+ var import_addTypesToRequestDocument = __toModule(require("../ast/addTypesToRequestDocument"));
49
+ const query = import_fs.default.readFileSync(import_path.default.join(__dirname, "./fixtures/query1.graphql"), {
50
+ encoding: "utf-8"
51
+ });
52
+ const parsedQuery = (0, import_graphql.parse)(query);
53
+ const compiledQuery = (0, import_graphql_jit.compileQuery)(import_swapi_schema.default, parsedQuery);
54
+ const typeAnnotatedQuery = (0, import_addTypesToRequestDocument.addTypesToRequestDocument)(import_swapi_schema.default, parsedQuery);
55
+ const queryRunningSuite = new import_nice_benchmark.default("Query Running");
56
+ queryRunningSuite.add("graphql-js - string queries", () => __async(void 0, null, function* () {
57
+ const result = yield (0, import_graphql.graphql)({
58
+ schema: import_swapi_schema.default,
59
+ source: query,
60
+ contextValue: {models: import_models.default}
61
+ });
62
+ if (result.errors || !result.data) {
63
+ throw new Error("Stuff ain't executing");
64
+ }
65
+ }));
66
+ queryRunningSuite.add("graphql-js - parsed queries", () => __async(void 0, null, function* () {
67
+ const result = yield (0, import_graphql.execute)({
68
+ schema: import_swapi_schema.default,
69
+ document: parsedQuery,
70
+ contextValue: {models: import_models.default}
71
+ });
72
+ if (result.errors || !result.data) {
73
+ throw new Error("Stuff ain't executing");
74
+ }
75
+ }));
76
+ queryRunningSuite.add("graphql-jit - uncompiled", () => __async(void 0, null, function* () {
77
+ const freshCompiledQuery = (0, import_graphql_jit.compileQuery)(import_swapi_schema.default, parsedQuery);
78
+ if ((0, import_graphql_jit.isCompiledQuery)(freshCompiledQuery)) {
79
+ const result = yield freshCompiledQuery.query({}, {models: import_models.default}, {});
80
+ if (result.errors || !result.data) {
81
+ throw new Error("Stuff ain't executing");
82
+ }
83
+ } else {
84
+ throw new Error("Wrong query");
85
+ }
86
+ }));
87
+ queryRunningSuite.add("graphql-jit - precompiled", () => __async(void 0, null, function* () {
88
+ if ((0, import_graphql_jit.isCompiledQuery)(compiledQuery)) {
89
+ const result = yield compiledQuery.query({}, {models: import_models.default}, {});
90
+ if (result.errors || !result.data) {
91
+ throw new Error("Stuff ain't executing");
92
+ }
93
+ } else {
94
+ throw new Error("Wrong query");
95
+ }
96
+ }));
97
+ queryRunningSuite.add("supermassive - runtime schemaless", () => __async(void 0, null, function* () {
98
+ const result = yield (0, import_executeWithoutSchema.executeWithoutSchema)({
99
+ resolvers: import_resolvers.default,
100
+ document: typeAnnotatedQuery,
101
+ contextValue: {models: import_models.default}
102
+ });
103
+ if (result.errors || !result.data) {
104
+ throw new Error("Stuff ain't executing");
105
+ }
106
+ }));
107
+ const queryParsingSuite = new import_nice_benchmark.default("Query parsing");
108
+ queryParsingSuite.add("graphql-js", () => __async(void 0, null, function* () {
109
+ (0, import_graphql.parse)(query);
110
+ }));
111
+ const queryCompilingSuite = new import_nice_benchmark.default("Query compiling");
112
+ queryCompilingSuite.add("graphql-jit", () => __async(void 0, null, function* () {
113
+ yield (0, import_graphql_jit.compileQuery)(import_swapi_schema.default, parsedQuery);
114
+ }));
115
+ const queryAnnotationSuite = new import_nice_benchmark.default("Query annotation");
116
+ queryAnnotationSuite.add("supermassive", () => {
117
+ (0, import_addTypesToRequestDocument.addTypesToRequestDocument)(import_swapi_schema.default, parsedQuery);
118
+ });
119
+ function main() {
120
+ return __async(this, null, function* () {
121
+ yield queryCompilingSuite.run();
122
+ yield queryParsingSuite.run();
123
+ yield queryAnnotationSuite.run();
124
+ yield queryRunningSuite.run();
125
+ });
126
+ }
127
+ main();
@@ -0,0 +1,109 @@
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 fs from "fs";
22
+ import path from "path";
23
+ import NiceBenchmark from "./nice-benchmark";
24
+ import schema from "./swapi-schema";
25
+ import resolvers from "./swapi-schema/resolvers";
26
+ import models from "./swapi-schema/models";
27
+ import {graphql, execute as graphqlExecute, parse} from "graphql";
28
+ import {compileQuery, isCompiledQuery} from "graphql-jit";
29
+ import {executeWithoutSchema as supermassiveExecute} from "../executeWithoutSchema";
30
+ import {addTypesToRequestDocument} from "../ast/addTypesToRequestDocument";
31
+ const query = fs.readFileSync(path.join(__dirname, "./fixtures/query1.graphql"), {
32
+ encoding: "utf-8"
33
+ });
34
+ const parsedQuery = parse(query);
35
+ const compiledQuery = compileQuery(schema, parsedQuery);
36
+ const typeAnnotatedQuery = addTypesToRequestDocument(schema, parsedQuery);
37
+ const queryRunningSuite = new NiceBenchmark("Query Running");
38
+ queryRunningSuite.add("graphql-js - string queries", () => __async(void 0, null, function* () {
39
+ const result = yield graphql({
40
+ schema,
41
+ source: query,
42
+ contextValue: {models}
43
+ });
44
+ if (result.errors || !result.data) {
45
+ throw new Error("Stuff ain't executing");
46
+ }
47
+ }));
48
+ queryRunningSuite.add("graphql-js - parsed queries", () => __async(void 0, null, function* () {
49
+ const result = yield graphqlExecute({
50
+ schema,
51
+ document: parsedQuery,
52
+ contextValue: {models}
53
+ });
54
+ if (result.errors || !result.data) {
55
+ throw new Error("Stuff ain't executing");
56
+ }
57
+ }));
58
+ queryRunningSuite.add("graphql-jit - uncompiled", () => __async(void 0, null, function* () {
59
+ const freshCompiledQuery = compileQuery(schema, parsedQuery);
60
+ if (isCompiledQuery(freshCompiledQuery)) {
61
+ const result = yield freshCompiledQuery.query({}, {models}, {});
62
+ if (result.errors || !result.data) {
63
+ throw new Error("Stuff ain't executing");
64
+ }
65
+ } else {
66
+ throw new Error("Wrong query");
67
+ }
68
+ }));
69
+ queryRunningSuite.add("graphql-jit - precompiled", () => __async(void 0, null, function* () {
70
+ if (isCompiledQuery(compiledQuery)) {
71
+ const result = yield compiledQuery.query({}, {models}, {});
72
+ if (result.errors || !result.data) {
73
+ throw new Error("Stuff ain't executing");
74
+ }
75
+ } else {
76
+ throw new Error("Wrong query");
77
+ }
78
+ }));
79
+ queryRunningSuite.add("supermassive - runtime schemaless", () => __async(void 0, null, function* () {
80
+ const result = yield supermassiveExecute({
81
+ resolvers,
82
+ document: typeAnnotatedQuery,
83
+ contextValue: {models}
84
+ });
85
+ if (result.errors || !result.data) {
86
+ throw new Error("Stuff ain't executing");
87
+ }
88
+ }));
89
+ const queryParsingSuite = new NiceBenchmark("Query parsing");
90
+ queryParsingSuite.add("graphql-js", () => __async(void 0, null, function* () {
91
+ parse(query);
92
+ }));
93
+ const queryCompilingSuite = new NiceBenchmark("Query compiling");
94
+ queryCompilingSuite.add("graphql-jit", () => __async(void 0, null, function* () {
95
+ yield compileQuery(schema, parsedQuery);
96
+ }));
97
+ const queryAnnotationSuite = new NiceBenchmark("Query annotation");
98
+ queryAnnotationSuite.add("supermassive", () => {
99
+ addTypesToRequestDocument(schema, parsedQuery);
100
+ });
101
+ function main() {
102
+ return __async(this, null, function* () {
103
+ yield queryCompilingSuite.run();
104
+ yield queryParsingSuite.run();
105
+ yield queryAnnotationSuite.run();
106
+ yield queryRunningSuite.run();
107
+ });
108
+ }
109
+ main();
@@ -2,7 +2,7 @@ export default class NiceBenchmark {
2
2
  private name;
3
3
  private suite;
4
4
  constructor(name: string);
5
- add(name: string, fn: () => Promise<any>): void;
5
+ add(name: string, fn: () => Promise<void> | void): void;
6
6
  run(options?: any): Promise<any>;
7
7
  }
8
8
  //# sourceMappingURL=nice-benchmark.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nice-benchmark.d.ts","sourceRoot":"","sources":["../../benchmarks/nice-benchmark.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,KAAK,CAAQ;gBAET,IAAI,EAAE,MAAM;IAQxB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC;IAUxC,GAAG,CAAC,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;CAOjC"}
1
+ {"version":3,"file":"nice-benchmark.d.ts","sourceRoot":"","sources":["../../src/benchmarks/nice-benchmark.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,KAAK,CAAQ;gBAET,IAAI,EAAE,MAAM;IAQxB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAUhD,GAAG,CAAC,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;CAOjC"}
@@ -0,0 +1,72 @@
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
+ default: () => NiceBenchmark
46
+ });
47
+ var import_benchmark = __toModule(require("benchmark"));
48
+ class NiceBenchmark {
49
+ constructor(name) {
50
+ this.name = name;
51
+ this.suite = new import_benchmark.Suite(name);
52
+ this.suite.on("cycle", function(event) {
53
+ console.log(String(event.target));
54
+ });
55
+ }
56
+ add(name, fn) {
57
+ this.suite.add(name, {
58
+ defer: true,
59
+ fn: (deferred) => __async(this, null, function* () {
60
+ yield fn();
61
+ deferred.resolve();
62
+ })
63
+ });
64
+ }
65
+ run(options) {
66
+ return new Promise((resolve) => {
67
+ this.suite.on("complete", resolve);
68
+ console.log(this.name);
69
+ this.suite.run(options);
70
+ });
71
+ }
72
+ }