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

graphql-codegen-visitor-plugin-common

Package Overview
Dependencies
Maintainers
1
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-codegen-visitor-plugin-common - npm Package Compare versions

Comparing version 0.19.0-alpha.9ce4a2d1 to 0.19.0-alpha.a50faf1a

2

dist/commonjs/base-resolvers-visitor.d.ts

@@ -17,3 +17,3 @@ import { ScalarsMap, NamingConvention, ConvertFn, ConvertOptions } from './types';

typesPrefix: string;
contextType: ParsedMapper;
contextType: string;
mappers: {

@@ -20,0 +20,0 @@ [typeName: string]: ParsedMapper;

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

this._collectedDirectiveResolvers = {};
this._parsedConfig = Object.assign({ scalars: Object.assign({}, (defaultScalars || scalars_1.DEFAULT_SCALARS), (rawConfig.scalars || {})), convert: naming_1.convertFactory(rawConfig), typesPrefix: rawConfig.typesPrefix || '', contextType: this.parseMapper(rawConfig.contextType || 'any'), mappers: this.transformMappers(rawConfig.mappers || {}) }, (additionalConfig || {}));
this._parsedConfig = Object.assign({ scalars: Object.assign({}, (defaultScalars || scalars_1.DEFAULT_SCALARS), (rawConfig.scalars || {})), convert: naming_1.convertFactory(rawConfig), typesPrefix: rawConfig.typesPrefix || '', contextType: rawConfig.contextType || 'any', mappers: this.transformMappers(rawConfig.mappers || {}) }, (additionalConfig || {}));
autoBind(this);

@@ -66,8 +66,2 @@ this._variablesTransfomer = new variables_to_object_1.OperationVariablesToObject(this.scalars, this.convertName);

});
if (this.config.contextType.isExternal) {
if (!groupedMappers[this.config.contextType.source]) {
groupedMappers[this.config.contextType.source] = [];
}
groupedMappers[this.config.contextType.source].push(this.config.contextType.type);
}
return Object.keys(groupedMappers).map(source => this.buildMapperImport(source, groupedMappers[source]));

@@ -92,3 +86,3 @@ }

