@applica-software-guru/crud-client
Version:
Libreria per l'accesso ai servizi REST di Applica.
41 lines • 2.06 kB
TypeScript
import { AttachmentParserResult, CreateHeaderOptions, ErrorMapperResult } from './types';
import { stringify } from 'query-string';
import { GetListParams, GetManyParams } from 'ra-core';
declare function createHeadersFromOptions(options: CreateHeaderOptions): Headers | any;
declare function createFormData(body: any): string;
declare function fetchJson(url: string, options?: any, HttpErrorClass?: any, timeout?: number): Promise<any>;
declare function flattenObject(value: any, path?: string[]): any;
declare const queryParameters: typeof stringify;
declare function createGetQuery(params: GetListParams | GetManyParams | any): {
filters: any[];
page: any;
rowsPerPage: any;
keyword: any;
sorts: {
property: any;
descending: boolean;
}[];
};
type ConvertFileToBase64Result = null | {
name: string;
data: string | ArrayBuffer | null;
};
declare function convertFileToBase64(file: any): Promise<ConvertFileToBase64Result>;
declare function convertFile(file: any): Promise<any>;
declare function uuid(): string;
declare function convertFileToPart(item: any, parts: any[]): string;
declare function springErrorMapper(errors: any[]): any[];
declare function createErrorMapper(result: ErrorMapperResult): any | any[] | boolean;
declare function flattenKeys(obj: any, prefix?: string): any;
/**
* Configure a parser capable of working with attachments managed within forms.
*
* @param {Array<String>} fields
* @returns {Function} Returns a parser function that can be used to parse attachments.
* @example
* import { createAttachmentsParser } from '@applica-software-guru/crud-client';
* const parser = createAttachmentsParser();
*/
declare function createAttachmentsParser(): (data: any) => Promise<AttachmentParserResult>;
export { convertFile, convertFileToBase64, convertFileToPart, createAttachmentsParser, createErrorMapper, createFormData, createGetQuery, createHeadersFromOptions, fetchJson, flattenKeys, flattenObject, queryParameters, springErrorMapper, uuid };
//# sourceMappingURL=utils.d.ts.map