@graphitation/supermassive 3.0.0-alpha.3 → 3.0.0-alpha.4

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 (133) hide show
  1. package/.eslintcache +1 -1
  2. package/CHANGELOG.md +10 -2
  3. package/lib/__testUtils__/execute.d.ts.map +1 -1
  4. package/lib/__testUtils__/execute.js +15 -8
  5. package/lib/__testUtils__/execute.js.map +2 -2
  6. package/lib/__testUtils__/execute.mjs +15 -8
  7. package/lib/__testUtils__/execute.mjs.map +2 -2
  8. package/lib/__testUtils__/gql.d.ts +7 -0
  9. package/lib/__testUtils__/gql.d.ts.map +1 -0
  10. package/lib/{utilities/getSchemaFragment.js → __testUtils__/gql.js} +6 -17
  11. package/lib/__testUtils__/gql.js.map +7 -0
  12. package/lib/__testUtils__/gql.mjs +8 -0
  13. package/lib/__testUtils__/gql.mjs.map +7 -0
  14. package/lib/benchmarks/index.js +8 -4
  15. package/lib/benchmarks/index.js.map +3 -3
  16. package/lib/benchmarks/index.mjs +7 -3
  17. package/lib/benchmarks/index.mjs.map +2 -2
  18. package/lib/collectFields.js +2 -2
  19. package/lib/collectFields.js.map +1 -1
  20. package/lib/collectFields.mjs +2 -2
  21. package/lib/collectFields.mjs.map +1 -1
  22. package/lib/executeWithSchema.d.ts +1 -1
  23. package/lib/executeWithSchema.d.ts.map +1 -1
  24. package/lib/executeWithSchema.js +24 -8
  25. package/lib/executeWithSchema.js.map +2 -2
  26. package/lib/executeWithSchema.mjs +27 -8
  27. package/lib/executeWithSchema.mjs.map +2 -2
  28. package/lib/executeWithoutSchema.d.ts +7 -3
  29. package/lib/executeWithoutSchema.d.ts.map +1 -1
  30. package/lib/executeWithoutSchema.js +100 -73
  31. package/lib/executeWithoutSchema.js.map +3 -3
  32. package/lib/executeWithoutSchema.mjs +104 -76
  33. package/lib/executeWithoutSchema.mjs.map +3 -3
  34. package/lib/index.d.ts +15 -3
  35. package/lib/index.d.ts.map +1 -1
  36. package/lib/index.js +24 -4
  37. package/lib/index.js.map +2 -2
  38. package/lib/index.mjs +34 -3
  39. package/lib/index.mjs.map +2 -2
  40. package/lib/schema/definition.d.ts +6 -1
  41. package/lib/schema/definition.d.ts.map +1 -1
  42. package/lib/schema/definition.js.map +1 -1
  43. package/lib/schema/definition.mjs.map +1 -1
  44. package/lib/schema/directives.d.ts +2 -1
  45. package/lib/schema/directives.d.ts.map +1 -1
  46. package/lib/schema/directives.js +8 -3
  47. package/lib/schema/directives.js.map +2 -2
  48. package/lib/schema/directives.mjs +8 -3
  49. package/lib/schema/directives.mjs.map +2 -2
  50. package/lib/schema/fragment.d.ts +29 -7
  51. package/lib/schema/fragment.d.ts.map +1 -1
  52. package/lib/schema/fragment.js +55 -30
  53. package/lib/schema/fragment.js.map +2 -2
  54. package/lib/schema/fragment.mjs +55 -30
  55. package/lib/schema/fragment.mjs.map +2 -2
  56. package/lib/subscribeWithSchema.d.ts +1 -1
  57. package/lib/subscribeWithSchema.d.ts.map +1 -1
  58. package/lib/subscribeWithSchema.js +24 -8
  59. package/lib/subscribeWithSchema.js.map +2 -2
  60. package/lib/subscribeWithSchema.mjs +27 -8
  61. package/lib/subscribeWithSchema.mjs.map +2 -2
  62. package/lib/types.d.ts +9 -6
  63. package/lib/types.d.ts.map +1 -1
  64. package/lib/types.js +0 -14
  65. package/lib/types.js.map +2 -2
  66. package/lib/types.mjs +0 -11
  67. package/lib/types.mjs.map +3 -3
  68. package/lib/utilities/addMinimalViableSchemaToRequestDocument.d.ts +8 -5
  69. package/lib/utilities/addMinimalViableSchemaToRequestDocument.d.ts.map +1 -1
  70. package/lib/utilities/addMinimalViableSchemaToRequestDocument.js +35 -222
  71. package/lib/utilities/addMinimalViableSchemaToRequestDocument.js.map +3 -3
  72. package/lib/utilities/addMinimalViableSchemaToRequestDocument.mjs +37 -249
  73. package/lib/utilities/addMinimalViableSchemaToRequestDocument.mjs.map +3 -3
  74. package/lib/utilities/annotateDocumentGraphQLTransform.d.ts +2 -1
  75. package/lib/utilities/annotateDocumentGraphQLTransform.d.ts.map +1 -1
  76. package/lib/utilities/annotateDocumentGraphQLTransform.js +2 -9
  77. package/lib/utilities/annotateDocumentGraphQLTransform.js.map +2 -2
  78. package/lib/utilities/annotateDocumentGraphQLTransform.mjs +4 -11
  79. package/lib/utilities/annotateDocumentGraphQLTransform.mjs.map +2 -2
  80. package/lib/utilities/coerceInputValue.d.ts +2 -2
  81. package/lib/utilities/coerceInputValue.d.ts.map +1 -1
  82. package/lib/utilities/coerceInputValue.js.map +1 -1
  83. package/lib/utilities/coerceInputValue.mjs.map +1 -1
  84. package/lib/utilities/decodeASTSchema.d.ts +2 -2
  85. package/lib/utilities/decodeASTSchema.d.ts.map +1 -1
  86. package/lib/utilities/decodeASTSchema.js +8 -5
  87. package/lib/utilities/decodeASTSchema.js.map +2 -2
  88. package/lib/utilities/decodeASTSchema.mjs +8 -5
  89. package/lib/utilities/decodeASTSchema.mjs.map +2 -2
  90. package/lib/utilities/encodeASTSchema.d.ts +2 -2
  91. package/lib/utilities/encodeASTSchema.d.ts.map +1 -1
  92. package/lib/utilities/encodeASTSchema.js +39 -10
  93. package/lib/utilities/encodeASTSchema.js.map +2 -2
  94. package/lib/utilities/encodeASTSchema.mjs +39 -10
  95. package/lib/utilities/encodeASTSchema.mjs.map +2 -2
  96. package/lib/utilities/extractMinimalViableSchemaForRequestDocument.d.ts +8 -0
  97. package/lib/utilities/extractMinimalViableSchemaForRequestDocument.d.ts.map +1 -0
  98. package/lib/utilities/extractMinimalViableSchemaForRequestDocument.js +238 -0
  99. package/lib/utilities/extractMinimalViableSchemaForRequestDocument.js.map +7 -0
  100. package/lib/utilities/extractMinimalViableSchemaForRequestDocument.mjs +245 -0
  101. package/lib/utilities/extractMinimalViableSchemaForRequestDocument.mjs.map +7 -0
  102. package/lib/utilities/mergeResolvers.d.ts +2 -2
  103. package/lib/utilities/mergeResolvers.d.ts.map +1 -1
  104. package/lib/utilities/mergeResolvers.js +20 -22
  105. package/lib/utilities/mergeResolvers.js.map +2 -2
  106. package/lib/utilities/mergeResolvers.mjs +20 -25
  107. package/lib/utilities/mergeResolvers.mjs.map +2 -2
  108. package/lib/utilities/mergeSchemaDefinitions.d.ts +8 -0
  109. package/lib/utilities/mergeSchemaDefinitions.d.ts.map +1 -0
  110. package/lib/utilities/{mergeDefinitions.js → mergeSchemaDefinitions.js} +13 -13
  111. package/lib/utilities/mergeSchemaDefinitions.js.map +7 -0
  112. package/lib/utilities/{mergeDefinitions.mjs → mergeSchemaDefinitions.mjs} +11 -11
  113. package/lib/utilities/mergeSchemaDefinitions.mjs.map +7 -0
  114. package/lib/utilities/valueFromAST.d.ts +2 -2
  115. package/lib/utilities/valueFromAST.d.ts.map +1 -1
  116. package/lib/utilities/valueFromAST.js.map +1 -1
  117. package/lib/utilities/valueFromAST.mjs.map +1 -1
  118. package/lib/values.d.ts +2 -2
  119. package/lib/values.d.ts.map +1 -1
  120. package/lib/values.js +2 -2
  121. package/lib/values.js.map +1 -1
  122. package/lib/values.mjs +2 -2
  123. package/lib/values.mjs.map +1 -1
  124. package/package.json +1 -1
  125. package/lib/utilities/getSchemaFragment.d.ts +0 -4
  126. package/lib/utilities/getSchemaFragment.d.ts.map +0 -1
  127. package/lib/utilities/getSchemaFragment.js.map +0 -7
  128. package/lib/utilities/getSchemaFragment.mjs +0 -22
  129. package/lib/utilities/getSchemaFragment.mjs.map +0 -7
  130. package/lib/utilities/mergeDefinitions.d.ts +0 -8
  131. package/lib/utilities/mergeDefinitions.d.ts.map +0 -1
  132. package/lib/utilities/mergeDefinitions.js.map +0 -7
  133. package/lib/utilities/mergeDefinitions.mjs.map +0 -7
package/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # Change Log - @graphitation/supermassive
2
2
 
3
- This log was last generated on Tue, 29 Aug 2023 15:06:31 GMT and should not be manually modified.
3
+ This log was last generated on Sun, 10 Sep 2023 20:58:42 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 3.0.0-alpha.4
8
+
9
+ Sun, 10 Sep 2023 20:58:42 GMT
10
+
11
+ ### Changes
12
+
13
+ - Schema fragment loader (vladimir.razuvaev@gmail.com)
14
+
7
15
  ## 3.0.0-alpha.3
8
16
 
9
- Tue, 29 Aug 2023 15:06:31 GMT
17
+ Tue, 29 Aug 2023 15:06:36 GMT
10
18
 
11
19
  ### Changes
12
20
 
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/__testUtils__/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAKb,aAAa,EACb,aAAa,IAAI,oBAAoB,EACrC,eAAe,IAAI,sBAAsB,EAC1C,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAE,eAAe,EAAiB,MAAM,UAAU,CAAC;AAK1D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,KAAK,aAAa,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,IACrE,sBAAsB,CAAC,KAAK,EAAE,WAAW,CAAC,GAC1C,cAAc,CAAC,sBAAsB,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAE3E,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,cAAc,CAAC,eAAe,CAAC,EACxE,gBAAgB,EAAE,CAChB,IAAI,EAAE,aAAa,KAChB,cAAc,CACjB,cAAc,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,eAAe,CAC9D;oEAkCS,aAAa,SACd,MAAM,cACF,OAAO,MAAM,EAAE,OAAO,CAAC;iDAjC1B,aAAa,SACd,MAAM,cACD,OAAO,MAAM,EAAE,OAAO,CAAC;6BA8F3B,eAAe,GAAG,aAAa,KACtC,QAAQ,OAAO,CAAC;sCAhCX,oBAAoB,KACzB,eAAe,aAAa,CAAC;EA8DjC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/__testUtils__/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAKb,aAAa,EACb,aAAa,IAAI,oBAAoB,EACrC,eAAe,IAAI,sBAAsB,EAC1C,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAE,eAAe,EAAiB,MAAM,UAAU,CAAC;AAI1D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,KAAK,aAAa,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,IACrE,sBAAsB,CAAC,KAAK,EAAE,WAAW,CAAC,GAC1C,cAAc,CAAC,sBAAsB,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAE3E,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,cAAc,CAAC,eAAe,CAAC,EACxE,gBAAgB,EAAE,CAChB,IAAI,EAAE,aAAa,KAChB,cAAc,CACjB,cAAc,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,eAAe,CAC9D;oEAqCS,aAAa,SACd,MAAM,cACF,OAAO,MAAM,EAAE,OAAO,CAAC;iDApC1B,aAAa,SACd,MAAM,cACD,OAAO,MAAM,EAAE,OAAO,CAAC;6BAqG3B,eAAe,GAAG,aAAa,KACtC,QAAQ,OAAO,CAAC;sCAhCX,oBAAoB,KACzB,eAAe,aAAa,CAAC;EA8DjC"}
@@ -74,7 +74,7 @@ var import_swapi_schema = require("../benchmarks/swapi-schema");
74
74
  var import_resolvers = __toESM(require("../benchmarks/swapi-schema/resolvers"));
75
75
  var import_models = __toESM(require("../benchmarks/swapi-schema/models"));
76
76
  var import_executeWithoutSchema = require("../executeWithoutSchema");
77
- var import_addMinimalViableSchemaToRequestDocument = require("../utilities/addMinimalViableSchemaToRequestDocument");
77
+ var import_extractMinimalViableSchemaForRequestDocument = require("../utilities/extractMinimalViableSchemaForRequestDocument");
78
78
  var import_iterall = require("iterall");
