import type { UnknownObject } from '../types/index.js'; /** * Gets the type of the given object. * @param o */ export declare function type(o: unknown): string; /** * Specifies whether the property/key is defined on the given object. * @param o * @param propName */ export declare function hasDefined(o: UnknownObject, propName: string): boolean; /** * Builds the dynamic-detail suffix for an error message, honoring `safeErrors`. * When `safe` (the default), returns `''` so no caller-supplied value is echoed * into the message (the value still travels in the error's structured fields). * When not safe (`policy.safeErrors:false`), returns a `Got: …` suffix for * developer ergonomics. * @param safe - The resolved `safeErrors` flag. * @param value - The dynamic value to (conditionally) include. */ export declare function detail(safe: boolean, value: unknown): string; /** * Applies the configured `engine.errorCodePrefix` to an {@link ErrorCode}. * With the default empty prefix the code is returned unchanged; with a prefix * (e.g. `"AC_"`) it becomes `"AC_ROLE_NOT_FOUND"` so codes can't collide with a * consumer's own error codes. * @param prefix - The resolved code prefix (may be `undefined`/empty). * @param code - The bare {@link ErrorCode} value. */ export declare function ecode(prefix: string | undefined, code: string): string; /** * Converts the given (string) value into an array of string. Note that * this does not throw if the value is not a string or array. It will * silently return `[]` (empty array). So where ever it's used, the host * function should consider throwing. * @param value */ export declare function toStringArray(value: unknown): string[]; /** * Checks whether the given array consists of non-empty string items. * (Array can be empty but no item should be an empty string.) * @param arr - Array to be checked. */ export declare function isFilledStringArray(arr: unknown[]): boolean; /** * Checks whether the given value is an empty array. * @param value - Value to be checked. */ export declare function isEmptyArray(value: unknown): boolean; /** * If an attribute list contains **only** negations (e.g. `['!password']`), * implies a leading `'*'` so it means "all attributes except...". A list * with at least one positive glob, or an empty list, is returned unchanged. * @param attributes */ export declare function impliedStar(attributes: string[]): string[]; /** * Ensures that the pushed item is unique in the target array. * @param arr - Target array. * @param item - Item to be pushed to array. */ export declare function pushUniq(arr: string[], item: string): string[]; /** * Concats the given two arrays and ensures all items are unique. * @param arrA * @param arrB */ export declare function uniqConcat(arrA: string[], arrB: string[]): string[]; /** * Subtracts the second array from the first. * @param arrA * @param arrB */ export declare function subtractArray(arrA: string[], arrB: string[]): string[]; /** * Recursively freezes the given value, making it (and every nested object and * array it contains) immutable. Primitives, `null` and functions pass through * unchanged. * * The v3 grants model nests grant rules inside arrays * (`resource.action -> IGrant[]`), so a shallow freeze would freeze the array * but leave each rule object mutable — a lock-bypass. This recurses into array * elements (an array's own property names include its indices) and object * values alike, freezing children before the container. * * @param o - Value to deep-freeze. * @returns The same value, now deeply frozen. */ export declare function deepFreeze(o: T): T; /** * Similar to JS .forEach, except this allows for breaking out early, * (before all iterations are executed) by returning `false`. * @param array * @param callback * @param thisArg */ export declare function each(array: unknown[], callback: any, thisArg?: unknown | null): void; /** * Iterates through the keys of the given object. Breaking out early is * possible by returning `false`. * @param object * @param callback * @param thisArg */ export declare function eachKey(object: UnknownObject, callback: any, thisArg?: unknown | null): void; //# sourceMappingURL=generic.d.ts.map