UNPKG

@nestjs/graphql

Version:

Nest - modern, fast, powerful node.js web framework (@graphql)

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); } }