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.

33 lines (32 loc) • 937 B
import { __decorate } from "tslib"; import { Injectable } from '@nestjs/common'; import { isFunction } from '@nestjs/common/utils/shared.utils.js'; const BANNED_TYPES = [String, Date, Number, Boolean]; let OrphanedReferenceRegistry = class OrphanedReferenceRegistry { constructor() { this.registry = new Set(); } addToRegistryIfOrphaned(typeRef) { if (!isFunction(typeRef)) { return; } if (BANNED_TYPES.includes(typeRef)) { return; } this.registry.add(typeRef); } getAll() { return [...this.registry.values()]; } /** * Clear all registered references. * Used when generating multiple schemas with different module configurations. */ clear() { this.registry.clear(); } }; OrphanedReferenceRegistry = __decorate([ Injectable() ], OrphanedReferenceRegistry); export { OrphanedReferenceRegistry };