import { BusinessError, FunctionResult, FunctionDefinition } from './service-provider-model.js'; /** * Validates a function result against the expected success codes and extracts the data. * * @param result - The raw function result from the provider * @param functionDef - The function definition with successCodes * @returns The extracted resultData, typed as T * @throws BusinessError if statusCode is not in successCodes * * @example * ```typescript * public loadGalleryList(): Observable { * const call = { object: "galleryList" }; * return from( * services.functions.callFunction(handlePutFunc.name, call) * .then((result) => validateFunctionResult(result, handlePutFunc)) * ); * } * ``` */ export declare function validateFunctionResult(result: FunctionResult, functionDef: FunctionDefinition): T; /** * Validates a function result with a custom success code array. * Use this when you don't have a full FunctionDefinition available. * * @param result - The raw function result from the provider * @param successCodes - Array of valid status codes (default: [200]) * @returns The extracted resultData, typed as T * @throws BusinessError if statusCode is not in successCodes */ export declare function validateResult(result: FunctionResult, successCodes?: number[]): T; /** * Type guard to check if an error is a BusinessError. * Useful in catch blocks to distinguish business errors from technical errors. * * @example * ```typescript * catchError((err) => { * if (isBusinessError(err)) { * console.log("Business error:", err.code, err.message); * } * return of(failAction(err)); * }) * ``` */ export declare function isBusinessError(error: unknown): error is BusinessError; /** * Extracts error information for logging/display. * Handles both BusinessError and standard Error. */ export declare function extractErrorInfo(error: unknown): { message: string; code: number; }; //# sourceMappingURL=function-utils.d.ts.map