@graphql-codegen/visitor-plugin-common
Advanced tools
Comparing version 1.0.7-alpha-e7a51714.5 to 1.0.7-alpha-ea401fe9.17
@@ -20,3 +20,6 @@ "use strict"; | ||
constructor(rawConfig, additionalConfig, _schema, scalars = scalars_1.DEFAULT_SCALARS) { | ||
super(rawConfig, Object.assign({ addTypename: !rawConfig.skipTypename }, (additionalConfig || {})), utils_1.buildScalars(_schema, scalars)); | ||
super(rawConfig, { | ||
addTypename: !rawConfig.skipTypename, | ||
...(additionalConfig || {}), | ||
}, utils_1.buildScalars(_schema, scalars)); | ||
this._schema = _schema; | ||
@@ -23,0 +26,0 @@ this._unnamedCounter = 1; |
@@ -12,3 +12,9 @@ "use strict"; | ||
constructor(rawConfig, additionalConfig, _schema, defaultScalars = scalars_1.DEFAULT_SCALARS) { | ||
super(rawConfig, Object.assign({ contextType: mappers_1.parseMapper(rawConfig.contextType || 'any'), avoidOptionals: utils_1.getConfigValue(rawConfig.avoidOptionals, false), defaultMapper: rawConfig.defaultMapper ? mappers_1.parseMapper(rawConfig.defaultMapper || 'any') : null, mappers: mappers_1.transformMappers(rawConfig.mappers || {}) }, (additionalConfig || {})), utils_1.buildScalars(_schema, defaultScalars)); | ||
super(rawConfig, { | ||
contextType: mappers_1.parseMapper(rawConfig.contextType || 'any'), | ||
avoidOptionals: utils_1.getConfigValue(rawConfig.avoidOptionals, false), | ||
defaultMapper: rawConfig.defaultMapper ? mappers_1.parseMapper(rawConfig.defaultMapper || 'any') : null, | ||
mappers: mappers_1.transformMappers(rawConfig.mappers || {}), | ||
...(additionalConfig || {}), | ||
}, utils_1.buildScalars(_schema, defaultScalars)); | ||
this._schema = _schema; | ||
@@ -219,5 +225,8 @@ this._declarationBlockConfig = {}; | ||
this._collectedResolvers[node.name] = 'GraphQLScalarType'; | ||
return new utils_1.DeclarationBlock(Object.assign({}, this._declarationBlockConfig, { blockTransformer(block) { | ||
return new utils_1.DeclarationBlock({ | ||
...this._declarationBlockConfig, | ||
blockTransformer(block) { | ||
return block; | ||
} })) | ||
}, | ||
}) | ||
.export() | ||
@@ -237,5 +246,8 @@ .asKind('interface') | ||
this._collectedDirectiveResolvers[node.name] = directiveName + '<any, any, Context>'; | ||
return new utils_1.DeclarationBlock(Object.assign({}, this._declarationBlockConfig, { blockTransformer(block) { | ||
return new utils_1.DeclarationBlock({ | ||
...this._declarationBlockConfig, | ||
blockTransformer(block) { | ||
return block; | ||
} })) | ||
}, | ||
}) | ||
.export() | ||
@@ -242,0 +254,0 @@ .asKind('type') |
@@ -10,3 +10,6 @@ "use strict"; | ||
constructor(_schema, rawConfig, additionalConfig, defaultScalars = scalars_1.DEFAULT_SCALARS) { | ||
super(rawConfig, Object.assign({ enumValues: rawConfig.enumValues || {} }, additionalConfig), utils_1.buildScalars(_schema, defaultScalars)); | ||
super(rawConfig, { | ||
enumValues: rawConfig.enumValues || {}, | ||
...additionalConfig, | ||
}, utils_1.buildScalars(_schema, defaultScalars)); | ||
this._schema = _schema; | ||
@@ -13,0 +16,0 @@ this._argumentsTransformer = new variables_to_object_1.OperationVariablesToObject(this.scalars, this.convertName); |
@@ -9,3 +9,8 @@ "use strict"; | ||
this._declarationBlockConfig = {}; | ||
this._parsedConfig = Object.assign({ scalars: Object.assign({}, (defaultScalars || scalars_1.DEFAULT_SCALARS), (rawConfig.scalars || {})), convert: naming_1.convertFactory(rawConfig), typesPrefix: rawConfig.typesPrefix || '' }, (additionalConfig || {})); | ||
this._parsedConfig = { | ||
scalars: { ...(defaultScalars || scalars_1.DEFAULT_SCALARS), ...(rawConfig.scalars || {}) }, | ||
convert: naming_1.convertFactory(rawConfig), | ||
typesPrefix: rawConfig.typesPrefix || '', | ||
...(additionalConfig || {}), | ||
}; | ||
autoBind(this); | ||
@@ -12,0 +17,0 @@ } |
@@ -12,3 +12,7 @@ "use strict"; | ||
constructor(_fragments, rawConfig, additionalConfig) { | ||
super(rawConfig, Object.assign({ noGraphQLTag: utils_1.getConfigValue(rawConfig.noGraphQLTag, false), gqlImport: rawConfig.gqlImport || null }, additionalConfig)); | ||
super(rawConfig, { | ||
noGraphQLTag: utils_1.getConfigValue(rawConfig.noGraphQLTag, false), | ||
gqlImport: rawConfig.gqlImport || null, | ||
...additionalConfig, | ||
}); | ||
this._fragments = _fragments; | ||
@@ -15,0 +19,0 @@ autoBind(this); |
@@ -76,2 +76,5 @@ "use strict"; | ||
const loadedFragment = this._loadedFragments.find(f => f.name === node.name.value); | ||
if (!loadedFragment) { | ||
throw new Error(`Unable to find fragment matching then name "${node.name.value}"! Please make sure it's loaded.`); | ||
} | ||
if (!this._fragments[loadedFragment.onType]) { | ||
@@ -204,3 +207,3 @@ this._fragments[loadedFragment.onType] = []; | ||
} | ||
const mergedResult = Object.assign({}, interfaces, types); | ||
const mergedResult = { ...interfaces, ...types }; | ||
return utils_1.quoteIfNeeded(Object.keys(mergedResult).map(typeName => { | ||
@@ -207,0 +210,0 @@ const baseFragments = utils_1.quoteIfNeeded(mergedResult[typeName].fragments, ' & '); |
@@ -82,3 +82,8 @@ "use strict"; | ||
this._comment = null; | ||
this._config = Object.assign({ blockWrapper: '', blockTransformer: block => block, enumNameValueSeparator: ':' }, this._config); | ||
this._config = { | ||
blockWrapper: '', | ||
blockTransformer: block => block, | ||
enumNameValueSeparator: ':', | ||
...this._config, | ||
}; | ||
} | ||
@@ -191,3 +196,3 @@ export(exp = true) { | ||
const typeMap = schema.getTypeMap(); | ||
let result = Object.assign({}, scalarsMapping); | ||
let result = { ...scalarsMapping }; | ||
Object.keys(typeMap) | ||
@@ -194,0 +199,0 @@ .map(typeName => typeMap[typeName]) |
@@ -18,3 +18,6 @@ import * as autoBind from 'auto-bind'; | ||
constructor(rawConfig, additionalConfig, _schema, scalars = DEFAULT_SCALARS) { | ||
super(rawConfig, Object.assign({ addTypename: !rawConfig.skipTypename }, (additionalConfig || {})), buildScalars(_schema, scalars)); | ||
super(rawConfig, { | ||
addTypename: !rawConfig.skipTypename, | ||
...(additionalConfig || {}), | ||
}, buildScalars(_schema, scalars)); | ||
this._schema = _schema; | ||
@@ -21,0 +24,0 @@ this._unnamedCounter = 1; |
@@ -10,3 +10,9 @@ import { BaseVisitor } from './base-visitor'; | ||
constructor(rawConfig, additionalConfig, _schema, defaultScalars = DEFAULT_SCALARS) { | ||
super(rawConfig, Object.assign({ contextType: parseMapper(rawConfig.contextType || 'any'), avoidOptionals: getConfigValue(rawConfig.avoidOptionals, false), defaultMapper: rawConfig.defaultMapper ? parseMapper(rawConfig.defaultMapper || 'any') : null, mappers: transformMappers(rawConfig.mappers || {}) }, (additionalConfig || {})), buildScalars(_schema, defaultScalars)); | ||
super(rawConfig, { | ||
contextType: parseMapper(rawConfig.contextType || 'any'), | ||
avoidOptionals: getConfigValue(rawConfig.avoidOptionals, false), | ||
defaultMapper: rawConfig.defaultMapper ? parseMapper(rawConfig.defaultMapper || 'any') : null, | ||
mappers: transformMappers(rawConfig.mappers || {}), | ||
...(additionalConfig || {}), | ||
}, buildScalars(_schema, defaultScalars)); | ||
this._schema = _schema; | ||
@@ -217,5 +223,8 @@ this._declarationBlockConfig = {}; | ||
this._collectedResolvers[node.name] = 'GraphQLScalarType'; | ||
return new DeclarationBlock(Object.assign({}, this._declarationBlockConfig, { blockTransformer(block) { | ||
return new DeclarationBlock({ | ||
...this._declarationBlockConfig, | ||
blockTransformer(block) { | ||
return block; | ||
} })) | ||
}, | ||
}) | ||
.export() | ||
@@ -235,5 +244,8 @@ .asKind('interface') | ||
this._collectedDirectiveResolvers[node.name] = directiveName + '<any, any, Context>'; | ||
return new DeclarationBlock(Object.assign({}, this._declarationBlockConfig, { blockTransformer(block) { | ||
return new DeclarationBlock({ | ||
...this._declarationBlockConfig, | ||
blockTransformer(block) { | ||
return block; | ||
} })) | ||
}, | ||
}) | ||
.export() | ||
@@ -240,0 +252,0 @@ .asKind('type') |
@@ -8,3 +8,6 @@ import { BaseVisitor } from './base-visitor'; | ||
constructor(_schema, rawConfig, additionalConfig, defaultScalars = DEFAULT_SCALARS) { | ||
super(rawConfig, Object.assign({ enumValues: rawConfig.enumValues || {} }, additionalConfig), buildScalars(_schema, defaultScalars)); | ||
super(rawConfig, { | ||
enumValues: rawConfig.enumValues || {}, | ||
...additionalConfig, | ||
}, buildScalars(_schema, defaultScalars)); | ||
this._schema = _schema; | ||
@@ -11,0 +14,0 @@ this._argumentsTransformer = new OperationVariablesToObject(this.scalars, this.convertName); |
@@ -7,3 +7,8 @@ import * as autoBind from 'auto-bind'; | ||
this._declarationBlockConfig = {}; | ||
this._parsedConfig = Object.assign({ scalars: Object.assign({}, (defaultScalars || DEFAULT_SCALARS), (rawConfig.scalars || {})), convert: convertFactory(rawConfig), typesPrefix: rawConfig.typesPrefix || '' }, (additionalConfig || {})); | ||
this._parsedConfig = { | ||
scalars: { ...(defaultScalars || DEFAULT_SCALARS), ...(rawConfig.scalars || {}) }, | ||
convert: convertFactory(rawConfig), | ||
typesPrefix: rawConfig.typesPrefix || '', | ||
...(additionalConfig || {}), | ||
}; | ||
autoBind(this); | ||
@@ -10,0 +15,0 @@ } |
@@ -10,3 +10,7 @@ import { BaseVisitor } from './index'; | ||
constructor(_fragments, rawConfig, additionalConfig) { | ||
super(rawConfig, Object.assign({ noGraphQLTag: getConfigValue(rawConfig.noGraphQLTag, false), gqlImport: rawConfig.gqlImport || null }, additionalConfig)); | ||
super(rawConfig, { | ||
noGraphQLTag: getConfigValue(rawConfig.noGraphQLTag, false), | ||
gqlImport: rawConfig.gqlImport || null, | ||
...additionalConfig, | ||
}); | ||
this._fragments = _fragments; | ||
@@ -13,0 +17,0 @@ autoBind(this); |
@@ -74,2 +74,5 @@ import { Kind, isObjectType, isUnionType, isInterfaceType, isEnumType, isEqualType, SchemaMetaFieldDef, TypeMetaFieldDef, isScalarType, } from 'graphql'; | ||
const loadedFragment = this._loadedFragments.find(f => f.name === node.name.value); | ||
if (!loadedFragment) { | ||
throw new Error(`Unable to find fragment matching then name "${node.name.value}"! Please make sure it's loaded.`); | ||
} | ||
if (!this._fragments[loadedFragment.onType]) { | ||
@@ -202,3 +205,3 @@ this._fragments[loadedFragment.onType] = []; | ||
} | ||
const mergedResult = Object.assign({}, interfaces, types); | ||
const mergedResult = { ...interfaces, ...types }; | ||
return quoteIfNeeded(Object.keys(mergedResult).map(typeName => { | ||
@@ -205,0 +208,0 @@ const baseFragments = quoteIfNeeded(mergedResult[typeName].fragments, ' & '); |
@@ -73,3 +73,8 @@ import { pascalCase } from 'change-case'; | ||
this._comment = null; | ||
this._config = Object.assign({ blockWrapper: '', blockTransformer: block => block, enumNameValueSeparator: ':' }, this._config); | ||
this._config = { | ||
blockWrapper: '', | ||
blockTransformer: block => block, | ||
enumNameValueSeparator: ':', | ||
...this._config, | ||
}; | ||
} | ||
@@ -178,3 +183,3 @@ export(exp = true) { | ||
const typeMap = schema.getTypeMap(); | ||
let result = Object.assign({}, scalarsMapping); | ||
let result = { ...scalarsMapping }; | ||
Object.keys(typeMap) | ||
@@ -181,0 +186,0 @@ .map(typeName => typeMap[typeName]) |
{ | ||
"name": "@graphql-codegen/visitor-plugin-common", | ||
"version": "1.0.7-alpha-e7a51714.5+e7a51714", | ||
"version": "1.0.7-alpha-ea401fe9.17+ea401fe9", | ||
"license": "MIT", | ||
@@ -10,3 +10,3 @@ "scripts": { | ||
"dependencies": { | ||
"@graphql-codegen/plugin-helpers": "1.0.7-alpha-e7a51714.5+e7a51714", | ||
"@graphql-codegen/plugin-helpers": "1.0.7-alpha-ea401fe9.17+ea401fe9", | ||
"auto-bind": "2.0.0", | ||
@@ -21,3 +21,3 @@ "dependency-graph": "0.8.0", | ||
"devDependencies": { | ||
"@graphql-codegen/testing": "1.0.7-alpha-e7a51714.5+e7a51714", | ||
"@graphql-codegen/testing": "1.0.7-alpha-ea401fe9.17+ea401fe9", | ||
"@types/graphql": "14.0.7", | ||
@@ -27,4 +27,4 @@ "@types/jest": "24.0.11", | ||
"jest": "24.5.0", | ||
"ts-jest": "24.0.0", | ||
"typescript": "3.3.4000" | ||
"ts-jest": "24.0.1", | ||
"typescript": "3.4.1" | ||
}, | ||
@@ -41,3 +41,3 @@ "sideEffects": false, | ||
}, | ||
"gitHead": "e7a517143af1ac7d88bef272f01854f0469d6463" | ||
"gitHead": "ea401fe90a07c804c6f98e2d9d581ce405287c76" | ||
} |
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 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 not supported yet
Sorry, the diff of this file is not supported yet
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
258058
3788