/* * MIT License * * Copyright (c) 2018-2020 Ardalan Amini * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import Relational from "./base/Relational"; import Collection from "./Collection"; import Connect from "./Connect"; import DB, { Id } from "./DB"; import EventEmitter, { Event } from "./DB/EventEmitter"; import GraphQL from "./GraphQL"; import Types from "./types"; declare namespace Odin { type Connection = string; interface Schema { [key: string]: any; } interface Document { id?: Id; [key: string]: any; } type DB = typeof DB; type GraphQL = typeof GraphQL; type Types = typeof Types; type Connect = typeof Connect; } declare class Odin = any> extends Relational { protected static get _events(): EventEmitter; static Collection: typeof Collection; static Connect: typeof Connect; static DB: typeof DB; static GraphQL: GraphQL; static Types: { readonly array: import("@foxify/schema/dist/Array").default; readonly boolean: import("@foxify/schema/dist/Boolean").default; readonly date: import("@foxify/schema/dist/Date").default; readonly id: import("./types/Id").default; readonly number: import("@foxify/schema/dist/Number").default; readonly object: import("@foxify/schema/dist/Object").default; readonly string: import("@foxify/schema/dist/String").default; isType: (arg: any) => arg is import("@foxify/schema/dist/Any").default; }; static isOdin: (arg: any) => arg is Odin; static toString(): string; static validate = any>(document: T, updating?: boolean): any; /********************************** Event **********************************/ static on>(event: "create", listener: (item: Odin) => void): typeof Odin; static once>(event: Event, listener: (item: Odin) => void): typeof Odin; static removeAllListeners(event?: Event): typeof Odin; static removeListener>(event: Event, listener: (data: Odin) => void): typeof Odin; constructor(document?: Odin.Document & Partial); /** * Gets the given attribute's value * @param {string} attribute * @returns {*} */ getAttribute(attribute: K): T[K]; getAttribute(attribute: string): unknown; /** * Sets the given attribute's value * @param {string} attribute * @param {*} value */ setAttribute(attribute: K, value: T[K]): void; setAttribute(attribute: string, value: any): void; toJSON(): Record; inspect(): Record; } export = Odin;