uni-manager 0.1.51 → 0.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { switchMap, mergeMap, concatMap, exhaustMap,
|
|
1
|
+
import { switchMap, mergeMap, concatMap, exhaustMap, of, throwError, EMPTY, defer, from, tap, catchError, finalize, timer, distinctUntilChanged, BehaviorSubject, map } from 'rxjs';
|
|
2
2
|
import { UniToastManager } from 'uni-manager/toast';
|
|
3
3
|
import isEqual from 'lodash-es/isEqual';
|
|
4
4
|
import { UniErrorManager } from 'uni-manager/error';
|
|
@@ -26,6 +26,11 @@ function operatorHandler(operator) {
|
|
|
26
26
|
function errorHandler(ref, error, errorMode) {
|
|
27
27
|
// Controllo: sia effettivamente un errore di tipo 'UniHttpError'
|
|
28
28
|
if (error instanceof UniHttpError) {
|
|
29
|
+
// In caso sia un errore server (es: connessione caduta) viene ripristinato automaticamente
|
|
30
|
+
if (error.type === 'network') {
|
|
31
|
+
UniErrorManager.add(ref, error);
|
|
32
|
+
return of();
|
|
33
|
+
}
|
|
29
34
|
switch (errorMode) {
|
|
30
35
|
case PollingErrorMode.IGNORE: {
|
|
31
36
|
return of();
|
|
@@ -105,7 +110,7 @@ function http$(url, refType, config, promiseCallback) {
|
|
|
105
110
|
* Avvia e coordina un ciclo di polling a intervalli regolari.
|
|
106
111
|
* Gestisce la concorrenza tramite operatori RxJS configurabili, la rimozione dei popup, di errore nelle iterazioni successive e i comportamenti custom al primo avvio.
|
|
107
112
|
*/
|
|
108
|
-
function httpPolling$(url, config,
|
|
113
|
+
function httpPolling$(url, config, executeHttpCallback) {
|
|
109
114
|
/* Recupero configurazione */
|
|
110
115
|
const { interval, ref, operator = MapOperator.SWITCH_MAP, errorMode = PollingErrorMode.STOP, emitValueMode = EmitValueMode.ON_NEW_DATA, firstIteration, } = config;
|
|
111
116
|
const timer$ = timer(0, interval);
|
|
@@ -126,7 +131,7 @@ function httpPolling$(url, config, promiseFactory) {
|
|
|
126
131
|
UniHttpManager.updateIsLoading(ref, 1);
|
|
127
132
|
}
|
|
128
133
|
return defer(() => {
|
|
129
|
-
const http$ = from(
|
|
134
|
+
const http$ = from(executeHttpCallback());
|
|
130
135
|
return http$.pipe(tap({
|
|
131
136
|
unsubscribe: () => {
|
|
132
137
|
/* Disattivazione loader per sicurezza se il flusso si interrompe prima della risposta */
|
|
@@ -153,7 +158,8 @@ function httpPolling$(url, config, promiseFactory) {
|
|
|
153
158
|
}
|
|
154
159
|
}
|
|
155
160
|
/* Meccanismo di ripristino automatico: se il polling torna in salute, cancella l'errore dallo store e nasconde i relativi messaggi a schermo */
|
|
156
|
-
if (errorMode === PollingErrorMode.IGNORE_WITH_ERROR
|
|
161
|
+
if (errorMode === PollingErrorMode.IGNORE_WITH_ERROR ||
|
|
162
|
+
UniErrorManager.currentValue.get(ref)?.uniError?.type === 'network') {
|
|
157
163
|
UniHttpManager.updateHasError(ref, false);
|
|
158
164
|
UniErrorManager.remove(ref);
|
|
159
165
|
}
|
|
@@ -164,7 +170,7 @@ function httpPolling$(url, config, promiseFactory) {
|
|
|
164
170
|
UniHttpManager.updateIsLoading(ref, -1);
|
|
165
171
|
isLoaderActive = false;
|
|
166
172
|
}
|
|
167
|
-
|
|
173
|
+
/* Aggiorna la ref nella map */
|
|
168
174
|
UniHttpManager.updateHasError(ref, true);
|
|
169
175
|
/* Gestione errore */
|
|
170
176
|
return errorHandler(ref, error, errorMode);
|
|
@@ -222,126 +228,236 @@ async function executeBlob(request) {
|
|
|
222
228
|
/**
|
|
223
229
|
* Esegue una richiesta HTTP nativa gestendo l'imbuto dei 4 casi d'errore.
|
|
224
230
|
*/
|
|
231
|
+
// async function execute2(request: Request): Promise<Response> {
|
|
232
|
+
// const startTime = performance.now();
|
|
233
|
+
// const requestClone = request.clone();
|
|
234
|
+
// try {
|
|
235
|
+
// /* Esecuzione della richiesta HTTP nativa */
|
|
236
|
+
// const res = await fetch(request);
|
|
237
|
+
// /* Calcolo durata */
|
|
238
|
+
// const durationMs = Math.round(performance.now() - startTime);
|
|
239
|
+
// /* Gestione ok HTTP: chiamata andata a buon fine. Viene restituita la risposta al chiamante. */
|
|
240
|
+
// if (res.ok) {
|
|
241
|
+
// return res;
|
|
242
|
+
// }
|
|
243
|
+
// /* Gestione Errore HTTP: la chiamata è arrivata al server ma ha restituito uno stato 4xx o 5xx */
|
|
244
|
+
// let httpError: unknown;
|
|
245
|
+
// try {
|
|
246
|
+
// /* Clonazione della risposta per l'ispezione del payload senza consumare lo stream originale */
|
|
247
|
+
// const resClone = res.clone();
|
|
248
|
+
// /* Verifica se il formato è un JSON */
|
|
249
|
+
// const contentType = res.headers.get('content-type') ?? '';
|
|
250
|
+
// const isJson = contentType.startsWith('application/json');
|
|
251
|
+
// /* Estrazione del corpo dell'errore in base al formato rilevato */
|
|
252
|
+
// httpError = isJson ? await resClone.json() : await resClone.text();
|
|
253
|
+
// } catch {
|
|
254
|
+
// /* Fallback in caso di fallimento della clonazione o del parsing del testo */
|
|
255
|
+
// httpError = `Failed to parse error response body (Status: ${res.status})`;
|
|
256
|
+
// }
|
|
257
|
+
// // ERRORE CON STATUS, CASO A: errore applicativo backend ('be')
|
|
258
|
+
// // Se il payload estratto supera il controllo 'isHttpException', significa che la richiesta è stata elaborata dal codice C#, ha intercettato il GlobalExceptionHandler ed è ritornata come JSON strutturato.
|
|
259
|
+
// // Questo scenario si applica a qualsiasi codice (400, 404, 500, ecc.) purché sia formattato dal backend.
|
|
260
|
+
// if (isErrorResponse(httpError)) {
|
|
261
|
+
// const errorResponse = httpError;
|
|
262
|
+
// throw new UniHttpError({
|
|
263
|
+
// type: 'be',
|
|
264
|
+
// request: requestClone,
|
|
265
|
+
// httpStatus: res.status,
|
|
266
|
+
// durationMs,
|
|
267
|
+
// userAgent: navigator.userAgent,
|
|
268
|
+
// error: errorResponse,
|
|
269
|
+
// });
|
|
270
|
+
// }
|
|
271
|
+
// // ERRORE CON STATUS, CASO B: errore infrastrutturale del server ('server')
|
|
272
|
+
// // Se l'esecuzione raggiunge questo punto, il server ha risposto con un errore (es. 404, 405, 502, 504) ma non ha restituito il JSON customizzato.
|
|
273
|
+
// // Rappresenta il blocco da parte del server web (IIS, Nginx, Proxy) che ha rifiutato la chiamata o ha risposto con una pagina HTML/Testo standard.
|
|
274
|
+
// // Di conseguenza, il flag 'isBe' deve essere impostato a false poiché non deriva dalla logica applicativa.
|
|
275
|
+
// const defaultMessage = `HTTP Error ${res.status}${res.statusText ? ` (${res.statusText})` : ''}`;
|
|
276
|
+
// const errorTracker = new Error(defaultMessage);
|
|
277
|
+
// const rawError = typeof httpError === 'string' ? httpError.trim() : '';
|
|
278
|
+
// let finalMessage: string;
|
|
279
|
+
// if (rawError) {
|
|
280
|
+
// // Estrazione della prima riga per l'analisi del tipo di errore
|
|
281
|
+
// const firstLine = rawError.split('\n', 1)[0];
|
|
282
|
+
// const exceptionRegex = /^([a-zA-Z0-9.]+\.Exception):/i;
|
|
283
|
+
// // Verifica se la riga segue il formato standard .NET o un pattern di eccezione custom
|
|
284
|
+
// if (
|
|
285
|
+
// exceptionRegex.test(firstLine) ||
|
|
286
|
+
// firstLine.startsWith('System.') ||
|
|
287
|
+
// firstLine.startsWith('Microsoft.')
|
|
288
|
+
// ) {
|
|
289
|
+
// const colonIndex = firstLine.indexOf(': ');
|
|
290
|
+
// finalMessage = colonIndex === -1 ? firstLine : firstLine.slice(colonIndex + 2);
|
|
291
|
+
// }
|
|
292
|
+
// // Priorità: Mantenimento dell'intero corpo per errori HTML o testo generico
|
|
293
|
+
// else {
|
|
294
|
+
// finalMessage = rawError;
|
|
295
|
+
// }
|
|
296
|
+
// }
|
|
297
|
+
// // Utilizzo del messaggio di default in assenza di corpo nell'errore
|
|
298
|
+
// else {
|
|
299
|
+
// finalMessage = defaultMessage;
|
|
300
|
+
// }
|
|
301
|
+
// const errorResponse: ErrorResponse = {
|
|
302
|
+
// exception: {
|
|
303
|
+
// isBe: false,
|
|
304
|
+
// type: 'ServerError',
|
|
305
|
+
// message: finalMessage,
|
|
306
|
+
// stackTrace: errorTracker.stack ?? '',
|
|
307
|
+
// },
|
|
308
|
+
// innerException: null,
|
|
309
|
+
// };
|
|
310
|
+
// throw new UniHttpError({
|
|
311
|
+
// type: 'server',
|
|
312
|
+
// request: requestClone,
|
|
313
|
+
// httpStatus: res.status,
|
|
314
|
+
// durationMs,
|
|
315
|
+
// userAgent: navigator.userAgent,
|
|
316
|
+
// error: errorResponse,
|
|
317
|
+
// });
|
|
318
|
+
// } catch (error: unknown) {
|
|
319
|
+
// // ERRORE CON/SENZA STATUS: già gestito, rilancio diretto.
|
|
320
|
+
// // Se l'errore è un'istanza di UniHttpError (lanciata nei blocchi superiori per 'be' o 'server'), significa che è già stata catalogata correttamente.
|
|
321
|
+
// // Viene eseguito il rilancio diretto.
|
|
322
|
+
// if (error instanceof UniHttpError) {
|
|
323
|
+
// throw error;
|
|
324
|
+
// }
|
|
325
|
+
// // ERRORE SENZA STATUS, CASO A: errore di rete locale ('network')
|
|
326
|
+
// // Si verifica solo se la fetch() fallisce prima di stabilire un contatto con il server.
|
|
327
|
+
// // Il browser solleva un 'TypeError' (es. "Failed to fetch").
|
|
328
|
+
// if (error instanceof TypeError) {
|
|
329
|
+
// const fallbackException: ErrorResponse = {
|
|
330
|
+
// exception: {
|
|
331
|
+
// isBe: false,
|
|
332
|
+
// type: error.name || 'NetworkError',
|
|
333
|
+
// message: error.message,
|
|
334
|
+
// stackTrace: error.stack ?? '',
|
|
335
|
+
// },
|
|
336
|
+
// innerException: null,
|
|
337
|
+
// };
|
|
338
|
+
// throw new UniHttpError({
|
|
339
|
+
// type: 'network',
|
|
340
|
+
// request: requestClone,
|
|
341
|
+
// httpStatus: 0,
|
|
342
|
+
// durationMs: 0,
|
|
343
|
+
// userAgent: navigator.userAgent,
|
|
344
|
+
// error: fallbackException,
|
|
345
|
+
// });
|
|
346
|
+
// }
|
|
347
|
+
// // ERRORE SENZA STATUS, CASO B: errore frontend ('fe')
|
|
348
|
+
// // Qualsiasi altro errore imprevisto che non derivi da un fallimento della fetch o della risposta.
|
|
349
|
+
// throw error;
|
|
350
|
+
// }
|
|
351
|
+
// }
|
|
225
352
|
async function execute(request) {
|
|
226
353
|
const startTime = performance.now();
|
|
227
354
|
const requestClone = request.clone();
|
|
355
|
+
let res;
|
|
228
356
|
try {
|
|
229
357
|
/* Esecuzione della richiesta HTTP nativa */
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
let httpError;
|
|
239
|
-
try {
|
|
240
|
-
/* Clonazione della risposta per l'ispezione del payload senza consumare lo stream originale */
|
|
241
|
-
const resClone = res.clone();
|
|
242
|
-
/* Verifica se il formato è un JSON */
|
|
243
|
-
const contentType = res.headers.get('content-type') ?? '';
|
|
244
|
-
const isJson = contentType.startsWith('application/json');
|
|
245
|
-
/* Estrazione del corpo dell'errore in base al formato rilevato */
|
|
246
|
-
httpError = isJson ? await resClone.json() : await resClone.text();
|
|
247
|
-
}
|
|
248
|
-
catch {
|
|
249
|
-
/* Fallback in caso di fallimento della clonazione o del parsing del testo */
|
|
250
|
-
httpError = `Failed to parse error response body (Status: ${res.status})`;
|
|
251
|
-
}
|
|
252
|
-
// ERRORE CON STATUS, CASO A: errore applicativo backend ('be')
|
|
253
|
-
// Se il payload estratto supera il controllo 'isHttpException', significa che la richiesta è stata elaborata dal codice C#, ha intercettato il GlobalExceptionHandler ed è ritornata come JSON strutturato.
|
|
254
|
-
// Questo scenario si applica a qualsiasi codice (400, 404, 500, ecc.) purché sia formattato dal backend.
|
|
255
|
-
if (isErrorResponse(httpError)) {
|
|
256
|
-
const errorResponse = httpError;
|
|
257
|
-
throw new UniHttpError({
|
|
258
|
-
type: 'be',
|
|
259
|
-
request: requestClone,
|
|
260
|
-
httpStatus: res.status,
|
|
261
|
-
durationMs,
|
|
262
|
-
userAgent: navigator.userAgent,
|
|
263
|
-
error: errorResponse,
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
// ERRORE CON STATUS, CASO B: errore infrastrutturale del server ('server')
|
|
267
|
-
// Se l'esecuzione raggiunge questo punto, il server ha risposto con un errore (es. 404, 405, 502, 504) ma non ha restituito il JSON customizzato.
|
|
268
|
-
// Rappresenta il blocco da parte del server web (IIS, Nginx, Proxy) che ha rifiutato la chiamata o ha risposto con una pagina HTML/Testo standard.
|
|
269
|
-
// Di conseguenza, il flag 'isBe' deve essere impostato a false poiché non deriva dalla logica applicativa.
|
|
270
|
-
const defaultMessage = `HTTP Error ${res.status}${res.statusText ? ` (${res.statusText})` : ''}`;
|
|
271
|
-
const errorTracker = new Error(defaultMessage);
|
|
272
|
-
const rawError = typeof httpError === 'string' ? httpError.trim() : '';
|
|
273
|
-
let finalMessage;
|
|
274
|
-
if (rawError) {
|
|
275
|
-
// Estrazione della prima riga per l'analisi del tipo di errore
|
|
276
|
-
const firstLine = rawError.split('\n', 1)[0];
|
|
277
|
-
const exceptionRegex = /^([a-zA-Z0-9.]+\.Exception):/i;
|
|
278
|
-
// Verifica se la riga segue il formato standard .NET o un pattern di eccezione custom
|
|
279
|
-
if (exceptionRegex.test(firstLine) ||
|
|
280
|
-
firstLine.startsWith('System.') ||
|
|
281
|
-
firstLine.startsWith('Microsoft.')) {
|
|
282
|
-
const colonIndex = firstLine.indexOf(': ');
|
|
283
|
-
finalMessage = colonIndex === -1 ? firstLine : firstLine.slice(colonIndex + 2);
|
|
284
|
-
}
|
|
285
|
-
// Priorità: Mantenimento dell'intero corpo per errori HTML o testo generico
|
|
286
|
-
else {
|
|
287
|
-
finalMessage = rawError;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
// Utilizzo del messaggio di default in assenza di corpo nell'errore
|
|
291
|
-
else {
|
|
292
|
-
finalMessage = defaultMessage;
|
|
293
|
-
}
|
|
294
|
-
const errorResponse = {
|
|
358
|
+
res = await fetch(request);
|
|
359
|
+
}
|
|
360
|
+
catch (error) {
|
|
361
|
+
// ERRORE: NETWORK
|
|
362
|
+
// ERRORE SENZA STATUS, errore di rete locale
|
|
363
|
+
// Si verifica solo se la fetch() fallisce prima di stabilire un contatto con il server.
|
|
364
|
+
// Il browser solleva un 'TypeError' (es. "Failed to fetch").
|
|
365
|
+
const fallbackException = {
|
|
295
366
|
exception: {
|
|
296
367
|
isBe: false,
|
|
297
|
-
type: '
|
|
298
|
-
message:
|
|
299
|
-
stackTrace:
|
|
368
|
+
type: error instanceof Error ? error.name : 'NetworkError',
|
|
369
|
+
message: error instanceof Error ? error.message : 'Unknown network error',
|
|
370
|
+
stackTrace: error instanceof Error ? (error.stack ?? '') : '',
|
|
300
371
|
},
|
|
301
372
|
innerException: null,
|
|
302
373
|
};
|
|
303
374
|
throw new UniHttpError({
|
|
304
|
-
type: '
|
|
375
|
+
type: 'network',
|
|
376
|
+
request: requestClone,
|
|
377
|
+
httpStatus: 0,
|
|
378
|
+
durationMs: Math.round(performance.now() - startTime),
|
|
379
|
+
userAgent: navigator.userAgent,
|
|
380
|
+
error: fallbackException,
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
/* Gestione ok HTTP: chiamata andata a buon fine. Viene restituita la risposta al chiamante. */
|
|
384
|
+
if (res.ok) {
|
|
385
|
+
return res;
|
|
386
|
+
}
|
|
387
|
+
/* Gestione Errore HTTP: la chiamata è arrivata al server ma ha restituito uno stato 4xx o 5xx */
|
|
388
|
+
let httpError;
|
|
389
|
+
try {
|
|
390
|
+
/* Clonazione della risposta per l'ispezione del payload senza consumare lo stream originale */
|
|
391
|
+
const resClone = res.clone();
|
|
392
|
+
/* Verifica se il formato è un JSON, estrazione del corpo dell'errore in base al formato rilevato */
|
|
393
|
+
const contentType = res.headers.get('content-type') ?? '';
|
|
394
|
+
const isJson = contentType.includes('json');
|
|
395
|
+
httpError = isJson ? await resClone.json() : await resClone.text();
|
|
396
|
+
}
|
|
397
|
+
catch {
|
|
398
|
+
/* Fallback in caso di fallimento della clonazione o del parsing del testo */
|
|
399
|
+
httpError = `Failed to parse error response body (Status: ${res.status})`;
|
|
400
|
+
}
|
|
401
|
+
// ERRORE: BE
|
|
402
|
+
// ERRORE CON STATUS: errore applicativo backend
|
|
403
|
+
// Se il payload estratto supera il controllo 'isHttpException', significa che la richiesta è stata elaborata dal codice C#, ha intercettato il GlobalExceptionHandler ed è ritornata come JSON strutturato.
|
|
404
|
+
// Questo scenario si applica a qualsiasi codice (400, 404, 500, ecc.) purché sia formattato dal backend.
|
|
405
|
+
if (isErrorResponse(httpError)) {
|
|
406
|
+
throw new UniHttpError({
|
|
407
|
+
type: 'be',
|
|
305
408
|
request: requestClone,
|
|
306
409
|
httpStatus: res.status,
|
|
307
|
-
durationMs,
|
|
410
|
+
durationMs: Math.round(performance.now() - startTime),
|
|
308
411
|
userAgent: navigator.userAgent,
|
|
309
|
-
error:
|
|
412
|
+
error: httpError,
|
|
310
413
|
});
|
|
311
414
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
415
|
+
// ERRORE: SERVER
|
|
416
|
+
// ERRORE CON STATUS: errore infrastrutturale del server
|
|
417
|
+
// Se l'esecuzione raggiunge questo punto, il server ha risposto con un errore (es. 404, 405, 502, 504) ma non ha restituito il JSON customizzato.
|
|
418
|
+
// Rappresenta il blocco da parte del server web (IIS, Nginx, Proxy) che ha rifiutato la chiamata o ha risposto con una pagina HTML/Testo standard.
|
|
419
|
+
// Di conseguenza, il flag 'isBe' deve essere impostato a false poiché non deriva dalla logica applicativa.
|
|
420
|
+
const defaultMessage = `HTTP Error ${res.status}` + (res.statusText ? ` (${res.statusText})` : '');
|
|
421
|
+
const tracker = new Error(defaultMessage);
|
|
422
|
+
const rawError = typeof httpError === 'string' ? httpError.trim() : '';
|
|
423
|
+
let finalMessage;
|
|
424
|
+
if (rawError) {
|
|
425
|
+
// Estrazione della prima riga per l'analisi del tipo di errore
|
|
426
|
+
const firstLine = rawError.split('\n', 1)[0];
|
|
427
|
+
const exceptionRegex = /^([a-zA-Z0-9.]+\.Exception):/i;
|
|
428
|
+
// Verifica se la riga segue il formato standard .NET o un pattern di eccezione custom
|
|
429
|
+
if (exceptionRegex.test(firstLine) ||
|
|
430
|
+
firstLine.startsWith('System.') ||
|
|
431
|
+
firstLine.startsWith('Microsoft.')) {
|
|
432
|
+
const colonIndex = firstLine.indexOf(': ');
|
|
433
|
+
finalMessage = colonIndex === -1 ? firstLine : firstLine.slice(colonIndex + 2);
|
|
318
434
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
if (error instanceof TypeError) {
|
|
323
|
-
const fallbackException = {
|
|
324
|
-
exception: {
|
|
325
|
-
isBe: false,
|
|
326
|
-
type: error.name || 'NetworkError',
|
|
327
|
-
message: error.message,
|
|
328
|
-
stackTrace: error.stack ?? '',
|
|
329
|
-
},
|
|
330
|
-
innerException: null,
|
|
331
|
-
};
|
|
332
|
-
throw new UniHttpError({
|
|
333
|
-
type: 'network',
|
|
334
|
-
request: requestClone,
|
|
335
|
-
httpStatus: 0,
|
|
336
|
-
durationMs: 0,
|
|
337
|
-
userAgent: navigator.userAgent,
|
|
338
|
-
error: fallbackException,
|
|
339
|
-
});
|
|
435
|
+
else {
|
|
436
|
+
// Priorità: mantenimento dell'intero corpo per errori HTML o testo generico
|
|
437
|
+
finalMessage = rawError;
|
|
340
438
|
}
|
|
341
|
-
// ERRORE SENZA STATUS, CASO B: errore frontend ('fe')
|
|
342
|
-
// Qualsiasi altro errore imprevisto che non derivi da un fallimento della fetch o della risposta.
|
|
343
|
-
throw error;
|
|
344
439
|
}
|
|
440
|
+
else {
|
|
441
|
+
// Utilizzo del messaggio di default in assenza di corpo nell'errore
|
|
442
|
+
finalMessage = defaultMessage;
|
|
443
|
+
}
|
|
444
|
+
const errorResponse = {
|
|
445
|
+
exception: {
|
|
446
|
+
isBe: false,
|
|
447
|
+
type: 'ServerError',
|
|
448
|
+
message: finalMessage,
|
|
449
|
+
stackTrace: tracker.stack ?? '',
|
|
450
|
+
},
|
|
451
|
+
innerException: null,
|
|
452
|
+
};
|
|
453
|
+
throw new UniHttpError({
|
|
454
|
+
type: 'server',
|
|
455
|
+
request: requestClone,
|
|
456
|
+
httpStatus: res.status,
|
|
457
|
+
durationMs: Math.round(performance.now() - startTime),
|
|
458
|
+
userAgent: navigator.userAgent,
|
|
459
|
+
error: errorResponse,
|
|
460
|
+
});
|
|
345
461
|
}
|
|
346
462
|
/**
|
|
347
463
|
* Gestione errore in caso di assenza di risposta quando invece era prevista
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uni-manager-http.mjs","sources":["../../../projects/uni-manager/http/handler.ts","../../../projects/uni-manager/http/core.ts","../../../projects/uni-manager/http/execute.ts","../../../projects/uni-manager/http/utilities.ts","../../../projects/uni-manager/http/manager.ts","../../../projects/uni-manager/http/uni-manager-http.ts"],"sourcesContent":["import {\r\n EMPTY,\r\n Observable,\r\n OperatorFunction,\r\n concatMap,\r\n exhaustMap,\r\n mergeMap,\r\n of,\r\n switchMap,\r\n throwError,\r\n} from 'rxjs';\r\nimport { UniHttpError } from 'uni-error/http';\r\nimport { UniErrorManager } from 'uni-manager/error';\r\nimport { MapOperator, PollingErrorMode } from 'uni-model-type/enum';\r\n\r\nexport function operatorHandler<T>(\r\n operator: MapOperator,\r\n): (project: (value: number) => Observable<T>) => OperatorFunction<number, T> {\r\n // Gestione della concorrenza in base al parametro\r\n switch (operator) {\r\n case MapOperator.EXHAUST_MAP: {\r\n return (project) => exhaustMap(project);\r\n }\r\n case MapOperator.CONCAT_MAP: {\r\n return (project) => concatMap(project);\r\n }\r\n case MapOperator.MERGE_MAP: {\r\n return (project) => mergeMap(project);\r\n }\r\n case MapOperator.SWITCH_MAP: {\r\n return (project) => switchMap(project);\r\n }\r\n }\r\n}\r\n\r\nexport function errorHandler(\r\n ref: string,\r\n error: unknown,\r\n errorMode: PollingErrorMode,\r\n): Observable<never> {\r\n // Controllo: sia effettivamente un errore di tipo 'UniHttpError'\r\n if (error 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, error);\r\n return of();\r\n }\r\n case PollingErrorMode.STOP: {\r\n UniErrorManager.add(ref, error);\r\n return throwError(() => error);\r\n }\r\n }\r\n } else {\r\n return throwError(() => error);\r\n }\r\n}\r\n","/* eslint-disable unicorn/prefer-early-return */\r\nimport isEqual from 'lodash-es/isEqual';\r\nimport {\r\n Observable,\r\n catchError,\r\n defer,\r\n distinctUntilChanged,\r\n finalize,\r\n from,\r\n tap,\r\n timer,\r\n} from 'rxjs';\r\nimport { UniErrorManager } from 'uni-manager/error';\r\nimport { UniToastManager } from 'uni-manager/toast';\r\nimport { EmitValueMode, MapOperator, PollingErrorMode } from 'uni-model-type/enum';\r\nimport type { HttpConfig, HttpConfigPolling, HttpRef } from 'uni-model-type/type';\r\n\r\nimport { errorHandler, operatorHandler } from './handler';\r\nimport { UniHttpManager } from './manager';\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: string,\r\n refType: HttpRef['type'],\r\n config: HttpConfig<T>,\r\n promiseCallback: () => Promise<T>,\r\n): Observable<T> {\r\n /* Recupero configurazione */\r\n const { ref, toast, hasLoader } = config;\r\n\r\n // Usiamo un flag let per garantire che il loader venga spento una sola volta\r\n let isLoaderActive = hasLoader !== false;\r\n\r\n return defer(() => {\r\n const http$ = from(promiseCallback());\r\n return http$.pipe(\r\n tap({\r\n subscribe: () => {\r\n /* Creazione reference */\r\n UniHttpManager.add(ref, new URL(url), refType);\r\n\r\n /* Incrementa per il loader */\r\n if (isLoaderActive) {\r\n UniHttpManager.updateIsLoading(ref, 1);\r\n }\r\n },\r\n unsubscribe: () => {\r\n /* Disattivazione loader per sicurezza se il flusso si interrompe prima della risposta */\r\n if (isLoaderActive) {\r\n UniHttpManager.updateIsLoading(ref, -1);\r\n isLoaderActive = false;\r\n }\r\n\r\n /* Rimozione reference */\r\n UniHttpManager.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((error) => {\r\n // Aggiorna la ref nella map\r\n UniHttpManager.updateHasError(ref, true);\r\n\r\n /* Gestione errore */\r\n return errorHandler(ref, error, PollingErrorMode.STOP);\r\n }),\r\n finalize(() => {\r\n /* Decrementa per il loader */\r\n if (isLoaderActive) {\r\n UniHttpManager.updateIsLoading(ref, -1);\r\n isLoaderActive = false;\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: string,\r\n config: HttpConfigPolling<T>,\r\n promiseFactory: () => Promise<T>,\r\n): Observable<T> {\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 UniHttpManager.add(ref, new URL(url), 'polling');\r\n },\r\n unsubscribe: () => {\r\n /* Rimozione reference */\r\n UniHttpManager.remove(ref);\r\n },\r\n }),\r\n operatorHandler<T>(operator)((index) => {\r\n // Il loader è attivo solo al primo giro se non è esplicitamente false\r\n let isLoaderActive = index === 0 && firstIteration?.hasLoader !== false;\r\n\r\n /* Incrementa per il loader */\r\n if (isLoaderActive) {\r\n UniHttpManager.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({\r\n unsubscribe: () => {\r\n /* Disattivazione loader per sicurezza se il flusso si interrompe prima della risposta */\r\n if (isLoaderActive) {\r\n UniHttpManager.updateIsLoading(ref, -1);\r\n isLoaderActive = false;\r\n }\r\n },\r\n next: (res) => {\r\n /* Prima risposta */\r\n if (index === 0) {\r\n /* Prima risposta: callback */\r\n if (firstIteration?.callback) {\r\n firstIteration.callback(res);\r\n }\r\n\r\n /* Prima risposta: loader */\r\n if (isLoaderActive) {\r\n UniHttpManager.updateIsLoading(ref, -1);\r\n isLoaderActive = false;\r\n }\r\n\r\n /* Prima risposta: toast */\r\n if (firstIteration?.toast) {\r\n UniToastManager.showHttp(firstIteration.toast, res);\r\n }\r\n }\r\n\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 UniHttpManager.updateHasError(ref, false);\r\n UniErrorManager.remove(ref);\r\n }\r\n },\r\n }),\r\n catchError((error) => {\r\n /* Disattivazione loader in caso di errore al primo giro */\r\n if (isLoaderActive) {\r\n UniHttpManager.updateIsLoading(ref, -1);\r\n isLoaderActive = false;\r\n }\r\n\r\n // Aggiorna la ref nella map\r\n UniHttpManager.updateHasError(ref, true);\r\n\r\n /* Gestione errore */\r\n return errorHandler(ref, error, errorMode);\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","/* eslint-disable unicorn/no-declarations-before-early-exit */\r\nimport { isErrorResponse, UniHttpError } from 'uni-error/http';\r\nimport type { ErrorResponse, FileDatasource } from 'uni-model-type/type';\r\n\r\n// =============================================================================\r\n// API PUBBLICHE: GESTIONE DATI E FILE\r\n// =============================================================================\r\nexport async function executeHttp(request: Request): Promise<void>;\r\nexport async function executeHttp<T>(request: Request): Promise<T>;\r\nexport async function executeHttp<T>(request: Request): Promise<T | void> {\r\n /* Esegue la chiamata HTTP */\r\n const res = await execute(request);\r\n\r\n /* Gestione dello stato 204: chiamata andata a buon fine ma senza dati di ritorno */\r\n if (res.status === 204) return;\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 ('') lancia errore */\r\n if (!text || text.trim().length === 0) {\r\n throw response204Error(request, res);\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(request: Request): Promise<FileDatasource> {\r\n /* Esegue la chiamata HTTP */\r\n const res = await execute(request);\r\n\r\n /* Gestione dello stato 204: se la chiamata andata a buon fine ma senza dati di ritorno lancia errore */\r\n if (res.status === 204) {\r\n throw response204Error(request, res);\r\n }\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) lancia errore */\r\n if (blob.size === 0) {\r\n throw response204Error(request, res);\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 name = '';\r\n if (disposition) {\r\n const matches = /filename[^;=\\n]*=((['\"]).*?\\2|[^;\\n]*)/.exec(disposition);\r\n if (!!matches && matches[1]) {\r\n name = matches[1].replaceAll(/['\"]/g, '');\r\n }\r\n }\r\n\r\n return { blob, name };\r\n}\r\n\r\n// =============================================================================\r\n// HELPERS\r\n// =============================================================================\r\n/**\r\n * Esegue una richiesta HTTP nativa gestendo l'imbuto dei 4 casi d'errore.\r\n */\r\nasync function execute(request: Request): Promise<Response> {\r\n const startTime = performance.now();\r\n const requestClone = request.clone();\r\n\r\n try {\r\n /* Esecuzione della richiesta HTTP nativa */\r\n const res = await fetch(request);\r\n\r\n /* Calcolo durata */\r\n const durationMs = Math.round(performance.now() - startTime);\r\n\r\n /* Gestione ok HTTP: chiamata andata a buon fine. Viene restituita la risposta al chiamante. */\r\n if (res.ok) {\r\n return res;\r\n }\r\n\r\n /* Gestione Errore HTTP: la chiamata è arrivata al server ma ha restituito uno stato 4xx o 5xx */\r\n let httpError: unknown;\r\n\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 /* Verifica se il formato è 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 httpError = 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 httpError = `Failed to parse error response body (Status: ${res.status})`;\r\n }\r\n\r\n // ERRORE CON STATUS, CASO A: errore applicativo backend ('be')\r\n // Se il payload estratto supera il controllo 'isHttpException', significa che la richiesta è stata elaborata dal codice C#, ha intercettato il GlobalExceptionHandler ed è ritornata come JSON strutturato.\r\n // Questo scenario si applica a qualsiasi codice (400, 404, 500, ecc.) purché sia formattato dal backend.\r\n if (isErrorResponse(httpError)) {\r\n const errorResponse = httpError;\r\n throw new UniHttpError({\r\n type: 'be',\r\n request: requestClone,\r\n httpStatus: res.status,\r\n durationMs,\r\n userAgent: navigator.userAgent,\r\n error: errorResponse,\r\n });\r\n }\r\n\r\n // ERRORE CON STATUS, CASO B: errore infrastrutturale del server ('server')\r\n // Se l'esecuzione raggiunge questo punto, il server ha risposto con un errore (es. 404, 405, 502, 504) ma non ha restituito il JSON customizzato.\r\n // Rappresenta il blocco da parte del server web (IIS, Nginx, Proxy) che ha rifiutato la chiamata o ha risposto con una pagina HTML/Testo standard.\r\n // Di conseguenza, il flag 'isBe' deve essere impostato a false poiché non deriva dalla logica applicativa.\r\n const defaultMessage = `HTTP Error ${res.status}${res.statusText ? ` (${res.statusText})` : ''}`;\r\n const errorTracker = new Error(defaultMessage);\r\n const rawError = typeof httpError === 'string' ? httpError.trim() : '';\r\n let finalMessage: string;\r\n if (rawError) {\r\n // Estrazione della prima riga per l'analisi del tipo di errore\r\n const firstLine = rawError.split('\\n', 1)[0];\r\n const exceptionRegex = /^([a-zA-Z0-9.]+\\.Exception):/i;\r\n\r\n // Verifica se la riga segue il formato standard .NET o un pattern di eccezione custom\r\n if (\r\n exceptionRegex.test(firstLine) ||\r\n firstLine.startsWith('System.') ||\r\n firstLine.startsWith('Microsoft.')\r\n ) {\r\n const colonIndex = firstLine.indexOf(': ');\r\n finalMessage = colonIndex === -1 ? firstLine : firstLine.slice(colonIndex + 2);\r\n }\r\n // Priorità: Mantenimento dell'intero corpo per errori HTML o testo generico\r\n else {\r\n finalMessage = rawError;\r\n }\r\n }\r\n // Utilizzo del messaggio di default in assenza di corpo nell'errore\r\n else {\r\n finalMessage = defaultMessage;\r\n }\r\n const errorResponse: ErrorResponse = {\r\n exception: {\r\n isBe: false,\r\n type: 'ServerError',\r\n message: finalMessage,\r\n stackTrace: errorTracker.stack ?? '',\r\n },\r\n innerException: null,\r\n };\r\n throw new UniHttpError({\r\n type: 'server',\r\n request: requestClone,\r\n httpStatus: res.status,\r\n durationMs,\r\n userAgent: navigator.userAgent,\r\n error: errorResponse,\r\n });\r\n } catch (error: unknown) {\r\n // ERRORE CON/SENZA STATUS: già gestito, rilancio diretto.\r\n // Se l'errore è un'istanza di UniHttpError (lanciata nei blocchi superiori per 'be' o 'server'), significa che è già stata catalogata correttamente.\r\n // Viene eseguito il rilancio diretto.\r\n if (error instanceof UniHttpError) {\r\n throw error;\r\n }\r\n\r\n // ERRORE SENZA STATUS, CASO A: errore di rete locale ('network')\r\n // Si verifica solo se la fetch() fallisce prima di stabilire un contatto con il server.\r\n // Il browser solleva un 'TypeError' (es. \"Failed to fetch\").\r\n if (error instanceof TypeError) {\r\n const fallbackException: ErrorResponse = {\r\n exception: {\r\n isBe: false,\r\n type: error.name || 'NetworkError',\r\n message: error.message,\r\n stackTrace: error.stack ?? '',\r\n },\r\n innerException: null,\r\n };\r\n throw new UniHttpError({\r\n type: 'network',\r\n request: requestClone,\r\n httpStatus: 0,\r\n durationMs: 0,\r\n userAgent: navigator.userAgent,\r\n error: fallbackException,\r\n });\r\n }\r\n\r\n // ERRORE SENZA STATUS, CASO B: errore frontend ('fe')\r\n // Qualsiasi altro errore imprevisto che non derivi da un fallimento della fetch o della risposta.\r\n throw error;\r\n }\r\n}\r\n\r\n/**\r\n * Gestione errore in caso di assenza di risposta quando invece era prevista\r\n */\r\nfunction response204Error(request: Request, res: Response): UniHttpError {\r\n return new UniHttpError({\r\n type: 'be',\r\n request,\r\n httpStatus: res.status,\r\n durationMs: 0,\r\n userAgent: navigator.userAgent,\r\n error: {\r\n exception: {\r\n isBe: true,\r\n type: 'ProtocolError',\r\n message: 'Expected payload of type T, but received empty response.',\r\n stackTrace: '',\r\n },\r\n innerException: null,\r\n },\r\n });\r\n}\r\n","/* eslint-disable unicorn/no-break-in-nested-loop */\r\nimport { UniTypeDateManager } from 'uni-manager/type';\r\nimport type { HttpBody, HttpConfig } from 'uni-model-type/type';\r\n\r\n// =============================================================================\r\n// REQUEST\r\n// =============================================================================\r\n/**\r\n * Costruisce un oggetto Request completo e standardizzato per l'API partendo dai parametri di configurazione.\r\n * Gestisce la composizione dell'URL, la formattazione delle date nei query parametri e il merge dell'init.\r\n */\r\nexport function getRequest<T>(\r\n hostname: string,\r\n port: number,\r\n config: HttpConfig<T>,\r\n defaultRequestInit: RequestInit,\r\n): Request {\r\n const { queryParams, path, hasApiPrefix } = config;\r\n\r\n // Rimuove eventuali barre iniziali o finali dal path per evitare doppi slash (es. //api//)\r\n const cleanPath = path.replaceAll(/^\\/+|\\/+$/g, '');\r\n\r\n // Inserisce il prefisso 'api' a meno che non sia esplicitamente disabilitato nel config\r\n const segments = [hasApiPrefix === false ? '' : 'api', cleanPath].filter(Boolean);\r\n const pathFixed = '/' + segments.join('/');\r\n\r\n // Generazione dell'oggetto URL nativo combinando la base (host+porta) e il path strutturato\r\n const url = new URL(pathFixed, `http://${hostname}:${port}`);\r\n\r\n // Aggiunta query params\r\n if (queryParams) {\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(queryParams)) {\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 in formato nativo -> Convertito in YYYY-MM-DD\r\n if (item instanceof Date) {\r\n formattedValue = UniTypeDateManager.toYYYYMMDD(item);\r\n }\r\n // Caso: Date in formato ISO string -> Parsato e convertito in YYYY-MM-DD\r\n else if (typeof item === 'string' && isoDateRegex.test(item)) {\r\n const parsedDate = new Date(item);\r\n // Se la stringa superava la regex ma la data non è valida -> fallback sulla stringa originale\r\n formattedValue = Number.isNaN(parsedDate.getTime())\r\n ? item\r\n : UniTypeDateManager.toYYYYMMDD(parsedDate);\r\n }\r\n // Caso: Default (Numeri, Booleani, Stringhe standard) -> Conversione a stringa pulita\r\n else {\r\n formattedValue = String(item);\r\n }\r\n\r\n // Appende il parametro formattato nell'URL\r\n url.searchParams.append(key, formattedValue);\r\n }\r\n }\r\n }\r\n\r\n // Unisce le configurazioni base registrate nel config dell'endpoint con quelle puntuali della singola chiamata\r\n const initCustom: RequestInit = {\r\n ...defaultRequestInit,\r\n ...config.init,\r\n };\r\n\r\n // Ritorna l'oggetto Request completo di URL formattato e init con tutte le proprietà standard del browser\r\n return new Request(url, initCustom);\r\n}\r\n\r\n// =============================================================================\r\n// BODY\r\n// =============================================================================\r\n/**\r\n * Controlla che le chiavi degli oggetti nel body rispettino i tipi attesi:\r\n * - Se terminano con 'timestamp' -> il valore deve essere number\r\n * - Se terminano con 'date' o 'at' -> il valore deve essere un oggetto Date\r\n * - Se iniziano con 'is', 'has', 'should', 'can' -> il valore deve essere boolean\r\n * - Se terminano/corrispondono a 'id', 'count', 'qty', 'total' -> il valore deve essere number\r\n */\r\nexport function validateHttpBody<T>(body: HttpBody<T>): void {\r\n // Gestione degli array: validazione ricorsiva di ciascun elemento\r\n if (Array.isArray(body)) {\r\n for (const item of body) {\r\n validateHttpBody(item);\r\n }\r\n return;\r\n }\r\n\r\n // Gestione degli oggetti\r\n if (body !== null && typeof body === 'object' && !(body instanceof Date)) {\r\n for (const [key, value] of Object.entries(body)) {\r\n // 1. Booleani\r\n const booleanRegEx = /^(is|has|should|can)[A-Z]/;\r\n if (booleanRegEx.test(key) && typeof value !== 'boolean') {\r\n if (value === null) return;\r\n\r\n throw new TypeError(`Validation failed: key \"${key}\" must be a boolean.`);\r\n }\r\n\r\n // 2. Stringhe\r\n if (\r\n (key.endsWith('Code') ||\r\n key.endsWith('Name') ||\r\n key.endsWith('Description') ||\r\n key.endsWith('Url')) &&\r\n typeof value !== 'string'\r\n ) {\r\n if (value === null) return;\r\n\r\n throw new TypeError(`Validation failed: key \"${key}\" must be a string.`);\r\n }\r\n\r\n // 3. Controllo Date\r\n if (key.endsWith('Date') || key.endsWith('At')) {\r\n const isDateInstance = value instanceof Date && !Number.isNaN(value.getTime());\r\n const isoRegex = /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?(Z|[+-]\\d{2}:\\d{2})?)?$/;\r\n const isDateString =\r\n typeof value === 'string' && isoRegex.test(value) && !Number.isNaN(Date.parse(value));\r\n if (!isDateInstance && !isDateString) {\r\n if (value === null) return;\r\n\r\n throw new TypeError(\r\n `Validation failed: key \"${key}\" must be a valid Date object or ISO string.`,\r\n );\r\n }\r\n }\r\n\r\n // 4. Timestamp\r\n if (key.endsWith('Timestamp')) {\r\n if (value === null) return;\r\n\r\n if (typeof value !== 'number') {\r\n throw new TypeError(`Validation failed: key \"${key}\" must be a number.`);\r\n }\r\n\r\n const date = new Date(value);\r\n if (value !== null && Number.isNaN(date.getTime())) {\r\n throw new TypeError(`Validation failed: key \"${key}\" is not a valid timestamp.`);\r\n }\r\n }\r\n\r\n // 5. Controllo Numerico\r\n const numericSuffixes = ['Id', 'ID', 'Count', 'Qty', 'Total'];\r\n if (numericSuffixes.some((suffix) => key.endsWith(suffix)) && typeof value !== 'number') {\r\n if (value === null) return;\r\n\r\n throw new TypeError(`Validation failed: key \"${key}\" must be a number.`);\r\n }\r\n\r\n // Analisi ricorsiva per la verifica di eventuali sotto-oggetti o sotto-array\r\n validateHttpBody(value);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Normalizza i valori del body così da sistemare le incongruenze tra ui e db\r\n * - Applica il trim alle stringhe\r\n * - Converte gli oggetti Date in stringhe YYYY-MM-DD\r\n * - Rimuove la proprietà 'id' se presente al livello principale (root).\r\n */\r\nexport function normalizeHttpBody<T>(\r\n body: HttpBody<T>,\r\n method: 'post' | 'put',\r\n hasToKeepId: boolean | undefined,\r\n): unknown {\r\n // Validazione iniziale\r\n validateHttpBody(body);\r\n\r\n // UNDEFINED\r\n // Tipi gestiti: undefined\r\n if (body === undefined) {\r\n return undefined;\r\n }\r\n\r\n // NULL\r\n // Tipi gestiti: null\r\n if (body === null) {\r\n return null;\r\n }\r\n\r\n // DATE\r\n // Tipi gestiti: Date\r\n const isDateInstance = body instanceof Date;\r\n const isDateString =\r\n typeof body === 'string' && /^\\d{4}-\\d{2}-\\d{2}/.test(body) && !Number.isNaN(Date.parse(body));\r\n if (isDateInstance || isDateString) {\r\n return UniTypeDateManager.toYYYYMMDD(body);\r\n }\r\n\r\n // PRIMITIVI GENERICI\r\n // Tipi gestiti: number, boolean, symbol, bigint, string\r\n if (typeof body !== 'object') {\r\n if (typeof body !== 'string') return body ?? null;\r\n\r\n // Rimuove spazi inutili e restituisce null in caso di stringa vuota\r\n return body.trim() || null;\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, method, true));\r\n }\r\n\r\n // OGGETTI\r\n // Tipi gestiti: Record<string, any>, generici oggetti JavaScript ({ })\r\n // Rimozione della chiave 'id' al primo livello (root) e prosegue ricorsivamente\r\n const entries = Object.entries(body)\r\n .filter(([key]) => !(method === 'post' && !hasToKeepId && key.toLowerCase() === 'id'))\r\n .map(([key, value]) => [key, normalizeHttpBody(value, method, true)]);\r\n\r\n // Ricostruzione dell'oggetto normalizzato\r\n return Object.fromEntries(entries);\r\n}\r\n","/* eslint-disable unicorn/prefer-iterator-to-array */\r\n/* eslint-disable unicorn/prefer-iterator-helpers */\r\nimport { BehaviorSubject, Observable, distinctUntilChanged, map, of, tap } from 'rxjs';\r\nimport { UniToastManager } from 'uni-manager/toast';\r\nimport type {\r\n FileDatasource,\r\n HttpBody,\r\n HttpBodyPrimitive,\r\n HttpConfig,\r\n HttpConfigPolling,\r\n HttpRef,\r\n ToastConfig,\r\n} from 'uni-model-type/type';\r\n\r\nimport { http$, httpPolling$ } from './core';\r\nimport { executeBlob, executeHttp } from './execute';\r\nimport { getRequest, normalizeHttpBody } from './utilities';\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 /* ------------------------------------ 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 /* ------------------------------------------------------------------------------- */\r\n /* --------------------------------- Metodi: get --------------------------------- */\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 /** Restituisce se lo store ha chiamate in attesa di risposta o meno */\r\n public static get hasWaitingRequests$(): Observable<boolean> {\r\n return this.store$.pipe(\r\n map((requestMap) => [...requestMap.values()].some((request) => request.pendingCount > 0)),\r\n distinctUntilChanged(),\r\n );\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: store -------------------------------- */\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\n public static add(id: string, url: URL, type: HttpRef['type']): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = this.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 this.store.next(newMap);\r\n }\r\n\r\n /**\r\n * Rimuove un http ref tramite ID\r\n */\r\n public static remove(id: string): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = this.currentValue;\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n if (!oldMap.has(id)) return;\r\n\r\n // Aggiorna store\r\n const newMap = new Map(oldMap);\r\n newMap.delete(id);\r\n this.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\n public static updateIsLoading(id: string, delta: -1 | 1): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = this.currentValue;\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n 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 this.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\n public static updateHasError(id: string, hasError: boolean): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = this.currentValue;\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n 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 this.store.next(newMap);\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$(config: HttpConfig<void>): Observable<void>;\r\n public static read$<T>(config: HttpConfig<T>): Observable<T>;\r\n public static read$<T>(config: HttpConfig<void | T>): Observable<void | T> {\r\n /* Config */\r\n const defaultRequestInit: RequestInit = {\r\n method: 'GET',\r\n };\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n\r\n /* API */\r\n return http$(request.url, 'one', config, () => executeHttp<T>(request)).pipe(\r\n tap((res) => {\r\n if (config.hasToast === false || !!config.toast) return;\r\n\r\n if (!res) {\r\n UniToastManager.show({ label: 'NoItemFound' });\r\n } else if (Array.isArray(res)) {\r\n UniToastManager.show({ label: 'ItemsFound', params: { count: res.length } });\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$<TBody extends HttpBodyPrimitive>(\r\n config: HttpConfig<void> & { hasToKeepId?: boolean },\r\n body: HttpBody<TBody>,\r\n ): Observable<void>;\r\n public static create$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfig<TResponse> & { hasToKeepId?: boolean },\r\n body: HttpBody<TBody>,\r\n ): Observable<TResponse>;\r\n public static create$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfig<void | TResponse> & { hasToKeepId?: boolean },\r\n body: HttpBody<TBody>,\r\n ): Observable<void | TResponse> {\r\n /* Config */\r\n const defaultRequestInit: 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, 'post', config.hasToKeepId)),\r\n };\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n\r\n /* Config custom (toast di default) */\r\n const configCustom: HttpConfig<TResponse> = {\r\n ...config,\r\n toast: config.hasToast === false ? undefined : { ...CONFIG_TOAST_DEFAULT, ...config.toast },\r\n };\r\n\r\n /* API */\r\n return http$(request.url, 'one', configCustom, () => executeHttp<TResponse>(request));\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$(config: HttpConfig<void>): Observable<void>;\r\n public static update$<TResponse>(config: HttpConfig<TResponse>): Observable<TResponse>;\r\n public static update$<TBody extends HttpBodyPrimitive>(\r\n config: HttpConfig<void>,\r\n body: HttpBody<TBody>,\r\n ): Observable<void>;\r\n public static update$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfig<TResponse>,\r\n body: HttpBody<TBody>,\r\n ): Observable<TResponse>;\r\n public static update$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfig<void | TResponse>,\r\n body?: HttpBody<TBody>,\r\n ): Observable<void | TResponse> {\r\n /* Config */\r\n const defaultRequestInit: RequestInit = { method: 'PUT' };\r\n if (body !== undefined) {\r\n defaultRequestInit.headers = {\r\n 'Content-Type': 'application/json',\r\n ...config.init?.headers,\r\n };\r\n defaultRequestInit.body = JSON.stringify(normalizeHttpBody(body, 'put', false));\r\n }\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n\r\n /* Config custom (toast di default) */\r\n const configCustom: HttpConfig<TResponse> = {\r\n ...config,\r\n toast: config.hasToast === false ? undefined : { ...CONFIG_TOAST_DEFAULT, ...config.toast },\r\n };\r\n\r\n /* API */\r\n return http$(request.url, 'one', configCustom, () => executeHttp<TResponse>(request));\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$(config: HttpConfig<void>): Observable<void>;\r\n public static delete$<T>(config: HttpConfig<T>): Observable<T>;\r\n public static delete$<T>(config: HttpConfig<void | T>): Observable<void | T> {\r\n /* Config */\r\n const defaultRequestInit: RequestInit = {\r\n method: 'DELETE',\r\n };\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\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_DEFAULT, ...config.toast },\r\n };\r\n\r\n /* API */\r\n return http$(request.url, 'one', configCustom, () => executeHttp<T>(request));\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$(config: HttpConfig<FileDatasource>): Observable<void | FileDatasource> {\r\n // /* Config */\r\n // const defaultRequestInit: RequestInit = {\r\n // method: 'GET',\r\n // };\r\n // const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n // /* API */\r\n // return http$(request.url, 'image', config, () => executeBlob(request));\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<void> & { queryParams: { dispositionType: 'inline' } },\r\n ): Observable<URL>;\r\n public static readFile$(\r\n config: HttpConfig<void> & { queryParams: { dispositionType: 'attachment' } },\r\n ): Observable<FileDatasource>;\r\n public static readFile$(\r\n config: HttpConfig<void> & { queryParams: { dispositionType: 'inline' | 'attachment' } },\r\n ): Observable<URL | FileDatasource>;\r\n public static readFile$(\r\n config: HttpConfig<void> & { queryParams: { dispositionType: 'inline' | 'attachment' } },\r\n ): Observable<URL | FileDatasource> {\r\n /* Config */\r\n const defaultRequestInit: RequestInit = {\r\n method: 'GET',\r\n };\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n\r\n // Se è inline, restituisce l'URL arricchito con il token (senza fare la fetch)\r\n if (config.queryParams.dispositionType === 'inline') {\r\n const url: URL = new URL(request.url);\r\n\r\n /* Header */\r\n const authHeader = request.headers.get('Authorization');\r\n if (authHeader && authHeader.startsWith('Bearer ')) {\r\n const token = authHeader.slice(7);\r\n url.searchParams.append('token', token);\r\n }\r\n\r\n return of(url);\r\n }\r\n\r\n // Se è attachment, esegue la chiamata HTTP e restituisce il Blob binario\r\n return http$(request.url, 'image', config, () => executeBlob(request));\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$(config: HttpConfigPolling<void>): Observable<void>;\r\n public static readPolling$<T>(config: HttpConfigPolling<T>): Observable<T>;\r\n public static readPolling$<T>(config: HttpConfigPolling<void | T>): Observable<void | T> {\r\n /* Config */\r\n const defaultRequestInit: RequestInit = {\r\n method: 'GET',\r\n };\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n\r\n /* API */\r\n return httpPolling$(request.url, config, () => executeHttp<T>(request));\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$<TBody extends HttpBodyPrimitive>(\r\n config: HttpConfigPolling<void> & { hasToKeepId?: boolean },\r\n body: HttpBody<TBody>,\r\n ): Observable<void>;\r\n public static createPolling$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfigPolling<TResponse> & { hasToKeepId?: boolean },\r\n body: HttpBody<TBody>,\r\n ): Observable<TResponse>;\r\n public static createPolling$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfigPolling<void | TResponse> & { hasToKeepId?: boolean },\r\n body: HttpBody<TBody>,\r\n ): Observable<void | TResponse> {\r\n /* Config */\r\n const defaultRequestInit: RequestInit = {\r\n method: 'POST',\r\n headers: { 'Content-Type': 'application/json' },\r\n body: JSON.stringify(normalizeHttpBody(body, 'post', config.hasToKeepId)),\r\n };\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n\r\n /* API */\r\n return httpPolling$(request.url, config, () => executeHttp<TResponse>(request));\r\n }\r\n\r\n /**\r\n * Avvia un ciclo di polling basato su richieste PUT.\r\n */\r\n public static updatePolling$(config: HttpConfigPolling<void>): Observable<void>;\r\n public static updatePolling$<TBody extends HttpBodyPrimitive>(\r\n config: HttpConfigPolling<void>,\r\n body: HttpBody<TBody>,\r\n ): Observable<void>;\r\n public static updatePolling$<TResponse>(\r\n config: HttpConfigPolling<TResponse>,\r\n ): Observable<TResponse>;\r\n public static updatePolling$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfigPolling<TResponse>,\r\n body: HttpBody<TBody>,\r\n ): Observable<TResponse>;\r\n public static updatePolling$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfigPolling<void | TResponse>,\r\n body?: HttpBody<TBody>,\r\n ): Observable<void | TResponse> {\r\n /* Config */\r\n const defaultRequestInit: RequestInit = {\r\n method: 'PUT',\r\n };\r\n if (body !== undefined) {\r\n defaultRequestInit.headers = {\r\n 'Content-Type': 'application/json',\r\n ...config.init?.headers,\r\n };\r\n defaultRequestInit.body = JSON.stringify(normalizeHttpBody(body, 'put', false));\r\n }\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n\r\n /* API */\r\n return httpPolling$(request.url, config, () => executeHttp<TResponse>(request));\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAeM,SAAU,eAAe,CAC7B,QAAqB,EAAA;;IAGrB,QAAQ,QAAQ;AACd,QAAA,KAAK,WAAW,CAAC,WAAW,EAAE;YAC5B,OAAO,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,CAAC;QACzC;AACA,QAAA,KAAK,WAAW,CAAC,UAAU,EAAE;YAC3B,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO,CAAC;QACxC;AACA,QAAA,KAAK,WAAW,CAAC,SAAS,EAAE;YAC1B,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,OAAO,CAAC;QACvC;AACA,QAAA,KAAK,WAAW,CAAC,UAAU,EAAE;YAC3B,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO,CAAC;QACxC;;AAEJ;SAEgB,YAAY,CAC1B,GAAW,EACX,KAAc,EACd,SAA2B,EAAA;;AAG3B,IAAA,IAAI,KAAK,YAAY,YAAY,EAAE;QACjC,QAAQ,SAAS;AACf,YAAA,KAAK,gBAAgB,CAAC,MAAM,EAAE;gBAC5B,OAAO,EAAE,EAAE;YACb;AACA,YAAA,KAAK,gBAAgB,CAAC,IAAI,EAAE;AAC1B,gBAAA,OAAO,KAAK;YACd;AACA,YAAA,KAAK,gBAAgB,CAAC,iBAAiB,EAAE;AACvC,gBAAA,eAAe,CAAC,G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AC,IAAI,EAAE,MAAM,EAAE,kBAAkB,CAAC;;AAGzF,QAAA,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,WAAW,CAAY,OAAO,CAAC,CAAC;IACjF;AAiBO,IAAA,OAAO,cAAc,CAC1B,MAA2C,EAC3C,IAAsB,EAAA;;AAGtB,QAAA,MAAM,kBAAkB,GAAgB;AACtC,YAAA,MAAM,EAAE,KAAK;SACd;AACD,QAAA,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,kBAAkB,CAAC,OAAO,GAAG;AAC3B,gBAAA,cAAc,EAAE,kBAAkB;AAClC,gBAAA,GAAG,MAAM,CAAC,IAAI,EAAE,OAAO;aACxB;AACD,YAAA,kBAAkB,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QACjF;AACA,QAAA,MAAM,OAAO,GAAY,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,kBAAkB,CAAC;;AAGzF,QAAA,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,WAAW,CAAY,OAAO,CAAC,CAAC;IACjF;;;ACvbF;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"uni-manager-http.mjs","sources":["../../../projects/uni-manager/http/handler.ts","../../../projects/uni-manager/http/core.ts","../../../projects/uni-manager/http/execute.ts","../../../projects/uni-manager/http/utilities.ts","../../../projects/uni-manager/http/manager.ts","../../../projects/uni-manager/http/uni-manager-http.ts"],"sourcesContent":["import {\r\n EMPTY,\r\n Observable,\r\n OperatorFunction,\r\n concatMap,\r\n exhaustMap,\r\n mergeMap,\r\n of,\r\n switchMap,\r\n throwError,\r\n} from 'rxjs';\r\nimport { UniHttpError } from 'uni-error/http';\r\nimport { UniErrorManager } from 'uni-manager/error';\r\nimport { MapOperator, PollingErrorMode } from 'uni-model-type/enum';\r\n\r\nexport function operatorHandler<T>(\r\n operator: MapOperator,\r\n): (project: (value: number) => Observable<T>) => OperatorFunction<number, T> {\r\n // Gestione della concorrenza in base al parametro\r\n switch (operator) {\r\n case MapOperator.EXHAUST_MAP: {\r\n return (project) => exhaustMap(project);\r\n }\r\n case MapOperator.CONCAT_MAP: {\r\n return (project) => concatMap(project);\r\n }\r\n case MapOperator.MERGE_MAP: {\r\n return (project) => mergeMap(project);\r\n }\r\n case MapOperator.SWITCH_MAP: {\r\n return (project) => switchMap(project);\r\n }\r\n }\r\n}\r\n\r\nexport function errorHandler(\r\n ref: string,\r\n error: unknown,\r\n errorMode: PollingErrorMode,\r\n): Observable<never> {\r\n // Controllo: sia effettivamente un errore di tipo 'UniHttpError'\r\n if (error instanceof UniHttpError) {\r\n // In caso sia un errore server (es: connessione caduta) viene ripristinato automaticamente\r\n if (error.type === 'network') {\r\n UniErrorManager.add(ref, error);\r\n return of();\r\n }\r\n\r\n switch (errorMode) {\r\n case PollingErrorMode.IGNORE: {\r\n return of();\r\n }\r\n case PollingErrorMode.SKIP: {\r\n return EMPTY;\r\n }\r\n case PollingErrorMode.IGNORE_WITH_ERROR: {\r\n UniErrorManager.add(ref, error);\r\n return of();\r\n }\r\n case PollingErrorMode.STOP: {\r\n UniErrorManager.add(ref, error);\r\n return throwError(() => error);\r\n }\r\n }\r\n } else {\r\n return throwError(() => error);\r\n }\r\n}\r\n","/* eslint-disable unicorn/prefer-early-return */\r\nimport isEqual from 'lodash-es/isEqual';\r\nimport {\r\n Observable,\r\n catchError,\r\n defer,\r\n distinctUntilChanged,\r\n finalize,\r\n from,\r\n tap,\r\n timer,\r\n} from 'rxjs';\r\nimport { UniErrorManager } from 'uni-manager/error';\r\nimport { UniToastManager } from 'uni-manager/toast';\r\nimport { EmitValueMode, MapOperator, PollingErrorMode } from 'uni-model-type/enum';\r\nimport type { HttpConfig, HttpConfigPolling, HttpRef } from 'uni-model-type/type';\r\n\r\nimport { errorHandler, operatorHandler } from './handler';\r\nimport { UniHttpManager } from './manager';\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: string,\r\n refType: HttpRef['type'],\r\n config: HttpConfig<T>,\r\n promiseCallback: () => Promise<T>,\r\n): Observable<T> {\r\n /* Recupero configurazione */\r\n const { ref, toast, hasLoader } = config;\r\n\r\n // Usiamo un flag let per garantire che il loader venga spento una sola volta\r\n let isLoaderActive = hasLoader !== false;\r\n\r\n return defer(() => {\r\n const http$ = from(promiseCallback());\r\n return http$.pipe(\r\n tap({\r\n subscribe: () => {\r\n /* Creazione reference */\r\n UniHttpManager.add(ref, new URL(url), refType);\r\n\r\n /* Incrementa per il loader */\r\n if (isLoaderActive) {\r\n UniHttpManager.updateIsLoading(ref, 1);\r\n }\r\n },\r\n unsubscribe: () => {\r\n /* Disattivazione loader per sicurezza se il flusso si interrompe prima della risposta */\r\n if (isLoaderActive) {\r\n UniHttpManager.updateIsLoading(ref, -1);\r\n isLoaderActive = false;\r\n }\r\n\r\n /* Rimozione reference */\r\n UniHttpManager.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((error) => {\r\n // Aggiorna la ref nella map\r\n UniHttpManager.updateHasError(ref, true);\r\n\r\n /* Gestione errore */\r\n return errorHandler(ref, error, PollingErrorMode.STOP);\r\n }),\r\n finalize(() => {\r\n /* Decrementa per il loader */\r\n if (isLoaderActive) {\r\n UniHttpManager.updateIsLoading(ref, -1);\r\n isLoaderActive = false;\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: string,\r\n config: HttpConfigPolling<T>,\r\n executeHttpCallback: () => Promise<T>,\r\n): Observable<T> {\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 UniHttpManager.add(ref, new URL(url), 'polling');\r\n },\r\n unsubscribe: () => {\r\n /* Rimozione reference */\r\n UniHttpManager.remove(ref);\r\n },\r\n }),\r\n operatorHandler<T>(operator)((index) => {\r\n // Il loader è attivo solo al primo giro se non è esplicitamente false\r\n let isLoaderActive = index === 0 && firstIteration?.hasLoader !== false;\r\n\r\n /* Incrementa per il loader */\r\n if (isLoaderActive) {\r\n UniHttpManager.updateIsLoading(ref, 1);\r\n }\r\n\r\n return defer(() => {\r\n const http$ = from(executeHttpCallback());\r\n return http$.pipe(\r\n tap({\r\n unsubscribe: () => {\r\n /* Disattivazione loader per sicurezza se il flusso si interrompe prima della risposta */\r\n if (isLoaderActive) {\r\n UniHttpManager.updateIsLoading(ref, -1);\r\n isLoaderActive = false;\r\n }\r\n },\r\n next: (res) => {\r\n /* Prima risposta */\r\n if (index === 0) {\r\n /* Prima risposta: callback */\r\n if (firstIteration?.callback) {\r\n firstIteration.callback(res);\r\n }\r\n\r\n /* Prima risposta: loader */\r\n if (isLoaderActive) {\r\n UniHttpManager.updateIsLoading(ref, -1);\r\n isLoaderActive = false;\r\n }\r\n\r\n /* Prima risposta: toast */\r\n if (firstIteration?.toast) {\r\n UniToastManager.showHttp(firstIteration.toast, res);\r\n }\r\n }\r\n\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 (\r\n errorMode === PollingErrorMode.IGNORE_WITH_ERROR ||\r\n UniErrorManager.currentValue.get(ref)?.uniError?.type === 'network'\r\n ) {\r\n UniHttpManager.updateHasError(ref, false);\r\n UniErrorManager.remove(ref);\r\n }\r\n },\r\n }),\r\n catchError((error) => {\r\n /* Disattivazione loader in caso di errore al primo giro */\r\n if (isLoaderActive) {\r\n UniHttpManager.updateIsLoading(ref, -1);\r\n isLoaderActive = false;\r\n }\r\n\r\n /* Aggiorna la ref nella map */\r\n UniHttpManager.updateHasError(ref, true);\r\n\r\n /* Gestione errore */\r\n return errorHandler(ref, error, errorMode);\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","/* eslint-disable unicorn/no-declarations-before-early-exit */\r\nimport { isErrorResponse, UniHttpError } from 'uni-error/http';\r\nimport type { ErrorResponse, FileDatasource } from 'uni-model-type/type';\r\n\r\n// =============================================================================\r\n// API PUBBLICHE: GESTIONE DATI E FILE\r\n// =============================================================================\r\nexport async function executeHttp(request: Request): Promise<void>;\r\nexport async function executeHttp<T>(request: Request): Promise<T>;\r\nexport async function executeHttp<T>(request: Request): Promise<T | void> {\r\n /* Esegue la chiamata HTTP */\r\n const res = await execute(request);\r\n\r\n /* Gestione dello stato 204: chiamata andata a buon fine ma senza dati di ritorno */\r\n if (res.status === 204) return;\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 ('') lancia errore */\r\n if (!text || text.trim().length === 0) {\r\n throw response204Error(request, res);\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(request: Request): Promise<FileDatasource> {\r\n /* Esegue la chiamata HTTP */\r\n const res = await execute(request);\r\n\r\n /* Gestione dello stato 204: se la chiamata andata a buon fine ma senza dati di ritorno lancia errore */\r\n if (res.status === 204) {\r\n throw response204Error(request, res);\r\n }\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) lancia errore */\r\n if (blob.size === 0) {\r\n throw response204Error(request, res);\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 name = '';\r\n if (disposition) {\r\n const matches = /filename[^;=\\n]*=((['\"]).*?\\2|[^;\\n]*)/.exec(disposition);\r\n if (!!matches && matches[1]) {\r\n name = matches[1].replaceAll(/['\"]/g, '');\r\n }\r\n }\r\n\r\n return { blob, name };\r\n}\r\n\r\n// =============================================================================\r\n// HELPERS\r\n// =============================================================================\r\n/**\r\n * Esegue una richiesta HTTP nativa gestendo l'imbuto dei 4 casi d'errore.\r\n */\r\n// async function execute2(request: Request): Promise<Response> {\r\n// const startTime = performance.now();\r\n// const requestClone = request.clone();\r\n\r\n// try {\r\n// /* Esecuzione della richiesta HTTP nativa */\r\n// const res = await fetch(request);\r\n\r\n// /* Calcolo durata */\r\n// const durationMs = Math.round(performance.now() - startTime);\r\n\r\n// /* Gestione ok HTTP: chiamata andata a buon fine. Viene restituita la risposta al chiamante. */\r\n// if (res.ok) {\r\n// return res;\r\n// }\r\n\r\n// /* Gestione Errore HTTP: la chiamata è arrivata al server ma ha restituito uno stato 4xx o 5xx */\r\n// let httpError: unknown;\r\n\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// /* Verifica se il formato è 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// httpError = 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// httpError = `Failed to parse error response body (Status: ${res.status})`;\r\n// }\r\n\r\n// // ERRORE CON STATUS, CASO A: errore applicativo backend ('be')\r\n// // Se il payload estratto supera il controllo 'isHttpException', significa che la richiesta è stata elaborata dal codice C#, ha intercettato il GlobalExceptionHandler ed è ritornata come JSON strutturato.\r\n// // Questo scenario si applica a qualsiasi codice (400, 404, 500, ecc.) purché sia formattato dal backend.\r\n// if (isErrorResponse(httpError)) {\r\n// const errorResponse = httpError;\r\n// throw new UniHttpError({\r\n// type: 'be',\r\n// request: requestClone,\r\n// httpStatus: res.status,\r\n// durationMs,\r\n// userAgent: navigator.userAgent,\r\n// error: errorResponse,\r\n// });\r\n// }\r\n\r\n// // ERRORE CON STATUS, CASO B: errore infrastrutturale del server ('server')\r\n// // Se l'esecuzione raggiunge questo punto, il server ha risposto con un errore (es. 404, 405, 502, 504) ma non ha restituito il JSON customizzato.\r\n// // Rappresenta il blocco da parte del server web (IIS, Nginx, Proxy) che ha rifiutato la chiamata o ha risposto con una pagina HTML/Testo standard.\r\n// // Di conseguenza, il flag 'isBe' deve essere impostato a false poiché non deriva dalla logica applicativa.\r\n// const defaultMessage = `HTTP Error ${res.status}${res.statusText ? ` (${res.statusText})` : ''}`;\r\n// const errorTracker = new Error(defaultMessage);\r\n// const rawError = typeof httpError === 'string' ? httpError.trim() : '';\r\n// let finalMessage: string;\r\n// if (rawError) {\r\n// // Estrazione della prima riga per l'analisi del tipo di errore\r\n// const firstLine = rawError.split('\\n', 1)[0];\r\n// const exceptionRegex = /^([a-zA-Z0-9.]+\\.Exception):/i;\r\n\r\n// // Verifica se la riga segue il formato standard .NET o un pattern di eccezione custom\r\n// if (\r\n// exceptionRegex.test(firstLine) ||\r\n// firstLine.startsWith('System.') ||\r\n// firstLine.startsWith('Microsoft.')\r\n// ) {\r\n// const colonIndex = firstLine.indexOf(': ');\r\n// finalMessage = colonIndex === -1 ? firstLine : firstLine.slice(colonIndex + 2);\r\n// }\r\n// // Priorità: Mantenimento dell'intero corpo per errori HTML o testo generico\r\n// else {\r\n// finalMessage = rawError;\r\n// }\r\n// }\r\n// // Utilizzo del messaggio di default in assenza di corpo nell'errore\r\n// else {\r\n// finalMessage = defaultMessage;\r\n// }\r\n// const errorResponse: ErrorResponse = {\r\n// exception: {\r\n// isBe: false,\r\n// type: 'ServerError',\r\n// message: finalMessage,\r\n// stackTrace: errorTracker.stack ?? '',\r\n// },\r\n// innerException: null,\r\n// };\r\n// throw new UniHttpError({\r\n// type: 'server',\r\n// request: requestClone,\r\n// httpStatus: res.status,\r\n// durationMs,\r\n// userAgent: navigator.userAgent,\r\n// error: errorResponse,\r\n// });\r\n// } catch (error: unknown) {\r\n// // ERRORE CON/SENZA STATUS: già gestito, rilancio diretto.\r\n// // Se l'errore è un'istanza di UniHttpError (lanciata nei blocchi superiori per 'be' o 'server'), significa che è già stata catalogata correttamente.\r\n// // Viene eseguito il rilancio diretto.\r\n// if (error instanceof UniHttpError) {\r\n// throw error;\r\n// }\r\n\r\n// // ERRORE SENZA STATUS, CASO A: errore di rete locale ('network')\r\n// // Si verifica solo se la fetch() fallisce prima di stabilire un contatto con il server.\r\n// // Il browser solleva un 'TypeError' (es. \"Failed to fetch\").\r\n// if (error instanceof TypeError) {\r\n// const fallbackException: ErrorResponse = {\r\n// exception: {\r\n// isBe: false,\r\n// type: error.name || 'NetworkError',\r\n// message: error.message,\r\n// stackTrace: error.stack ?? '',\r\n// },\r\n// innerException: null,\r\n// };\r\n// throw new UniHttpError({\r\n// type: 'network',\r\n// request: requestClone,\r\n// httpStatus: 0,\r\n// durationMs: 0,\r\n// userAgent: navigator.userAgent,\r\n// error: fallbackException,\r\n// });\r\n// }\r\n\r\n// // ERRORE SENZA STATUS, CASO B: errore frontend ('fe')\r\n// // Qualsiasi altro errore imprevisto che non derivi da un fallimento della fetch o della risposta.\r\n// throw error;\r\n// }\r\n// }\r\n\r\nasync function execute(request: Request): Promise<Response> {\r\n const startTime = performance.now();\r\n const requestClone = request.clone();\r\n\r\n let res: Response;\r\n\r\n try {\r\n /* Esecuzione della richiesta HTTP nativa */\r\n res = await fetch(request);\r\n } catch (error) {\r\n // ERRORE: NETWORK\r\n // ERRORE SENZA STATUS, errore di rete locale\r\n // Si verifica solo se la fetch() fallisce prima di stabilire un contatto con il server.\r\n // Il browser solleva un 'TypeError' (es. \"Failed to fetch\").\r\n const fallbackException: ErrorResponse = {\r\n exception: {\r\n isBe: false,\r\n type: error instanceof Error ? error.name : 'NetworkError',\r\n message: error instanceof Error ? error.message : 'Unknown network error',\r\n stackTrace: error instanceof Error ? (error.stack ?? '') : '',\r\n },\r\n innerException: null,\r\n };\r\n\r\n throw new UniHttpError({\r\n type: 'network',\r\n request: requestClone,\r\n httpStatus: 0,\r\n durationMs: Math.round(performance.now() - startTime),\r\n userAgent: navigator.userAgent,\r\n error: fallbackException,\r\n });\r\n }\r\n\r\n /* Gestione ok HTTP: chiamata andata a buon fine. Viene restituita la risposta al chiamante. */\r\n if (res.ok) {\r\n return res;\r\n }\r\n\r\n /* Gestione Errore HTTP: la chiamata è arrivata al server ma ha restituito uno stato 4xx o 5xx */\r\n let httpError: unknown;\r\n\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 /* Verifica se il formato è un JSON, estrazione del corpo dell'errore in base al formato rilevato */\r\n const contentType = res.headers.get('content-type') ?? '';\r\n const isJson = contentType.includes('json');\r\n httpError = 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 httpError = `Failed to parse error response body (Status: ${res.status})`;\r\n }\r\n\r\n // ERRORE: BE\r\n // ERRORE CON STATUS: errore applicativo backend\r\n // Se il payload estratto supera il controllo 'isHttpException', significa che la richiesta è stata elaborata dal codice C#, ha intercettato il GlobalExceptionHandler ed è ritornata come JSON strutturato.\r\n // Questo scenario si applica a qualsiasi codice (400, 404, 500, ecc.) purché sia formattato dal backend.\r\n if (isErrorResponse(httpError)) {\r\n throw new UniHttpError({\r\n type: 'be',\r\n request: requestClone,\r\n httpStatus: res.status,\r\n durationMs: Math.round(performance.now() - startTime),\r\n userAgent: navigator.userAgent,\r\n error: httpError,\r\n });\r\n }\r\n\r\n // ERRORE: SERVER\r\n // ERRORE CON STATUS: errore infrastrutturale del server\r\n // Se l'esecuzione raggiunge questo punto, il server ha risposto con un errore (es. 404, 405, 502, 504) ma non ha restituito il JSON customizzato.\r\n // Rappresenta il blocco da parte del server web (IIS, Nginx, Proxy) che ha rifiutato la chiamata o ha risposto con una pagina HTML/Testo standard.\r\n // Di conseguenza, il flag 'isBe' deve essere impostato a false poiché non deriva dalla logica applicativa.\r\n const defaultMessage =\r\n `HTTP Error ${res.status}` + (res.statusText ? ` (${res.statusText})` : '');\r\n const tracker = new Error(defaultMessage);\r\n const rawError = typeof httpError === 'string' ? httpError.trim() : '';\r\n let finalMessage: string;\r\n if (rawError) {\r\n // Estrazione della prima riga per l'analisi del tipo di errore\r\n const firstLine = rawError.split('\\n', 1)[0];\r\n const exceptionRegex = /^([a-zA-Z0-9.]+\\.Exception):/i;\r\n\r\n // Verifica se la riga segue il formato standard .NET o un pattern di eccezione custom\r\n if (\r\n exceptionRegex.test(firstLine) ||\r\n firstLine.startsWith('System.') ||\r\n firstLine.startsWith('Microsoft.')\r\n ) {\r\n const colonIndex = firstLine.indexOf(': ');\r\n finalMessage = colonIndex === -1 ? firstLine : firstLine.slice(colonIndex + 2);\r\n } else {\r\n // Priorità: mantenimento dell'intero corpo per errori HTML o testo generico\r\n finalMessage = rawError;\r\n }\r\n } else {\r\n // Utilizzo del messaggio di default in assenza di corpo nell'errore\r\n finalMessage = defaultMessage;\r\n }\r\n const errorResponse: ErrorResponse = {\r\n exception: {\r\n isBe: false,\r\n type: 'ServerError',\r\n message: finalMessage,\r\n stackTrace: tracker.stack ?? '',\r\n },\r\n innerException: null,\r\n };\r\n throw new UniHttpError({\r\n type: 'server',\r\n request: requestClone,\r\n httpStatus: res.status,\r\n durationMs: Math.round(performance.now() - startTime),\r\n userAgent: navigator.userAgent,\r\n error: errorResponse,\r\n });\r\n}\r\n\r\n/**\r\n * Gestione errore in caso di assenza di risposta quando invece era prevista\r\n */\r\nfunction response204Error(request: Request, res: Response): UniHttpError {\r\n return new UniHttpError({\r\n type: 'be',\r\n request,\r\n httpStatus: res.status,\r\n durationMs: 0,\r\n userAgent: navigator.userAgent,\r\n error: {\r\n exception: {\r\n isBe: true,\r\n type: 'ProtocolError',\r\n message: 'Expected payload of type T, but received empty response.',\r\n stackTrace: '',\r\n },\r\n innerException: null,\r\n },\r\n });\r\n}\r\n","/* eslint-disable unicorn/no-break-in-nested-loop */\r\nimport { UniTypeDateManager } from 'uni-manager/type';\r\nimport type { HttpBody, HttpConfig } from 'uni-model-type/type';\r\n\r\n// =============================================================================\r\n// REQUEST\r\n// =============================================================================\r\n/**\r\n * Costruisce un oggetto Request completo e standardizzato per l'API partendo dai parametri di configurazione.\r\n * Gestisce la composizione dell'URL, la formattazione delle date nei query parametri e il merge dell'init.\r\n */\r\nexport function getRequest<T>(\r\n hostname: string,\r\n port: number,\r\n config: HttpConfig<T>,\r\n defaultRequestInit: RequestInit,\r\n): Request {\r\n const { queryParams, path, hasApiPrefix } = config;\r\n\r\n // Rimuove eventuali barre iniziali o finali dal path per evitare doppi slash (es. //api//)\r\n const cleanPath = path.replaceAll(/^\\/+|\\/+$/g, '');\r\n\r\n // Inserisce il prefisso 'api' a meno che non sia esplicitamente disabilitato nel config\r\n const segments = [hasApiPrefix === false ? '' : 'api', cleanPath].filter(Boolean);\r\n const pathFixed = '/' + segments.join('/');\r\n\r\n // Generazione dell'oggetto URL nativo combinando la base (host+porta) e il path strutturato\r\n const url = new URL(pathFixed, `http://${hostname}:${port}`);\r\n\r\n // Aggiunta query params\r\n if (queryParams) {\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(queryParams)) {\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 in formato nativo -> Convertito in YYYY-MM-DD\r\n if (item instanceof Date) {\r\n formattedValue = UniTypeDateManager.toYYYYMMDD(item);\r\n }\r\n // Caso: Date in formato ISO string -> Parsato e convertito in YYYY-MM-DD\r\n else if (typeof item === 'string' && isoDateRegex.test(item)) {\r\n const parsedDate = new Date(item);\r\n // Se la stringa superava la regex ma la data non è valida -> fallback sulla stringa originale\r\n formattedValue = Number.isNaN(parsedDate.getTime())\r\n ? item\r\n : UniTypeDateManager.toYYYYMMDD(parsedDate);\r\n }\r\n // Caso: Default (Numeri, Booleani, Stringhe standard) -> Conversione a stringa pulita\r\n else {\r\n formattedValue = String(item);\r\n }\r\n\r\n // Appende il parametro formattato nell'URL\r\n url.searchParams.append(key, formattedValue);\r\n }\r\n }\r\n }\r\n\r\n // Unisce le configurazioni base registrate nel config dell'endpoint con quelle puntuali della singola chiamata\r\n const initCustom: RequestInit = {\r\n ...defaultRequestInit,\r\n ...config.init,\r\n };\r\n\r\n // Ritorna l'oggetto Request completo di URL formattato e init con tutte le proprietà standard del browser\r\n return new Request(url, initCustom);\r\n}\r\n\r\n// =============================================================================\r\n// BODY\r\n// =============================================================================\r\n/**\r\n * Controlla che le chiavi degli oggetti nel body rispettino i tipi attesi:\r\n * - Se terminano con 'timestamp' -> il valore deve essere number\r\n * - Se terminano con 'date' o 'at' -> il valore deve essere un oggetto Date\r\n * - Se iniziano con 'is', 'has', 'should', 'can' -> il valore deve essere boolean\r\n * - Se terminano/corrispondono a 'id', 'count', 'qty', 'total' -> il valore deve essere number\r\n */\r\nexport function validateHttpBody<T>(body: HttpBody<T>): void {\r\n // Gestione degli array: validazione ricorsiva di ciascun elemento\r\n if (Array.isArray(body)) {\r\n for (const item of body) {\r\n validateHttpBody(item);\r\n }\r\n return;\r\n }\r\n\r\n // Gestione degli oggetti\r\n if (body !== null && typeof body === 'object' && !(body instanceof Date)) {\r\n for (const [key, value] of Object.entries(body)) {\r\n // 1. Booleani\r\n const booleanRegEx = /^(is|has|should|can)[A-Z]/;\r\n if (booleanRegEx.test(key) && typeof value !== 'boolean') {\r\n if (value === null) return;\r\n\r\n throw new TypeError(`Validation failed: key \"${key}\" must be a boolean.`);\r\n }\r\n\r\n // 2. Stringhe\r\n if (\r\n (key.endsWith('Code') ||\r\n key.endsWith('Name') ||\r\n key.endsWith('Description') ||\r\n key.endsWith('Url')) &&\r\n typeof value !== 'string'\r\n ) {\r\n if (value === null) return;\r\n\r\n throw new TypeError(`Validation failed: key \"${key}\" must be a string.`);\r\n }\r\n\r\n // 3. Controllo Date\r\n if (key.endsWith('Date') || key.endsWith('At')) {\r\n const isDateInstance = value instanceof Date && !Number.isNaN(value.getTime());\r\n const isoRegex = /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?(Z|[+-]\\d{2}:\\d{2})?)?$/;\r\n const isDateString =\r\n typeof value === 'string' && isoRegex.test(value) && !Number.isNaN(Date.parse(value));\r\n if (!isDateInstance && !isDateString) {\r\n if (value === null) return;\r\n\r\n throw new TypeError(\r\n `Validation failed: key \"${key}\" must be a valid Date object or ISO string.`,\r\n );\r\n }\r\n }\r\n\r\n // 4. Timestamp\r\n if (key.endsWith('Timestamp')) {\r\n if (value === null) return;\r\n\r\n if (typeof value !== 'number') {\r\n throw new TypeError(`Validation failed: key \"${key}\" must be a number.`);\r\n }\r\n\r\n const date = new Date(value);\r\n if (value !== null && Number.isNaN(date.getTime())) {\r\n throw new TypeError(`Validation failed: key \"${key}\" is not a valid timestamp.`);\r\n }\r\n }\r\n\r\n // 5. Controllo Numerico\r\n const numericSuffixes = ['Id', 'ID', 'Count', 'Qty', 'Total'];\r\n if (numericSuffixes.some((suffix) => key.endsWith(suffix)) && typeof value !== 'number') {\r\n if (value === null) return;\r\n\r\n throw new TypeError(`Validation failed: key \"${key}\" must be a number.`);\r\n }\r\n\r\n // Analisi ricorsiva per la verifica di eventuali sotto-oggetti o sotto-array\r\n validateHttpBody(value);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Normalizza i valori del body così da sistemare le incongruenze tra ui e db\r\n * - Applica il trim alle stringhe\r\n * - Converte gli oggetti Date in stringhe YYYY-MM-DD\r\n * - Rimuove la proprietà 'id' se presente al livello principale (root).\r\n */\r\nexport function normalizeHttpBody<T>(\r\n body: HttpBody<T>,\r\n method: 'post' | 'put',\r\n hasToKeepId: boolean | undefined,\r\n): unknown {\r\n // Validazione iniziale\r\n validateHttpBody(body);\r\n\r\n // UNDEFINED\r\n // Tipi gestiti: undefined\r\n if (body === undefined) {\r\n return undefined;\r\n }\r\n\r\n // NULL\r\n // Tipi gestiti: null\r\n if (body === null) {\r\n return null;\r\n }\r\n\r\n // DATE\r\n // Tipi gestiti: Date\r\n const isDateInstance = body instanceof Date;\r\n const isDateString =\r\n typeof body === 'string' && /^\\d{4}-\\d{2}-\\d{2}/.test(body) && !Number.isNaN(Date.parse(body));\r\n if (isDateInstance || isDateString) {\r\n return UniTypeDateManager.toYYYYMMDD(body);\r\n }\r\n\r\n // PRIMITIVI GENERICI\r\n // Tipi gestiti: number, boolean, symbol, bigint, string\r\n if (typeof body !== 'object') {\r\n if (typeof body !== 'string') return body ?? null;\r\n\r\n // Rimuove spazi inutili e restituisce null in caso di stringa vuota\r\n return body.trim() || null;\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, method, true));\r\n }\r\n\r\n // OGGETTI\r\n // Tipi gestiti: Record<string, any>, generici oggetti JavaScript ({ })\r\n // Rimozione della chiave 'id' al primo livello (root) e prosegue ricorsivamente\r\n const entries = Object.entries(body)\r\n .filter(([key]) => !(method === 'post' && !hasToKeepId && key.toLowerCase() === 'id'))\r\n .map(([key, value]) => [key, normalizeHttpBody(value, method, true)]);\r\n\r\n // Ricostruzione dell'oggetto normalizzato\r\n return Object.fromEntries(entries);\r\n}\r\n","/* eslint-disable unicorn/prefer-iterator-to-array */\r\n/* eslint-disable unicorn/prefer-iterator-helpers */\r\nimport { BehaviorSubject, Observable, distinctUntilChanged, map, of, tap } from 'rxjs';\r\nimport { UniToastManager } from 'uni-manager/toast';\r\nimport type {\r\n FileDatasource,\r\n HttpBody,\r\n HttpBodyPrimitive,\r\n HttpConfig,\r\n HttpConfigPolling,\r\n HttpRef,\r\n ToastConfig,\r\n} from 'uni-model-type/type';\r\n\r\nimport { http$, httpPolling$ } from './core';\r\nimport { executeBlob, executeHttp } from './execute';\r\nimport { getRequest, normalizeHttpBody } from './utilities';\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 /* ------------------------------------ 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 /* ------------------------------------------------------------------------------- */\r\n /* --------------------------------- Metodi: get --------------------------------- */\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 /** Restituisce se lo store ha chiamate in attesa di risposta o meno */\r\n public static get hasWaitingRequests$(): Observable<boolean> {\r\n return this.store$.pipe(\r\n map((requestMap) => [...requestMap.values()].some((request) => request.pendingCount > 0)),\r\n distinctUntilChanged(),\r\n );\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: store -------------------------------- */\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\n public static add(id: string, url: URL, type: HttpRef['type']): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = this.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 this.store.next(newMap);\r\n }\r\n\r\n /**\r\n * Rimuove un http ref tramite ID\r\n */\r\n public static remove(id: string): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = this.currentValue;\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n if (!oldMap.has(id)) return;\r\n\r\n // Aggiorna store\r\n const newMap = new Map(oldMap);\r\n newMap.delete(id);\r\n this.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\n public static updateIsLoading(id: string, delta: -1 | 1): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = this.currentValue;\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n 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 this.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\n public static updateHasError(id: string, hasError: boolean): void {\r\n // Recupera l'ultimo stato (Map)\r\n const oldMap = this.currentValue;\r\n\r\n // Controllo: se non è presente l'item allora termina\r\n 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 this.store.next(newMap);\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$(config: HttpConfig<void>): Observable<void>;\r\n public static read$<T>(config: HttpConfig<T>): Observable<T>;\r\n public static read$<T>(config: HttpConfig<void | T>): Observable<void | T> {\r\n /* Config */\r\n const defaultRequestInit: RequestInit = {\r\n method: 'GET',\r\n };\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n\r\n /* API */\r\n return http$(request.url, 'one', config, () => executeHttp<T>(request)).pipe(\r\n tap((res) => {\r\n if (config.hasToast === false || !!config.toast) return;\r\n\r\n if (!res) {\r\n UniToastManager.show({ label: 'NoItemFound' });\r\n } else if (Array.isArray(res)) {\r\n UniToastManager.show({ label: 'ItemsFound', params: { count: res.length } });\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$<TBody extends HttpBodyPrimitive>(\r\n config: HttpConfig<void> & { hasToKeepId?: boolean },\r\n body: HttpBody<TBody>,\r\n ): Observable<void>;\r\n public static create$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfig<TResponse> & { hasToKeepId?: boolean },\r\n body: HttpBody<TBody>,\r\n ): Observable<TResponse>;\r\n public static create$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfig<void | TResponse> & { hasToKeepId?: boolean },\r\n body: HttpBody<TBody>,\r\n ): Observable<void | TResponse> {\r\n /* Config */\r\n const defaultRequestInit: 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, 'post', config.hasToKeepId)),\r\n };\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n\r\n /* Config custom (toast di default) */\r\n const configCustom: HttpConfig<TResponse> = {\r\n ...config,\r\n toast: config.hasToast === false ? undefined : { ...CONFIG_TOAST_DEFAULT, ...config.toast },\r\n };\r\n\r\n /* API */\r\n return http$(request.url, 'one', configCustom, () => executeHttp<TResponse>(request));\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$(config: HttpConfig<void>): Observable<void>;\r\n public static update$<TResponse>(config: HttpConfig<TResponse>): Observable<TResponse>;\r\n public static update$<TBody extends HttpBodyPrimitive>(\r\n config: HttpConfig<void>,\r\n body: HttpBody<TBody>,\r\n ): Observable<void>;\r\n public static update$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfig<TResponse>,\r\n body: HttpBody<TBody>,\r\n ): Observable<TResponse>;\r\n public static update$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfig<void | TResponse>,\r\n body?: HttpBody<TBody>,\r\n ): Observable<void | TResponse> {\r\n /* Config */\r\n const defaultRequestInit: RequestInit = { method: 'PUT' };\r\n if (body !== undefined) {\r\n defaultRequestInit.headers = {\r\n 'Content-Type': 'application/json',\r\n ...config.init?.headers,\r\n };\r\n defaultRequestInit.body = JSON.stringify(normalizeHttpBody(body, 'put', false));\r\n }\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n\r\n /* Config custom (toast di default) */\r\n const configCustom: HttpConfig<TResponse> = {\r\n ...config,\r\n toast: config.hasToast === false ? undefined : { ...CONFIG_TOAST_DEFAULT, ...config.toast },\r\n };\r\n\r\n /* API */\r\n return http$(request.url, 'one', configCustom, () => executeHttp<TResponse>(request));\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$(config: HttpConfig<void>): Observable<void>;\r\n public static delete$<T>(config: HttpConfig<T>): Observable<T>;\r\n public static delete$<T>(config: HttpConfig<void | T>): Observable<void | T> {\r\n /* Config */\r\n const defaultRequestInit: RequestInit = {\r\n method: 'DELETE',\r\n };\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\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_DEFAULT, ...config.toast },\r\n };\r\n\r\n /* API */\r\n return http$(request.url, 'one', configCustom, () => executeHttp<T>(request));\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$(config: HttpConfig<FileDatasource>): Observable<void | FileDatasource> {\r\n // /* Config */\r\n // const defaultRequestInit: RequestInit = {\r\n // method: 'GET',\r\n // };\r\n // const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n // /* API */\r\n // return http$(request.url, 'image', config, () => executeBlob(request));\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<void> & { queryParams: { dispositionType: 'inline' } },\r\n ): Observable<URL>;\r\n public static readFile$(\r\n config: HttpConfig<void> & { queryParams: { dispositionType: 'attachment' } },\r\n ): Observable<FileDatasource>;\r\n public static readFile$(\r\n config: HttpConfig<void> & { queryParams: { dispositionType: 'inline' | 'attachment' } },\r\n ): Observable<URL | FileDatasource>;\r\n public static readFile$(\r\n config: HttpConfig<void> & { queryParams: { dispositionType: 'inline' | 'attachment' } },\r\n ): Observable<URL | FileDatasource> {\r\n /* Config */\r\n const defaultRequestInit: RequestInit = {\r\n method: 'GET',\r\n };\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n\r\n // Se è inline, restituisce l'URL arricchito con il token (senza fare la fetch)\r\n if (config.queryParams.dispositionType === 'inline') {\r\n const url: URL = new URL(request.url);\r\n\r\n /* Header */\r\n const authHeader = request.headers.get('Authorization');\r\n if (authHeader && authHeader.startsWith('Bearer ')) {\r\n const token = authHeader.slice(7);\r\n url.searchParams.append('token', token);\r\n }\r\n\r\n return of(url);\r\n }\r\n\r\n // Se è attachment, esegue la chiamata HTTP e restituisce il Blob binario\r\n return http$(request.url, 'image', config, () => executeBlob(request));\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$(config: HttpConfigPolling<void>): Observable<void>;\r\n public static readPolling$<T>(config: HttpConfigPolling<T>): Observable<T>;\r\n public static readPolling$<T>(config: HttpConfigPolling<void | T>): Observable<void | T> {\r\n /* Config */\r\n const defaultRequestInit: RequestInit = {\r\n method: 'GET',\r\n };\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n\r\n /* API */\r\n return httpPolling$(request.url, config, () => executeHttp<T>(request));\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$<TBody extends HttpBodyPrimitive>(\r\n config: HttpConfigPolling<void> & { hasToKeepId?: boolean },\r\n body: HttpBody<TBody>,\r\n ): Observable<void>;\r\n public static createPolling$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfigPolling<TResponse> & { hasToKeepId?: boolean },\r\n body: HttpBody<TBody>,\r\n ): Observable<TResponse>;\r\n public static createPolling$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfigPolling<void | TResponse> & { hasToKeepId?: boolean },\r\n body: HttpBody<TBody>,\r\n ): Observable<void | TResponse> {\r\n /* Config */\r\n const defaultRequestInit: RequestInit = {\r\n method: 'POST',\r\n headers: { 'Content-Type': 'application/json' },\r\n body: JSON.stringify(normalizeHttpBody(body, 'post', config.hasToKeepId)),\r\n };\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n\r\n /* API */\r\n return httpPolling$(request.url, config, () => executeHttp<TResponse>(request));\r\n }\r\n\r\n /**\r\n * Avvia un ciclo di polling basato su richieste PUT.\r\n */\r\n public static updatePolling$(config: HttpConfigPolling<void>): Observable<void>;\r\n public static updatePolling$<TBody extends HttpBodyPrimitive>(\r\n config: HttpConfigPolling<void>,\r\n body: HttpBody<TBody>,\r\n ): Observable<void>;\r\n public static updatePolling$<TResponse>(\r\n config: HttpConfigPolling<TResponse>,\r\n ): Observable<TResponse>;\r\n public static updatePolling$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfigPolling<TResponse>,\r\n body: HttpBody<TBody>,\r\n ): Observable<TResponse>;\r\n public static updatePolling$<TResponse, TBody extends HttpBodyPrimitive>(\r\n config: HttpConfigPolling<void | TResponse>,\r\n body?: HttpBody<TBody>,\r\n ): Observable<void | TResponse> {\r\n /* Config */\r\n const defaultRequestInit: RequestInit = {\r\n method: 'PUT',\r\n };\r\n if (body !== undefined) {\r\n defaultRequestInit.headers = {\r\n 'Content-Type': 'application/json',\r\n ...config.init?.headers,\r\n };\r\n defaultRequestInit.body = JSON.stringify(normalizeHttpBody(body, 'put', false));\r\n }\r\n const request: Request = getRequest(this.hostname, this.port, config, defaultRequestInit);\r\n\r\n /* API */\r\n return httpPolling$(request.url, config, () => executeHttp<TResponse>(request));\r\n }\r\n}\r\n","/**\n * Gener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,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE;AAC3B,YAAA,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;QAC3C;IACF;AAEA,IAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE;AACvB;AAEA;AACA;AACA;AACA;;AAEG;AACH;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA,eAAe,OAAO,CAAC,OAAgB,EAAA;AACrC,IAAA,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE;AACnC,IAAA,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,EAAE;AAEpC,IAAA,IAAI,GAAa;AAEjB,IAAA,IAAI;;AAEF,QAAA,GAAG,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC;IAC5B;IAAE,OAAO,KAAK,EAAE;;;;;AAKd,QAAA,MAAM,iBAAiB,GAAkB;AACvC,YAAA,SAAS,EAAE;AACT,gBAAA,IAAI,EAAE,KAAK;AACX,gBAAA,IAAI,EAAE,KAAK,Y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