UNPKG

@nestjs/graphql

Version:

GraphQL for NestJS: code-first and schema-first APIs, resolvers as providers, subscriptions, federation and generated SDL, on Apollo or Mercurius.

21 lines (20 loc) • 725 B
import { MetadataListByNameCollection } from './metadata-list-by-name.collection.js'; export class FieldDirectiveCollection extends MetadataListByNameCollection { constructor() { super(...arguments); this.sdls = new Set(); this.fieldNames = new Set(); this.uniqueCombinations = new Set(); } add(value) { const combinationKey = `${value.sdl}${value.fieldName}`; if (this.uniqueCombinations.has(combinationKey)) { return; } super.add(value, value.fieldName); this.sdls.add(value.sdl); this.fieldNames.add(value.fieldName); this.uniqueCombinations.add(combinationKey); this.globalArray?.push(value); } }