.asKind('type')
.withName(this.convertName('IResolvers'), `<Context = ${this.config.contextType.type}>`)
.withName(this.convertName('IResolvers'), `<Context = ${this.config.contextType}>`)
.withBlock(Object.keys(this._collectedResolvers)

@@ -108,3 +102,3 @@ .map(schemaTypeName => {

.asKind('type')
.withName(this.convertName('IDirectiveResolvers'), `<Context = ${this.config.contextType.type}>`)
.withName(this.convertName('IDirectiveResolvers'), `<Context = ${this.config.contextType}>`)
.withBlock(Object.keys(this._collectedDirectiveResolvers)

@@ -167,3 +161,3 @@ .map(schemaTypeName => {

.asKind('interface')
.withName(name, `<Context = ${this.config.contextType.type}, ParentType = ${type}>`)
.withName(name, `<Context = ${this.config.contextType}, ParentType = ${type}>`)
.withBlock(node.fields.map((f) => f(node.name)).join('\n'));

@@ -186,3 +180,3 @@ this._collectedResolvers[node.name] = name + '<Context>';

.asKind('interface')
.withName(name, `<Context = ${this.config.contextType.type}, ParentType = ${node.name}>`)
.withName(name, `<Context = ${this.config.contextType}, ParentType = ${node.name}>`)
.withBlock(utils_1.indent(`__resolveType: TypeResolveFn<${possibleTypes}>`)).string;

@@ -213,3 +207,3 @@ }

.asKind('type')
.withName(directiveName, `<Result, Parent, Context = ${this.config.contextType.type}, Args = { ${directiveArgs} }>`)
.withName(directiveName, `<Result, Parent, Context = ${this.config.contextType}, Args = { ${directiveArgs} }>`)
.withContent(`DirectiveResolverFn<Result, Parent, Context, Args>`).string;

@@ -235,3 +229,3 @@ }

.asKind('interface')
.withName(name, `<Context = ${this.config.contextType.type}, ParentType = ${node.name}>`)
.withName(name, `<Context = ${this.config.contextType}, ParentType = ${node.name}>`)
.withBlock(utils_1.indent(`__resolveType: TypeResolveFn<${implementingTypes.map(name => `'${name}'`).join(' | ')}>`))

@@ -238,0 +232,0 @@ .string;

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

const typeName = baseType.name;
if (this._scalars[typeName] || graphql_1.isEnumType(baseType) || graphql_1.isScalarType(baseType)) {
if (this._scalars[typeName] || graphql_1.isEnumType(baseType)) {
if (field.alias && field.alias.value) {

@@ -57,0 +57,0 @@ this._primitiveAliasedFields.push({

@@ -17,3 +17,3 @@ import { ScalarsMap, NamingConvention, ConvertFn, ConvertOptions } from './types';

typesPrefix: string;
contextType: ParsedMapper;
contextType: string;
mappers: {

@@ -20,0 +20,0 @@ [typeName: string]: ParsedMapper;

@@ -13,3 +13,3 @@ import * as autoBind from 'auto-bind';

this._collectedDirectiveResolvers = {};
this._parsedConfig = Object.assign({ scalars: Object.assign({}, (defaultScalars || DEFAULT_SCALARS), (rawConfig.scalars || {})), convert: convertFactory(rawConfig), typesPrefix: rawConfig.typesPrefix || '', contextType: this.parseMapper(rawConfig.contextType || 'any'), mappers: this.transformMappers(rawConfig.mappers || {}) }, (additionalConfig || {}));
this._parsedConfig = Object.assign({ scalars: Object.assign({}, (defaultScalars || DEFAULT_SCALARS), (rawConfig.scalars || {})), convert: convertFactory(rawConfig), typesPrefix: rawConfig.typesPrefix || '', contextType: rawConfig.contextType || 'any', mappers: this.transformMappers(rawConfig.mappers || {}) }, (additionalConfig || {}));
autoBind(this);

@@ -64,8 +64,2 @@ this._variablesTransfomer = new OperationVariablesToObject(this.scalars, this.convertName);

});
if (this.config.contextType.isExternal) {
if (!groupedMappers[this.config.contextType.source]) {
groupedMappers[this.config.contextType.source] = [];
}
groupedMappers[this.config.contextType.source].push(this.config.contextType.type);
}
return Object.keys(groupedMappers).map(source => this.buildMapperImport(source, groupedMappers[source]));

@@ -90,3 +84,3 @@ }

.asKind('type')
.withName(this.convertName('IResolvers'), `<Context = ${this.config.contextType.type}>`)
.withName(this.convertName('IResolvers'), `<Context = ${this.config.contextType}>`)
.withBlock(Object.keys(this._collectedResolvers)

@@ -106,3 +100,3 @@ .map(schemaTypeName => {

.asKind('type')
.withName(this.convertName('IDirectiveResolvers'), `<Context = ${this.config.contextType.type}>`)
.withName(this.convertName('IDirectiveResolvers'), `<Context = ${this.config.contextType}>`)
.withBlock(Object.keys(this._collectedDirectiveResolvers)

@@ -165,3 +159,3 @@ .map(schemaTypeName => {

.asKind('interface')
.withName(name, `<Context = ${this.config.contextType.type}, ParentType = ${type}>`)
.withName(name, `<Context = ${this.config.contextType}, ParentType = ${type}>`)
.withBlock(node.fields.map((f) => f(node.name)).join('\n'));

@@ -184,3 +178,3 @@ this._collectedResolvers[node.name] = name + '<Context>';

.asKind('interface')
.withName(name, `<Context = ${this.config.contextType.type}, ParentType = ${node.name}>`)
.withName(name, `<Context = ${this.config.contextType}, ParentType = ${node.name}>`)
.withBlock(indent(`__resolveType: TypeResolveFn<${possibleTypes}>`)).string;

@@ -211,3 +205,3 @@ }

.asKind('type')
.withName(directiveName, `<Result, Parent, Context = ${this.config.contextType.type}, Args = { ${directiveArgs} }>`)
.withName(directiveName, `<Result, Parent, Context = ${this.config.contextType}, Args = { ${directiveArgs} }>`)
.withContent(`DirectiveResolverFn<Result, Parent, Context, Args>`).string;

@@ -233,3 +227,3 @@ }

.asKind('interface')
.withName(name, `<Context = ${this.config.contextType.type}, ParentType = ${node.name}>`)
.withName(name, `<Context = ${this.config.contextType}, ParentType = ${node.name}>`)
.withBlock(indent(`__resolveType: TypeResolveFn<${implementingTypes.map(name => `'${name}'`).join(' | ')}>`))

@@ -236,0 +230,0 @@ .string;

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

import { Kind, isObjectType, isUnionType, isInterfaceType, isEnumType, isEqualType, SchemaMetaFieldDef, TypeMetaFieldDef, isScalarType } from 'graphql';
import { Kind, isObjectType, isUnionType, isInterfaceType, isEnumType, isEqualType, SchemaMetaFieldDef, TypeMetaFieldDef } from 'graphql';
import { getBaseType, quoteIfNeeded } from './utils';

@@ -52,3 +52,3 @@ function isMetadataFieldName(name) {

const typeName = baseType.name;
if (this._scalars[typeName] || isEnumType(baseType) || isScalarType(baseType)) {
if (this._scalars[typeName] || isEnumType(baseType)) {
if (field.alias && field.alias.value) {

@@ -55,0 +55,0 @@ this._primitiveAliasedFields.push({

{
"name": "graphql-codegen-visitor-plugin-common",
"version": "0.19.0-alpha.9ce4a2d1",
"version": "0.19.0-alpha.a50faf1a",
"license": "MIT",

@@ -11,3 +11,3 @@ "scripts": {

"dependency-graph": "0.8.0",
"graphql-codegen-plugin-helpers": "0.19.0-alpha.9ce4a2d1",
"graphql-codegen-plugin-helpers": "0.19.0-alpha.a50faf1a",
"graphql-tag": "2.10.1",

@@ -22,3 +22,3 @@ "tslib": "1.9.3"

"graphql": "14.1.1",
"graphql-codegen-testing": "0.19.0-alpha.9ce4a2d1",
"graphql-codegen-testing": "0.19.0-alpha.a50faf1a",
"typescript": "3.3.3333"

@@ -25,0 +25,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

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