@pamlight/admin
Version:
The library for syncing data changes to multiple devices from your database
61 lines • 1.62 kB
TypeScript
import { PamlightAdminActionTypes, PamlightDBWriteTypes, RouteTypes } from '../enums';
export interface IObjectMap<T> {
[key: string]: T;
}
export interface SocketRequestPayload {
body?: any;
responseId: string;
routeId?: string;
getDoc?: boolean;
}
export interface PamlightApiCommand {
body: IObjectMap<any>;
action: PamlightAdminActionTypes;
responseId?: string;
}
export interface PamlightApiError {
message: string;
code: number;
date: Date;
}
export interface PamlightAdminCredentials {
projectId: string;
projectKey: string;
}
export interface PamlightApiResponse {
error?: PamlightApiError;
timestamp: Date;
data?: any;
}
export interface WriteDocOption {
query?: IObjectMap<any>;
payload?: any;
upsert?: boolean;
result?: any;
customData?: any;
error?: any;
}
export interface WriteConfigRouteOption {
routeId: string;
collection?: string;
writeType?: PamlightDBWriteTypes;
type?: RouteTypes;
docFn: (clientData: any, parentData?: WriteDocOption) => Promise<WriteDocOption>;
triggers?: string[];
}
export interface ReadConfigRouteOption {
routeId: string;
collection: string;
type?: RouteTypes;
queryFn?: (payload: any) => IObjectMap<any>;
limit?: number;
sort?: IObjectMap<1 | -1>;
skip?: number;
projection?: IObjectMap<boolean>;
isSingleDocument?: boolean;
}
export interface RouteConfig {
reads: ReadConfigRouteOption[];
writes: WriteConfigRouteOption[];
}
//# sourceMappingURL=index.d.ts.map