@fluxhub/fluxhub-lib 19.0.243 → 19.0.245

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.
@@ -12,6 +12,7 @@ export declare class QueryService {
12
12
  private app_s;
13
13
  private uti_s;
14
14
  headers?: HttpHeaders | null;
15
+ private reporter;
15
16
  url: string | null;
16
17
  constructor(http: HttpClient, toastr: ToastrService, app_s: AppService, uti_s: UtilityService);
17
18
  /**
@@ -0,0 +1,48 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { HttpHeaders } from '@angular/common/http';
3
+ /**
4
+ * Segnalazione di un errore dei servizi dati della libreria (query, griglie).
5
+ *
6
+ * La libreria non dipende da nessun SDK di monitoraggio: il portale che vuole
7
+ * raccogliere gli errori fornisce FH_ERROR_REPORTER (es. con @sentry/angular verso
8
+ * Rustrak) e decide cosa farne. Senza provider non succede niente.
9
+ */
10
+ export interface FHErrorReport {
11
+ /** 'ko' = risposta { result_msg: 'KO' }, 'http' = errore di trasporto (5xx, rete), 'empty' = risposta vuota */
12
+ kind: 'ko' | 'http' | 'empty';
13
+ /** Servizio che ha fatto la chiamata */
14
+ service: 'query' | 'grid';
15
+ /** Endpoint chiamato, senza host (es. /doquery, /dogridn, /doexportn) */
16
+ endpoint: string;
17
+ /** Chiave della query o della griglia (mai i valori dei parametri) */
18
+ key: string;
19
+ /** Messaggio d'errore restituito dal server */
20
+ message: string;
21
+ /** Status HTTP, solo per kind='http' */
22
+ status?: number;
23
+ /**
24
+ * Id dell'evento gia' registrato dal server (header X-FH-Event-Id). Se valorizzato
25
+ * l'errore e' gia' stato raccolto lato backend con stack trace e chiave: il
26
+ * reporter non dovrebbe mandarne un secondo, al massimo un breadcrumb.
27
+ */
28
+ serverEventId: string | null;
29
+ /** Pagina del portale da cui e' partita la chiamata */
30
+ route: string;
31
+ /** false se il chiamante ha chiesto di non mostrare il toast d'errore */
32
+ displayError: boolean;
33
+ }
34
+ export type FHErrorReporter = (report: FHErrorReport) => void;
35
+ /** Fornito dal portale: `{ provide: FH_ERROR_REPORTER, useValue: (r) => ... }` */
36
+ export declare const FH_ERROR_REPORTER: InjectionToken<FHErrorReporter>;
37
+ /** Header con cui il server dichiara di aver gia' registrato l'errore. */
38
+ export declare const FH_EVENT_ID_HEADER = "X-FH-Event-Id";
39
+ /** Header con la pagina del portale, letto dal server per arricchire i suoi eventi. */
40
+ export declare const FH_ROUTE_HEADER = "X-FH-Route";
41
+ /** Pagina corrente: i portali usano l'hash routing (/#/home), altrimenti il path. */
42
+ export declare function fhCurrentRoute(): string;
43
+ export declare function fhEndpointOf(url: string | null): string;
44
+ /** Invoca il reporter senza mai far fallire la chiamata dati per colpa sua. */
45
+ export declare function fhReport(reporter: FHErrorReporter | null, r: FHErrorReport | null): void;
46
+ /** Report per un errore di trasporto, o null se non va segnalato. */
47
+ export declare function fhHttpErrorReport(err: any, base: Omit<FHErrorReport, 'kind' | 'message' | 'status' | 'serverEventId'>): FHErrorReport | null;
48
+ export declare function fhEventId(h: HttpHeaders | null | undefined): string | null;
@@ -12,6 +12,7 @@ export declare class GridService {
12
12
  private toastr;
13
13
  private uti_s;
14
14
  headers?: HttpHeaders | null;
15
+ private reporter;
15
16
  constructor(http: HttpClient, app_s: AppService, toastr: ToastrService, uti_s: UtilityService);
16
17
  url: string | null;
17
18
  doQuery(queryp: QGParam, displayError?: boolean, url_sec?: string | null): Observable<QGResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluxhub/fluxhub-lib",
3
- "version": "19.0.243",
3
+ "version": "19.0.245",
4
4
  "description": "FluxHub components and workflow library",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
package/public-api.d.ts CHANGED
@@ -90,6 +90,8 @@ export { AppService } from './lib/services/app.service';
90
90
  export { AppMakerService } from './lib/services/app-maker.service';
91
91
  export { FileService } from './lib/services/dofile.service';
92
92
  export { QueryService } from './lib/services/doquery.service';
93
+ export { FH_ERROR_REPORTER, FH_EVENT_ID_HEADER, FH_ROUTE_HEADER } from './lib/services/error-reporter';
94
+ export type { FHErrorReport, FHErrorReporter } from './lib/services/error-reporter';
93
95
  export { OdbcService } from './lib/services/doquery-odbc.service';
94
96
  export { WkfService } from './lib/services/dowkf.service';
95
97
  export { WkfProceedReason, WkfProceedResult, WkfProceedOptions, WkfTaskResult, WkfCompleteTaskOptions, } from './lib/services/dowkf.service';