import * as React from 'react'; import { OutputSelector } from 'reselect'; export interface NionReduxState { nion: { requests: { [dataKey: string]: any }; entities: { [dataKey: string]: any }; references: { [dataKey: string]: any }; }; } export interface NionRequest { errors?: Error[]; fetchedAt?: Date; isError?: boolean; isLoaded?: boolean; isLoading: boolean; isProcessing: boolean; name?: string; pending: boolean; status?: 'not called' | 'error' | 'pending' | 'success'; statusCode?: number; } export interface NionRef { id: string | number; type: string; } export interface GetActionOptions { append?: boolean; appendKey?: string; } export interface PostActionOptions { append?: boolean; } export interface DeleteActionOptions { refToDelete?: NionRef; } export interface Actions { get(params?: any, actionOptions?: GetActionOptions): Promise; delete(params?: any, actionOptions?: DeleteActionOptions): Promise; put(params?: any): Promise; patch(body?: any, params?: any): Promise; post(body?: any, params?: any, actionOptions?: PostActionOptions): Promise; updateEntity(ref: NionRef, attributes: any): Promise; } export interface NionRefHolder { _ref: { data: NionRef | NionRef[] }; } export interface NionValue extends NionRefHolder { data: T | null; request: NionRequest; actions: Actions; } export function exists(value?: NionValue | null): value is NionValue; export function selectData(key: string, defaultValue?: any): OutputSelector; export function selectRequest(key: string): OutputSelector; export function selectResourcesForKeys( keys: T[], returnAllObjects?: boolean, ): OutputSelector>, any>; export function selectObjectWithRequest(dataKey: string): OutputSelector; export function makeRef( ref: NionRefHolder, options?: { isCollection?: boolean }, ): { entities: NionRef[]; isCollection: boolean; meta: any; links: any }; export function configureNion(options: any): { reducer: any }; export function bootstrapNion(store: NionReduxState, bootstrapObj: any, apiType?: string): void; export function initializeNionDevTool(store: NionReduxState): void; export function titleFormatter(action: symbol, time: any, took: number): string; export const actions: Actions; export interface CommonDeclarationValues { endpoint?: string; initialRef?: ReturnType; extensions?: any; apiType?: string; requestParams?: any; } export interface HookDeclaration extends CommonDeclarationValues { dataKey: string; fetchOnMount?: boolean; } export type NionMeta = Record<'meta' | string, any>; export function useNion( declaration: string | HookDeclaration, dependencyArray?: any[], ): [T | null, Actions, NionRequest, NionMeta]; export interface ExpandedHOCDeclaration extends CommonDeclarationValues { dataKey?: string; fetchOnInit?: boolean; fetchOnce?: boolean; } export type DataKey = string; export type HOCDeclaration = | Record | DataKey | ((props: Props) => Record); export interface InferableComponentEnhancerWithProps {

(component: React.ComponentType

): React.ComponentClass< Omit & TNeedsProps >; } export class DenormalizationCache {} export type HOCProps = { nion: { [dataKey: string]: NionValue }; }; declare function nion( ...declarations: [HOCDeclaration, ...Array>] ): InferableComponentEnhancerWithProps; export default nion;