UNPKG

@cloud-copilot/iam-policy

Version:
38 lines 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConditionOperationImpl = void 0; const ifExistsSlice = 'IfExists'.length * -1; class ConditionOperationImpl { op; constructor(op) { this.op = op; } setOperator() { if (!this.op.includes(':')) { return undefined; } const setOp = this.op.split(':').at(0)?.toLowerCase(); if (setOp === 'forallvalues') { return 'ForAllValues'; } else if (setOp === 'foranyvalue') { return 'ForAnyValue'; } throw new Error(`Unknown set operator: ${setOp}`); } isIfExists() { return this.op.toLowerCase().endsWith('ifexists'); } baseOperator() { const base = this.op.split(':').at(-1); if (base?.toLowerCase().endsWith('ifexists')) { return base.slice(0, ifExistsSlice); } return base; } value() { return this.op; } } exports.ConditionOperationImpl = ConditionOperationImpl; //# sourceMappingURL=conditionOperation.js.map