import * as i0 from "@angular/core"; export interface IHistoryDetailsLink { type: string; emit: string; } export interface IHistoryDetailsFragment { text: string; bold: boolean; hyphen: boolean; link?: IHistoryDetailsLink | null; } export interface IHistoryDetailsPart { fragments: IHistoryDetailsFragment[]; } export interface IHistoryDetails { line1: IHistoryDetailsPart[]; line2: IHistoryDetailsPart[] | null; } export interface IHistoryDetailsDateFormat { input: string; output: string; } export type THistoryDetailsRawItem = Record; export type THistoryDetailsTransformer = (item: THistoryDetailsRawItem) => IHistoryDetails; export type THistoryDetailsTransformerConfig = Record; export interface IHistoryTransformationConfig { aliasPathPrefixes: string[]; dateFormat: IHistoryDetailsDateFormat; emptyValues: readonly unknown[]; fallbackAliases: string[]; historyItemTypeAliases: string[]; transformers: THistoryDetailsTransformerConfig; } export declare class HistoryTransformationService { /** * Transforms a raw history item into the structured details model. * * @param item - The raw history item. * @param config - The domain-specific transformation configuration. * @returns The transformed history details. */ transformDetails(item: THistoryDetailsRawItem, config: IHistoryTransformationConfig): IHistoryDetails; /** * Transforms raw history items while preserving the rest of each item. * * @param items - The raw history items. * @param config - The domain-specific transformation configuration. * @returns The items with transformed structured details. */ transformItems(items: T[], config: IHistoryTransformationConfig): Array & { details: IHistoryDetails; }>; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } export declare const HISTORY_DETAILS_PATTERNS: { keyNormalise: RegExp; snakeCaseBoundary: RegExp; snakeCaseSeparator: RegExp; transactionTypeSpace: RegExp; }; export interface IHistoryFragmentOptions { bold?: boolean; hyphen?: boolean; link?: IHistoryDetailsLink | null; } export interface IHistoryMappingFragmentPrefixOptions { fragmentEmptyPrefix: string | null; fragmentSpacePrefix: string; hyphenPrefix: string; } export interface IHistoryMappingDetailsTextOptions extends IHistoryMappingFragmentPrefixOptions { detailsLineSeparator: string; fragmentJoiner: string | null; partSeparator: string; } export interface IHistoryMappingItemsEntry { key: string; items: THistoryDetailsRawItem[]; } export interface IHistoryMappingNumberOptions { fieldPathSeparator: string | null; numberSanitisePattern: RegExp | null; } /** * Checks whether a value can be mapped as a raw history item. * * @param value - The value to check. * @returns True when the value is an object record. */ export declare function isHistoryMappingItem(value: unknown): value is THistoryDetailsRawItem; /** * Finds the first supported history item collection and filters it to mappable object items. * * @param source - The source object containing a history item collection. * @param keys - Candidate history item collection keys in priority order. * @returns The matched collection entry, or null when no array is present. */ export declare function getHistoryMappingItemsEntry(source: Record, keys: readonly string[]): IHistoryMappingItemsEntry | null; /** * Maps the first supported history item collection into consumer-owned row objects. * * @param source - The source object containing a history item collection. * @param keys - Candidate history item collection keys in priority order. * @param mapItemToRow - Row mapper owned by the consuming flow. * @returns Mapped rows. */ export declare function getHistoryMappingRows(source: Record, keys: readonly string[], mapItemToRow: (item: THistoryDetailsRawItem, index: number) => TRow): TRow[]; /** * Gets a value from a history item using a field path. * * @param source - The source history item. * @param path - The field path. * @param fieldPathSeparator - The path segment separator. * @returns The matched field value. */ export declare function getHistoryMappingValue(source: THistoryDetailsRawItem, path: string, fieldPathSeparator?: string): unknown; /** * Gets the first present string or number from the supplied history item paths. * * @param item - The source history item. * @param paths - The field paths to inspect. * @param fieldPathSeparator - The path segment separator. * @returns The first present string value. */ export declare function getHistoryMappingString(item: THistoryDetailsRawItem, paths: readonly string[], fieldPathSeparator?: string): string | null; /** * Gets the first finite number from the supplied history item paths. * * @param item - The source history item. * @param paths - The field paths to inspect. * @param options - Number mapping options. * @returns The first finite number value. */ export declare function getHistoryMappingNumber(item: THistoryDetailsRawItem, paths: readonly string[], options?: IHistoryMappingNumberOptions): number | null; /** * Parses supported history date values to sortable UTC timestamps. * * @param value - The raw date value. * @param dateFormat - The configured input date format. * @returns The UTC timestamp in milliseconds, or null when parsing fails. */ export declare function parseHistoryDateTimestamp(value: unknown, dateFormat: IHistoryDetailsDateFormat): number | null; /** * Gets the first parseable date timestamp from the supplied history item paths. * * @param item - The source history item. * @param paths - The field paths to inspect. * @param dateFormat - The configured input date format. * @param fieldPathSeparator - The path segment separator. * @returns The first parseable UTC timestamp in milliseconds. */ export declare function getHistoryMappingDateTimestamp(item: THistoryDetailsRawItem, paths: readonly string[], dateFormat: IHistoryDetailsDateFormat, fieldPathSeparator?: string): number | null; /** * Gets the rendered prefix for a history details fragment. * * @param fragment - The details fragment. * @param index - The fragment index in its part. * @param options - Prefix display options. * @returns The rendered prefix. */ export declare function getHistoryMappingFragmentPrefix(fragment: Pick, index: number, options: IHistoryMappingFragmentPrefixOptions): string; /** * Converts transformed history details into plain text for table sorting. * * @param details - The transformed details model. * @param options - Details text display options. * @returns Details text. */ export declare function getHistoryMappingDetailsText(details: IHistoryDetails, options: IHistoryMappingDetailsTextOptions): string; /** * Converts transformed history details parts into plain text for table sorting. * * @param parts - The transformed details parts. * @param options - Details text display options. * @returns Details parts text. */ export declare function getHistoryMappingPartsText(parts: IHistoryDetailsPart[], options: IHistoryMappingDetailsTextOptions): string; /** * Transforms a raw history item into the configured structured details model. * * @param item - The raw history item. * @param config - The domain-specific transformation configuration. * @returns The transformed details model. */ export declare function transformHistoryDetails(item: THistoryDetailsRawItem, config: IHistoryTransformationConfig): IHistoryDetails; /** * Transforms raw history items while preserving the rest of each item. * * @param items - The raw history items. * @param config - The domain-specific transformation configuration. * @returns The items with transformed structured details. */ export declare function transformHistoryItems(items: T[], config: IHistoryTransformationConfig): Array & { details: IHistoryDetails; }>; /** * Builds fallback details from configured fallback fields when no transformer matches. * * @param item - The raw history item. * @param config - The domain-specific transformation configuration. * @returns The fallback structured details model. */ export declare function transformHistoryFallbackDetails(item: THistoryDetailsRawItem, config: IHistoryTransformationConfig): IHistoryDetails; /** * Creates a details object and normalises an empty secondary line to null. * * @param line1Parts - The primary line parts. * @param line2Parts - The secondary line parts. * @returns The structured details object. */ export declare function createHistoryDetails(line1Parts: Array, line2Parts?: Array): IHistoryDetails; /** * Creates a details part after removing empty fragments. * * @param fragments - The fragments for the part. * @returns The details part or null when no fragments are visible. */ export declare function createHistoryDetailsPart(fragments: IHistoryDetailsFragment[]): IHistoryDetailsPart | null; /** * Creates a text-only details part. * * @param text - The part text. * @returns The details part or null when text is empty. */ export declare function createHistoryTextPart(text: string | null): IHistoryDetailsPart | null; /** * Creates a details part containing a bold label and plain value. * * @param label - The label text. * @param value - The value text. * @returns The labelled details part or null when value is empty. */ export declare function createHistoryLabelValuePart(label: string, value: string | null): IHistoryDetailsPart | null; /** * Creates a text fragment with default styling flags. * * @param text - The fragment text. * @param options - Optional fragment styling and link metadata. * @returns The details fragment. */ export declare function createHistoryFragment(text: string, options?: IHistoryFragmentOptions): IHistoryDetailsFragment; /** * Creates link metadata for a details fragment. * * @param type - The link type emitted by the UI. * @param emit - The emitted linked entity identifier. * @returns The fragment link metadata. */ export declare function createHistoryLink(type: string, emit: string): IHistoryDetailsLink; /** * Reads the first non-empty scalar value from candidate aliases as a string. * * @param item - The raw history item. * @param aliases - The candidate field aliases. * @param aliasPathPrefixes - The prefixes used for unqualified aliases. * @param emptyValues - Values that should be treated as empty. * @returns The string value or null. */ export declare function getHistoryString(item: THistoryDetailsRawItem, aliases: string[], aliasPathPrefixes: string[], emptyValues: readonly unknown[]): string | null; /** * Reads the first non-empty value from candidate aliases. * * @param item - The raw history item. * @param aliases - The candidate field aliases. * @param aliasPathPrefixes - The prefixes used for unqualified aliases. * @param emptyValues - Values that should be treated as empty. * @returns The matched value or null. */ export declare function getHistoryValue(item: THistoryDetailsRawItem, aliases: string[], aliasPathPrefixes: string[], emptyValues: readonly unknown[]): unknown; /** * Expands an alias into candidate dot-notated paths. * * @param alias - The field alias. * @param aliasPathPrefixes - The prefixes used for unqualified aliases. * @returns The candidate paths. */ export declare function getHistoryAliasPaths(alias: string, aliasPathPrefixes: string[]): string[]; /** * Reads a value from an history item using a dot-notated path. * * @param item - The raw history item. * @param path - The dot-notated path. * @returns The matched value or undefined. */ export declare function getHistoryValueByPath(item: THistoryDetailsRawItem, path: string): unknown; /** * Checks whether a value is a non-null record. * * @param value - The value to check. * @returns True when the value is a record. */ export declare function isHistoryRecord(value: unknown): value is Record; /** * Checks whether a value should be treated as empty. * * @param value - The value to check. * @param emptyValues - Values that should be treated as empty. * @returns True when the value is empty. */ export declare function isHistoryEmptyValue(value: unknown, emptyValues: readonly unknown[]): boolean; /** * Checks whether a string value is present. * * @param value - The value to check. * @returns True when the value is a non-empty string. */ export declare function isHistoryPresentString(value: string | null): value is string; /** * Normalises a history item type key for transformer lookup. * * @param value - The raw key. * @returns The normalised key or null. */ export declare function normaliseHistoryKey(value: string | null): string | null; /** * Normalises a transaction type code for switch matching. * * @param value - The raw transaction type. * @returns The normalised transaction type or null. */ export declare function normaliseHistoryTransactionType(value: string | null): string | null; /** * Converts a camel, space, or hyphen value to snake case. * * @param value - The raw value. * @returns The snake case value. */ export declare function toHistorySnakeCase(value: string): string; /** * Formats configured date strings to the configured output format. * * @param value - The raw date value. * @param dateFormat - The input and output date formats. * @returns The formatted date or original value when parsing fails. */ export declare function formatHistoryDate(value: string | null, dateFormat: IHistoryDetailsDateFormat): string | null; /** * Formats numeric values as currency while preserving preformatted text. * * @param value - The raw money value. * @param currencyPrefix - The currency prefix to prepend to numeric values. * @param emptyValues - Values that should be treated as empty. * @returns The formatted money text or null. */ export declare function formatHistoryMoney(value: unknown, currencyPrefix: string, emptyValues: readonly unknown[]): string | null;