import { PlainObject } from 'deverything'; import { Identifier, AuthProvider, CreateParams, DeleteManyParams, DeleteParams, GetListParams, GetManyReferenceParams, GetManyParams, GetOneParams, UpdateParams, UpdateManyParams, DataProvider } from 'react-admin'; import { PrismaClient } from '@prisma/client'; import { DynamicClientExtensionThis } from '@prisma/client/runtime/library'; import { CreateAxiosDefaults, AxiosInterceptorOptions } from 'axios'; import * as ra_core from 'ra-core'; type AuditOptions = { model: { create: Function; }; authProvider: AuthProvider; columns?: { id?: string; date?: string; resource?: string; action?: string; payload?: string; author?: string; }; enabledForAction?: { create?: boolean; update?: boolean; delete?: boolean; }; enabledResources?: string[]; }; declare const defaultAuditOptions: Pick; type AuditActions = "create" | "update" | "delete"; type AuditLogPayload = { id: Identifier; data?: PlainObject; previousData?: PlainObject; }; type RaPayload = GetListRequest | GetOneRequest | GetManyRequest | GetManyReferenceRequest | CreateRequest | UpdateRequest | UpdateManyRequest | DeleteRequest | DeleteManyRequest; type GetListRequest = { method: "getList"; params: GetListParams; resource: T; model?: string; }; type GetOneRequest = { method: "getOne"; params: GetOneParams; resource: T; model?: string; }; type GetManyRequest = { method: "getMany"; params: GetManyParams; resource: T; model?: string; }; type GetManyReferenceRequest = { method: "getManyReference"; params: GetManyReferenceParams; resource: T; model?: string; }; type CreateRequest = { method: "create"; params: CreateParams; resource: T; model?: string; }; type UpdateRequest = { method: "update"; params: UpdateParams; resource: T; model?: string; }; type UpdateManyRequest = { method: "updateMany"; params: UpdateManyParams; resource: T; model?: string; }; type DeleteRequest = { method: "delete"; params: DeleteParams; resource: T; model?: string; }; type DeleteManyRequest = { method: "deleteMany"; params: DeleteManyParams; resource: T; model?: string; }; declare const auditHandler: (request: RaPayload, options: AuditOptions, created?: any) => Promise; declare const createAuditEntry: (options: AuditOptions, request: RaPayload, id: Identifier) => Promise; type SetImplicitShortcut = string; type SetImplicitConnection = { [connectModel: string]: string; }; type SetExplicitConnection = { [pivotModel: string]: { [connectModel: string]: string; }; }; type PrismaClientOrDynamicClientExtension = PrismaClient | DynamicClientExtensionThis<{}, { params: { extArgs: { result: {}; model: {}; client: {}; query: {}; }; }; returns: {}; }, {}>; type CreateArgs = { include?: object | null; select?: object | null; omit?: object | null; }; type CreateOptions = Args & { allowOnlyFields?: { [key: string]: boolean; }; connect?: { [key: string]: SetImplicitShortcut | SetImplicitConnection | SetExplicitConnection; }; audit?: AuditOptions; debug?: boolean; primaryKey?: string; }; declare const createHandler: (req: CreateRequest, prismaClient: PrismaClientOrDynamicClientExtension, options?: CreateOptions>) => Promise<{ data: any; }>; type AxiosInterceptorFulfilled = ((value: V) => V | Promise) | null; type AxiosInterceptorError = ((error: any) => any) | null; declare const dataProvider: (endpoint: string, options?: { headers?: CreateAxiosDefaults["headers"]; withCredentials?: boolean; resourceToModelMap?: Record; axiosInterceptors?: { response?: { onFulfilled?: AxiosInterceptorFulfilled; onRejected?: AxiosInterceptorError; options?: AxiosInterceptorOptions; }[]; request?: { onFulfilled?: AxiosInterceptorFulfilled; onRejected?: AxiosInterceptorError; options?: AxiosInterceptorOptions; }[]; }; }) => DataProvider; type DeleteOptions = { softDeleteField?: string; debug?: boolean; audit?: AuditOptions; primaryKey?: string; }; declare const deleteHandler: (req: DeleteRequest, prismaClient: PrismaClientOrDynamicClientExtension, options?: DeleteOptions) => Promise<{ data: any; }>; type DeleteManyOptions = { softDeleteField?: string; audit?: AuditOptions; debug?: boolean; primaryKey?: string; }; declare const deleteManyHandler: (req: DeleteManyRequest, prismaClient: PrismaClientOrDynamicClientExtension, options?: DeleteManyOptions) => Promise<{ data: any[]; }>; type FilterMode = "insensitive" | "default" | undefined; type ExtractWhereOptions = { filterMode?: FilterMode; debug?: boolean; }; declare const extractWhere: (req: GetListRequest | GetManyReferenceRequest, options?: ExtractWhereOptions) => {}; type GetListArgs = { include?: object | null; select?: object | null; omit?: object | null; where?: object | null; orderBy?: object | null; }; type GetListOptions = Args & { noNullsOnSort?: string[]; debug?: boolean; primaryKey?: string; transformRow?: (row: any, rowIndex: number, rows: any[]) => any | Promise; transformRows?: (rows: any[]) => any[] | Promise; filterMode?: FilterMode; }; declare const getListHandler: (req: GetListRequest, prismaClient: PrismaClientOrDynamicClientExtension, options?: GetListOptions) => Promise<{ data: any; total: any; }>; type GetManyArgs = { include?: object | null; select?: object | null; omit?: object | null; }; type GetManyOptions = Args & { debug?: boolean; primaryKey?: string; transformRow?: (data: any) => any | Promise; }; declare const getManyHandler: (req: GetManyRequest, prismaClient: PrismaClientOrDynamicClientExtension, options?: GetManyOptions) => Promise<{ data: any; }>; type GetManyReferenceArgs = { include?: object | null; select?: object | null; omit?: object | null; }; type GetManyReferenceOptions = Args & { debug?: boolean; primaryKey?: string; transformRow?: (data: any) => any | Promise; filterMode?: FilterMode; }; declare const getManyReferenceHandler: (req: GetManyReferenceRequest, prismaClient: PrismaClientOrDynamicClientExtension, options?: GetManyReferenceOptions) => Promise<{ data: any; total: any; }>; type GetOneArgs = { include?: object | null; select?: object | null; omit?: object | null; }; type GetOneOptions = Args & { debug?: boolean; primaryKey?: string; transform?: (row: any) => any | Promise; }; declare const getOneHandler: (req: GetOneRequest, prismaClient: PrismaClientOrDynamicClientExtension, options?: GetOneOptions>) => Promise<{ data: any; }>; type UpdateArgs = { include?: object | null; select?: object | null; omit?: object | null; }; type UpdateOptions = Args & { debug?: boolean; skipFields?: { [key: string]: boolean; }; allowOnlyFields?: { [key: string]: boolean; }; set?: { [key: string]: SetImplicitShortcut | SetImplicitConnection | SetExplicitConnection; }; allowNestedUpdate?: { [key: string]: boolean; }; allowNestedUpsert?: { [key: string]: boolean; }; allowJsonUpdate?: { [key: string]: boolean; }; audit?: AuditOptions; primaryKey?: string; }; declare const reduceData: (data: any, options: UpdateOptions) => {}; declare const updateHandler: (req: UpdateRequest, prismaClient: PrismaClientOrDynamicClientExtension, options?: UpdateOptions>) => Promise<{ data: any; }>; declare const defaultHandler: (req: RaPayload, prismaClient: PrismaClientOrDynamicClientExtension, options?: { audit?: AuditOptions; create?: CreateOptions; delete?: DeleteOptions; deleteMany?: DeleteManyOptions; getList?: GetListOptions; getMany?: GetManyOptions; getManyReference?: GetManyReferenceOptions; getOne?: GetOneOptions; update?: UpdateOptions; }) => Promise<{ data: any; }>; declare const extractOrderBy: (req: GetListRequest | GetManyReferenceRequest) => {}; /** * Extracts the skip and take values from the request. * Throws an error if pagination is not present. * This is useful if the server depends on the pagination being present. */ declare const extractRequiredSkipTake: (req: GetListRequest | GetManyReferenceRequest) => { skip: number; take: number; }; declare const extractSkipTake: (req: GetListRequest | GetManyReferenceRequest) => { skip: number | undefined; take: number | undefined; }; declare const getInfiniteListHandler: (req: GetListRequest, prismaClient: PrismaClientOrDynamicClientExtension, options?: GetListOptions) => Promise<{ data: any; pageInfo: { hasPreviousPage: boolean; hasNextPage: boolean; }; }>; /** * Checks if a specific field in the request has changed between previousData and data. * Throws an error if the field is not present in either previousData or data (should be null) * * @param req - The update request containing previousData and data. * @param field - The field to check for changes. * @param value - Optional value to compare against what the field has changed to * @returns true if the field has changed, false otherwise. * @throws RDSPError if the field is not present in previousData or data. */ declare const hasFieldChanged: (req: UpdateRequest, // for now, does not support updateMany (how can that be done?) field: string, value?: any) => boolean; declare const isExport: (req: GetListRequest) => boolean; interface Permission { /** * @default 'allow' */ type?: "allow" | "deny"; /** * List of actions to allow/deny for the resource * Can be a single action or an array of actions */ action: Action | Action[]; /** * Resource to allow/deny the actions on * This is ideally typed but is also of type string for joint resources ex. user.email */ resource: T | "*"; record?: any; /** * Field(s) to allow/deny the actions on * This is used for field-level permissions * Can be a single field or an array of fields */ field?: string | string[]; } type Action = "*" | "list" | "show" | "create" | "edit" | "delete" | "export"; declare const actions: Action[]; type Permissions = Permission[]; type ReactAdminFetchActions = "getOne" | "create" | "update" | "getList" | "getMany" | "getManyReference" | "updateMany" | "delete" | "deleteMany"; declare const fetchActionToAction: Record; declare const canAccess: ({ action, permissions, resource, record, field, }: { action: Action; permissions: Permissions; resource: string; record?: any; field?: string; }) => boolean; declare const updateManyHandler: (req: UpdateManyRequest, prismaClient: PrismaClientOrDynamicClientExtension, options?: Omit, "select" | "include">) => Promise<{ data: ra_core.Identifier[]; }>; export { type Action, type AuditActions, type AuditLogPayload, type AuditOptions, type CreateArgs, type CreateOptions, type CreateRequest, type DeleteManyOptions, type DeleteManyRequest, type DeleteOptions, type DeleteRequest, type ExtractWhereOptions, type FilterMode, type GetListArgs, type GetListOptions, type GetListRequest, type GetManyArgs, type GetManyOptions, type GetManyReferenceArgs, type GetManyReferenceOptions, type GetManyReferenceRequest, type GetManyRequest, type GetOneArgs, type GetOneOptions, type GetOneRequest, type Permission, type Permissions, type RaPayload, type ReactAdminFetchActions, type SetExplicitConnection, type SetImplicitConnection, type SetImplicitShortcut, type UpdateArgs, type UpdateManyRequest, type UpdateOptions, type UpdateRequest, actions, auditHandler, canAccess, createAuditEntry, createHandler, dataProvider, defaultAuditOptions, defaultHandler, deleteHandler, deleteManyHandler, extractOrderBy, extractRequiredSkipTake, extractSkipTake, extractWhere, fetchActionToAction, getInfiniteListHandler, getListHandler, getManyHandler, getManyReferenceHandler, getOneHandler, hasFieldChanged, isExport, reduceData, updateHandler, updateManyHandler };