/** * FunctionGraphObject model for ORM client * @generated by @constructive-io/graphql-codegen * DO NOT EDIT - changes will be overwritten */ import { OrmClient } from '../client'; import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildFindOneDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder'; import type { ConnectionResult, FindManyArgs, FindFirstArgs, CreateArgs, UpdateArgs, DeleteArgs, InferSelectResult, StrictSelect, } from '../select-types'; import type { FunctionGraphObject, FunctionGraphObjectWithRelations, FunctionGraphObjectSelect, FunctionGraphObjectFilter, FunctionGraphObjectOrderBy, CreateFunctionGraphObjectInput, UpdateFunctionGraphObjectInput, FunctionGraphObjectPatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class FunctionGraphObjectModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ functionGraphObjects: ConnectionResult>; }> { const { document, variables } = buildFindManyDocument( 'FunctionGraphObject', 'functionGraphObjects', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, first: args?.first, last: args?.last, after: args?.after, before: args?.before, offset: args?.offset, }, 'FunctionGraphObjectFilter', 'FunctionGraphObjectOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'FunctionGraphObject', fieldName: 'functionGraphObjects', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ functionGraphObject: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'FunctionGraphObject', 'functionGraphObjects', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'FunctionGraphObjectFilter', 'FunctionGraphObjectOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'FunctionGraphObject', fieldName: 'functionGraphObject', document, variables, transform: (data: { functionGraphObjects?: { nodes?: InferSelectResult[]; }; }) => ({ functionGraphObject: data.functionGraphObjects?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ functionGraphObject: InferSelectResult | null; }> { const { document, variables } = buildFindOneDocument( 'FunctionGraphObject', 'getNodeAtPath', args.id, args.select, 'id', 'UUID!', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'FunctionGraphObject', fieldName: 'functionGraphObject', document, variables, }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createFunctionGraphObject: { functionGraphObject: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'FunctionGraphObject', 'createFunctionGraphObject', 'functionGraphObject', args.select, args.data, 'CreateFunctionGraphObjectInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'FunctionGraphObject', fieldName: 'createFunctionGraphObject', document, variables, }); } update( args: UpdateArgs< S, { id: string; scopeId: string; }, FunctionGraphObjectPatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updateFunctionGraphObject: { functionGraphObject: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'FunctionGraphObject', 'updateFunctionGraphObject', 'functionGraphObject', args.select, args.where.id, args.data, 'UpdateFunctionGraphObjectInput', 'id', 'functionGraphObjectPatch', connectionFieldsMap, { scopeId: args.where.scopeId, } ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'FunctionGraphObject', fieldName: 'updateFunctionGraphObject', document, variables, }); } delete( args: DeleteArgs< { id: string; scopeId: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deleteFunctionGraphObject: { functionGraphObject: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'FunctionGraphObject', 'deleteFunctionGraphObject', 'functionGraphObject', { id: args.where.id, scopeId: args.where.scopeId, }, 'DeleteFunctionGraphObjectInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'FunctionGraphObject', fieldName: 'deleteFunctionGraphObject', document, variables, }); } }