@graphitation/supermassive 3.0.0-alpha.7 → 3.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintcache +1 -1
- package/CHANGELOG.md +10 -2
- package/README.md +137 -26
- package/lib/__testUtils__/execute.d.ts.map +1 -1
- package/lib/__testUtils__/execute.js +2 -5
- package/lib/__testUtils__/execute.js.map +2 -2
- package/lib/__testUtils__/execute.mjs +2 -5
- package/lib/__testUtils__/execute.mjs.map +2 -2
- package/lib/executeWithSchema.d.ts +1 -1
- package/lib/executeWithSchema.d.ts.map +1 -1
- package/lib/executeWithSchema.js +9 -23
- package/lib/executeWithSchema.js.map +2 -2
- package/lib/executeWithSchema.mjs +9 -26
- package/lib/executeWithSchema.mjs.map +2 -2
- package/lib/executeWithoutSchema.d.ts.map +1 -1
- package/lib/executeWithoutSchema.js +3 -2
- package/lib/executeWithoutSchema.js.map +2 -2
- package/lib/executeWithoutSchema.mjs +3 -2
- package/lib/executeWithoutSchema.mjs.map +2 -2
- package/lib/subscribeWithSchema.d.ts +1 -1
- package/lib/subscribeWithSchema.d.ts.map +1 -1
- package/lib/subscribeWithSchema.js +9 -23
- package/lib/subscribeWithSchema.js.map +2 -2
- package/lib/subscribeWithSchema.mjs +9 -26
- package/lib/subscribeWithSchema.mjs.map +2 -2
- package/lib/types.d.ts +3 -7
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
# Change Log - @graphitation/supermassive
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 14 Sep 2023 19:05:21 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 3.0.0-alpha.8
|
|
8
|
+
|
|
9
|
+
Thu, 14 Sep 2023 19:05:21 GMT
|
|
10
|
+
|
|
11
|
+
### Changes
|
|
12
|
+
|
|
13
|
+
- change signature of executeWithSchema and subscribeWithSchema functions (vladimir.razuvaev@gmail.com)
|
|
14
|
+
|
|
7
15
|
## 3.0.0-alpha.7
|
|
8
16
|
|
|
9
|
-
Tue, 12 Sep 2023 23:58:
|
|
17
|
+
Tue, 12 Sep 2023 23:58:31 GMT
|
|
10
18
|
|
|
11
19
|
### Changes
|
|
12
20
|
|
package/README.md
CHANGED
|
@@ -27,22 +27,38 @@ Similarly, the GraphQL operations themselves, described using e.g. [GraphQL SDL]
|
|
|
27
27
|
|
|
28
28
|
### Current
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Starting with version 3.0, supermassive expects a compact fragment of the schema alongside documents that are sent to it.
|
|
31
|
+
It doesn't require having a full schema, only a small fragment necessary for a specific operation.
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
Schema fragment format is much more compact than the graphql-js AST. It is optimized for fast merging and serializing,
|
|
34
|
+
so you can incrementally load and merge schema fragments as different operations are requested.
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
Different strategies of "fragmentizing" the schema are possible, it is up to your specific case which strategy to choose.
|
|
37
|
+
Below you can find some strategies that we found useful.
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
need.
|
|
39
|
+
#### 1. Schema fragment by operation
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
We can extract schema fragments by running a pre-processing step on queries, in the same stage where `graphql` tags would normally be extracted and pre-parsed.
|
|
42
|
+
Supermassive package contains several handy utilities for this strategy.
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
#### 2. Schema modules
|
|
45
|
+
|
|
46
|
+
If the schema is big enough, it is a common practice to split it into [multiple modules](https://the-guild.dev/graphql/modules/docs).
|
|
47
|
+
In this case the natural strategy is to generate a single fragment per module. Supermassive supports custom fragment loader,
|
|
48
|
+
so when an operation contains an unknown field or type, supermassive will request a fragment for it.
|
|
49
|
+
This strategy implies "schema map" to properly map operations or individual types to appropriate schema modules
|
|
50
|
+
(schema map generation is out of scope for supermassive itself).
|
|
51
|
+
|
|
52
|
+
#### 3. Variation of the two
|
|
53
|
+
|
|
54
|
+
Other strategies usually represent a variation of those two. E.g. a fragment per specific group of operations, group of modules,
|
|
55
|
+
or mix of modules and operations. Supermassive is agnostic to your "fragmentizing" strategy.
|
|
56
|
+
|
|
57
|
+
### Possible future - pre-normalized executor
|
|
42
58
|
|
|
43
59
|
In a scenario where executor is running close to the client (sometimes even in same process or at least in same browser), it might be worth exploring removing some of the requirements imposed by the usual GraphQL transport - for example serialization. Not only GraphQL executors do the JSON serialization, but also they return the data that is optimized for transport and that matches the query tree. This means clients need to perform often expensive normazilation. As traffic and message size might be less important in same process / same browser scenarios, it might be worthwhile exploring return pre-normalized data from supermassive. This offers massive speedups for some clients like Apollo ([see benchmarks](https://github.com/vladar/graphql-normalized)).
|
|
44
60
|
|
|
45
|
-
### Possible future
|
|
61
|
+
### Possible future - Tree-shaking based on documents
|
|
46
62
|
|
|
47
63
|
Current implementation is more efficient in terms of bundles than one requiring full schema, but resolvers are also not always needed. By going through fields being selected in the documents, resolvers can be split or tree-shook to only load ones that are required for certain frontend bundle.
|
|
48
64
|
|
|
@@ -73,7 +89,7 @@ This would lead to the following [conceptual] tree-shaking after compilation of
|
|
|
73
89
|
};
|
|
74
90
|
```
|
|
75
91
|
|
|
76
|
-
### Possible future
|
|
92
|
+
### Possible future - GraphQL-to-JS
|
|
77
93
|
|
|
78
94
|
We can expand on the previous phase by ahead-of-time compiling the resolution of the operations, their field-resolvers, and invocation thereof into JavaScript code. This essentially does away with any need for AST of the operation during execution. This means execution will be faster as no more generic lookups and checks need to be performed.
|
|
79
95
|
|
|
@@ -142,7 +158,7 @@ function CurrentUserNameQuery(rootSource = {}) {
|
|
|
142
158
|
CurrentUserNameQuery();
|
|
143
159
|
```
|
|
144
160
|
|
|
145
|
-
### Possible future
|
|
161
|
+
### Possible future - persisted queries
|
|
146
162
|
|
|
147
163
|
we can make it possible to replace the operations at runtime using a simple identifier, thus allowing GraphQL clients to execute their operations using these identifiers that they obtain through a concept known as ["persisted queries"](https://relay.dev/docs/guides/persisted-queries/). This means that GraphQL clients that do not require graphql-js AST _themselves_ to operate, such as Relay, will be able to greatly reduce the size of the User-Experience bundles by entirely eliminating the document in favour of a short identifier.
|
|
148
164
|
|
|
@@ -176,15 +192,28 @@ function CurrentUser() {
|
|
|
176
192
|
|
|
177
193
|
## Usage
|
|
178
194
|
|
|
179
|
-
There are 3 main parts of Supermassive
|
|
195
|
+
There are 3 main parts of Supermassive:
|
|
196
|
+
|
|
197
|
+
1. The executor
|
|
198
|
+
2. Minimal viable schema fragment extractor and query annotator (for [schema fragment by operation](#1-schema-fragment-by-operation) strategy)
|
|
199
|
+
3. Schema fragment encoder from/to graphql-js AST (for [schema modules](#2-schema-modules) strategy) + utilities for fragment merging
|
|
200
|
+
|
|
201
|
+
Executor is the part that actually runs the queries. It takes operation document and schema fragment (composed of resolvers and compact type definitions) and optionally, schema fragment loader.
|
|
202
|
+
|
|
203
|
+
Schema fragment extractor process query to extract type definitions necessary to execute this query.
|
|
204
|
+
Query annotator could be used to inline those type definitions into query itself (e.g. as a directive).
|
|
205
|
+
Annotator can be run as part of query extraction stage in Relay Compiler or eg in `@graphitation/graphql-js-tag`.
|
|
206
|
+
|
|
207
|
+
Schema fragment encoder is necessary to produce schema fragments based on [schema modules](#2-schema-modules).
|
|
208
|
+
It takes graphql-js AST of the individual schema module and converts it to the compact schema fragment format.
|
|
180
209
|
|
|
181
210
|
### Executor
|
|
182
211
|
|
|
183
|
-
Two functions are provided - `executeWithSchema` and `executeWithoutSchema`. They attempt to match `graphql-js`'s `execute` function parameters. `executeWithSchema` fully matches it and is meant for development or testing. It does the
|
|
212
|
+
Two functions are provided - `executeWithSchema` and `executeWithoutSchema`. They attempt to match `graphql-js`'s `execute` function parameters. `executeWithSchema` fully matches it and is meant for development or testing. It does the schema fragment extraction for operation in runtime. `executeWithoutSchema` expects schema fragment extracted at build/compile-time, as a required argument.
|
|
184
213
|
|
|
185
|
-
```
|
|
214
|
+
```ts
|
|
186
215
|
interface CommonExecutionArgs {
|
|
187
|
-
|
|
216
|
+
document: DocumentNode;
|
|
188
217
|
rootValue?: unknown;
|
|
189
218
|
contextValue?: unknown;
|
|
190
219
|
variableValues?: Maybe<{ [variable: string]: unknown }>;
|
|
@@ -193,29 +222,111 @@ interface CommonExecutionArgs {
|
|
|
193
222
|
typeResolver?: Maybe<TypeResolver<any, any>>;
|
|
194
223
|
}
|
|
195
224
|
type ExecutionWithoutSchemaArgs = CommonExecutionArgs & {
|
|
196
|
-
|
|
225
|
+
schemaFragment: SchemaFragment;
|
|
226
|
+
schemaFragmentLoader?: SchemaFragmentLoader;
|
|
197
227
|
};
|
|
198
228
|
|
|
199
229
|
type ExecutionWithSchemaArgs = CommonExecutionArgs & {
|
|
200
|
-
|
|
201
|
-
|
|
230
|
+
definitions: DocumentNode;
|
|
231
|
+
resolvers: UserResolvers;
|
|
202
232
|
};
|
|
203
233
|
|
|
204
|
-
function executeWithoutSchema(
|
|
234
|
+
function executeWithoutSchema(
|
|
235
|
+
args: ExecutionWithoutSchemaArgs,
|
|
236
|
+
): PromiseOrValue<ExecutionResult>;
|
|
237
|
+
|
|
238
|
+
function executeWithSchema(
|
|
239
|
+
args: ExecutionWithSchemaArgs,
|
|
240
|
+
): PromiseOrValue<ExecutionResult>;
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Minimal viable schema extractor
|
|
205
244
|
|
|
206
|
-
|
|
245
|
+
Extracts minimal schema fragment necessary for operation execution with supermassive.
|
|
246
|
+
|
|
247
|
+
```ts
|
|
248
|
+
export function extractMinimalViableSchemaForRequestDocument(
|
|
249
|
+
schema: GraphQLSchema,
|
|
250
|
+
requestDocument: DocumentNode,
|
|
251
|
+
): { definitions: SchemaDefinitions; unknownDirectives: DirectiveNode[] };
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Webpack Transform
|
|
255
|
+
|
|
256
|
+
Inlines schema definitions extracted with `extractMinimalViableSchemaForRequestDocument` into the `@schema` directive of each operation / fragment node.
|
|
257
|
+
|
|
258
|
+
With `@graphitation/graphql-js-tag` and `@graphitation/ts-transform-graphql-js-tag` (in webpack config)
|
|
259
|
+
|
|
260
|
+
```js
|
|
261
|
+
import { buildASTSchema } from 'graphql'
|
|
262
|
+
import { getTransformer } from "@graphitation/ts-transform-graphql-js-tag";
|
|
263
|
+
import { annotateDocumentGraphQLTransform } from "@graphitation/supermassive";
|
|
264
|
+
|
|
265
|
+
// ...
|
|
266
|
+
|
|
267
|
+
{
|
|
268
|
+
test: /\.tsx?$/,
|
|
269
|
+
loader: "ts-loader",
|
|
270
|
+
options: {
|
|
271
|
+
getCustomTransformers: () => ({
|
|
272
|
+
before: [
|
|
273
|
+
getTransformer({
|
|
274
|
+
graphqlTagModuleExport: "graphql",
|
|
275
|
+
transformer: annotateDocumentGraphQLTransform(
|
|
276
|
+
buildASTSchema({
|
|
277
|
+
fs.readFileSync(
|
|
278
|
+
"PATH_TO_SCHEMA_TYPEDEFS.graphql",
|
|
279
|
+
{ encoding: "utf-8" }
|
|
280
|
+
),
|
|
281
|
+
)
|
|
282
|
+
),
|
|
283
|
+
}),
|
|
284
|
+
],
|
|
285
|
+
}),
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
}
|
|
207
289
|
```
|
|
208
290
|
|
|
209
|
-
###
|
|
291
|
+
### Schema definitions encoder
|
|
210
292
|
|
|
211
|
-
|
|
293
|
+
Encodes SDL type definitions represented by graphql-js AST to compact format, necessary for execution with supermassive.
|
|
212
294
|
|
|
213
|
-
|
|
295
|
+
```ts
|
|
296
|
+
export function encodeASTSchema(
|
|
297
|
+
schemaFragment: DocumentNode,
|
|
298
|
+
): SchemaDefinitions[];
|
|
299
|
+
export function decodeASTSchema(
|
|
300
|
+
encodedSchemaFragments: SchemaDefinitions[],
|
|
301
|
+
): DocumentNode;
|
|
302
|
+
```
|
|
214
303
|
|
|
215
|
-
|
|
304
|
+
Usage example:
|
|
216
305
|
|
|
217
|
-
```
|
|
218
|
-
|
|
306
|
+
```js
|
|
307
|
+
import { prase } from "graphql";
|
|
308
|
+
import { encodeASTSchema, decodeASTSchema } from "@graphitation/supermassive";
|
|
309
|
+
|
|
310
|
+
const typeDefs = parse(
|
|
311
|
+
fs.readFileSync("PATH_TO_SCHEMA_TYPEDEFS.graphql", { encoding: "utf-8" }),
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
const encodedTypeDefs = encodeASTSchema(typeDefs);
|
|
315
|
+
const decodedTypeDefs = decodeASTSchema(encodedTypeDefs); // decodedTypeDefs are same as typeDefs
|
|
219
316
|
```
|
|
220
317
|
|
|
221
|
-
|
|
318
|
+
### Utilities for definitions and resolvers merging
|
|
319
|
+
|
|
320
|
+
Utilities are useful when it is necessary to produce a single schema fragment from multiple schema fragments.
|
|
321
|
+
|
|
322
|
+
```ts
|
|
323
|
+
export function mergeSchemaDefinitions(
|
|
324
|
+
accumulator: SchemaDefinitions,
|
|
325
|
+
definitions: SchemaDefinitions[],
|
|
326
|
+
): SchemaDefinitions;
|
|
327
|
+
|
|
328
|
+
export function mergeResolvers(
|
|
329
|
+
accumulator: Resolvers,
|
|
330
|
+
resolvers: (Resolvers | Resolvers[])[],
|
|
331
|
+
): Resolvers;
|
|
332
|
+
```
|
|
@@ -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;AAI1D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,KAAK,aAAa,CAAC,KAAK,G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AC,GAAG,eAAe,CAC9D;oEAkCS,aAAa,SACd,MAAM,cACF,OAAO,MAAM,EAAE,OAAO,CAAC;iDAjC1B,aAAa,SACd,MAAM,cACD,OAAO,MAAM,EAAE,OAAO,CAAC;6BAkG3B,eAAe,GAAG,aAAa,KACtC,QAAQ,OAAO,CAAC;sCAhCX,oBAAoB,KACzB,eAAe,aAAa,CAAC;EA8DjC"}
|
|
@@ -84,11 +84,8 @@ function createExecutionUtils(graphqlExecute, graphqlSubscribe) {
|
|
|
84
84
|
const result = yield drainExecution(
|
|
85
85
|
yield (0, import_executeWithSchema.executeWithSchema)({
|
|
86
86
|
document,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
definitions: import_swapi_schema.typeDefs,
|
|
90
|
-
resolvers: import_resolvers.default
|
|
91
|
-
},
|
|
87
|
+
definitions: import_swapi_schema.typeDefs,
|
|
88
|
+
resolvers: import_resolvers.default,
|
|
92
89
|
contextValue: {
|
|
93
90
|
models: import_models.default
|
|
94
91
|
},
|
|
@@ -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/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
|
|
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,
|
|
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 definitions: typeDefs,\n resolvers: resolvers as UserResolvers<unknown, unknown>,\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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gB,KAAK;AAC3B,QAAI;AACJ,eAAW,cAAe,KAAK,SAC5B,aAAa;AACd,cAAQ,WAAW,MAAM;AAAA,QACvB,KAAK,oBAAK;AACR,cAAI,iBAAiB,MAAM;AACzB,gBAAI,cAAc,QAAW;AAC3B,oBAAM,IAAI,MAAM,uBAAuB;AAAA,YACzC;AACA,wBAAY;AAAA,UACd,aAAW,gBAAW,SAAX,mBAAiB,WAAU,eAAe;AACnD,wBAAY;AAAA,UACd;AACA;AAAA,MACJ;AAAA,IACF;AACA,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,MAAM,uBAAuB;AAAA,IACzC;AAEA,QAAI,UAAU,cAAc,iCAAkB,cAAc;AAC1D,aAAO,iBAAiB,IAAI;AAAA,IAC9B,OAAO;AACL,aAAO,eAAe,IAAI;AAAA,IAC5B;AAAA,EACF;AAEA,WAAe,eACb,QACkB;AAAA;AAClB,UAAI;AACJ,cAAI,gCAAgB,MAAM,GAAG;AAC3B,0BAAkB,MAAM,2BAA2B,MAAM;AAAA,MAC3D,WAAW,uBAAuB,QAAQ;AACxC,0BAAkB,iCACb,SADa;AAAA,UAEhB,mBAAmB,MAAM;AAAA,YACvB,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,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
|
}
|
|
@@ -59,11 +59,8 @@ function createExecutionUtils(graphqlExecute, graphqlSubscribe) {
|
|
|
59
59
|
const result = yield drainExecution(
|
|
60
60
|
yield executeWithSchema({
|
|
61
61
|
document,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
definitions: typeDefs,
|
|
65
|
-
resolvers
|
|
66
|
-
},
|
|
62
|
+
definitions: typeDefs,
|
|
63
|
+
resolvers,
|
|
67
64
|
contextValue: {
|
|
68
65
|
models
|
|
69
66
|
},
|
|
@@ -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/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
|
|
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,
|
|
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 definitions: typeDefs,\n resolvers: resolvers as UserResolvers<unknown, unknown>,\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,aAAa;AAAA,UACb;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;AA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AAO,eAAe,IAAI;AAAA,IAC5B;AAAA,EACF;AAEA,WAAe,eACb,QACkB;AAAA;AAClB,UAAI;AACJ,UAAI,gBAAgB,MAAM,GAAG;AAC3B,0BAAkB,MAAM,2BAA2B,MAAM;AAAA,MAC3D,WAAW,uBAAuB,QAAQ;AACxC,0BAAkB,iCACb,SADa;AAAA,UAEhB,mBAAmB,MAAM;AAAA,YACvB,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
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PromiseOrValue } from "./jsutils/PromiseOrValue";
|
|
2
2
|
import { ExecutionResult, ExecutionWithSchemaArgs } from "./types";
|
|
3
|
-
export declare function executeWithSchema({
|
|
3
|
+
export declare function executeWithSchema({ document, definitions, resolvers, 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,
|
|
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,WAAW,EACX,SAAS,EACT,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,mBAAmB,GACpB,EAAE,uBAAuB,GAAG,cAAc,CAAC,eAAe,CAAC,CAoB3D"}
|
package/lib/executeWithSchema.js
CHANGED
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __spreadValues = (a, b) => {
|
|
12
|
-
for (var prop in b || (b = {}))
|
|
13
|
-
if (__hasOwnProp.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
if (__getOwnPropSymbols)
|
|
16
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
-
if (__propIsEnum.call(b, prop))
|
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
|
19
|
-
}
|
|
20
|
-
return a;
|
|
21
|
-
};
|
|
22
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
6
|
var __export = (target, all) => {
|
|
24
7
|
for (var name in all)
|
|
25
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -42,8 +25,9 @@ var import_graphql = require("graphql");
|
|
|
42
25
|
var import_index = require("./index");
|
|
43
26
|
var import_extractMinimalViableSchemaForRequestDocument = require("./utilities/extractMinimalViableSchemaForRequestDocument");
|
|
44
27
|
function executeWithSchema({
|
|
45
|
-
schema,
|
|
46
28
|
document,
|
|
29
|
+
definitions,
|
|
30
|
+
resolvers,
|
|
47
31
|
rootValue,
|
|
48
32
|
contextValue,
|
|
49
33
|
variableValues,
|
|
@@ -52,15 +36,17 @@ function executeWithSchema({
|
|
|
52
36
|
typeResolver,
|
|
53
37
|
fieldExecutionHooks
|
|
54
38
|
}) {
|
|
55
|
-
const
|
|
56
|
-
(0, import_graphql.buildASTSchema)(
|
|
39
|
+
const extracted = (0, import_extractMinimalViableSchemaForRequestDocument.extractMinimalViableSchemaForRequestDocument)(
|
|
40
|
+
(0, import_graphql.buildASTSchema)(definitions),
|
|
57
41
|
document
|
|
58
42
|
);
|
|
59
43
|
return (0, import_index.executeWithoutSchema)({
|
|
60
44
|
document,
|
|
61
|
-
schemaFragment:
|
|
62
|
-
|
|
63
|
-
|
|
45
|
+
schemaFragment: {
|
|
46
|
+
schemaId: "executeWithSchema",
|
|
47
|
+
definitions: extracted.definitions,
|
|
48
|
+
resolvers
|
|
49
|
+
},
|
|
64
50
|
rootValue,
|
|
65
51
|
contextValue,
|
|
66
52
|
variableValues,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/executeWithSchema.ts"],
|
|
4
|
-
"sourcesContent": ["import { buildASTSchema } from \"graphql\";\nimport { executeWithoutSchema } from \"./index\";\nimport { PromiseOrValue } from \"./jsutils/PromiseOrValue\";\nimport { ExecutionResult, ExecutionWithSchemaArgs } from \"./types\";\nimport { extractMinimalViableSchemaForRequestDocument } from \"./utilities/extractMinimalViableSchemaForRequestDocument\";\n\nexport function executeWithSchema({\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { buildASTSchema } from \"graphql\";\nimport { executeWithoutSchema } from \"./index\";\nimport { PromiseOrValue } from \"./jsutils/PromiseOrValue\";\nimport { ExecutionResult, ExecutionWithSchemaArgs } from \"./types\";\nimport { extractMinimalViableSchemaForRequestDocument } from \"./utilities/extractMinimalViableSchemaForRequestDocument\";\n\nexport function executeWithSchema({\n document,\n definitions,\n resolvers,\n rootValue,\n contextValue,\n variableValues,\n operationName,\n fieldResolver,\n typeResolver,\n fieldExecutionHooks,\n}: ExecutionWithSchemaArgs): PromiseOrValue<ExecutionResult> {\n const extracted = extractMinimalViableSchemaForRequestDocument(\n buildASTSchema(definitions),\n document,\n );\n return executeWithoutSchema({\n document,\n schemaFragment: {\n schemaId: \"executeWithSchema\",\n definitions: extracted.definitions,\n resolvers,\n },\n rootValue,\n contextValue,\n variableValues,\n operationName,\n fieldResolver,\n typeResolver,\n fieldExecutionHooks,\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA+B;AAC/B,mBAAqC;AAGrC,0DAA6D;AAEtD,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA6D;AAC3D,QAAM,gBAAY;AAAA,QAChB,+BAAe,WAAW;AAAA,IAC1B;AAAA,EACF;AACA,aAAO,mCAAqB;AAAA,IAC1B;AAAA,IACA,gBAAgB;AAAA,MACd,UAAU;AAAA,MACV,aAAa,UAAU;AAAA,MACvB;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,30 +1,11 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
|
|
21
1
|
// src/executeWithSchema.ts
|
|
22
2
|
import { buildASTSchema } from "graphql";
|
|
23
3
|
import { executeWithoutSchema } from "./index.mjs";
|
|
24
4
|
import { extractMinimalViableSchemaForRequestDocument } from "./utilities/extractMinimalViableSchemaForRequestDocument.mjs";
|
|
25
5
|
function executeWithSchema({
|
|
26
|
-
schema,
|
|
27
6
|
document,
|
|
7
|
+
definitions,
|
|
8
|
+
resolvers,
|
|
28
9
|
rootValue,
|
|
29
10
|
contextValue,
|
|
30
11
|
variableValues,
|
|
@@ -33,15 +14,17 @@ function executeWithSchema({
|
|
|
33
14
|
typeResolver,
|
|
34
15
|
fieldExecutionHooks
|
|
35
16
|
}) {
|
|
36
|
-
const
|
|
37
|
-
buildASTSchema(
|
|
17
|
+
const extracted = extractMinimalViableSchemaForRequestDocument(
|
|
18
|
+
buildASTSchema(definitions),
|
|
38
19
|
document
|
|
39
20
|
);
|
|
40
21
|
return executeWithoutSchema({
|
|
41
22
|
document,
|
|
42
|
-
schemaFragment:
|
|
43
|
-
|
|
44
|
-
|
|
23
|
+
schemaFragment: {
|
|
24
|
+
schemaId: "executeWithSchema",
|
|
25
|
+
definitions: extracted.definitions,
|
|
26
|
+
resolvers
|
|
27
|
+
},
|
|
45
28
|
rootValue,
|
|
46
29
|
contextValue,
|
|
47
30
|
variableValues,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/executeWithSchema.ts"],
|
|
4
|
-
"sourcesContent": ["import { buildASTSchema } from \"graphql\";\nimport { executeWithoutSchema } from \"./index\";\nimport { PromiseOrValue } from \"./jsutils/PromiseOrValue\";\nimport { ExecutionResult, ExecutionWithSchemaArgs } from \"./types\";\nimport { extractMinimalViableSchemaForRequestDocument } from \"./utilities/extractMinimalViableSchemaForRequestDocument\";\n\nexport function executeWithSchema({\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { buildASTSchema } from \"graphql\";\nimport { executeWithoutSchema } from \"./index\";\nimport { PromiseOrValue } from \"./jsutils/PromiseOrValue\";\nimport { ExecutionResult, ExecutionWithSchemaArgs } from \"./types\";\nimport { extractMinimalViableSchemaForRequestDocument } from \"./utilities/extractMinimalViableSchemaForRequestDocument\";\n\nexport function executeWithSchema({\n document,\n definitions,\n resolvers,\n rootValue,\n contextValue,\n variableValues,\n operationName,\n fieldResolver,\n typeResolver,\n fieldExecutionHooks,\n}: ExecutionWithSchemaArgs): PromiseOrValue<ExecutionResult> {\n const extracted = extractMinimalViableSchemaForRequestDocument(\n buildASTSchema(definitions),\n document,\n );\n return executeWithoutSchema({\n document,\n schemaFragment: {\n schemaId: \"executeWithSchema\",\n definitions: extracted.definitions,\n resolvers,\n },\n rootValue,\n contextValue,\n variableValues,\n operationName,\n fieldResolver,\n typeResolver,\n fieldExecutionHooks,\n });\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;AAGrC,SAAS,oDAAoD;AAEtD,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA6D;AAC3D,QAAM,YAAY;AAAA,IAChB,eAAe,WAAW;AAAA,IAC1B;AAAA,EACF;AACA,SAAO,qBAAqB;AAAA,IAC1B;AAAA,IACA,gBAAgB;AAAA,MACd,UAAU;AAAA,MACV,aAAa,UAAU;AAAA,MACvB;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeWithoutSchema.d.ts","sourceRoot":"","sources":["../src/executeWithoutSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAIZ,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AACjB,OAAO,EAGL,UAAU,EAEX,MAAM,iBAAiB,CAAC;AAOzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,KAAK,EACV,0BAA0B,EAC1B,qBAAqB,EACrB,WAAW,EACX,YAAY,EACZ,eAAe,EAMf,0BAA0B,EAC1B,cAAc,EAC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AAE,MAAM,GAAG,SAAS,CAAC;QAC1B,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;QACvB,aAAa,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;QACvC,aAAa,EAAE,qBAAqB,GAAG,SAAS,CAAC;QACjD,UAAU,EAAE,gBAAgB,CAAC;KAC9B;IAsBD,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IASrD,2BAA2B;CAG5B;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,EACvB,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,EAE7B,MAAM,EAAE,eAAe,CAAC,KAAK,EAAE,WAAW,CAAC,GAC1C,MAAM,IAAI,0BAA0B,CAAC,KAAK,EAAE,WAAW,CAAC,CAE1D;AAED,wBAAgB,sBAAsB,CACpC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,EACvB,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,EAE7B,MAAM,EAAE,eAAe,CAAC,KAAK,EAAE,WAAW,CAAC,GAC1C,MAAM,IAAI,0BAA0B,CAAC,KAAK,EAAE,WAAW,CAAC,CAE1D"}
|
|
@@ -383,14 +383,15 @@ function requestSchemaFragment(exeContext, request) {
|
|
|
383
383
|
if (!exeContext.schemaFragmentLoader) {
|
|
384
384
|
return;
|
|
385
385
|
}
|
|
386
|
+
const currentSchemaId = exeContext.schemaFragment.schemaId;
|
|
386
387
|
return exeContext.schemaFragmentLoader(
|
|
387
388
|
exeContext.schemaFragment,
|
|
388
389
|
exeContext.contextValue,
|
|
389
390
|
request
|
|
390
391
|
).then(({ mergedFragment, mergedContextValue }) => {
|
|
391
|
-
if (
|
|
392
|
+
if (currentSchemaId !== mergedFragment.schemaId) {
|
|
392
393
|
throw new Error(
|
|
393
|
-
`Cannot use new schema fragment: old and new fragments describe different schemas: ${
|
|
394
|
+
`Cannot use new schema fragment: old and new fragments describe different schemas: ${currentSchemaId} vs. ${mergedFragment.schemaId}`
|
|
394
395
|
);
|
|
395
396
|
}
|
|
396
397
|
exeContext.contextValue = mergedContextValue != null ? mergedContextValue : exeContext.contextValue;
|