UNPKG

apollo-client-code-first-request

Version:
39 lines 1.71 kB
"use strict"; var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); }; exports.__esModule = true; exports.Metadata = void 0; require("reflect-metadata"); var constants_1 = require("../constants"); var Metadata = (function () { function Metadata() { } Metadata.getType = function (target, propertyKey) { return Reflect.getMetadata('design:type', target, propertyKey); }; Metadata.addPropertyKey = function (propertyName, target, propertyKey) { var prevPropertyNames = this.getPropertyNames(target, propertyKey); if (!prevPropertyNames.includes(propertyName)) { Reflect.defineMetadata(constants_1.PROPERTY_NAMES_METADATA, __spreadArray(__spreadArray([], prevPropertyNames, true), [propertyName], false), target, propertyKey); } }; Metadata.getPropertyNames = function (target, propertyKey) { return Reflect.getMetadata(constants_1.PROPERTY_NAMES_METADATA, target, propertyKey) || []; }; Metadata.setFieldInfo = function (fieldInfo, target, propertyKey) { Reflect.defineMetadata(constants_1.FIELD_METADATA, fieldInfo, target, propertyKey); }; Metadata.getFieldInfo = function (target, propertyKey) { return Reflect.getMetadata(constants_1.FIELD_METADATA, target, propertyKey); }; return Metadata; }()); exports.Metadata = Metadata; //# sourceMappingURL=metadata.util.js.map