/** * ORM Client - createClient factory * @generated by @constructive-io/graphql-codegen * DO NOT EDIT - changes will be overwritten */ import { OrmClient } from './client'; import type { OrmClientConfig } from './client'; import { BucketModel } from './models/bucket'; import { FileModel } from './models/file'; import { PlatformBucketModel } from './models/platformBucket'; import { PlatformFileModel } from './models/platformFile'; import { createMutationOperations } from './mutation'; export type { OrmClientConfig, QueryResult, GraphQLError, GraphQLAdapter } from './client'; export { GraphQLRequestError, FetchAdapter } from './client'; export { QueryBuilder } from './query-builder'; export * from './select-types'; export * from './models'; export { createMutationOperations } from './mutation'; /** * Create an ORM client instance * * @example * ```typescript * const db = createClient({ * endpoint: 'https://api.example.com/graphql', * headers: { Authorization: 'Bearer token' }, * }); * * // Query users * const users = await db.user.findMany({ * select: { id: true, name: true }, * first: 10, * }).execute(); * * // Create a user * const newUser = await db.user.create({ * data: { name: 'John', email: 'john@example.com' }, * select: { id: true }, * }).execute(); * ``` */ export function createClient(config: OrmClientConfig) { const client = new OrmClient(config); return { bucket: new BucketModel(client), file: new FileModel(client), platformBucket: new PlatformBucketModel(client), platformFile: new PlatformFileModel(client), mutation: createMutationOperations(client), }; }