Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function createGqlSchema(): Promise {
let attempts = 0;
// eslint-disable-next-line no-constant-condition
while (true) {
try {
if (options.watchPg) {
await watchPostGraphileSchema(pgPool, pgSchemas, options, newSchema => {
gqlSchema = newSchema;
_emitter.emit('schemas:changed');
exportGqlSchema(gqlSchema);
});
if (!gqlSchema) {
throw new Error(
"Consistency error: watchPostGraphileSchema promises to call the callback before the promise resolves; but this hasn't happened",
);
}
} else {
gqlSchema = await createPostGraphileSchema(pgPool, pgSchemas, options);
exportGqlSchema(gqlSchema);
}
if (attempts > 0) {
// tslint:disable-next-line no-console
console.error(