Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(rawConfig: KotlinResolversPluginRawConfig, private _schema: GraphQLSchema, defaultPackageName: string) {
super(rawConfig, {
enumValues: rawConfig.enumValues || {},
listType: rawConfig.listType || 'Iterable',
package: rawConfig.package || defaultPackageName,
scalars: buildScalars(_schema, rawConfig.scalars, KOTLIN_SCALARS),
});
}
constructor(rawConfig: CompatabilityPluginRawConfig, private _schema: GraphQLSchema, options: { reactApollo: any }) {
super(rawConfig, {
reactApollo: options.reactApollo,
noNamespaces: getConfigValue(rawConfig.noNamespaces, false),
preResolveTypes: getConfigValue(rawConfig.preResolveTypes, false),
strict: getConfigValue(rawConfig.strict, false),
scalars: buildScalars(_schema, rawConfig.scalars),
} as any);
}
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(rawConfig: JavaResolversPluginRawConfig, private _schema: GraphQLSchema, defaultPackageName: string) {
super(rawConfig, {
enumValues: rawConfig.enumValues || {},
listType: rawConfig.listType || 'Iterable',
className: rawConfig.className || 'Types',
package: rawConfig.package || defaultPackageName,
scalars: buildScalars(_schema, rawConfig.scalars, JAVA_SCALARS),
});
}
constructor(
protected _schema: GraphQLSchema,
rawConfig: TRawConfig,
additionalConfig: Partial,
defaultScalars: NormalizedScalarsMap = DEFAULT_SCALARS
) {
super(rawConfig, {
...additionalConfig,
scalars: buildScalars(_schema, rawConfig.scalars || '', defaultScalars),
});
const typesUsedInDirectives: string[] = [];
if (rawConfig.directives) {
const directiveSchema = parse(rawConfig.directives);
directiveSchema.definitions.forEach((definition: DefinitionNode) => {
if (definition.kind === Kind.ENUM_TYPE_DEFINITION || definition.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION) {
typesUsedInDirectives.push(definition.name.value);
}
});
}
this.typesToSkip = [this._schema.getQueryType(), this._schema.getMutationType(), this._schema.getSubscriptionType()]
.filter(t => t)
.map(t => (t && t.name) || '');
this.typesToSkip.push(...typesUsedInDirectives);
buildGeneratesSection: options => {
const schemaObject: GraphQLSchema = options.schemaAst ? options.schemaAst : buildASTSchema(options.schema);
const baseVisitor = new BaseVisitor(options.config, {
scalars: buildScalars(schemaObject, options.config.scalars),
});
const getAllFragmentSubTypes = (possbileTypes: string[], name: string, suffix: string): string[] => {
if (possbileTypes.length === 0) {
return [];
} else if (possbileTypes.length === 1) {
return [
baseVisitor.convertName(name, {
useTypesPrefix: true,
suffix: suffix,
}),
];
} else {
return possbileTypes.map(typeName =>
baseVisitor.convertName(name, {
useTypesPrefix: true,
constructor(rawConfig: JavaResolversPluginRawConfig, private _schema: GraphQLSchema, defaultPackageName: string) {
super(rawConfig, {
mappers: transformMappers(rawConfig.mappers || {}),
package: rawConfig.package || defaultPackageName,
defaultMapper: parseMapper(rawConfig.defaultMapper || 'Object'),
className: rawConfig.className || 'Resolvers',
listType: rawConfig.listType || 'Iterable',
scalars: buildScalars(_schema, rawConfig.scalars, JAVA_SCALARS),
});
}