information.js

"use strict";
/***************************************************
* Licensed Materials - Property of HCL.
* (c)Copyright HCL America, Inc. 2023-2024
****************************************************/
Object.defineProperty(exports, "__esModule", { value: true });
exports.notesError = exports.templateVersion = exports.serverAccess = exports.isVirtualizedDirectory = exports.isUsingJavaElement = exports.isModalHelp = exports.isInCompositeApp = exports.isEmbeddedInsideWCT = exports.isAppInstalled = exports.getAddressBooks = exports.fontList = exports.configFile = exports.thisValue = exports.thisName = exports.soundex = exports.regQueryValue = exports.ldapServer = exports.languagePreference = exports.clientType = exports.browserInfo = exports.sheets = exports.sheet = exports.isRef = exports.isFormula = exports.info = exports.cell = exports.type = exports.na = exports.n = exports.isText = exports.isOdd = exports.isNumber = exports.isNonText = exports.isNA = exports.isLogical = exports.isEven = exports.isError = exports.isErr = exports.isBlank = exports.errorType = exports.error = exports._notes_vmx = exports._notes = exports._openFormula = void 0;
const tslib_1 = require("tslib");
/**
 * @file Information
 * @module information
 * @category Information
 */
const notesf_base = tslib_1.__importStar(require("../notes/information"));
const notesf_vmx = tslib_1.__importStar(require("../notes/voltmx/information"));
const API = tslib_1.__importStar(require("../rosetta/API"));
const notes_text = tslib_1.__importStar(require("../notes/text"));
const openf = tslib_1.__importStar(require("../openformula/information"));
exports._openFormula = openf;
const notesf = () => API.isCurrentFrameworkVoltMX() ? notesf_vmx : notesf_base;
exports._notes = notesf_base;
exports._notes_vmx = notesf_vmx;
//-----------------------------
// Open Formula information
// TODO: This does not match openformula implementation
function error() {
    return openf.ERROR();
}
exports.error = error;
error.type = (error_val) => {
    return openf.ERROR.TYPE(error_val);
};
exports.errorType = error.type;
/**
 * Returns TRUE if the value is blank.
 *
 * @param {*} value The value that you want tested. The value argument can be a blank (empty value), error, logical value, text, number, or reference value, or a name referring to any of these.
 * @returns {boolean} if the value is null.
 * @example rosettajs.Information.isBlank(null) // returns true
 * @example rosettajs.Information.isBlank("") // returns false
 */
function isBlank(value) {
    return openf.ISBLANK(value);
}
exports.isBlank = isBlank;
/**
 * Returns TRUE if the value is any error value except #N/A.
 *
 * @param {*} value The value that you want tested. The value argument can be a blank (empty value), error, logical value, text, number, or reference value, or a name referring to any of these.
 * @returns {boolean} True if the value is an error other than #N/A
 * @example rosettajs.Information.isErr(1/0); // Returns true
 * @example rosettajs.Information.isErr(1); // Returns false
 */
function isErr(value) {
    return openf.ISERR(value);
}
exports.isErr = isErr;
/**
 * Returns TRUE if the value is any error value.
 *
 * @param {*} value The value that you want tested. The value argument can be a blank (empty value), error, logical value, text, number, or reference value, or a name referring to any of these.
 * @returns {boolean}
 * @example rosettajs.Information.isError(1/0); // Returns true
 * @example rosettajs.Information.isError(1); // Returns false
 */
function isError(value) {
    return API.isCurrentAPIOpenFormula() ? exports._openFormula.ISERROR(value) : exports._notes.IsError(value);
}
exports.isError = isError;
/**
 * Returns TRUE if the number is even.
 *
 * @param {number} number The value to test. If number is not an integer, it is truncated.
 * @returns {number} true if a number is even and false if it is not
 * @example rosettajs.Information.isEven(-3); // returns false
 * @example rosettajs.Information.isEven(2); // returns true
 */
function isEven(number) {
    return openf.ISEVEN(number);
}
exports.isEven = isEven;
/**
 * Returns TRUE if the value is a logical value.
 *
 * @param {*} value The value that you want tested. The value argument can be a blank (empty value), error, logical value, text, number, or reference value, or a name referring to any of these.
 * @returns {boolean} true if the value is true, and false if the value is false or 0.
 * @example rosettajs.Information.isLogical(true); // returns true
 * @example rosettajs.Information.isLogical(0); // returns false
 */
