import { type ReadModelKeyFunction } from '../model/model'; import { type Maybe } from '../value/maybe.type'; /** * A string type used as a key in boolean arrays. * * @semanticType * @semanticTopic identifier * @semanticTopic string */ export type BooleanStringKey = string; /** * Boolean represented by an array to describe the current state and reason why. */ export type BooleanStringKeyArray = BooleanKeyArray; /** * Boolean represented by an array to describe the current state and reason why. * * Having any values in the array is considered "true". */ export type BooleanKeyArray = Maybe; /** * Wraps a key reading function to ensure that empty string keys are not used in boolean key arrays. * * @param readKey - The key reading function to wrap. * @returns A wrapped key reading function that throws an error if an empty string is used as a key. */ export declare function readBooleanKeySafetyWrap(readKey: ReadModelKeyFunction): ReadModelKeyFunction; /** * Checks if a boolean key array evaluates to false (empty or undefined). * * @param value - Boolean-key array to evaluate as a tri-state. * @returns True when the array has no entries (treated as `false`); otherwise false. */ export declare function isFalseBooleanKeyArray(value: BooleanKeyArray): boolean; /** * Checks if a boolean key array evaluates to true (has at least one value). * * @param value - Boolean-key array to evaluate as a tri-state. * @returns True when at least one entry exists (treated as `true`); otherwise false. */ export declare function isTrueBooleanKeyArray(value: BooleanKeyArray): boolean; /** * Inserts a value into a boolean key array, removing any existing values with the same key. * * @param array - Existing boolean-key array to extend. * @param value - Entry to add, displacing any prior entry with the same key. * @param readKey - Resolver that derives the comparison key from an entry. * @returns Resulting boolean-key array containing the inserted entry. */ export declare function insertIntoBooleanKeyArray(array: BooleanKeyArray, value: T, readKey: ReadModelKeyFunction): BooleanKeyArray; /** * Removes a value from a boolean key array based on its key. * * @param array - Existing boolean-key array to filter. * @param value - Entry whose key identifies the row to drop. * @param readKey - Resolver that derives the comparison key from an entry. * @returns Boolean-key array with entries matching the value's key removed. */ export declare function removeFromBooleanKeyArray(array: BooleanKeyArray, value: T, readKey: ReadModelKeyFunction): BooleanKeyArray; /** * Removes values from a boolean key array that match the specified key. * * @param array - Existing boolean-key array to filter. * @param key - Identifier whose entries should be removed. * @param readKey - Resolver that derives the comparison key from an entry. * @returns Boolean-key array with entries carrying the given key removed. */ export declare function removeByKeyFromBooleanKeyArray(array: BooleanKeyArray, key: string, readKey: ReadModelKeyFunction): BooleanKeyArray; /** * Utility type for working with boolean key arrays. */ export type BooleanKeyArrayUtility = ReturnType>; /** * Creates a utility object with functions for working with boolean key arrays. * * @param readKey - Function to extract the key from a value. * @returns An object with utility functions for boolean key arrays. */ export declare function booleanKeyArrayUtility(readKey: ReadModelKeyFunction): { isFalse: (value: BooleanKeyArray) => boolean; isTrue: (value: BooleanKeyArray) => boolean; set: (array: BooleanKeyArray, value: T, enable?: boolean) => BooleanKeyArray; insert: (array: BooleanKeyArray, value: T) => BooleanKeyArray; remove: (array: BooleanKeyArray, value: T) => BooleanKeyArray; removeByKey: (array: BooleanKeyArray, key: string) => BooleanKeyArray; }; /** * Utility for working with boolean string key arrays. */ export declare const BooleanStringKeyArrayUtility: { isFalse: (value: BooleanKeyArray) => boolean; isTrue: (value: BooleanKeyArray) => boolean; set: (array: BooleanKeyArray, value: string, enable?: boolean) => BooleanKeyArray; insert: (array: BooleanKeyArray, value: string) => BooleanKeyArray; remove: (array: BooleanKeyArray, value: string) => BooleanKeyArray; removeByKey: (array: BooleanKeyArray, key: string) => BooleanKeyArray; };