UNPKG

@cloud-copilot/iam-simulate

Version:
35 lines 1.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StringNotLike = void 0; const util_js_1 = require("../../util.js"); const conditionUtil_js_1 = require("../conditionUtil.js"); exports.StringNotLike = { name: 'StringNotLike', matches: (request, keyValue, policyValues) => { const explains = policyValues.map((value) => { const { pattern, errors } = (0, util_js_1.convertIamString)(value, request, { replaceWildcards: true }); if (errors && errors.length > 0) { return { value, matches: false, errors }; } const matches = !pattern.test(keyValue); return { value, matches, resolvedValue: (0, conditionUtil_js_1.resolvedValue)(value, request) }; }); const overallMatch = !explains.some((explain) => !explain.matches); return { matches: overallMatch, explains }; }, allowsVariables: true, allowsWildcards: true, isNegative: true }; //# sourceMappingURL=StringNotLike.js.map