function isLogical(value) {
    return openf.ISLOGICAL(value);
}
exports.isLogical = isLogical;
/**
 * Returns TRUE if the value is the #N/A error value.
 *
 * @param {*} value The value that you want tested. The value argument can be a blank (empty value), error, logical value, text, number, or reference value, or a name referring to any of these.
 * @returns {boolean} returns true if the value being evaluated is equal to error.na, false if not;
 * @example rosettajs.Information.isNA(error.na); // returns true.
 * @example rosettajs.Information.isNA(1); // returns false.
 */
function isNA(value) {
    return openf.ISNA(value);
}
exports.isNA = isNA;
/**
 * Returns TRUE if the value is not text.
 *
 * @param {*} value The value that you want tested. The value argument can be a blank (empty value), error, logical value, text, number, or reference value, or a name referring to any of these.
 * @returns {boolean} true if value is not a string, false if it is.
 * @example rosettajs.Information.isNonText(1); // returns true.
 * @example rosettajs.Information.isNonText('string'); // returns false.
 */
function isNonText(value) {
    return openf.ISNONTEXT(value);
}
exports.isNonText = isNonText;
/**
 * Returns TRUE if the value is a number.
 *
 * @param {*} value The value that you want tested. The value argument can be a blank (empty value), error, logical value, text, number, or reference value, or a name referring to any of these.
 * When using the Notes formula implementation the value can be a list.
 * @returns {boolean} true if value is a number, false if not.
 * or the Open Formula implementation see  {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#ISNUMBER|www.oasis-open.org}
 * @example
 * rosettajs.Information.isNumber(1); // Returns true
 * @example
 * rosettajs.Information.isNumber("1"); // Returns false
 * @example
 * rosettajs.API.setDefaultAPIAsNotes();
 * rosettajs.Text.isNumber([-345, 2.78. 997, .7]); // Returns true
 */
function isNumber(value) {
    return API.isCurrentAPIOpenFormula() ? openf.ISNUMBER(value) : notes_text.IsNumber(value);
}
exports.isNumber = isNumber;
/**
 * Returns TRUE if the number is odd.
 *
 * @param {number} value The value that you want tested. The value argument can be a blank (empty value), error, logical value, text, number, or reference value, or a name referring to any of these.
 * @returns {boolean} true if the value is an odd number, false if not.
 * @example rosettajs.Information.isOdd(1); // returns true.
 * @example rosettajs.Information.isOdd('string'); // returns false.
 * @example rosettajs.Information.isOdd(2.5); // returns false.
 */
function isOdd(value) {
    return openf.ISODD(value);
}
exports.isOdd = isOdd;
/**
 * Returns TRUE if the value is text.
 *
 * @param {*} value The value that you want tested. The value argument can be a blank (empty value), error, logical value, text, number, or reference value, or a name referring to any of these.
 * When using the Notes formula implementation the value can be a list.
 * @returns {boolean} returns true if value has type string, false if not.
 * or the Open Formula implementation see  {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#ISTEXT|www.oasis-open.org}
 * @example
 * rosettajs.Information.isText(1); // Returns false
 * @example
 * rosettajs.Information.isText("1"); // Returns true
 * @example
 * rosettajs.API.setDefaultAPIAsNotes();
 * rosettajs.Text.isText('xyz', 'abc', 7.7); // returns false
 */
function isText(value) {
    return API.isCurrentAPIOpenFormula() ? openf.ISTEXT(value) : notes_text.IsText(value);
}
exports.isText = isText;
/**
 * Returns a value converted to a number.
 *
 * @param {*} value The value you want converted. N converts values listed in the following table.
 * @returns {number | Error} value if it is a number, value.getTime if it is an instance of Date, 1 if true, 0 if false, otherwise it returns an error.
 * @example rosettajs.Information.n(rosettajs.Logical.true()); // Returns 1
 */
function n(value) {
    return openf.N(value);
}
exports.n = n;
/**
 * Returns the error value #N/A.
 *
 * @returns {error} error.na
 * @example rosettajs.Information.isNA(rosettajs.Information.na()); // Returns true
 */
