"use strict";
/***************************************************
* Licensed Materials - Property of HCL.
* (c)Copyright HCL America, Inc. 2023-2024
****************************************************/
Object.defineProperty(exports, "__esModule", { value: true });
exports.switchView = exports.renameDatabase = exports.publishDatabase = exports.databaseReplSettings = exports.databaseDelete = exports.addDatabaseRepID = exports.addDatabase = exports.webDbName = exports.viewTitle = exports.setProfileField = exports.serverName = exports.replicaID = exports.isExpandable = exports.isDB2 = exports.getProfileField = exports.dbTitle = exports.dbName = exports.dbManager = exports.dbExists = exports.dbCommand = exports.dB2Schema = exports.setDocField = exports.getDocField = exports.dbLookup = exports.dbColumn = exports.dVarP = exports.dVar = exports.dSum = exports.dstDevP = exports.dstDev = exports.dProduct = exports.dMin = exports.dMax = exports.dGet = exports.dCountA = exports.dCount = exports.dAverage = exports._openFormula = exports._notes_vmx_utils = exports._notes_vmx = exports._notes = void 0;
const tslib_1 = require("tslib");
/**
* @file Database
* @module database
* @category Database
*/
const openf = tslib_1.__importStar(require("../openformula/database"));
const notesf_base = tslib_1.__importStar(require("../notes/database"));
const notesf_vmx = tslib_1.__importStar(require("../notes/voltmx/database"));
const notesf_vmx_utils = tslib_1.__importStar(require("../notes/voltmx/database.utils"));
const API = tslib_1.__importStar(require("../rosetta/API"));
const notesf = () => API.isCurrentFrameworkVoltMX() ? notesf_vmx : notesf_base;
const notesc = notesf; // notes commands are exposed in the notes functions source file; this notesc is just for visual cue
exports._notes = notesf_base;
exports._notes_vmx = notesf_vmx;
exports._notes_vmx_utils = notesf_vmx_utils;
exports._openFormula = openf;
//-----------------------------
// Open Formula database
/**
* Finds the average of values in a given field from the records (rows) in a
* database that match a search criteria.
* @param {Array} database Range of values that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
* @param {string} field Indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
* @param {Array} criteria Range of values that contains the conditions you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one value below the column label in which you specify a condition for the column.
* @returns {number} Average of the field's values from call to OpenFormula DAVERAGE function
*/
function dAverage(database, field, criteria) {
return openf.DAVERAGE(database, field, criteria);
}
exports.dAverage = dAverage;
/**
* Counts the number of records (rows) in a database that match a search criteria
* and contain numerical values.
* @param {Array} database The database
* @param {string} field The field
* @param {Array} criteria The criteria
* @returns {number} Count of records matching search criteria from call to OpenFormula
* DCOUNT function
*/
function dCount(database, field, criteria) {
return openf.DCOUNT(database, field, criteria);
}
exports.dCount = dCount;
/**
* Counts the number of records (rows) in a database that match a search criteria
* and contain values (as COUNTA).
* @param {Array} database The database
* @param {string} field The field
* @param {Array} criteria The criteria
* @returns {number} Count of records matching search criteria from call to OpenFormula
* DCOUNTA function
*/
function dCountA(database, field, criteria) {
return openf.DCOUNTA(database, field, criteria);
}
exports.dCountA = dCountA;
/**
* Get the single value in the field from the single record (row) in a database
* that matches a search criteria.
* @param {Array} database The database
* @param {string} field The field
* @param {Array} criteria The criteria
* @returns {number} Value in field matching search criteria from call to OpenFormula DGET function
*/
function dGet(database, field, criteria) {
return openf.DGET(database, field, criteria);
}
exports.dGet = dGet;
/**
* Finds the maximum value in a given field from the records (rows) in a database
* that match a search criteria.
* @param {Array} database The database
* @param {string} field The field
* @param {Array} criteria The criteria
* @returns {number} Maximum value of the field's values matching search criteria from call
* to OpenFormula DMAX function
*/
function dMax(database, field, criteria) {
return openf.DMAX(database, field, criteria);
}
exports.dMax = dMax;
/**
* Finds the minimum value in a given field from the records (rows) in a database
* that match a search criteria.
* @param {Array} database The database
* @param {string} field The field
* @param {Array} criteria The criteria
* @returns {number} Minimum value of the field's values matching search criteria from call
* to OpenFormula DMIN function
*/
function dMin(database, field, criteria) {
return openf.DMIN(database, field, criteria);
}
exports.dMin = dMin;
/**
* Finds the product of values in a given field from the records (rows) in a
* database that match a search criteria.
* @param {Array} database The database
* @param {string} field The field
* @param {Array} criteria The criteria
* @returns {number} Product of the field's values matching search criteriain field records
* matching search criteria from call to OpenFormula DPRODUCT function
*/
function dProduct(database, field, criteria) {
return openf.DPRODUCT(database, field, criteria);
}
exports.dProduct = dProduct;
/**
* Finds the sample standard deviation in a given field from the records (rows) in
* a database that match a search criteria.
* @param {Array} database The database
* @param {string} field The field
* @param {Array} criteria The criteria
* @returns {number} Sample standard deviation of the field's values matching search criteria
* from call to OpenFormula DSTDEV function
*/
function dstDev(database, field, criteria) {
return openf.DSTDEV(database, field, criteria);
}
exports.dstDev = dstDev;
/**
* Finds the population standard deviation in a given field from the records (rows)
* in a database that match a search criteria.
* @param {Array} database The database
* @param {string} field The field
* @param {Array} criteria The criteria
* @returns {number} Population standard deviation of the field's values matching search
* criteria from call to OpenFormula DSTDEVP function
*/
function dstDevP(database, field, criteria) {
return openf.DSTDEVP(database, field, criteria);
}
exports.dstDevP = dstDevP;
/**
* Finds the sum of values in a given field from the records (rows) in a database
* that match a search criteria.
* @param {Array} database The database
* @param {string} field The field
* @param {Array} criteria The criteria
* @returns {number} Sum of the field's values matching search criteria from call to
* OpenFormula DSUM function
*/
function dSum(database, field, criteria) {
return openf.DSUM(database, field, criteria);
}
exports.dSum = dSum;
/**
* Finds the sample variance in a given field from the records (rows) in a database
* that match a search criteria.
* @param {Array} catabase The database
* @param {string} field The field
* @param {Array} criteria The criteria
* @returns {number} Sample variance of the field's values matching search criteria from call
* to OpenFormula DVAR function
*/
function dVar(database, field, criteria) {
return openf.DVAR(database, field, criteria);
}
exports.dVar = dVar;
/**
* Finds the population variance in a given field from the records (rows) in a
* database that match a search criteria.
* @param {Array} database The database
* @param {string} field The field
* @param {Array} criteria The criteria
* @returns {number} Population variance of the field's values matching search criteria from
* call to OpenFormula DVARP function
*/
function dVarP(database, field, criteria) {
return openf.DVARP(database, field, criteria);
}
exports.dVarP = dVarP;
//-----------------------------
// Notes @functions database
/**
* Returns a column of values from a view or folder in a Domino® database.
* @param {*} cache
* @param {*} serverDatabase
* @param {string} viewName
* @param {number} column
* @returns Promise
*/
const dbColumn = (cache, serverDatabase, viewName, column = 1) => {
return notesf().DbColumn(cache, serverDatabase, viewName, column);
};
exports.dbColumn = dbColumn;
/**
* Given a key value, looks in the specified view (or folder) and finds all
* documents containing the key value within the view.
* @param {*} cache
* @param {*} serverDatabase
* @param {string} viewName
* @param {string} key
* @param {*} field
* @returns Promise
*/
const dbLookup = (cache, serverDatabase, viewName, key, field, keywords) => {
return notesf().DbLookup(cache, serverDatabase, viewName, key, field, keywords);
};
exports.dbLookup = dbLookup;
/**
* Given the unique ID of a document, returns the contents of a specific field on
* that document. The document must reside in the current database.
* @param {string} documentUNID
* @param {string} fieldName
* @returns {*} fieldValue
*/
function getDocField(documentUNID, fieldName) {
return notesf().GetDocField(documentUNID, fieldName);
}
exports.getDocField = getDocField;
/**
* Given the unique ID of a document, sets the value of a specific field on that
* document. The document must reside in the current database.
* @param {string} documentUNID The unique ID of a document.
* @param {string} fieldName The name of a field in the current document.
* @param {*} fieldValue The value to set the field.
*/
function setDocField(documentUNID, fieldName, fieldValue) {
return notesf().SetDocField(documentUNID, fieldName, fieldValue);
}
exports.setDocField = setDocField;
/**
* Given the name of a database as a text string, returns a text string containing
* the DB2® schema of that database if it is a db2nsf database or the empty string
* if it is not a db2nsf database.
* @param {Array} any arguments
* @throws {Error} No plans to implement
*/
function dB2Schema() {
return notesf().DB2Schema();
}
exports.dB2Schema = dB2Schema;
/**
* Accesses view and folder information from a Domino® database in Web applications.
* @param {Array} any arguments
* @throws {Error} No plans to implement
*/
function dbCommand() {
return notesf().DbCommand();
}
exports.dbCommand = dbCommand;
/**
* Given a server and file name, or replica ID, indicates whether the specified
* database exists.
* @param {Array} any arguments
* @throws {Error} No plans to implement
*/
function dbExists() {
return notesf().DbExists();
}
exports.dbExists = dbExists;
/**
* Returns a list of users, groups, and servers who currently have Manager access
* to the database. In a window title formula, only the name of the first manager
* listed in the ACL is displayed.
*
* @DbManager does not work in selection formulas or column formulas.
* @param {Array} any arguments
* @throws {Error} No plans to implement
*/
function dbManager() {
return notesf().DbManager();
}
exports.dbManager = dbManager;
/**
* Returns the name of the current Domino® server and database.
* @param {Array} any arguments
* @throws {Error} No plans to implement
*/
function dbName() {
return notesf().DbName();
}
exports.dbName = dbName;
/**
* Returns the title of the current database.
* @param {Array} any arguments
* @throws {Error} No plans to implement
*/
function dbTitle() {
return notesf().DbTitle();
}
exports.dbTitle = dbTitle;
/**
* Retrieves a field from a profile document, and caches the field value for the
* remainder of the session.
* @param {Array} any arguments
* @throws {Error} No plans to implement
*/
function getProfileField() {
return notesf().GetProfileField();
}
exports.getProfileField = getProfileField;
/**
* Given a server and filename or server and replica ID, indicates if the specified
* database is backed by DB2® or not.
* @returns {boolean}
* @throws {Error} No plans to implement
*/
function isDB2() {
return notesf().IsDB2();
}
exports.isDB2 = isDB2;
/**
* In column formulas, returns a specified string if a row in a view can be
* expanded.
* @returns {string}
* @throws {Error} No plans to implement
*/
function isExpandable() {
return notesf().IsExpandable();
}
exports.isExpandable = isExpandable;
/**
* Returns the replica ID of the current database.
* @returns {string}
* @throws {Error} No plans to implement
*/
function replicaID() {
return notesf().ReplicaID();
}
exports.replicaID = replicaID;
/**
* Returns the name of the server containing the current database. When the
* database is local, returns the user name.
* @returns {string}
* @throws {Error} No plans to implement
*/
function serverName() {
return notesf().ServerName();
}
exports.serverName = serverName;
/**
* Sets the value of a field in a profile document or creates a profile document.
* @returns {*}
* @throws {Error} No plans to implement
*/
function setProfileField() {
return notesf().SetProfileField();
}
exports.setProfileField = setProfileField;
/**
* Returns the current view's name. If there are aliases and synonyms, they are
* returned in a text list.
* @returns {string|string[]}
* @throws {Error} No plans to implement
*/
function viewTitle() {
return notesf().ViewTitle();
}
exports.viewTitle = viewTitle;
/**
* Returns the name of the current database encoded for URL inclusion.
* @returns {string}
* @throws {Error} No plans to implement
*/
function webDbName() {
return notesf().WebDbName();
}
exports.webDbName = webDbName;
/**
* Adds the specified database icon to the user's workspace, without opening the
* database.
* @throws {Error} no plans to implement
*/
function addDatabase() {
return notesc().AddDatabase();
}
exports.addDatabase = addDatabase;
/**
* Adds an icon to the desktop for the database specified by its replica ID.
* @throws {Error} no plans to implement
*/
function addDatabaseRepID() {
return notesc().AddDatabaseRepID();
}
exports.addDatabaseRepID = addDatabaseRepID;
/**
* Permanently deletes the current database file from the hard disk where it is
* stored.
* @throws {Error} no plans to implement
*/
function databaseDelete() {
return notesc().DatabaseDelete();
}
exports.databaseDelete = databaseDelete;
/**
* Displays the Replication Settings dialog box for the current database.
* @throws {Error} no plans to implement
*/
function databaseReplSettings() {
return notesc().DatabaseReplSettings();
}
exports.databaseReplSettings = databaseReplSettings;
/**
* Displays the Publish Database dialog box, where the user selects a library in
* which to publish the selected database.
* @throws {Error} no plans to implement
*/
function publishDatabase() {
return notesc().PublishDatabase();
}
exports.publishDatabase = publishDatabase;
/**
* For a particular database on the user's workspace, RenameDatabase locates a
* replica of that database (based on its replica ID) on the specified server, and
* replaces the database icon with that of the replica. The only change the user
* sees is that the server name has changed on the database icon.
* @throws {Error} no plans to implement
*/
function renameDatabase() {
return notesc().RenameDatabase();
}
exports.renameDatabase = renameDatabase;
/**
* Switches to the specified view or folder within the current database or, if a
* view or folder is not specified, displays the View menu so the user can select
* a view.
* @throws {Error} no plans to implement
*/
function switchView() {
return notesc().SwitchView();
}
exports.switchView = switchView;
//# sourceMappingURL=database.js.map