UNPKG

@redocly/graphql-docs

Version:

Redocly GraphQL docs

2 lines (1 loc) 601 B
import{TypeGroup as i}from"../../../schema/index.js";import{DEFAULT_MENU_GROUP_ID as u}from"../../models/index.js";import{getItemDoesNotMatchAnyGroupErrorMessage as m}from"./errors.js";import{insertIntoGroup as n}from"./insert-into-group.js";import{directiveMatchesGroup as s}from"./item-matches-group.js";function g(e,t,r){t.getDirectives().forEach(o=>{c(o,r).forEach(p=>{n(e,o.name,p,i.directives,r)})})}function c(e,t){const r=t.groups.filter(o=>s(e,o)).map(o=>o.name);if(t.requireExactGroups&&!r.length)throw new Error(m(`Directive ${e.name}`));return r.length?r:[u]}export{g as groupDirectives};