{"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/util.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  err: unknown,\r\n  errorMode: PollingErrorMode,\r\n): Observable<never> {\r\n  // Controllo: sia effettivamente un errore di tipo 'UniHttpError'\r\n  if (err instanceof UniHttpError) {\r\n    switch (errorMode) {\r\n      case PollingErrorMode.IGNORE: {\r\n        return of();\r\n      }\r\n      case PollingErrorMode.SKIP: {\r\n        return EMPTY;\r\n      }\r\n      case PollingErrorMode.IGNORE_WITH_ERROR: {\r\n        UniErrorManager.add(ref, err);\r\n        return of();\r\n      }\r\n      case PollingErrorMode.STOP: {\r\n        UniErrorManager.add(ref, err);\r\n        return throwError(() => err);\r\n      }\r\n    }\r\n  } else {\r\n    return throwError(() => err);\r\n  }\r\n}\r\n","import isEqual from 'lodash-es/isEqual';\r\nimport {\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  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          add(ref, new URL(url), refType);\r\n\r\n          /* Incrementa per il loader */\r\n          if (hasLoader !== false) {\r\n            updateIsLoading(ref, 1);\r\n          }\r\n        },\r\n        unsubscribe: () => {\r\n          /* Rimozione reference */\r\n          remove(ref);\r\n        },\r\n        next: (res) => {\r\n          /* Mostra toast (se presente) */\r\n          if (toast) {\r\n            UniToastManager.showHttp(toast, res);\r\n          }\r\n        },\r\n      }),\r\n      catchError((err) => {\r\n        // Aggiorna la ref nella map\r\n        updateHasError(ref, true);\r\n\r\n        /* Gestione errore */\r\n        return errorHandler(ref, err, PollingErrorMode.STOP);\r\n      }),\r\n      finalize(() => {\r\n        /* Decrementa per il loader */\r\n        if (hasLoader !== false) {\r\n          updateIsLoading(ref, -1);\r\n        }\r\n      }),\r\n    );\r\n  });\r\n}\r\n\r\n/**\r\n * Avvia e coordina un ciclo di polling a intervalli regolari.\r\n * Gestisce la concorrenza tramite operatori RxJS configurabili, la rimozione dei popup, di errore nelle iterazioni successive e i comportamenti custom al primo avvio.\r\n */\r\nexport function httpPolling$<T>(\r\n  url: 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        add(ref, new URL(url), 'polling');\r\n      },\r\n      unsubscribe: () => {\r\n        /* Rimozione reference */\r\n        remove(ref);\r\n      },\r\n    }),\r\n    operatorHandler<T>(operator)((index) => {\r\n      /* Incrementa per il loader */\r\n      if (index === 0 && firstIteration?.hasLoader !== false) {\r\n        updateIsLoading(ref, 1);\r\n      }\r\n\r\n      return defer(() => {\r\n        const http$ = from(promiseFactory());\r\n        return http$.pipe(\r\n          tap((res) => {\r\n            /* Meccanismo di ripristino automatico: se il polling torna in salute, cancella l'errore dallo store e nasconde i relativi messaggi a schermo */\r\n            if (errorMode === PollingErrorMode.IGNORE_WITH_ERROR) {\r\n              updateHasError(ref, false);\r\n              UniErrorManager.remove(ref);\r\n            }\r\n\r\n            /* Prima risposta */\r\n            if (index === 0 && firstIteration?.toast) {\r\n              UniToastManager.showHttp(firstIteration.toast, res);\r\n            }\r\n          }),\r\n          catchError((err) => {\r\n            // Aggiorna la ref nella map\r\n            updateHasError(ref, true);\r\n\r\n            /* Gestione errore */\r\n            return errorHandler(ref, err, errorMode);\r\n          }),\r\n          finalize(() => {\r\n            /* Decrementa per il loader */\r\n            if (index === 0 && firstIteration?.hasLoader !== false) {\r\n              updateIsLoading(ref, -1);\r\n            }\r\n          }),\r\n        );\r\n      });\r\n    }),\r\n  );\r\n\r\n  return emitValueMode === EmitValueMode.ON_NEW_DATA\r\n    ? source$.pipe(distinctUntilChanged((prev, cur) => isEqual(prev, cur)))\r\n    : source$;\r\n}\r\n\r\n/* ------------------------------------------------------------------------------- */\r\n/* ------------------------------------ Utils ------------------------------------ */\r\n/* ------------------------------------------------------------------------------- */\r\n/**\r\n * Aggiunge una nuova ref nello store solo se non è già presente.\r\n * Se l'ID esiste già, l'operazione viene interrotta per preservare il dato originale.\r\n */\r\nfunction add(id: string, url: URL, type: HttpRef['type']): void {\r\n  // Recupera l'ultimo stato (Map)\r\n  const oldMap = UniHttpManager.currentValue;\r\n\r\n  // Controllo: se è presente l'item allora termina\r\n  if (oldMap.get(id)) return;\r\n\r\n  // Crea il nuovo oggetto\r\n  const newItemMap: HttpRef = {\r\n    type,\r\n    lineId: undefined,\r\n    url,\r\n    hasError: false,\r\n    pendingCount: 0,\r\n  };\r\n\r\n  // Crea una nuova istanza della Map\r\n  const newMap = new Map(oldMap);\r\n  newMap.set(id, newItemMap);\r\n\r\n  // Aggiorna il nuovo stato notificando l'observer\r\n  UniHttpManager.store.next(newMap);\r\n}\r\n\r\n/**\r\n * Rimuove un http ref tramite ID\r\n */\r\nfunction remove(id: string): void {\r\n  // Recupera l'ultimo stato (Map)\r\n  const oldMap = UniHttpManager.currentValue;\r\n\r\n  // Controllo: se non è presente l'item allora termina\r\n  if (!oldMap.has(id)) return;\r\n\r\n  // Aggiorna store\r\n  const newMap = new Map(oldMap);\r\n  newMap.delete(id);\r\n  UniHttpManager.store.next(newMap);\r\n}\r\n\r\n/**\r\n * Aggiorna il contatore delle chiamate pendenti per una specifica ref.\r\n * Incrementa o decrementa 'pendingCount' garantendo che non scenda mai sotto lo zero.\r\n * Se la ref non esiste, l'operazione viene ignorata.\r\n */\r\nfunction updateIsLoading(id: string, delta: -1 | 1): void {\r\n  // Recupera l'ultimo stato (Map)\r\n  const oldMap = UniHttpManager.currentValue;\r\n\r\n  // Controllo: se non è presente l'item allora termina\r\n  const oldItem = oldMap.get(id);\r\n  if (!oldItem) return;\r\n\r\n  // Aggiorna l'oggetto\r\n  const newItemMap: HttpRef = {\r\n    ...oldItem,\r\n    pendingCount: Math.max(0, oldItem.pendingCount + delta),\r\n  };\r\n\r\n  // Crea una nuova istanza della Map\r\n  const newMap = new Map(oldMap);\r\n  newMap.set(id, newItemMap);\r\n\r\n  // Aggiorna il nuovo stato notificando l'observer\r\n  UniHttpManager.store.next(newMap);\r\n}\r\n\r\n/**\r\n * Aggiorna lo stato di errore per una specifica ref.\r\n * Se il valore di 'hasError' è identico a quello attuale o se la ref non esiste,\r\n * l'operazione viene interrotta per evitare aggiornamenti inutili.\r\n */\r\nfunction updateHasError(id: string, hasError: boolean): void {\r\n  // Recupera l'ultimo stato (Map)\r\n  const oldMap = UniHttpManager.currentValue;\r\n\r\n  // Controllo: se non è presente l'item allora termina\r\n  const oldItem = oldMap.get(id);\r\n  if (!oldItem) return;\r\n\r\n  // Controllo: se con lo stesso valore, salta\r\n  if (oldItem.hasError === hasError) return;\r\n\r\n  // Aggiorna l'oggetto\r\n  const newItemMap: HttpRef = { ...oldItem, hasError };\r\n\r\n  // Crea una nuova istanza della Map\r\n  const newMap = new Map(oldMap);\r\n  newMap.set(id, newItemMap);\r\n\r\n  // Aggiorna il nuovo stato notificando l'observer\r\n  UniHttpManager.store.next(newMap);\r\n}\r\n","import { isErrorResponse, UniHttpError } from 'uni-error/http';\r\nimport type { ErrorResponse, FileDatasource } from 'uni-model-type/type';\r\n\r\n// =============================================================================\r\n// MOTORE DI ESECUZIONE HTTP\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 errorResponse: ErrorResponse = {\r\n      exception: {\r\n        isBe: false,\r\n        type: 'ServerError',\r\n        message:\r\n          typeof httpError === 'string' && httpError.trim()\r\n            ? httpError // Se è presente l'HTML o del testo reale del server, viene utilizzato questo\r\n            : defaultMessage, // Se il corpo della risposta è vuoto, viene usato il messaggio di sicurezza\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// 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 fileName = 'download.pdf'; // Fallback di default\r\n  if (disposition) {\r\n    const matches = /filename[^;=\\n]*=((['\"]).*?\\2|[^;\\n]*)/.exec(disposition);\r\n    if (!!matches && matches[1]) {\r\n      fileName = matches[1].replaceAll(/['\"]/g, '');\r\n    }\r\n  }\r\n\r\n  /* Genera l'URL temporaneo dal blob */\r\n  const fileUrl = URL.createObjectURL(blob);\r\n\r\n  setTimeout(() => {\r\n    URL.revokeObjectURL(fileUrl);\r\n  }, 60_000);\r\n\r\n  return { url: fileUrl, name: fileName };\r\n}\r\n\r\n// =============================================================================\r\n// HELPERS\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","import { UniTypeDateManager } from 'uni-manager/type';\r\nimport type { HttpBody, HttpConfig } from 'uni-model-type/type';\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 * 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 isBooleanPattern = /^(is|has|should|can)[A-Z]/;\r\n      if (isBooleanPattern.test(key) && typeof value !== 'boolean') {\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        value !== null &&\r\n        typeof value !== 'string'\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 (value !== null && !isDateInstance && !isDateString) {\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 (typeof value !== 'number') {\r\n          throw new TypeError(`Validation failed: key \"${key}\" must be a number.`);\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', 'ID', 'Count', 'Qty', 'Total'];\r\n      if (numericSuffixes.some((suffix) => key.endsWith(suffix)) && typeof value !== 'number') {\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    const date = new Date(body);\r\n    return UniTypeDateManager.toYYYYMMDD(date);\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","import { BehaviorSubject, Observable, distinctUntilChanged, map, 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 './util';\r\n\r\nconst CONFIG_TOAST_DEFAULT: ToastConfig = {\r\n  type: 'success',\r\n  label: 'OperationCompleted',\r\n};\r\n\r\nexport class UniHttpManager {\r\n  /* ------------------------------------------------------------------------------- */\r\n  /* ----------------------------------- Config ------------------------------------ */\r\n  /* ------------------------------------------------------------------------------- */\r\n  /** Hostname del server (es. 'api.example.com' o 'localhost') */\r\n  private static hostname: string;\r\n\r\n  /** Porta del server su cui effettuare le chiamate (es. 80, 443 o 3000) */\r\n  private static port: number;\r\n\r\n  /* ------------------------------------------------------------------------------- */\r\n  /* --------------------------------- Metodi: get --------------------------------- */\r\n  /* ------------------------------------------------------------------------------- */\r\n  /** Restituisce se lo store ha chiamate in attesa di risposta o meno */\r\n  public static get hasWaitingRequests$(): Observable<boolean> {\r\n    return this.store$.pipe(\r\n      map((requestMap) => [...requestMap.values()].some((x) => x.pendingCount > 0)),\r\n      distinctUntilChanged(),\r\n    );\r\n  }\r\n\r\n  /* ------------------------------------------------------------------------------- */\r\n  /* ------------------------------------ Store ------------------------------------ */\r\n  /* ------------------------------------------------------------------------------- */\r\n  /** Store privato (Subject) */\r\n  public static store = new BehaviorSubject<Map<string, HttpRef>>(new Map());\r\n\r\n  /** Store pubblico (Observable) */\r\n  public static store$: Observable<Map<string, HttpRef>> = this.store.asObservable();\r\n\r\n  /** Ottiene lo stato attuale della Map senza dover sottoscrivere l'observable */\r\n  public static get currentValue(): Map<string, HttpRef> {\r\n    return this.store.getValue();\r\n  }\r\n\r\n  /* ------------------------------------------------------------------------------- */\r\n  /* -------------------------------- Metodi: setup -------------------------------- */\r\n  /* ------------------------------------------------------------------------------- */\r\n  /**\r\n   * Inizializza la configurazione di rete del manager.\r\n   * Deve essere chiamato prima di effettuare qualsiasi richiesta HTTP.\r\n   */\r\n  public static setup(hostname: string, port: number): void {\r\n    this.hostname = hostname;\r\n    this.port = port;\r\n  }\r\n\r\n  /* ------------------------------------------------------------------------------- */\r\n  /* -------------------------------- Metodi: CRUD --------------------------------- */\r\n  /* ------------------------------------------------------------------------------- */\r\n  /*\r\n   * Esegue una singola richiesta HTTP GET.\r\n   * Utilizza il path configurato per costruire l'URL completo e restituisce un Observable del risultato.\r\n   */\r\n  public static read$(config: HttpConfig<void>): Observable<void>;\r\n  public static read$<T>(config: HttpConfig<T>): Observable<T>;\r\n  public static read$<T>(config: HttpConfig<T>): Observable<T | void> {\r\n    /* Config */\r\n    const defaultRequestInit: RequestInit = {\r\n      method: 'GET',\r\n    };\r\n    // const a = this.create$(config, { id: 4 });\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 (Array.isArray(res) && config.hasToast && !config.toast) {\r\n          UniToastManager.show({\r\n            label: 'ItemsFound',\r\n            params: { count: res.length },\r\n          });\r\n        }\r\n      }),\r\n    );\r\n  }\r\n\r\n  /**\r\n   * Esegue una richiesta HTTP POST inviando un payload JSON nel corpo della richiesta.\r\n   * Imposta automaticamente l'header 'Content-Type' come 'application/json'.\r\n   */\r\n  public static create$<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<TResponse> & { hasToKeepId?: boolean },\r\n    body: HttpBody<TBody>,\r\n  ): Observable<TResponse | void> {\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$<TBody extends HttpBodyPrimitive>(\r\n    config: HttpConfig<void>,\r\n    body: HttpBody<TBody>,\r\n  ): Observable<void>;\r\n  public static update$<TResponse>(config: HttpConfig<TResponse>): Observable<TResponse>;\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<TResponse>,\r\n    body?: HttpBody<TBody>,\r\n  ): Observable<TResponse | void> {\r\n    /* Config */\r\n    const defaultRequestInit: RequestInit = { method: 'PUT' };\r\n    if (body) {\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<T>): Observable<T | void> {\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<FileDatasource | void> {\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, '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$(config: HttpConfig<FileDatasource>): Observable<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    /* Config custom (toast di default) */\r\n    const configCustom: HttpConfig<FileDatasource> = {\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, 'file', configCustom, () => 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<T>): Observable<T | void> {\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<TResponse> & { hasToKeepId?: boolean },\r\n    body: HttpBody<TBody>,\r\n  ): Observable<TResponse | void> {\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<TResponse>,\r\n    body?: HttpBody<TBody>,\r\n  ): Observable<TResponse | void> {\r\n    /* Config */\r\n    const defaultRequestInit: RequestInit = {\r\n      method: 'PUT',\r\n    };\r\n    if (body) {\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,GAAY,EACZ,SAA2B,EAAA;;AAG3B,IAAA,IAAI,GAAG,YAAY,YAAY,EAAE;QAC/B,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,iBAA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