import { z, ZodObject } from "zod"; import { ZodRawShape } from "zod/lib/types"; import { Identifiable } from "../identifiable"; export declare const UnsafeEntitySymbol: symbol; export declare const EntitySymbol: symbol; export type EntityCore = Identifiable & { createdAt: Date; updatedAt: Date; }; export declare const EntityCoreShape: { id: z.ZodString; createdAt: z.ZodDate; updatedAt: z.ZodDate; }; export type EntityCoreShapeType = typeof EntityCoreShape; type EntityFn = { copy: (fields: Partial

) => Zentity; toPlain: () => P & EntityCore; }; type NonBrandedEntity = EntityCore & P & EntityFn & E; export type UnsafeZentity = NonBrandedEntity & { _brand: typeof UnsafeEntitySymbol; validate: () => Zentity; }; export type Zentity = UnsafeZentity & { _safe: typeof EntitySymbol; }; export declare function isZentity(data: any): data is Zentity; export type EntityClass = { name: string; create: (params: ZodShapeType & EntityCore) => Zentity, R>; new: (params: ZodShapeType & { id: string; }) => Zentity, R>; unsafe: (params: ZodShapeType & EntityCore) => UnsafeZentity, R>; schema: ZodObject; shape: S & EntityCoreShapeType; extend: (e: EntityCore & ZodShapeType) => R; }; export type inferPlainTypeFromClass = E extends EntityClass ? ZodShapeType & EntityCore : never; export type inferZentityTypeFromClass = E extends EntityClass ? Zentity, R> : never; export type inferZentityType = E extends EntityClass ? ZodShapeType & R : never; export type inferEntity = E extends EntityClass ? Zentity, R> : never; export type inferPlainTypeFromZentity = E extends Zentity ? P & EntityCore : never; export type ZodShapeType = z.infer>; export type Extender = (e: EntityCore & ZodShapeType) => R; export declare function entity(options: { name: string; shape: S; extend?: Extender; }): EntityClass; export {}; //# sourceMappingURL=zentity.d.ts.map