Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nexus

Package Overview
Dependencies
Maintainers
4
Versions
395
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nexus - npm Package Compare versions

Comparing version 1.4.0-next.8 to 1.4.0-next.9

3

dist-esm/builder.d.ts

@@ -313,4 +313,2 @@ import { ASTKindToNode, GraphQLDirective, GraphQLNamedType, GraphQLSchema, GraphQLSchemaConfig, printSchema } from 'graphql';

/** All Schema Directives */
/** Whether we have used any custom directives within the schema construction */
private hasSDLDirectives;
/** All types that need to be traversed for children types */

@@ -429,3 +427,2 @@ private typesToWalk;

customDirectives: Record<string, GraphQLDirective>;
hasSDLDirectives: boolean;
schemaDirectives?: Partial<{

@@ -432,0 +429,0 @@ astNode: ASTKindToNode['SchemaDefinition'];

@@ -72,4 +72,2 @@ import { __rest } from "tslib";

// private schemaDirectives: GraphQLDirective[] = []
/** Whether we have used any custom directives within the schema construction */
this.hasSDLDirectives = false;
/** All types that need to be traversed for children types */

@@ -501,3 +499,2 @@ this.typesToWalk = [];

customDirectives: this.directivesMap,
hasSDLDirectives: this.hasSDLDirectives,
schemaDirectives: this.maybeAddDirectiveUses('SCHEMA', this.config.schemaDirectives),

@@ -646,7 +643,3 @@ };

}
const result = maybeAddDirectiveUses(kind, directives, this.directivesMap);
if (result) {
this.hasSDLDirectives = true;
}
return result;
return maybeAddDirectiveUses(kind, directives, this.directivesMap);
}

@@ -653,0 +646,0 @@ buildEnumType(config) {

@@ -25,3 +25,2 @@ import { ConfiguredTypegen, SchemaConfig } from './builder';

finalConfig: import("./builder").BuilderConfig;
hasSDLDirectives: boolean;
};

16

dist-esm/makeSchema.js

@@ -15,3 +15,3 @@ import { __awaiter, __rest } from "tslib";

export function makeSchema(config) {
const { schema, missingTypes, finalConfig, hasSDLDirectives } = makeSchemaInternal(config);
const { schema, missingTypes, finalConfig } = makeSchemaInternal(config);
const typegenConfig = resolveTypegenConfig(finalConfig);

@@ -23,3 +23,3 @@ const sdl = typegenConfig.outputs.schema;

// in the optional thunk for the typegen config
const typegenPromise = new TypegenMetadata(typegenConfig).generateArtifacts(schema, hasSDLDirectives);
const typegenPromise = new TypegenMetadata(typegenConfig).generateArtifacts(schema);
if (config.shouldExitAfterGenerateArtifacts) {

@@ -58,5 +58,5 @@ let typegenPath = '(not enabled)';

return __awaiter(this, void 0, void 0, function* () {
const { schema, missingTypes, finalConfig, hasSDLDirectives } = makeSchemaInternal(config);
const { schema, missingTypes, finalConfig } = makeSchemaInternal(config);
const typegenConfig = resolveTypegenConfig(finalConfig);
yield new TypegenMetadata(typegenConfig).generateArtifacts(schema, hasSDLDirectives);
yield new TypegenMetadata(typegenConfig).generateArtifacts(schema);
assertNoMissingTypes(schema, missingTypes);

@@ -72,5 +72,5 @@ runAbstractTypeRuntimeChecks(schema, finalConfig.features);

generateSchema.withArtifacts = (config, typegen = null) => __awaiter(void 0, void 0, void 0, function* () {
const { schema, missingTypes, finalConfig, hasSDLDirectives } = makeSchemaInternal(config);
const { schema, missingTypes, finalConfig } = makeSchemaInternal(config);
const typegenConfig = resolveTypegenConfig(finalConfig);
const { schemaTypes, tsTypes, globalTypes } = yield new TypegenMetadata(typegenConfig).generateArtifactContents(schema, typegen, hasSDLDirectives);
const { schemaTypes, tsTypes, globalTypes } = yield new TypegenMetadata(typegenConfig).generateArtifactContents(schema, typegen);
assertNoMissingTypes(schema, missingTypes);

@@ -108,6 +108,6 @@ runAbstractTypeRuntimeChecks(schema, finalConfig.features);

}
const { finalConfig, typeMap, missingTypes, schemaExtension, onAfterBuildFns, customDirectives, schemaDirectives, hasSDLDirectives, } = builder.getFinalTypeMap();
const { finalConfig, typeMap, missingTypes, schemaExtension, onAfterBuildFns, customDirectives, schemaDirectives, } = builder.getFinalTypeMap();
const schema = new GraphQLSchema(Object.assign(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 }), directives: [...specifiedDirectives, ...Object.values(customDirectives)] }), schemaDirectives));
onAfterBuildFns.forEach((fn) => fn(schema));
return { schema, missingTypes, finalConfig, hasSDLDirectives };
return { schema, missingTypes, finalConfig };
}

