Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function initGraphbackClient(
context: InputModelTypeContext[]
): Promise {
const fragments: StringDic = {};
const queries: StringDic = {};
const mutations: StringDic = {};
const subscriptions: StringDic = {};
const client = await createClient(context, { output: "gqlwithfragment" });
if (client.fragments !== undefined) {
insertImplInto(client.fragments, fragments);
}
if (client.queries !== undefined) {
insertImplInto(client.queries, queries);
}
if (client.mutations !== undefined) {
insertImplInto(client.mutations, mutations);
}
if (client.subscriptions !== undefined) {
insertImplInto(client.subscriptions, subscriptions);
}
export async function createClientFiles(cwd: string, inputContext: InputModelTypeContext[], config: GenerateConfig) {
const generated = await createClient(inputContext, { output: config.generator.client.format });
await Promise.all([
createFragments(cwd, generated, config),
createQueries(cwd, generated, config),
createMutations(cwd, generated, config),
createSubscriptions(cwd, generated, config),
]);
}
public async createClient(): Promise {
return createClient(this.inputContext);
}
}