import { init } from "@paralleldrive/cuid2"; import { type ExcludeField, type Field, type IncludeField } from "./valid-fields.js"; type Cuid2InitOptions = Parameters[0]; export type Cuid2ExtensionOptionsBase = { /** * This allows you to customize the CUID2 generation. * * A useful option is to set the `fingerprint` to a unique value for your application. * * @example * const cuid2 = cuid2Extension({ * cuid2Options: { * fingerprint: process.env.DEVICE_ID * } * }) * * @see https://github.com/paralleldrive/cuid2?tab=readme-ov-file#configuration */ cuid2Options?: Cuid2InitOptions; }; type Cuid2ExtensionOptionsWildcard = { /** * The fields to automatically set the CUID2 value on. * * Provide the fields in the format of `ModelName:FieldName`. You can use `*` to match all models. * * @example ["User:userId", "Post:postId"] * @example ["*:id", "Post:secondId"] * * @default ["*:id"] */ includeFields?: IncludeField[]; /** * The fields to exclude from being automatically set the CUID2 value on. * * This is useful if you have a small number of fields that you want to exclude from being automatically set. * You can use `*` to exclude all fields on a model. * * Provide the fields in the format of `ModelName:FieldName`. * * @example ["User:id"] * @example ["Post:*"] */ excludeFields?: ExcludeField[]; }; type Cuid2ExtensionOptionsExact = { /** * Requires the exact fields to include for the CUID2 extension. * * This is the recommended way to use the extension as it provides a clear understanding of which fields are being * affected and supports type safety. */ fields: Field[]; }; export type Cuid2ExtensionOptions = Cuid2ExtensionOptionsBase & (Cuid2ExtensionOptionsWildcard | Cuid2ExtensionOptionsExact); export default function cuid2Extension(options?: Cuid2ExtensionOptions): (client: any) => { $extends: { extArgs: import("@prisma/client/runtime/library").InternalArgs; }; }; export {};