export type Layer = (req: Request) => Promise; export type Middleware = (next: Layer) => Layer; export type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; export type BodyData = void | object | FormData; export interface IApi { get(path: string, options?: RequestInit): Promise; post( path: string, data?: Req, options?: RequestInit, ): Promise; put( path: string, data?: Req, options?: RequestInit, ): Promise; patch( path: string, data?: Req, options?: RequestInit, ): Promise; delete(path: string, options?: RequestInit): Promise; search(path: string, query: object, options?: RequestInit): Promise; } export type ResourceId = string | number; export type ResourceParams = Record; export type ResourceData< T extends object, idAttribute extends string = 'id', > = Omit;