API_context.js

"use strict";
/***************************************************
* Licensed Materials - Property of HCL.
* (c)Copyright HCL America, Inc. 2023-2024
****************************************************/
Object.defineProperty(exports, "__esModule", { value: true });
exports.isCurrentDb = exports.isCurrentLocal = exports.setDefaultAsDb = exports.setDefaultAsLocal = exports.getDefault = exports._config = void 0;
exports._config = {
    local: "local",
    db: "db",
    default: "db"
};
/**
 * Get default context
 * @returns {string} default context (Local or DB)
 */
function getDefault() {
    return exports._config.default;
}
exports.getDefault = getDefault;
/**
 * Set default context to local
 * @returns {string} The default context
 */
function setDefaultAsLocal() {
    exports._config.default = exports._config.local;
    return getDefault();
}
exports.setDefaultAsLocal = setDefaultAsLocal;
/**
 * Set default context to db
 * @returns {string} The default context
 */
function setDefaultAsDb() {
    exports._config.default = exports._config.db;
    return getDefault();
}
exports.setDefaultAsDb = setDefaultAsDb;
/**
 * Is current context local?
 * @returns {boolean} true if the current context is set to local; false otherwise
 */
function isCurrentLocal() { return getDefault() === exports._config.local; }
exports.isCurrentLocal = isCurrentLocal;
/**
 * Is current context database?
 * @returns {boolean} true if the current context is set to db; false otherwise
 */
function isCurrentDb() { return getDefault() === exports._config.db; }
exports.isCurrentDb = isCurrentDb;
//# sourceMappingURL=API_context.js.map