UNPKG

@typegoose/typegoose

Version:

Define Mongoose models using TypeScript classes

64 lines (63 loc) 2.33 kB
import mongoose from 'mongoose'; import type { AnyParamConstructor, IBuildSchemaOptions, IModelOptions, INamingOptions } from '../types'; /** * Internal Schema Builder for Classes * This Function should not be used directly outside of typegoose internals, use "buildSchema" from typegoose.ts directly * @param cl The Class to build a Model from * @param origSch A Schema to clone and extend onto * @param opt Overwrite SchemaOptions (Merged with Decorator Options) * @param isFinalSchema Set if this Schema is the final (top-level) to build, only when "true" are discriminators, hooks, virtuals, etc applied * @param overwriteNaming Overwrite options for name generation * @param extraOptions Extra options to affect what needs to be done * @returns Returns the Build Schema * @private */ export declare function _buildSchema<U extends AnyParamConstructor<any>>(cl: U, origSch?: mongoose.Schema<any>, opt?: IModelOptions, isFinalSchema?: boolean, overwriteNaming?: INamingOptions, extraOptions?: IBuildSchemaOptions): mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, { [x: number]: unknown; [x: symbol]: unknown; [x: string]: unknown; }, mongoose.Document<unknown, {}, { [x: number]: unknown; [x: symbol]: unknown; [x: string]: unknown; }, { id: string; }, mongoose.ResolveSchemaOptions<mongoose.DefaultSchemaOptions>> & Omit<{ [x: number]: unknown; [x: symbol]: unknown; [x: string]: unknown; } & Required<{ _id: unknown; }> & { __v: number; }, "id"> & { id: string; }, { [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>; } | { [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, { [x: number]: unknown; [x: symbol]: unknown; [x: string]: unknown; }, { id: string; }, mongoose.ResolveSchemaOptions<mongoose.DefaultSchemaOptions>> & Omit<{ [x: number]: unknown; [x: symbol]: unknown; [x: string]: unknown; } & Required<{ _id: unknown; }> & { __v: number; }, "id"> & { id: string; }> | undefined; }, { [x: number]: {}; [x: symbol]: {}; [x: string]: {}; } & Required<{ _id: unknown; }> & { __v: number; }>;