/** * CLI command for mutation databaseGraphSetAndCommit * @generated by @constructive-io/graphql-codegen * DO NOT EDIT - changes will be overwritten */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { unflattenDotNotation, buildSelectFromPaths } from '../utils'; import type { DatabaseGraphSetAndCommitVariables } from '../../orm/mutation'; import type { DatabaseGraphSetAndCommitPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, _options: CLIOptions ) => { try { if (argv.help || argv.h) { console.log( 'database-graph-set-and-commit - databaseGraphSetAndCommit\n\nUsage: database-graph-set-and-commit [OPTIONS]\n' ); process.exit(0); } const answers = await prompter.prompt(argv, [ { type: 'text', name: 'input', message: 'The exclusive input argument for this mutation. An object type, make sure to see documentation for this object\u2019s fields.', required: true, }, ]); const client = getClient(); const parsedAnswers = unflattenDotNotation(answers); const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation .databaseGraphSetAndCommit( parsedAnswers as unknown as DatabaseGraphSetAndCommitVariables, { select: selectFields, } as unknown as { select: DatabaseGraphSetAndCommitPayloadSelect; } ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: databaseGraphSetAndCommit'); if (error instanceof Error) { console.error(error.message); } process.exit(1); } };