import { type FirstLetterLowercase } from '@augment-vir/core'; import { type BasePrismaClient, type BaseTypeMap } from './base-prisma-types.js'; import { type PrismaModelName } from './prisma-model-name.js'; /** * Use this to define mock entries that _shouldn't_ be saved to the database so that we can easily * write tests for missing data. * * @category Prisma : Common * @category Package : @augment-vir/common * @example * * ```ts * import {type PrismaClient} from '@prisma/client'; * import {prismaModelCreateExclude, PrismaKeyedModelCreate} from '@augment-vir/common'; * * export const mockUsers = { * user1: { * id: 1, * authRole: 'admin', * }, * missingUser: { * id: -1, * authRole: 'user', * [prismaModelCreateExclude]: true, * }, * } as const satisfies PrismaKeyedModelCreate; * ``` * * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common) */ export declare const prismaModelCreateExclude: unique symbol; /** * Use this to prevent the id property from being included when creating a mock record, allowing the * database's internal auto-increment functionality to generate one. This is necessary when testing * creation of new records because manually specified ids do not increment the auto incrementor. * * @category Prisma : Common * @category Package : @augment-vir/common * @example * * ```ts * import {type PrismaClient} from '@prisma/client'; * import {prismaModelCreateOmitId, PrismaKeyedModelCreate} from '@augment-vir/common'; * * export const mockUsers = { * user1: { * id: 1, * authRole: 'admin', * [prismaModelCreateOmitId]: true, * }, * user2: { * id: 2, * authRole: 'admin', * [prismaModelCreateOmitId]: true, * }, * } as const satisfies PrismaKeyedModelCreate; * ``` * * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common) */ export declare const prismaModelCreateOmitId: unique symbol; /** * Extracts the creation data for a model from the given `PrismaClient` type. * * @category Prisma : Common * @category Package : @augment-vir/common * @example * * ```ts * import {type PrismaClient} from '@prisma/client'; * import {type PrismaModelCreate} from '@augment-vir/common'; * * function doThing(entry: PrismaModelCreate) {} * ``` * * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common) */ export type PrismaModelCreate> = NonNullable]['create']>[0]> extends { data?: infer Data; } ? NonNullable & Partial<{ [prismaModelCreateExclude]: true; [prismaModelCreateOmitId]: true; }> : `ERROR: failed to infer creation entry for model '${Model}'`; /** * A type for creating multiple Prisma create mocks that are named for future reference. * * @category Prisma : Common * @category Package : @augment-vir/common * @example * * ```ts * import {PrismaKeyedModelCreate} from '@augment-vir/common'; * import {type PrismaClient} from '@prisma/client'; * * const mockUsers = { * mockUser1: { * first_name: 'one', * id: 123, * // etc. * }, * mockUser2: { * first_name: 'two', * id: 124, * auth_role: 'user', * // etc. * }, * } as const satisfies PrismaKeyedModelCreate; * ``` * * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common) */ export type PrismaKeyedModelCreate> = { [EntryName in string]: PrismaModelCreate; }; /** * Model create data stored by model name in either array or keyed form. Used in * `prisma.client.addData()` from `@augment-vir/node`. * * @category Prisma : Common * @category Package : @augment-vir/common * @example * * ```ts * import {PrismaKeyedModelCreate} from '@augment-vir/common'; * import {type PrismaClient} from '@prisma/client'; * * const mockData: ModelCreateData = { * user: { * mockUser1: { * first_name: 'one', * id: 123, * // etc. * }, * mockUser2: { * first_name: 'two', * id: 124, * auth_role: 'user', * // etc. * }, * }, * region: [ * { * id: 1, * name: 'North America', * // etc. * }, * { * id: 2, * name: 'Europe', * // etc. * }, * ], * }; * ``` * * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common) */ export type PrismaAllModelsCreate = Readonly]: Readonly> | ReadonlyArray>>; }>>;