{"version":3,"file":"toolbox-http.mjs","sources":["../../../projects/toolbox/http/error/error.model.ts","../../../projects/toolbox/http/error/error.helpers.ts","../../../projects/toolbox/http/services/http.helpers.ts","../../../projects/toolbox/http/services/http.client.ts","../../../projects/toolbox/http/url/url.helpers.ts","../../../projects/toolbox/http/url/url.service.ts","../../../projects/toolbox/http/interceptors/timing.interceptor.ts","../../../projects/toolbox/http/toolbox-http.ts"],"sourcesContent":["import { TbxValidationError } from \"./validation-error.model\";\r\n\r\n/**\r\n * Models an application error.\r\n */\r\nexport class TbxError implements Error {\r\n  /** The error message such as 'Http failure response'. */\r\n  public readonly message: string;\r\n\r\n  /** The error name such as HttpErrorResponse. */\r\n  public readonly name: string = \"\";\r\n\r\n  /** The HTTP error status code. */\r\n  public readonly status: number = 0;\r\n\r\n  /** The HTTP error status text. */\r\n  public readonly statusText: string = \"\";\r\n\r\n  /** The URL where the error occurred. */\r\n  public readonly url: string = \"\";\r\n\r\n  /** The error stack. */\r\n  public readonly stack: string = \"\";\r\n\r\n  /** An array of messages, if any. */\r\n  public readonly messages: string[] = [];\r\n\r\n  /** The area/location where the error occurred. */\r\n  public readonly area: string = \"\";\r\n\r\n  /** Indicates whether the error is fatal. */\r\n  public readonly isFatal: boolean = false;\r\n\r\n  /** An array of validation errors, if any. */\r\n  public readonly validationErrors: TbxValidationError[] = [];\r\n\r\n  /** The actual error object. */\r\n  public readonly error: unknown;\r\n\r\n  /**\r\n   * Initializes a new instance of the {@link TbxError} class.\r\n   * @param message The error message such as 'Http failure response'.\r\n   * @param init The optional initialization parameters.\r\n   */\r\n  public constructor(\r\n    message: string,\r\n    init?: {\r\n      name?: string;\r\n      /** The error status code. */\r\n      status?: number;\r\n      /** The error status text. */\r\n      statusText?: string;\r\n      /** The URL where the error occurred if a request. */\r\n      url?: string;\r\n      /** The error stack, if any. */\r\n      stack?: string;\r\n      /** An array of error messages. */\r\n      messages?: string[];\r\n      /** Area where the error occurred. */\r\n      area?: string;\r\n      /** Indicates whether the error is fatal. */\r\n      isFatal?: boolean;\r\n      /** An array of validation errors. */\r\n      validationErrors?: TbxValidationError[];\r\n      /** The original error object such as HttpErrorResponse. */\r\n      error?: never;\r\n    }\r\n  ) {\r\n    this.message = message;\r\n\r\n    if( init != null ) {\r\n      this.name = init.name ?? \"\";\r\n      this.status = init.status ?? 0;\r\n      this.statusText = init.statusText ?? \"\";\r\n      this.url = init.url ?? \"\";\r\n      this.stack = init.stack ?? \"\";\r\n      this.messages = init.messages ?? [];\r\n      this.area = init.area ?? \"\";\r\n      this.error = init.error;\r\n      this.isFatal = init.isFatal ?? false;\r\n      this.validationErrors = init.validationErrors ?? [];\r\n    }\r\n  }\r\n}\r\n","import { TbxError } from \"./error.model\";\r\nimport { TbxValidationError } from \"./validation-error.model\";\r\n\r\n/**\r\n * Parses the given error to a {@link TbxError} object.\r\n * @param error The error object to convert.\r\n * @param area The message to append to the error. The message is prefixed with\r\n * 'while' - for example, if area is 'getting project data' the error will read:\r\n * 'An error has occurred while getting project data.'\r\n * @returns A {@link TbxError} object.\r\n */\r\n/* eslint-disable @typescript-eslint/no-explicit-any */\r\n/* eslint-disable no-extra-boolean-cast */\r\nexport const parseApiError = ( error: any, area?: string ): TbxError => {\r\n  if( error == null ) {\r\n    throw new Error( \"Expected an error to parse\" );\r\n  }\r\n\r\n  if( error instanceof TbxError ) {\r\n    return error;\r\n  }\r\n\r\n  let message = error.message ?? \"\";\r\n  let messages: string[] = [];\r\n  const name = error.name ?? \"\";\r\n  const statusCode = error.status != null ? parseInt( error.status, 10 ) : 0;\r\n  const statusText = error.statusText ?? \"\";\r\n  const url = error.url ?? \"\";\r\n\r\n  if( error.error != null ) {\r\n    if( Boolean( error.error.title ) ) {\r\n      message = error.error.title;\r\n    }\r\n\r\n    if( Boolean( error.error.detail ) ) {\r\n      message = error.error.detail;\r\n    }\r\n\r\n    if( Boolean( error.error?.messages ) ) {\r\n      messages = [...error.error.messages];\r\n    }\r\n  }\r\n\r\n  if( statusCode === 401 || statusCode === 403 ) {\r\n    const action = ( area != null )\r\n                   ? `the action of ${ area }.` : \"this action.\";\r\n\r\n    message =\r\n      `You currently do not have access to perform ${ action }. ` +\r\n      \"Please contact the HelpDesk for assistance.\";\r\n  }\r\n\r\n  if( message.length === 0 || statusCode === 500 ) {\r\n    let temp = \"An unexpected error has occurred\";\r\n    if( area != null ) {\r\n      temp += ` while ${ area }`;\r\n    }\r\n\r\n    message = `${ temp }.  The administrators have been notified.`;\r\n  }\r\n\r\n  return new TbxError( message, {\r\n    name,\r\n    status: statusCode,\r\n    statusText,\r\n    url,\r\n    stack: error?.stack ?? new Error().stack,\r\n    messages,\r\n    area,\r\n    error,\r\n    validationErrors: getValidationErrors( error )\r\n  } );\r\n};\r\n\r\nconst getValidationErrors = ( error: any ) => {\r\n  const validationErrors: TbxValidationError[] = [];\r\n\r\n  if( Boolean( error.error?.validationErrors ) ) {\r\n    for( const val of error.error.validationErrors ) {\r\n      validationErrors.push( {\r\n        key: val.key,\r\n        message: val.message ?? val.errorMessage\r\n      } );\r\n    }\r\n  }\r\n\r\n  return validationErrors;\r\n};\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport { HttpHeaders, HttpParams } from \"@angular/common/http\";\r\nimport { TbxHttpClient } from \"./http.client\";\r\n\r\n/**\r\n * Sets the options for a request with standard headers including authentication,\r\n * accept and content-type headers for application/json, and X-Requested-With set\r\n * to \"XMLHttpRequest\".\r\n * @param params The URL parameters for the options. This calls the function\r\n * {@link buildUrlParams} to set the parameters.\r\n * @returns An object with proper header for the requests.\r\n */\r\nexport const getHttpOptions = ( params?: any ): {} => ( {\r\n  withCredentials: TbxHttpClient.withCredentials,\r\n  params: buildUrlParams( params ),\r\n  headers: new HttpHeaders( {\r\n    accept: \"application/json\",\r\n    // eslint-disable-next-line @typescript-eslint/naming-convention\r\n    \"content-Type\": \"application/json; charset=utf-8\",\r\n    // eslint-disable-next-line @typescript-eslint/naming-convention\r\n    \"x-Requested-With\": \"XMLHttpRequest\"\r\n  } )\r\n} );\r\n\r\n/**\r\n * Builds the URL search parameters if specified.\r\n * @param params - The URL parameters.\r\n * @returns An object with proper header for the requests.\r\n */\r\nexport const buildUrlParams = ( params?: any ): HttpParams => {\r\n  let hp = new HttpParams();\r\n\r\n  for( const key in params ) {\r\n    if( Object.prototype.hasOwnProperty.call( params, key ) ) {\r\n      hp = hp.append( key.toString(), params[key].toString() );\r\n    }\r\n  }\r\n\r\n  return hp;\r\n};\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport { HttpClient, HttpResponse } from \"@angular/common/http\";\r\nimport { inject, Injectable } from \"@angular/core\";\r\nimport { Observable, throwError } from \"rxjs\";\r\nimport { catchError } from \"rxjs/operators\";\r\n\r\nimport { parseApiError } from \"../error/error.helpers\";\r\nimport { getHttpOptions } from \"./http.helpers\";\r\n\r\n/**\r\n * Provides HTTP functions for the application. It automatically adds headers\r\n * needed by the back-end, and any authentication tokens or credentials.\r\n */\r\n@Injectable( { providedIn: \"root\" } )\r\nexport class TbxHttpClient {\r\n\r\n  public static withCredentials = true;\r\n  private readonly http = inject( HttpClient );\r\n\r\n  /**\r\n   * Convert the error to a standard {@link TbxError} and rethrows the error.\r\n   * @param error The error to handle.\r\n   * @returns A new {@link Observable} of type {@link TbxError}.\r\n   */\r\n  private static handleError<T>( error: any ): Observable<T> {\r\n    console.group( \"ToolBox API Error\" );\r\n    console.error( error );\r\n    console.groupEnd();\r\n\r\n    return throwError( () => parseApiError( error ) );\r\n  }\r\n\r\n  /**\r\n   * Constructs a GET request which interprets the body as JSON and returns it.\r\n   * @param url - The URL to send the request to.\r\n   * @param params - Any parameters to send along with the query.\r\n   * @param options - Any options to add to the request. If not options given,\r\n   * the standard headers and options will be applied.\r\n   * @returns The body as JSON, or a {@link Observable} if an error is encountered.\r\n   */\r\n  public get<T>( url: string, params?: any, options?: {} ): Observable<T> {\r\n    const opts = options != null ? options : getHttpOptions( params );\r\n\r\n    return this.http\r\n               .get<T>( url, opts )\r\n               .pipe( catchError( error => TbxHttpClient.handleError<T>( error ) ) );\r\n  }\r\n\r\n  /**\r\n   * Constructs a GET request which interprets the body as JSON\r\n   * and returns the full response.\r\n   * @param url - The URL to send the request to.\r\n   * @returns The full response of the request as an {@link Observable<HttpResponse<T>},\r\n   * or a {@link Observable} if an error is encountered.\r\n   */\r\n  public getFull<T>( url: string ): Observable<HttpResponse<T>> {\r\n    return this.http\r\n               .get<T>(\r\n                 url,\r\n                 {\r\n                   observe: \"response\",\r\n                   ...getHttpOptions()\r\n                 } )\r\n               .pipe( catchError(\r\n                 error => TbxHttpClient.handleError<HttpResponse<T>>( error ) )\r\n               );\r\n  }\r\n\r\n  /**\r\n   * Construct a POST request and includes the {@param body} as the payload.\r\n   * @param url - The URL to send the request to.\r\n   * @param body - The data to send as the body/payload.\r\n   * @param options - Any options to add to the request. If not options given,\r\n   * the standard headers and options will be applied.\r\n   * @returns The response as an {@link Observable}, or an error {@link Observable}\r\n   * if an error is encountered.\r\n   */\r\n  public post<T>( url: string, body: any, options?: {} ): Observable<T> {\r\n    const opts = options ?? getHttpOptions();\r\n\r\n    return this.http\r\n               .post<T>( url, body, opts )\r\n               .pipe( catchError( error => TbxHttpClient.handleError<T>( error ) ) );\r\n  }\r\n\r\n  /**\r\n   * Construct a PUT request and includes the {@param body} as the payload.\r\n   * @param url The URL to send the request to.\r\n   * @param body The data to send as the body/payload.\r\n   * @param options - Any options to add to the request. If not options given,\r\n   * the standard headers and options will be applied.\r\n   * @returns The response as an {@link Observable}, or an error {@link Observable}\r\n   * if an error is encountered.\r\n   */\r\n  public put<T>( url: string, body: any, options?: {} ): Observable<T> {\r\n    const opts = options ?? getHttpOptions();\r\n\r\n    return this.http\r\n               .put<T>( url, body, opts )\r\n               .pipe( catchError( error => TbxHttpClient.handleError<T>( error ) ) );\r\n  }\r\n\r\n  /**\r\n   * Construct a DELETE request.\r\n   * @param url The URL to send the request to.\r\n   * @param options - Any options to add to the request. If not options given,\r\n   * the standard headers and options will be applied.\r\n   * @returns The response as an {@link Observable}, or an error {@link Observable}\r\n   * if an error is encountered.\r\n   */\r\n  public delete<T>( url: string, options?: {} ): Observable<T> {\r\n    const opts = options ?? getHttpOptions();\r\n\r\n    return this.http\r\n               .delete<T>( url, opts )\r\n               .pipe( catchError( error => TbxHttpClient.handleError<T>( error ) ) );\r\n  }\r\n}\r\n","export const getBaseUrl = (): string => {\r\n  const els = document.getElementsByTagName( \"base\" );\r\n\r\n  return els.length > 0 ? els[0].href : \"/\";\r\n};\r\n\r\nexport const getBaseUrlFromWindow = (): string => {\r\n  console.log( \"window.location\", window.location );\r\n\r\n  return \"\";\r\n};\r\n","import { Injectable } from \"@angular/core\";\r\nimport {\r\n  removeLeadingSlash,\r\n  removeTrailingSlash,\r\n  isNotNullOrEmpty\r\n} from \"@lacera/ngx-toolbox/utilities\";\r\n\r\nimport { getBaseUrl } from \"./url.helpers\";\r\nimport { TbxUrlModel } from \"./url.model\";\r\n\r\n/**\r\n * Provides functions to get URLs defined in the server.\r\n */\r\n@Injectable( { providedIn: \"root\" } )\r\nexport class TbxUrlService {\r\n  /** Gets or sets a list of all available server endpoints. */\r\n  public routes: TbxUrlModel[] = [];\r\n\r\n  /** The base HREF for the application. */\r\n  public baseHref = \"\";\r\n\r\n  /**\r\n   * Gets a value indicating whether the base HREF should be included when resolving.\r\n   */\r\n  public includeBaseHref = false;\r\n\r\n  /** Gets the home relative URL such as \"/\". */\r\n  public get home(): string {\r\n    return this.find( \"relBaseUrl\" )?.url ?? getBaseUrl();\r\n  }\r\n\r\n  /** Gets the home absolute URL (e.g., http://localhost:4200/) */\r\n  public get homeAbsolute(): string {\r\n    return this.find( \"baseUrl\" )?.url ?? getBaseUrl();\r\n  }\r\n\r\n  /** Gets the URL to submit log entries to the server. */\r\n  public get log(): string {\r\n    return this.find( \"ToolBoxPostLogApi\" )?.url ?? \"api/toolbox/Log\";\r\n  }\r\n\r\n  /** Gets the URL to submit emails to the server. */\r\n  public get sendMail(): string {\r\n    return this.find( \"ToolBoxPostSendMailApi\" )?.url ?? \"api/toolbox/sendmail\";\r\n  }\r\n\r\n  /** Gets the URL to submit errors to the server. */\r\n  public get submitError(): string {\r\n    return this.find( \"ToolBoxPostErrorApi\" )?.url ?? \"api/toolbox/error\";\r\n  }\r\n\r\n  /**\r\n   * Simple function to combine URL segments for the service.\r\n   * @param path1 - The first path.\r\n   * @param path2 - The optional second path.\r\n   * @param path3 - An optional third path.\r\n   * @returns The properly combined URL.\r\n   */\r\n  public static combine( path1: string, path2?: string, path3?: string ): string {\r\n    const result: string[] = [];\r\n\r\n    if( path1.length > 0 ) {\r\n      result[0] = removeLeadingSlash(\r\n        removeTrailingSlash( path1 ) );\r\n    }\r\n\r\n    if( path2 !== undefined && path2.length > 0 ) {\r\n      if( path2.startsWith( \"http\" ) ) {\r\n        return this.combine( path2, path3 ?? \"\" );\r\n      }\r\n      else {\r\n        result[1] = removeLeadingSlash( path2 );\r\n      }\r\n    }\r\n\r\n    if( path3 !== undefined && path3.length > 0 ) {\r\n      result[2] = removeLeadingSlash( path3 );\r\n    }\r\n\r\n    return result.join( \"/\" );\r\n  }\r\n\r\n  /**\r\n   * Gets the URL by the specified name appending an optional segment.\r\n   * @param name - The name of the endpoint to resolve.\r\n   * @param appendUrl - An optional segment to append to the URL.\r\n   * @throws The specified URL name does not exist in the server.\r\n   * @returns The URL of the endpoint or undefined.\r\n   */\r\n  public get( name: string, appendUrl?: string ): string {\r\n    const url = this.resolve( name );\r\n    if( url !== undefined ) {\r\n      return TbxUrlService.combine( url, appendUrl );\r\n    }\r\n\r\n    throw new Error( `No URL found with the name: ${ name }.` );\r\n  }\r\n\r\n  /**\r\n   * Resolves the URL by the specified name.\r\n   * @param name - The name of the endpoint to resolve.\r\n   * @returns The URL of the endpoint or undefined.\r\n   */\r\n  public resolve( name: string ): string | undefined {\r\n    // Find the URL received from the server\r\n    const route = this.find( name );\r\n    if( route === undefined ) {\r\n      return undefined;\r\n    }\r\n\r\n    // Check if we need to include the path to the server\r\n    const tempServerUrl = this.includeBaseHref ? this.baseHref : \"\";\r\n\r\n    if( isNotNullOrEmpty( route.url ) ) {\r\n      return TbxUrlService.combine( tempServerUrl, route.url );\r\n    }\r\n    else if(\r\n      isNotNullOrEmpty( route.template ) &&\r\n      route.template.endsWith( \"}\" )\r\n    ) {\r\n      return TbxUrlService.combine(\r\n        tempServerUrl,\r\n        route.template.slice( 0, route.template.indexOf( \"{\" ) )\r\n      );\r\n    }\r\n\r\n    return undefined;\r\n  }\r\n\r\n  /**\r\n   * Finds the route by the specified name.\r\n   * @param name The of the route to find.\r\n   * @returns The url model if found, otherwise undefined.\r\n   */\r\n  public find( name: string ): TbxUrlModel | undefined {\r\n    return this.routes.find( r => r.name === name );\r\n  }\r\n}\r\n","import { HttpEvent, HttpInterceptorFn, HttpResponse } from \"@angular/common/http\";\r\nimport { tap } from \"rxjs/operators\";\r\n\r\n/**\r\n * Intercepts HTTP requests sent from this application and logs to the console\r\n * how long it took to complete in milliseconds.\r\n */\r\nexport const tbxTimingInterceptor: HttpInterceptorFn = ( req, next ) => {\r\n  const started = Date.now();\r\n\r\n  return next( req )\r\n    .pipe( tap( ( event: HttpEvent<unknown> ) => {\r\n        if( event instanceof HttpResponse ) {\r\n          const elapsed = Date.now() - started;\r\n\r\n          console.group( \"ToolBox\" );\r\n          console.log(\r\n            `%c ${ req.urlWithParams }%c - ${ elapsed } ms.`,\r\n            \"color: blue;\",\r\n            \"font-weight: bold;\"\r\n          );\r\n          console.groupEnd();\r\n        }\r\n      } )\r\n    );\r\n};\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAEA;;AAEG;MACU,QAAQ,CAAA;AAkCnB;;;;AAIG;IACH,WAAA,CACE,OAAe,EACf,IAoBC,EAAA;;QAxDa,IAAA,CAAA,IAAI,GAAW,EAAE;;QAGjB,IAAA,CAAA,MAAM,GAAW,CAAC;;QAGlB,IAAA,CAAA,UAAU,GAAW,EAAE;;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