/** * A mask that can either hide/show data entirely (BinaryMask) or * selectively hide/show object properties (PropertiesMask). * * @template $Data - The data type being masked */ export type Mask<$Data = any> = BinaryMask<$Data> | PropertiesMask<$Data extends object ? $Data : object>; /** * Create a mask based on the provided options. * * @param options - Mask configuration: * - `boolean`: Creates a binary mask (true = show, false = hide) * - `string[]`: Creates a properties mask that allows only the specified keys * - `object`: Creates a properties mask based on true/false values per key * * @returns A mask that can be applied to data * * @example * ```ts * // Binary mask * const showAll = create(true) * const hideAll = create(false) * * // Properties mask with array * const allowMask = create(['name', 'email']) * * // Properties mask with object * const objectMask = create({ * name: true, * email: true, * password: false * }) * ``` */ export declare const create: <$Data = unknown>(options: InferOptions<$Data>) => Mask<$Data>; /** * Valid options for creating a mask for the given data type. * * @template $Data - The data type to be masked */ export type InferOptions<$Data> = unknown extends $Data ? boolean | string[] | Record : $Data extends object ? (boolean | (keyof $Data)[] | Partial<{ [K in keyof $Data]: boolean; }>) : boolean; /** * A mask that selectively shows or hides object properties. * * @template $Data - The object type being masked */ export interface PropertiesMask<$Data extends object = object> { type: `properties`; /** Whether to allow only specified properties or deny them */ mode: `allow` | `deny`; /** The list of property keys to allow or deny */ properties: (keyof $Data)[]; } /** * Create a properties mask. * * @param mode - 'allow' to show only specified properties, 'deny' to hide them * @param properties - Array of property keys to allow or deny * @returns A PropertiesMask */ export declare const createProperties: <$Data extends object = object>(mode: `allow` | `deny`, properties: (keyof $Data)[]) => PropertiesMask<$Data>; /** * A mask that either shows or hides data entirely. * * @template _$Data - The data type being masked (used for type inference) */ export interface BinaryMask<_$Data = any> { type: `binary`; /** Whether to show (true) or hide (false) the data */ show: boolean; } /** * Create a binary mask. * * @param show - Whether to show (true) or hide (false) the data * @returns A BinaryMask */ export declare const createBinary: <$Data = any>(show: boolean) => BinaryMask<$Data>; /** * Create a mask that shows all data. * @returns A BinaryMask with show=true */ export declare const show: () => BinaryMask; /** * Create a mask that hides all data. * @returns A BinaryMask with show=false */ export declare const hide: () => BinaryMask; /** * Create a mask that shows only the specified properties. * * @param properties - Array of property keys to show * @returns A PropertiesMask in 'allow' mode * * @example * ```ts * const userMask = pick(['name', 'email']) * // Only 'name' and 'email' will be shown * ``` */ export declare const pick: <$Data extends object = object>(properties: (keyof $Data)[]) => PropertiesMask<$Data>; /** * Create a mask that hides the specified properties. * * @param properties - Array of property keys to hide * @returns A PropertiesMask in 'deny' mode * * @example * ```ts * const userMask = omit(['password', 'ssn']) * // Everything except 'password' and 'ssn' will be shown * ``` */ export declare const omit: <$Data extends object = object>(properties: (keyof $Data)[]) => PropertiesMask<$Data>; /** * Extract the data type from a mask. * * @template $Mask - The mask type * @returns The data type the mask is designed for */ export type GetDataType<$Mask extends Mask> = $Mask extends BinaryMask ? $Data : $Mask extends PropertiesMask ? $Data : never; //# sourceMappingURL=mask.d.ts.map