Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
namespacedImportName: this.config.namespacedImportName,
convertName: this.convertName.bind(this),
enumPrefix: this.config.enumPrefix,
scalars: this.scalars,
formatNamedField: (name: string): string => name,
wrapTypeWithModifiers,
};
const processor = config.preResolveTypes
? new PreResolveTypesProcessor(processorConfig)
: new FlowWithPickSelectionSetProcessor({
...processorConfig,
useFlowExactObjects: this.config.useFlowExactObjects,
useFlowReadOnlyTypes: this.config.useFlowReadOnlyTypes,
});
const enumsNames = Object.keys(schema.getTypeMap()).filter(typeName => isEnumType(schema.getType(typeName)));
this.setSelectionSetHandler(new SelectionSetToObject(processor, this.scalars, this.schema, this.convertName.bind(this), allFragments, this.config));
this.setVariablesTransformer(new FlowOperationVariablesToObject(this.scalars, this.convertName.bind(this), this.config.namespacedImportName, enumsNames, this.config.enumPrefix));
}
}
return `${prefix}Maybe<${this.config.immutableTypes ? 'ReadonlyArray' : 'Array'}<${innerType}>>`;
} else {
return `${prefix}Maybe<${baseType}>`;
}
};
const processorConfig: SelectionSetProcessorConfig = {
namespacedImportName: this.config.namespacedImportName,
convertName: this.convertName.bind(this),
enumPrefix: this.config.enumPrefix,
scalars: this.scalars,
formatNamedField: (name: string): string => (this.config.immutableTypes ? `readonly ${name}` : name),
wrapTypeWithModifiers,
};
const processor = new (config.preResolveTypes ? PreResolveTypesProcessor : TypeScriptSelectionSetProcessor)(processorConfig);
this.setSelectionSetHandler(new SelectionSetToObject(processor, this.scalars, this.schema, this.convertName.bind(this), allFragments, this.config));
const enumsNames = Object.keys(schema.getTypeMap()).filter(typeName => isEnumType(schema.getType(typeName)));
this.setVariablesTransformer(
new TypeScriptOperationVariablesToObject(this.scalars, this.convertName.bind(this), this.config.avoidOptionals, this.config.immutableTypes, this.config.namespacedImportName, enumsNames, this.config.enumPrefix, this.config.enumValues)
);
this._declarationBlockConfig = {
ignoreExport: this.config.noExport,
};
}
}