UNPKG

@gsb-core/core

Version:

GSB core services and classes for platform-independent web applications

110 lines (109 loc) 4.09 kB
import { ViewMode } from "../models/gsb-entity-def.model"; /** * Utility functions for working with GSB entities */ /** * Standard GSB date field names */ export declare const GSB_DATE_FIELDS: { CREATE_DATE: string; LAST_UPDATE_DATE: string; CREATED_BY_ID: string; LAST_UPDATED_BY_ID: string; }; /** * Gets the correct sorting configuration for GSB entities * @param sortByCreateDate Whether to sort by creation date (true) or last update date (false) * @param ascending Whether to sort in ascending order * @returns The sort columns configuration for GSB queries */ export declare function getGsbDateSortCols(sortByCreateDate?: boolean, ascending?: boolean): { col: { name: string; }; sortType: string; }[]; /** * Compares two objects for equality, ignoring specified properties * @param obj1 First object to compare * @param obj2 Second object to compare * @param ignoredProps Array of property names to ignore during comparison * @returns True if objects are functionally equal (ignoring specified properties) */ export declare function compareObjects(obj1: any, obj2: any, ignoredProps?: string[]): boolean; /** * Utility class for GSB operations */ export declare class GsbUtils { static StringPropertyDefinitionId: string; static NumberPropertyDefinitionId: string; static BooleanPropertyDefinitionId: string; static DatePropertyDefinitionId: string; static ReferencePropertyDefinitionId: string; static EnumPropertyDefinitionId: string; static IDPropertyDefinitionId: string; static RichTextPropertyDefinitionId: string; static EmailPropertyDefinitionId: string; static PasswordPropertyDefinitionId: string; static newId(): string; /** * Checks if an ID is empty (null, undefined, or empty GUID) * @param id The ID to check * @returns true if the ID is empty, false otherwise */ static isIdEmpty(id: string | null | undefined): boolean; /** * Checks if an ID is valid (not empty and not an empty GUID) * @param id The ID to check * @returns true if the ID is valid, false otherwise */ static isValidId(id: string | null | undefined): boolean; /** * Checks if an array of IDs contains any empty IDs * @param ids Array of IDs to check * @returns true if any ID is empty, false otherwise */ static hasEmptyIds(ids: (string | null | undefined)[]): boolean; /** * Filters out empty IDs from an array * @param ids Array of IDs to filter * @returns Array of valid IDs */ static filterEmptyIds(ids: (string | null | undefined)[]): string[]; /** * Gets the view form mode from the given property * @param prop The property to get the view form mode from * @returns The view form mode or undefined if not found */ static getViewFormMode(prop: any): ViewMode | undefined; /** * Gets the create form mode from the given property * @param prop The property to get the create form mode from * @returns The create form mode or undefined if not found */ static getCreateFormMode(prop: any): ViewMode | undefined; /** * Gets the update form mode from the given property * @param prop The property to get the update form mode from * @returns The update form mode or undefined if not found */ static getUpdateFormMode(prop: any): ViewMode | undefined; /** * Converts a string to PascalCase * @param text The string to convert * @returns The string in PascalCase format */ static toPascalCase(text: string): string; /** * Converts a string to camelCase * @param title The string to convert * @returns The string in camelCase format */ static toCamelCase(title: string): string | undefined; /** * Checks if the request object contains an entity definition * @param req The request object to check * @returns true if the request object contains an entity definition, false otherwise */ static hasEntityDef(req: any): boolean; }