UNPKG

@cloud-copilot/iam-simulate

Version:
35 lines 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StringLike = void 0; const util_js_1 = require("../../util.js"); const conditionUtil_js_1 = require("../conditionUtil.js"); exports.StringLike = { name: 'StringLike', 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: false }; //# sourceMappingURL=StringLike.js.map