Comparing version 1.4.0-next.4 to 1.4.0-next.5
@@ -1,2 +0,2 @@ | ||
import { GraphQLDirective, GraphQLNamedType, GraphQLSchema, GraphQLSchemaConfig, printSchema } from 'graphql'; | ||
import { GraphQLNamedType, GraphQLSchema, GraphQLSchemaConfig, printSchema } from 'graphql'; | ||
import { InputDefinitionBlock } from './definitions/definitionBlocks'; | ||
@@ -132,3 +132,3 @@ import type { NexusExtendInputTypeDef } from './definitions/extendInputType'; | ||
* Whether the schema & types are generated when the server starts. Default is !process.env.NODE_ENV || | ||
* process.env.NODE_ENV === "development" | ||
* process.env.NODE_ENV !== "production" | ||
*/ | ||
@@ -179,22 +179,2 @@ shouldGenerateArtifacts?: boolean; | ||
}; | ||
/** | ||
* Allows specifying defined directives to pass to the GraphQLSchema constructor. | ||
* | ||
* @example | ||
* import { | ||
* GraphQLSchema, | ||
* GraphQLDeferDirective, | ||
* GraphQLStreamDirective, | ||
* specifiedDirectives, | ||
* } from 'graphql'; | ||
* const nexusSchema = makeSchema({ | ||
* types: [...], | ||
* directives: [ | ||
* ...specifiedDirectives, | ||
* GraphQLDeferDirective, | ||
* GraphQLStreamDirective, | ||
* ], | ||
* }); | ||
*/ | ||
directives?: GraphQLDirective[]; | ||
} | ||
@@ -206,3 +186,18 @@ export interface BuilderConfig extends Omit<BuilderConfigInput, 'nonNullDefaults' | 'features' | 'plugins'> { | ||
} | ||
export declare type SchemaConfig = BuilderConfigInput & { | ||
/** | ||
* Pick the properties off of the GraphQL schema config that we are supplying, and allow the user to | ||
* specify anything else that is defined on the currently used GraphQL schema: | ||
* | ||
* @example | ||
* const nexusSchema = makeSchema({ | ||
* directives: [ | ||
* ...specifiedDirectives, | ||
* GraphQLDeferDirective, | ||
* GraphQLStreamDirective, | ||
* ], | ||
* enableDeferStream: true | ||
* }); | ||
*/ | ||
export declare type AdditionalGraphQLSchemaConfigOptions = Omit<GraphQLSchemaConfig, 'query' | 'mutation' | 'subscription' | 'types' | keyof BuilderConfigInput>; | ||
export interface MakeSchemaOptions extends BuilderConfigInput { | ||
/** | ||
@@ -220,8 +215,4 @@ * All of the GraphQL types. This is an any for simplicity of developer experience, if it's an object we get | ||
shouldExitAfterGenerateArtifacts?: boolean; | ||
/** | ||
* Custom extensions, as [supported in | ||
* graphql-js](https://github.com/graphql/graphql-js/blob/master/src/type/__tests__/extensions-test.js) | ||
*/ | ||
extensions?: GraphQLSchemaConfig['extensions']; | ||
} & NexusGenPluginSchemaConfig; | ||
} | ||
export declare type SchemaConfig = MakeSchemaOptions & AdditionalGraphQLSchemaConfigOptions & NexusGenPluginSchemaConfig; | ||
export interface TypegenInfo { | ||
@@ -228,0 +219,0 @@ /** Headers attached to the generate type output */ |
@@ -1123,3 +1123,2 @@ import { __rest } from "tslib"; | ||
export function makeSchemaInternal(config) { | ||
var _a; | ||
const builder = new SchemaBuilder(config); | ||
@@ -1151,13 +1150,10 @@ builder.addTypes(config.types); | ||
} | ||
const schema = new GraphQLSchema({ | ||
query: getRootType('query', 'Query'), | ||
mutation: getRootType('mutation', 'Mutation'), | ||
subscription: getRootType('subscription', 'Subscription'), | ||
types: objValues(typeMap), | ||
extensions: Object.assign(Object.assign({}, config.extensions), { nexus: schemaExtension }), | ||
directives: (_a = config.directives) !== null && _a !== void 0 ? _a : undefined, | ||
}); | ||
const schema = new GraphQLSchema(Object.assign(Object.assign({}, extractGraphQLSchemaOptions(config)), { query: getRootType('query', 'Query'), mutation: getRootType('mutation', 'Mutation'), subscription: getRootType('subscription', 'Subscription'), types: objValues(typeMap), extensions: Object.assign(Object.assign({}, config.extensions), { nexus: schemaExtension }) })); | ||
onAfterBuildFns.forEach((fn) => fn(schema)); | ||
return { schema, missingTypes, finalConfig }; | ||
} | ||
function extractGraphQLSchemaOptions(config) { | ||
const { formatTypegen, nonNullDefaults, mergeSchema, outputs, shouldExitAfterGenerateArtifacts, shouldGenerateArtifacts, schemaRoots, sourceTypes, prettierConfig, plugins, customPrintSchemaFn, features, contextType } = config, graphqlConfigOpts = __rest(config, ["formatTypegen", "nonNullDefaults", "mergeSchema", "outputs", "shouldExitAfterGenerateArtifacts", "shouldGenerateArtifacts", "schemaRoots", "sourceTypes", "prettierConfig", "plugins", "customPrintSchemaFn", "features", "contextType"]); | ||
return graphqlConfigOpts; | ||
} | ||
export function setConfigDefaults(config) { | ||
@@ -1164,0 +1160,0 @@ var _a, _b, _c, _d, _e; |
@@ -1,2 +0,2 @@ | ||
import { GraphQLDirective, GraphQLNamedType, GraphQLSchema, GraphQLSchemaConfig, printSchema } from 'graphql'; | ||
import { GraphQLNamedType, GraphQLSchema, GraphQLSchemaConfig, printSchema } from 'graphql'; | ||
import { InputDefinitionBlock } from './definitions/definitionBlocks'; | ||
@@ -132,3 +132,3 @@ import type { NexusExtendInputTypeDef } from './definitions/extendInputType'; | ||
* Whether the schema & types are generated when the server starts. Default is !process.env.NODE_ENV || | ||
* process.env.NODE_ENV === "development" | ||
* process.env.NODE_ENV !== "production" | ||
*/ | ||
@@ -179,22 +179,2 @@ shouldGenerateArtifacts?: boolean; | ||
}; | ||
/** | ||
* Allows specifying defined directives to pass to the GraphQLSchema constructor. | ||
* | ||
* @example | ||
* import { | ||
* GraphQLSchema, | ||
* GraphQLDeferDirective, | ||
* GraphQLStreamDirective, | ||
* specifiedDirectives, | ||
* } from 'graphql'; | ||
* const nexusSchema = makeSchema({ | ||
* types: [...], | ||
* directives: [ | ||
* ...specifiedDirectives, | ||
* GraphQLDeferDirective, | ||
* GraphQLStreamDirective, | ||
* ], | ||
* }); | ||
*/ | ||
directives?: GraphQLDirective[]; | ||
} | ||
@@ -206,3 +186,18 @@ export interface BuilderConfig extends Omit<BuilderConfigInput, 'nonNullDefaults' | 'features' | 'plugins'> { | ||
} | ||
export declare type SchemaConfig = BuilderConfigInput & { | ||
/** | ||
* Pick the properties off of the GraphQL schema config that we are supplying, and allow the user to | ||
* specify anything else that is defined on the currently used GraphQL schema: | ||
* | ||
* @example | ||
* const nexusSchema = makeSchema({ | ||
* directives: [ | ||
* ...specifiedDirectives, | ||
* GraphQLDeferDirective, | ||
* GraphQLStreamDirective, | ||
* ], | ||
* enableDeferStream: true | ||
* }); | ||
*/ | ||
export declare type AdditionalGraphQLSchemaConfigOptions = Omit<GraphQLSchemaConfig, 'query' | 'mutation' | 'subscription' | 'types' | keyof BuilderConfigInput>; | ||
export interface MakeSchemaOptions extends BuilderConfigInput { | ||
/** | ||
@@ -220,8 +215,4 @@ * All of the GraphQL types. This is an any for simplicity of developer experience, if it's an object we get | ||
shouldExitAfterGenerateArtifacts?: boolean; | ||
/** | ||
* Custom extensions, as [supported in | ||
* graphql-js](https://github.com/graphql/graphql-js/blob/master/src/type/__tests__/extensions-test.js) | ||
*/ | ||
extensions?: GraphQLSchemaConfig['extensions']; | ||
} & NexusGenPluginSchemaConfig; | ||
} | ||
export declare type SchemaConfig = MakeSchemaOptions & AdditionalGraphQLSchemaConfigOptions & NexusGenPluginSchemaConfig; | ||
export interface TypegenInfo { | ||
@@ -228,0 +219,0 @@ /** Headers attached to the generate type output */ |
@@ -1127,3 +1127,2 @@ "use strict"; | ||
function makeSchemaInternal(config) { | ||
var _a; | ||
const builder = new SchemaBuilder(config); | ||
@@ -1155,10 +1154,3 @@ builder.addTypes(config.types); | ||
} | ||
const schema = new graphql_1.GraphQLSchema({ | ||
query: getRootType('query', 'Query'), | ||
mutation: getRootType('mutation', 'Mutation'), | ||
subscription: getRootType('subscription', 'Subscription'), | ||
types: (0, utils_1.objValues)(typeMap), | ||
extensions: Object.assign(Object.assign({}, config.extensions), { nexus: schemaExtension }), | ||
directives: (_a = config.directives) !== null && _a !== void 0 ? _a : undefined, | ||
}); | ||
const schema = new graphql_1.GraphQLSchema(Object.assign(Object.assign({}, extractGraphQLSchemaOptions(config)), { query: getRootType('query', 'Query'), mutation: getRootType('mutation', 'Mutation'), subscription: getRootType('subscription', 'Subscription'), types: (0, utils_1.objValues)(typeMap), extensions: Object.assign(Object.assign({}, config.extensions), { nexus: schemaExtension }) })); | ||
onAfterBuildFns.forEach((fn) => fn(schema)); | ||
@@ -1168,2 +1160,6 @@ return { schema, missingTypes, finalConfig }; | ||
exports.makeSchemaInternal = makeSchemaInternal; | ||
function extractGraphQLSchemaOptions(config) { | ||
const { formatTypegen, nonNullDefaults, mergeSchema, outputs, shouldExitAfterGenerateArtifacts, shouldGenerateArtifacts, schemaRoots, sourceTypes, prettierConfig, plugins, customPrintSchemaFn, features, contextType } = config, graphqlConfigOpts = (0, tslib_1.__rest)(config, ["formatTypegen", "nonNullDefaults", "mergeSchema", "outputs", "shouldExitAfterGenerateArtifacts", "shouldGenerateArtifacts", "schemaRoots", "sourceTypes", "prettierConfig", "plugins", "customPrintSchemaFn", "features", "contextType"]); | ||
return graphqlConfigOpts; | ||
} | ||
function setConfigDefaults(config) { | ||
@@ -1170,0 +1166,0 @@ var _a, _b, _c, _d, _e; |
{ | ||
"name": "nexus", | ||
"version": "1.4.0-next.4", | ||
"version": "1.4.0-next.5", | ||
"description": "Scalable, strongly typed GraphQL schema development", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2173505
34213