UNPKG

database-proxy

Version:

Through a set of access control rules configuration database access to realize the client directly access the database via HTTP.

114 lines 2.74 kB
export declare enum ActionType { READ = "database.queryDocument", UPDATE = "database.updateDocument", ADD = "database.addDocument", REMOVE = "database.deleteDocument", COUNT = "database.countDocument", WATCH = "database.watchDocument", AGGREGATE = "database.aggregateDocuments", CREATE_INDEX = "database.createIndex", CREATE_INDEXES = "database.createIndexes", DROP_INDEX = "database.dropIndex", DROP_INDEXES = "database.dropIndexes", LIST_INDEXES = "database.listIndexes" } export interface Action { readonly type: ActionType; readonly fields: string[]; } export declare enum Direction { DESC = "desc", ASC = "asc" } export interface Order { direction: Direction; field: string; } export declare enum JoinType { INNER = "inner", LEFT = "left", RIGHT = "right", FULL = "full" } export interface JoinParam { collection: string; type: JoinType; leftKey: string; rightKey: string; } export interface Params { collection: string; action: ActionType; query?: any; data?: any; order?: Order[]; offset?: number; limit?: number; projection?: any; count?: boolean; multi?: boolean; upsert?: boolean; merge?: boolean; stages?: { stageKey: string; stageValue: string; }[]; /** * nested table name, when use join, like [{ tableName: {id: 1, name: 'xxx'}, subTable: {id: 1, age: 1}}] * @deprecated this field is only used for mysql, and will be deprecated * @see https://github.com/mysqljs/mysql#joins-with-overlapping-column-names */ nested?: boolean; /** * SQL join * @deprecated this field is only used for mysql, and will be deprecated */ joins?: JoinParam[]; } export declare function getAction(actionName: ActionType): Action | null; export declare const UPDATE_COMMANDS: { SET: string; REMOVE: string; INC: string; MUL: string; PUSH: string; PULL: string; PULL_ALL: string; POP: string; SHIFT: string; UNSHIFT: string; BIT: string; ADD_TO_SET: string; RENAME: string; MAX: string; MIN: string; }; export declare const LOGIC_COMMANDS: { AND: string; OR: string; NOT: string; NOR: string; }; export declare const QUERY_COMMANDS: { EQ: string; NEQ: string; GT: string; GTE: string; LT: string; LTE: string; IN: string; NIN: string; ALL: string; EXISTS: string; SIZE: string; MOD: string; ELE_MATCH: string; GEO_NEAR: string; GEO_WITHIN: string; GEO_INTERSECTS: string; LIKE: string; EXPR: string; TEXT: string; SEARCH: string; }; //# sourceMappingURL=types.d.ts.map