export const processErrors: any; /** * How to handle Schema validation errors in models. */ export type MODEL_ERROR_LEVEL = Enum; /** * How to handle Schema validation errors in models. * * @typedef MODEL_ERROR_LEVEL * @type {Enum} * * @property {} UNSET - Errors are ignored. * @property {} WARN - Console.warn * @property {} ERROR - Console.error * @property {} THROW - Throw an exception */ export const MODEL_ERROR_LEVEL: Enum; /** * Once the Model is instantiated the schema can't be changed. * * The Model class uses the [on-change](https://github.com/sindresorhus/on-change) library (uses the [`Proxy` API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy)) to detect changes and enforce the schema. * * @example * ``` javascript * import { Model } from 'hord'; * * const Person = new Model({ * first: String, * last: String, * age: 'integer', * hobbies: { * type: Array, * content: String * } * }); * * const johnDoe = Person.apply({ * first: 'John', * last: 'Doe', * age: 21 * }); * * johnDoe.hobbies = ['programming', 10]; * * console.log(johnDoe); * // => { first: 'John', last: 'Doe', age: 21, hobbies: ['programming'] } * ``` * * @class Model * @classdesc Data models with automatic schema enforcement. * * @param {Schema} schema */ declare class Model { constructor(schema: any); /** * Apply this model to an object. * * @memberOf Model * @instance * * @param {object} object - The object to apply this model to. * * @returns {object} */ apply(object: object): object; /** * Returns a new Model with a new [extended](docs/Schema.md#Schema+extend) Schema. Retains the errorLevel from the calling Model. * * @memberOf Model * @instance * * @param {Model|Schema|Schema.SchemaDefinition} model - The model to superimpose on this one. * * @returns {Model} */ extend(model: Model | Schema | Schema.SchemaDefinition): Model; /** * Get the schema for this model. * * @memberOf Model * @instance * @readonly * * @returns {Schema} */ readonly get schema(): Schema; } declare namespace Model { let defaultErrorLevel: (newValue: any, isForcedSave: any, ...args: any[]) => any; } export default Model; import { Enum } from 'type-enforcer'; import Schema from './Schema/Schema.js'; //# sourceMappingURL=Model.d.ts.map