INNER CODE UNIT · TypeScript
fragmentCost
Escape-Technologies/graphql-armor · packages/plugins/cost-limit/src/index.ts:182
fragmentCost = this.computeComplexity(fragment, depth + 1);
cost += this.config.depthCostFactor * fragmentCost;
}
if (this.visitedFragments.get(node.name.value) === -1) {
this.visitedFragments.set(node.name.value, fragmentCost);
}
}
}
return cost;
}
}
/**
* Limit the complexity of a GraphQL document.
*
* Use with `@graphql/graphql-js`.
*/
export const costLimitRule = (options?: CostLimitOptions) => (context: ValidationContext) =>