///
///
import * as mongoose from 'mongoose';
import { HttpMethod, HttpStatusCode } from '../utils/http-util';
import { Request, Response, NextFunction } from 'express';
import { Log } from '../../typings/log';
/**
* Parses comma separated string field names into mongodb projection object.
*/
export declare function parseFields(rawFields: string | any): any;
/**
* Parses the query string into mongodb criteria object.
*/
export declare function parseQuery(rawQuery: string | any): any;
/**
* Parses comma separated string populate names into mongodb population object.
*/
export declare function parsePopulation(rawPopulation: string | any): any;
/**
* Parses comma separated string sort names into mongodb population object.
*/
export declare function parseSort(rawSort: string | any): any;
/**
* Clears an existing collection using recursive retries.
*/
export declare function clearCollection(instance: mongoose.Mongoose, name: string): Promise;
export interface HttpResponse {
status: HttpStatusCode;
body?: any;
}
export interface HttpRequest {
originalUrl?: string;
method: HttpMethod;
query?: {
[key: string]: any;
};
headers?: {
[key: string]: any;
};
body?: any;
params?: {
[key: string]: any;
};
rawBody?: any;
}
export declare function createApi(authHandler: {
ensureAuthorized: (request: Request, response: Response, next: NextFunction) => Promise;
}, app: any, store: any, logger: Log): void;
/**
* The mongoose-based RESTful API implementation.
*/
export declare class Mongooser {
private readonly model;
constructor(model: mongoose.Model);
/**
* Retrieves an existing item by id.
*/
getOne(id: any, projection?: any, population?: mongoose.ModelPopulateOptions | Array): Promise;
/**
* Retrieves existing items.
*/
getMany(criteria?: any, projection?: any, population?: mongoose.ModelPopulateOptions | Array, page?: number | any, perPage?: number | any, sort?: string | any, showInactive?: boolean | any): Promise;
/**
* Inserts new items.
*/
insertMany(req: Request): Promise;
/**
* Updates (patches) an existing item.
*/
updateOne(req: Request, id: any): Promise;
/**
* Deactivates an existing item.
*/
deletebyId(id: any): Promise;
}