rosettajs_dist_lib_rosetta_rosetta.js
"use strict";
/***************************************************
* Licensed Materials - Property of HCL.
* (c)Copyright HCL America, Inc. 2023-2024
****************************************************/
Object.defineProperty(exports, "__esModule", { value: true });
exports.debug = debug;
exports.context = context;
exports.restfulAPI = restfulAPI;
const tslib_1 = require("tslib");
/**
* @file Rosetta
* @module rosetta
* @description This file contains custom functions specific to the Rosetta language
* @category Rosetta
*/
const info = tslib_1.__importStar(require("./information"));
const doc = tslib_1.__importStar(require("./document"));
const network = tslib_1.__importStar(require("./network"));
/**
* Uses the console object's methods to display Debug messages, prepending them with a timestamp.
* Defaults to console.log() if * no type of logger is supplied.
* Note: this API is not derived from an existing Lotus Notes Formula function
* @param {string} msg message
* @param {string} type logger to employ: 'Error', 'Warning', 'Info', 'Debug', 'Log' from the console object, or javascript alert if type is Alert
* @returns {Object} Object representing the debug message
* @returns {undefined} undefined if no logger is available
*/
function debug(msg, type) {
return info.debug(msg, type);
}
/**
* Gets the current API context (if ctx param is null or not supplied) or
* Sets the API context to either database for local DOM, for those APIs
* that require working with differents contexts such as GetField/SetField
* Note: this API is not derived from an existing Lotus Notes Formula function.
* Instead, it is needed to set the acting context for the GetField and SetField functions.
* @param {string} [ctx] the context to set: 'db', 'local', or 'all' (default for any other string supplied)
* @returns {string} the context
*/
function context(ctx) {
return doc.context(ctx);
}
/**
* Function to call a restful API.
* @param {string} url - The URL of the REST service.
* @param {string} method - The HTTP method (GET, POST, PUT, DELETE, etc.).
* @param {string} headers - Optional headers to include in the request as a JSON string.
* @param {string} body - Optional body for POST, PUT, or PATCH requests as a JSON string.
* @param {string} additionalRequestParams - Optional additional request parameters as a JSON string.
* @returns {Promise<any>} - A promise that resolves to the response data or rejects with an error.
*/
function restfulAPI(url, method, headers, body = null, additionalRequestParams = null) {
return network.restfulAPI(url, method, headers, body, additionalRequestParams);
}
//# sourceMappingURL=rosetta.js.map