/** * FunctionGraphRef 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 { FunctionGraphRef, FunctionGraphRefWithRelations, FunctionGraphRefSelect, FunctionGraphRefFilter, FunctionGraphRefOrderBy, CreateFunctionGraphRefInput, UpdateFunctionGraphRefInput, FunctionGraphRefPatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class FunctionGraphRefModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ functionGraphRefs: ConnectionResult>; }> { const { document, variables } = buildFindManyDocument( 'FunctionGraphRef', 'functionGraphRefs', 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, }, 'FunctionGraphRefFilter', 'FunctionGraphRefOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'FunctionGraphRef', fieldName: 'functionGraphRefs', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ functionGraphRef: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'FunctionGraphRef', 'functionGraphRefs', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'FunctionGraphRefFilter', 'FunctionGraphRefOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'FunctionGraphRef', fieldName: 'functionGraphRef', document, variables, transform: (data: { functionGraphRefs?: { nodes?: InferSelectResult[]; }; }) => ({ functionGraphRef: data.functionGraphRefs?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ functionGraphRef: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'FunctionGraphRef', 'functionGraphRefs', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'FunctionGraphRefFilter', 'FunctionGraphRefOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'FunctionGraphRef', fieldName: 'functionGraphRef', document, variables, transform: (data: { functionGraphRefs?: { nodes?: InferSelectResult[]; }; }) => ({ functionGraphRef: data.functionGraphRefs?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createFunctionGraphRef: { functionGraphRef: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'FunctionGraphRef', 'createFunctionGraphRef', 'functionGraphRef', args.select, args.data, 'CreateFunctionGraphRefInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'FunctionGraphRef', fieldName: 'createFunctionGraphRef', document, variables, }); } update( args: UpdateArgs< S, { id: string; scopeId: string; }, FunctionGraphRefPatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updateFunctionGraphRef: { functionGraphRef: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'FunctionGraphRef', 'updateFunctionGraphRef', 'functionGraphRef', args.select, args.where.id, args.data, 'UpdateFunctionGraphRefInput', 'id', 'functionGraphRefPatch', connectionFieldsMap, { scopeId: args.where.scopeId, } ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'FunctionGraphRef', fieldName: 'updateFunctionGraphRef', document, variables, }); } delete( args: DeleteArgs< { id: string; scopeId: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deleteFunctionGraphRef: { functionGraphRef: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'FunctionGraphRef', 'deleteFunctionGraphRef', 'functionGraphRef', { id: args.where.id, scopeId: args.where.scopeId, }, 'DeleteFunctionGraphRefInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'FunctionGraphRef', fieldName: 'deleteFunctionGraphRef', document, variables, }); } }