uni-manager 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -17,7 +17,7 @@ import { concatMap } from 'rxjs/internal/operators/concatMap';
|
|
|
17
17
|
import { exhaustMap } from 'rxjs/internal/operators/exhaustMap';
|
|
18
18
|
import { mergeMap } from 'rxjs/internal/operators/mergeMap';
|
|
19
19
|
import { switchMap } from 'rxjs/internal/operators/switchMap';
|
|
20
|
-
import { UniHttpError,
|
|
20
|
+
import { UniHttpError, isHttpException } from 'uni-error/http';
|
|
21
21
|
import { UniTypeDateManager } from 'uni-manager/type';
|
|
22
22
|
|
|
23
23
|
var MapOperator;
|
|
@@ -277,59 +277,62 @@ function updateHasError(id, hasError) {
|
|
|
277
277
|
|
|
278
278
|
async function execute(url, init) {
|
|
279
279
|
try {
|
|
280
|
-
/*
|
|
280
|
+
/* Esecuzione della richiesta HTTP nativa */
|
|
281
281
|
const res = await fetch(url, init);
|
|
282
|
-
/*
|
|
282
|
+
/* Gestione dello stato 204: assenza di contenuto legittima */
|
|
283
283
|
if (res.status === 204) {
|
|
284
284
|
return undefined;
|
|
285
285
|
}
|
|
286
|
-
/*
|
|
286
|
+
/*Gestione ok HTTP: risposta ricevuta dal server con stato valido */
|
|
287
287
|
if (res.ok) {
|
|
288
288
|
return res;
|
|
289
289
|
}
|
|
290
|
-
/* Errore HTTP
|
|
291
|
-
let
|
|
290
|
+
/* Gestione Errore HTTP: risposta ricevuta dal server ma con stato non valido */
|
|
291
|
+
let httpErrorPayload;
|
|
292
292
|
try {
|
|
293
|
-
/*
|
|
293
|
+
/* Clonazione della risposta per l'ispezione del payload senza consumare lo stream originale */
|
|
294
294
|
const resClone = res.clone();
|
|
295
295
|
/* Recupero se è un json */
|
|
296
296
|
const contentType = res.headers.get('content-type') ?? '';
|
|
297
297
|
const isJson = contentType.startsWith('application/json');
|
|
298
|
-
/*
|
|
299
|
-
|
|
298
|
+
/* Estrazione del corpo dell'errore in base al formato rilevato */
|
|
299
|
+
httpErrorPayload = isJson ? await resClone.json() : await resClone.text();
|
|
300
300
|
}
|
|
301
301
|
catch {
|
|
302
|
-
|
|
303
|
-
|
|
302
|
+
/* Fallback in caso di fallimento della clonazione o del parsing del testo */
|
|
303
|
+
httpErrorPayload = `Failed to parse error response body (Status: ${res.status})`;
|
|
304
304
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
305
|
+
// Controllo: se il payload estratto rispetta è di tipo HttpException
|
|
306
|
+
if (isHttpException(httpErrorPayload)) {
|
|
307
|
+
// const type = httpErrorPayload.isBe ? 'be' : 'ice';
|
|
308
|
+
throw new UniHttpError('be', res.status, url, httpErrorPayload);
|
|
308
309
|
}
|
|
309
310
|
else {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
311
|
+
// Fallback per errori non di tipo HttpException (es. pagine HTML di errore di IIS/Nginx o stringhe piane)
|
|
312
|
+
const error = new Error(res.statusText || `HTTP Error ${res.status}`);
|
|
313
|
+
const fallbackException = {
|
|
314
|
+
message: typeof httpErrorPayload === 'string' && httpErrorPayload
|
|
315
|
+
? httpErrorPayload
|
|
316
|
+
: error.message,
|
|
317
|
+
type: 'ErrorBase',
|
|
315
318
|
stackTrace: error.stack ?? '',
|
|
316
|
-
|
|
319
|
+
isBe: true,
|
|
320
|
+
};
|
|
321
|
+
throw new UniHttpError('base', res.status, url, fallbackException);
|
|
317
322
|
}
|
|
318
323
|
}
|
|
319
324
|
catch (error) {
|
|
320
|
-
//
|
|
321
|
-
if (error instanceof UniHttpError) {
|
|
322
|
-
throw error;
|
|
323
|
-
}
|
|
325
|
+
// Fallback per errori di rete locale (es. assenza di linea, DNS fallito, timeout di fetch)
|
|
324
326
|
if (error instanceof TypeError) {
|
|
325
|
-
|
|
326
|
-
exceptionMessage: `${error.name}: ${error.message}\n${error.stack}`,
|
|
327
|
-
exceptionType: error.name,
|
|
327
|
+
const fallbackNetworkException = {
|
|
328
328
|
message: error.message,
|
|
329
|
+
type: error.name || 'TypeError',
|
|
329
330
|
stackTrace: error.stack ?? '',
|
|
330
|
-
|
|
331
|
+
isBe: true,
|
|
332
|
+
};
|
|
333
|
+
throw new UniHttpError('network', -1, url, fallbackNetworkException);
|
|
331
334
|
}
|
|
332
|
-
//
|
|
335
|
+
// Rilancio diretto senza alterazioni per istanze di UniHttpError o eccezioni non identificate
|
|
333
336
|
throw error;
|
|
334
337
|
}
|
|
335
338
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uni-manager-http.mjs","sources":["../../../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/http/uni-manager-http.ts"],"sourcesContent":["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 err: unknown,\r\n errorMode: PollingErrorMode,\r\n ref: string,\r\n): Observable<never> {\r\n // Controllo: sia effettivamente un errore di tipo 'UniHttpError'\r\n if (err instanceof UniHttpError) {\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(err, PollingErrorMode.STOP, ref);\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(err, errorMode, ref);\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 { isHttpErrorBody, 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 /* Esegue chiamata http */\r\n const res = await fetch(url, init);\r\n\r\n /* Nessun contenuto cons status 204 */\r\n if (res.status === 204) {\r\n return undefined;\r\n }\r\n\r\n /* Risposta ok */\r\n if (res.ok) {\r\n return res;\r\n }\r\n\r\n /* Errore HTTP (quindi risposta ricevuta ma non ok) */\r\n let errorBody: unknown;\r\n try {\r\n /* Clona risposta per leggerla senza consumare la 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 /* Aggiorna body con struttura errore */\r\n errorBody = isJson ? await resClone.json() : await resClone.text();\r\n } catch {\r\n // Se il clone o il parsing falliscono, si usa una stringa di fallback sicura\r\n errorBody = `Failed to parse error response body (Status: ${res.status})`;\r\n }\r\n\r\n if (isHttpErrorBody(errorBody)) {\r\n const type = errorBody.exceptionType.includes('HttpRequestException') ? 'be' : 'ice';\r\n throw new UniHttpError(type, res.status, url, errorBody);\r\n } else {\r\n const error = new Error(`HTTP ${res.statusText}`);\r\n throw new UniHttpError('base', res.status, url, {\r\n exceptionMessage: error.message,\r\n exceptionType: 'ErrorBase',\r\n message: error.message,\r\n stackTrace: error.stack ?? '',\r\n });\r\n }\r\n } catch (error: unknown) {\r\n // Se l'errore è già un UniHttpError (lanciato sopra) bypassa tutto il resto\r\n if (error instanceof UniHttpError) {\r\n throw error;\r\n }\r\n\r\n if (error instanceof TypeError) {\r\n throw new UniHttpError('network', -1, url, {\r\n exceptionMessage: `${error.name}: ${error.message}\\n${error.stack}`,\r\n exceptionType: error.name,\r\n message: error.message,\r\n stackTrace: error.stack ?? '',\r\n });\r\n }\r\n\r\n // Fallback per qualsiasi altro tipo di errore sconosciuto\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 { 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(map((x) => [...x.values()].some((y) => y.pendingCount > 0)));\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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;IAAY;AAAZ,CAAA,UAAY,WAAW,EAAA;;AAEtB,IAAA,WAAA,CAAA,WAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU;;AAGV,IAAA,WAAA,CAAA,WAAA,CAAA,aAAA,CAAA,GAAA,CAAA,CAAA,GAAA,aAAW;;AAGX,IAAA,WAAA,CAAA,WAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU;;AAGV,IAAA,WAAA,CAAA,WAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS;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AACD,QAAA,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,UAAU,CAAC,OAAO,GAAG;gBACnB,GAAG,UAAU,CAAC,OAAO;AACrB,gBAAA,cAAc,EAAE,kBAAkB;aACnC;YACD,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QACxC;;AAGA,QAAA,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;AACpD,QAAA,OAAO,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,WAAW,CAAI,GAAG,EAAE,UAAU,CAAC,CAAC;IACzE;;;AC/QF;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"uni-manager-http.mjs","sources":["../../../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/http/uni-manager-http.ts"],"sourcesContent":["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 err: unknown,\r\n errorMode: PollingErrorMode,\r\n ref: string,\r\n): Observable<never> {\r\n // Controllo: sia effettivamente un errore di tipo 'UniHttpError'\r\n if (err instanceof UniHttpError) {\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(err, PollingErrorMode.STOP, ref);\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(err, errorMode, ref);\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 rispetta è di tipo HttpException\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 } else {\r\n // Fallback per errori non di tipo HttpException (es. pagine HTML di errore di IIS/Nginx o stringhe piane)\r\n const error = 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 : error.message,\r\n type: 'ErrorBase',\r\n stackTrace: error.stack ?? '',\r\n isBe: true,\r\n };\r\n throw new UniHttpError('base', res.status, url, fallbackException);\r\n }\r\n } catch (error: unknown) {\r\n // Fallback per errori di rete locale (es. assenza di linea, DNS fallito, timeout di fetch)\r\n if (error instanceof TypeError) {\r\n const fallbackNetworkException: HttpException = {\r\n message: error.message,\r\n type: error.name || 'TypeError',\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 senza alterazioni per istanze di UniHttpError o eccezioni non identificate\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 { 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(map((x) => [...x.values()].some((y) => y.pendingCount > 0)));\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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;IAAY;AAA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,MAAM,EAAE,MAAM,WAAW,CAAI,GAAG,EAAE,UAAU,CAAC,CAAC;IACzE;AAEA;;AAEG;AACI,IAAA,OAAO,cAAc,CAC1B,MAA4B,EAC5B,IAAe,EAAA;;AAGf,QAAA,MAAM,UAAU,GAAgB;YAC9B,GAAG,MAAM,CAAC,IAAI;AACd,YAAA,MAAM,EAAE,KAAK;SACd;AACD,QAAA,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,UAAU,CAAC,OAAO,GAAG;gBACnB,GAAG,UAAU,CAAC,OAAO;AACrB,gBAAA,cAAc,EAAE,kBAAkB;aACnC;YACD,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QACxC;;AAGA,QAAA,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;AACpD,QAAA,OAAO,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,WAAW,CAAI,GAAG,EAAE,UAAU,CAAC,CAAC;IACzE;;;AC/QF;;AAEG;;;;"}
|
package/fesm2022/uni-manager.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import { concatMap } from 'rxjs/internal/operators/concatMap';
|
|
|
17
17
|
import { exhaustMap } from 'rxjs/internal/operators/exhaustMap';
|
|
18
18
|
import { mergeMap } from 'rxjs/internal/operators/mergeMap';
|
|
19
19
|
import { switchMap } from 'rxjs/internal/operators/switchMap';
|
|
20
|
-
import { UniHttpError,
|
|
20
|
+
import { UniHttpError, isHttpException } from 'uni-error/http';
|
|
21
21
|
import { UniTypeDateManager as UniTypeDateManager$1 } from 'uni-manager/type';
|
|
22
22
|
import { UniLocaleManager as UniLocaleManager$1 } from 'uni-manager/locale';
|
|
23
23
|
|
|
@@ -415,59 +415,62 @@ function updateHasError(id, hasError) {
|
|
|
415
415
|
|
|
416
416
|
async function execute(url, init) {
|
|
417
417
|
try {
|
|
418
|
-
/*
|
|
418
|
+
/* Esecuzione della richiesta HTTP nativa */
|
|
419
419
|
const res = await fetch(url, init);
|
|
420
|
-
/*
|
|
420
|
+
/* Gestione dello stato 204: assenza di contenuto legittima */
|
|
421
421
|
if (res.status === 204) {
|
|
422
422
|
return undefined;
|
|
423
423
|
}
|
|
424
|
-
/*
|
|
424
|
+
/*Gestione ok HTTP: risposta ricevuta dal server con stato valido */
|
|
425
425
|
if (res.ok) {
|
|
426
426
|
return res;
|
|
427
427
|
}
|
|
428
|
-
/* Errore HTTP
|
|
429
|
-
let
|
|
428
|
+
/* Gestione Errore HTTP: risposta ricevuta dal server ma con stato non valido */
|
|
429
|
+
let httpErrorPayload;
|
|
430
430
|
try {
|
|
431
|
-
/*
|
|
431
|
+
/* Clonazione della risposta per l'ispezione del payload senza consumare lo stream originale */
|
|
432
432
|
const resClone = res.clone();
|
|
433
433
|
/* Recupero se è un json */
|
|
434
434
|
const contentType = res.headers.get('content-type') ?? '';
|
|
435
435
|
const isJson = contentType.startsWith('application/json');
|
|
436
|
-
/*
|
|
437
|
-
|
|
436
|
+
/* Estrazione del corpo dell'errore in base al formato rilevato */
|
|
437
|
+
httpErrorPayload = isJson ? await resClone.json() : await resClone.text();
|
|
438
438
|
}
|
|
439
439
|
catch {
|
|
440
|
-
|
|
441
|
-
|
|
440
|
+
/* Fallback in caso di fallimento della clonazione o del parsing del testo */
|
|
441
|
+
httpErrorPayload = `Failed to parse error response body (Status: ${res.status})`;
|
|
442
442
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
443
|
+
// Controllo: se il payload estratto rispetta è di tipo HttpException
|
|
444
|
+
if (isHttpException(httpErrorPayload)) {
|
|
445
|
+
// const type = httpErrorPayload.isBe ? 'be' : 'ice';
|
|
446
|
+
throw new UniHttpError('be', res.status, url, httpErrorPayload);
|
|
446
447
|
}
|
|
447
448
|
else {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
449
|
+
// Fallback per errori non di tipo HttpException (es. pagine HTML di errore di IIS/Nginx o stringhe piane)
|
|
450
|
+
const error = new Error(res.statusText || `HTTP Error ${res.status}`);
|
|
451
|
+
const fallbackException = {
|
|
452
|
+
message: typeof httpErrorPayload === 'string' && httpErrorPayload
|
|
453
|
+
? httpErrorPayload
|
|
454
|
+
: error.message,
|
|
455
|
+
type: 'ErrorBase',
|
|
453
456
|
stackTrace: error.stack ?? '',
|
|
454
|
-
|
|
457
|
+
isBe: true,
|
|
458
|
+
};
|
|
459
|
+
throw new UniHttpError('base', res.status, url, fallbackException);
|
|
455
460
|
}
|
|
456
461
|
}
|
|
457
462
|
catch (error) {
|
|
458
|
-
//
|
|
459
|
-
if (error instanceof UniHttpError) {
|
|
460
|
-
throw error;
|
|
461
|
-
}
|
|
463
|
+
// Fallback per errori di rete locale (es. assenza di linea, DNS fallito, timeout di fetch)
|
|
462
464
|
if (error instanceof TypeError) {
|
|
463
|
-
|
|
464
|
-
exceptionMessage: `${error.name}: ${error.message}\n${error.stack}`,
|
|
465
|
-
exceptionType: error.name,
|
|
465
|
+
const fallbackNetworkException = {
|
|
466
466
|
message: error.message,
|
|
467
|
+
type: error.name || 'TypeError',
|
|
467
468
|
stackTrace: error.stack ?? '',
|
|
468
|
-
|
|
469
|
+
isBe: true,
|
|
470
|
+
};
|
|
471
|
+
throw new UniHttpError('network', -1, url, fallbackNetworkException);
|
|
469
472
|
}
|
|
470
|
-
//
|
|
473
|
+
// Rilancio diretto senza alterazioni per istanze di UniHttpError o eccezioni non identificate
|
|
471
474
|
throw error;
|
|
472
475
|
}
|
|
473
476
|
}
|
|
@@ -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 type { IUniFeError } from 'uni-error/fe';\r\nimport type { IUniHttpError } from 'uni-error/http';\r\n\r\nexport class UniErrorManager {\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'.\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\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 UniErrorManager.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 = UniErrorManager.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 UniErrorManager.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 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 err: unknown,\r\n errorMode: PollingErrorMode,\r\n ref: string,\r\n): Observable<never> {\r\n // Controllo: sia effettivamente un errore di tipo 'UniHttpError'\r\n if (err instanceof UniHttpError) {\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(err, PollingErrorMode.STOP, ref);\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(err, errorMode, ref);\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 { isHttpErrorBody, 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 /* Esegue chiamata http */\r\n const res = await fetch(url, init);\r\n\r\n /* Nessun contenuto cons status 204 */\r\n if (res.status === 204) {\r\n return undefined;\r\n }\r\n\r\n /* Risposta ok */\r\n if (res.ok) {\r\n return res;\r\n }\r\n\r\n /* Errore HTTP (quindi risposta ricevuta ma non ok) */\r\n let errorBody: unknown;\r\n try {\r\n /* Clona risposta per leggerla senza consumare la 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 /* Aggiorna body con struttura errore */\r\n errorBody = isJson ? await resClone.json() : await resClone.text();\r\n } catch {\r\n // Se il clone o il parsing falliscono, si usa una stringa di fallback sicura\r\n errorBody = `Failed to parse error response body (Status: ${res.status})`;\r\n }\r\n\r\n if (isHttpErrorBody(errorBody)) {\r\n const type = errorBody.exceptionType.includes('HttpRequestException') ? 'be' : 'ice';\r\n throw new UniHttpError(type, res.status, url, errorBody);\r\n } else {\r\n const error = new Error(`HTTP ${res.statusText}`);\r\n throw new UniHttpError('base', res.status, url, {\r\n exceptionMessage: error.message,\r\n exceptionType: 'ErrorBase',\r\n message: error.message,\r\n stackTrace: error.stack ?? '',\r\n });\r\n }\r\n } catch (error: unknown) {\r\n // Se l'errore è già un UniHttpError (lanciato sopra) bypassa tutto il resto\r\n if (error instanceof UniHttpError) {\r\n throw error;\r\n }\r\n\r\n if (error instanceof TypeError) {\r\n throw new UniHttpError('network', -1, url, {\r\n exceptionMessage: `${error.name}: ${error.message}\\n${error.stack}`,\r\n exceptionType: error.name,\r\n message: error.message,\r\n stackTrace: error.stack ?? '',\r\n });\r\n }\r\n\r\n // Fallback per qualsiasi altro tipo di errore sconosciuto\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 { 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(map((x) => [...x.values()].some((y) => y.pendingCount > 0)));\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":";;;;;;;;;;;;;;;;;;;;;;;MAKa,eAAe,CAAA;;;;;aAKX,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,QAAA,MAAM,MAAM,GAAG,eAAe,CAAC,YAAY;;QAG3C,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,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;IACpC;AAEA;;A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,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 type { IUniFeError } from 'uni-error/fe';\r\nimport type { IUniHttpError } from 'uni-error/http';\r\n\r\nexport class UniErrorManager {\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'.\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\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 UniErrorManager.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 = UniErrorManager.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 UniErrorManager.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 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 err: unknown,\r\n errorMode: PollingErrorMode,\r\n ref: string,\r\n): Observable<never> {\r\n // Controllo: sia effettivamente un errore di tipo 'UniHttpError'\r\n if (err instanceof UniHttpError) {\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(err, PollingErrorMode.STOP, ref);\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(err, errorMode, ref);\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 rispetta è di tipo HttpException\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 } else {\r\n // Fallback per errori non di tipo HttpException (es. pagine HTML di errore di IIS/Nginx o stringhe piane)\r\n const error = 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 : error.message,\r\n type: 'ErrorBase',\r\n stackTrace: error.stack ?? '',\r\n isBe: true,\r\n };\r\n throw new UniHttpError('base', res.status, url, fallbackException);\r\n }\r\n } catch (error: unknown) {\r\n // Fallback per errori di rete locale (es. assenza di linea, DNS fallito, timeout di fetch)\r\n if (error instanceof TypeError) {\r\n const fallbackNetworkException: HttpException = {\r\n message: error.message,\r\n type: error.name || 'TypeError',\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 senza alterazioni per istanze di UniHttpError o eccezioni non identificate\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 { 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(map((x) => [...x.values()].some((y) => y.pendingCount > 0)));\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":";;;;;;;;;;;;;;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