drapi_API.js

"use strict";
/***************************************************
* Licensed Materials - Property of HCL.
* (c)Copyright HCL America, Inc. 2023-2024
****************************************************/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getActionEventObject = exports.setActionEventObject = exports.getCurrentServiceName = exports.getCurrentServerDatabase = exports.setCurrentServerDatabase = exports.rosettaDRAPIObject = exports.rosettaDRAPIService = exports.rosettajsLogger = void 0;
/**
 * @file Rosetta API - DRAPI
 * @module rosetta-api-drapi
 */
/**
* rosettajsLogger
* @returns {*} rosettajs logger for voltmx;
*/
function rosettajsLogger() {
    /* @ts-expect-error: rosettajs is assigned at runtime */
    const logger = voltmx.rosettajs.logger = voltmx.rosettajs.logger ? voltmx.rosettajs.logger : new voltmx.logger.createNewLogger("ROSETTAJS", null);
    return logger;
}
exports.rosettajsLogger = rosettajsLogger;
/**
 * Service class for a DRAPI Service
 */
class rosettaDRAPIService {
    constructor() {
        this._defaultView = "";
        this._objectNames = [];
        this._objects = new Map();
        this._metadata = [];
        this._lastError = new Error;
    }
}
exports.rosettaDRAPIService = rosettaDRAPIService;
/**
 * Class for a DRAPI Object - View or Form
 *
 */
class rosettaDRAPIObject {
    constructor(name) {
        this._name = name;
        this._documents = [];
        this._document = {};
        this._allDocsAvailable = false;
    }
}
exports.rosettaDRAPIObject = rosettaDRAPIObject;
/**
* Current active Server:Database
*/
let currentServerDatabase = ""; // Used when no ServerDatabase is specified in api
function setCurrentServerDatabase(serverDatabase) {
    currentServerDatabase = serverDatabase;
}
exports.setCurrentServerDatabase = setCurrentServerDatabase;
function getCurrentServerDatabase() {
    return currentServerDatabase;
}
exports.getCurrentServerDatabase = getCurrentServerDatabase;
function getCurrentServiceName() {
    let currentServiceName = Array.isArray(currentServerDatabase) ? currentServerDatabase : ["", currentServerDatabase];
    return (!currentServiceName[1] ? "" : currentServiceName[1]);
}
exports.getCurrentServiceName = getCurrentServiceName;
/**
* Action Event Object
*/
let actionEventObject = {};
function setActionEventObject(eventobject) {
    actionEventObject = eventobject;
}
exports.setActionEventObject = setActionEventObject;
function getActionEventObject() {
    return actionEventObject;
}
exports.getActionEventObject = getActionEventObject;
//# sourceMappingURL=API.js.map