function na() {
    return openf.NA();
}
exports.na = na;
/**
 * Returns a number indicating the data type of a value.
 *
 * @param {*} value Can be any Microsoft Excel value, such as a number, text, logical value, and so on.
 * @returns {number | undefined} 1 if value is a number, 2 if value is text, 4 if value isLogical, 16 if value is an array, 64 if value is an error/
 */
function type(value) {
    return openf.TYPE(value);
}
exports.type = type;
/**
 * Returns information about the formatting, location, or contents of a value.
 * Category: Information
 * @throws No plans to implement
 */
function cell() {
    return openf.CELL();
}
exports.cell = cell;
/**
 * Returns information about the current operating environment.
 * Category: Information
 * @throws No plans to implement
 */
function info() {
    return openf.INFO();
}
exports.info = info;
/**
 * Returns TRUE if there is a reference to a value that contains a formula.
 * Category: Information
 * @param {*} reference Reference is a reference to the value you want to test. Reference can be a value reference, a formula, or a name that refers to a value.
 * @throws No plans to implement
 */
function isFormula() {
    return openf.ISFORMULA();
}
exports.isFormula = isFormula;
/**
 * Returns TRUE if the value is a reference.
 * Category: Information
 * @param {*} value The value that you want tested. The value argument can be a blank (empty value), error, logical value, text, number, or reference value, or a name referring to any of these.
 * @throws No plans to implement
 */
function isRef() {
    return openf.ISREF();
}
exports.isRef = isRef;
/**
 * Returns the sheet number of the referenced sheet.
 * Category: Information
 * @param {*} value Optional. Value is the name of a sheet or a reference for which you want the sheet number. If value is omitted, SHEET returns the number of the sheet that contains the function.
 * @throws No plans to implement
 */
function sheet() {
    return openf.SHEET();
}
exports.sheet = sheet;
/**
 * Returns the number of sheets in a reference.
 * Category: Information
 * @param {*} reference Optional. Reference is a reference for which you want to know the number of sheets it contains. If Reference is omitted, SHEETS returns the number of sheets in the workbook that contains the function.
 * @throws No plans to implement
 */
function sheets() {
    return openf.SHEETS();
}
exports.sheets = sheets;
//-----------------------------
// Notes @functions information
/**
 * Determines the capabilities of a Web client, that is you can determine the
 * properties of the browser for the current request.
 * @throws {Error} method not implemented
 * @TODO this needs to be implemented
 */
function browserInfo() {
    return notesf().BrowserInfo();
}
exports.browserInfo = browserInfo;
/**
 * Returns a text string to differentiate Notes® clients and World Wide Web browsers.
 * @throws {Error} method not implemented
 * @TODO this needs to be implemented
 */
function clientType() {
    return notesf().ClientType();
}
exports.clientType = clientType;
/**
 * Returns 1 (True) if the value is an @ERROR value, returns 0 (False) if not
 * an error.
 * @throws {Error} method not implemented
 * @TODO this needs to be implemented
 */
//export function isError ():boolean {   //dup
//  return notesf().IsError();
//};
/**
 * Returns user's specified preferred language setting.
 *
 * @param {Text} keyword Specify a category for which you would like to get the preferred language. The following categories are available:
 *     [REGION]
 *     [CONTENT]
 *     [ALTERNATENAME]
 * @returns {TextOrTextList} Text or Text list that represents the language and country code for user's preferred setting.
 *     [REGION] language is set as the default.
 *     If @LanguagePreference cannot find the language setting for the specified category, it returns the language for [REGION].
 * @see For further information, see  {@link https://help.hcltechsw.com/dom_designer/12.0.2/basic/H_LANGUAGEPREFERENCE_FORMULA.html|www.hcltechsw.com}
 * @example @LanguagePreference([REGION]); // returns 'fr-CA'
 * @example @LanguagePreference([ALTERNATENAME]); // returns 'fr'
 */
function languagePreference(keyword) {
    return notesf().LanguagePreference(keyword);
}
exports.languagePreference = languagePreference;
/**
 * Returns the URL and port number of the LDAP listener in the current domain.
 * Notes® looks for this information in several places, following this search
 * sequence:
 * 1. Searches on the current server.
 * 2. Searches for the notes.ini variable labeled LDAPSERVER=.
 * 3. Queries the administration server, which runs the LDAP service automatically, by default.
 * @throws {Error} method not implemented
 * @TODO this needs to be implemented
 */
