MCPcopy Create free account
hub / github.com/axe-api/axe-api / isQueryFeatureEnabled

Function isQueryFeatureEnabled

packages/axe-api/src/Services/LimitService.ts:129–163  ·  view source on GitHub ↗
(
  model: IModelService,
  feature: QueryFeature,
  key: string | null = null,
)

Source from the content-addressed store, hash-verified

127};
128
129export const isQueryFeatureEnabled = (
130 model: IModelService,
131 feature: QueryFeature,
132 key: string | null = null,
133): boolean => {
134 const rules = model.queryLimits.filter(
135 (limit) => limit.feature === feature && limit.key === null,
136 );
137
138 if (key) {
139 const keyRules = model.queryLimits.filter(
140 (limit) => limit.feature === feature && limit.key === key,
141 );
142
143 if (keyRules.length > 0) {
144 const lastKeyRule = keyRules[keyRules.length - 1];
145 if (lastKeyRule?.type === QueryFeatureType.Deny) {
146 return false;
147 }
148
149 return true;
150 }
151 }
152
153 if (rules.length === 0) {
154 return false;
155 }
156
157 const lastRule = rules[rules.length - 1];
158 if (lastRule?.type === QueryFeatureType.Deny) {
159 return false;
160 }
161
162 return true;
163};
164
165export const valideteQueryFeature = (
166 model: IModelService,

Callers 2

toRequestParametersFunction · 0.90
valideteQueryFeatureFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected