octonom
Version:
Object Document Mapper for any database
40 lines • 1.84 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const any_1 = require("./any");
const array_1 = require("./array");
const boolean_1 = require("./boolean");
const date_1 = require("./date");
const model_1 = require("./model");
const number_1 = require("./number");
const object_1 = require("./object");
const reference_1 = require("./reference");
const string_1 = require("./string");
function getSchemaDecorator(createSchema) {
return (target, key) => target.constructor.setSchema(key, createSchema());
}
exports.getSchemaDecorator = getSchemaDecorator;
/* tslint:disable:variable-name */
exports.Property = {
Any: (options = {}) => getSchemaDecorator(() => new any_1.AnySchema(options)),
Array: (options) => getSchemaDecorator(() => new array_1.ArraySchema(options)),
Boolean: (options = {}) => getSchemaDecorator(() => new boolean_1.BooleanSchema(options)),
Date: (options = {}) => getSchemaDecorator(() => new date_1.DateSchema(options)),
Model: (options) => getSchemaDecorator(() => new model_1.ModelSchema(options)),
Number: (options = {}) => getSchemaDecorator(() => new number_1.NumberSchema(options)),
Object: (options) => getSchemaDecorator(() => new object_1.ObjectSchema(options)),
Reference: (options) => getSchemaDecorator(() => new reference_1.ReferenceSchema(options)),
String: (options = {}) => getSchemaDecorator(() => new string_1.StringSchema(options)),
};
exports.Schema = {
Any: any_1.AnySchema,
Array: array_1.ArraySchema,
Boolean: boolean_1.BooleanSchema,
Date: date_1.DateSchema,
Model: model_1.ModelSchema,
Number: number_1.NumberSchema,
Object: object_1.ObjectSchema,
Reference: reference_1.ReferenceSchema,
String: string_1.StringSchema,
};
/* tslint:enable:variable-name */
//# sourceMappingURL=index.js.map