import { EntityEnumDef, EntityEnumField, EntityField, EntityIndex, EntityRelationField, EntityScalarField, EntitySpec } from "./types.js"; //#region src/entity/defineEntity.d.ts /** * Helper to define a database entity with full type safety. * * @example * ```typescript * const UserEntity = defineEntity({ * name: 'User', * schema: 'lssm_sigil', * description: 'A user of the platform.', * fields: { * id: field.id(), * email: field.string({ isUnique: true, zod: z.string().email() }), * name: field.string({ isOptional: true }), * createdAt: field.createdAt(), * updatedAt: field.updatedAt(), * memberships: field.hasMany('Member'), * }, * indexes: [{ fields: ['email'], unique: true }], * }); * ``` */ declare function defineEntity>(spec: EntitySpec): EntitySpec; /** * Helper to define an enum that can be shared across entities. */ declare function defineEntityEnum(def: EntityEnumDef): EntityEnumDef; /** * Field builder helpers for common field patterns. */ declare const field: { /** String field */ string(opts?: Partial>): EntityScalarField; /** Integer field */ int(opts?: Partial>): EntityScalarField; /** Float field */ float(opts?: Partial>): EntityScalarField; /** Boolean field */ boolean(opts?: Partial>): EntityScalarField; /** DateTime field */ dateTime(opts?: Partial>): EntityScalarField; /** JSON field */ json(opts?: Partial>): EntityScalarField; /** BigInt field */ bigInt(opts?: Partial>): EntityScalarField; /** Decimal field */ decimal(opts?: Partial>): EntityScalarField; /** Bytes field */ bytes(opts?: Partial>): EntityScalarField; /** Primary key field with cuid() default */ id(opts?: Partial>): EntityScalarField; /** Primary key field with uuid() default */ uuid(opts?: Partial>): EntityScalarField; /** Auto-increment integer primary key */ autoIncrement(opts?: Partial>): EntityScalarField; /** createdAt timestamp with now() default */ createdAt(opts?: Partial>): EntityScalarField; /** updatedAt timestamp with @updatedAt */ updatedAt(opts?: Partial>): EntityScalarField; /** Email field with validation */ email(opts?: Partial>): EntityScalarField; /** URL field with validation */ url(opts?: Partial>): EntityScalarField; /** Enum field */ enum(enumName: string, opts?: Partial>): EntityEnumField; /** Inline enum field with values */ inlineEnum(enumName: string, values: readonly string[], opts?: Partial>): EntityEnumField; /** Has one relation (1:1 inverse side) */ hasOne(target: string, opts?: Partial>): EntityRelationField; /** Has many relation (1:N inverse side) */ hasMany(target: string, opts?: Partial>): EntityRelationField; /** Belongs to relation (N:1 owning side with foreign key) */ belongsTo(target: string, fields: string[], references: string[], opts?: Partial>): EntityRelationField; /** Foreign key field (string) - use with belongsTo */ foreignKey(opts?: Partial>): EntityScalarField; }; /** * Index builder helpers. */ declare const index: { /** Create a regular index */ on(fields: string[], opts?: Partial>): EntityIndex; /** Create a unique constraint index */ unique(fields: string[], opts?: Partial>): EntityIndex; /** Create a compound index with sort orders */ compound(fields: string[], sort: Record, opts?: Partial>): EntityIndex; }; //#endregion export { defineEntity, defineEntityEnum, field, index }; //# sourceMappingURL=defineEntity.d.ts.map