"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: Object.getOwnPropertyDescriptor(all, name).get
    });
}
_export(exports, {
    get getOperationFunc () {
        return getOperationFunc;
    },
    get getOperationName () {
        return getOperationName;
    },
    get operations () {
        return operations;
    },
    get registerOperation () {
        return registerOperation;
    }
});
const _errors = require("../../helpers/errors");
const operations = {};
function getOperationFunc(id) {
    if (!operations[id]) {
        (0, _errors.throwWithCause)(`Operation with id "${id}" does not exist.`);
    }
    const func = operations[id].func;
    return function(conditions, value) {
        return func(conditions, value);
    };
}
function getOperationName(id) {
    return operations[id].name;
}
function registerOperation(id, name, func) {
    operations[id] = {
        name,
        func
    };
}
