Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
decoratorName: {
type: 'ObjectType',
interface: 'InterfaceType',
arguments: 'ArgsType',
field: 'Field',
input: 'InputType',
...(pluginConfig.decoratorName || {}),
},
...(additionalConfig || {}),
} as TParsedConfig);
autoBind(this);
const enumNames = Object.values(schema.getTypeMap())
.map(type => (type instanceof GraphQLEnumType ? type.name : undefined))
.filter(t => t);
this.setArgumentsTransformer(new TypeScriptOperationVariablesToObject(this.scalars, this.convertName, this.config.avoidOptionals.object, this.config.immutableTypes, null, enumNames, this.config.enumPrefix, this.config.enumValues));
this.setDeclarationBlockConfig({
enumNameValueSeparator: ' =',
});
}
constructor(private _schema: GraphQLSchema, pluginConfig: TypeScriptMongoPluginConfig) {
super(pluginConfig, ({
dbTypeSuffix: pluginConfig.dbTypeSuffix || 'DbObject',
dbInterfaceSuffix: pluginConfig.dbInterfaceSuffix || 'DbInterface',
objectIdType: resolveObjectId(pluginConfig.objectIdType).identifier,
objectIdImport: resolveObjectId(pluginConfig.objectIdType).module,
idFieldName: pluginConfig.idFieldName || '_id',
enumsAsString: getConfigValue(pluginConfig.enumsAsString, true),
avoidOptionals: getConfigValue(pluginConfig.avoidOptionals, false),
scalars: buildScalars(_schema, pluginConfig.scalars, DEFAULT_SCALARS),
} as Partial) as any);
autoBind(this);
this._variablesTransformer = new TypeScriptOperationVariablesToObject(this.scalars, this.convertName, false, false);
}
constructor(pluginConfig: TypeScriptResolversPluginConfig, schema: GraphQLSchema) {
super(
pluginConfig,
{
avoidOptionals: getConfigValue(pluginConfig.avoidOptionals, false),
immutableTypes: getConfigValue(pluginConfig.immutableTypes, false),
useIndexSignature: getConfigValue(pluginConfig.useIndexSignature, false),
} as ParsedTypeScriptResolversConfig,
schema
);
autoBind(this);
this.setVariablesTransformer(new TypeScriptOperationVariablesToObject(this.scalars, this.convertName, this.config.avoidOptionals, this.config.immutableTypes, null, [], this.config.enumPrefix, this.config.enumValues));
if (this.config.useIndexSignature) {
this._declarationBlockConfig = {
blockTransformer(block) {
return `ResolversObject<${block}>`;
},
};
}
}