Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
await server.start();
let binding: Binding;
try {
binding = ((await server.getBinding()) as unknown) as Binding;
} catch (error) {
Logger.error(error);
return process.exit(1);
}
let project: Project = (null as unknown) as Project;
try {
project = ((await createProject(binding as any)) as unknown) as Project;
Logger.log(project);
} catch (err) {
const error = getBindingError(err);
Logger.error(error);
}
try {
// Create environment
let environment: Environment;
const environments: Environment[] = [];
environment = await createEnvironment(binding as any, project.key, 'production');
environments.push(environment);
environment = await createEnvironment(binding as any, project.key, 'staging');
environments.push(environment);
environment = await createEnvironment(binding as any, project.key, 'development');
environments.push(environment);
// Create flags
await createFeatureFlag(binding as any, project.key, 'alpha-map-view');
static logGraphQLError(error: Error) {
console.error(util.inspect(getBindingError(error), { showHidden: false, depth: null }));
}
}
);
Logger.info(project);
const flagsA = await binding.query.featureFlagsForUser({
where: { projKey: project.key, envKey: 'production', userKey: 'user-a' }
});
Logger.info(flagsA);
const flagsB = await binding.query.featureFlagsForUser({
where: { projKey: project.key, envKey: 'production', userKey: 'user-b' }
});
Logger.info(flagsB);
} catch (err) {
const error = getBindingError(err);
Logger.error(error);
}
return server.stop();
}