function ldapServer() {
    return notesf().LDAPServer();
}
exports.ldapServer = ldapServer;
/**
 * Copies the administration execution control list from a specified Address Book
 * and name to your personal workstation ECL.
 * @throws {Error} no plans to implement
 */
function regQueryValue() {
    return notesf().RegQueryValue();
}
exports.regQueryValue = regQueryValue;
/**
 * Returns the Soundex (the Notes® phonetic speller) code for the specified string.
 * @throws {Error} method not implemented
 * @TODO this needs to be implemented
 */
function soundex() {
    return notesf().Soundex();
}
exports.soundex = soundex;
/**
 * Returns the name of the current field. Only works within the context of a text/field widget.
 * @param {*} eventobject Optional. If the eventobject is not specified, the eventobject set by setActionEventObject is used.
 * @returns {string} The name of the current field.
 */
function thisName(eventobject) {
    return notesf().ThisName(eventobject);
}
exports.thisName = thisName;
/**
 * Returns the value of the current field. Only works within the context of a text/field widget.
 * @param {*} eventobject Optional. If the eventobject is not specified, the eventobject set by setActionEventObject is used.
 * @returns {string} The value of the current field.
 */
function thisValue(eventobject) {
    return notesf().ThisValue(eventobject);
}
exports.thisValue = thisValue;
/**
 * Returns the file path for the initialization file for Notes® (notes.ini).
 * @throws {Error} no plans to implement
 */
function configFile() {
    return notesf().ConfigFile();
}
exports.configFile = configFile;
/**
 * Provides a list of available fonts on the Notes® client where this @function
 * is executed.
 * @throws {Error} no plans to implement
 */
function fontList() {
    return notesf().FontList();
}
exports.fontList = fontList;
/**
 * Returns a list of the address books associated with a client (if the current
 * database is local) or server.
 * @throws {Error} no plans to implement
 */
function getAddressBooks() {
    return notesf().GetAddressBooks();
}
exports.getAddressBooks = getAddressBooks;
/**
 * Indicates whether the specified type of application is installed.
 * @throws {Error} no plans to implement
 */
function isAppInstalled() {
    return notesf().IsAppInstalled();
}
exports.isAppInstalled = isAppInstalled;
/**
 * Indicates whether any part of the current Notes® session is embedded inside of
 * Workplace client.
 * @throws {Error} no plans to implement
 */
function isEmbeddedInsideWCT() {
    return notesf().IsEmbeddedInsideWCT();
}
exports.isEmbeddedInsideWCT = isEmbeddedInsideWCT;
/**
 * Indicates whether the component is running within a composite application.
 * @throws {Error} no plans to implement
 */
function isInCompositeApp() {
    return notesf().IsInCompositeApp();
}
exports.isInCompositeApp = isInCompositeApp;
/**
 * Indicates whether the current document is a modal Help document.
 * @throws {Error} no plans to implement
 */
function isModalHelp() {
    return notesf().IsModalHelp();
}
exports.isModalHelp = isModalHelp;
/**
 * Indicates whether a view or outline uses the Java™ user interface.
 * @throws {Error} no plans to implement
 */
function isUsingJavaElement() {
    return notesf().IsUsingJavaElement();
}
exports.isUsingJavaElement = isUsingJavaElement;
/**
 * Indicates whether virtualized directories are enabled for the current server.
 * @throws {Error} no plans to implement
 */
function isVirtualizedDirectory() {
    return notesf().IsVirtualizedDirectory();
}
exports.isVirtualizedDirectory = isVirtualizedDirectory;
/**
 * Checks if a specified user has a specified administrative access level to a
 * server.
 * @throws {Error} no plans to implement
 */
function serverAccess() {
    return notesf().ServerAccess();
}
exports.serverAccess = serverAccess;
/**
 * Returns the version number of the master template upon which the
 *     database design is based.

 * @throws {Error} no plans to implement
 */
function templateVersion() {
    return notesf().TemplateVersion();
}
exports.templateVersion = templateVersion;
/**
 * Allows you to generate an error condition within an expression. This is useful
 * if you want to evaluate the current values in several fields and need to know if
 * an error has occurred in the entry of any of them.
 * @throws {Error} Notes Error
 */
function notesError() {
    return notesf().NotesError();
}
exports.notesError = notesError;
//# sourceMappingURL=information.js.map