@intuitionrobotics/db-api-generator
Version:
33 lines • 2.93 kB
TypeScript
import { BaseDB_ApiGenerator } from "./BaseDB_ApiGenerator.js";
import { type ApiTypeBinder, type QueryParams } from "@intuitionrobotics/thunderstorm";
import { type ApiBinder_DBCreate, type ApiBinder_DBDelete, type ApiBinder_DBQuery, type ApiBinder_DBUniuqe, type ApiBinder_DBUpdate, type GenericApiDef } from "../index.js";
import { type Clause_Where, type DB_Object } from "@intuitionrobotics/firebase";
import { ApiResponse, type ExpressRequest, ServerApi } from "@intuitionrobotics/thunderstorm/backend";
export declare function resolveUrlPart(dbModule: BaseDB_ApiGenerator<any>, pathPart?: string, pathSuffix?: string): string;
export declare abstract class GenericServerApi<DBType extends DB_Object, Binder extends ApiTypeBinder<string, R, B, P>, PostProcessor = never, R = Binder["response"], B = Binder["body"], P extends QueryParams | {} = Binder["queryParams"]> extends ServerApi<Binder> {
protected readonly dbModule: BaseDB_ApiGenerator<DBType>;
protected readonly postProcessors: PostProcessor[];
protected constructor(dbModule: BaseDB_ApiGenerator<DBType>, def: GenericApiDef, pathPart?: string);
addPostProcessor(processor: PostProcessor): void;
}
export declare class ServerApi_Create<DBType extends DB_Object> extends GenericServerApi<DBType, ApiBinder_DBCreate<DBType>, (item: DBType) => DBType> {
constructor(dbModule: BaseDB_ApiGenerator<DBType>, pathPart?: string);
protected process(request: ExpressRequest, response: ApiResponse, queryParams: {}, body: Omit<DBType, "_id">): Promise<DBType>;
}
export declare class ServerApi_Update<DBType extends DB_Object> extends GenericServerApi<DBType, ApiBinder_DBUpdate<DBType>> {
constructor(dbModule: BaseDB_ApiGenerator<DBType>, pathPart?: string);
protected process(request: ExpressRequest, response: ApiResponse, queryParams: {}, body: DBType): Promise<DBType>;
}
export declare class ServerApi_Unique<DBType extends DB_Object> extends GenericServerApi<DBType, ApiBinder_DBUniuqe<DBType>> {
constructor(dbModule: BaseDB_ApiGenerator<DBType>, pathPart?: string);
protected process(request: ExpressRequest, response: ApiResponse, queryParams: DB_Object, _body: void): Promise<DBType>;
}
export declare class ServerApi_Query<DBType extends DB_Object> extends GenericServerApi<DBType, ApiBinder_DBQuery<DB_Object>, () => Promise<Partial<DBType>[]>> {
constructor(dbModule: BaseDB_ApiGenerator<DBType>, pathPart?: string);
protected process(request: ExpressRequest, response: ApiResponse, queryParams: {}, _body: Clause_Where<DBType>): Promise<DBType[]>;
}
export declare class ServerApi_Delete<DBType extends DB_Object> extends GenericServerApi<DBType, ApiBinder_DBDelete<DBType>> {
constructor(dbModule: BaseDB_ApiGenerator<DBType>, pathPart?: string);
protected process(request: ExpressRequest, response: ApiResponse, queryParams: DB_Object, _body: void): Promise<DBType>;
}
//# sourceMappingURL=apis.d.ts.map