UNPKG

@terabits/grapi

Version:

Grapi Schema Generator For GraphQL Server

85 lines (84 loc) 2.88 kB
"use strict"; exports.__esModule = true; var lodash_1 = require("../lodash"); var type_1 = require("./type"); var Field = (function () { function Field(_a) { var type = _a.type, nonNull = _a.nonNull, list = _a.list, nonNullItem = _a.nonNullItem, unique = _a.unique, readOnly = _a.readOnly, autoGen = _a.autoGen, createdAt = _a.createdAt, updatedAt = _a.updatedAt; this.metadata = {}; this.type = type; this.nonNull = (0, lodash_1.defaultTo)(nonNull, false); this.list = (0, lodash_1.defaultTo)(list, false); this.nonNullItem = (0, lodash_1.defaultTo)(nonNullItem, false); this.unique = (0, lodash_1.defaultTo)(unique, false); this.readOnly = (0, lodash_1.defaultTo)(readOnly, false); this.autoGen = (0, lodash_1.defaultTo)(autoGen, false); this.createdAt = (0, lodash_1.defaultTo)(createdAt, false); this.updatedAt = (0, lodash_1.defaultTo)(updatedAt, false); } Field.prototype.isNonNull = function () { return this.nonNull; }; Field.prototype.setNonNull = function (value) { this.nonNull = value; }; Field.prototype.isNonNullItem = function () { return this.nonNullItem; }; Field.prototype.setNonNullItem = function (value) { this.nonNullItem = value; }; Field.prototype.isList = function () { return this.list; }; Field.prototype.setList = function (value) { this.list = value; }; Field.prototype.setUnique = function (value) { this.unique = value; }; Field.prototype.isUnique = function () { return this.unique; }; Field.prototype.isReadOnly = function () { return this.readOnly; }; Field.prototype.setReadOnly = function (value) { this.readOnly = value; }; Field.prototype.isAutoGenerated = function () { return this.autoGen; }; Field.prototype.setAutoGen = function (value) { this.autoGen = value; }; Field.prototype.getType = function () { return this.type; }; Field.prototype.isScalar = function () { return (0, type_1.isScalarType)(this.type); }; Field.prototype.getTypename = function () { return this.type.toString(); }; Field.prototype.getMetadata = function (key) { return this.metadata[key]; }; Field.prototype.setMetadata = function (key, value) { return this.metadata[key] = value; }; Field.prototype.isCreatedAt = function () { return this.createdAt; }; Field.prototype.setCreatedAt = function (value) { this.createdAt = value; }; Field.prototype.isUpdatedAt = function () { return this.updatedAt; }; Field.prototype.setUpdatedAt = function (value) { this.updatedAt = value; }; return Field; }()); exports["default"] = Field;