import { HttpErrorResponse } from '@angular/common/http'; import { ProviderToken } from '@angular/core'; import { Actions } from '@ngrx/effects'; import { Action, ActionCreator, Creator } from '@ngrx/store'; import { GenericEditDialogService } from '@sowatech/shared/swt-generic'; import { OperatorFunction } from 'rxjs'; /** * Effect, der als Reaktion auf eine Failure Action den ErrorHandler mit angegebenem ActionText auslöst. * ```ts * loadListError$ = createErrorHandlerEffect(apiActions.loadListFailure, 'Laden der Liste'); * ``` */ export declare function createErrorHandlerEffect(action: ActionCreator>, actionText: string, actions$?: Actions): import("rxjs").Observable<{ error: ErrorParams; actionText: string; handling: "messageBox" | "dialog"; } & Action<"[App] Error">> & import("@ngrx/effects").CreateEffectMetadata; /** * Effect, der als Reaktion auf eine Failure Action den Fehler im Edit Dialog anzeigt. * ```ts * createError$ = createDialogErrorEffect(apiActions.createFailure); * ``` */ export declare function createDialogErrorEffect(action: ActionCreator>, actions$?: Actions): import("rxjs").Observable<{ error: ErrorParams; actionText: string; handling: "messageBox" | "dialog"; } & Action<"[App] Error">> & import("@ngrx/effects").CreateEffectMetadata; type HttpStatusCode = number; export type ErrorParams = { name: string; message: string; status: HttpStatusCode; error: any; }; type FailureParam = HttpErrorResponse; type FailurePayload = { error: ErrorParams; }; type FailureAction = ActionCreator>; /** * props für Failure Actions. * ```ts * createActionGroup({ * name: 'My API', * events: { * 'Update Success': emptyProps(), * 'Update Failure': errorProps(), * }, * }); * * catchError(err => of(apiActions.updateFailure(err))) * ``` */ export declare const errorProps: () => (error: FailureParam) => FailurePayload; /** * Abkürzung fürs Mappen zu einer Failure Action. * * ohne mapFailure: `catchError(err => of(apiActions.updateFailure(err)))` * * mit mapFailure: `mapFailure(apiActions.updateFailure)` */ export declare const mapFailure: (failureAction: FailureAction) => OperatorFunction; type ErrorOptions = { handling: 'messageBox'; actionText: string; } | { handling: 'dialog'; actionText: undefined; }; /** * globale Error Action, über die sämtliches ErrorHandling abgehandelt wird */ export declare const errorAction: import("@ngrx/store").FunctionWithParametersType<[error: ErrorParams, errorOptions: ErrorOptions], { error: ErrorParams; actionText: string; handling: "messageBox" | "dialog"; } & Action<"[App] Error">> & Action<"[App] Error">; /** * Globaler Effect, der von `createDialogErrorEffect` gemappte Fehler im Dialog anzeigt. * Der Effect muss im AppModule registriert werden: * ```ts * EffectsModule.forRoot({ globalDialogErrorHandlingEffect }) * ``` */ export declare const globalDialogErrorHandlingEffect: import("@ngrx/effects").FunctionalEffect<(actions$?: Actions, dialog?: GenericEditDialogService) => import("rxjs").Observable>; type ErrorHandlerService = ProviderToken<{ handleError: (error: any, actionText: string) => any; }>; /** * Globaler Effect, der von `createErrorHandlerEffect` gemappte Fehler über den ErrorHandler anzeigt * Ist eine Factory, weil der ErrorHandler nicht im shared liegt. * Der Effect muss im AppModule registriert werden: * ```ts * EffectsModule.forRoot({ globalErrorHandlingEffect: globalErrorHandlingEffectFactory(ErrorHandlerService) }) * ``` */ export declare function globalErrorHandlingEffectFactory(errorHandlerType: ErrorHandlerService): import("@ngrx/effects").FunctionalEffect<(actions$?: Actions, errorHandler?: { handleError: (error: any, actionText: string) => any; }) => import("rxjs").Observable>; export {};