nosqlax
Version:
NoSQLax is a modern, lightweight JavaScript Object Document Mapper(ODM) library that makes working with CouchDB a breeze. Inspired by CouchDB’s “Relax” philosophy and the chill vibes of Snorlax, NoSQLax takes the hassle out of managing your data, offering
30 lines (29 loc) • 1.15 kB
TypeScript
import BaseEntity from "./BaseEntity";
import DataSource from "./DataSource";
import { MangoQuery, MangoSelector } from "nano";
type MangoOptions = Omit<MangoQuery, 'selector'>;
declare abstract class ActiveRecordEntity extends BaseEntity {
private static repoMap;
constructor(data: {
_id?: string;
_rev?: string;
[key: string]: any;
});
protected static attachDataSource(dataSource: DataSource, ajvOptions: any): void;
private static getRepo;
static find(id: string): Promise<BaseEntity>;
static findOne(selector: MangoSelector, options?: MangoOptions): Promise<BaseEntity>;
static get dataSource(): DataSource;
static findMany(selector: MangoSelector, options?: MangoOptions): Promise<BaseEntity[]>;
static findAll(options?: MangoOptions): Promise<BaseEntity[]>;
static save(data: BaseEntity): Promise<BaseEntity>;
save(): Promise<BaseEntity>;
static delete(id: string): Promise<{
message: string;
}>;
delete(): Promise<{
message: string;
}>;
static extend(newMethods: Record<string, Function>): void;
}
export default ActiveRecordEntity;