uni-manager 0.1.6 → 0.1.8

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.
@@ -1,4 +1,5 @@
1
1
  import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
2
+ import { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged';
2
3
  import { map } from 'rxjs/internal/operators/map';
3
4
 
4
5
  class UniErrorManager {
@@ -7,48 +8,56 @@ class UniErrorManager {
7
8
  /* ------------------------------------------------------------------------------- */
8
9
  /** Restituisce se lo store ha chiamate in attesa di risposta o meno */
9
10
  static get errors$() {
10
- return this.store$.pipe(map((x) => Array.from(x.entries(), ([id, error]) => ({ ...error, id }))));
11
+ return UniErrorManager.store$.pipe(map((x) => Array.from(x.entries(), ([id, error]) => ({ ...error, id }))), distinctUntilChanged((prev, curr) => {
12
+ if (prev.length !== curr.length)
13
+ return false;
14
+ return prev.every((err, index) => err.id === curr[index].id && err.count === curr[index].count);
15
+ }));
11
16
  }
12
17
  /* ------------------------------------------------------------------------------- */
13
18
  /* ------------------------------------ Store ------------------------------------ */
14
19
  /* ------------------------------------------------------------------------------- */
15
- /** Store privato (Subject) */
20
+ /** Store privato (Subject) */
16
21
  static { this.store = new BehaviorSubject(new Map()); }
17
- /** Store pubblico (Observable) */
18
- static { this.store$ = this.store.asObservable(); }
22
+ /** Store pubblico (Observable) */
23
+ static { this.store$ = UniErrorManager.store.asObservable(); }
19
24
  /** Ottiene lo stato attuale della Map senza dover sottoscrivere l'observable */
20
25
  static get currentValue() {
21
- return this.store.getValue();
26
+ return UniErrorManager.store.getValue();
22
27
  }
23
28
  /* ------------------------------------------------------------------------------- */
24
29
  /* -------------------------------- Metodi: store -------------------------------- */
25
30
  /* ------------------------------------------------------------------------------- */
26
31
  /**
27
32
  * Aggiunge o aggiorna un errore nello store.
28
- * Se l'errore esiste già (stesso ID), incrementa il contatore 'count'.
33
+ * Se l'errore esiste già (stesso ID), incrementa il contatore 'count' e aggiorna il timestamp.
29
34
  */
30
35
  static add(id, error) {
31
36
  // Recupera l'ultimo stato (Map)
32
- const oldMap = this.currentValue;
37
+ const oldMap = UniErrorManager.currentValue;
38
+ console.log(oldMap);
33
39
  // Tenta di recuperare l'oggetto corrente
34
40
  const oldItem = oldMap.get(id);
35
- // Crea il nuovo oggetto
41
+ // Crea il nuovo oggetto aggiornando contatore e portando il timestamp al momento attuale
36
42
  const newItemMap = {
37
43
  ...error,
38
44
  count: oldItem ? oldItem.count + 1 : 1,
45
+ timestamp: new Date(),
39
46
  };
40
47
  // Crea una nuova istanza della Map
41
48
  const newMap = new Map(oldMap);
42
49
  newMap.set(id, newItemMap);
43
50
  // Aggiorna il nuovo stato notificando l'observer
44
- this.store.next(newMap);
51
+ UniErrorManager.store.next(newMap);
52
+ console.log(newMap);
45
53
  }
46
54
  /**
47
55
  * Rimuove un errore tramite ID
48
56
  */
49
57
  static remove(id) {
50
58
  // Recupera l'ultimo stato (Map)
51
- const oldMap = this.currentValue;
59
+ const oldMap = UniErrorManager.currentValue;
60
+ console.log(oldMap);
52
61
  // Controllo: se non è presente l'item allora termina
53
62
  if (!oldMap.has(id))
54
63
  return;
@@ -56,7 +65,8 @@ class UniErrorManager {
56
65
  const newMap = new Map(oldMap);
57
66
  newMap.delete(id);
58
67
  // Aggiorna il nuovo stato notificando l'observer
59
- this.store.next(newMap);
68
+ UniErrorManager.store.next(newMap);
69
+ console.log(newMap);
60
70
  }
61
71
  /**
62
72
  * Svuota completamente la lista degli errori
@@ -65,7 +75,7 @@ class UniErrorManager {
65
75
  // Crea una nuova istanza della Map
66
76
  const newMap = new Map();
67
77
  // Aggiorna il nuovo stato notificando l'observer
68
- this.store.next(newMap);
78
+ UniErrorManager.store.next(newMap);
69
79
  }
70
80
  }
71
81
 
@@ -1 +1 @@
1
- {"version":3,"file":"uni-manager-error.mjs","sources":["../../../projects/uni-manager/error/manager.ts","../../../projects/uni-manager/error/uni-manager-error.ts"],"sourcesContent":["import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';\r\nimport { Observable } from 'rxjs/internal/Observable';\r\nimport { map } from 'rxjs/internal/operators/map';\r\nimport type { IUniFeError } from 'uni-error/fe';\r\nimport type { IUniHttpError } from 'uni-error/http';\r\n\r\nexport class UniErrorManager {\r\n /* ------------------------------------------------------------------------------- */\r\n /* --------------------------------- Metodi: get --------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Restituisce se lo store ha chiamate in attesa di risposta o meno */\r\n public static get errors$(): Observable<({ id: string } & (IUniFeError | IUniHttpError))[]> {\r\n return this.store$.pipe(\r\n map((x) => Array.from(x.entries(), ([id, error]) => ({ ...error, id }))),\r\n // distinctUntilChanged((prev, curr) => {\r\n // if (prev.length !== curr.length) return false;\r\n // return prev.every(\r\n // (err, index) => err.id === curr[index].id && err.count === curr[index].count,\r\n // );\r\n // }),\r\n );\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* ------------------------------------ Store ------------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Store privato (Subject) */\r\n private static store = new BehaviorSubject<Map<string, IUniFeError | IUniHttpError>>(new Map());\r\n\r\n /** Store pubblico (Observable) */\r\n public static store$: Observable<Map<string, IUniFeError | IUniHttpError>> =\r\n this.store.asObservable();\r\n\r\n /** Ottiene lo stato attuale della Map senza dover sottoscrivere l'observable */\r\n public static get currentValue(): Map<string, IUniFeError | IUniHttpError> {\r\n return this.store.getValue();\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: store -------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Aggiunge o aggiorna un errore nello store.\r\n * Se l'errore esiste già (stesso ID), incrementa il contatore 'count'.\r\n */\r\n public static add(id: string, error: IUniHttpError | IUniFeError): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = this.currentValue;\r\n\r\n // Tenta di recuperare l'oggetto corrente\r\n const oldItem = oldMap.get(id);\r\n\r\n // Crea il nuovo oggetto\r\n const newItemMap: IUniFeError | IUniHttpError = {\r\n ...error,\r\n count: oldItem ? oldItem.count + 1 : 1,\r\n };\r\n\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map(oldMap);\r\n newMap.set(id, newItemMap);\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n this.store.next(newMap);\r\n }\r\n\r\n /**\r\n * Rimuove un errore tramite ID\r\n */\r\n public static remove(id: string): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = this.currentValue;\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n if (!oldMap.has(id)) return;\r\n\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map(oldMap);\r\n newMap.delete(id);\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n this.store.next(newMap);\r\n }\r\n\r\n /**\r\n * Svuota completamente la lista degli errori\r\n */\r\n public static removeAll(): void {\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map();\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n this.store.next(newMap);\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAMa,eAAe,CAAA;;;;;AAKnB,IAAA,WAAW,OAAO,GAAA;AACvB,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CACrB,GAAG,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAOzE;IACH;;;;;aAMe,IAAA,CAAA,KAAK,GAAG,IAAI,eAAe,CAA2C,IAAI,GAAG,EAAE,CAAC,CAAC;;AAGlF,IAAA,SAAA,IAAA,CAAA,MAAM,GAClB,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;;AAGrB,IAAA,WAAW,YAAY,GAAA;AAC5B,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;IAC9B;;;;AAKA;;;AAGG;AACI,IAAA,OAAO,GAAG,CAAC,EAAU,EAAE,KAAkC,EAAA;;AAE9D,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY;;QAGhC,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;;AAG9B,QAAA,MAAM,UAAU,GAAgC;AAC9C,YAAA,GAAG,KAAK;AACR,YAAA,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC;SACvC;;AAGD,QAAA,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC;AAC9B,QAAA,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,UAAU,CAAC;;AAG1B,QAAA,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;IACzB;AAEA;;AAEG;IACI,OAAO,MAAM,CAAC,EAAU,EAAA;;AAE7B,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY;;AAGhC,QAAA,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE;;AAGrB,QAAA,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC;AAC9B,QAAA,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;;AAGjB,QAAA,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;IACzB;AAEA;;AAEG;AACI,IAAA,OAAO,SAAS,GAAA;;AAErB,QAAA,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE;;AAGxB,QAAA,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;IACzB;;;AC7FF;;AAEG;;;;"}
1
+ {"version":3,"file":"uni-manager-error.mjs","sources":["../../../projects/uni-manager/error/manager.ts","../../../projects/uni-manager/error/uni-manager-error.ts"],"sourcesContent":["import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';\r\nimport { Observable } from 'rxjs/internal/Observable';\r\nimport { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged';\r\nimport { map } from 'rxjs/internal/operators/map';\r\nimport type { IUniFeError } from 'uni-error/fe';\r\nimport type { IUniHttpError } from 'uni-error/http';\r\n\r\nexport class UniErrorManager {\r\n /* ------------------------------------------------------------------------------- */\r\n /* --------------------------------- Metodi: get --------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Restituisce se lo store ha chiamate in attesa di risposta o meno */\r\n public static get errors$(): Observable<({ id: string } & (IUniFeError | IUniHttpError))[]> {\r\n return UniErrorManager.store$.pipe(\r\n map((x) => Array.from(x.entries(), ([id, error]) => ({ ...error, id }))),\r\n distinctUntilChanged((prev, curr) => {\r\n if (prev.length !== curr.length) return false;\r\n return prev.every(\r\n (err, index) => err.id === curr[index].id && err.count === curr[index].count,\r\n );\r\n }),\r\n );\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* ------------------------------------ Store ------------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Store privato (Subject) */\r\n private static store = new BehaviorSubject<Map<string, IUniFeError | IUniHttpError>>(new Map());\r\n\r\n /** Store pubblico (Observable) */\r\n public static store$: Observable<Map<string, IUniFeError | IUniHttpError>> =\r\n UniErrorManager.store.asObservable();\r\n\r\n /** Ottiene lo stato attuale della Map senza dover sottoscrivere l'observable */\r\n public static get currentValue(): Map<string, IUniFeError | IUniHttpError> {\r\n return UniErrorManager.store.getValue();\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: store -------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Aggiunge o aggiorna un errore nello store.\r\n * Se l'errore esiste già (stesso ID), incrementa il contatore 'count' e aggiorna il timestamp.\r\n */\r\n public static add(id: string, error: IUniHttpError | IUniFeError): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = UniErrorManager.currentValue;\r\n console.log(oldMap);\r\n\r\n // Tenta di recuperare l'oggetto corrente\r\n const oldItem = oldMap.get(id);\r\n\r\n // Crea il nuovo oggetto aggiornando contatore e portando il timestamp al momento attuale\r\n const newItemMap: IUniFeError | IUniHttpError = {\r\n ...error,\r\n count: oldItem ? oldItem.count + 1 : 1,\r\n timestamp: new Date(),\r\n };\r\n\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map(oldMap);\r\n newMap.set(id, newItemMap);\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n UniErrorManager.store.next(newMap);\r\n\r\n console.log(newMap);\r\n }\r\n\r\n /**\r\n * Rimuove un errore tramite ID\r\n */\r\n public static remove(id: string): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = UniErrorManager.currentValue;\r\n console.log(oldMap);\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n if (!oldMap.has(id)) return;\r\n\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map(oldMap);\r\n newMap.delete(id);\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n UniErrorManager.store.next(newMap);\r\n\r\n console.log(newMap);\r\n }\r\n\r\n /**\r\n * Svuota completamente la lista degli errori\r\n */\r\n public static removeAll(): void {\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map();\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n UniErrorManager.store.next(newMap);\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAOa,eAAe,CAAA;;;;;AAKnB,IAAA,WAAW,OAAO,GAAA;QACvB,OAAO,eAAe,CAAC,MAAM,CAAC,IAAI,CAChC,GAAG,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,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AAElC,QAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;IACrB;AAEA;;AAEG;IACI,OAAO,MAAM,CAAC,EAAU,EAAA;;AAE7B,QAAA,MAAM,MAAM,GAAG,eAAe,CAAC,YAAY;AAC3C,QAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;;AAGnB,QAAA,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE;;AAGrB,QAAA,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC;AAC9B,QAAA,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;;AAGjB,QAAA,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;AAElC,QAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;IACrB;AAEA;;AAEG;AACI,IAAA,OAAO,SAAS,GAAA;;AAErB,QAAA,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE;;AAGxB,QAAA,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;IACpC;;;ACrGF;;AAEG;;;;"}
@@ -1,8 +1,8 @@
1
1
  import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
2
+ import { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged';
2
3
  import { map } from 'rxjs/internal/operators/map';
3
4
  import { tap } from 'rxjs/internal/operators/tap';
4
5
  import { UniToastManager as UniToastManager$1 } from 'uni-manager/toast';
5
- import { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged';
6
6
  import isEqual from 'lodash-es/isEqual';
7
7
  import { defer } from 'rxjs/internal/observable/defer';
8
8
  import { from } from 'rxjs/internal/observable/from';
@@ -27,48 +27,56 @@ class UniErrorManager {
27
27
  /* ------------------------------------------------------------------------------- */
28
28
  /** Restituisce se lo store ha chiamate in attesa di risposta o meno */
29
29
  static get errors$() {
30
- return this.store$.pipe(map((x) => Array.from(x.entries(), ([id, error]) => ({ ...error, id }))));
30
+ return UniErrorManager.store$.pipe(map((x) => Array.from(x.entries(), ([id, error]) => ({ ...error, id }))), distinctUntilChanged((prev, curr) => {
31
+ if (prev.length !== curr.length)
32
+ return false;
33
+ return prev.every((err, index) => err.id === curr[index].id && err.count === curr[index].count);
34
+ }));
31
35
  }
32
36
  /* ------------------------------------------------------------------------------- */
33
37
  /* ------------------------------------ Store ------------------------------------ */
34
38
  /* ------------------------------------------------------------------------------- */
35
- /** Store privato (Subject) */
39
+ /** Store privato (Subject) */
36
40
  static { this.store = new BehaviorSubject(new Map()); }
37
- /** Store pubblico (Observable) */
38
- static { this.store$ = this.store.asObservable(); }
41
+ /** Store pubblico (Observable) */
42
+ static { this.store$ = UniErrorManager.store.asObservable(); }
39
43
  /** Ottiene lo stato attuale della Map senza dover sottoscrivere l'observable */
40
44
  static get currentValue() {
41
- return this.store.getValue();
45
+ return UniErrorManager.store.getValue();
42
46
  }
43
47
  /* ------------------------------------------------------------------------------- */
44
48
  /* -------------------------------- Metodi: store -------------------------------- */
45
49
  /* ------------------------------------------------------------------------------- */
46
50
  /**
47
51
  * Aggiunge o aggiorna un errore nello store.
48
- * Se l'errore esiste già (stesso ID), incrementa il contatore 'count'.
52
+ * Se l'errore esiste già (stesso ID), incrementa il contatore 'count' e aggiorna il timestamp.
49
53
  */
50
54
  static add(id, error) {
51
55
  // Recupera l'ultimo stato (Map)
52
- const oldMap = this.currentValue;
56
+ const oldMap = UniErrorManager.currentValue;
57
+ console.log(oldMap);
53
58
  // Tenta di recuperare l'oggetto corrente
54
59
  const oldItem = oldMap.get(id);
55
- // Crea il nuovo oggetto
60
+ // Crea il nuovo oggetto aggiornando contatore e portando il timestamp al momento attuale
56
61
  const newItemMap = {
57
62
  ...error,
58
63
  count: oldItem ? oldItem.count + 1 : 1,
64
+ timestamp: new Date(),
59
65
  };
60
66
  // Crea una nuova istanza della Map
61
67
  const newMap = new Map(oldMap);
62
68
  newMap.set(id, newItemMap);
63
69
  // Aggiorna il nuovo stato notificando l'observer
64
- this.store.next(newMap);
70
+ UniErrorManager.store.next(newMap);
71
+ console.log(newMap);
65
72
  }
66
73
  /**
67
74
  * Rimuove un errore tramite ID
68
75
  */
69
76
  static remove(id) {
70
77
  // Recupera l'ultimo stato (Map)
71
- const oldMap = this.currentValue;
78
+ const oldMap = UniErrorManager.currentValue;
79
+ console.log(oldMap);
72
80
  // Controllo: se non è presente l'item allora termina
73
81
  if (!oldMap.has(id))
74
82
  return;
@@ -76,7 +84,8 @@ class UniErrorManager {
76
84
  const newMap = new Map(oldMap);
77
85
  newMap.delete(id);
78
86
  // Aggiorna il nuovo stato notificando l'observer
79
- this.store.next(newMap);
87
+ UniErrorManager.store.next(newMap);
88
+ console.log(newMap);
80
89
  }
81
90
  /**
82
91
  * Svuota completamente la lista degli errori
@@ -85,7 +94,7 @@ class UniErrorManager {
85
94
  // Crea una nuova istanza della Map
86
95
  const newMap = new Map();
87
96
  // Aggiorna il nuovo stato notificando l'observer
88
- this.store.next(newMap);
97
+ UniErrorManager.store.next(newMap);
89
98
  }
90
99
  }
91
100
 
@@ -1 +1 @@
1
- {"version":3,"file":"uni-manager.mjs","sources":["../../../projects/uni-manager/error/manager.ts","../../../projects/uni-manager/file/manager.ts","../../../projects/uni-manager/http/enum.ts","../../../projects/uni-manager/http/handler.ts","../../../projects/uni-manager/http/core.ts","../../../projects/uni-manager/http/execute.ts","../../../projects/uni-manager/http/util.ts","../../../projects/uni-manager/http/manager.ts","../../../projects/uni-manager/locale/manager.ts","../../../projects/uni-manager/toast/manager.ts","../../../projects/uni-manager/type/date.manager.ts","../../../projects/uni-manager/type/number.manager.ts","../../../projects/uni-manager/type/string.manager.ts","../../../projects/uni-manager/public-api.ts","../../../projects/uni-manager/uni-manager.ts"],"sourcesContent":["import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';\r\nimport { Observable } from 'rxjs/internal/Observable';\r\nimport { map } from 'rxjs/internal/operators/map';\r\nimport type { IUniFeError } from 'uni-error/fe';\r\nimport type { IUniHttpError } from 'uni-error/http';\r\n\r\nexport class UniErrorManager {\r\n /* ------------------------------------------------------------------------------- */\r\n /* --------------------------------- Metodi: get --------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Restituisce se lo store ha chiamate in attesa di risposta o meno */\r\n public static get errors$(): Observable<({ id: string } & (IUniFeError | IUniHttpError))[]> {\r\n return this.store$.pipe(\r\n map((x) => Array.from(x.entries(), ([id, error]) => ({ ...error, id }))),\r\n // distinctUntilChanged((prev, curr) => {\r\n // if (prev.length !== curr.length) return false;\r\n // return prev.every(\r\n // (err, index) => err.id === curr[index].id && err.count === curr[index].count,\r\n // );\r\n // }),\r\n );\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* ------------------------------------ Store ------------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Store privato (Subject) */\r\n private static store = new BehaviorSubject<Map<string, IUniFeError | IUniHttpError>>(new Map());\r\n\r\n /** Store pubblico (Observable) */\r\n public static store$: Observable<Map<string, IUniFeError | IUniHttpError>> =\r\n this.store.asObservable();\r\n\r\n /** Ottiene lo stato attuale della Map senza dover sottoscrivere l'observable */\r\n public static get currentValue(): Map<string, IUniFeError | IUniHttpError> {\r\n return this.store.getValue();\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: store -------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Aggiunge o aggiorna un errore nello store.\r\n * Se l'errore esiste già (stesso ID), incrementa il contatore 'count'.\r\n */\r\n public static add(id: string, error: IUniHttpError | IUniFeError): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = this.currentValue;\r\n\r\n // Tenta di recuperare l'oggetto corrente\r\n const oldItem = oldMap.get(id);\r\n\r\n // Crea il nuovo oggetto\r\n const newItemMap: IUniFeError | IUniHttpError = {\r\n ...error,\r\n count: oldItem ? oldItem.count + 1 : 1,\r\n };\r\n\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map(oldMap);\r\n newMap.set(id, newItemMap);\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n this.store.next(newMap);\r\n }\r\n\r\n /**\r\n * Rimuove un errore tramite ID\r\n */\r\n public static remove(id: string): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = this.currentValue;\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n if (!oldMap.has(id)) return;\r\n\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map(oldMap);\r\n newMap.delete(id);\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n this.store.next(newMap);\r\n }\r\n\r\n /**\r\n * Svuota completamente la lista degli errori\r\n */\r\n public static removeAll(): void {\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map();\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n this.store.next(newMap);\r\n }\r\n}\r\n","import type { FileDatasource } from './model';\r\n\r\nexport class UniFileManager {\r\n /**\r\n * Apre un file (es. PDF, immagine) in una nuova scheda del browser\r\n * Il contenuto viene caricato all'interno di un iframe per garantire compatibilità di visualizzazione\r\n */\r\n public static openInNewTab(data: FileDatasource | undefined): void {\r\n if (!data || !data.url) return;\r\n\r\n const newWindow = window.open('', '_blank');\r\n if (!newWindow) return;\r\n\r\n newWindow.document.title = data.name;\r\n\r\n // Crea l'iframe e lo aggiunge al body della nuova finestra\r\n const iframe = this.createIframe(newWindow.document, data.url, '100%', '100%');\r\n newWindow.document.body.style.margin = '0';\r\n newWindow.document.body.append(iframe);\r\n\r\n // Rimuove l'oggetto URL dalla memoria dopo un tempo congruo per il caricamento\r\n setTimeout(() => URL.revokeObjectURL(data.url), 3000);\r\n }\r\n\r\n /**\r\n * Stampa un file aprendo il dialogo di stampa nativo del sistema\r\n * Utilizza un iframe invisibile per non interrompere la navigazione\r\n */\r\n public static openInPrintPreview(data: FileDatasource | undefined): void {\r\n if (!data || !data.url) return;\r\n\r\n // Crea l'iframe come elemento fisso e nascosto (dimensioni zero)\r\n const iframe = this.createIframe(document, data.url, '0', '0');\r\n iframe.style.position = 'fixed';\r\n iframe.style.bottom = '0';\r\n document.body.append(iframe);\r\n\r\n // Attende il completamento del caricamento del file nell'iframe\r\n iframe.addEventListener('load', (): void => {\r\n // Attesa supplementare per consentire il rendering del PDF\r\n setTimeout(() => {\r\n iframe.contentWindow?.focus();\r\n iframe.contentWindow?.print();\r\n\r\n // Rimozione dell'iframe dal DOM e pulizia della memoria\r\n setTimeout(() => {\r\n iframe.remove();\r\n URL.revokeObjectURL(data.url);\r\n }, 1000);\r\n }, 1000);\r\n });\r\n }\r\n\r\n /**\r\n * Scarica un file localmente sul dispositivo dell'utente\r\n */\r\n public static download(data: FileDatasource | undefined): void {\r\n if (!data || !data.url) return;\r\n\r\n const link = document.createElement('a');\r\n link.href = data.url;\r\n\r\n // Specifica il nome con cui il file verrà salvato\r\n link.download = data.name;\r\n\r\n // Opzionale: assicura che il link non sia visibile\r\n link.style.display = 'none';\r\n\r\n document.body.append(link);\r\n link.click();\r\n\r\n // Pulizia: rimuove l'elemento e revoca l'URL\r\n setTimeout(() => {\r\n link.remove();\r\n URL.revokeObjectURL(data.url);\r\n }, 100);\r\n }\r\n\r\n /* ----------------------------- Utils ----------------------------- */\r\n private static createIframe(\r\n doc: Document,\r\n url: string,\r\n width: string,\r\n height: string,\r\n ): HTMLIFrameElement {\r\n const iframe = doc.createElement('iframe');\r\n iframe.src = url;\r\n iframe.style.width = width;\r\n iframe.style.height = height;\r\n iframe.style.border = 'none';\r\n return iframe;\r\n }\r\n}\r\n","export enum MapOperator {\r\n\t/** Cancella la precedente richiesta, mantiene solo l’ultima */\r\n\tSWITCH_MAP,\r\n\r\n\t/** Ignora nuovi valori finché la corrente non finisce */\r\n\tEXHAUST_MAP,\r\n\r\n\t/** Mette le richieste in coda, le esegue una alla volta */\r\n\tCONCAT_MAP,\r\n\r\n\t/** Esegue tutte le richieste in parallelo, ordine non garantito */\r\n\tMERGE_MAP\r\n}\r\n\r\nexport enum PollingErrorMode {\r\n\t/** Salta questa iterazione emettendo un undefined. Il polling continua al tick successivo. */\r\n\tIGNORE,\r\n\r\n\t/** Salta questa iterazione senza emettere valori. Il polling continua al tick successivo. */\r\n\tSKIP,\r\n\r\n\t/** Interrompe il polling propagando l'errore. */\r\n\tSTOP,\r\n\r\n\t/** Ignora l'errore, lo salva (es. per UI), e continua il polling. Emette `undefined`. */\r\n\tIGNORE_WITH_ERROR\r\n}\r\n\r\nexport enum EmitValueMode {\r\n\t/** Aggiorna lo stato solo se arrivano dati nuovi (distinct) */\r\n\tON_NEW_DATA,\r\n\r\n\t/** Aggiorna lo stato ad ogni chiamata, anche se i dati sono uguali */\r\n\tEVERY_TIME\r\n}\r\n","import { Observable } from 'rxjs/internal/Observable';\r\nimport { EMPTY } from 'rxjs/internal/observable/empty';\r\nimport { of } from 'rxjs/internal/observable/of';\r\nimport { throwError } from 'rxjs/internal/observable/throwError';\r\nimport { concatMap } from 'rxjs/internal/operators/concatMap';\r\nimport { exhaustMap } from 'rxjs/internal/operators/exhaustMap';\r\nimport { mergeMap } from 'rxjs/internal/operators/mergeMap';\r\nimport { switchMap } from 'rxjs/internal/operators/switchMap';\r\nimport { OperatorFunction } from 'rxjs/internal/types';\r\nimport { UniHttpError } from 'uni-error/http';\r\nimport { UniErrorManager } from 'uni-manager/error';\r\n\r\nimport { MapOperator, PollingErrorMode } from './enum';\r\n\r\nexport function operatorHandler<T>(\r\n operator: MapOperator,\r\n): (\r\n project: (value: number) => Observable<T | undefined>,\r\n) => OperatorFunction<number, T | undefined> {\r\n // Gestione della concorrenza in base al parametro\r\n switch (operator) {\r\n case MapOperator.EXHAUST_MAP: {\r\n return (project) => exhaustMap(project);\r\n }\r\n case MapOperator.CONCAT_MAP: {\r\n return (project) => concatMap(project);\r\n }\r\n case MapOperator.MERGE_MAP: {\r\n return (project) => mergeMap(project);\r\n }\r\n case MapOperator.SWITCH_MAP: {\r\n return (project) => switchMap(project);\r\n }\r\n }\r\n}\r\n\r\nexport function errorHandler(\r\n ref: string,\r\n err: unknown,\r\n errorMode: PollingErrorMode,\r\n): Observable<never> {\r\n // Controllo: sia effettivamente un errore di tipo 'UniHttpError'\r\n if (err instanceof UniHttpError) {\r\n // Aggiunge errore al manager\r\n UniErrorManager.add(ref, err);\r\n\r\n switch (errorMode) {\r\n case PollingErrorMode.IGNORE: {\r\n return of();\r\n }\r\n case PollingErrorMode.SKIP: {\r\n return EMPTY;\r\n }\r\n case PollingErrorMode.IGNORE_WITH_ERROR: {\r\n UniErrorManager.add(ref, err);\r\n return of();\r\n }\r\n case PollingErrorMode.STOP: {\r\n UniErrorManager.add(ref, err);\r\n return throwError(() => err);\r\n }\r\n }\r\n } else {\r\n return throwError(() => err);\r\n }\r\n}\r\n","import isEqual from 'lodash-es/isEqual';\r\nimport { Observable } from 'rxjs/internal/Observable';\r\nimport { defer } from 'rxjs/internal/observable/defer';\r\nimport { from } from 'rxjs/internal/observable/from';\r\nimport { timer } from 'rxjs/internal/observable/timer';\r\nimport { catchError } from 'rxjs/internal/operators/catchError';\r\nimport { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged';\r\nimport { finalize } from 'rxjs/internal/operators/finalize';\r\nimport { tap } from 'rxjs/internal/operators/tap';\r\nimport { UniErrorManager } from 'uni-manager/error';\r\nimport { UniToastManager } from 'uni-manager/toast';\r\n\r\nimport { EmitValueMode, MapOperator, PollingErrorMode } from './enum';\r\nimport { errorHandler, operatorHandler } from './handler';\r\nimport { UniHttpManager } from './manager';\r\nimport type { HttpConfig, HttpConfigPolling, HttpRef } from './model';\r\n\r\n/* ------------------------------------------------------------------------------- */\r\n/* -------------------------------- Funzioni Core RxJS -------------------------- */\r\n/* ------------------------------------------------------------------------------- */\r\n/**\r\n * Gestisce l'esecuzione e il ciclo di vita di una singola richiesta HTTP.\r\n * Si occupa della registrazione della reference, della gestione dei loader, dei toast di successo e dell'intercettazione degli errori.\r\n */\r\nexport function http$<T>(\r\n url: URL,\r\n refType: HttpRef['type'],\r\n config: HttpConfig<T>,\r\n promiseFactory: () => Promise<T | undefined>,\r\n): Observable<T | undefined> {\r\n /* Recupero configurazione */\r\n const { ref, toast, hasLoader } = config;\r\n\r\n return defer(() => {\r\n const http$ = from(promiseFactory());\r\n return http$.pipe(\r\n tap({\r\n subscribe: () => {\r\n /* Creazione reference */\r\n add(ref, url, refType);\r\n\r\n /* Incrementa per il loader */\r\n if (hasLoader !== false) {\r\n updateIsLoading(ref, 1);\r\n }\r\n },\r\n unsubscribe: () => {\r\n /* Rimozione reference */\r\n remove(ref);\r\n },\r\n next: (res) => {\r\n /* Mostra toast (se presente) */\r\n if (toast) {\r\n UniToastManager.showHttp(toast, res);\r\n }\r\n },\r\n }),\r\n catchError((err) => {\r\n // Aggiorna la ref nella map\r\n updateHasError(ref, true);\r\n\r\n /* Gestione errore */\r\n return errorHandler(ref, err, PollingErrorMode.STOP);\r\n }),\r\n finalize(() => {\r\n /* Decrementa per il loader */\r\n if (hasLoader !== false) {\r\n updateIsLoading(ref, -1);\r\n }\r\n }),\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Avvia e coordina un ciclo di polling a intervalli regolari.\r\n * Gestisce la concorrenza tramite operatori RxJS configurabili, la rimozione dei popup, di errore nelle iterazioni successive e i comportamenti custom al primo avvio.\r\n */\r\nexport function httpPolling$<T>(\r\n url: URL,\r\n config: HttpConfigPolling<T>,\r\n promiseFactory: () => Promise<T | undefined>,\r\n): Observable<T | undefined> {\r\n /* Recupero configurazione */\r\n const {\r\n interval,\r\n ref,\r\n operator = MapOperator.SWITCH_MAP,\r\n errorMode = PollingErrorMode.STOP,\r\n emitValueMode = EmitValueMode.ON_NEW_DATA,\r\n firstIteration,\r\n } = config;\r\n\r\n const timer$ = timer(0, interval);\r\n const source$ = timer$.pipe(\r\n tap({\r\n subscribe: () => {\r\n /* Creazione reference */\r\n add(ref, url, 'polling');\r\n },\r\n unsubscribe: () => {\r\n /* Rimozione reference */\r\n remove(ref);\r\n },\r\n }),\r\n operatorHandler<T>(operator)((index) => {\r\n /* Incrementa per il loader */\r\n if (index === 0 && firstIteration?.hasLoader !== false) {\r\n updateIsLoading(ref, 1);\r\n }\r\n\r\n return defer(() => {\r\n const http$ = from(promiseFactory());\r\n return http$.pipe(\r\n tap((res) => {\r\n /* Meccanismo di ripristino automatico: se il polling torna in salute, cancella l'errore dallo store e nasconde i relativi messaggi a schermo */\r\n if (errorMode === PollingErrorMode.IGNORE_WITH_ERROR) {\r\n updateHasError(ref, false);\r\n UniErrorManager.remove(ref);\r\n }\r\n\r\n /* Prima risposta */\r\n if (index === 0 && firstIteration?.toast) {\r\n UniToastManager.showHttp(firstIteration.toast, res);\r\n }\r\n }),\r\n catchError((err) => {\r\n // Aggiorna la ref nella map\r\n updateHasError(ref, true);\r\n\r\n /* Gestione errore */\r\n return errorHandler(ref, err, errorMode);\r\n }),\r\n finalize(() => {\r\n /* Decrementa per il loader */\r\n if (index === 0 && firstIteration?.hasLoader !== false) {\r\n updateIsLoading(ref, -1);\r\n }\r\n }),\r\n );\r\n });\r\n }),\r\n );\r\n\r\n return emitValueMode === EmitValueMode.ON_NEW_DATA\r\n ? source$.pipe(distinctUntilChanged((prev, cur) => isEqual(prev, cur)))\r\n : source$;\r\n}\r\n\r\n/* ------------------------------------------------------------------------------- */\r\n/* ------------------------------------ Utils ------------------------------------ */\r\n/* ------------------------------------------------------------------------------- */\r\n/**\r\n * Aggiunge una nuova ref nello store solo se non è già presente.\r\n * Se l'ID esiste già, l'operazione viene interrotta per preservare il dato originale.\r\n */\r\nfunction add(id: string, url: URL, type: HttpRef['type']): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = UniHttpManager.currentValue;\r\n\r\n // Controllo: se è presente l'item allora termina\r\n if (oldMap.get(id)) return;\r\n\r\n // Crea il nuovo oggetto\r\n const newItemMap: HttpRef = {\r\n type,\r\n lineId: undefined,\r\n url,\r\n hasError: false,\r\n pendingCount: 0,\r\n };\r\n\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map(oldMap);\r\n newMap.set(id, newItemMap);\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n UniHttpManager.store.next(newMap);\r\n}\r\n\r\n/**\r\n * Rimuove un http ref tramite ID\r\n */\r\nfunction remove(id: string): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = UniHttpManager.currentValue;\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n if (!oldMap.has(id)) return;\r\n\r\n // Aggiorna store\r\n const newMap = new Map(oldMap);\r\n newMap.delete(id);\r\n UniHttpManager.store.next(newMap);\r\n}\r\n\r\n/**\r\n * Aggiorna il contatore delle chiamate pendenti per una specifica ref.\r\n * Incrementa o decrementa 'pendingCount' garantendo che non scenda mai sotto lo zero.\r\n * Se la ref non esiste, l'operazione viene ignorata.\r\n */\r\nfunction updateIsLoading(id: string, delta: -1 | 1): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = UniHttpManager.currentValue;\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n const oldItem = oldMap.get(id);\r\n if (!oldItem) return;\r\n\r\n // Aggiorna l'oggetto\r\n const newItemMap: HttpRef = {\r\n ...oldItem,\r\n pendingCount: Math.max(0, oldItem.pendingCount + delta),\r\n };\r\n\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map(oldMap);\r\n newMap.set(id, newItemMap);\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n UniHttpManager.store.next(newMap);\r\n}\r\n\r\n/**\r\n * Aggiorna lo stato di errore per una specifica ref.\r\n * Se il valore di 'hasError' è identico a quello attuale o se la ref non esiste,\r\n * l'operazione viene interrotta per evitare aggiornamenti inutili.\r\n */\r\nfunction updateHasError(id: string, hasError: boolean): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = UniHttpManager.currentValue;\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n const oldItem = oldMap.get(id);\r\n if (!oldItem) return;\r\n\r\n // Controllo: se con lo stesso valore, salta\r\n if (oldItem.hasError === hasError) return;\r\n\r\n // Aggiorna l'oggetto\r\n const newItemMap: HttpRef = { ...oldItem, hasError };\r\n\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map(oldMap);\r\n newMap.set(id, newItemMap);\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n UniHttpManager.store.next(newMap);\r\n}\r\n","import { HttpException, isHttpException, UniHttpError } from 'uni-error/http';\r\nimport { FileDatasource } from 'uni-manager/file';\r\n\r\nasync function execute(url: URL, init?: RequestInit): Promise<Response | undefined> {\r\n try {\r\n /* Esecuzione della richiesta HTTP nativa */\r\n const res = await fetch(url, init);\r\n\r\n /* Gestione dello stato 204: assenza di contenuto legittima */\r\n if (res.status === 204) {\r\n return undefined;\r\n }\r\n\r\n /*Gestione ok HTTP: risposta ricevuta dal server con stato valido */\r\n if (res.ok) {\r\n return res;\r\n }\r\n\r\n /* Gestione Errore HTTP: risposta ricevuta dal server ma con stato non valido */\r\n let httpErrorPayload: unknown;\r\n try {\r\n /* Clonazione della risposta per l'ispezione del payload senza consumare lo stream originale */\r\n const resClone = res.clone();\r\n\r\n /* Recupero se è un json */\r\n const contentType = res.headers.get('content-type') ?? '';\r\n const isJson = contentType.startsWith('application/json');\r\n\r\n /* Estrazione del corpo dell'errore in base al formato rilevato */\r\n httpErrorPayload = isJson ? await resClone.json() : await resClone.text();\r\n } catch {\r\n /* Fallback in caso di fallimento della clonazione o del parsing del testo */\r\n httpErrorPayload = `Failed to parse error response body (Status: ${res.status})`;\r\n }\r\n\r\n // Controllo: se il payload estratto è di tipo HttpException (.NET)\r\n if (isHttpException(httpErrorPayload)) {\r\n // const type = httpErrorPayload.isBe ? 'be' : 'ice';\r\n throw new UniHttpError('be', res.status, url, httpErrorPayload);\r\n }\r\n\r\n // Fallback per errori di infrastruttura (es. pagine HTML di IIS/Nginx, 404, 502)\r\n const errorTracker = new Error(res.statusText || `HTTP Error ${res.status}`);\r\n const fallbackException: HttpException = {\r\n message:\r\n typeof httpErrorPayload === 'string' && httpErrorPayload\r\n ? httpErrorPayload\r\n : errorTracker.message,\r\n type: 'InfrastructureError',\r\n stackTrace: errorTracker.stack ?? '',\r\n isBe: true,\r\n };\r\n throw new UniHttpError('server', res.status, url, fallbackException);\r\n } catch (error: unknown) {\r\n // Fallback per errori di rete locale (es. assenza di linea, DNS fallito)\r\n if (error instanceof TypeError) {\r\n const fallbackNetworkException: HttpException = {\r\n message: error.message,\r\n type: error.name || 'NetworkError',\r\n stackTrace: error.stack ?? '',\r\n isBe: true,\r\n };\r\n throw new UniHttpError('network', -1, url, fallbackNetworkException);\r\n }\r\n\r\n // Rilancio diretto per istanze di UniHttpError o eccezioni già gestite\r\n throw error;\r\n }\r\n}\r\n\r\nexport async function executeHttp<T>(url: URL, init?: RequestInit): Promise<T | undefined> {\r\n /* Esegue la chiamata HTTP e restituisce il corpo decodificato come JSON */\r\n const res = await execute(url, init);\r\n if (!res) return undefined;\r\n\r\n /* Estrae il contenuto come testo */\r\n const text = await res.text();\r\n\r\n /* Controllo: se il testo è vuoto (''), ritorna undefined */\r\n if (!text || text.trim().length === 0) {\r\n return undefined;\r\n }\r\n\r\n /* Parsa manualmente il testo, dato che lo stream è stato già letto */\r\n return JSON.parse(text) as T;\r\n}\r\n\r\nexport async function executeBlob(\r\n url: URL,\r\n init?: RequestInit,\r\n): Promise<FileDatasource | undefined> {\r\n /* Esegue la chiamata HTTP */\r\n const res = await execute(url, init);\r\n if (!res) return undefined;\r\n\r\n /* Estrae il contenuto come Blob direttamente */\r\n const blob = await res.blob();\r\n\r\n /* Controllo: se il blob è vuoto (0 byte), ritorna undefined */\r\n if (blob.size === 0) {\r\n return undefined;\r\n }\r\n\r\n /* Estrae il nome del file dall'header */\r\n const disposition = res.headers.get('Content-Disposition');\r\n let fileName = 'download.pdf'; // Fallback di default\r\n if (disposition) {\r\n const matches = /filename[^;=\\n]*=((['\"]).*?\\2|[^;\\n]*)/.exec(disposition);\r\n if (!!matches && matches[1]) {\r\n fileName = matches[1].replaceAll(/['\"]/g, '');\r\n }\r\n }\r\n\r\n /* Genera l'URL temporaneo dal blob */\r\n const fileUrl = URL.createObjectURL(blob);\r\n\r\n return { url: fileUrl, name: fileName };\r\n}\r\n","import { UniTypeDateManager } from 'uni-manager/type';\r\nimport type { HttpBody, HttpConfig } from './model';\r\n\r\n/**\r\n * Costruisce un URL completo per l'API partendo dai parametri di configurazione.\r\n */\r\nexport function getUrl<T>(hostname: string, port: number, config: HttpConfig<T>): URL {\r\n const { pathParams, path, hasApiPrefix } = config;\r\n\r\n // Costruzione url\r\n const prefix = hasApiPrefix === false ? '' : 'api';\r\n const cleanPath = path.startsWith('/') ? path.slice(1) : path;\r\n const pathFixed = prefix ? `${prefix}/${cleanPath}` : cleanPath;\r\n const url = new URL(pathFixed, `http://${hostname}:${port}`);\r\n\r\n if (pathParams) {\r\n // Regex per intercettare stringhe in formato ISO string\r\n const isoDateRegex = /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})?)?$/;\r\n\r\n for (const [key, rawValue] of Object.entries(pathParams)) {\r\n if (rawValue === undefined || rawValue === null) {\r\n continue;\r\n }\r\n\r\n // Conversione in array per usare un solo ciclo\r\n const valuesArray = Array.isArray(rawValue) ? rawValue : [rawValue];\r\n\r\n for (const item of valuesArray) {\r\n if (item === undefined || item === null) {\r\n continue;\r\n }\r\n\r\n let formattedValue: string;\r\n\r\n // Caso: Date nativo\r\n if (item instanceof Date) {\r\n formattedValue = UniTypeDateManager.toYYYYMMDD(item);\r\n }\r\n // Caso: Date formato ISO string\r\n else if (typeof item === 'string' && isoDateRegex.test(item)) {\r\n const parsedDate = new Date(item);\r\n formattedValue = Number.isNaN(parsedDate.getTime())\r\n ? item\r\n : UniTypeDateManager.toYYYYMMDD(parsedDate);\r\n }\r\n // Default\r\n else {\r\n formattedValue = String(item);\r\n }\r\n\r\n url.searchParams.append(key, formattedValue);\r\n }\r\n }\r\n }\r\n\r\n return url;\r\n}\r\n\r\n/**\r\n * Normalizza i valori del body cosi da sistemare le incongruenze tra ui e db\r\n */\r\nexport function normalizeHttpBody<T extends HttpBody>(body: T, isRoot = true): T {\r\n // PRIMITIVI GENERICI\r\n // Tipi gestiti: null, undefined, number, boolean, symbol, bigint, string\r\n if (body === null || typeof body !== 'object') {\r\n // Sotto-gestione specifica per il tipo: string\r\n if (typeof body === 'string') {\r\n return body.trim() as T;\r\n }\r\n return body;\r\n }\r\n\r\n // DATE\r\n // Tipi gestiti: Date\r\n // Formattazione esplicita manuale in YYYY-MM-DD\r\n if (body instanceof Date) {\r\n const year = body.getFullYear();\r\n const month = String(body.getMonth() + 1).padStart(2, '0');\r\n const day = String(body.getDate()).padStart(2, '0');\r\n return `${year}-${month}-${day}` as unknown as T;\r\n }\r\n\r\n // STRUTTURE DATI ITERABILI\r\n // Tipi gestiti: Array (qualsiasi array, es. string[], number[], Object[])\r\n // Se è un array, viene mappato ricorsivamente ogni singolo elemento al suo interno (passando isRoot = false perché gli elementi dell'array non sono l'oggetto root principale)\r\n if (Array.isArray(body)) {\r\n return body.map((item) => normalizeHttpBody(item, false)) as unknown as T;\r\n }\r\n\r\n // OGGETTI\r\n // Tipi gestiti: Record<string, any>, generici oggetti JavaScript ({ })\r\n // Rimuove chiave 'id' al primo livello e prosegue ricorsivamente\r\n const entries = Object.entries(body)\r\n .filter(([key]) => !(isRoot && key.toLowerCase() === 'id'))\r\n .map(([key, value]) => [key, normalizeHttpBody(value, false)]);\r\n\r\n // Ricostruisce l'oggetto normalizzato\r\n return Object.fromEntries(entries) as T;\r\n}\r\n","import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';\r\nimport { Observable } from 'rxjs/internal/Observable';\r\nimport { map } from 'rxjs/internal/operators/map';\r\nimport { tap } from 'rxjs/internal/operators/tap';\r\nimport type { FileDatasource } from 'uni-manager/file';\r\nimport { ToastConfig, UniToastManager } from 'uni-manager/toast';\r\n\r\nimport { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged';\r\nimport { http$, httpPolling$ } from './core';\r\nimport { executeBlob, executeHttp } from './execute';\r\nimport type { HttpBody, HttpConfig, HttpConfigPolling, HttpRef } from './model';\r\nimport { getUrl, normalizeHttpBody } from './util';\r\n\r\nconst CONFIG_TOAST_DEFAULT: ToastConfig = {\r\n type: 'success',\r\n label: 'OperationCompleted',\r\n};\r\n\r\nexport class UniHttpManager {\r\n /* ------------------------------------------------------------------------------- */\r\n /* ----------------------------------- Config ------------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Hostname del server (es. 'api.example.com' o 'localhost') */\r\n private static hostname: string;\r\n\r\n /** Porta del server su cui effettuare le chiamate (es. 80, 443 o 3000) */\r\n private static port: number;\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* --------------------------------- Metodi: get --------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Restituisce se lo store ha chiamate in attesa di risposta o meno */\r\n public static get hasWaitingRequests$(): Observable<boolean> {\r\n return this.store$.pipe(\r\n map((requestMap) => {\r\n for (const request of requestMap.values()) {\r\n if (request.pendingCount > 0) return true;\r\n }\r\n return false;\r\n }),\r\n distinctUntilChanged(),\r\n );\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* ------------------------------------ Store ------------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Store privato (Subject) */\r\n public static store = new BehaviorSubject<Map<string, HttpRef>>(new Map());\r\n\r\n /** Store pubblico (Observable) */\r\n public static store$: Observable<Map<string, HttpRef>> = this.store.asObservable();\r\n\r\n /** Ottiene lo stato attuale della Map senza dover sottoscrivere l'observable */\r\n public static get currentValue(): Map<string, HttpRef> {\r\n return this.store.getValue();\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: setup -------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Inizializza la configurazione di rete del manager.\r\n * Deve essere chiamato prima di effettuare qualsiasi richiesta HTTP.\r\n */\r\n public static setup(hostname: string, port: number): void {\r\n this.hostname = hostname;\r\n this.port = port;\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: CRUD --------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /*\r\n * Esegue una singola richiesta HTTP GET.\r\n * Utilizza il path configurato per costruire l'URL completo e restituisce un Observable del risultato.\r\n */\r\n public static read$<T>(config: HttpConfig<T>): Observable<T | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'GET',\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return http$(url, 'one', config, () => executeHttp<T>(url, initCustom)).pipe(\r\n tap((res) => {\r\n if (Array.isArray(res) && config.toast === undefined) {\r\n UniToastManager.show({\r\n label: 'ItemsFound',\r\n params: { count: res.length },\r\n });\r\n }\r\n }),\r\n );\r\n }\r\n\r\n /**\r\n * Esegue una richiesta HTTP POST inviando un payload JSON nel corpo della richiesta.\r\n * Imposta automaticamente l'header 'Content-Type' come 'application/json'.\r\n */\r\n public static create$<T>(config: HttpConfig<T>, body: HttpBody): Observable<T | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n ...config.init?.headers,\r\n },\r\n body: JSON.stringify(normalizeHttpBody(body)),\r\n };\r\n\r\n /* Config custom (toast di default) */\r\n const configCustom: HttpConfig<T> = {\r\n ...config,\r\n toast: config.hasToast === false ? undefined : (config.toast ?? CONFIG_TOAST_DEFAULT),\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return http$(url, 'one', configCustom, () => executeHttp<T>(url, initCustom));\r\n }\r\n\r\n /**\r\n * Esegue una singola richiesta HTTP PUT per aggiornare una risorsa esistente.\r\n */\r\n public static update$<T>(config: HttpConfig<T>, body?: HttpBody): Observable<T | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = { ...config.init, method: 'PUT' };\r\n if (body !== undefined) {\r\n initCustom.headers = {\r\n 'Content-Type': 'application/json',\r\n ...config.init?.headers,\r\n };\r\n initCustom.body = JSON.stringify(normalizeHttpBody(body));\r\n }\r\n\r\n /* Config custom (toast di default) */\r\n const configCustom: HttpConfig<T> = {\r\n ...config,\r\n toast: config.hasToast === false ? undefined : (config.toast ?? CONFIG_TOAST_DEFAULT),\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return http$(url, 'one', configCustom, () => executeHttp<T>(url, initCustom));\r\n }\r\n\r\n /**\r\n * Esegue una richiesta HTTP DELETE per rimuovere una risorsa.\r\n * Utilizza il path configurato per costruire l'URL completo e restituisce un Observable del risultato.\r\n */\r\n public static delete$<T>(config: HttpConfig<T>): Observable<T | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'DELETE',\r\n };\r\n\r\n /* Config custom (toast di default) */\r\n const configCustom: HttpConfig<T> = {\r\n ...config,\r\n toast: config.hasToast === false ? undefined : (config.toast ?? CONFIG_TOAST_DEFAULT),\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return http$(url, 'one', configCustom, () => executeHttp<T>(url, initCustom));\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------- Metodi: CRUD file/image ---------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Recupera un'immagine tramite una richiesta GET e la trasforma in un formato gestibile (es. Blob o Base64).\r\n * Delega la logica di conversione alla funzione executeImage.\r\n */\r\n public static readImage$(\r\n config: HttpConfig<FileDatasource>,\r\n ): Observable<FileDatasource | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'GET',\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return http$(url, 'image', config, () => executeBlob(url, initCustom));\r\n }\r\n\r\n /**\r\n * Recupera un file (es. PDF) tramite una richiesta GET e restituisce un Object URL temporaneo.\r\n * Delega la logica di conversione alla funzione executeFile.\r\n */\r\n public static readFile$(\r\n config: HttpConfig<FileDatasource>,\r\n ): Observable<FileDatasource | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'GET',\r\n };\r\n\r\n /* Config custom (toast di default) */\r\n const configCustom: HttpConfig<FileDatasource> = {\r\n ...config,\r\n toast: config.hasToast === false ? undefined : (config.toast ?? CONFIG_TOAST_DEFAULT),\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return http$(url, 'file', configCustom, () => executeBlob(url, initCustom));\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* ---------------------------- Metodi: CRUD polling ----------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Avvia un ciclo di polling basato su richieste GET.\r\n * Continua a emettere valori in base alla configurazione di intervallo definita in HttpConfigPolling.\r\n */\r\n public static readPolling$<T>(config: HttpConfigPolling<T>): Observable<T | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'GET',\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return httpPolling$(url, config, () => executeHttp<T>(url, initCustom));\r\n }\r\n\r\n /**\r\n * Avvia un ciclo di polling basato su richieste POST.\r\n * Invia il body specificato a ogni iterazione del ciclo.\r\n */\r\n public static createPolling$<T>(\r\n config: HttpConfigPolling<T>,\r\n body: HttpBody,\r\n ): Observable<T | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'POST',\r\n headers: { 'Content-Type': 'application/json' },\r\n body: JSON.stringify(body),\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return httpPolling$(url, config, () => executeHttp<T>(url, initCustom));\r\n }\r\n\r\n /**\r\n * Avvia un ciclo di polling basato su richieste PUT.\r\n */\r\n public static updatePolling$<T>(\r\n config: HttpConfigPolling<T>,\r\n body?: HttpBody,\r\n ): Observable<T | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'PUT',\r\n };\r\n if (body !== undefined) {\r\n initCustom.headers = {\r\n ...initCustom.headers,\r\n 'Content-Type': 'application/json',\r\n };\r\n initCustom.body = JSON.stringify(body);\r\n }\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return httpPolling$(url, config, () => executeHttp<T>(url, initCustom));\r\n }\r\n}\r\n","import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';\r\n\r\nexport class UniLocaleManager {\r\n /* ------------------------------------------------------------------------------- */\r\n /* ----------------------------------- Config ------------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Codice lingua corrente (es. 'it-IT', 'en-US') usato per formattare date e numeri */\r\n private static _locale = navigator.language ?? 'en-US';\r\n\r\n /** Elenco dei codici lingua supportati dall'applicazione (es. ['it-IT', 'en-US']) */\r\n private static _localesSupported: string[] = [];\r\n\r\n /** Prefisso globale applicato a tutte le chiavi di traduzione (es. 'APP_') */\r\n private static _prefix: string | undefined = undefined;\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* --------------------------------- Metodi: get --------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Restituisce il codice lingua corrente */\r\n public static get locale(): string {\r\n return this._locale;\r\n }\r\n\r\n /** Restituisce l'array contenente tutti i codici locale supportati.*/\r\n public static get localesSupported(): string[] {\r\n return this._localesSupported;\r\n }\r\n\r\n /** Restituisce solo la lingua (es. 'it') */\r\n public static get language(): string {\r\n return this._locale.split('-')[0];\r\n }\r\n\r\n /** Restituisce solo il paese (es. 'IT') */\r\n public static get region(): string {\r\n const parts = this._locale.split('-');\r\n return parts.length > 1 ? parts[1] : '';\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* ------------------------------------ Store ------------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Store privato (Subject) */\r\n public static store = new BehaviorSubject<Record<string, string>>({});\r\n\r\n /** Store pubblico (Observable) */\r\n public static store$ = this.store.asObservable();\r\n\r\n /** Ottiene il dizionario attuale senza sottoscrizione */\r\n public static get currentValue(): Record<string, string> {\r\n return this.store.getValue();\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: setup -------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Inizializza la configurazione di rete del manager.\r\n * Deve essere chiamato prima di effettuare qualsiasi richiesta HTTP.\r\n */\r\n public static setup(locale: string | null | undefined, prefix?: string): void {\r\n this._locale = locale ?? 'en-US';\r\n this._prefix = prefix;\r\n }\r\n\r\n /** Imposta l'elenco dei codici lingua supportati dall'applicazione */\r\n public static setLocalesSupported(locales: string[] | undefined): void {\r\n this._localesSupported = locales ?? [];\r\n }\r\n\r\n /**\r\n * Aggiorna lo store locale con il dizionario delle traduzioni fornito.\r\n * Se viene passato undefined, lo store viene inizializzato come oggetto vuoto.\r\n */\r\n public static setTranslations(translations: Record<string, string> | undefined): void {\r\n this.store.next(translations ?? {});\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* ----------------------------- Metodi: traduzioni ------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Traduce una label in base al dizionario caricato.\r\n * Gestisce la composizione della chiave, i parametri dinamici (interpolazione) e il fallback.\r\n */\r\n public static translate(\r\n key: string,\r\n prefix = 'lbl',\r\n params?: Record<string, string | number | Date>,\r\n ): string {\r\n if (!key) return '-';\r\n\r\n // Costruzione chiave: prefissoGlobale + prefissoLocale + LabelConInizialeMaiuscola\r\n const keyParts = key.trim().split(/(?=[A-Z])/);\r\n const rootKeyParts = keyParts.filter((p) => p.toLowerCase() !== prefix.toLowerCase());\r\n const cleanKey = rootKeyParts.length > 0 ? rootKeyParts.join('') : undefined;\r\n const capitalizedKey = cleanKey ? cleanKey.charAt(0).toUpperCase() + cleanKey.slice(1) : '';\r\n const finalKey = `${this._prefix ?? ''}${prefix}${capitalizedKey}`;\r\n\r\n // Cerca la chiave in minuscolo (standardizzazione)\r\n let translation = this.currentValue?.[finalKey.toLowerCase()];\r\n\r\n // Log e fallback se la traduzione manca\r\n if (!translation) {\r\n console.warn(`Translation missing for key: ${finalKey}`);\r\n return `🔑 ${finalKey}`;\r\n }\r\n\r\n // Interpolazione variabili\r\n if (params) {\r\n for (const [key, value] of Object.entries(params)) {\r\n const displayValue =\r\n value instanceof Date ? value.toLocaleDateString(this._locale) : String(value);\r\n\r\n translation = translation.replaceAll(`{{${key}}}`, displayValue);\r\n }\r\n }\r\n\r\n return translation;\r\n }\r\n\r\n /**\r\n * Traduce una stringa che contiene parametri separati da un carattere specifico.\r\n * Supporta ora un numero arbitrario di parametri in formato \"label/param1/param2\"\r\n * o semplicemente \"label\".\r\n */\r\n public static translateInlineParams(keyWithParams: string, splitChar: string): string {\r\n if (!keyWithParams) return '-';\r\n\r\n const [label, ...params] = keyWithParams.split(splitChar);\r\n\r\n // Se non ci sono parametri, esegui una traduzione semplice\r\n if (params.length === 0) {\r\n return this.translate(label);\r\n }\r\n\r\n // Mappa i parametri in un oggetto di interpolazione: { inlineParam0: val, inlineParam1: val, ... }\r\n const interpolationParameters: Record<string, string> = {};\r\n for (const [index, val] of params.entries()) {\r\n interpolationParameters[`param${index}`] = val;\r\n }\r\n\r\n return this.translate(label, 'lbl', interpolationParameters);\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* ------------------------------- Metodi: numeri -------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Converte un valore numerico in una stringa formattata secondo il locale impostato.\r\n * Disabilita i separatori delle migliaia e forza un numero fisso di decimali.\r\n */\r\n public static toStringNumber(value: number, decimal: number): string {\r\n return new Intl.NumberFormat(this._locale, {\r\n useGrouping: true,\r\n minimumFractionDigits: decimal,\r\n maximumFractionDigits: decimal,\r\n numberingSystem: 'latn',\r\n }).format(value);\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: date --------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Formatta una data o una stringa in base al locale corrente.\r\n * Gestisce tre modalità predefinite (date, time, full) e accetta opzioni personalizzate Intl.\r\n */\r\n public static toDate(\r\n date: string | Date,\r\n mode: 'date' | 'time' | 'full' = 'full',\r\n force?: { oldLang: string; newLocale: string },\r\n ): string {\r\n const dt = new Date(date);\r\n\r\n // Controllo: validità data\r\n if (Number.isNaN(dt.getTime())) {\r\n console.error(`[UniLocaleManager] Data non valida fornita a formatDateTime:`, date);\r\n return '';\r\n }\r\n\r\n // Controllo: locale da forzare\r\n const locale = force && this._locale.startsWith(force.oldLang) ? force.newLocale : this._locale;\r\n\r\n switch (mode) {\r\n case 'date': {\r\n return dt.toLocaleDateString(locale);\r\n }\r\n case 'time': {\r\n return dt.toLocaleTimeString(locale);\r\n }\r\n case 'full': {\r\n return dt.toLocaleString(locale);\r\n }\r\n }\r\n }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport { UniLocaleManager } from 'uni-manager/locale';\r\nimport type { IToastManager, ToastConfig, ToastHttpConfig } from './model';\r\n\r\nexport class UniToastManager {\r\n /* ------------------------------------------------------------------------------- */\r\n /* ----------------------------------- Config ------------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Riferimento interno all'istanza */\r\n private static manager: IToastManager;\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: setup -------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Inizializza il manager con una serie di operazioni\r\n */\r\n public static setup(operations: IToastManager): void {\r\n this.manager = operations;\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: show --------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Mostra un toast di successo basato su una risposta HTTP e una label di traduzione.\r\n */\r\n public static show(\r\n config: ToastConfig & {\r\n prefix?: string;\r\n suffix?: string;\r\n },\r\n ): void {\r\n /* Messaggio tradotto */\r\n const msg = UniLocaleManager.translate(config.label, 'toast', config.params);\r\n const msgFixed = `${config.prefix ?? ''}${msg}${config.suffix ?? ''}`;\r\n this.manager[config.type ?? 'info'](msgFixed, config);\r\n }\r\n\r\n /**\r\n * Mostra un toast di successo basato su una risposta HTTP e una label di traduzione.\r\n */\r\n public static showHttp<T>(config: ToastConfig & ToastHttpConfig<T>, res: T | undefined): void {\r\n const { params, resParams, formatters } = config;\r\n\r\n /* Parametri statici di base */\r\n const allParams: Record<string, any> = { ...params };\r\n\r\n if (res !== undefined && res !== null) {\r\n /* Se è un array aggiunge il parametro 'count' con la lunghezza dell'array */\r\n if (Array.isArray(res)) {\r\n allParams['count'] = res.length;\r\n } else if (typeof res === 'object' && resParams?.length) {\r\n // Se la proprietà NON esiste nella risposta, allora salta\r\n for (const resParam of resParams ?? []) {\r\n if (!(resParam in res)) continue;\r\n\r\n // Se esiste un formatter per questa chiave lo si usa, altrimenti valore grezzo\r\n const rawValue = res[resParam];\r\n allParams[resParam] = formatters?.[resParam] ? formatters[resParam](rawValue) : rawValue;\r\n }\r\n }\r\n }\r\n\r\n /* Messaggio tradotto */\r\n this.show({ ...config, params: allParams });\r\n }\r\n}\r\n","/**\r\n * Classe di utilità per la gestione e formattazione delle date.\r\n * Fornisce metodi per convertire in modo sicuro valori di tipo Date, stringa o null in formati standardizzati.\r\n */\r\nexport class UniTypeDateManager {\r\n static toYYYYMMDD(date: Date | string | null | undefined): string {\r\n if (!date) return '';\r\n\r\n const d = new Date(date);\r\n\r\n if (Number.isNaN(d.getTime())) return '';\r\n\r\n const year = d.getFullYear();\r\n const month = String(d.getMonth() + 1).padStart(2, '0');\r\n const day = String(d.getDate()).padStart(2, '0');\r\n\r\n return `${year}-${month}-${day}`;\r\n }\r\n}\r\n","/**\r\n * Utility per la gestione e formattazione di valori numerici.\r\n */\r\nexport class UniTypeNumberManager {\r\n /** Applica il padding a un numero o una stringa */\r\n static toPad(value: number | string | null | undefined, count: number, character = '0'): string {\r\n // Se il valore è null/undefined, riempiamo l'intero campo con il carattere scelto\r\n if (value === null || value === undefined) {\r\n return ''.padStart(count, character);\r\n }\r\n\r\n // Convertiamo in stringa e applichiamo il padding\r\n return value.toString().padStart(count, character);\r\n }\r\n\r\n /** Formatta un numero in una versione leggibile (es: 1000 -> 1K, 1000000 -> 1M) */\r\n static toTruncateAndAdUdm(value: number, decimalDigits = 0, maxIntegerDigits = 3): string {\r\n // Nessun limite impostato o numero inferiore alla soglia definita\r\n if (Math.abs(value) < Math.pow(10, maxIntegerDigits)) {\r\n return value.toFixed(decimalDigits);\r\n }\r\n\r\n // Definizione delle scale di riduzione per grandi numeri\r\n const scales = [\r\n { threshold: 1e12, suffix: 'T' }, // Trilioni\r\n { threshold: 1e9, suffix: 'B' }, // Miliardi\r\n { threshold: 1e6, suffix: 'M' }, // Milioni\r\n { threshold: 1e3, suffix: 'K' }, // Migliaia\r\n ];\r\n\r\n // Itera dalla scala più grande alla più piccola per trovare la soglia corretta\r\n for (const { threshold, suffix } of scales) {\r\n if (Math.abs(value) >= threshold) {\r\n const reduced = value / threshold;\r\n\r\n // parseFloat(toFixed()) rimuove gli zeri decimali superflui (es: 1.50 -> 1.5)\r\n // aggiungendo poi il relativo suffisso (K, M, B, T)\r\n return Number.parseFloat(reduced.toFixed(decimalDigits)).toString() + suffix;\r\n }\r\n }\r\n\r\n // Fallback: se il numero è grande ma non rientra nelle scale (caso raro con la logica attuale)\r\n return value.toFixed(decimalDigits);\r\n }\r\n}\r\n","/**\r\n * Utility per la manipolazione di stringhe\r\n */\r\nexport class UniTypeStringManager {\r\n /** Converte una stringa in formato lblPascalCase (es. \"user_id\" -> \"lblUserId\") */\r\n static toLabelize(key: string | null | undefined, prefix = 'lbl'): string {\r\n // Se vuoto restituisce vuoto\r\n if (!key) return '';\r\n\r\n // Pulizia chiave\r\n const fixedKey = key.trim();\r\n\r\n // Unisce il prefisso\r\n return prefix + this.toPascalCase(fixedKey);\r\n }\r\n\r\n /** Converte una stringa in PascalCase (es. \"user_id\" -> \"UserId\") */\r\n static toPascalCase(key: string | null | undefined): string {\r\n // Se vuoto restituisce vuoto\r\n if (!key) return '';\r\n\r\n // Pulizia chiave\r\n const fixedKey = key.trim();\r\n\r\n // Normalizza e pulisce\r\n const parts = this.splitString(fixedKey);\r\n if (parts.length === 0) return '';\r\n\r\n // Converte in PascalCase\r\n const pascalCased = this.toPascalCaseParts(parts);\r\n\r\n return pascalCased;\r\n }\r\n\r\n /** Converte una stringa in camelCase (es. \"user_id\" -> \"userId\") */\r\n static toCamelCase(key: string | null | undefined): string {\r\n // Se vuoto restituisce vuoto\r\n if (!key) return '';\r\n\r\n // Pulizia chiave\r\n const fixedKey = key.trim();\r\n\r\n // Normalizza e pulisce\r\n const parts = this.splitString(fixedKey);\r\n if (parts.length === 0) return '';\r\n\r\n // La prima parola resta minuscola, le successive PascalCase\r\n const first = parts[0].toLowerCase();\r\n const rest = parts.slice(1);\r\n return first + this.toPascalCaseParts(rest);\r\n }\r\n\r\n /** Capitalizza solo la prima lettera della stringa */\r\n static toCapitalize(key: string | null | undefined): string {\r\n // Se vuoto restituisce vuoto\r\n if (!key) return '';\r\n\r\n // Pulizia chiave\r\n const fixedKey = key.trim();\r\n\r\n return fixedKey.charAt(0).toUpperCase() + fixedKey.slice(1);\r\n }\r\n\r\n /** Sostituisce sotto-stringhe all'interno della stringa */\r\n static toReplace(\r\n key: string | null | undefined,\r\n values: { searchValue: string; replaceValue: string }[],\r\n ): string {\r\n // Se vuoto restituisce vuoto\r\n if (!key) return '';\r\n\r\n // Pulizia chiave\r\n let fixedKey = key.trim();\r\n\r\n for (const value of values) {\r\n fixedKey = fixedKey.replaceAll(value.searchValue, value.replaceValue);\r\n }\r\n\r\n return fixedKey;\r\n }\r\n\r\n /* ----------------- Utils ----------------- */\r\n private static splitString(key: string): string[] {\r\n return (\r\n key\r\n // Pulisce eventuali caratteri di separazione rimasti in testa (es. \"_tab_name\" -> \"tab_name\")\r\n .replace(/^[-_\\s]+/, '')\r\n\r\n // Isola il CamelCase inserendo un underscore tra minuscole e maiuscole (es. \"userId\" -> \"user_Id\")\r\n .replaceAll(/([a-z])([A-Z])/g, '$1_$2')\r\n\r\n // Isola gli acronimi attaccati a parole Normali (es. \"VARAna\" -> \"VAR_Ana\" grazie alla minuscola \"na\")\r\n .replaceAll(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')\r\n\r\n // Applica il taglio definitivo usando come riferimento i trattini, gli underscore e gli spazi\r\n .split(/[-_\\s]+/)\r\n\r\n // Rimuove dall'array finale eventuali stringhe vuote generate da separatori consecutivi\r\n .filter(Boolean)\r\n );\r\n }\r\n\r\n private static toPascalCaseParts(parts: string[]): string {\r\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()).join('');\r\n }\r\n}\r\n","/*\r\n * Public API Surface of uni-manager\r\n */\r\n\r\nexport * from './error/public-api';\r\nexport * from './file/public-api';\r\nexport * from './http/public-api';\r\nexport * from './locale/public-api';\r\nexport * from './toast/public-api';\r\nexport * from './type/public-api';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["UniErrorManager","UniToastManager","UniTypeDateManager","UniLocaleManager"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAMa,eAAe,CAAA;;;;;AAKnB,IAAA,WAAW,OAAO,GAAA;AACvB,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CACrB,GAAG,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAOzE;IACH;;;;;aAMe,IAAA,CAAA,KAAK,GAAG,IAAI,eAAe,CAA2C,IAAI,GAAG,EAAE,CAAC,CAAC;;AAGlF,IA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AAG,CAAC,IAAI,EAAE;AAE3B,QAAA,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7D;;AAGA,IAAA,OAAO,SAAS,CACd,GAA8B,EAC9B,MAAuD,EAAA;;AAGvD,QAAA,IAAI,CAAC,GAAG;AAAE,YAAA,OAAO,EAAE;;AAGnB,QAAA,IAAI,QAAQ,GAAG,GAAG,CAAC,IAAI,EAAE;AAEzB,QAAA,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;AAC1B,YAAA,QAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,YAAY,CAAC;QACvE;AAEA,QAAA,OAAO,QAAQ;IACjB;;IAGQ,OAAO,WAAW,CAAC,GAAW,EAAA;AACpC,QAAA,QACE;;AAEG,aAAA,OAAO,CAAC,UAAU,EAAE,EAAE;;AAGtB,aAAA,UAAU,CAAC,iBAAiB,EAAE,OAAO;;AAGrC,aAAA,UAAU,CAAC,uBAAuB,EAAE,OAAO;;aAG3C,KAAK,CAAC,SAAS;;AAGf,aAAA,MAAM,CAAC,OAAO,CAAC;IAEtB;IAEQ,OAAO,iBAAiB,CAAC,KAAe,EAAA;AAC9C,QAAA,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;IACjG;AACD;;ACzGD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"uni-manager.mjs","sources":["../../../projects/uni-manager/error/manager.ts","../../../projects/uni-manager/file/manager.ts","../../../projects/uni-manager/http/enum.ts","../../../projects/uni-manager/http/handler.ts","../../../projects/uni-manager/http/core.ts","../../../projects/uni-manager/http/execute.ts","../../../projects/uni-manager/http/util.ts","../../../projects/uni-manager/http/manager.ts","../../../projects/uni-manager/locale/manager.ts","../../../projects/uni-manager/toast/manager.ts","../../../projects/uni-manager/type/date.manager.ts","../../../projects/uni-manager/type/number.manager.ts","../../../projects/uni-manager/type/string.manager.ts","../../../projects/uni-manager/public-api.ts","../../../projects/uni-manager/uni-manager.ts"],"sourcesContent":["import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';\r\nimport { Observable } from 'rxjs/internal/Observable';\r\nimport { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged';\r\nimport { map } from 'rxjs/internal/operators/map';\r\nimport type { IUniFeError } from 'uni-error/fe';\r\nimport type { IUniHttpError } from 'uni-error/http';\r\n\r\nexport class UniErrorManager {\r\n /* ------------------------------------------------------------------------------- */\r\n /* --------------------------------- Metodi: get --------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Restituisce se lo store ha chiamate in attesa di risposta o meno */\r\n public static get errors$(): Observable<({ id: string } & (IUniFeError | IUniHttpError))[]> {\r\n return UniErrorManager.store$.pipe(\r\n map((x) => Array.from(x.entries(), ([id, error]) => ({ ...error, id }))),\r\n distinctUntilChanged((prev, curr) => {\r\n if (prev.length !== curr.length) return false;\r\n return prev.every(\r\n (err, index) => err.id === curr[index].id && err.count === curr[index].count,\r\n );\r\n }),\r\n );\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* ------------------------------------ Store ------------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Store privato (Subject) */\r\n private static store = new BehaviorSubject<Map<string, IUniFeError | IUniHttpError>>(new Map());\r\n\r\n /** Store pubblico (Observable) */\r\n public static store$: Observable<Map<string, IUniFeError | IUniHttpError>> =\r\n UniErrorManager.store.asObservable();\r\n\r\n /** Ottiene lo stato attuale della Map senza dover sottoscrivere l'observable */\r\n public static get currentValue(): Map<string, IUniFeError | IUniHttpError> {\r\n return UniErrorManager.store.getValue();\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: store -------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Aggiunge o aggiorna un errore nello store.\r\n * Se l'errore esiste già (stesso ID), incrementa il contatore 'count' e aggiorna il timestamp.\r\n */\r\n public static add(id: string, error: IUniHttpError | IUniFeError): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = UniErrorManager.currentValue;\r\n console.log(oldMap);\r\n\r\n // Tenta di recuperare l'oggetto corrente\r\n const oldItem = oldMap.get(id);\r\n\r\n // Crea il nuovo oggetto aggiornando contatore e portando il timestamp al momento attuale\r\n const newItemMap: IUniFeError | IUniHttpError = {\r\n ...error,\r\n count: oldItem ? oldItem.count + 1 : 1,\r\n timestamp: new Date(),\r\n };\r\n\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map(oldMap);\r\n newMap.set(id, newItemMap);\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n UniErrorManager.store.next(newMap);\r\n\r\n console.log(newMap);\r\n }\r\n\r\n /**\r\n * Rimuove un errore tramite ID\r\n */\r\n public static remove(id: string): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = UniErrorManager.currentValue;\r\n console.log(oldMap);\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n if (!oldMap.has(id)) return;\r\n\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map(oldMap);\r\n newMap.delete(id);\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n UniErrorManager.store.next(newMap);\r\n\r\n console.log(newMap);\r\n }\r\n\r\n /**\r\n * Svuota completamente la lista degli errori\r\n */\r\n public static removeAll(): void {\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map();\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n UniErrorManager.store.next(newMap);\r\n }\r\n}\r\n","import type { FileDatasource } from './model';\r\n\r\nexport class UniFileManager {\r\n /**\r\n * Apre un file (es. PDF, immagine) in una nuova scheda del browser\r\n * Il contenuto viene caricato all'interno di un iframe per garantire compatibilità di visualizzazione\r\n */\r\n public static openInNewTab(data: FileDatasource | undefined): void {\r\n if (!data || !data.url) return;\r\n\r\n const newWindow = window.open('', '_blank');\r\n if (!newWindow) return;\r\n\r\n newWindow.document.title = data.name;\r\n\r\n // Crea l'iframe e lo aggiunge al body della nuova finestra\r\n const iframe = this.createIframe(newWindow.document, data.url, '100%', '100%');\r\n newWindow.document.body.style.margin = '0';\r\n newWindow.document.body.append(iframe);\r\n\r\n // Rimuove l'oggetto URL dalla memoria dopo un tempo congruo per il caricamento\r\n setTimeout(() => URL.revokeObjectURL(data.url), 3000);\r\n }\r\n\r\n /**\r\n * Stampa un file aprendo il dialogo di stampa nativo del sistema\r\n * Utilizza un iframe invisibile per non interrompere la navigazione\r\n */\r\n public static openInPrintPreview(data: FileDatasource | undefined): void {\r\n if (!data || !data.url) return;\r\n\r\n // Crea l'iframe come elemento fisso e nascosto (dimensioni zero)\r\n const iframe = this.createIframe(document, data.url, '0', '0');\r\n iframe.style.position = 'fixed';\r\n iframe.style.bottom = '0';\r\n document.body.append(iframe);\r\n\r\n // Attende il completamento del caricamento del file nell'iframe\r\n iframe.addEventListener('load', (): void => {\r\n // Attesa supplementare per consentire il rendering del PDF\r\n setTimeout(() => {\r\n iframe.contentWindow?.focus();\r\n iframe.contentWindow?.print();\r\n\r\n // Rimozione dell'iframe dal DOM e pulizia della memoria\r\n setTimeout(() => {\r\n iframe.remove();\r\n URL.revokeObjectURL(data.url);\r\n }, 1000);\r\n }, 1000);\r\n });\r\n }\r\n\r\n /**\r\n * Scarica un file localmente sul dispositivo dell'utente\r\n */\r\n public static download(data: FileDatasource | undefined): void {\r\n if (!data || !data.url) return;\r\n\r\n const link = document.createElement('a');\r\n link.href = data.url;\r\n\r\n // Specifica il nome con cui il file verrà salvato\r\n link.download = data.name;\r\n\r\n // Opzionale: assicura che il link non sia visibile\r\n link.style.display = 'none';\r\n\r\n document.body.append(link);\r\n link.click();\r\n\r\n // Pulizia: rimuove l'elemento e revoca l'URL\r\n setTimeout(() => {\r\n link.remove();\r\n URL.revokeObjectURL(data.url);\r\n }, 100);\r\n }\r\n\r\n /* ----------------------------- Utils ----------------------------- */\r\n private static createIframe(\r\n doc: Document,\r\n url: string,\r\n width: string,\r\n height: string,\r\n ): HTMLIFrameElement {\r\n const iframe = doc.createElement('iframe');\r\n iframe.src = url;\r\n iframe.style.width = width;\r\n iframe.style.height = height;\r\n iframe.style.border = 'none';\r\n return iframe;\r\n }\r\n}\r\n","export enum MapOperator {\r\n\t/** Cancella la precedente richiesta, mantiene solo l’ultima */\r\n\tSWITCH_MAP,\r\n\r\n\t/** Ignora nuovi valori finché la corrente non finisce */\r\n\tEXHAUST_MAP,\r\n\r\n\t/** Mette le richieste in coda, le esegue una alla volta */\r\n\tCONCAT_MAP,\r\n\r\n\t/** Esegue tutte le richieste in parallelo, ordine non garantito */\r\n\tMERGE_MAP\r\n}\r\n\r\nexport enum PollingErrorMode {\r\n\t/** Salta questa iterazione emettendo un undefined. Il polling continua al tick successivo. */\r\n\tIGNORE,\r\n\r\n\t/** Salta questa iterazione senza emettere valori. Il polling continua al tick successivo. */\r\n\tSKIP,\r\n\r\n\t/** Interrompe il polling propagando l'errore. */\r\n\tSTOP,\r\n\r\n\t/** Ignora l'errore, lo salva (es. per UI), e continua il polling. Emette `undefined`. */\r\n\tIGNORE_WITH_ERROR\r\n}\r\n\r\nexport enum EmitValueMode {\r\n\t/** Aggiorna lo stato solo se arrivano dati nuovi (distinct) */\r\n\tON_NEW_DATA,\r\n\r\n\t/** Aggiorna lo stato ad ogni chiamata, anche se i dati sono uguali */\r\n\tEVERY_TIME\r\n}\r\n","import { Observable } from 'rxjs/internal/Observable';\r\nimport { EMPTY } from 'rxjs/internal/observable/empty';\r\nimport { of } from 'rxjs/internal/observable/of';\r\nimport { throwError } from 'rxjs/internal/observable/throwError';\r\nimport { concatMap } from 'rxjs/internal/operators/concatMap';\r\nimport { exhaustMap } from 'rxjs/internal/operators/exhaustMap';\r\nimport { mergeMap } from 'rxjs/internal/operators/mergeMap';\r\nimport { switchMap } from 'rxjs/internal/operators/switchMap';\r\nimport { OperatorFunction } from 'rxjs/internal/types';\r\nimport { UniHttpError } from 'uni-error/http';\r\nimport { UniErrorManager } from 'uni-manager/error';\r\n\r\nimport { MapOperator, PollingErrorMode } from './enum';\r\n\r\nexport function operatorHandler<T>(\r\n operator: MapOperator,\r\n): (\r\n project: (value: number) => Observable<T | undefined>,\r\n) => OperatorFunction<number, T | undefined> {\r\n // Gestione della concorrenza in base al parametro\r\n switch (operator) {\r\n case MapOperator.EXHAUST_MAP: {\r\n return (project) => exhaustMap(project);\r\n }\r\n case MapOperator.CONCAT_MAP: {\r\n return (project) => concatMap(project);\r\n }\r\n case MapOperator.MERGE_MAP: {\r\n return (project) => mergeMap(project);\r\n }\r\n case MapOperator.SWITCH_MAP: {\r\n return (project) => switchMap(project);\r\n }\r\n }\r\n}\r\n\r\nexport function errorHandler(\r\n ref: string,\r\n err: unknown,\r\n errorMode: PollingErrorMode,\r\n): Observable<never> {\r\n // Controllo: sia effettivamente un errore di tipo 'UniHttpError'\r\n if (err instanceof UniHttpError) {\r\n // Aggiunge errore al manager\r\n UniErrorManager.add(ref, err);\r\n\r\n switch (errorMode) {\r\n case PollingErrorMode.IGNORE: {\r\n return of();\r\n }\r\n case PollingErrorMode.SKIP: {\r\n return EMPTY;\r\n }\r\n case PollingErrorMode.IGNORE_WITH_ERROR: {\r\n UniErrorManager.add(ref, err);\r\n return of();\r\n }\r\n case PollingErrorMode.STOP: {\r\n UniErrorManager.add(ref, err);\r\n return throwError(() => err);\r\n }\r\n }\r\n } else {\r\n return throwError(() => err);\r\n }\r\n}\r\n","import isEqual from 'lodash-es/isEqual';\r\nimport { Observable } from 'rxjs/internal/Observable';\r\nimport { defer } from 'rxjs/internal/observable/defer';\r\nimport { from } from 'rxjs/internal/observable/from';\r\nimport { timer } from 'rxjs/internal/observable/timer';\r\nimport { catchError } from 'rxjs/internal/operators/catchError';\r\nimport { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged';\r\nimport { finalize } from 'rxjs/internal/operators/finalize';\r\nimport { tap } from 'rxjs/internal/operators/tap';\r\nimport { UniErrorManager } from 'uni-manager/error';\r\nimport { UniToastManager } from 'uni-manager/toast';\r\n\r\nimport { EmitValueMode, MapOperator, PollingErrorMode } from './enum';\r\nimport { errorHandler, operatorHandler } from './handler';\r\nimport { UniHttpManager } from './manager';\r\nimport type { HttpConfig, HttpConfigPolling, HttpRef } from './model';\r\n\r\n/* ------------------------------------------------------------------------------- */\r\n/* -------------------------------- Funzioni Core RxJS -------------------------- */\r\n/* ------------------------------------------------------------------------------- */\r\n/**\r\n * Gestisce l'esecuzione e il ciclo di vita di una singola richiesta HTTP.\r\n * Si occupa della registrazione della reference, della gestione dei loader, dei toast di successo e dell'intercettazione degli errori.\r\n */\r\nexport function http$<T>(\r\n url: URL,\r\n refType: HttpRef['type'],\r\n config: HttpConfig<T>,\r\n promiseFactory: () => Promise<T | undefined>,\r\n): Observable<T | undefined> {\r\n /* Recupero configurazione */\r\n const { ref, toast, hasLoader } = config;\r\n\r\n return defer(() => {\r\n const http$ = from(promiseFactory());\r\n return http$.pipe(\r\n tap({\r\n subscribe: () => {\r\n /* Creazione reference */\r\n add(ref, url, refType);\r\n\r\n /* Incrementa per il loader */\r\n if (hasLoader !== false) {\r\n updateIsLoading(ref, 1);\r\n }\r\n },\r\n unsubscribe: () => {\r\n /* Rimozione reference */\r\n remove(ref);\r\n },\r\n next: (res) => {\r\n /* Mostra toast (se presente) */\r\n if (toast) {\r\n UniToastManager.showHttp(toast, res);\r\n }\r\n },\r\n }),\r\n catchError((err) => {\r\n // Aggiorna la ref nella map\r\n updateHasError(ref, true);\r\n\r\n /* Gestione errore */\r\n return errorHandler(ref, err, PollingErrorMode.STOP);\r\n }),\r\n finalize(() => {\r\n /* Decrementa per il loader */\r\n if (hasLoader !== false) {\r\n updateIsLoading(ref, -1);\r\n }\r\n }),\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Avvia e coordina un ciclo di polling a intervalli regolari.\r\n * Gestisce la concorrenza tramite operatori RxJS configurabili, la rimozione dei popup, di errore nelle iterazioni successive e i comportamenti custom al primo avvio.\r\n */\r\nexport function httpPolling$<T>(\r\n url: URL,\r\n config: HttpConfigPolling<T>,\r\n promiseFactory: () => Promise<T | undefined>,\r\n): Observable<T | undefined> {\r\n /* Recupero configurazione */\r\n const {\r\n interval,\r\n ref,\r\n operator = MapOperator.SWITCH_MAP,\r\n errorMode = PollingErrorMode.STOP,\r\n emitValueMode = EmitValueMode.ON_NEW_DATA,\r\n firstIteration,\r\n } = config;\r\n\r\n const timer$ = timer(0, interval);\r\n const source$ = timer$.pipe(\r\n tap({\r\n subscribe: () => {\r\n /* Creazione reference */\r\n add(ref, url, 'polling');\r\n },\r\n unsubscribe: () => {\r\n /* Rimozione reference */\r\n remove(ref);\r\n },\r\n }),\r\n operatorHandler<T>(operator)((index) => {\r\n /* Incrementa per il loader */\r\n if (index === 0 && firstIteration?.hasLoader !== false) {\r\n updateIsLoading(ref, 1);\r\n }\r\n\r\n return defer(() => {\r\n const http$ = from(promiseFactory());\r\n return http$.pipe(\r\n tap((res) => {\r\n /* Meccanismo di ripristino automatico: se il polling torna in salute, cancella l'errore dallo store e nasconde i relativi messaggi a schermo */\r\n if (errorMode === PollingErrorMode.IGNORE_WITH_ERROR) {\r\n updateHasError(ref, false);\r\n UniErrorManager.remove(ref);\r\n }\r\n\r\n /* Prima risposta */\r\n if (index === 0 && firstIteration?.toast) {\r\n UniToastManager.showHttp(firstIteration.toast, res);\r\n }\r\n }),\r\n catchError((err) => {\r\n // Aggiorna la ref nella map\r\n updateHasError(ref, true);\r\n\r\n /* Gestione errore */\r\n return errorHandler(ref, err, errorMode);\r\n }),\r\n finalize(() => {\r\n /* Decrementa per il loader */\r\n if (index === 0 && firstIteration?.hasLoader !== false) {\r\n updateIsLoading(ref, -1);\r\n }\r\n }),\r\n );\r\n });\r\n }),\r\n );\r\n\r\n return emitValueMode === EmitValueMode.ON_NEW_DATA\r\n ? source$.pipe(distinctUntilChanged((prev, cur) => isEqual(prev, cur)))\r\n : source$;\r\n}\r\n\r\n/* ------------------------------------------------------------------------------- */\r\n/* ------------------------------------ Utils ------------------------------------ */\r\n/* ------------------------------------------------------------------------------- */\r\n/**\r\n * Aggiunge una nuova ref nello store solo se non è già presente.\r\n * Se l'ID esiste già, l'operazione viene interrotta per preservare il dato originale.\r\n */\r\nfunction add(id: string, url: URL, type: HttpRef['type']): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = UniHttpManager.currentValue;\r\n\r\n // Controllo: se è presente l'item allora termina\r\n if (oldMap.get(id)) return;\r\n\r\n // Crea il nuovo oggetto\r\n const newItemMap: HttpRef = {\r\n type,\r\n lineId: undefined,\r\n url,\r\n hasError: false,\r\n pendingCount: 0,\r\n };\r\n\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map(oldMap);\r\n newMap.set(id, newItemMap);\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n UniHttpManager.store.next(newMap);\r\n}\r\n\r\n/**\r\n * Rimuove un http ref tramite ID\r\n */\r\nfunction remove(id: string): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = UniHttpManager.currentValue;\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n if (!oldMap.has(id)) return;\r\n\r\n // Aggiorna store\r\n const newMap = new Map(oldMap);\r\n newMap.delete(id);\r\n UniHttpManager.store.next(newMap);\r\n}\r\n\r\n/**\r\n * Aggiorna il contatore delle chiamate pendenti per una specifica ref.\r\n * Incrementa o decrementa 'pendingCount' garantendo che non scenda mai sotto lo zero.\r\n * Se la ref non esiste, l'operazione viene ignorata.\r\n */\r\nfunction updateIsLoading(id: string, delta: -1 | 1): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = UniHttpManager.currentValue;\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n const oldItem = oldMap.get(id);\r\n if (!oldItem) return;\r\n\r\n // Aggiorna l'oggetto\r\n const newItemMap: HttpRef = {\r\n ...oldItem,\r\n pendingCount: Math.max(0, oldItem.pendingCount + delta),\r\n };\r\n\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map(oldMap);\r\n newMap.set(id, newItemMap);\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n UniHttpManager.store.next(newMap);\r\n}\r\n\r\n/**\r\n * Aggiorna lo stato di errore per una specifica ref.\r\n * Se il valore di 'hasError' è identico a quello attuale o se la ref non esiste,\r\n * l'operazione viene interrotta per evitare aggiornamenti inutili.\r\n */\r\nfunction updateHasError(id: string, hasError: boolean): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = UniHttpManager.currentValue;\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n const oldItem = oldMap.get(id);\r\n if (!oldItem) return;\r\n\r\n // Controllo: se con lo stesso valore, salta\r\n if (oldItem.hasError === hasError) return;\r\n\r\n // Aggiorna l'oggetto\r\n const newItemMap: HttpRef = { ...oldItem, hasError };\r\n\r\n // Crea una nuova istanza della Map\r\n const newMap = new Map(oldMap);\r\n newMap.set(id, newItemMap);\r\n\r\n // Aggiorna il nuovo stato notificando l'observer\r\n UniHttpManager.store.next(newMap);\r\n}\r\n","import { HttpException, isHttpException, UniHttpError } from 'uni-error/http';\r\nimport { FileDatasource } from 'uni-manager/file';\r\n\r\nasync function execute(url: URL, init?: RequestInit): Promise<Response | undefined> {\r\n try {\r\n /* Esecuzione della richiesta HTTP nativa */\r\n const res = await fetch(url, init);\r\n\r\n /* Gestione dello stato 204: assenza di contenuto legittima */\r\n if (res.status === 204) {\r\n return undefined;\r\n }\r\n\r\n /*Gestione ok HTTP: risposta ricevuta dal server con stato valido */\r\n if (res.ok) {\r\n return res;\r\n }\r\n\r\n /* Gestione Errore HTTP: risposta ricevuta dal server ma con stato non valido */\r\n let httpErrorPayload: unknown;\r\n try {\r\n /* Clonazione della risposta per l'ispezione del payload senza consumare lo stream originale */\r\n const resClone = res.clone();\r\n\r\n /* Recupero se è un json */\r\n const contentType = res.headers.get('content-type') ?? '';\r\n const isJson = contentType.startsWith('application/json');\r\n\r\n /* Estrazione del corpo dell'errore in base al formato rilevato */\r\n httpErrorPayload = isJson ? await resClone.json() : await resClone.text();\r\n } catch {\r\n /* Fallback in caso di fallimento della clonazione o del parsing del testo */\r\n httpErrorPayload = `Failed to parse error response body (Status: ${res.status})`;\r\n }\r\n\r\n // Controllo: se il payload estratto è di tipo HttpException (.NET)\r\n if (isHttpException(httpErrorPayload)) {\r\n // const type = httpErrorPayload.isBe ? 'be' : 'ice';\r\n throw new UniHttpError('be', res.status, url, httpErrorPayload);\r\n }\r\n\r\n // Fallback per errori di infrastruttura (es. pagine HTML di IIS/Nginx, 404, 502)\r\n const errorTracker = new Error(res.statusText || `HTTP Error ${res.status}`);\r\n const fallbackException: HttpException = {\r\n message:\r\n typeof httpErrorPayload === 'string' && httpErrorPayload\r\n ? httpErrorPayload\r\n : errorTracker.message,\r\n type: 'InfrastructureError',\r\n stackTrace: errorTracker.stack ?? '',\r\n isBe: true,\r\n };\r\n throw new UniHttpError('server', res.status, url, fallbackException);\r\n } catch (error: unknown) {\r\n // Fallback per errori di rete locale (es. assenza di linea, DNS fallito)\r\n if (error instanceof TypeError) {\r\n const fallbackNetworkException: HttpException = {\r\n message: error.message,\r\n type: error.name || 'NetworkError',\r\n stackTrace: error.stack ?? '',\r\n isBe: true,\r\n };\r\n throw new UniHttpError('network', -1, url, fallbackNetworkException);\r\n }\r\n\r\n // Rilancio diretto per istanze di UniHttpError o eccezioni già gestite\r\n throw error;\r\n }\r\n}\r\n\r\nexport async function executeHttp<T>(url: URL, init?: RequestInit): Promise<T | undefined> {\r\n /* Esegue la chiamata HTTP e restituisce il corpo decodificato come JSON */\r\n const res = await execute(url, init);\r\n if (!res) return undefined;\r\n\r\n /* Estrae il contenuto come testo */\r\n const text = await res.text();\r\n\r\n /* Controllo: se il testo è vuoto (''), ritorna undefined */\r\n if (!text || text.trim().length === 0) {\r\n return undefined;\r\n }\r\n\r\n /* Parsa manualmente il testo, dato che lo stream è stato già letto */\r\n return JSON.parse(text) as T;\r\n}\r\n\r\nexport async function executeBlob(\r\n url: URL,\r\n init?: RequestInit,\r\n): Promise<FileDatasource | undefined> {\r\n /* Esegue la chiamata HTTP */\r\n const res = await execute(url, init);\r\n if (!res) return undefined;\r\n\r\n /* Estrae il contenuto come Blob direttamente */\r\n const blob = await res.blob();\r\n\r\n /* Controllo: se il blob è vuoto (0 byte), ritorna undefined */\r\n if (blob.size === 0) {\r\n return undefined;\r\n }\r\n\r\n /* Estrae il nome del file dall'header */\r\n const disposition = res.headers.get('Content-Disposition');\r\n let fileName = 'download.pdf'; // Fallback di default\r\n if (disposition) {\r\n const matches = /filename[^;=\\n]*=((['\"]).*?\\2|[^;\\n]*)/.exec(disposition);\r\n if (!!matches && matches[1]) {\r\n fileName = matches[1].replaceAll(/['\"]/g, '');\r\n }\r\n }\r\n\r\n /* Genera l'URL temporaneo dal blob */\r\n const fileUrl = URL.createObjectURL(blob);\r\n\r\n return { url: fileUrl, name: fileName };\r\n}\r\n","import { UniTypeDateManager } from 'uni-manager/type';\r\nimport type { HttpBody, HttpConfig } from './model';\r\n\r\n/**\r\n * Costruisce un URL completo per l'API partendo dai parametri di configurazione.\r\n */\r\nexport function getUrl<T>(hostname: string, port: number, config: HttpConfig<T>): URL {\r\n const { pathParams, path, hasApiPrefix } = config;\r\n\r\n // Costruzione url\r\n const prefix = hasApiPrefix === false ? '' : 'api';\r\n const cleanPath = path.startsWith('/') ? path.slice(1) : path;\r\n const pathFixed = prefix ? `${prefix}/${cleanPath}` : cleanPath;\r\n const url = new URL(pathFixed, `http://${hostname}:${port}`);\r\n\r\n if (pathParams) {\r\n // Regex per intercettare stringhe in formato ISO string\r\n const isoDateRegex = /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})?)?$/;\r\n\r\n for (const [key, rawValue] of Object.entries(pathParams)) {\r\n if (rawValue === undefined || rawValue === null) {\r\n continue;\r\n }\r\n\r\n // Conversione in array per usare un solo ciclo\r\n const valuesArray = Array.isArray(rawValue) ? rawValue : [rawValue];\r\n\r\n for (const item of valuesArray) {\r\n if (item === undefined || item === null) {\r\n continue;\r\n }\r\n\r\n let formattedValue: string;\r\n\r\n // Caso: Date nativo\r\n if (item instanceof Date) {\r\n formattedValue = UniTypeDateManager.toYYYYMMDD(item);\r\n }\r\n // Caso: Date formato ISO string\r\n else if (typeof item === 'string' && isoDateRegex.test(item)) {\r\n const parsedDate = new Date(item);\r\n formattedValue = Number.isNaN(parsedDate.getTime())\r\n ? item\r\n : UniTypeDateManager.toYYYYMMDD(parsedDate);\r\n }\r\n // Default\r\n else {\r\n formattedValue = String(item);\r\n }\r\n\r\n url.searchParams.append(key, formattedValue);\r\n }\r\n }\r\n }\r\n\r\n return url;\r\n}\r\n\r\n/**\r\n * Normalizza i valori del body cosi da sistemare le incongruenze tra ui e db\r\n */\r\nexport function normalizeHttpBody<T extends HttpBody>(body: T, isRoot = true): T {\r\n // PRIMITIVI GENERICI\r\n // Tipi gestiti: null, undefined, number, boolean, symbol, bigint, string\r\n if (body === null || typeof body !== 'object') {\r\n // Sotto-gestione specifica per il tipo: string\r\n if (typeof body === 'string') {\r\n return body.trim() as T;\r\n }\r\n return body;\r\n }\r\n\r\n // DATE\r\n // Tipi gestiti: Date\r\n // Formattazione esplicita manuale in YYYY-MM-DD\r\n if (body instanceof Date) {\r\n const year = body.getFullYear();\r\n const month = String(body.getMonth() + 1).padStart(2, '0');\r\n const day = String(body.getDate()).padStart(2, '0');\r\n return `${year}-${month}-${day}` as unknown as T;\r\n }\r\n\r\n // STRUTTURE DATI ITERABILI\r\n // Tipi gestiti: Array (qualsiasi array, es. string[], number[], Object[])\r\n // Se è un array, viene mappato ricorsivamente ogni singolo elemento al suo interno (passando isRoot = false perché gli elementi dell'array non sono l'oggetto root principale)\r\n if (Array.isArray(body)) {\r\n return body.map((item) => normalizeHttpBody(item, false)) as unknown as T;\r\n }\r\n\r\n // OGGETTI\r\n // Tipi gestiti: Record<string, any>, generici oggetti JavaScript ({ })\r\n // Rimuove chiave 'id' al primo livello e prosegue ricorsivamente\r\n const entries = Object.entries(body)\r\n .filter(([key]) => !(isRoot && key.toLowerCase() === 'id'))\r\n .map(([key, value]) => [key, normalizeHttpBody(value, false)]);\r\n\r\n // Ricostruisce l'oggetto normalizzato\r\n return Object.fromEntries(entries) as T;\r\n}\r\n","import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';\r\nimport { Observable } from 'rxjs/internal/Observable';\r\nimport { map } from 'rxjs/internal/operators/map';\r\nimport { tap } from 'rxjs/internal/operators/tap';\r\nimport type { FileDatasource } from 'uni-manager/file';\r\nimport { ToastConfig, UniToastManager } from 'uni-manager/toast';\r\n\r\nimport { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged';\r\nimport { http$, httpPolling$ } from './core';\r\nimport { executeBlob, executeHttp } from './execute';\r\nimport type { HttpBody, HttpConfig, HttpConfigPolling, HttpRef } from './model';\r\nimport { getUrl, normalizeHttpBody } from './util';\r\n\r\nconst CONFIG_TOAST_DEFAULT: ToastConfig = {\r\n type: 'success',\r\n label: 'OperationCompleted',\r\n};\r\n\r\nexport class UniHttpManager {\r\n /* ------------------------------------------------------------------------------- */\r\n /* ----------------------------------- Config ------------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Hostname del server (es. 'api.example.com' o 'localhost') */\r\n private static hostname: string;\r\n\r\n /** Porta del server su cui effettuare le chiamate (es. 80, 443 o 3000) */\r\n private static port: number;\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* --------------------------------- Metodi: get --------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Restituisce se lo store ha chiamate in attesa di risposta o meno */\r\n public static get hasWaitingRequests$(): Observable<boolean> {\r\n return this.store$.pipe(\r\n map((requestMap) => {\r\n for (const request of requestMap.values()) {\r\n if (request.pendingCount > 0) return true;\r\n }\r\n return false;\r\n }),\r\n distinctUntilChanged(),\r\n );\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* ------------------------------------ Store ------------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Store privato (Subject) */\r\n public static store = new BehaviorSubject<Map<string, HttpRef>>(new Map());\r\n\r\n /** Store pubblico (Observable) */\r\n public static store$: Observable<Map<string, HttpRef>> = this.store.asObservable();\r\n\r\n /** Ottiene lo stato attuale della Map senza dover sottoscrivere l'observable */\r\n public static get currentValue(): Map<string, HttpRef> {\r\n return this.store.getValue();\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: setup -------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Inizializza la configurazione di rete del manager.\r\n * Deve essere chiamato prima di effettuare qualsiasi richiesta HTTP.\r\n */\r\n public static setup(hostname: string, port: number): void {\r\n this.hostname = hostname;\r\n this.port = port;\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: CRUD --------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /*\r\n * Esegue una singola richiesta HTTP GET.\r\n * Utilizza il path configurato per costruire l'URL completo e restituisce un Observable del risultato.\r\n */\r\n public static read$<T>(config: HttpConfig<T>): Observable<T | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'GET',\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return http$(url, 'one', config, () => executeHttp<T>(url, initCustom)).pipe(\r\n tap((res) => {\r\n if (Array.isArray(res) && config.toast === undefined) {\r\n UniToastManager.show({\r\n label: 'ItemsFound',\r\n params: { count: res.length },\r\n });\r\n }\r\n }),\r\n );\r\n }\r\n\r\n /**\r\n * Esegue una richiesta HTTP POST inviando un payload JSON nel corpo della richiesta.\r\n * Imposta automaticamente l'header 'Content-Type' come 'application/json'.\r\n */\r\n public static create$<T>(config: HttpConfig<T>, body: HttpBody): Observable<T | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n ...config.init?.headers,\r\n },\r\n body: JSON.stringify(normalizeHttpBody(body)),\r\n };\r\n\r\n /* Config custom (toast di default) */\r\n const configCustom: HttpConfig<T> = {\r\n ...config,\r\n toast: config.hasToast === false ? undefined : (config.toast ?? CONFIG_TOAST_DEFAULT),\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return http$(url, 'one', configCustom, () => executeHttp<T>(url, initCustom));\r\n }\r\n\r\n /**\r\n * Esegue una singola richiesta HTTP PUT per aggiornare una risorsa esistente.\r\n */\r\n public static update$<T>(config: HttpConfig<T>, body?: HttpBody): Observable<T | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = { ...config.init, method: 'PUT' };\r\n if (body !== undefined) {\r\n initCustom.headers = {\r\n 'Content-Type': 'application/json',\r\n ...config.init?.headers,\r\n };\r\n initCustom.body = JSON.stringify(normalizeHttpBody(body));\r\n }\r\n\r\n /* Config custom (toast di default) */\r\n const configCustom: HttpConfig<T> = {\r\n ...config,\r\n toast: config.hasToast === false ? undefined : (config.toast ?? CONFIG_TOAST_DEFAULT),\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return http$(url, 'one', configCustom, () => executeHttp<T>(url, initCustom));\r\n }\r\n\r\n /**\r\n * Esegue una richiesta HTTP DELETE per rimuovere una risorsa.\r\n * Utilizza il path configurato per costruire l'URL completo e restituisce un Observable del risultato.\r\n */\r\n public static delete$<T>(config: HttpConfig<T>): Observable<T | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'DELETE',\r\n };\r\n\r\n /* Config custom (toast di default) */\r\n const configCustom: HttpConfig<T> = {\r\n ...config,\r\n toast: config.hasToast === false ? undefined : (config.toast ?? CONFIG_TOAST_DEFAULT),\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return http$(url, 'one', configCustom, () => executeHttp<T>(url, initCustom));\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------- Metodi: CRUD file/image ---------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Recupera un'immagine tramite una richiesta GET e la trasforma in un formato gestibile (es. Blob o Base64).\r\n * Delega la logica di conversione alla funzione executeImage.\r\n */\r\n public static readImage$(\r\n config: HttpConfig<FileDatasource>,\r\n ): Observable<FileDatasource | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'GET',\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return http$(url, 'image', config, () => executeBlob(url, initCustom));\r\n }\r\n\r\n /**\r\n * Recupera un file (es. PDF) tramite una richiesta GET e restituisce un Object URL temporaneo.\r\n * Delega la logica di conversione alla funzione executeFile.\r\n */\r\n public static readFile$(\r\n config: HttpConfig<FileDatasource>,\r\n ): Observable<FileDatasource | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'GET',\r\n };\r\n\r\n /* Config custom (toast di default) */\r\n const configCustom: HttpConfig<FileDatasource> = {\r\n ...config,\r\n toast: config.hasToast === false ? undefined : (config.toast ?? CONFIG_TOAST_DEFAULT),\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return http$(url, 'file', configCustom, () => executeBlob(url, initCustom));\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* ---------------------------- Metodi: CRUD polling ----------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Avvia un ciclo di polling basato su richieste GET.\r\n * Continua a emettere valori in base alla configurazione di intervallo definita in HttpConfigPolling.\r\n */\r\n public static readPolling$<T>(config: HttpConfigPolling<T>): Observable<T | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'GET',\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return httpPolling$(url, config, () => executeHttp<T>(url, initCustom));\r\n }\r\n\r\n /**\r\n * Avvia un ciclo di polling basato su richieste POST.\r\n * Invia il body specificato a ogni iterazione del ciclo.\r\n */\r\n public static createPolling$<T>(\r\n config: HttpConfigPolling<T>,\r\n body: HttpBody,\r\n ): Observable<T | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'POST',\r\n headers: { 'Content-Type': 'application/json' },\r\n body: JSON.stringify(body),\r\n };\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return httpPolling$(url, config, () => executeHttp<T>(url, initCustom));\r\n }\r\n\r\n /**\r\n * Avvia un ciclo di polling basato su richieste PUT.\r\n */\r\n public static updatePolling$<T>(\r\n config: HttpConfigPolling<T>,\r\n body?: HttpBody,\r\n ): Observable<T | undefined> {\r\n /* Config */\r\n const initCustom: RequestInit = {\r\n ...config.init,\r\n method: 'PUT',\r\n };\r\n if (body !== undefined) {\r\n initCustom.headers = {\r\n ...initCustom.headers,\r\n 'Content-Type': 'application/json',\r\n };\r\n initCustom.body = JSON.stringify(body);\r\n }\r\n\r\n /* API */\r\n const url = getUrl(this.hostname, this.port, config);\r\n return httpPolling$(url, config, () => executeHttp<T>(url, initCustom));\r\n }\r\n}\r\n","import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';\r\n\r\nexport class UniLocaleManager {\r\n /* ------------------------------------------------------------------------------- */\r\n /* ----------------------------------- Config ------------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Codice lingua corrente (es. 'it-IT', 'en-US') usato per formattare date e numeri */\r\n private static _locale = navigator.language ?? 'en-US';\r\n\r\n /** Elenco dei codici lingua supportati dall'applicazione (es. ['it-IT', 'en-US']) */\r\n private static _localesSupported: string[] = [];\r\n\r\n /** Prefisso globale applicato a tutte le chiavi di traduzione (es. 'APP_') */\r\n private static _prefix: string | undefined = undefined;\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* --------------------------------- Metodi: get --------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Restituisce il codice lingua corrente */\r\n public static get locale(): string {\r\n return this._locale;\r\n }\r\n\r\n /** Restituisce l'array contenente tutti i codici locale supportati.*/\r\n public static get localesSupported(): string[] {\r\n return this._localesSupported;\r\n }\r\n\r\n /** Restituisce solo la lingua (es. 'it') */\r\n public static get language(): string {\r\n return this._locale.split('-')[0];\r\n }\r\n\r\n /** Restituisce solo il paese (es. 'IT') */\r\n public static get region(): string {\r\n const parts = this._locale.split('-');\r\n return parts.length > 1 ? parts[1] : '';\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* ------------------------------------ Store ------------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Store privato (Subject) */\r\n public static store = new BehaviorSubject<Record<string, string>>({});\r\n\r\n /** Store pubblico (Observable) */\r\n public static store$ = this.store.asObservable();\r\n\r\n /** Ottiene il dizionario attuale senza sottoscrizione */\r\n public static get currentValue(): Record<string, string> {\r\n return this.store.getValue();\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: setup -------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Inizializza la configurazione di rete del manager.\r\n * Deve essere chiamato prima di effettuare qualsiasi richiesta HTTP.\r\n */\r\n public static setup(locale: string | null | undefined, prefix?: string): void {\r\n this._locale = locale ?? 'en-US';\r\n this._prefix = prefix;\r\n }\r\n\r\n /** Imposta l'elenco dei codici lingua supportati dall'applicazione */\r\n public static setLocalesSupported(locales: string[] | undefined): void {\r\n this._localesSupported = locales ?? [];\r\n }\r\n\r\n /**\r\n * Aggiorna lo store locale con il dizionario delle traduzioni fornito.\r\n * Se viene passato undefined, lo store viene inizializzato come oggetto vuoto.\r\n */\r\n public static setTranslations(translations: Record<string, string> | undefined): void {\r\n this.store.next(translations ?? {});\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* ----------------------------- Metodi: traduzioni ------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Traduce una label in base al dizionario caricato.\r\n * Gestisce la composizione della chiave, i parametri dinamici (interpolazione) e il fallback.\r\n */\r\n public static translate(\r\n key: string,\r\n prefix = 'lbl',\r\n params?: Record<string, string | number | Date>,\r\n ): string {\r\n if (!key) return '-';\r\n\r\n // Costruzione chiave: prefissoGlobale + prefissoLocale + LabelConInizialeMaiuscola\r\n const keyParts = key.trim().split(/(?=[A-Z])/);\r\n const rootKeyParts = keyParts.filter((p) => p.toLowerCase() !== prefix.toLowerCase());\r\n const cleanKey = rootKeyParts.length > 0 ? rootKeyParts.join('') : undefined;\r\n const capitalizedKey = cleanKey ? cleanKey.charAt(0).toUpperCase() + cleanKey.slice(1) : '';\r\n const finalKey = `${this._prefix ?? ''}${prefix}${capitalizedKey}`;\r\n\r\n // Cerca la chiave in minuscolo (standardizzazione)\r\n let translation = this.currentValue?.[finalKey.toLowerCase()];\r\n\r\n // Log e fallback se la traduzione manca\r\n if (!translation) {\r\n console.warn(`Translation missing for key: ${finalKey}`);\r\n return `🔑 ${finalKey}`;\r\n }\r\n\r\n // Interpolazione variabili\r\n if (params) {\r\n for (const [key, value] of Object.entries(params)) {\r\n const displayValue =\r\n value instanceof Date ? value.toLocaleDateString(this._locale) : String(value);\r\n\r\n translation = translation.replaceAll(`{{${key}}}`, displayValue);\r\n }\r\n }\r\n\r\n return translation;\r\n }\r\n\r\n /**\r\n * Traduce una stringa che contiene parametri separati da un carattere specifico.\r\n * Supporta ora un numero arbitrario di parametri in formato \"label/param1/param2\"\r\n * o semplicemente \"label\".\r\n */\r\n public static translateInlineParams(keyWithParams: string, splitChar: string): string {\r\n if (!keyWithParams) return '-';\r\n\r\n const [label, ...params] = keyWithParams.split(splitChar);\r\n\r\n // Se non ci sono parametri, esegui una traduzione semplice\r\n if (params.length === 0) {\r\n return this.translate(label);\r\n }\r\n\r\n // Mappa i parametri in un oggetto di interpolazione: { inlineParam0: val, inlineParam1: val, ... }\r\n const interpolationParameters: Record<string, string> = {};\r\n for (const [index, val] of params.entries()) {\r\n interpolationParameters[`param${index}`] = val;\r\n }\r\n\r\n return this.translate(label, 'lbl', interpolationParameters);\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* ------------------------------- Metodi: numeri -------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Converte un valore numerico in una stringa formattata secondo il locale impostato.\r\n * Disabilita i separatori delle migliaia e forza un numero fisso di decimali.\r\n */\r\n public static toStringNumber(value: number, decimal: number): string {\r\n return new Intl.NumberFormat(this._locale, {\r\n useGrouping: true,\r\n minimumFractionDigits: decimal,\r\n maximumFractionDigits: decimal,\r\n numberingSystem: 'latn',\r\n }).format(value);\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: date --------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Formatta una data o una stringa in base al locale corrente.\r\n * Gestisce tre modalità predefinite (date, time, full) e accetta opzioni personalizzate Intl.\r\n */\r\n public static toDate(\r\n date: string | Date,\r\n mode: 'date' | 'time' | 'full' = 'full',\r\n force?: { oldLang: string; newLocale: string },\r\n ): string {\r\n const dt = new Date(date);\r\n\r\n // Controllo: validità data\r\n if (Number.isNaN(dt.getTime())) {\r\n console.error(`[UniLocaleManager] Data non valida fornita a formatDateTime:`, date);\r\n return '';\r\n }\r\n\r\n // Controllo: locale da forzare\r\n const locale = force && this._locale.startsWith(force.oldLang) ? force.newLocale : this._locale;\r\n\r\n switch (mode) {\r\n case 'date': {\r\n return dt.toLocaleDateString(locale);\r\n }\r\n case 'time': {\r\n return dt.toLocaleTimeString(locale);\r\n }\r\n case 'full': {\r\n return dt.toLocaleString(locale);\r\n }\r\n }\r\n }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport { UniLocaleManager } from 'uni-manager/locale';\r\nimport type { IToastManager, ToastConfig, ToastHttpConfig } from './model';\r\n\r\nexport class UniToastManager {\r\n /* ------------------------------------------------------------------------------- */\r\n /* ----------------------------------- Config ------------------------------------ */\r\n /* ------------------------------------------------------------------------------- */\r\n /** Riferimento interno all'istanza */\r\n private static manager: IToastManager;\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: setup -------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Inizializza il manager con una serie di operazioni\r\n */\r\n public static setup(operations: IToastManager): void {\r\n this.manager = operations;\r\n }\r\n\r\n /* ------------------------------------------------------------------------------- */\r\n /* -------------------------------- Metodi: show --------------------------------- */\r\n /* ------------------------------------------------------------------------------- */\r\n /**\r\n * Mostra un toast di successo basato su una risposta HTTP e una label di traduzione.\r\n */\r\n public static show(\r\n config: ToastConfig & {\r\n prefix?: string;\r\n suffix?: string;\r\n },\r\n ): void {\r\n /* Messaggio tradotto */\r\n const msg = UniLocaleManager.translate(config.label, 'toast', config.params);\r\n const msgFixed = `${config.prefix ?? ''}${msg}${config.suffix ?? ''}`;\r\n this.manager[config.type ?? 'info'](msgFixed, config);\r\n }\r\n\r\n /**\r\n * Mostra un toast di successo basato su una risposta HTTP e una label di traduzione.\r\n */\r\n public static showHttp<T>(config: ToastConfig & ToastHttpConfig<T>, res: T | undefined): void {\r\n const { params, resParams, formatters } = config;\r\n\r\n /* Parametri statici di base */\r\n const allParams: Record<string, any> = { ...params };\r\n\r\n if (res !== undefined && res !== null) {\r\n /* Se è un array aggiunge il parametro 'count' con la lunghezza dell'array */\r\n if (Array.isArray(res)) {\r\n allParams['count'] = res.length;\r\n } else if (typeof res === 'object' && resParams?.length) {\r\n // Se la proprietà NON esiste nella risposta, allora salta\r\n for (const resParam of resParams ?? []) {\r\n if (!(resParam in res)) continue;\r\n\r\n // Se esiste un formatter per questa chiave lo si usa, altrimenti valore grezzo\r\n const rawValue = res[resParam];\r\n allParams[resParam] = formatters?.[resParam] ? formatters[resParam](rawValue) : rawValue;\r\n }\r\n }\r\n }\r\n\r\n /* Messaggio tradotto */\r\n this.show({ ...config, params: allParams });\r\n }\r\n}\r\n","/**\r\n * Classe di utilità per la gestione e formattazione delle date.\r\n * Fornisce metodi per convertire in modo sicuro valori di tipo Date, stringa o null in formati standardizzati.\r\n */\r\nexport class UniTypeDateManager {\r\n static toYYYYMMDD(date: Date | string | null | undefined): string {\r\n if (!date) return '';\r\n\r\n const d = new Date(date);\r\n\r\n if (Number.isNaN(d.getTime())) return '';\r\n\r\n const year = d.getFullYear();\r\n const month = String(d.getMonth() + 1).padStart(2, '0');\r\n const day = String(d.getDate()).padStart(2, '0');\r\n\r\n return `${year}-${month}-${day}`;\r\n }\r\n}\r\n","/**\r\n * Utility per la gestione e formattazione di valori numerici.\r\n */\r\nexport class UniTypeNumberManager {\r\n /** Applica il padding a un numero o una stringa */\r\n static toPad(value: number | string | null | undefined, count: number, character = '0'): string {\r\n // Se il valore è null/undefined, riempiamo l'intero campo con il carattere scelto\r\n if (value === null || value === undefined) {\r\n return ''.padStart(count, character);\r\n }\r\n\r\n // Convertiamo in stringa e applichiamo il padding\r\n return value.toString().padStart(count, character);\r\n }\r\n\r\n /** Formatta un numero in una versione leggibile (es: 1000 -> 1K, 1000000 -> 1M) */\r\n static toTruncateAndAdUdm(value: number, decimalDigits = 0, maxIntegerDigits = 3): string {\r\n // Nessun limite impostato o numero inferiore alla soglia definita\r\n if (Math.abs(value) < Math.pow(10, maxIntegerDigits)) {\r\n return value.toFixed(decimalDigits);\r\n }\r\n\r\n // Definizione delle scale di riduzione per grandi numeri\r\n const scales = [\r\n { threshold: 1e12, suffix: 'T' }, // Trilioni\r\n { threshold: 1e9, suffix: 'B' }, // Miliardi\r\n { threshold: 1e6, suffix: 'M' }, // Milioni\r\n { threshold: 1e3, suffix: 'K' }, // Migliaia\r\n ];\r\n\r\n // Itera dalla scala più grande alla più piccola per trovare la soglia corretta\r\n for (const { threshold, suffix } of scales) {\r\n if (Math.abs(value) >= threshold) {\r\n const reduced = value / threshold;\r\n\r\n // parseFloat(toFixed()) rimuove gli zeri decimali superflui (es: 1.50 -> 1.5)\r\n // aggiungendo poi il relativo suffisso (K, M, B, T)\r\n return Number.parseFloat(reduced.toFixed(decimalDigits)).toString() + suffix;\r\n }\r\n }\r\n\r\n // Fallback: se il numero è grande ma non rientra nelle scale (caso raro con la logica attuale)\r\n return value.toFixed(decimalDigits);\r\n }\r\n}\r\n","/**\r\n * Utility per la manipolazione di stringhe\r\n */\r\nexport class UniTypeStringManager {\r\n /** Converte una stringa in formato lblPascalCase (es. \"user_id\" -> \"lblUserId\") */\r\n static toLabelize(key: string | null | undefined, prefix = 'lbl'): string {\r\n // Se vuoto restituisce vuoto\r\n if (!key) return '';\r\n\r\n // Pulizia chiave\r\n const fixedKey = key.trim();\r\n\r\n // Unisce il prefisso\r\n return prefix + this.toPascalCase(fixedKey);\r\n }\r\n\r\n /** Converte una stringa in PascalCase (es. \"user_id\" -> \"UserId\") */\r\n static toPascalCase(key: string | null | undefined): string {\r\n // Se vuoto restituisce vuoto\r\n if (!key) return '';\r\n\r\n // Pulizia chiave\r\n const fixedKey = key.trim();\r\n\r\n // Normalizza e pulisce\r\n const parts = this.splitString(fixedKey);\r\n if (parts.length === 0) return '';\r\n\r\n // Converte in PascalCase\r\n const pascalCased = this.toPascalCaseParts(parts);\r\n\r\n return pascalCased;\r\n }\r\n\r\n /** Converte una stringa in camelCase (es. \"user_id\" -> \"userId\") */\r\n static toCamelCase(key: string | null | undefined): string {\r\n // Se vuoto restituisce vuoto\r\n if (!key) return '';\r\n\r\n // Pulizia chiave\r\n const fixedKey = key.trim();\r\n\r\n // Normalizza e pulisce\r\n const parts = this.splitString(fixedKey);\r\n if (parts.length === 0) return '';\r\n\r\n // La prima parola resta minuscola, le successive PascalCase\r\n const first = parts[0].toLowerCase();\r\n const rest = parts.slice(1);\r\n return first + this.toPascalCaseParts(rest);\r\n }\r\n\r\n /** Capitalizza solo la prima lettera della stringa */\r\n static toCapitalize(key: string | null | undefined): string {\r\n // Se vuoto restituisce vuoto\r\n if (!key) return '';\r\n\r\n // Pulizia chiave\r\n const fixedKey = key.trim();\r\n\r\n return fixedKey.charAt(0).toUpperCase() + fixedKey.slice(1);\r\n }\r\n\r\n /** Sostituisce sotto-stringhe all'interno della stringa */\r\n static toReplace(\r\n key: string | null | undefined,\r\n values: { searchValue: string; replaceValue: string }[],\r\n ): string {\r\n // Se vuoto restituisce vuoto\r\n if (!key) return '';\r\n\r\n // Pulizia chiave\r\n let fixedKey = key.trim();\r\n\r\n for (const value of values) {\r\n fixedKey = fixedKey.replaceAll(value.searchValue, value.replaceValue);\r\n }\r\n\r\n return fixedKey;\r\n }\r\n\r\n /* ----------------- Utils ----------------- */\r\n private static splitString(key: string): string[] {\r\n return (\r\n key\r\n // Pulisce eventuali caratteri di separazione rimasti in testa (es. \"_tab_name\" -> \"tab_name\")\r\n .replace(/^[-_\\s]+/, '')\r\n\r\n // Isola il CamelCase inserendo un underscore tra minuscole e maiuscole (es. \"userId\" -> \"user_Id\")\r\n .replaceAll(/([a-z])([A-Z])/g, '$1_$2')\r\n\r\n // Isola gli acronimi attaccati a parole Normali (es. \"VARAna\" -> \"VAR_Ana\" grazie alla minuscola \"na\")\r\n .replaceAll(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')\r\n\r\n // Applica il taglio definitivo usando come riferimento i trattini, gli underscore e gli spazi\r\n .split(/[-_\\s]+/)\r\n\r\n // Rimuove dall'array finale eventuali stringhe vuote generate da separatori consecutivi\r\n .filter(Boolean)\r\n );\r\n }\r\n\r\n private static toPascalCaseParts(parts: string[]): string {\r\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()).join('');\r\n }\r\n}\r\n","/*\r\n * Public API Surface of uni-manager\r\n */\r\n\r\nexport * from './error/public-api';\r\nexport * from './file/public-api';\r\nexport * from './http/public-api';\r\nexport * from './locale/public-api';\r\nexport * from './toast/public-api';\r\nexport * from './type/public-api';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["UniErrorManager","UniToastManager","UniTypeDateManager","UniLocaleManager"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAOa,eAAe,CAAA;;;;;AAKnB,IAAA,WAAW,OAAO,GAAA;QACvB,OAAO,eAAe,CAAC,MAAM,CAAC,IAAI,CAChC,GAAG,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EACxE,oBAAoB,CAAC,CAAC,IAAI,EAAE,IAAI,KAAI;AAClC,YAAA,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM;AAAE,gBAAA,OAAO,KAAK;AAC7C,YAAA,OAAO,IAAI,CAAC,KAAK,CACf,CAAC,GAAG,EAAE,KAAK,KAAK,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAC7E;QACH,CAAC,CAAC,CACH;IACH;;;;;aAMe,IAAA,CAAA,KAAK,GAAG,IAAI,eAAe,CAA2C,IAAI,GAAG,EAAE,CAAC,CAAC;;AAGlF,IAAA,SAAA,IAAA,CAAA,MAAM,GAClB,eAAe,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;;AAGhC,IAAA,WAAW,YAAY,GAAA;AAC5B,QAAA,OAAO,eAAe,CAAC,KAAK,CAAC,QAAQ,EAAE;IACzC;;;;AAKA;;;AAGG;AACI,IAAA,OAAO,GAAG,CAAC,EAAU,EAAE,KAAkC,EAAA;;AAE9D,QA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class UniErrorManager {
7
7
  static get errors$(): Observable<({
8
8
  id: string;
9
9
  } & (IUniFeError | IUniHttpError))[]>;
10
- /** Store privato (Subject) */
10
+ /** Store privato (Subject) */
11
11
  private static store;
12
- /** Store pubblico (Observable) */
12
+ /** Store pubblico (Observable) */
13
13
  static store$: Observable<Map<string, IUniFeError | IUniHttpError>>;
14
14
  /** Ottiene lo stato attuale della Map senza dover sottoscrivere l'observable */
15
15
  static get currentValue(): Map<string, IUniFeError | IUniHttpError>;
16
16
  /**
17
17
  * Aggiunge o aggiorna un errore nello store.
18
- * Se l'errore esiste già (stesso ID), incrementa il contatore 'count'.
18
+ * Se l'errore esiste già (stesso ID), incrementa il contatore 'count' e aggiorna il timestamp.
19
19
  */
20
20
  static add(id: string, error: IUniHttpError | IUniFeError): void;
21
21
  /**
@@ -11,15 +11,15 @@ declare class UniErrorManager {
11
11
  static get errors$(): Observable<({
12
12
  id: string;
13
13
  } & (IUniFeError | IUniHttpError))[]>;
14
- /** Store privato (Subject) */
14
+ /** Store privato (Subject) */
15
15
  private static store;
16
- /** Store pubblico (Observable) */
16
+ /** Store pubblico (Observable) */
17
17
  static store$: Observable<Map<string, IUniFeError | IUniHttpError>>;
18
18
  /** Ottiene lo stato attuale della Map senza dover sottoscrivere l'observable */
19
19
  static get currentValue(): Map<string, IUniFeError | IUniHttpError>;
20
20
  /**
21
21
  * Aggiunge o aggiorna un errore nello store.
22
- * Se l'errore esiste già (stesso ID), incrementa il contatore 'count'.
22
+ * Se l'errore esiste già (stesso ID), incrementa il contatore 'count' e aggiorna il timestamp.
23
23
  */
24
24
  static add(id: string, error: IUniHttpError | IUniFeError): void;
25
25
  /**