Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Validate and unpack schema
var schema = void 0;
if (schemaJson) {
schema = initSchema(schemaJson);
} else if (schemaJsonFilepath) {
schema = initSchemaFromFile(schemaJsonFilepath);
} else if (schemaString) {
schema = initSchemaFromString(schemaString);
} else {
try {
var config = (0, _graphqlConfig.getGraphQLProjectConfig)('.', projectName);
schema = config.getSchema();
} catch (e) {
if (e instanceof _graphqlConfig.ConfigNotFoundError) {
throw new Error('Must provide .graphqlconfig file or pass in `schemaJson` option ' + 'with schema object or `schemaJsonFilepath` with absolute path to the json file.');
}
throw e;
}
}
// Validate env
if (env && env !== 'lokka' && env !== 'relay' && env !== 'apollo' && env !== 'literal') {
throw new Error('Invalid option for env, only `apollo`, `lokka`, `relay`, and `literal` supported.');
}
// Validate tagName and set default
var tagName = void 0;
if (tagNameOption) {
tagName = tagNameOption;
} else if (env === 'relay') {
constructor(context, withoutInit = false) {
try {
this.gqlConfig = graphQLConfig.getGraphQLConfig();
this.fixOldConfig();
} catch (e) {
if (e instanceof graphQLConfig.ConfigNotFoundError) {
const { amplify } = context;
let projectRoot;
if (!withoutInit) {
projectRoot = amplify.getEnvInfo().projectPath || process.cwd();
} else {
projectRoot = process.cwd();
}
const configPath = join(projectRoot, '.graphqlconfig.yml');
this.gqlConfig = new graphQLConfig.GraphQLConfig(null, configPath);
this.gqlConfig.config = {};
} else {
throw e;
}
}
}
static isValidAmplifyProject(project) {