UNPKG

odatafy-mongoose

Version:

Use mongoose to excel the capabilities of datafy-mongodb

44 lines (43 loc) 1.89 kB
import { Model, SchemaType } from 'mongoose'; import { MongoDBODatafyOpts } from 'odatafy-mongodb'; import { ObjectModelMetadata, ODataModelField, ServiceMetadata } from './types'; /** * Get expandmap for use in odatafy-mongodb from a mongoose model * @param model - model to get expandmap for * @returns expandmap for the passed mongoose model */ export declare function getExpandMapping(model: Model<unknown>, basePath?: string, depth?: number): MongoDBODatafyOpts["expandMapping"]; /** * Get metadata for all models that are registered in the mongoose instance that is passed to init * @returns metadata for the odata service */ export declare function getServiceMetaData(): ServiceMetadata; /** * Extract metadata from a mongoose model * @param model - model to extract metadata from * @returns - metadata for the model */ export declare function getModelMetadata(model: Model<unknown>): ObjectModelMetadata; /** * Extract Metadata from mongoose model with pathanme * @param model - model to extract from * @param pathName - name of the path to extract * @param metaData - already extracted metadata * @returns extracted metadata for the specified pathName of the specified model */ export declare function getPathMetaData(model: Model<unknown>, pathName: string, metaData: ObjectModelMetadata): ODataModelField; /** * Extract Metadata from mongoose model path * @param model - model to extract from * @param path - path to extract * @param metaData - already extracted metadata * @returns extracted metadata for the specified path of the specified model */ export declare function extractMetaData(model: Model<unknown>, path: SchemaType, metaData: ObjectModelMetadata): ODataModelField; export declare const mergeDeep: (target: { [key: string]: unknown; }, source: { [key: string]: unknown; }, isMergingArrays?: boolean) => { [key: string]: unknown; };