import { IResourceItem } from "@pankod/refine-core"; import React from "react"; export declare type InferType = "relation" | "array" | "object" | "date" | "email" | "image" | "url" | "richtext" | "text" | "number" | "boolean" | "unknown" | `custom_${string}` | null; export declare type InferField = { key: string; type: InferType; relation?: boolean; multiple?: boolean; fieldable?: boolean; /** * Accessor to get the value from the record, if its an array it means multiple values should be concatenated */ accessor?: string | string[]; resource?: IResourceItem; priority?: number; relationInfer?: InferField | null | false; canRelation?: boolean; }; export declare type ResourceInferenceAttempt = { status: "success" | "error"; resource: string; field: string; }; export declare type FieldInferencer = (key: string, value: unknown, record: Record, infer: FieldInferencer) => InferField | null | false; export declare type FieldTransformer = (fields: Array, resources: IResourceItem[], resource: IResourceItem, record: Record, infer: FieldInferencer) => Array; export declare type RecordField = { key: string; value: unknown; }; export declare type ImportElement = [ element: string, module: string, isDefaultImport?: boolean ]; export declare type CodeViewerProps = { code?: string; loading?: boolean; }; export declare type AdditionalScopeType = [ packageName: string, variableName: string, module: unknown, ignoreReplacement?: boolean ]; export declare type LiveComponentProps = { fetchError?: boolean | string; code?: string; additionalScope?: Array; errorComponent?: React.FC<{ error?: string; }>; }; export declare type RendererContext = { resource: IResourceItem; resources: IResourceItem[]; fields: Array; infer: FieldInferencer; isCustomPage: boolean; id?: string | number; }; export declare type CreateInferencerConfig = { /** * Inferencer Component Type */ type: "list" | "show" | "edit" | "create"; /** * Additional packages to be included in the scope, by default RefineCore and React is included */ additionalScope?: Array; /** * Custom Elements to be inferred */ customElements?: Array; /** * Transformers for the inferred fields */ fieldTransformers?: Array; /** * Custom Code Viewer Component */ codeViewerComponent: React.FC; /** * Loading component to be shown while infering */ loadingComponent: React.FC; /** * Error component to be shown if infering fails or throws an error */ errorComponent: React.FC<{ error?: string; }>; /** * String renderer, inferred fields and the resource will be passed to this function and the code for the component will be generated. */ renderer: (context: RendererContext) => string; }; export declare type InferencerComponentProps = { /** * The resource name to infer from, use this or `resource` prop */ name?: string; /** * The resource name to infer from, use this or `name` prop */ resource?: string; /** * The action to infer page * @default "list" * */ action?: "list" | "show" | "edit" | "create"; /** * The record to infer from, use this when `action` is `show` or `edit` * */ id?: string | number; /** * Field transformer function, you can use this to transform the inferred field or ignore it by returning `undefined`, `null` or `false` * Example: you can remove a field you want to hide by returning `undefined`, `null` or `false` * Example: you can change the `accessor` of an element by returning a new field with the new `accessor` to update the render */ fieldTransformer?: (field: InferField) => InferField | undefined | null | false; }; export declare type InferencerResultComponent = React.FC; export declare type CreateInferencer = (config: CreateInferencerConfig) => InferencerResultComponent; //# sourceMappingURL=index.d.ts.map