@rapharacing/mw-utils
Version:
Middleware Utils
32 lines • 1.26 kB
TypeScript
import { IRequestConfig, IErrorResponseConfig, IErrorResponse, ICognitoError } from "./interfaces";
/**
* Returns a Error Object
* @param {Object} error Error
* @param {String} customError Custom error to inject into console
* @returns {Object} Error
*/
export declare const errorResponse: ({ error, customError }: IErrorResponseConfig) => Promise<IErrorResponse>;
/**
* Returns a Error key
* @param {Object} error Error response from AWS or CC
* @param {string} customMessage Custom error message to overwrite stack errors
* @returns {string} Error key
*/
export declare const cognitoErrorResponse: ({ error, customMessage }: ICognitoError) => Promise<string>;
/**
* Returns a configuration object for axios
* @param {String} url URL
* @param {String} method HTTP method
* @param {String} token Authorization token
* @param {Object} data Data to be sent as the request body
* @returns {Object} Configuration object
*/
export declare const getRequestConfig: ({ url, method, token, data }: IRequestConfig) => Promise<IRequestConfig>;
/**
* Format Authorization Token
*
* @param {string} token Token
* @returns {string} Token
*/
export declare const formatAuthorizationToken: (token: string) => string;
//# sourceMappingURL=index.d.ts.map