UNPKG

graphql-composer

Version:
56 lines 1.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GQLType = void 0; const __1 = require("../../.."); const GQLBasicType_1 = require("./GQLBasicType"); class GQLType extends GQLBasicType_1.GQLBasicType { constructor() { super(...arguments); this._fields = []; } get fields() { return this._fields; } /** * Set the field list * @param fields The fields list */ setFields(...fields) { this._fields = fields; return this; } /** * Add some fields to the fields list * @param fields The fields list */ addFields(...fields) { return this.setFields(...this._fields, ...fields); } /** * Remove some fields from the fields list * @param fields The fields IDs */ removeFields(...fields) { return this.setFields(...__1.ArrayHelper.remove(fields, this._fields)); } /** * Make all the fields nullable */ partial() { this.transformFields((field) => { field.nullable(); }); return this; } /** * Make all the fields not nullable */ required() { this.transformFields((field) => { field.required(); }); return this; } } exports.GQLType = GQLType; //# sourceMappingURL=GQLType.js.map