import { IdType, Logger, LogLevel } from "./types"; /** * Assert that the given condition is `true`. * * @param condition - The condition to check. * @param message - The error message to throw. **/ export declare function ok(condition: boolean, message: string): asserts condition; /** * Assert that the given values is a valid user/company id **/ export declare function idOk(id: IdType, entity: string): void; /** * Check if the given item is an object. * * @param item - The item to check. * @returns `true` if the item is an object, `false` otherwise. **/ export declare function isObject(item: any): item is Record; export type LogFn = (message: string, ...args: any[]) => void; export declare function decorate(prefix: string, fn: LogFn): LogFn; export declare function applyLogLevel(logger: Logger, logLevel: LogLevel): { debug: LogFn; info: LogFn; warn: LogFn; error: LogFn; }; /** * Decorate the messages of a given logger with the given prefix. * * @param prefix - The prefix to add to log messages. * @param logger - The logger to decorate. * @returns The decorated logger. **/ export declare function decorateLogger(prefix: string, logger: Logger): Logger; /** Merge two objects, skipping `undefined` values. * * @param target - The target object. * @param source - The source object. * @returns The merged object. **/ export declare function mergeSkipUndefined(target: T, source: U): T & U; /** Hash an object using SHA1. * * @param obj - The object to hash. * * @returns The SHA1 hash of the object. **/ export declare function hashObject(obj: Record): string; export declare function once ReturnType>(fn: T): () => ReturnType; export declare class TimeoutError extends Error { constructor(timeoutMs: number); } /** * Wraps a promise with a timeout. If the promise doesn't resolve within the specified * timeout, it will reject with a timeout error. The original promise will still * continue to execute but its result will be ignored. * * @param promise - The promise to wrap with a timeout * @param timeoutMs - The timeout in milliseconds * @returns A promise that resolves with the original promise result or rejects with a timeout error * @throws {Error} If the timeout is reached before the promise resolves **/ export declare function withTimeout(promise: Promise, timeoutMs: number): Promise; //# sourceMappingURL=utils.d.ts.map