v0.0.12
Patch Changes
-
d93aa9a: Add graphql-js v14 support
-
832b8af: Introduce the
ExecutorSchemainterfacegraphql-executor"upgrades"GraphQLSchemaobjects created withgraphql-jsv14 and v15 to agraphql-jsv16-compatibile version by providing utility functions that analyze the schema and provide all the necessary metadata. This change introduces the theExecutorSchemainterface so that clients can explicitly perform this schema preparation step.The included (memoized)
toExectorSchemautility function generates anExecutorSchemafrom aGraphQLSchemaobject and is called implicitly if only aGraphQLSchemais passed to the executor. Using the newexecutorSchemaoption, however, a pre-specifiedExecutorSchemainstance can be used. In this case, theGraphQLSchemapassed via theschemaoption is never used bygraphql-executorand only required so that it can be passed through to resolvers via theinfoargument.The
ExecutorSchemais also passed to resolvers within anexecutorSchemaproperty added to theinfoargument (using TypeScript interface merging). This property is populated both when theExecutorSchemais provided explicitly and when it is generated from theGraphQLSchema.BREAKING CHANGE:
The
Executorclass is now instantiated with an configuration object containing aschemaof typeGraphQLSchemaand an optionalexecutorSchemaof typeExecutorSchema. Previously, the executor was instantiated without any parameters.NOTE:
When the executor is instantiated with both a
schemaand anexecutorSchema:graphql-executordoes not validate theschemaorexecutorSchema.graphql-executordoes not check whether theexecutorSchemamatches theschema.graphql-executordoes not utilize theschemain any way except to pass its value to resolvers as a property of theinfoargument.
-
ac0430a: remove createSourceEventStream function export
BREAKING CHANGE: access to createSourceEventStream is still possible in advanced cases, but now only via an explicitly created instance of the internal Executor class.
-
d06133c: Skip schema validation prior to first use.
Schemas can (and should!) still be validated when and where appropriate using the dedicated graphql-js validateSchema method.
graphql-js validates previously unvalidated schemas prior to the first execution. The validation step is skipped by graphql-js if and only if the schema was created with the
assumeValidoption, which essentially triggers a faux validation run that produces no errors.graphql-executor now simply does not automatically validate schemas, preferring to require servers to explicitly validate schemas when and where appropriate, just as document validation is a distinct, explicit step.
-
ecc3758: Allow cross-realm execution
This is made possible by avoiding instanceof checks within the executor proper.
New predicates are introduced that rely on Symbol.toStringTag (or error names) to identify objects from other realms.
Field/type resolvers and isTypeOf functions that are passed GraphQL type system entities and use native graphql-js predicates will still encounter cross-realm errors.
Cross-realm execution can be avoided by end-users by simply calling the original isSchema predicate from graphql-js.