@@ -114,0 +114,0 @@ function extractGraphQLSchemaOptions(config) {

@@ -20,4 +20,4 @@ import { GraphQLSchema } from 'graphql';

/** Generates the artifacts of the build based on what we know about the schema and how it was defined. */
generateArtifacts(schema: NexusGraphQLSchema, hasSDLDirectives: boolean): Promise<void>;
generateArtifactContents(schema: NexusGraphQLSchema, typegen: string | null | ConfiguredTypegen, hasSDLDirectives: boolean): Promise<{
generateArtifacts(schema: NexusGraphQLSchema): Promise<void>;
generateArtifactContents(schema: NexusGraphQLSchema, typegen: string | null | ConfiguredTypegen): Promise<{
schemaTypes: string;

@@ -30,3 +30,3 @@ tsTypes: string;

/** Generates the schema, adding any directives as necessary */
generateSchemaFile(schema: GraphQLSchema, hasSDLDirectives: boolean): string;
generateSchemaFile(schema: GraphQLSchema): string;
/** Generates the type definitions */

@@ -33,0 +33,0 @@ generateTypesFile(schema: NexusGraphQLSchema, typegenPath: string): Promise<string>;

import { __awaiter } from "tslib";
import { lexicographicSortSchema, printSchema } from 'graphql';
import { lexicographicSortSchema } from 'graphql';
import * as path from 'path';

@@ -18,3 +18,3 @@ import { SDL_HEADER, TYPEGEN_HEADER } from './lang';

/** Generates the artifacts of the build based on what we know about the schema and how it was defined. */
generateArtifacts(schema, hasSDLDirectives) {
generateArtifacts(schema) {
return __awaiter(this, void 0, void 0, function* () {

@@ -24,3 +24,3 @@ const sortedSchema = this.sortSchema(schema);

if (this.config.outputs.schema || typegen) {
const { schemaTypes, tsTypes, globalTypes } = yield this.generateArtifactContents(sortedSchema, typegen, hasSDLDirectives);
const { schemaTypes, tsTypes, globalTypes } = yield this.generateArtifactContents(sortedSchema, typegen);
if (this.config.outputs.schema) {

@@ -43,6 +43,6 @@ yield this.writeFile('schema', schemaTypes, this.config.outputs.schema);

}
generateArtifactContents(schema, typegen, hasSDLDirectives) {
generateArtifactContents(schema, typegen) {
return __awaiter(this, void 0, void 0, function* () {
const result = {
schemaTypes: this.generateSchemaFile(schema, hasSDLDirectives),
schemaTypes: this.generateSchemaFile(schema),
tsTypes: '',

@@ -117,7 +117,6 @@ globalTypes: null,

/** Generates the schema, adding any directives as necessary */
generateSchemaFile(schema, hasSDLDirectives) {
const printer = hasSDLDirectives ? printSchemaWithDirectives : printSchema;
generateSchemaFile(schema) {
let printedSchema = this.config.customPrintSchemaFn
? this.config.customPrintSchemaFn(schema)
: printer(schema);
: printSchemaWithDirectives(schema);
return [SDL_HEADER, printedSchema].join('\n\n');

@@ -124,0 +123,0 @@ }

@@ -313,4 +313,2 @@ import { ASTKindToNode, GraphQLDirective, GraphQLNamedType, GraphQLSchema, GraphQLSchemaConfig, printSchema } from 'graphql';

/** All Schema Directives */
/** Whether we have used any custom directives within the schema construction */
private hasSDLDirectives;
/** All types that need to be traversed for children types */

@@ -429,3 +427,2 @@ private typesToWalk;

customDirectives: Record<string, GraphQLDirective>;
hasSDLDirectives: boolean;
schemaDirectives?: Partial<{

@@ -432,0 +429,0 @@ astNode: ASTKindToNode['SchemaDefinition'];

@@ -75,4 +75,2 @@ "use strict";

// private schemaDirectives: GraphQLDirective[] = []
/** Whether we have used any custom directives within the schema construction */
this.hasSDLDirectives = false;
/** All types that need to be traversed for children types */

@@ -504,3 +502,2 @@ this.typesToWalk = [];

customDirectives: this.directivesMap,
hasSDLDirectives: this.hasSDLDirectives,
schemaDirectives: this.maybeAddDirectiveUses('SCHEMA', this.config.schemaDirectives),

@@ -649,7 +646,3 @@ };

}
const result = (0, directive_1.maybeAddDirectiveUses)(kind, directives, this.directivesMap);
if (result) {
this.hasSDLDirectives = true;
}
return result;
return (0, directive_1.maybeAddDirectiveUses)(kind, directives, this.directivesMap);
}

@@ -656,0 +649,0 @@ buildEnumType(config) {

@@ -25,3 +25,2 @@ import { ConfiguredTypegen, SchemaConfig } from './builder';

finalConfig: import("./builder").BuilderConfig;
hasSDLDirectives: boolean;
};

@@ -18,3 +18,3 @@ "use strict";

function makeSchema(config) {
const { schema, missingTypes, finalConfig, hasSDLDirectives } = makeSchemaInternal(config);
const { schema, missingTypes, finalConfig } = makeSchemaInternal(config);
const typegenConfig = (0, typegenUtils_1.resolveTypegenConfig)(finalConfig);

@@ -26,3 +26,3 @@ const sdl = typegenConfig.outputs.schema;

// in the optional thunk for the typegen config
const typegenPromise = new typegenMetadata_1.TypegenMetadata(typegenConfig).generateArtifacts(schema, hasSDLDirectives);
const typegenPromise = new typegenMetadata_1.TypegenMetadata(typegenConfig).generateArtifacts(schema);
if (config.shouldExitAfterGenerateArtifacts) {

@@ -62,5 +62,5 @@ let typegenPath = '(not enabled)';

return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
const { schema, missingTypes, finalConfig, hasSDLDirectives } = makeSchemaInternal(config);
const { schema, missingTypes, finalConfig } = makeSchemaInternal(config);
const typegenConfig = (0, typegenUtils_1.resolveTypegenConfig)(finalConfig);
yield new typegenMetadata_1.TypegenMetadata(typegenConfig).generateArtifacts(schema, hasSDLDirectives);
yield new typegenMetadata_1.TypegenMetadata(typegenConfig).generateArtifacts(schema);
(0, utils_1.assertNoMissingTypes)(schema, missingTypes);

@@ -77,5 +77,5 @@ (0, utils_1.runAbstractTypeRuntimeChecks)(schema, finalConfig.features);

generateSchema.withArtifacts = (config, typegen = null) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
const { schema, missingTypes, finalConfig, hasSDLDirectives } = makeSchemaInternal(config);
const { schema, missingTypes, finalConfig } = makeSchemaInternal(config);
const typegenConfig = (0, typegenUtils_1.resolveTypegenConfig)(finalConfig);
const { schemaTypes, tsTypes, globalTypes } = yield new typegenMetadata_1.TypegenMetadata(typegenConfig).generateArtifactContents(schema, typegen, hasSDLDirectives);
const { schemaTypes, tsTypes, globalTypes } = yield new typegenMetadata_1.TypegenMetadata(typegenConfig).generateArtifactContents(schema, typegen);
(0, utils_1.assertNoMissingTypes)(schema, missingTypes);

@@ -113,6 +113,6 @@ (0, utils_1.runAbstractTypeRuntimeChecks)(schema, finalConfig.features);

}
const { finalConfig, typeMap, missingTypes, schemaExtension, onAfterBuildFns, customDirectives, schemaDirectives, hasSDLDirectives, } = builder.getFinalTypeMap();
const { finalConfig, typeMap, missingTypes, schemaExtension, onAfterBuildFns, customDirectives, schemaDirectives, } = builder.getFinalTypeMap();
const schema = new graphql_1.GraphQLSchema(Object.assign(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 }), directives: [...graphql_1.specifiedDirectives, ...Object.values(customDirectives)] }), schemaDirectives));
onAfterBuildFns.forEach((fn) => fn(schema));
return { schema, missingTypes, finalConfig, hasSDLDirectives };
return { schema, missingTypes, finalConfig };
}

@@ -119,0 +119,0 @@ exports.makeSchemaInternal = makeSchemaInternal;

@@ -20,4 +20,4 @@ import { GraphQLSchema } from 'graphql';

/** Generates the artifacts of the build based on what we know about the schema and how it was defined. */
generateArtifacts(schema: NexusGraphQLSchema, hasSDLDirectives: boolean): Promise<void>;
generateArtifactContents(schema: NexusGraphQLSchema, typegen: string | null | ConfiguredTypegen, hasSDLDirectives: boolean): Promise<{
generateArtifacts(schema: NexusGraphQLSchema): Promise<void>;
generateArtifactContents(schema: NexusGraphQLSchema, typegen: string | null | ConfiguredTypegen): Promise<{
schemaTypes: string;

@@ -30,3 +30,3 @@ tsTypes: string;

/** Generates the schema, adding any directives as necessary */
generateSchemaFile(schema: GraphQLSchema, hasSDLDirectives: boolean): string;
generateSchemaFile(schema: GraphQLSchema): string;
/** Generates the type definitions */

@@ -33,0 +33,0 @@ generateTypesFile(schema: NexusGraphQLSchema, typegenPath: string): Promise<string>;

@@ -21,3 +21,3 @@ "use strict";

/** Generates the artifacts of the build based on what we know about the schema and how it was defined. */
generateArtifacts(schema, hasSDLDirectives) {
generateArtifacts(schema) {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {

@@ -27,3 +27,3 @@ const sortedSchema = this.sortSchema(schema);

if (this.config.outputs.schema || typegen) {
const { schemaTypes, tsTypes, globalTypes } = yield this.generateArtifactContents(sortedSchema, typegen, hasSDLDirectives);
const { schemaTypes, tsTypes, globalTypes } = yield this.generateArtifactContents(sortedSchema, typegen);
if (this.config.outputs.schema) {

@@ -46,6 +46,6 @@ yield this.writeFile('schema', schemaTypes, this.config.outputs.schema);

}
generateArtifactContents(schema, typegen, hasSDLDirectives) {
generateArtifactContents(schema, typegen) {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
const result = {
schemaTypes: this.generateSchemaFile(schema, hasSDLDirectives),
schemaTypes: this.generateSchemaFile(schema),
tsTypes: '',

@@ -120,7 +120,6 @@ globalTypes: null,

/** Generates the schema, adding any directives as necessary */
generateSchemaFile(schema, hasSDLDirectives) {
const printer = hasSDLDirectives ? printSchemaWithDirectives_1.printSchemaWithDirectives : graphql_1.printSchema;
generateSchemaFile(schema) {
let printedSchema = this.config.customPrintSchemaFn
? this.config.customPrintSchemaFn(schema)
: printer(schema);
: (0, printSchemaWithDirectives_1.printSchemaWithDirectives)(schema);
return [lang_1.SDL_HEADER, printedSchema].join('\n\n');

@@ -127,0 +126,0 @@ }

{
"name": "nexus",
"version": "1.4.0-next.8",
"version": "1.4.0-next.9",
"description": "Scalable, strongly typed GraphQL schema development",

@@ -5,0 +5,0 @@ "keywords": [

@@ -22,3 +22,3 @@ import { GraphQLNamedType, GraphQLSchema, isObjectType, specifiedDirectives } from 'graphql'

export function makeSchema(config: SchemaConfig): NexusGraphQLSchema {
const { schema, missingTypes, finalConfig, hasSDLDirectives } = makeSchemaInternal(config)
const { schema, missingTypes, finalConfig } = makeSchemaInternal(config)
const typegenConfig = resolveTypegenConfig(finalConfig)

@@ -30,3 +30,3 @@ const sdl = typegenConfig.outputs.schema

// in the optional thunk for the typegen config
const typegenPromise = new TypegenMetadata(typegenConfig).generateArtifacts(schema, hasSDLDirectives)
const typegenPromise = new TypegenMetadata(typegenConfig).generateArtifacts(schema)
if (config.shouldExitAfterGenerateArtifacts) {

@@ -64,5 +64,5 @@ let typegenPath = '(not enabled)'

export async function generateSchema(config: SchemaConfig): Promise<NexusGraphQLSchema> {
const { schema, missingTypes, finalConfig, hasSDLDirectives } = makeSchemaInternal(config)
const { schema, missingTypes, finalConfig } = makeSchemaInternal(config)
const typegenConfig = resolveTypegenConfig(finalConfig)
await new TypegenMetadata(typegenConfig).generateArtifacts(schema, hasSDLDirectives)
await new TypegenMetadata(typegenConfig).generateArtifacts(schema)
assertNoMissingTypes(schema, missingTypes)

@@ -86,7 +86,7 @@ runAbstractTypeRuntimeChecks(schema, finalConfig.features)

}> => {
const { schema, missingTypes, finalConfig, hasSDLDirectives } = makeSchemaInternal(config)
const { schema, missingTypes, finalConfig } = makeSchemaInternal(config)
const typegenConfig = resolveTypegenConfig(finalConfig)
const { schemaTypes, tsTypes, globalTypes } = await new TypegenMetadata(
typegenConfig
).generateArtifactContents(schema, typegen, hasSDLDirectives)
).generateArtifactContents(schema, typegen)
assertNoMissingTypes(schema, missingTypes)

@@ -132,3 +132,2 @@ runAbstractTypeRuntimeChecks(schema, finalConfig.features)

schemaDirectives,
hasSDLDirectives,
} = builder.getFinalTypeMap()

@@ -152,3 +151,3 @@

return { schema, missingTypes, finalConfig, hasSDLDirectives }
return { schema, missingTypes, finalConfig }
}

@@ -155,0 +154,0 @@

@@ -1,2 +0,2 @@

import { GraphQLSchema, lexicographicSortSchema, printSchema } from 'graphql'
import { GraphQLSchema, lexicographicSortSchema } from 'graphql'
import * as path from 'path'

@@ -29,11 +29,7 @@ import type { BuilderConfigInput, TypegenInfo } from './builder'

/** Generates the artifacts of the build based on what we know about the schema and how it was defined. */
async generateArtifacts(schema: NexusGraphQLSchema, hasSDLDirectives: boolean) {
async generateArtifacts(schema: NexusGraphQLSchema) {
const sortedSchema = this.sortSchema(schema)
const { typegen } = this.config.outputs
if (this.config.outputs.schema || typegen) {
const { schemaTypes, tsTypes, globalTypes } = await this.generateArtifactContents(
sortedSchema,
typegen,
hasSDLDirectives
)
const { schemaTypes, tsTypes, globalTypes } = await this.generateArtifactContents(sortedSchema, typegen)
if (this.config.outputs.schema) {

@@ -55,9 +51,5 @@ await this.writeFile('schema', schemaTypes, this.config.outputs.schema)

async generateArtifactContents(
schema: NexusGraphQLSchema,
typegen: string | null | ConfiguredTypegen,
hasSDLDirectives: boolean
) {
async generateArtifactContents(schema: NexusGraphQLSchema, typegen: string | null | ConfiguredTypegen) {
const result = {
schemaTypes: this.generateSchemaFile(schema, hasSDLDirectives),
schemaTypes: this.generateSchemaFile(schema),
tsTypes: '',

@@ -133,7 +125,6 @@ globalTypes: null as null | string,

/** Generates the schema, adding any directives as necessary */
generateSchemaFile(schema: GraphQLSchema, hasSDLDirectives: boolean): string {
const printer = hasSDLDirectives ? printSchemaWithDirectives : printSchema
generateSchemaFile(schema: GraphQLSchema): string {
let printedSchema = this.config.customPrintSchemaFn
? this.config.customPrintSchemaFn(schema)
: printer(schema)
: printSchemaWithDirectives(schema)
return [SDL_HEADER, printedSchema].join('\n\n')

@@ -140,0 +131,0 @@ }

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 not supported yet

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 not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc