UNPKG

@cloud-copilot/iam-simulate

Version:
32 lines 1.07 kB
import { convertIamString } from '../../util.js'; import { resolvedValue } from '../conditionUtil.js'; export const StringNotEquals = { name: 'StringNotEquals', matches: (request, keyValue, policyValues) => { const explains = policyValues.map((value) => { const { pattern, errors } = convertIamString(value, request, { replaceWildcards: false }); if (errors && errors.length > 0) { return { value, matches: false, errors }; } const matches = !pattern.test(keyValue); return { value, matches, resolvedValue: resolvedValue(value, request) }; }); const overallMatch = !explains.some((explain) => !explain.matches); return { matches: overallMatch, explains }; }, allowsVariables: true, allowsWildcards: false, isNegative: true }; //# sourceMappingURL=StringNotEquals.js.map