@avonjs/avonjs
Version:
A fluent Node.js API generator.
45 lines (44 loc) • 1.27 kB
TypeScript
import type { AnyRecord, Model, PrimaryKey, UnknownRecord } from '../Contracts';
declare const Fluent_base: (abstract new (...args: import("../Contracts").Args) => {
attributes: Record<string, unknown>;
hidden: string[];
visible: string[];
setAttributeValue<T = never>(key: string, value: T): any;
getAttributeValue<T = undefined>(key: string): T;
makeVisible(attribute: string): any;
makeHidden(attribute: string): any;
getAttributes(): AnyRecord;
getAttributesValue(): undefined[];
toSerializable(): AnyRecord;
}) & {
new (): {};
};
export default class Fluent extends Fluent_base implements Model {
attributes: UnknownRecord;
constructor(attributes?: UnknownRecord);
/**
* Set the attributes.
*/
setAttributes(attributes: UnknownRecord): this;
/**
* Set value for the given key.
*/
setAttribute(key: string, value: unknown): this;
/**
* Get value for the given key.
*/
getAttribute<T = undefined>(key: string): T;
/**
* Get the model key.
*/
getKey(): PrimaryKey;
/**
* Get primary key name of the model.
*/
getKeyName(): string;
/**
* Convert attributes to JSON string.
*/
toJson(): string;
}
export {};