taxtank-core 0.33.56 → 0.33.58

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taxtank-core",
3
- "version": "0.33.56",
3
+ "version": "0.33.58",
4
4
  "private": false,
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^17.0.0",
@@ -9,4 +9,5 @@ export declare class HomeOfficeLog extends ObservableModel implements HomeOffice
9
9
  hours: number;
10
10
  description: string;
11
11
  business?: SoleBusiness;
12
+ get formattedDate(): string;
12
13
  }
@@ -0,0 +1,13 @@
1
+ export declare const HTTP_ERROR_MESSAGES: {
2
+ 400: string;
3
+ 401: string;
4
+ 403: string;
5
+ 404: string;
6
+ 405: string;
7
+ 408: string;
8
+ 429: string;
9
+ 500: string;
10
+ 502: string;
11
+ 503: string;
12
+ 504: string;
13
+ };
@@ -1,3 +1,4 @@
1
1
  export * from './rest.service';
2
+ export * from './http-error-messages.const';
2
3
  export * from './rest-method.type';
3
4
  export * from './http-method.type';
@@ -44,6 +44,21 @@ export declare abstract class RestService<BaseModel, Model extends AbstractModel
44
44
  protected orderByDesc: boolean;
45
45
  roles: UserRolesEnum[];
46
46
  mercureTopic: string;
47
+ /**
48
+ * flag to use error messages from api or default ones
49
+ * @TODO: TT-4642 check customHttpErrorMessages fix change to backend errors
50
+ */
51
+ protected useBackendError: boolean;
52
+ /**
53
+ * messages that can be redefined in other classes to customize httpErrorMessages
54
+ */
55
+ protected customHttpErrorMessages: {};
56
+ /**
57
+ * mapping with HTTP errors codes and general messages
58
+ */
59
+ protected httpErrorMessages: {
60
+ [key: number]: string;
61
+ };
47
62
  constructor(environment: any);
48
63
  protected get apiUrl(): string;
49
64
  setCache(data: any[], next?: boolean): void;
@@ -89,6 +104,13 @@ export declare abstract class RestService<BaseModel, Model extends AbstractModel
89
104
  * Remove multiple Model instances from database
90
105
  */
91
106
  deleteBatch(models: Model[]): Observable<void>;
107
+ /**
108
+ * Handle response errors - shows error in toast
109
+ * and throws error further
110
+ * @param error - any backend error
111
+ * @throws HttpErrorResponse | Error - Always throws the error further as an Observable<never>
112
+ */
113
+ handleError(error: unknown): Observable<never>;
92
114
  /**
93
115
  * Handle response data - update cache and dispatch event if it is needed
94
116
  */
@@ -7,6 +7,9 @@ export declare class AllocationRuleService extends RestService<AllocationRuleBas
7
7
  protected endpointUri: string;
8
8
  collectionClass: typeof AllocationRuleCollection;
9
9
  modelClass: typeof AllocationRule;
10
+ customHttpErrorMessages: {
11
+ 422: string;
12
+ };
10
13
  static ɵfac: i0.ɵɵFactoryDeclaration<AllocationRuleService, never>;
11
14
  static ɵprov: i0.ɵɵInjectableDeclaration<AllocationRuleService>;
12
15
  }