@soleil-se/app-util
Version:
Utility functions for WebApps, RESTApps and Widgets in Sitevision.
85 lines (84 loc) • 4.25 kB
TypeScript
export default appData;
declare namespace appData {
/**
* Get a value from app data, same as get in \@sitevision/api/server/appData.
* @param {string} key - The key of app data to retrieve.
* @param {...string} [properties] - The keys of the properties to retrieve from a JCR Node.
* @returns {unknown} The value of the app data or a properties of a JCR Node.
*/
function get(key: string, ...properties?: string[]): unknown;
/**
* Get a value from app data as an array, same as getArray in \@sitevision/api/server/appData.
* @param {string} key - The key of app data to retrieve.
* @returns {import('@sitevision/api/types/javax/jcr/Node').Node[] | string[]} An array of JCR
* Nodes for list components or value wrapped in an array for single type components.
*/
function getArray(key: string): string[] | import("@sitevision/api/types/javax/jcr/Node").Node[];
/**
* Get a string value from app data.
* @param {string} key - The key of app data to retrieve.
* @returns {string | undefined} The string value or undefined if not set.
*/
function getString(key: string): string | undefined;
/**
* Get a boolean value from app data.
* @param {string} key - The key of app data to retrieve.
* @returns {boolean | undefined} The boolean value or undefined if not set.
*/
function getBoolean(key: string): boolean | undefined;
/**
* Get a number value from app data.
* @param {string} key - The key of app data to retrieve.
* @returns {number | undefined} The number value, undefined if not set or not a number.
*/
function getNumber(key: string): number | undefined;
/**
* Get an array of nodes from app data.
* @param {string} key - The key of app data to retrieve.
* @returns {import('@sitevision/api/types/javax/jcr/Node').Node[]} The array of nodes or an
* empty array if not set.
*/
function getNodes(key: string): import("@sitevision/api/types/javax/jcr/Node").Node[];
/**
* Get an array of strings from app data.
* @param {string} key - The key of app data to retrieve.
* @returns {string[]} The array of strings or an empty array if not set.
*/
function getStrings(key: string): string[];
/**
* Get a JCR Node from app data.
* @param {string} key - The key of the property to retrieve.
* @returns {import('@sitevision/api/types/javax/jcr/Node').Node | undefined} The JCR Node or
* undefined if not set.
*/
function getNode(key: string): import("@sitevision/api/types/javax/jcr/Node").Node;
/**
* Get a string property from a JCR Node referenced in app data.
* @param {string} key - The key of the app data value.
* @param {string} property - The property to retrieve from the node.
* @returns {string | undefined} The string property value or undefined if not set.
*/
function getStringProperty(key: string, property: string): string | undefined;
/**
* Get a string array property or a single string wrapped in an array from a JCR Node referenced
* in app data.
* @param {string} key - The key of app data to retrieve.
* @param {string} property - The property to retrieve from the node.
* @returns {string[]} The array of strings or an empty array if not set.
*/
function getStringsProperty(key: string, property: string): string[];
/**
* Get a boolean property from a JCR Node referenced in app data.
* @param {string} key - The key of the app data value.
* @param {string} property - The property to retrieve from the node.
* @returns {boolean | undefined} The boolean property value or undefined if not set.
*/
function getBooleanProperty(key: string, property: string): boolean | undefined;
/**
* Get a number property from a JCR Node referenced in app data.
* @param {string} key - The key of the app data value.
* @param {string} property - The property to retrieve from the node.
* @returns {number | undefined} The number property value, undefined if not set or not a number.
*/
function getNumberProperty(key: string, property: string): number | undefined;
}