@getanthill/datastore
Version:
Event-Sourced Datastore
39 lines (38 loc) • 1.62 kB
TypeScript
import type { NextFunction, Request, Response } from 'express';
import type { AccessLevel, AnyObject, ApiErrorsObject, GenericType, ModelConfig, Services } from '../../typings';
import type { ParsedQs } from 'qs';
export declare function controllerBuilder(services: Services, meter: (labels: {
state: string;
model: string;
}) => void, handler: (req: Request, res: Response, next: NextFunction) => Promise<any>, errors?: ApiErrorsObject): (req: Request, res: Response, next: NextFunction) => Promise<void>;
export declare function mapQueryValues(Model: GenericType, properties: AnyObject, obj: AnyObject, mustHash?: boolean): AnyObject | null;
export declare function mapFindQuery(Model: GenericType, query: ParsedQs): {
query: null;
options: {
sort: {
_id: any;
};
projection: {
[x: string]: number;
};
};
} | {
query: {
[key: string]: any;
};
options: {
sort: {
_id: any;
};
projection: {
[x: string]: number;
};
};
};
export declare function getQueryFromCursorLastId(Model: GenericType, options: any, cursorLastId: string, cursorLastCorrelationId: string): any;
export declare function buildCursorLastId(entity: any, options: any): any;
export declare function checkProcessingAuthorization(services: Services, tokenId: string, modelConfig: ModelConfig, data: AnyObject): void;
export declare function decrypt(services: Services, access: {
id: string;
level?: AccessLevel;
}, modelName: string, data: AnyObject, fields?: string[]): Promise<AnyObject>;