unleash-server
Version:
Unleash is an enterprise ready feature flag service. It provides different strategies for handling feature flags.
11 lines • 737 B
JavaScript
import { BadDataError } from '../../error/index.js';
const MAX_COMPLEXITY = 30000;
export const validateQueryComplexity = (environmentsCount, featuresCount, contextCombinationsCount, limit = MAX_COMPLEXITY) => {
const totalCount = environmentsCount * featuresCount * contextCombinationsCount;
const reason = `Rejecting evaluation as it would generate ${totalCount} combinations exceeding ${limit} limit. `;
const action = `Please reduce the number of selected environments (${environmentsCount}), features (${featuresCount}), context field combinations (${contextCombinationsCount}).`;
if (totalCount > limit) {
throw new BadDataError(reason + action);
}
};
//# sourceMappingURL=validateQueryComplexity.js.map