79
79
  function createExecutionUtils(graphqlExecute, graphqlSubscribe) {
80
80
  function compareResultsForExecuteWithSchema(schema, query, variables) {
@@ -83,9 +83,12 @@ function createExecutionUtils(graphqlExecute, graphqlSubscribe) {
83
83
  const document = (0, import_graphql.parse)(query);
84
84
  const result = yield drainExecution(
85
85
  yield (0, import_executeWithSchema.executeWithSchema)({
86
- typeDefs: import_swapi_schema.typeDefs,
87
- resolvers: import_resolvers.default,
88
86
  document,
87
+ schema: {
88
+ schemaId: "test",
89
+ definitions: import_swapi_schema.typeDefs,
90
+ resolvers: import_resolvers.default
91
+ },
89
92
  contextValue: {
90
93
  models: import_models.default
91
94
  },
@@ -109,17 +112,21 @@ function createExecutionUtils(graphqlExecute, graphqlSubscribe) {
109
112
  return __async(this, arguments, function* (schema, query, variables = {}) {
110
113
  expect.assertions(1);
111
114
  const document = (0, import_graphql.parse)(query);
115
+ const { definitions } = (0, import_extractMinimalViableSchemaForRequestDocument.extractMinimalViableSchemaForRequestDocument)(
116
+ schema,
117
+ document
118
+ );
112
119
  const result = yield drainExecution(
113
120
  yield (0, import_executeWithoutSchema.executeWithoutSchema)({
114
121
  document,
115
122
  contextValue: {
116
123
  models: import_models.default
117
124
  },
118
- resolvers: import_resolvers.default,
119
- schemaFragment: (0, import_addMinimalViableSchemaToRequestDocument.extractMinimalViableSchemaForRequestDocument)(
120
- schema,
121
- document
122
- ),
125
+ schemaFragment: {
126
+ schemaId: "test",
127
+ definitions,
128
+ resolvers: import_resolvers.default
129
+ },
123
130
  variableValues: variables
124
131
  })
125
132
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/__testUtils__/execute.ts"],
4
- "sourcesContent": ["import {\n DocumentNode,\n GraphQLSchema,\n Kind,\n OperationDefinitionNode,\n OperationTypeNode,\n parse,\n ExecutionArgs,\n ExecutionArgs as GraphQLExecutionArgs,\n ExecutionResult as GraphQLExecutionResult,\n} from \"graphql\";\nimport { executeWithSchema } from \"../executeWithSchema\";\nimport { typeDefs } from \"../benchmarks/swapi-schema\";\nimport resolvers from \"../benchmarks/swapi-schema/resolvers\";\nimport { ExecutionResult, UserResolvers } from \"../types\";\nimport models from \"../benchmarks/swapi-schema/models\";\nimport { executeWithoutSchema } from \"../executeWithoutSchema\";\nimport { extractMinimalViableSchemaForRequestDocument } from \"../utilities/addMinimalViableSchemaToRequestDocument\";\nimport {} from \"graphql/execution/execute\";\nimport { PromiseOrValue } from \"graphql/jsutils/PromiseOrValue\";\nimport { ObjMap } from \"../jsutils/ObjMap\";\nimport { forAwaitEach, isAsyncIterable } from \"iterall\";\n\ntype GraphQLResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> =\n | GraphQLExecutionResult<TData, TExtensions>\n | AsyncGenerator<GraphQLExecutionResult<TData, TExtensions>, void, void>;\n\nexport function createExecutionUtils(\n graphqlExecute: (args: ExecutionArgs) => PromiseOrValue<ExecutionResult>,\n graphqlSubscribe: (\n args: ExecutionArgs,\n ) => PromiseOrValue<\n AsyncGenerator<ExecutionResult, void, void> | ExecutionResult\n >,\n) {\n async function compareResultsForExecuteWithSchema(\n schema: GraphQLSchema,\n query: string,\n variables?: Record<string, unknown>,\n ) {\n expect.assertions(1);\n const document = parse(query);\n const result = await drainExecution(\n await executeWithSchema({\n typeDefs,\n resolvers: resolvers as UserResolvers<unknown, unknown>,\n document,\n contextValue: {\n models,\n },\n variableValues: variables,\n }),\n );\n const validResult = await drainExecution(\n await graphqlExecuteOrSubscribe({\n document,\n contextValue: {\n models,\n },\n schema,\n variableValues: variables,\n }),\n );\n expect(result).toEqual(validResult);\n }\n\n async function compareResultForExecuteWithoutSchemaWithMVSAnnotation(\n schema: GraphQLSchema,\n query: string,\n variables: Record<string, unknown> = {},\n ) {\n expect.assertions(1);\n const document = parse(query);\n const result = await drainExecution(\n await executeWithoutSchema({\n document,\n contextValue: {\n models,\n },\n resolvers: resolvers as UserResolvers,\n schemaFragment: extractMinimalViableSchemaForRequestDocument(\n schema,\n document,\n ),\n variableValues: variables,\n }),\n );\n const validResult = await drainExecution(\n await graphqlExecuteOrSubscribe({\n document,\n contextValue: {\n models,\n },\n schema,\n variableValues: variables,\n }),\n );\n expect(result).toEqual(validResult);\n }\n\n function graphqlExecuteOrSubscribe(\n args: GraphQLExecutionArgs,\n ): PromiseOrValue<GraphQLResult> {\n const operationName = args.operationName;\n let operation: OperationDefinitionNode | undefined;\n for (const definition of (args.document as unknown as DocumentNode)\n .definitions) {\n switch (definition.kind) {\n case Kind.OPERATION_DEFINITION:\n if (operationName == null) {\n if (operation !== undefined) {\n throw new Error(\"Bad operation in test\");\n }\n operation = definition;\n } else if (definition.name?.value === operationName) {\n operation = definition;\n }\n break;\n }\n }\n if (!operation) {\n throw new Error(\"Bad operation in test\");\n }\n\n if (operation.operation === OperationTypeNode.SUBSCRIPTION) {\n return graphqlSubscribe(args) as GraphQLResult;\n } else {\n return graphqlExecute(args) as GraphQLResult;\n }\n }\n\n async function drainExecution(\n result: ExecutionResult | GraphQLResult,\n ): Promise<unknown> {\n let processedResult;\n if (isAsyncIterable(result)) {\n processedResult = await drainAsyncGeneratorToArray(result);\n } else if (\"subsequentResults\" in result) {\n processedResult = {\n ...result,\n subsequentResults: await drainAsyncGeneratorToArray(\n result.subsequentResults,\n ),\n };\n } else {\n processedResult = result;\n }\n return processedResult;\n }\n\n async function drainAsyncGeneratorToArray<T>(\n collection: AsyncGenerator<T, void, void>,\n ): Promise<T[]> {\n const result: T[] = [];\n await forAwaitEach(collection, (item) => result.push(item));\n return result;\n }\n\n return {\n compareResultForExecuteWithoutSchemaWithMVSAnnotation,\n compareResultsForExecuteWithSchema,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;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import {\n DocumentNode,\n GraphQLSchema,\n Kind,\n OperationDefinitionNode,\n OperationTypeNode,\n parse,\n ExecutionArgs,\n ExecutionArgs as GraphQLExecutionArgs,\n ExecutionResult as GraphQLExecutionResult,\n} from \"graphql\";\nimport { executeWithSchema } from \"../executeWithSchema\";\nimport { typeDefs } from \"../benchmarks/swapi-schema\";\nimport resolvers from \"../benchmarks/swapi-schema/resolvers\";\nimport { ExecutionResult, UserResolvers } from \"../types\";\nimport models from \"../benchmarks/swapi-schema/models\";\nimport { executeWithoutSchema } from \"../executeWithoutSchema\";\nimport { extractMinimalViableSchemaForRequestDocument } from \"../utilities/extractMinimalViableSchemaForRequestDocument\";\nimport { PromiseOrValue } from \"graphql/jsutils/PromiseOrValue\";\nimport { ObjMap } from \"../jsutils/ObjMap\";\nimport { forAwaitEach, isAsyncIterable } from \"iterall\";\n\ntype GraphQLResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> =\n | GraphQLExecutionResult<TData, TExtensions>\n | AsyncGenerator<GraphQLExecutionResult<TData, TExtensions>, void, void>;\n\nexport function createExecutionUtils(\n graphqlExecute: (args: ExecutionArgs) => PromiseOrValue<ExecutionResult>,\n graphqlSubscribe: (\n args: ExecutionArgs,\n ) => PromiseOrValue<\n AsyncGenerator<ExecutionResult, void, void> | ExecutionResult\n >,\n) {\n async function compareResultsForExecuteWithSchema(\n schema: GraphQLSchema,\n query: string,\n variables?: Record<string, unknown>,\n ) {\n expect.assertions(1);\n const document = parse(query);\n const result = await drainExecution(\n await executeWithSchema({\n document,\n schema: {\n schemaId: \"test\",\n definitions: typeDefs,\n resolvers: resolvers as UserResolvers<unknown, unknown>,\n },\n contextValue: {\n models,\n },\n variableValues: variables,\n }),\n );\n const validResult = await drainExecution(\n await graphqlExecuteOrSubscribe({\n document,\n contextValue: {\n models,\n },\n schema,\n variableValues: variables,\n }),\n );\n expect(result).toEqual(validResult);\n }\n\n async function compareResultForExecuteWithoutSchemaWithMVSAnnotation(\n schema: GraphQLSchema,\n query: string,\n variables: Record<string, unknown> = {},\n ) {\n expect.assertions(1);\n const document = parse(query);\n const { definitions } = extractMinimalViableSchemaForRequestDocument(\n schema,\n document,\n );\n const result = await drainExecution(\n await executeWithoutSchema({\n document,\n contextValue: {\n models,\n },\n schemaFragment: {\n schemaId: \"test\",\n definitions,\n resolvers: resolvers as UserResolvers,\n },\n variableValues: variables,\n }),\n );\n const validResult = await drainExecution(\n await graphqlExecuteOrSubscribe({\n document,\n contextValue: {\n models,\n },\n schema,\n variableValues: variables,\n }),\n );\n expect(result).toEqual(validResult);\n }\n\n function graphqlExecuteOrSubscribe(\n args: GraphQLExecutionArgs,\n ): PromiseOrValue<GraphQLResult> {\n const operationName = args.operationName;\n let operation: OperationDefinitionNode | undefined;\n for (const definition of (args.document as unknown as DocumentNode)\n .definitions) {\n switch (definition.kind) {\n case Kind.OPERATION_DEFINITION:\n if (operationName == null) {\n if (operation !== undefined) {\n throw new Error(\"Bad operation in test\");\n }\n operation = definition;\n } else if (definition.name?.value === operationName) {\n operation = definition;\n }\n break;\n }\n }\n if (!operation) {\n throw new Error(\"Bad operation in test\");\n }\n\n if (operation.operation === OperationTypeNode.SUBSCRIPTION) {\n return graphqlSubscribe(args) as GraphQLResult;\n } else {\n return graphqlExecute(args) as GraphQLResult;\n }\n }\n\n async function drainExecution(\n result: ExecutionResult | GraphQLResult,\n ): Promise<unknown> {\n let processedResult;\n if (isAsyncIterable(result)) {\n processedResult = await drainAsyncGeneratorToArray(result);\n } else if (\"subsequentResults\" in result) {\n processedResult = {\n ...result,\n subsequentResults: await drainAsyncGeneratorToArray(\n result.subsequentResults,\n ),\n };\n } else {\n processedResult = result;\n }\n return processedResult;\n }\n\n async function drainAsyncGeneratorToArray<T>(\n collection: AsyncGenerator<T, void, void>,\n ): Promise<T[]> {\n const result: T[] = [];\n await forAwaitEach(collection, (item) => result.push(item));\n return result;\n }\n\n return {\n compareResultForExecuteWithoutSchemaWithMVSAnnotation,\n compareResultsForExecuteWithSchema,\n drainExecution,\n graphqlExecuteOrSubscribe,\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAUO;AACP,+BAAkC;AAClC,0BAAyB;AACzB,uBAAsB;AAEtB,oBAAmB;AACnB,kCAAqC;AACrC,0DAA6D;AAG7D,qBAA8C;AAMvC,SAAS,qBACd,gBACA,kBAKA;AACA,WAAe,mCACb,QACA,OACA,WACA;AAAA;AACA,aAAO,WAAW,CAAC;AACnB,YAAM,eAAW,sBAAM,KAAK;AAC5B,YAAM,SAAS,MAAM;AAAA,QACnB,UAAM,4CAAkB;AAAA,UACtB;AAAA,UACA,QAAQ;AAAA,YACN,UAAU;AAAA,YACV,aAAa;AAAA,YACb,WAAW,iBAAAA;AAAA,UACb;AAAA,UACA,cAAc;AAAA,YACZ,sBAAAC;AAAA,UACF;AAAA,UACA,gBAAgB;AAAA,QAClB,CAAC;AAAA,MACH;AACA,YAAM,cAAc,MAAM;AAAA,QACxB,MAAM,0BAA0B;AAAA,UAC9B;AAAA,UACA,cAAc;AAAA,YACZ,sBAAAA;AAAA,UACF;AAAA,UACA;AAAA,UACA,gBAAgB;AAAA,QAClB,CAAC;AAAA,MACH;AACA,aAAO,MAAM,EAAE,QAAQ,WAAW;AAAA,IACpC;AAAA;AAEA,WAAe,sDACb,IACA,IAEA;AAAA,+CAHA,QACA,OACA,YAAqC,CAAC,GACtC;AACA,aAAO,WAAW,CAAC;AACnB,YAAM,eAAW,sBAAM,KAAK;AAC5B,YAAM,EAAE,YAAY,QAAI;AAAA,QACtB;AAAA,QACA;AAAA,MACF;AACA,YAAM,SAAS,MAAM;AAAA,QACnB,UAAM,kDAAqB;AAAA,UACzB;AAAA,UACA,cAAc;AAAA,YACZ,sBAAAA;AAAA,U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AAA;AAEA,WAAe,2BACb,YACc;AAAA;AACd,YAAM,SAAc,CAAC;AACrB,gBAAM,6BAAa,YAAY,CAAC,SAAS,OAAO,KAAK,IAAI,CAAC;AAC1D,aAAO;AAAA,IACT;AAAA;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": ["resolvers", "models"]
7
7
  }
@@ -49,7 +49,7 @@ import { typeDefs } from "../benchmarks/swapi-schema/index.mjs";
49
49
  import resolvers from "../benchmarks/swapi-schema/resolvers.mjs";
50
50
  import models from "../benchmarks/swapi-schema/models.mjs";
51
51
  import { executeWithoutSchema } from "../executeWithoutSchema.mjs";
52
- import { extractMinimalViableSchemaForRequestDocument } from "../utilities/addMinimalViableSchemaToRequestDocument.mjs";
52
+ import { extractMinimalViableSchemaForRequestDocument } from "../utilities/extractMinimalViableSchemaForRequestDocument.mjs";
53
53
  import { forAwaitEach, isAsyncIterable } from "iterall";
54
54
  function createExecutionUtils(graphqlExecute, graphqlSubscribe) {
55
55
  function compareResultsForExecuteWithSchema(schema, query, variables) {
@@ -58,9 +58,12 @@ function createExecutionUtils(graphqlExecute, graphqlSubscribe) {
58
58
  const document = parse(query);
59
59
  const result = yield drainExecution(
60
60
  yield executeWithSchema({
61
- typeDefs,
62
- resolvers,
63
61
  document,
62
+ schema: {
63
+ schemaId: "test",
64
+ definitions: typeDefs,
65
+ resolvers
66
+ },
64
67
  contextValue: {
65
68
  models
66
69
  },
@@ -84,17 +87,21 @@ function createExecutionUtils(graphqlExecute, graphqlSubscribe) {
84
87
  return __async(this, arguments, function* (schema, query, variables = {}) {
85
88
  expect.assertions(1);
86
89
  const document = parse(query);
90
+ const { definitions } = extractMinimalViableSchemaForRequestDocument(
91
+ schema,
92
+ document
93
+ );
87
94
  const result = yield drainExecution(
88
95
  yield executeWithoutSchema({
89
96
  document,
90
97
  contextValue: {
91
98
  models
92
99
  },
93
- resolvers,
94
- schemaFragment: extractMinimalViableSchemaForRequestDocument(
95
- schema,
96
- document
97
- ),
100
+ schemaFragment: {
101
+ schemaId: "test",
102
+ definitions,
103
+ resolvers
104
+ },
98
105
  variableValues: variables
99
106
  })
100
107
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/__testUtils__/execute.ts"],
4
- "sourcesContent": ["import {\n DocumentNode,\n GraphQLSchema,\n Kind,\n OperationDefinitionNode,\n OperationTypeNode,\n parse,\n ExecutionArgs,\n ExecutionArgs as GraphQLExecutionArgs,\n ExecutionResult as GraphQLExecutionResult,\n} from \"graphql\";\nimport { executeWithSchema } from \"../executeWithSchema\";\nimport { typeDefs } from \"../benchmarks/swapi-schema\";\nimport resolvers from \"../benchmarks/swapi-schema/resolvers\";\nimport { ExecutionResult, UserResolvers } from \"../types\";\nimport models from \"../benchmarks/swapi-schema/models\";\nimport { executeWithoutSchema } from \"../executeWithoutSchema\";\nimport { extractMinimalViableSchemaForRequestDocument } from \"../utilities/addMinimalViableSchemaToRequestDocument\";\nimport {} from \"graphql/execution/execute\";\nimport { PromiseOrValue } from \"graphql/jsutils/PromiseOrValue\";\nimport { ObjMap } from \"../jsutils/ObjMap\";\nimport { forAwaitEach, isAsyncIterable } from \"iterall\";\n\ntype GraphQLResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> =\n | GraphQLExecutionResult<TData, TExtensions>\n | AsyncGenerator<GraphQLExecutionResult<TData, TExtensions>, void, void>;\n\nexport function createExecutionUtils(\n graphqlExecute: (args: ExecutionArgs) => PromiseOrValue<ExecutionResult>,\n graphqlSubscribe: (\n args: ExecutionArgs,\n ) => PromiseOrValue<\n AsyncGenerator<ExecutionResult, void, void> | ExecutionResult\n >,\n) {\n async function compareResultsForExecuteWithSchema(\n schema: GraphQLSchema,\n query: string,\n variables?: Record<string, unknown>,\n ) {\n expect.assertions(1);\n const document = parse(query);\n const result = await drainExecution(\n await executeWithSchema({\n typeDefs,\n resolvers: resolvers as UserResolvers<unknown, unknown>,\n document,\n contextValue: {\n models,\n },\n variableValues: variables,\n }),\n );\n const validResult = await drainExecution(\n await graphqlExecuteOrSubscribe({\n document,\n contextValue: {\n models,\n },\n schema,\n variableValues: variables,\n }),\n );\n expect(result).toEqual(validResult);\n }\n\n async function compareResultForExecuteWithoutSchemaWithMVSAnnotation(\n schema: GraphQLSchema,\n query: string,\n variables: Record<string, unknown> = {},\n ) {\n expect.assertions(1);\n const document = parse(query);\n const result = await drainExecution(\n await executeWithoutSchema({\n document,\n contextValue: {\n models,\n },\n resolvers: resolvers as UserResolvers,\n schemaFragment: extractMinimalViableSchemaForRequestDocument(\n schema,\n document,\n ),\n variableValues: variables,\n }),\n );\n const validResult = await drainExecution(\n await graphqlExecuteOrSubscribe({\n document,\n contextValue: {\n models,\n },\n schema,\n variableValues: variables,\n }),\n );\n expect(result).toEqual(validResult);\n }\n\n function graphqlExecuteOrSubscribe(\n args: GraphQLExecutionArgs,\n ): PromiseOrValue<GraphQLResult> {\n const operationName = args.operationName;\n let operation: OperationDefinitionNode | undefined;\n for (const definition of (args.document as unknown as DocumentNode)\n .definitions) {\n switch (definition.kind) {\n case Kind.OPERATION_DEFINITION:\n if (operationName == null) {\n if (operation !== undefined) {\n throw new Error(\"Bad operation in test\");\n }\n operation = definition;\n } else if (definition.name?.value === operationName) {\n operation = definition;\n }\n break;\n }\n }\n if (!operation) {\n throw new Error(\"Bad operation in test\");\n }\n\n if (operation.operation === OperationTypeNode.SUBSCRIPTION) {\n return graphqlSubscribe(args) as GraphQLResult;\n } else {\n return graphqlExecute(args) as GraphQLResult;\n }\n }\n\n async function drainExecution(\n result: ExecutionResult | GraphQLResult,\n ): Promise<unknown> {\n let processedResult;\n if (isAsyncIterable(result)) {\n processedResult = await drainAsyncGeneratorToArray(result);\n } else if (\"subsequentResults\" in result) {\n processedResult = {\n ...result,\n subsequentResults: await drainAsyncGeneratorToArray(\n result.subsequentResults,\n ),\n };\n } else {\n processedResult = result;\n }\n return processedResult;\n }\n\n async function drainAsyncGeneratorToArray<T>(\n collection: AsyncGenerator<T, void, void>,\n ): Promise<T[]> {\n const result: T[] = [];\n await forAwaitEach(collection, (item) => result.push(item));\n return result;\n }\n\n return {\n compareResultForExecuteWithoutSchemaWithMVSAnnotation,\n compareResultsForExecuteWithSchema,\n drainExecution,\n graphqlExecuteOrSubscribe,\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EAGE;AAAA,EAEA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,yBAAyB;AAClC,SAAS,gBAAgB;AACzB,OAAO,eAAe;AAEtB,OAAO,YAAY;AACnB,SAAS,4BAA4B;AACrC,SAAS,oDAAoD;AAI7D,SAAS,cAAc,uBAAuB;AAMvC,SAAS,qBACd,gBACA,kBAKA;AACA,WAAe,mCACb,QACA,OACA,WACA;AAAA;AACA,aAAO,WAAW,CAAC;AACnB,YAAM,WAAW,MAAM,KAAK;AAC5B,YAAM,SAAS,MAAM;AAAA,QACnB,MAAM,kBAAkB;AAAA,UACtB;AAAA,UACA;AAAA,UACA;AAAA,UACA,cAAc;AAAA,YACZ;AAAA,UACF;AAAA,UACA,gBAAgB;AAAA,QAClB,CAAC;AAAA,MACH;AACA,YAAM,cAAc,MAAM;AAAA,QACxB,MAAM,0BAA0B;AAAA,UAC9B;AAAA,UACA,cAAc;AAAA,YACZ;AAAA,UACF;AAAA,UACA;AAAA,UACA,gBAAgB;AAAA,QAClB,CAAC;AAAA,MACH;AACA,aAAO,MAAM,EAAE,QAAQ,WAAW;AAAA,IACpC;AAAA;AAEA,WAAe,sDACb,IACA,IAEA;AAAA,+CAHA,QACA,OACA,YAAqC,CAAC,GACtC;AACA,aAAO,WAAW,CAAC;AACnB,YAAM,WAAW,MAAM,KAAK;AAC5B,YAAM,SAAS,MAAM;AAAA,QACnB,MAAM,qBAAqB;AAAA,UACzB;AAAA,UACA,cAAc;AAAA,YACZ;AAAA,UACF;AAAA,U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AM,SAAc,CAAC;AACrB,YAAM,aAAa,YAAY,CAAC,SAAS,OAAO,KAAK,IAAI,CAAC;AAC1D,aAAO;AAAA,IACT;AAAA;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import {\n DocumentNode,\n GraphQLSchema,\n Kind,\n OperationDefinitionNode,\n OperationTypeNode,\n parse,\n ExecutionArgs,\n ExecutionArgs as GraphQLExecutionArgs,\n ExecutionResult as GraphQLExecutionResult,\n} from \"graphql\";\nimport { executeWithSchema } from \"../executeWithSchema\";\nimport { typeDefs } from \"../benchmarks/swapi-schema\";\nimport resolvers from \"../benchmarks/swapi-schema/resolvers\";\nimport { ExecutionResult, UserResolvers } from \"../types\";\nimport models from \"../benchmarks/swapi-schema/models\";\nimport { executeWithoutSchema } from \"../executeWithoutSchema\";\nimport { extractMinimalViableSchemaForRequestDocument } from \"../utilities/extractMinimalViableSchemaForRequestDocument\";\nimport { PromiseOrValue } from \"graphql/jsutils/PromiseOrValue\";\nimport { ObjMap } from \"../jsutils/ObjMap\";\nimport { forAwaitEach, isAsyncIterable } from \"iterall\";\n\ntype GraphQLResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> =\n | GraphQLExecutionResult<TData, TExtensions>\n | AsyncGenerator<GraphQLExecutionResult<TData, TExtensions>, void, void>;\n\nexport function createExecutionUtils(\n graphqlExecute: (args: ExecutionArgs) => PromiseOrValue<ExecutionResult>,\n graphqlSubscribe: (\n args: ExecutionArgs,\n ) => PromiseOrValue<\n AsyncGenerator<ExecutionResult, void, void> | ExecutionResult\n >,\n) {\n async function compareResultsForExecuteWithSchema(\n schema: GraphQLSchema,\n query: string,\n variables?: Record<string, unknown>,\n ) {\n expect.assertions(1);\n const document = parse(query);\n const result = await drainExecution(\n await executeWithSchema({\n document,\n schema: {\n schemaId: \"test\",\n definitions: typeDefs,\n resolvers: resolvers as UserResolvers<unknown, unknown>,\n },\n contextValue: {\n models,\n },\n variableValues: variables,\n }),\n );\n const validResult = await drainExecution(\n await graphqlExecuteOrSubscribe({\n document,\n contextValue: {\n models,\n },\n schema,\n variableValues: variables,\n }),\n );\n expect(result).toEqual(validResult);\n }\n\n async function compareResultForExecuteWithoutSchemaWithMVSAnnotation(\n schema: GraphQLSchema,\n query: string,\n variables: Record<string, unknown> = {},\n ) {\n expect.assertions(1);\n const document = parse(query);\n const { definitions } = extractMinimalViableSchemaForRequestDocument(\n schema,\n document,\n );\n const result = await drainExecution(\n await executeWithoutSchema({\n document,\n contextValue: {\n models,\n },\n schemaFragment: {\n schemaId: \"test\",\n definitions,\n resolvers: resolvers as UserResolvers,\n },\n variableValues: variables,\n }),\n );\n const validResult = await drainExecution(\n await graphqlExecuteOrSubscribe({\n document,\n contextValue: {\n models,\n },\n schema,\n variableValues: variables,\n }),\n );\n expect(result).toEqual(validResult);\n }\n\n function graphqlExecuteOrSubscribe(\n args: GraphQLExecutionArgs,\n ): PromiseOrValue<GraphQLResult> {\n const operationName = args.operationName;\n let operation: OperationDefinitionNode | undefined;\n for (const definition of (args.document as unknown as DocumentNode)\n .definitions) {\n switch (definition.kind) {\n case Kind.OPERATION_DEFINITION:\n if (operationName == null) {\n if (operation !== undefined) {\n throw new Error(\"Bad operation in test\");\n }\n operation = definition;\n } else if (definition.name?.value === operationName) {\n operation = definition;\n }\n break;\n }\n }\n if (!operation) {\n throw new Error(\"Bad operation in test\");\n }\n\n if (operation.operation === OperationTypeNode.SUBSCRIPTION) {\n return graphqlSubscribe(args) as GraphQLResult;\n } else {\n return graphqlExecute(args) as GraphQLResult;\n }\n }\n\n async function drainExecution(\n result: ExecutionResult | GraphQLResult,\n ): Promise<unknown> {\n let processedResult;\n if (isAsyncIterable(result)) {\n processedResult = await drainAsyncGeneratorToArray(result);\n } else if (\"subsequentResults\" in result) {\n processedResult = {\n ...result,\n subsequentResults: await drainAsyncGeneratorToArray(\n result.subsequentResults,\n ),\n };\n } else {\n processedResult = result;\n }\n return processedResult;\n }\n\n async function drainAsyncGeneratorToArray<T>(\n collection: AsyncGenerator<T, void, void>,\n ): Promise<T[]> {\n const result: T[] = [];\n await forAwaitEach(collection, (item) => result.push(item));\n return result;\n }\n\n return {\n compareResultForExecuteWithoutSchemaWithMVSAnnotation,\n compareResultsForExecuteWithSchema,\n drainExecution,\n graphqlExecuteOrSubscribe,\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EAGE;AAAA,EAEA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,yBAAyB;AAClC,SAAS,gBAAgB;AACzB,OAAO,eAAe;AAEtB,OAAO,YAAY;AACnB,SAAS,4BAA4B;AACrC,SAAS,oDAAoD;AAG7D,SAAS,cAAc,uBAAuB;AAMvC,SAAS,qBACd,gBACA,kBAKA;AACA,WAAe,mCACb,QACA,OACA,WACA;AAAA;AACA,aAAO,WAAW,CAAC;AACnB,YAAM,WAAW,MAAM,KAAK;AAC5B,YAAM,SAAS,MAAM;AAAA,QACnB,MAAM,kBAAkB;AAAA,UACtB;AAAA,UACA,QAAQ;AAAA,YACN,UAAU;AAAA,YACV,aAAa;AAAA,YACb;AAAA,UACF;AAAA,UACA,cAAc;AAAA,YACZ;AAAA,UACF;AAAA,UACA,gBAAgB;AAAA,QAClB,CAAC;AAAA,MACH;AACA,YAAM,cAAc,MAAM;AAAA,QACxB,MAAM,0BAA0B;AAAA,UAC9B;AAAA,UACA,cAAc;AAAA,YACZ;AAAA,UACF;AAAA,UACA;AAAA,UACA,gBAAgB;AAAA,QAClB,CAAC;AAAA,MACH;AACA,aAAO,MAAM,EAAE,QAAQ,WAAW;AAAA,IACpC;AAAA;AAEA,WAAe,sDACb,IACA,IAEA;AAAA,+CAHA,QACA,OACA,YAAqC,CAAC,GACtC;AACA,aAAO,WAAW,CAAC;AACnB,YAAM,WAAW,MAAM,KAAK;AAC5B,YAAM,EAAE,YAAY,IAAI;AAAA,QACtB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vB,OAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF,OAAO;AACL,0BAAkB;AAAA,MACpB;AACA,aAAO;AAAA,IACT;AAAA;AAEA,WAAe,2BACb,YACc;AAAA;AACd,YAAM,SAAc,CAAC;AACrB,YAAM,aAAa,YAAY,CAAC,SAAS,OAAO,KAAK,IAAI,CAAC;AAC1D,aAAO;AAAA,IACT;AAAA;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,7 @@
1
+ import { DocumentNode } from "graphql";
2
+ export type GqlResult = {
3
+ raw: string;
4
+ document: DocumentNode;
5
+ };
6
+ export declare function gql(raw: TemplateStringsArray): GqlResult;
7
+ //# sourceMappingURL=gql.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gql.d.ts","sourceRoot":"","sources":["../../src/__testUtils__/gql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAS,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,SAAS,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,CAAC;AAEhE,wBAAgB,GAAG,CAAC,GAAG,EAAE,oBAAoB,GAAG,SAAS,CAExD"}
@@ -16,23 +16,12 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var getSchemaFragment_exports = {};
20
- __export(getSchemaFragment_exports, {
21
- getSchemaFragment: () => getSchemaFragment
19
+ var gql_exports = {};
20
+ __export(gql_exports, {
21
+ gql: () => gql
22
22
  });
23
- module.exports = __toCommonJS(getSchemaFragment_exports);
23
+ module.exports = __toCommonJS(gql_exports);
24
24
  var import_graphql = require("graphql");
25
- var import_directives = require("../schema/directives");
26
- function getSchemaFragment(definition) {
27
- var _a, _b;
28
- const directive = (_a = definition.directives) == null ? void 0 : _a.find(
29
- (directive2) => directive2.name.value === import_directives.SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME
30
- );
31
- const arg = (_b = directive == null ? void 0 : directive.arguments) == null ? void 0 : _b.find(
32
- (arg2) => arg2.name.value === import_directives.SUPERMASSIVE_SCHEMA_DIRECTIVE_FRAGMENT_ARGUMENT_NAME
33
- );
34
- if ((arg == null ? void 0 : arg.value.kind) === import_graphql.Kind.STRING) {
35
- return JSON.parse(arg.value.value);
36
- }
37
- return void 0;
25
+ function gql(raw) {
26
+ return { raw: raw[0], document: (0, import_graphql.parse)(raw[0]) };
38
27
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/__testUtils__/gql.ts"],
4
+ "sourcesContent": ["import { DocumentNode, parse } from \"graphql\";\n\nexport type GqlResult = { raw: string; document: DocumentNode };\n\nexport function gql(raw: TemplateStringsArray): GqlResult {\n return { raw: raw[0], document: parse(raw[0]) };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoC;AAI7B,SAAS,IAAI,KAAsC;AACxD,SAAO,EAAE,KAAK,IAAI,CAAC,GAAG,cAAU,sBAAM,IAAI,CAAC,CAAC,EAAE;AAChD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ // src/__testUtils__/gql.ts
2
+ import { parse } from "graphql";
3
+ function gql(raw) {
4
+ return { raw: raw[0], document: parse(raw[0]) };
5
+ }
6
+ export {
7
+ gql
8
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/__testUtils__/gql.ts"],
4
+ "sourcesContent": ["import { DocumentNode, parse } from \"graphql\";\n\nexport type GqlResult = { raw: string; document: DocumentNode };\n\nexport function gql(raw: TemplateStringsArray): GqlResult {\n return { raw: raw[0], document: parse(raw[0]) };\n}\n"],
5
+ "mappings": ";AAAA,SAAuB,aAAa;AAI7B,SAAS,IAAI,KAAsC;AACxD,SAAO,EAAE,KAAK,IAAI,CAAC,GAAG,UAAU,MAAM,IAAI,CAAC,CAAC,EAAE;AAChD;",
6
+ "names": []
7
+ }
@@ -50,7 +50,7 @@ var import_models = __toESM(require("./swapi-schema/models"));
50
50
  var import_graphql = require("graphql");
51
51
  var import_graphql_jit = require("graphql-jit");
52
52
  var import_executeWithoutSchema = require("../executeWithoutSchema");
53
- var import_addMinimalViableSchemaToRequestDocument = require("../utilities/addMinimalViableSchemaToRequestDocument");
53
+ var import_extractMinimalViableSchemaForRequestDocument = require("../utilities/extractMinimalViableSchemaForRequestDocument");
54
54
  const query = import_fs.default.readFileSync(
55
55
  import_path.default.join(__dirname, "./fixtures/query1.graphql"),
56
56
  {
@@ -59,10 +59,15 @@ const query = import_fs.default.readFileSync(
59
59
  );
60
60
  const parsedQuery = (0, import_graphql.parse)(query);
61
61
  const compiledQuery = (0, import_graphql_jit.compileQuery)(import_swapi_schema.default, parsedQuery);
62
- const schemaFragment = (0, import_addMinimalViableSchemaToRequestDocument.extractMinimalViableSchemaForRequestDocument)(
62
+ const { definitions } = (0, import_extractMinimalViableSchemaForRequestDocument.extractMinimalViableSchemaForRequestDocument)(
63
63
  import_swapi_schema.default,
64
64
  parsedQuery
65
65
  );
66
+ const schemaFragment = {
67
+ schemaId: "benchmark",
68
+ definitions,
69
+ resolvers: import_resolvers.default
70
+ };
66
71
  const queryRunningSuite = new import_nice_benchmark.default("Query Running");
67
72
  queryRunningSuite.add("graphql-js - string queries", () => __async(exports, null, function* () {
68
73
  const result = yield (0, import_graphql.execute)({
@@ -107,7 +112,6 @@ queryRunningSuite.add("graphql-jit - precompiled", () => __async(exports, null,
107
112
  }));
108
113
  queryRunningSuite.add("supermassive - runtime schemaless", () => __async(exports, null, function* () {
109
114
  const result = yield (0, import_executeWithoutSchema.executeWithoutSchema)({
110
- resolvers: import_resolvers.default,
111
115
  schemaFragment,
112
116
  document: parsedQuery,
113
117
  contextValue: { models: import_models.default }
@@ -126,7 +130,7 @@ queryCompilingSuite.add("graphql-jit", () => __async(exports, null, function* ()
126
130
  }));
127
131
  const queryAnnotationSuite = new import_nice_benchmark.default("Query annotation");
128
132
  queryAnnotationSuite.add("supermassive", () => {
129
- (0, import_addMinimalViableSchemaToRequestDocument.extractMinimalViableSchemaForRequestDocument)(import_swapi_schema.default, parsedQuery);
133
+ (0, import_extractMinimalViableSchemaForRequestDocument.extractMinimalViableSchemaForRequestDocument)(import_swapi_schema.default, parsedQuery);
130
134
  });
131
135
  function main() {
132
136
  return __async(this, null, function* () {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/benchmarks/index.ts"],
4
- "sourcesContent": ["import fs from \"fs\";\nimport path from \"path\";\nimport NiceBenchmark from \"./nice-benchmark\";\nimport schema from \"./swapi-schema\";\nimport resolvers from \"./swapi-schema/resolvers\";\nimport models from \"./swapi-schema/models\";\nimport {\n execute as graphqlExecute,\n parse,\n // experimentalExecuteIncrementally as graphqlExecute,\n} from \"graphql\";\nimport { compileQuery, isCompiledQuery } from \"graphql-jit\";\nimport { executeWithoutSchema as supermassiveExecute } from \"../executeWithoutSchema\";\nimport { UserResolvers } from \"../types\";\nimport { extractMinimalViableSchemaForRequestDocument } from \"../utilities/addMinimalViableSchemaToRequestDocument\";\n\nconst query = fs.readFileSync(\n path.join(__dirname, \"./fixtures/query1.graphql\"),\n {\n encoding: \"utf-8\",\n },\n);\n\nconst parsedQuery = parse(query);\n\nconst compiledQuery = compileQuery(schema, parsedQuery);\n\nconst schemaFragment = extractMinimalViableSchemaForRequestDocument(\n schema,\n parsedQuery,\n);\n\nconst queryRunningSuite = new NiceBenchmark(\"Query Running\");\nqueryRunningSuite.add(\"graphql-js - string queries\", async () => {\n const result = await graphqlExecute({\n schema,\n document: parse(query),\n contextValue: { models },\n });\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n});\nqueryRunningSuite.add(\"graphql-js - parsed queries\", async () => {\n const result = await graphqlExecute({\n schema,\n document: parsedQuery,\n contextValue: { models },\n });\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n});\nqueryRunningSuite.add(\"graphql-jit - uncompiled\", async () => {\n const freshCompiledQuery = compileQuery(schema, parsedQuery);\n if (isCompiledQuery(freshCompiledQuery)) {\n const result = await freshCompiledQuery.query({}, { models }, {});\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n } else {\n throw new Error(\"Wrong query\");\n }\n});\nqueryRunningSuite.add(\"graphql-jit - precompiled\", async () => {\n if (isCompiledQuery(compiledQuery)) {\n const result = await compiledQuery.query({}, { models }, {});\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n } else {\n throw new Error(\"Wrong query\");\n }\n});\nqueryRunningSuite.add(\"supermassive - runtime schemaless\", async () => {\n const result = await supermassiveExecute({\n resolvers: resolvers as UserResolvers,\n schemaFragment,\n document: parsedQuery,\n contextValue: { models },\n });\n if (\"data\" in result && (result.errors || !result.data)) {\n throw new Error(\"Stuff ain't executing\");\n }\n});\n\nconst queryParsingSuite = new NiceBenchmark(\"Query parsing\");\nqueryParsingSuite.add(\"graphql-js\", async () => {\n parse(query);\n});\n\nconst queryCompilingSuite = new NiceBenchmark(\"Query compiling\");\nqueryCompilingSuite.add(\"graphql-jit\", async () => {\n await compileQuery(schema, parsedQuery);\n});\n\nconst queryAnnotationSuite = new NiceBenchmark(\"Query annotation\");\nqueryAnnotationSuite.add(\"supermassive\", () => {\n extractMinimalViableSchemaForRequestDocument(schema, parsedQuery);\n});\n\nasync function main() {\n await queryCompilingSuite.run();\n await queryParsingSuite.run();\n await queryAnnotationSuite.run();\n await queryRunningSuite.run();\n}\n\nmain();\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gBAAe;AACf,kBAAiB;AACjB,4BAA0B;AAC1B,0BAAmB;AACnB,uBAAsB;AACtB,oBAAmB;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ute", "models", "supermassiveExecute", "resolvers"]
4
+ "sourcesContent": ["import fs from \"fs\";\nimport path from \"path\";\nimport NiceBenchmark from \"./nice-benchmark\";\nimport schema from \"./swapi-schema\";\nimport resolvers from \"./swapi-schema/resolvers\";\nimport models from \"./swapi-schema/models\";\nimport {\n execute as graphqlExecute,\n parse,\n // experimentalExecuteIncrementally as graphqlExecute,\n} from \"graphql\";\nimport { compileQuery, isCompiledQuery } from \"graphql-jit\";\nimport { executeWithoutSchema as supermassiveExecute } from \"../executeWithoutSchema\";\nimport { UserResolvers } from \"../types\";\nimport { extractMinimalViableSchemaForRequestDocument } from \"../utilities/extractMinimalViableSchemaForRequestDocument\";\nimport { SchemaFragment } from \"../schema/fragment\";\n\nconst query = fs.readFileSync(\n path.join(__dirname, \"./fixtures/query1.graphql\"),\n {\n encoding: \"utf-8\",\n },\n);\n\nconst parsedQuery = parse(query);\nconst compiledQuery = compileQuery(schema, parsedQuery);\n\nconst { definitions } = extractMinimalViableSchemaForRequestDocument(\n schema,\n parsedQuery,\n);\n\nconst schemaFragment: SchemaFragment = {\n schemaId: \"benchmark\",\n definitions,\n resolvers: resolvers as UserResolvers,\n};\n\nconst queryRunningSuite = new NiceBenchmark(\"Query Running\");\nqueryRunningSuite.add(\"graphql-js - string queries\", async () => {\n const result = await graphqlExecute({\n schema,\n document: parse(query),\n contextValue: { models },\n });\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n});\nqueryRunningSuite.add(\"graphql-js - parsed queries\", async () => {\n const result = await graphqlExecute({\n schema,\n document: parsedQuery,\n contextValue: { models },\n });\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n});\nqueryRunningSuite.add(\"graphql-jit - uncompiled\", async () => {\n const freshCompiledQuery = compileQuery(schema, parsedQuery);\n if (isCompiledQuery(freshCompiledQuery)) {\n const result = await freshCompiledQuery.query({}, { models }, {});\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n } else {\n throw new Error(\"Wrong query\");\n }\n});\nqueryRunningSuite.add(\"graphql-jit - precompiled\", async () => {\n if (isCompiledQuery(compiledQuery)) {\n const result = await compiledQuery.query({}, { models }, {});\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n } else {\n throw new Error(\"Wrong query\");\n }\n});\nqueryRunningSuite.add(\"supermassive - runtime schemaless\", async () => {\n const result = await supermassiveExecute({\n schemaFragment,\n document: parsedQuery,\n contextValue: { models },\n });\n if (\"data\" in result && (result.errors || !result.data)) {\n throw new Error(\"Stuff ain't executing\");\n }\n});\n\nconst queryParsingSuite = new NiceBenchmark(\"Query parsing\");\nqueryParsingSuite.add(\"graphql-js\", async () => {\n parse(query);\n});\n\nconst queryCompilingSuite = new NiceBenchmark(\"Query compiling\");\nqueryCompilingSuite.add(\"graphql-jit\", async () => {\n await compileQuery(schema, parsedQuery);\n});\n\nconst queryAnnotationSuite = new NiceBenchmark(\"Query annotation\");\nqueryAnnotationSuite.add(\"supermassive\", () => {\n extractMinimalViableSchemaForRequestDocument(schema, parsedQuery);\n});\n\nasync function main() {\n await queryCompilingSuite.run();\n await queryParsingSuite.run();\n await queryAnnotationSuite.run();\n await queryRunningSuite.run();\n}\n\nmain();\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gBAAe;AACf,kBAAiB;AACjB,4BAA0B;AAC1B,0BAAmB;AACnB,uBAAsB;AACtB,oBAAmB;AACnB,qBAIO;AACP,yBAA8C;AAC9C,kCAA4D;AAE5D,0DAA6D;AAG7D,MAAM,QAAQ,UAAAA,QAAG;AAAA,EACf,YAAAC,QAAK,KAAK,WAAW,2BAA2B;AAAA,EAChD;AAAA,IACE,UAAU;AAAA,EACZ;AACF;AAEA,MAAM,kBAAc,sBAAM,KAAK;AAC/B,MAAM,oBAAgB,iCAAa,oBAAAC,SAAQ,WAAW;AAEtD,MAAM,EAAE,YAAY,QAAI;AAAA,EACtB,oBAAA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AC,OAAO,MAAM;AACjC,YAAM,IAAI,MAAM,uBAAuB;AAAA,IACzC;AAAA,EACF,OAAO;AACL,UAAM,IAAI,MAAM,aAAa;AAAA,EAC/B;AACF,EAAC;AACD,kBAAkB,IAAI,qCAAqC,MAAY;AACrE,QAAM,SAAS,UAAM,4BAAAC,sBAAoB;AAAA,IACvC;AAAA,IACA,UAAU;AAAA,IACV,cAAc,EAAE,sBAAAD,QAAO;AAAA,EACzB,CAAC;AACD,MAAI,UAAU,WAAW,OAAO,UAAU,CAAC,OAAO,OAAO;AACvD,UAAM,IAAI,MAAM,uBAAuB;AAAA,EACzC;AACF,EAAC;AAED,MAAM,oBAAoB,IAAI,sBAAAF,QAAc,eAAe;AAC3D,kBAAkB,IAAI,cAAc,MAAY;AAC9C,4BAAM,KAAK;AACb,EAAC;AAED,MAAM,sBAAsB,IAAI,sBAAAA,QAAc,iBAAiB;AAC/D,oBAAoB,IAAI,eAAe,MAAY;AACjD,YAAM,iCAAa,oBAAAF,SAAQ,WAAW;AACxC,EAAC;AAED,MAAM,uBAAuB,IAAI,sBAAAE,QAAc,kBAAkB;AACjE,qBAAqB,IAAI,gBAAgB,MAAM;AAC7C,wGAA6C,oBAAAF,SAAQ,WAAW;AAClE,CAAC;AAED,SAAe,OAAO;AAAA;AACpB,UAAM,oBAAoB,IAAI;AAC9B,UAAM,kBAAkB,IAAI;AAC5B,UAAM,qBAAqB,IAAI;AAC/B,UAAM,kBAAkB,IAAI;AAAA,EAC9B;AAAA;AAEA,KAAK;",
6
+ "names": ["fs", "path", "schema", "resolvers", "NiceBenchmark", "graphqlExecute", "models", "supermassiveExecute"]
7
7
  }
@@ -36,7 +36,7 @@ import {
36
36
  } from "graphql";
37
37
  import { compileQuery, isCompiledQuery } from "graphql-jit";
38
38
  import { executeWithoutSchema as supermassiveExecute } from "../executeWithoutSchema.mjs";
39
- import { extractMinimalViableSchemaForRequestDocument } from "../utilities/addMinimalViableSchemaToRequestDocument.mjs";
39
+ import { extractMinimalViableSchemaForRequestDocument } from "../utilities/extractMinimalViableSchemaForRequestDocument.mjs";
40
40
  var require_benchmarks = __commonJS({
41
41
  "src/benchmarks/index.ts"(exports) {
42
42
  var query = fs.readFileSync(
@@ -47,10 +47,15 @@ var require_benchmarks = __commonJS({
47
47
  );
48
48
  var parsedQuery = parse(query);
49
49
  var compiledQuery = compileQuery(schema, parsedQuery);
50
- var schemaFragment = extractMinimalViableSchemaForRequestDocument(
50
+ var { definitions } = extractMinimalViableSchemaForRequestDocument(
51
51
  schema,
52
52
  parsedQuery
53
53
  );
54
+ var schemaFragment = {
55
+ schemaId: "benchmark",
56
+ definitions,
57
+ resolvers
58
+ };
54
59
  var queryRunningSuite = new NiceBenchmark("Query Running");
55
60
  queryRunningSuite.add("graphql-js - string queries", () => __async(exports, null, function* () {
56
61
  const result = yield graphqlExecute({
@@ -95,7 +100,6 @@ var require_benchmarks = __commonJS({
95
100
  }));
96
101
  queryRunningSuite.add("supermassive - runtime schemaless", () => __async(exports, null, function* () {
97
102
  const result = yield supermassiveExecute({
98
- resolvers,
99
103
  schemaFragment,
100
104
  document: parsedQuery,
101
105
  contextValue: { models }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/benchmarks/index.ts"],
4
- "sourcesContent": ["import fs from \"fs\";\nimport path from \"path\";\nimport NiceBenchmark from \"./nice-benchmark\";\nimport schema from \"./swapi-schema\";\nimport resolvers from \"./swapi-schema/resolvers\";\nimport models from \"./swapi-schema/models\";\nimport {\n execute as graphqlExecute,\n parse,\n // experimentalExecuteIncrementally as graphqlExecute,\n} from \"graphql\";\nimport { compileQuery, isCompiledQuery } from \"graphql-jit\";\nimport { executeWithoutSchema as supermassiveExecute } from \"../executeWithoutSchema\";\nimport { UserResolvers } from \"../types\";\nimport { extractMinimalViableSchemaForRequestDocument } from \"../utilities/addMinimalViableSchemaToRequestDocument\";\n\nconst query = fs.readFileSync(\n path.join(__dirname, \"./fixtures/query1.graphql\"),\n {\n encoding: \"utf-8\",\n },\n);\n\nconst parsedQuery = parse(query);\n\nconst compiledQuery = compileQuery(schema, parsedQuery);\n\nconst schemaFragment = extractMinimalViableSchemaForRequestDocument(\n schema,\n parsedQuery,\n);\n\nconst queryRunningSuite = new NiceBenchmark(\"Query Running\");\nqueryRunningSuite.add(\"graphql-js - string queries\", async () => {\n const result = await graphqlExecute({\n schema,\n document: parse(query),\n contextValue: { models },\n });\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n});\nqueryRunningSuite.add(\"graphql-js - parsed queries\", async () => {\n const result = await graphqlExecute({\n schema,\n document: parsedQuery,\n contextValue: { models },\n });\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n});\nqueryRunningSuite.add(\"graphql-jit - uncompiled\", async () => {\n const freshCompiledQuery = compileQuery(schema, parsedQuery);\n if (isCompiledQuery(freshCompiledQuery)) {\n const result = await freshCompiledQuery.query({}, { models }, {});\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n } else {\n throw new Error(\"Wrong query\");\n }\n});\nqueryRunningSuite.add(\"graphql-jit - precompiled\", async () => {\n if (isCompiledQuery(compiledQuery)) {\n const result = await compiledQuery.query({}, { models }, {});\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n } else {\n throw new Error(\"Wrong query\");\n }\n});\nqueryRunningSuite.add(\"supermassive - runtime schemaless\", async () => {\n const result = await supermassiveExecute({\n resolvers: resolvers as UserResolvers,\n schemaFragment,\n document: parsedQuery,\n contextValue: { models },\n });\n if (\"data\" in result && (result.errors || !result.data)) {\n throw new Error(\"Stuff ain't executing\");\n }\n});\n\nconst queryParsingSuite = new NiceBenchmark(\"Query parsing\");\nqueryParsingSuite.add(\"graphql-js\", async () => {\n parse(query);\n});\n\nconst queryCompilingSuite = new NiceBenchmark(\"Query compiling\");\nqueryCompilingSuite.add(\"graphql-jit\", async () => {\n await compileQuery(schema, parsedQuery);\n});\n\nconst queryAnnotationSuite = new NiceBenchmark(\"Query annotation\");\nqueryAnnotationSuite.add(\"supermassive\", () => {\n extractMinimalViableSchemaForRequestDocument(schema, parsedQuery);\n});\n\nasync function main() {\n await queryCompilingSuite.run();\n await queryParsingSuite.run();\n await queryAnnotationSuite.run();\n await queryRunningSuite.run();\n}\n\nmain();\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,mBAAmB;AAC1B,OAAO,YAAY;AACnB,OAAO,eAAe;AACtB,OAAO,YAAY;AACnB;AAAA,EACE,WAAW;AAAA,EACX;AAAA,OAEK;AACP,SAAS,cAAc,uBAAuB;AAC9C,SAAS,wBAAwB,2BAA2B;AAE5D,SAAS,oDAAoD;AAd7D;AAAA;AAgBA,QAAM,QAAQ,GAAG;AAAA,MACf,KAAK,KAAK,WAAW,2BAA2B;AAAA,MAChD;AAAA,QACE,UAAU;AAAA,MACZ;AAAA,IACF;AAEA,QAAM,cAAc,MAAM,KAAK;AAE/B,QAAM,gBAAgB,aAAa,QAAQ,WAAW;AAEtD,QAAM,iBAAiB;AAAA,MACrB;AAAA,MACA;AAAA,IACF;AAEA,QAAM,oBAAoB,IAAI,cAAc,eAAe;AAC3D,sBAAkB,IAAI,+BAA+B,MAAY;AAC/D,YAAM,SAAS,MAAM,eAAe;AAAA,QAClC;AAAA,QACA,UAAU,MAAM,KAAK;AAAA,QACrB,cAAc,EAAE,OAAO;AAAA,MACzB,CAAC;AACD,UAAI,OAAO,UAAU,CAAC,OAAO,MAAM;AACjC,cAAM,IAAI,MAAM,uBAAuB;AAAA,MACzC;AAAA,IACF,EAAC;AACD,sBAAkB,IAAI,+BAA+B,MAAY;AAC/D,YAAM,SAAS,MAAM,eAAe;AAAA,QAClC;AAAA,QACA,UAAU;AAAA,QACV,cAAc,EAAE,OAAO;AAAA,MACzB,CAAC;AACD,UAAI,OAAO,UAAU,CAAC,OAAO,MAAM;AACjC,cAAM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IAAI,cAAc,kBAAkB;AACjE,yBAAqB,IAAI,gBAAgB,MAAM;AAC7C,mDAA6C,QAAQ,WAAW;AAAA,IAClE,CAAC;AAED,aAAe,OAAO;AAAA;AACpB,cAAM,oBAAoB,IAAI;AAC9B,cAAM,kBAAkB,IAAI;AAC5B,cAAM,qBAAqB,IAAI;AAC/B,cAAM,kBAAkB,IAAI;AAAA,MAC9B;AAAA;AAEA,SAAK;AAAA;AAAA;",
4
+ "sourcesContent": ["import fs from \"fs\";\nimport path from \"path\";\nimport NiceBenchmark from \"./nice-benchmark\";\nimport schema from \"./swapi-schema\";\nimport resolvers from \"./swapi-schema/resolvers\";\nimport models from \"./swapi-schema/models\";\nimport {\n execute as graphqlExecute,\n parse,\n // experimentalExecuteIncrementally as graphqlExecute,\n} from \"graphql\";\nimport { compileQuery, isCompiledQuery } from \"graphql-jit\";\nimport { executeWithoutSchema as supermassiveExecute } from \"../executeWithoutSchema\";\nimport { UserResolvers } from \"../types\";\nimport { extractMinimalViableSchemaForRequestDocument } from \"../utilities/extractMinimalViableSchemaForRequestDocument\";\nimport { SchemaFragment } from \"../schema/fragment\";\n\nconst query = fs.readFileSync(\n path.join(__dirname, \"./fixtures/query1.graphql\"),\n {\n encoding: \"utf-8\",\n },\n);\n\nconst parsedQuery = parse(query);\nconst compiledQuery = compileQuery(schema, parsedQuery);\n\nconst { definitions } = extractMinimalViableSchemaForRequestDocument(\n schema,\n parsedQuery,\n);\n\nconst schemaFragment: SchemaFragment = {\n schemaId: \"benchmark\",\n definitions,\n resolvers: resolvers as UserResolvers,\n};\n\nconst queryRunningSuite = new NiceBenchmark(\"Query Running\");\nqueryRunningSuite.add(\"graphql-js - string queries\", async () => {\n const result = await graphqlExecute({\n schema,\n document: parse(query),\n contextValue: { models },\n });\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n});\nqueryRunningSuite.add(\"graphql-js - parsed queries\", async () => {\n const result = await graphqlExecute({\n schema,\n document: parsedQuery,\n contextValue: { models },\n });\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n});\nqueryRunningSuite.add(\"graphql-jit - uncompiled\", async () => {\n const freshCompiledQuery = compileQuery(schema, parsedQuery);\n if (isCompiledQuery(freshCompiledQuery)) {\n const result = await freshCompiledQuery.query({}, { models }, {});\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n } else {\n throw new Error(\"Wrong query\");\n }\n});\nqueryRunningSuite.add(\"graphql-jit - precompiled\", async () => {\n if (isCompiledQuery(compiledQuery)) {\n const result = await compiledQuery.query({}, { models }, {});\n if (result.errors || !result.data) {\n throw new Error(\"Stuff ain't executing\");\n }\n } else {\n throw new Error(\"Wrong query\");\n }\n});\nqueryRunningSuite.add(\"supermassive - runtime schemaless\", async () => {\n const result = await supermassiveExecute({\n schemaFragment,\n document: parsedQuery,\n contextValue: { models },\n });\n if (\"data\" in result && (result.errors || !result.data)) {\n throw new Error(\"Stuff ain't executing\");\n }\n});\n\nconst queryParsingSuite = new NiceBenchmark(\"Query parsing\");\nqueryParsingSuite.add(\"graphql-js\", async () => {\n parse(query);\n});\n\nconst queryCompilingSuite = new NiceBenchmark(\"Query compiling\");\nqueryCompilingSuite.add(\"graphql-jit\", async () => {\n await compileQuery(schema, parsedQuery);\n});\n\nconst queryAnnotationSuite = new NiceBenchmark(\"Query annotation\");\nqueryAnnotationSuite.add(\"supermassive\", () => {\n extractMinimalViableSchemaForRequestDocument(schema, parsedQuery);\n});\n\nasync function main() {\n await queryCompilingSuite.run();\n await queryParsingSuite.run();\n await queryAnnotationSuite.run();\n await queryRunningSuite.run();\n}\n\nmain();\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,mBAAmB;AAC1B,OAAO,YAAY;AACnB,OAAO,eAAe;AACtB,OAAO,YAAY;AACnB;AAAA,EACE,WAAW;AAAA,EACX;AAAA,OAEK;AACP,SAAS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selectionSet, groupedFie
87
87
  if (!shouldIncludeNode(exeContext, selection) || !doesFragmentConditionMatch(
88
88
  selection,
89
89
  runtimeTypeName,
90
- exeContext.schemaTypes
90
+ exeContext.partialSchema
91
91
  )) {
92
92
  continue;
93
93
  }
@@ -131,7 +131,7 @@ function collectFieldsImpl(exeContext, runtimeTypeName, selectionSet, groupedFie
131
131
  if (fragment == null || !doesFragmentConditionMatch(
132
132
  fragment,
133
133
  runtimeTypeName,
134
- exeContext.schemaTypes
134
+ exeContext.partialSchema
135
135
  )) {
136
136
  continue;
137
137
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/collectFields.ts"],
4
- "sourcesContent": ["import {\n Kind,\n FieldNode,\n FragmentDefinitionNode,\n FragmentSpreadNode,\n InlineFragmentNode,\n SelectionNode,\n SelectionSetNode,\n} from \"graphql\";\nimport { getDirectiveValues } from \"./values\";\nimport {\n GraphQLSkipDirective,\n GraphQLIncludeDirective,\n GraphQLDeferDirective,\n} from \"./schema/directives\";\n\nimport { AccumulatorMap } from \"./jsutils/AccumulatorMap\";\nimport invariant from \"invariant\";\nimport { ExecutionContext } from \"./executeWithoutSchema\";\nimport { SchemaFragment } from \"./schema/fragment\";\n\nexport type FieldGroup = ReadonlyArray<FieldNode>;\n\nexport type GroupedFieldSet = Map<string, FieldGroup>;\n\nexport interface PatchFields {\n label: string | undefined;\n groupedFieldSet: GroupedFieldSet;\n}\n\nexport interface FieldsAndPatches {\n groupedFieldSet: GroupedFieldSet;\n patches: Array<PatchFields>;\n}\n\n/**\n * Given a selectionSet, collects all of the fields and returns them.\n *\n * CollectFields requires the \"runtime type\" of an object. For a field that\n * returns an Interface or Union type, the \"runtime type\" will be the actual\n * object type returned by that field.\n *\n * @internal\n */\nexport function collectFields(\n exeContext: ExecutionContext,\n runtimeTypeName: string,\n): FieldsAndPatches {\n const { operation } = exeContext;\n const groupedFieldSet = new AccumulatorMap<string, FieldNode>();\n const patches: Array<PatchFields> = [];\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n operation.selectionSet,\n groupedFieldSet,\n patches,\n new Set(),\n );\n return { groupedFieldSet, patches };\n}\n\n/**\n * Given an array of field nodes, collects all of the subfields of the passed\n * in fields, and returns them at the end.\n *\n * CollectSubFields requires the \"return type\" of an object. For a field that\n * returns an Interface or Union type, the \"return type\" will be the actual\n * object type returned by that field.\n *\n * @internal\n */\n// eslint-disable-next-line max-params\nexport function collectSubfields(\n exeContext: ExecutionContext,\n returnTypeName: string,\n fieldGroup: FieldGroup,\n): FieldsAndPatches {\n const subGroupedFieldSet = new AccumulatorMap<string, FieldNode>();\n const visitedFragmentNames = new Set<string>();\n\n const subPatches: Array<PatchFields> = [];\n const subFieldsAndPatches = {\n groupedFieldSet: subGroupedFieldSet,\n patches: subPatches,\n };\n\n for (const node of fieldGroup) {\n if (node.selectionSet) {\n collectFieldsImpl(\n exeContext,\n returnTypeName,\n node.selectionSet,\n subGroupedFieldSet,\n subPatches,\n visitedFragmentNames,\n );\n }\n }\n return subFieldsAndPatches;\n}\n\n// eslint-disable-next-line max-params\nfunction collectFieldsImpl(\n exeContext: ExecutionContext,\n runtimeTypeName: string,\n selectionSet: SelectionSetNode,\n groupedFieldSet: AccumulatorMap<string, FieldNode>,\n patches: Array<PatchFields>,\n visitedFragmentNames: Set<string>,\n): void {\n for (const selection of selectionSet.selections) {\n switch (selection.kind) {\n case Kind.FIELD: {\n if (!shouldIncludeNode(exeContext, selection)) {\n continue;\n }\n groupedFieldSet.add(getFieldEntryKey(selection), selection);\n break;\n }\n case Kind.INLINE_FRAGMENT: {\n if (\n !shouldIncludeNode(exeContext, selection) ||\n !doesFragmentConditionMatch(\n selection,\n runtimeTypeName,\n exeContext.schemaTypes,\n )\n ) {\n continue;\n }\n\n const defer = getDeferValues(exeContext, selection);\n\n if (defer) {\n const patchFields = new AccumulatorMap<string, FieldNode>();\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n selection.selectionSet,\n patchFields,\n patches,\n visitedFragmentNames,\n );\n patches.push({\n label: defer.label,\n groupedFieldSet: patchFields,\n });\n } else {\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n selection.selectionSet,\n groupedFieldSet,\n patches,\n visitedFragmentNames,\n );\n }\n break;\n }\n case Kind.FRAGMENT_SPREAD: {\n const fragName = selection.name.value;\n\n if (!shouldIncludeNode(exeContext, selection)) {\n continue;\n }\n\n const defer = getDeferValues(exeContext, selection);\n if (visitedFragmentNames.has(fragName) && !defer) {\n continue;\n }\n\n const fragment = exeContext.fragments[fragName];\n if (\n fragment == null ||\n !doesFragmentConditionMatch(\n fragment,\n runtimeTypeName,\n exeContext.schemaTypes,\n )\n ) {\n continue;\n }\n\n if (!defer) {\n visitedFragmentNames.add(fragName);\n }\n\n if (defer) {\n const patchFields = new AccumulatorMap<string, FieldNode>();\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n fragment.selectionSet,\n patchFields,\n patches,\n visitedFragmentNames,\n );\n patches.push({\n label: defer.label,\n groupedFieldSet: patchFields,\n });\n } else {\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n fragment.selectionSet,\n groupedFieldSet,\n patches,\n visitedFragmentNames,\n );\n }\n break;\n }\n }\n }\n}\n\n/**\n * Determines if a field should be included based on the @include and @skip\n * directives, where @skip has higher precedence than @include.\n */\nfunction shouldIncludeNode(\n exeContext: ExecutionContext,\n node: SelectionNode,\n): boolean {\n if (!node.directives?.length) {\n return true;\n }\n\n const skip = getDirectiveValues(exeContext, GraphQLSkipDirective, node);\n if (skip?.if === true) {\n return false;\n }\n\n const include = getDirectiveValues(exeContext, GraphQLIncludeDirective, node);\n if (include?.if === false) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Determines if a fragment is applicable to the given type.\n */\nfunction doesFragmentConditionMatch(\n fragment: FragmentDefinitionNode | InlineFragmentNode,\n typeName: string,\n // resolvers: Resolvers,\n schemaFragment: SchemaFragment,\n): boolean {\n const typeConditionNode = fragment.typeCondition;\n if (!typeConditionNode) {\n return true;\n }\n\n const conditionalTypeName = typeConditionNode.name.value;\n\n if (conditionalTypeName === typeName) {\n return true;\n }\n if (schemaFragment.isAbstractType(conditionalTypeName)) {\n return schemaFragment.isSubType(conditionalTypeName, typeName);\n }\n return false;\n}\n\n/**\n * Implements the logic to compute the key of a given field's entry\n */\nfunction getFieldEntryKey(node: FieldNode): string {\n return node.alias ? node.alias.value : node.name.value;\n}\n\n/**\n * Returns an object containing the `@defer` arguments if a field should be\n * deferred based on the experimental flag, defer directive present and\n * not disabled by the \"if\" argument.\n */\nfunction getDeferValues(\n exeContext: ExecutionContext,\n node: FragmentSpreadNode | InlineFragmentNode,\n): undefined | { label: string | undefined } {\n const defer = getDirectiveValues(exeContext, GraphQLDeferDirective, node);\n\n if (!defer) {\n return;\n }\n\n if (defer.if === false) {\n return;\n }\n\n invariant(\n exeContext.operation.operation !== \"subscription\",\n \"`@defer` directive not supported on subscription operations. Disable `@defer` by setting the `if` argument to `false`.\",\n );\n\n return {\n label: typeof defer.label === \"string\" ? defer.label : undefined,\n };\n}\n"],
4
+ "sourcesContent": ["import {\n Kind,\n FieldNode,\n FragmentDefinitionNode,\n FragmentSpreadNode,\n InlineFragmentNode,\n SelectionNode,\n SelectionSetNode,\n} from \"graphql\";\nimport { getDirectiveValues } from \"./values\";\nimport {\n GraphQLSkipDirective,\n GraphQLIncludeDirective,\n GraphQLDeferDirective,\n} from \"./schema/directives\";\n\nimport { AccumulatorMap } from \"./jsutils/AccumulatorMap\";\nimport invariant from \"invariant\";\nimport { ExecutionContext } from \"./executeWithoutSchema\";\nimport { PartialSchema } from \"./schema/fragment\";\n\nexport type FieldGroup = ReadonlyArray<FieldNode>;\n\nexport type GroupedFieldSet = Map<string, FieldGroup>;\n\nexport interface PatchFields {\n label: string | undefined;\n groupedFieldSet: GroupedFieldSet;\n}\n\nexport interface FieldsAndPatches {\n groupedFieldSet: GroupedFieldSet;\n patches: Array<PatchFields>;\n}\n\n/**\n * Given a selectionSet, collects all of the fields and returns them.\n *\n * CollectFields requires the \"runtime type\" of an object. For a field that\n * returns an Interface or Union type, the \"runtime type\" will be the actual\n * object type returned by that field.\n *\n * @internal\n */\nexport function collectFields(\n exeContext: ExecutionContext,\n runtimeTypeName: string,\n): FieldsAndPatches {\n const { operation } = exeContext;\n const groupedFieldSet = new AccumulatorMap<string, FieldNode>();\n const patches: Array<PatchFields> = [];\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n operation.selectionSet,\n groupedFieldSet,\n patches,\n new Set(),\n );\n return { groupedFieldSet, patches };\n}\n\n/**\n * Given an array of field nodes, collects all of the subfields of the passed\n * in fields, and returns them at the end.\n *\n * CollectSubFields requires the \"return type\" of an object. For a field that\n * returns an Interface or Union type, the \"return type\" will be the actual\n * object type returned by that field.\n *\n * @internal\n */\n// eslint-disable-next-line max-params\nexport function collectSubfields(\n exeContext: ExecutionContext,\n returnTypeName: string,\n fieldGroup: FieldGroup,\n): FieldsAndPatches {\n const subGroupedFieldSet = new AccumulatorMap<string, FieldNode>();\n const visitedFragmentNames = new Set<string>();\n\n const subPatches: Array<PatchFields> = [];\n const subFieldsAndPatches = {\n groupedFieldSet: subGroupedFieldSet,\n patches: subPatches,\n };\n\n for (const node of fieldGroup) {\n if (node.selectionSet) {\n collectFieldsImpl(\n exeContext,\n returnTypeName,\n node.selectionSet,\n subGroupedFieldSet,\n subPatches,\n visitedFragmentNames,\n );\n }\n }\n return subFieldsAndPatches;\n}\n\n// eslint-disable-next-line max-params\nfunction collectFieldsImpl(\n exeContext: ExecutionContext,\n runtimeTypeName: string,\n selectionSet: SelectionSetNode,\n groupedFieldSet: AccumulatorMap<string, FieldNode>,\n patches: Array<PatchFields>,\n visitedFragmentNames: Set<string>,\n): void {\n for (const selection of selectionSet.selections) {\n switch (selection.kind) {\n case Kind.FIELD: {\n if (!shouldIncludeNode(exeContext, selection)) {\n continue;\n }\n groupedFieldSet.add(getFieldEntryKey(selection), selection);\n break;\n }\n case Kind.INLINE_FRAGMENT: {\n if (\n !shouldIncludeNode(exeContext, selection) ||\n !doesFragmentConditionMatch(\n selection,\n runtimeTypeName,\n exeContext.partialSchema,\n )\n ) {\n continue;\n }\n\n const defer = getDeferValues(exeContext, selection);\n\n if (defer) {\n const patchFields = new AccumulatorMap<string, FieldNode>();\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n selection.selectionSet,\n patchFields,\n patches,\n visitedFragmentNames,\n );\n patches.push({\n label: defer.label,\n groupedFieldSet: patchFields,\n });\n } else {\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n selection.selectionSet,\n groupedFieldSet,\n patches,\n visitedFragmentNames,\n );\n }\n break;\n }\n case Kind.FRAGMENT_SPREAD: {\n const fragName = selection.name.value;\n\n if (!shouldIncludeNode(exeContext, selection)) {\n continue;\n }\n\n const defer = getDeferValues(exeContext, selection);\n if (visitedFragmentNames.has(fragName) && !defer) {\n continue;\n }\n\n const fragment = exeContext.fragments[fragName];\n if (\n fragment == null ||\n !doesFragmentConditionMatch(\n fragment,\n runtimeTypeName,\n exeContext.partialSchema,\n )\n ) {\n continue;\n }\n\n if (!defer) {\n visitedFragmentNames.add(fragName);\n }\n\n if (defer) {\n const patchFields = new AccumulatorMap<string, FieldNode>();\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n fragment.selectionSet,\n patchFields,\n patches,\n visitedFragmentNames,\n );\n patches.push({\n label: defer.label,\n groupedFieldSet: patchFields,\n });\n } else {\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n fragment.selectionSet,\n groupedFieldSet,\n patches,\n visitedFragmentNames,\n );\n }\n break;\n }\n }\n }\n}\n\n/**\n * Determines if a field should be included based on the @include and @skip\n * directives, where @skip has higher precedence than @include.\n */\nfunction shouldIncludeNode(\n exeContext: ExecutionContext,\n node: SelectionNode,\n): boolean {\n if (!node.directives?.length) {\n return true;\n }\n\n const skip = getDirectiveValues(exeContext, GraphQLSkipDirective, node);\n if (skip?.if === true) {\n return false;\n }\n\n const include = getDirectiveValues(exeContext, GraphQLIncludeDirective, node);\n if (include?.if === false) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Determines if a fragment is applicable to the given type.\n */\nfunction doesFragmentConditionMatch(\n fragment: FragmentDefinitionNode | InlineFragmentNode,\n typeName: string,\n // resolvers: Resolvers,\n schemaFragment: PartialSchema,\n): boolean {\n const typeConditionNode = fragment.typeCondition;\n if (!typeConditionNode) {\n return true;\n }\n\n const conditionalTypeName = typeConditionNode.name.value;\n\n if (conditionalTypeName === typeName) {\n return true;\n }\n if (schemaFragment.isAbstractType(conditionalTypeName)) {\n return schemaFragment.isSubType(conditionalTypeName, typeName);\n }\n return false;\n}\n\n/**\n * Implements the logic to compute the key of a given field's entry\n */\nfunction getFieldEntryKey(node: FieldNode): string {\n return node.alias ? node.alias.value : node.name.value;\n}\n\n/**\n * Returns an object containing the `@defer` arguments if a field should be\n * deferred based on the experimental flag, defer directive present and\n * not disabled by the \"if\" argument.\n */\nfunction getDeferValues(\n exeContext: ExecutionContext,\n node: FragmentSpreadNode | InlineFragmentNode,\n): undefined | { label: string | undefined } {\n const defer = getDirectiveValues(exeContext, GraphQLDeferDirective, node);\n\n if (!defer) {\n return;\n }\n\n if (defer.if === false) {\n return;\n }\n\n invariant(\n exeContext.operation.operation !== \"subscription\",\n \"`@defer` directive not supported on subscription operations. Disable `@defer` by setting the `if` argument to `false`.\",\n );\n\n return {\n label: typeof defer.label === \"string\" ? defer.label : undefined,\n };\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAQO;AACP,oBAAmC;AACnC,wBAIO;AAEP,4BAA+B;AAC/B,uBAAsB;AA2Bf,SAAS,cACd,YACA,iBACkB;AAClB,QAAM,EAAE,UAAU,IAAI;AACtB,QAAM,kBAAkB,IAAI,qCAAkC;AAC9D,QAAM,UAA8B,CAAC;AACrC;AAAA,IACE;AAAA,IACA;AAAA,IACA,UAAU;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;AACnC,MAAI,CAAC,mBAAmB;AACtB,WAAO;AAAA,EACT;AAEA,QAAM,sBAAsB,kBAAkB,KAAK;AAEnD,MAAI,wBAAwB,UAAU;AACpC,WAAO;AAAA,EACT;AACA,MAAI,eAAe,eAAe,mBAAmB,GAAG;AACtD,WAAO,eAAe,UAAU,qBAAqB,QAAQ;AAAA,EAC/D;AACA,SAAO;AACT;AAKA,SAAS,iBAAiB,MAAyB;AACjD,SAAO,KAAK,QAAQ,KAAK,MAAM,QAAQ,KAAK,KAAK;AACnD;AAOA,SAAS,eACP,YACA,MAC2C;AAC3C,QAAM,YAAQ,kCAAmB,YAAY,yCAAuB,IAAI;AAExE,MAAI,CAAC,OAAO;AACV;AAAA,EACF;AAEA,MAAI,MAAM,OAAO,OAAO;AACtB;AAAA,EACF;AAEA,uBAAAA;AAAA,IACE,WAAW,UAAU,cAAc;AAAA,IACnC;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAO,OAAO,MAAM,UAAU,WAAW,MAAM,QAAQ;AAAA,EACzD;AACF;",
6
6
  "names": ["invariant"]
7
7
  }
@@ -60,7 +60,7 @@ function collectFieldsImpl(exeContext, runtimeTypeName, selectionSet, groupedFie
60
60
  if (!shouldIncludeNode(exeContext, selection) || !doesFragmentConditionMatch(
61
61
  selection,
62
62
  runtimeTypeName,
63
- exeContext.schemaTypes
63
+ exeContext.partialSchema
64
64
  )) {
65
65
  continue;
66
66
  }
@@ -104,7 +104,7 @@ function collectFieldsImpl(exeContext, runtimeTypeName, selectionSet, groupedFie
104
104
  if (fragment == null || !doesFragmentConditionMatch(
105
105
  fragment,
106
106
  runtimeTypeName,
107
- exeContext.schemaTypes
107
+ exeContext.partialSchema
108
108
  )) {
109
109
  continue;
110
110
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/collectFields.ts"],
4
- "sourcesContent": ["import {\n Kind,\n FieldNode,\n FragmentDefinitionNode,\n FragmentSpreadNode,\n InlineFragmentNode,\n SelectionNode,\n SelectionSetNode,\n} from \"graphql\";\nimport { getDirectiveValues } from \"./values\";\nimport {\n GraphQLSkipDirective,\n GraphQLIncludeDirective,\n GraphQLDeferDirective,\n} from \"./schema/directives\";\n\nimport { AccumulatorMap } from \"./jsutils/AccumulatorMap\";\nimport invariant from \"invariant\";\nimport { ExecutionContext } from \"./executeWithoutSchema\";\nimport { SchemaFragment } from \"./schema/fragment\";\n\nexport type FieldGroup = ReadonlyArray<FieldNode>;\n\nexport type GroupedFieldSet = Map<string, FieldGroup>;\n\nexport interface PatchFields {\n label: string | undefined;\n groupedFieldSet: GroupedFieldSet;\n}\n\nexport interface FieldsAndPatches {\n groupedFieldSet: GroupedFieldSet;\n patches: Array<PatchFields>;\n}\n\n/**\n * Given a selectionSet, collects all of the fields and returns them.\n *\n * CollectFields requires the \"runtime type\" of an object. For a field that\n * returns an Interface or Union type, the \"runtime type\" will be the actual\n * object type returned by that field.\n *\n * @internal\n */\nexport function collectFields(\n exeContext: ExecutionContext,\n runtimeTypeName: string,\n): FieldsAndPatches {\n const { operation } = exeContext;\n const groupedFieldSet = new AccumulatorMap<string, FieldNode>();\n const patches: Array<PatchFields> = [];\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n operation.selectionSet,\n groupedFieldSet,\n patches,\n new Set(),\n );\n return { groupedFieldSet, patches };\n}\n\n/**\n * Given an array of field nodes, collects all of the subfields of the passed\n * in fields, and returns them at the end.\n *\n * CollectSubFields requires the \"return type\" of an object. For a field that\n * returns an Interface or Union type, the \"return type\" will be the actual\n * object type returned by that field.\n *\n * @internal\n */\n// eslint-disable-next-line max-params\nexport function collectSubfields(\n exeContext: ExecutionContext,\n returnTypeName: string,\n fieldGroup: FieldGroup,\n): FieldsAndPatches {\n const subGroupedFieldSet = new AccumulatorMap<string, FieldNode>();\n const visitedFragmentNames = new Set<string>();\n\n const subPatches: Array<PatchFields> = [];\n const subFieldsAndPatches = {\n groupedFieldSet: subGroupedFieldSet,\n patches: subPatches,\n };\n\n for (const node of fieldGroup) {\n if (node.selectionSet) {\n collectFieldsImpl(\n exeContext,\n returnTypeName,\n node.selectionSet,\n subGroupedFieldSet,\n subPatches,\n visitedFragmentNames,\n );\n }\n }\n return subFieldsAndPatches;\n}\n\n// eslint-disable-next-line max-params\nfunction collectFieldsImpl(\n exeContext: ExecutionContext,\n runtimeTypeName: string,\n selectionSet: SelectionSetNode,\n groupedFieldSet: AccumulatorMap<string, FieldNode>,\n patches: Array<PatchFields>,\n visitedFragmentNames: Set<string>,\n): void {\n for (const selection of selectionSet.selections) {\n switch (selection.kind) {\n case Kind.FIELD: {\n if (!shouldIncludeNode(exeContext, selection)) {\n continue;\n }\n groupedFieldSet.add(getFieldEntryKey(selection), selection);\n break;\n }\n case Kind.INLINE_FRAGMENT: {\n if (\n !shouldIncludeNode(exeContext, selection) ||\n !doesFragmentConditionMatch(\n selection,\n runtimeTypeName,\n exeContext.schemaTypes,\n )\n ) {\n continue;\n }\n\n const defer = getDeferValues(exeContext, selection);\n\n if (defer) {\n const patchFields = new AccumulatorMap<string, FieldNode>();\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n selection.selectionSet,\n patchFields,\n patches,\n visitedFragmentNames,\n );\n patches.push({\n label: defer.label,\n groupedFieldSet: patchFields,\n });\n } else {\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n selection.selectionSet,\n groupedFieldSet,\n patches,\n visitedFragmentNames,\n );\n }\n break;\n }\n case Kind.FRAGMENT_SPREAD: {\n const fragName = selection.name.value;\n\n if (!shouldIncludeNode(exeContext, selection)) {\n continue;\n }\n\n const defer = getDeferValues(exeContext, selection);\n if (visitedFragmentNames.has(fragName) && !defer) {\n continue;\n }\n\n const fragment = exeContext.fragments[fragName];\n if (\n fragment == null ||\n !doesFragmentConditionMatch(\n fragment,\n runtimeTypeName,\n exeContext.schemaTypes,\n )\n ) {\n continue;\n }\n\n if (!defer) {\n visitedFragmentNames.add(fragName);\n }\n\n if (defer) {\n const patchFields = new AccumulatorMap<string, FieldNode>();\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n fragment.selectionSet,\n patchFields,\n patches,\n visitedFragmentNames,\n );\n patches.push({\n label: defer.label,\n groupedFieldSet: patchFields,\n });\n } else {\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n fragment.selectionSet,\n groupedFieldSet,\n patches,\n visitedFragmentNames,\n );\n }\n break;\n }\n }\n }\n}\n\n/**\n * Determines if a field should be included based on the @include and @skip\n * directives, where @skip has higher precedence than @include.\n */\nfunction shouldIncludeNode(\n exeContext: ExecutionContext,\n node: SelectionNode,\n): boolean {\n if (!node.directives?.length) {\n return true;\n }\n\n const skip = getDirectiveValues(exeContext, GraphQLSkipDirective, node);\n if (skip?.if === true) {\n return false;\n }\n\n const include = getDirectiveValues(exeContext, GraphQLIncludeDirective, node);\n if (include?.if === false) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Determines if a fragment is applicable to the given type.\n */\nfunction doesFragmentConditionMatch(\n fragment: FragmentDefinitionNode | InlineFragmentNode,\n typeName: string,\n // resolvers: Resolvers,\n schemaFragment: SchemaFragment,\n): boolean {\n const typeConditionNode = fragment.typeCondition;\n if (!typeConditionNode) {\n return true;\n }\n\n const conditionalTypeName = typeConditionNode.name.value;\n\n if (conditionalTypeName === typeName) {\n return true;\n }\n if (schemaFragment.isAbstractType(conditionalTypeName)) {\n return schemaFragment.isSubType(conditionalTypeName, typeName);\n }\n return false;\n}\n\n/**\n * Implements the logic to compute the key of a given field's entry\n */\nfunction getFieldEntryKey(node: FieldNode): string {\n return node.alias ? node.alias.value : node.name.value;\n}\n\n/**\n * Returns an object containing the `@defer` arguments if a field should be\n * deferred based on the experimental flag, defer directive present and\n * not disabled by the \"if\" argument.\n */\nfunction getDeferValues(\n exeContext: ExecutionContext,\n node: FragmentSpreadNode | InlineFragmentNode,\n): undefined | { label: string | undefined } {\n const defer = getDirectiveValues(exeContext, GraphQLDeferDirective, node);\n\n if (!defer) {\n return;\n }\n\n if (defer.if === false) {\n return;\n }\n\n invariant(\n exeContext.operation.operation !== \"subscription\",\n \"`@defer` directive not supported on subscription operations. Disable `@defer` by setting the `if` argument to `false`.\",\n );\n\n return {\n label: typeof defer.label === \"string\" ? defer.label : undefined,\n };\n}\n"],
4
+ "sourcesContent": ["import {\n Kind,\n FieldNode,\n FragmentDefinitionNode,\n FragmentSpreadNode,\n InlineFragmentNode,\n SelectionNode,\n SelectionSetNode,\n} from \"graphql\";\nimport { getDirectiveValues } from \"./values\";\nimport {\n GraphQLSkipDirective,\n GraphQLIncludeDirective,\n GraphQLDeferDirective,\n} from \"./schema/directives\";\n\nimport { AccumulatorMap } from \"./jsutils/AccumulatorMap\";\nimport invariant from \"invariant\";\nimport { ExecutionContext } from \"./executeWithoutSchema\";\nimport { PartialSchema } from \"./schema/fragment\";\n\nexport type FieldGroup = ReadonlyArray<FieldNode>;\n\nexport type GroupedFieldSet = Map<string, FieldGroup>;\n\nexport interface PatchFields {\n label: string | undefined;\n groupedFieldSet: GroupedFieldSet;\n}\n\nexport interface FieldsAndPatches {\n groupedFieldSet: GroupedFieldSet;\n patches: Array<PatchFields>;\n}\n\n/**\n * Given a selectionSet, collects all of the fields and returns them.\n *\n * CollectFields requires the \"runtime type\" of an object. For a field that\n * returns an Interface or Union type, the \"runtime type\" will be the actual\n * object type returned by that field.\n *\n * @internal\n */\nexport function collectFields(\n exeContext: ExecutionContext,\n runtimeTypeName: string,\n): FieldsAndPatches {\n const { operation } = exeContext;\n const groupedFieldSet = new AccumulatorMap<string, FieldNode>();\n const patches: Array<PatchFields> = [];\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n operation.selectionSet,\n groupedFieldSet,\n patches,\n new Set(),\n );\n return { groupedFieldSet, patches };\n}\n\n/**\n * Given an array of field nodes, collects all of the subfields of the passed\n * in fields, and returns them at the end.\n *\n * CollectSubFields requires the \"return type\" of an object. For a field that\n * returns an Interface or Union type, the \"return type\" will be the actual\n * object type returned by that field.\n *\n * @internal\n */\n// eslint-disable-next-line max-params\nexport function collectSubfields(\n exeContext: ExecutionContext,\n returnTypeName: string,\n fieldGroup: FieldGroup,\n): FieldsAndPatches {\n const subGroupedFieldSet = new AccumulatorMap<string, FieldNode>();\n const visitedFragmentNames = new Set<string>();\n\n const subPatches: Array<PatchFields> = [];\n const subFieldsAndPatches = {\n groupedFieldSet: subGroupedFieldSet,\n patches: subPatches,\n };\n\n for (const node of fieldGroup) {\n if (node.selectionSet) {\n collectFieldsImpl(\n exeContext,\n returnTypeName,\n node.selectionSet,\n subGroupedFieldSet,\n subPatches,\n visitedFragmentNames,\n );\n }\n }\n return subFieldsAndPatches;\n}\n\n// eslint-disable-next-line max-params\nfunction collectFieldsImpl(\n exeContext: ExecutionContext,\n runtimeTypeName: string,\n selectionSet: SelectionSetNode,\n groupedFieldSet: AccumulatorMap<string, FieldNode>,\n patches: Array<PatchFields>,\n visitedFragmentNames: Set<string>,\n): void {\n for (const selection of selectionSet.selections) {\n switch (selection.kind) {\n case Kind.FIELD: {\n if (!shouldIncludeNode(exeContext, selection)) {\n continue;\n }\n groupedFieldSet.add(getFieldEntryKey(selection), selection);\n break;\n }\n case Kind.INLINE_FRAGMENT: {\n if (\n !shouldIncludeNode(exeContext, selection) ||\n !doesFragmentConditionMatch(\n selection,\n runtimeTypeName,\n exeContext.partialSchema,\n )\n ) {\n continue;\n }\n\n const defer = getDeferValues(exeContext, selection);\n\n if (defer) {\n const patchFields = new AccumulatorMap<string, FieldNode>();\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n selection.selectionSet,\n patchFields,\n patches,\n visitedFragmentNames,\n );\n patches.push({\n label: defer.label,\n groupedFieldSet: patchFields,\n });\n } else {\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n selection.selectionSet,\n groupedFieldSet,\n patches,\n visitedFragmentNames,\n );\n }\n break;\n }\n case Kind.FRAGMENT_SPREAD: {\n const fragName = selection.name.value;\n\n if (!shouldIncludeNode(exeContext, selection)) {\n continue;\n }\n\n const defer = getDeferValues(exeContext, selection);\n if (visitedFragmentNames.has(fragName) && !defer) {\n continue;\n }\n\n const fragment = exeContext.fragments[fragName];\n if (\n fragment == null ||\n !doesFragmentConditionMatch(\n fragment,\n runtimeTypeName,\n exeContext.partialSchema,\n )\n ) {\n continue;\n }\n\n if (!defer) {\n visitedFragmentNames.add(fragName);\n }\n\n if (defer) {\n const patchFields = new AccumulatorMap<string, FieldNode>();\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n fragment.selectionSet,\n patchFields,\n patches,\n visitedFragmentNames,\n );\n patches.push({\n label: defer.label,\n groupedFieldSet: patchFields,\n });\n } else {\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n fragment.selectionSet,\n groupedFieldSet,\n patches,\n visitedFragmentNames,\n );\n }\n break;\n }\n }\n }\n}\n\n/**\n * Determines if a field should be included based on the @include and @skip\n * directives, where @skip has higher precedence than @include.\n */\nfunction shouldIncludeNode(\n exeContext: ExecutionContext,\n node: SelectionNode,\n): boolean {\n if (!node.directives?.length) {\n return true;\n }\n\n const skip = getDirectiveValues(exeContext, GraphQLSkipDirective, node);\n if (skip?.if === true) {\n return false;\n }\n\n const include = getDirectiveValues(exeContext, GraphQLIncludeDirective, node);\n if (include?.if === false) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Determines if a fragment is applicable to the given type.\n */\nfunction doesFragmentConditionMatch(\n fragment: FragmentDefinitionNode | InlineFragmentNode,\n typeName: string,\n // resolvers: Resolvers,\n schemaFragment: PartialSchema,\n): boolean {\n const typeConditionNode = fragment.typeCondition;\n if (!typeConditionNode) {\n return true;\n }\n\n const conditionalTypeName = typeConditionNode.name.value;\n\n if (conditionalTypeName === typeName) {\n return true;\n }\n if (schemaFragment.isAbstractType(conditionalTypeName)) {\n return schemaFragment.isSubType(conditionalTypeName, typeName);\n }\n return false;\n}\n\n/**\n * Implements the logic to compute the key of a given field's entry\n */\nfunction getFieldEntryKey(node: FieldNode): string {\n return node.alias ? node.alias.value : node.name.value;\n}\n\n/**\n * Returns an object containing the `@defer` arguments if a field should be\n * deferred based on the experimental flag, defer directive present and\n * not disabled by the \"if\" argument.\n */\nfunction getDeferValues(\n exeContext: ExecutionContext,\n node: FragmentSpreadNode | InlineFragmentNode,\n): undefined | { label: string | undefined } {\n const defer = getDirectiveValues(exeContext, GraphQLDeferDirective, node);\n\n if (!defer) {\n return;\n }\n\n if (defer.if === false) {\n return;\n }\n\n invariant(\n exeContext.operation.operation !== \"subscription\",\n \"`@defer` directive not supported on subscription operations. Disable `@defer` by setting the `if` argument to `false`.\",\n );\n\n return {\n label: typeof defer.label === \"string\" ? defer.label : undefined,\n };\n}\n"],
5
5
  "mappings": ";AAAA;AAAA,EACE;AAAA,OAOK;AACP,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,sBAAsB;AAC/B,OAAO,eAAe;AA2Bf,SAAS,cACd,YACA,iBACkB;AAClB,QAAM,EAAE,UAAU,IAAI;AACtB,QAAM,kBAAkB,IAAI,eAAkC;AAC9D,QAAM,UAA8B,CAAC;AACrC;AAAA,IACE;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,oBAAI,IAAI;AAAA,EACV;AACA,SAAO,EAAE,iBAAiB,QAAQ;AACpC;AAaO,SAAS,iBACd,YACA,gBACA,YACkB;AAClB,QAAM,qBAAqB,IAAI,eAAkC;AACjE,QAAM,uBAAuB,oBAAI,IAAY;AAE7C,QAAM,aAAiC,CAAC;AACxC,QAAM,sBAAsB;AAAA,IAC1B,iBAAiB;AAAA,IACjB,SAAS;AAAA,EACX;AAEA,aAAW,QAAQ,YAAY;AAC7B,QAAI,KAAK,cAAc;AACrB;AAAA,QACE;AAAA,QACA;AAAA,QACA,KAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAGA,SAAS,kBACP,YACA,iBACA,cACA,iBACA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AW,UAAU,cAAc;AAAA,IACnC;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAO,OAAO,MAAM,UAAU,WAAW,MAAM,QAAQ;AAAA,EACzD;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
1
  import { PromiseOrValue } from "./jsutils/PromiseOrValue";
2
2
  import { ExecutionResult, ExecutionWithSchemaArgs } from "./types";
3
- export declare function executeWithSchema({ typeDefs, resolvers, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver, fieldExecutionHooks, }: ExecutionWithSchemaArgs): PromiseOrValue<ExecutionResult>;
3
+ export declare function executeWithSchema({ schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver, fieldExecutionHooks, }: ExecutionWithSchemaArgs): PromiseOrValue<ExecutionResult>;
4
4
  //# sourceMappingURL=executeWithSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"executeWithSchema.d.ts","sourceRoot":"","sources":["../src/executeWithSchema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAGnE,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,mBAAmB,GACpB,EAAE,uBAAuB,GAAG,cAAc,CAAC,eAAe,CAAC,CAmB3D"}
1
+ {"version":3,"file":"executeWithSchema.d.ts","sourceRoot":"","sources":["../src/executeWithSchema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAGnE,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,mBAAmB,GACpB,EAAE,uBAAuB,GAAG,cAAc,CAAC,eAAe,CAAC,CAmB3D"}