import { MapOperator, PollingErrorMode, EmitValueMode } from 'uni-model-type/enum'; type Column = { name?: string; dataField: string; dataType: string; format?: string | { type: string; precision: number; } | { weekday?: string; year?: string; month?: string; day?: string; hour?: string; minute?: string; second?: string; }; caption?: string; width: number; minWidth?: number; alignment?: string; cssClass?: string; sort?: { index: number; order: string; }; }; interface Combo { id: T; code: string; description: string; } interface ComboRaw { id: T; name: string; } interface ComboTranslation { id: T; label: string; isToTranslate?: boolean; } interface IUniError { type: 'fe' | 'be' | 'network' | 'server'; exception: { type: string; message: string; functionName: string; stackTrace: string; stackTraceFrames: { file: string; line: number; }[]; }; } interface IUniFeError extends IUniError { type: Extract; } interface IUniHttpError extends IUniError { type: Exclude; request: Request; httpStatus: number; durationMs: number; userAgent: string; innerException: IUniError['exception'] | null; } interface ErrorResponse { exception: ErrorResponseException; innerException: ErrorResponseException | null; } interface ErrorResponseException { isBe?: boolean; type: string; message: string; stackTrace: string; } interface ErrorStore { uniError: IUniFeError | IUniHttpError; historyItems: { message: string; timestamp: number; }[]; isVisible: boolean; isOpen: boolean; isCopied: boolean; isSaved: boolean; } interface FileDatasource { blob: Blob; name: string; } interface LoginForm { username: string; password: string; } interface IToastManager { success: (message: string, config?: ToastConfig) => void; info: (message: string, config?: ToastConfig) => void; warning: (message: string, config?: ToastConfig) => void; error: (message: string, config?: ToastConfig) => void; } interface ToastConfig { type?: keyof IToastManager; prefix?: string; label: string; params?: Record; duration?: number; message?: { prefix?: string; suffix?: string; }; } interface ToastHttpConfig { resParams?: T extends void ? undefined : (keyof T & string)[]; formatters?: Partial any>>; } interface HttpRef { type: 'one' | 'polling' | 'image' | 'file' | 'ws'; lineId: number | null | undefined; url: URL; pendingCount: number; hasError: boolean; } interface HttpConfig { ref: string; path: string; queryParams?: Record; init?: RequestInit; toast?: ToastConfig & ToastHttpConfig; hasToast?: boolean; hasLoader?: boolean; hasApiPrefix?: boolean; } interface HttpConfigPolling { interval: number; ref: string; path: string; queryParams?: Record; init?: RequestInit; operator?: MapOperator; errorMode?: PollingErrorMode; emitValueMode?: EmitValueMode; firstIteration?: { callback?: (res: T) => void; toast?: NonNullable['toast']>; hasLoader?: boolean; }; } /** * Tipi primitivi e strutture dati standard ammesse nel body. */ type HttpBodyPrimitive = string | number | boolean | Date | Array | Record; /** * Utility Type ricorsivo per la validazione delle chiavi. * Se una proprietà viola i pattern pattuiti, viene forzata a 'never'. */ type HttpBody = T extends Date ? T : T extends Array ? Array> : T extends object ? { [K in keyof T]: K extends string ? K extends `is${Capitalize}` | `has${Capitalize}` | `should${Capitalize}` | `can${Capitalize}` ? T[K] extends boolean | null ? T[K] : never : K extends `${string}Code` | `${string}Name` | `${string}Description` | `${string}Url` | 'code' | 'name' | 'description' | 'url' ? T[K] extends string | null ? T[K] : never : K extends `${string}Date` | `${string}At` ? T[K] extends Date | null ? T[K] : never : K extends 'id' | 'Id' | 'ID' | `${string}Id` | `${string}ID` | `${string}Count` | `${string}Qty` | `${string}Length` | `${string}Total` | `${string}Timestamp` | `${string}Timestampms` ? T[K] extends number | null ? T[K] : never : HttpBody : T[K]; } : T; interface FeLog { id: number; severity: keyof IToastManager; ref: string; timestamp: number; module: IUniError['type']; exceptionType: IUniError['exception']['type']; exceptionMessage: IUniError['exception']['message']; exceptionFunctionName: IUniError['exception']['functionName']; exceptionStackTrace: IUniError['exception']['stackTrace']; exceptionStackTraceFrames: IUniError['exception']['stackTraceFrames']; } type Nullable = { [K in keyof T]: T[K] | null; }; declare enum LogSeverity { NONE = 0, INFO = 1, WARNING = 2, ERROR = 3 } interface WebSocketNotification { date: string; severity: LogSeverity; data: T; } export { LogSeverity }; export type { Column, Combo, ComboRaw, ComboTranslation, ErrorResponse, ErrorResponseException, ErrorStore, FeLog, FileDatasource, HttpBody, HttpBodyPrimitive, HttpConfig, HttpConfigPolling, HttpRef, IToastManager, IUniError, IUniFeError, IUniHttpError, LoginForm, Nullable, ToastConfig, ToastHttpConfig, WebSocketNotification };