@ecodev/natural 42.3.4 → 42.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,12 +3,12 @@ import { ErrorHandler, InjectionToken } from '@angular/core';
3
3
  import { Observable } from 'rxjs';
4
4
  import * as i0 from "@angular/core";
5
5
  export interface NaturalLoggerType {
6
+ message: string;
7
+ stacktrace?: string;
6
8
  href?: string;
7
9
  host?: string;
8
10
  path?: string;
9
11
  agent?: string;
10
- message: string;
11
- stacktrace: string;
12
12
  status?: number;
13
13
  referrer?: string;
14
14
  url?: string;
@@ -17,17 +17,33 @@ export interface NaturalLoggerType {
17
17
  [key: string]: any;
18
18
  }
19
19
  export interface NaturalLoggerExtra {
20
+ /**
21
+ * Return an observable of extra data that will be logged. Those data will be merged into
22
+ * the original data, and so it can override things.
23
+ *
24
+ * Only the first emitted value will be used.
25
+ */
20
26
  getExtras(error: unknown): Observable<Partial<NaturalLoggerType>>;
21
27
  }
22
28
  export declare const NaturalLoggerConfigUrl: InjectionToken<string>;
23
29
  export declare const NaturalLoggerConfigExtra: InjectionToken<NaturalLoggerExtra>;
30
+ /**
31
+ * Replace Angular's error handler to also send the log to a remote server via HTTP POST.
32
+ *
33
+ * Usage is automatic as soon we import the module via:
34
+ *
35
+ * ```ts
36
+ * NaturalErrorModule.forRoot('http://example.com', ExtraService),
37
+ * ```
38
+ */
24
39
  export declare class NaturalErrorHandler extends ErrorHandler {
25
- private http;
40
+ private readonly http;
26
41
  private readonly document;
27
42
  private readonly url;
28
43
  private readonly loggerExtra?;
29
44
  constructor(http: HttpClient, document: Document, url: string, loggerExtra?: NaturalLoggerExtra | undefined);
30
45
  handleError(error: any): void;
46
+ private toMessage;
31
47
  /**
32
48
  * Send parameters to remote log
33
49
  */
@@ -1,2 +1,2 @@
1
- export * from './error.module';
2
- export * from './error-handler';
1
+ export { NaturalErrorModule } from './error.module';
2
+ export { NaturalErrorHandler, NaturalLoggerConfigExtra, NaturalLoggerConfigUrl, NaturalLoggerExtra, NaturalLoggerType, } from './error-handler';
@@ -1,16 +1,18 @@
1
- import { QueryParamsHandling, RouterLink } from '@angular/router';
1
+ import { OnChanges, SimpleChanges } from '@angular/core';
2
+ import { Params, QueryParamsHandling, RouterLink } from '@angular/router';
2
3
  import { ThemePalette } from '@angular/material/core';
3
4
  import * as i0 from "@angular/core";
4
5
  /**
5
6
  * Button that fits well in a `<mat-table>` and support either
6
7
  * route navigation via `navigate` or external URL via `href`.
7
8
  *
9
+ * If neither `navigate` nor `href` has a meaningful value, then
10
+ * it will show the icon and/or label in `<span>` instead of a button
11
+ *
8
12
  * External URL will always be opened in new tab.
9
13
  */
10
- export declare class NaturalTableButtonComponent {
11
- queryParams: {
12
- [k: string]: any;
13
- };
14
+ export declare class NaturalTableButtonComponent implements OnChanges {
15
+ queryParams: Params;
14
16
  queryParamsHandling: QueryParamsHandling;
15
17
  label?: string | null;
16
18
  icon?: string | null;
@@ -20,7 +22,8 @@ export declare class NaturalTableButtonComponent {
20
22
  preserveFragment: boolean;
21
23
  raised: boolean;
22
24
  color: ThemePalette;
23
- constructor();
25
+ type: 'routerLink' | 'href' | 'none';
26
+ ngOnChanges(changes: SimpleChanges): void;
24
27
  static ɵfac: i0.ɵɵFactoryDeclaration<NaturalTableButtonComponent, never>;
25
28
  static ɵcmp: i0.ɵɵComponentDeclaration<NaturalTableButtonComponent, "natural-table-button", never, { "queryParams": "queryParams"; "queryParamsHandling": "queryParamsHandling"; "label": "label"; "icon": "icon"; "href": "href"; "navigate": "navigate"; "fragment": "fragment"; "preserveFragment": "preserveFragment"; "raised": "raised"; "color": "color"; }, {}, never, never>;
26
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecodev/natural",
3
- "version": "42.3.4",
3
+ "version": "42.4.2",
4
4
  "license": "MIT",
5
5
  "repository": "github:Ecodev/natural",
6
6
  "sideEffects": false,