UNPKG

@grapi/server

Version:

Grapi Schema Generator For GraphQL Server

32 lines (31 loc) 999 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const lodash_1 = require("../lodash"); const field_1 = __importDefault(require("./field")); const type_1 = require("./type"); class ObjectField extends field_1.default { objectType; constructor({ nonNull, list, nonNullItem, readOnly, objectType, }) { super({ type: type_1.DataModelType.OBJECT, nonNull, list, nonNullItem, readOnly, }); this.objectType = objectType; } getFields() { return this.resolveObjectType().getFields(); } getTypename() { return this.resolveObjectType().getTypename(); } resolveObjectType() { return (0, lodash_1.isFunction)(this.objectType) ? this.objectType() : this.objectType; } } exports.default = ObjectField;