{"version":3,"file":"ngx-http-resilience.mjs","sources":["../../../../packages/ngx-http-resilience/src/lib/retry/delay-fns/constant.ts","../../../../packages/ngx-http-resilience/src/lib/retry/delay-fns/exponential.ts","../../../../packages/ngx-http-resilience/src/lib/retry/delay-fns/jitter.ts","../../../../packages/ngx-http-resilience/src/lib/retry/delay-fns/linear.ts","../../../../packages/ngx-http-resilience/src/lib/retry/error-predicates/any-error.ts","../../../../packages/ngx-http-resilience/src/lib/retry/error-predicates/any-http-error.ts","../../../../packages/ngx-http-resilience/src/lib/retry/error-predicates/with-status-codes.ts","../../../../packages/ngx-http-resilience/src/lib/retry/internal/retry-state.ts","../../../../packages/ngx-http-resilience/src/lib/retry/internal/retry-request-with-strategy.ts","../../../../packages/ngx-http-resilience/src/lib/retry/http-retry-interceptor.fn.ts","../../../../packages/ngx-http-resilience/src/lib/retry/http-retry-interceptor.service.ts","../../../../packages/ngx-http-resilience/src/lib/retry/predicate-builder.ts","../../../../packages/ngx-http-resilience/src/lib/retry/request-predicates/context.ts","../../../../packages/ngx-http-resilience/src/lib/retry/request-predicates/disableable.ts","../../../../packages/ngx-http-resilience/src/lib/retry/request-predicates/match-pattern.ts","../../../../packages/ngx-http-resilience/src/lib/retry/types.ts","../../../../packages/ngx-http-resilience/src/lib/visibility/http-visibility-interceptor.fn.ts","../../../../packages/ngx-http-resilience/src/lib/visibility/http-visibility-interceptor.service.ts","../../../../packages/ngx-http-resilience/src/lib/visibility/types.ts","../../../../packages/ngx-http-resilience/src/ngx-http-resilience.ts"],"sourcesContent":["import { DelayFn } from '../types';\n\n/**\n * Always wait for the same amount of time before retrying\n * @param delay The amount of time in milliseconds to wait\n * @param fastFirst Whether to immediately retry for the first attempt\n */\nexport function constantDelay(delay: number, fastFirst = false): DelayFn {\n  if (delay < 0) {\n    throw new Error('Delay must be greater than or equal to 0');\n  }\n\n  if (fastFirst) {\n    return (state) => (state.attempt === 1 ? 0 : delay);\n  }\n\n  return () => delay;\n}\n","import { DelayFn } from '../types';\n\n/**\n * Wait for an exponential increasing amount of time before retrying\n * @param initialDelay The initial amount of time in milliseconds to wait\n * @param factor The factor to increase the delay by\n * @param fastFirst Whether to immediately retry for the first attempt\n */\nexport function exponentialDelay(\n  initialDelay: number,\n  factor = 2,\n  fastFirst = false\n): DelayFn {\n  if (initialDelay <= 0) {\n    throw new Error('Initial delay must be greater than 0');\n  }\n\n  if (factor <= 0) {\n    throw new Error('Factor must be greater than 0');\n  }\n\n  if (fastFirst) {\n    return (state) =>\n      state.attempt === 1 ? 0 : initialDelay * factor ** (state.attempt - 2);\n  }\n\n  return (state) => initialDelay * factor ** (state.attempt - 1);\n}\n","import { RetryState } from '../internal';\nimport { DelayFn } from '../types';\n\nexport interface JitterOptions {\n  min: number;\n  max: number;\n}\n\n/* TODO - Add other algorithms that smooth and increase decorrelation\n * see:\n *  - https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/\n *  - https://github.com/Polly-Contrib/Polly.Contrib.WaitAndRetry#new-jitter-recommendation\n *  - https://github.com/Polly-Contrib/Polly.Contrib.WaitAndRetry/blob/master/src/Polly.Contrib.WaitAndRetry/Backoff.DecorrelatedJitterV2.cs\n *  - https://github.com/App-vNext/Polly/issues/530\n */\n\nexport function addJitter(\n  delayFn: DelayFn,\n  options: JitterOptions,\n  fastFirst = false\n): DelayFn {\n  if (options.min > options.max) {\n    throw new Error('Min must be less than or equal to max');\n  }\n\n  if (fastFirst) {\n    return (state) =>\n      state.attempt === 1 ? 0 : addJitterToDelay(delayFn, state, options);\n  }\n\n  return (state) => {\n    return addJitterToDelay(delayFn, state, options);\n  };\n}\n\nfunction addJitterToDelay(\n  delayFn: DelayFn,\n  state: RetryState,\n  options: JitterOptions\n): number {\n  return applyMinimumThreshold(\n    delayFn(state) + jitter(options.min, options.max)\n  );\n}\n\nfunction applyMinimumThreshold(delay: number): number {\n  return delay < 0 ? 0 : delay;\n}\n\nfunction jitter(min: number, max: number): number {\n  return Math.floor(Math.random() * (max - min + 1)) + min;\n}\n","import { DelayFn } from '../types';\n\n/**\n * Wait for a linearly increasing amount of time before retrying\n * @param delay The amount of time in milliseconds to increase the delay by\n * @param fastFirst Whether to immediately retry for the first attempt\n */\nexport function linearDelay(delay: number, fastFirst = false): DelayFn {\n  if (delay <= 0) {\n    throw new Error('Delay must be greater than 0');\n  }\n\n  if (fastFirst) {\n    return (state) => (state.attempt === 1 ? 0 : delay * (state.attempt - 1));\n  }\n\n  return (state) => delay * state.attempt;\n}\n","import { ErrorPredicate } from '../types';\n\n/**\n * Any error, even if it's not an `HttpErrorResponse` should be handled.\n */\nexport function anyError(): ErrorPredicate {\n  return () => true;\n}\n","import { HttpErrorResponse } from '@angular/common/http';\nimport { ErrorPredicate } from '../types';\n\n/**\n * Any HttpErrorResponse, should be handled. Other errors are ignored.\n */\nexport function anyHttpError(): ErrorPredicate {\n  return function (error) {\n    return isHttpErrorResponse(error);\n  };\n}\n\nfunction isHttpErrorResponse(error: unknown): error is HttpErrorResponse {\n  return error instanceof HttpErrorResponse;\n}\n","import { HttpStatusCode } from '@angular/common/http';\nimport { ErrorPredicate } from '../types';\n\n/**\n * Range options for the `statusCodes` predicate.\n */\nexport type StatusCodeRange = {\n  /** The minimum status code to match */\n  min?: number;\n  /** The maximum status code to match */\n  max?: number;\n};\n\nfunction isStatusCodeRange(\n  value: InternalStatusCodesErrorPredicateOptions\n): value is StatusCodeRange {\n  return (\n    typeof value === 'object' &&\n    value !== null &&\n    ('min' in value || 'max' in value)\n  );\n}\n\ntype InternalStatusCodesErrorPredicateOptions = Set<number> | StatusCodeRange;\n\n/**\n * Options for the `statusCodes` predicate.\n */\nexport type StatusCodesErrorPredicateOptions =\n  | InternalStatusCodesErrorPredicateOptions\n  | number\n  | number[];\n\n/**\n * Set of status codes that are generally safe to retry by default.\n */\nexport const STANDARD_RETRYABLE_STATUS_CODES = [\n  HttpStatusCode.RequestTimeout,\n  HttpStatusCode.BadGateway,\n  HttpStatusCode.ServiceUnavailable,\n  HttpStatusCode.GatewayTimeout,\n]; // TODO make const\n\n/**\n * Match any error with a status code matching the given options.\n * @param codes The status code(s) to match.\n *\n * @example\n *  createHttpRetryInterceptorFn({\n *    ...\n *    shouldHandleError: withStatusCodes(500),\n * })\n *\n * @example\n *  createHttpRetryInterceptorFn({\n *    ...\n *    shouldHandleError: withStatusCodes(500),\n *    ...\n *  })\n *\n * @example\n *  createHttpRetryInterceptorFn({\n *    ...\n *    shouldHandleError: withStatusCodes([500, 501]),\n *    ...\n *  })\n *\n * @example\n *  createHttpRetryInterceptorFn({\n *    ...\n *    shouldHandleError: withStatusCodes({ min: 500, max: 599 }),\n *    ...\n *  })\n */\nexport function withStatusCodes(\n  codes: StatusCodesErrorPredicateOptions\n): ErrorPredicate {\n  const internalOptions = getInternalOptions(codes);\n\n  if (internalOptions instanceof Set) {\n    return (err) => {\n      return hasStatus(err) && internalOptions.has(err.status);\n    };\n  }\n\n  if (isStatusCodeRange(internalOptions)) {\n    return (err) => {\n      return (\n        hasStatus(err) &&\n        (internalOptions.min === undefined ||\n          err.status >= internalOptions.min) &&\n        (internalOptions.max === undefined || err.status <= internalOptions.max)\n      );\n    };\n  }\n\n  return () => {\n    return false;\n  };\n}\n\nfunction getInternalOptions(\n  options: StatusCodesErrorPredicateOptions\n): InternalStatusCodesErrorPredicateOptions {\n  if (typeof options === 'number') {\n    return new Set([options]);\n  }\n\n  if (Array.isArray(options)) {\n    return new Set(options);\n  }\n\n  return options;\n}\n\nfunction hasStatus(err: unknown): err is { status: number } {\n  return (\n    err !== null &&\n    err !== undefined &&\n    typeof err === 'object' &&\n    'status' in err &&\n    typeof err.status === 'number'\n  );\n}\n","import { RetryState } from './types';\n\nexport function createRetryState(): RetryState {\n  return {\n    attempt: 0,\n    startTime: Date.now(),\n  };\n}\n\nexport function getUpdatedRetryState(state: RetryState): RetryState {\n  return {\n    attempt: state.attempt + 1,\n    startTime: state.startTime,\n  };\n}\n\nexport function totalDelay(state: RetryState): number {\n  return Date.now() - state.startTime;\n}\n","import {\n  HttpEvent,\n  HttpEventType,\n  HttpHandlerFn,\n  HttpRequest,\n} from '@angular/common/http';\nimport { Observable, Subject, catchError, switchMap, tap, timer } from 'rxjs';\nimport { RetryInterceptorEvent, RetryPolicy } from '../types';\nimport { getUpdatedRetryState } from './retry-state';\nimport { RetryState } from './types';\n\nexport function retryRequestWithStrategy(\n  req: HttpRequest<unknown>,\n  next: HttpHandlerFn,\n  strategy: RetryPolicy,\n  state: RetryState,\n  events$: Subject<RetryInterceptorEvent>\n): Observable<HttpEvent<unknown>> {\n  function retry(\n    sourceFn: () => Observable<HttpEvent<unknown>>\n  ): Observable<HttpEvent<unknown>> {\n    return sourceFn().pipe(\n      catchError((err: unknown) => {\n        if (!strategy.shouldHandleError(err)) {\n          events$.next({\n            type: 'UnhandledError',\n            req,\n            err,\n            attempt: state.attempt + 1,\n            totalTime: Date.now() - state.startTime,\n          });\n          throw err;\n        }\n\n        state = getUpdatedRetryState(state);\n\n        if (\n          strategy.maxRetryAttempts &&\n          state.attempt > strategy.maxRetryAttempts\n        ) {\n          events$.next({\n            type: 'FailedMaxAttemptsExceeded',\n            req,\n            err,\n            attempt: state.attempt,\n            totalTime: Date.now() - state.startTime,\n          });\n          throw err;\n        } else {\n          events$.next({\n            type: 'FailedTryingAgain',\n            req,\n            err,\n            attempt: state.attempt,\n            totalTime: Date.now() - state.startTime,\n          });\n        }\n\n        return timer(strategy.delay(state)).pipe(\n          switchMap(() => retry(sourceFn))\n        );\n      })\n    );\n  }\n\n  return retry(() => next(req)).pipe(\n    tap((httpEvent) => sendSuccessEvents(req, httpEvent, state, events$))\n  );\n}\n\nfunction sendSuccessEvents(\n  req: HttpRequest<unknown>,\n  event: HttpEvent<unknown>,\n  state: RetryState,\n  events$: Subject<RetryInterceptorEvent>\n) {\n  if (event.type !== HttpEventType.Sent) {\n    events$.next({\n      type: 'Succeeded',\n      req,\n      res: event,\n      attempt: state.attempt + 1,\n      totalTime: Date.now() - state.startTime,\n    });\n  }\n}\n","import { HttpInterceptorFn } from '@angular/common/http';\nimport { catchError, Subject, throwError, timeout } from 'rxjs';\nimport { createRetryState, retryRequestWithStrategy } from './internal';\nimport {\n  RetryInterceptorEvent,\n  RetryInterceptorOptions,\n  RetryPolicy,\n} from './types';\n\n/**\n * Creates an HttpInterceptorFn that will retry requests based on the provided\n * strategy.\n *\n * @param policy The retry strategy to use\n * @param options Additional options for the interceptor\n *\n * @example\n *  createHttpRetryInterceptorFn({\n *    shouldHandleRequest: matchPattern({method: 'GET' }),\n *    shouldHandleError: (err) => err instanceof HttpErrorResponse && err.status === 500,\n *\n */\nexport function createHttpRetryInterceptorFn(\n  policy: RetryPolicy,\n  options: RetryInterceptorOptions = {}\n): HttpInterceptorFn {\n  validateRetryStrategy(policy);\n\n  const events$ = options.events$ || new Subject<RetryInterceptorEvent>();\n\n  return (req, next) => {\n    if (!policy.shouldHandleRequest(req)) {\n      options.events$?.next({ type: 'RequestIgnored', req });\n\n      return next(req).pipe(\n        catchError((err: unknown) => {\n          options.events$?.next({ type: 'IgnoredRequestFailed', req, err });\n\n          return throwError(() => err);\n        })\n      );\n    }\n\n    const state = createRetryState();\n\n    const retryRequest$ = retryRequestWithStrategy(\n      req,\n      next,\n      policy,\n      state,\n      events$\n    );\n\n    return policy.maxTotalDelay\n      ? retryRequest$.pipe(\n          timeout({\n            each: policy.maxTotalDelay,\n            with: () =>\n              throwError(() => {\n                events$.next({\n                  type: 'MaxDelayExceeded',\n                  req,\n                  attempt: state.attempt + 1,\n                  totalTime: Date.now() - state.startTime,\n                });\n\n                return new Error('Max total delay exceeded');\n              }),\n          })\n        )\n      : retryRequest$;\n  };\n}\n\nexport function validateRetryStrategy(strategy: RetryPolicy): void {\n  if (strategy.maxRetryAttempts && strategy.maxRetryAttempts < 1) {\n    throw new Error('maxRetryAttempts must be greater than or equal to 1');\n  }\n\n  if (strategy.maxTotalDelay && strategy.maxTotalDelay < 1) {\n    throw new Error('maxTotalDelay must be greater than or equal to 1');\n  }\n}\n","import {\n  HttpHandler,\n  HttpInterceptor,\n  HttpInterceptorFn,\n  HttpRequest,\n} from '@angular/common/http';\nimport { Observable, Subject } from 'rxjs';\nimport { createHttpRetryInterceptorFn } from './http-retry-interceptor.fn';\nimport { RetryInterceptorEvent, RetryPolicy } from './types';\n\nexport class HttpRetryInterceptorService implements HttpInterceptor {\n  private readonly interceptorFn: HttpInterceptorFn;\n  private readonly events$ = new Subject<RetryInterceptorEvent>();\n\n  private constructor(policy: RetryPolicy) {\n    this.interceptorFn = createHttpRetryInterceptorFn(policy, {\n      events$: this.events$,\n    });\n  }\n\n  public static create(policy: RetryPolicy) {\n    return new HttpRetryInterceptorService(policy);\n  }\n\n  public intercept(req: HttpRequest<unknown>, next: HttpHandler) {\n    return this.interceptorFn(req, next.handle);\n  }\n\n  public observeEvents(): Observable<RetryInterceptorEvent> {\n    return this.events$.asObservable();\n  }\n}\n","import { Predicate, PredicateBuilder } from './types';\n\n/**\n * Creates a predicate builder for combining multiple predicates.\n * @returns A predicate builder.\n */\nexport function createPredicateBuilder<T>(): PredicateBuilder<T> {\n  const predicates: Predicate<T>[] = [];\n\n  function build(): Predicate<T> {\n    if (predicates.length === 0) {\n      throw new Error('No predicates provided');\n    }\n\n    return (input) => {\n      return predicates.some((predicate) => predicate(input));\n    };\n  }\n\n  function handle(predicate: Predicate<T>): PredicateBuilder<T> {\n    predicates.push(predicate);\n\n    return {\n      build,\n      handle,\n    };\n  }\n\n  return { build, handle };\n}\n","import {\n  HttpContext,\n  HttpContextToken,\n  HttpRequest,\n} from '@angular/common/http';\nimport { v4 as uuid } from 'uuid';\nimport { RequestPredicate } from '../types';\n\nconst NGX_HTTP_RESILIENCE_RETRY_ID = new HttpContextToken<Set<string>>(\n  () => new Set()\n);\n\nexport interface ContextPredicate {\n  /**\n   * Returns a cloned request that is marked as handled by this predicate\n   *\n   * @example\n   * const contextPredicate = createContextPredicate();\n   * httpClient.request(contextPredicate.getMarkedRequest(new HttpRequest(...)).pipe(...)\n   *\n   */\n  getMarkedRequest: (req: HttpRequest<unknown>) => HttpRequest<unknown>;\n  /**\n   * Returns a context that is marked as handled by this predicate\n   *\n   * @example\n   * const contextPredicate = createContextPredicate();\n   * httpClient.get(..., { context: contextPredicate.getContext() })\n   */\n  getContext: () => HttpContext;\n  /**\n   * Marks a context that it is handled by this predicate\n   *\n   * @example\n   * const contextPredicate = createContextPredicate();\n   * const context = new HttpContext();\n   * contextPredicate.markContext(context);\n   * httpClient.get(..., { context })\n   */\n  markContext: (context: HttpContext) => void;\n  /** Returns true if request is marked as handled by this predicate */\n  requestPredicate: RequestPredicate;\n}\n\n/**\n * Creates a predicate that marks requests as handled by this predicate\n *\n * @example\n *  const contextPredicate = createContextPredicate();\n *\n *  createHttpRetryInterceptorFn({\n *    ...\n *    shouldHandleRequest: contextPredicate.requestPredicate,\n *    ...\n *  })\n *\n *  httpClient.request(contextPredicate.getMarkedRequest(new HttpRequest(...)).pipe(...)\n *\n */\nexport function createContextPredicate(): ContextPredicate {\n  const id = uuid();\n\n  const getContext: () => HttpContext = () => {\n    return new HttpContext().set(NGX_HTTP_RESILIENCE_RETRY_ID, new Set([id]));\n  };\n\n  const requestPredicate: RequestPredicate = (req) => {\n    return req.context.get(NGX_HTTP_RESILIENCE_RETRY_ID).has(id);\n  };\n\n  return {\n    getMarkedRequest: (req) => markRequest(req, id),\n    getContext,\n    markContext: (context) => markContext(context, id),\n\n    requestPredicate,\n  };\n}\n\nfunction markRequest(\n  req: HttpRequest<unknown>,\n  id: string\n): HttpRequest<unknown> {\n  const newReq = req.clone();\n\n  markContext(newReq.context, id);\n\n  return newReq;\n}\n\nfunction markContext(context: HttpContext, id: string): void {\n  if (context.has(NGX_HTTP_RESILIENCE_RETRY_ID)) {\n    context.get(NGX_HTTP_RESILIENCE_RETRY_ID).add(id);\n  } else {\n    context.set(NGX_HTTP_RESILIENCE_RETRY_ID, new Set([id]));\n  }\n}\n","import { BehaviorSubject, Observable } from 'rxjs';\nimport { RequestPredicate } from '../types';\n\nexport interface DisableablePredicate {\n  /** Returns the predicate wrapped by this disableable predicate */\n  requestPredicate: RequestPredicate;\n  /** Disables the predicate */\n  disable: () => void;\n  /** Enables the predicate */\n  enable: () => void;\n  /** Sets the disabled state of the predicate */\n  setDisabled: (disabled: boolean) => void;\n  /** Toggles the disabled state of the predicate */\n  toggleDisabled: () => void;\n  /** Returns an observable that emits the disabled state of the predicate */\n  observeDisabledState: () => Observable<boolean>;\n}\n\n/**\n * Wraps a request predicate and allows it to be disabled\n * @param predicate The predicate to wrap\n * @param initiallyDisabled The initial disabled state of the predicate, defaults to false (enabled)\n *\n * @example\n * const disableablePredicate = createDisableablePredicate(matchPattern({method: 'GET' }));\n * createHttpRetryInterceptorFn({\n *   shouldHandleRequest: disableablePredicate.requestPredicate,\n *   ...\n * })\n */\nexport function createDisableablePredicate(\n  predicate: RequestPredicate,\n  initiallyDisabled = false\n): DisableablePredicate {\n  const disabled$ = new BehaviorSubject<boolean>(initiallyDisabled);\n\n  return {\n    requestPredicate: (req) => !disabled$.value && predicate(req),\n    disable: () => disabled$.next(true),\n    enable: () => disabled$.next(false),\n    setDisabled: (disabled: boolean) => disabled$.next(disabled),\n    toggleDisabled: () => disabled$.next(!disabled$.value),\n    observeDisabledState: () => disabled$.asObservable(),\n  };\n}\n","import { RequestPredicate } from '../types';\n\ninterface InternalRequestPattern {\n  method?: Set<string> | RegExp;\n  url?: string | RegExp;\n}\n\nexport interface RequestPattern {\n  /** HTTP methods to match. */\n  method?: InternalRequestPattern['method'] | string | string[];\n  /** URL to match. */\n  url?: InternalRequestPattern['url'];\n}\n\n/**\n * Creates a predicate that matches requests based on the given pattern.\n * @param pattern The pattern to match.\n *\n * @example\n *  createHttpRetryInterceptorFn({\n *    ...\n *    shouldHandleRequest: matchPattern({method: 'GET' }),\n *    ...\n *  })\n *\n *  @example\n *   createHttpRetryInterceptorFn({\n *     ...\n *     shouldHandleRequest: matchPattern({method: ['GET', 'POST'] }),\n *     ...\n *   })\n *\n *  @example\n *   createHttpRetryInterceptorFn({\n *     ...\n *     shouldHandleRequest: matchPattern({method: /GET|POST/ }),\n *     ...\n *   })\n *\n * @example\n *  createHttpRetryInterceptorFn({\n *    ...\n *    shouldHandleRequest: matchPattern({url: 'https://example.com' }),\n *    ...\n *  })\n *\n * @example\n *  createHttpRetryInterceptorFn({\n *    ...\n *    shouldHandleRequest: matchPattern({url: /example.com/ }),\n *    ...\n *  })\n *\n * @example\n *  createHttpRetryInterceptorFn({\n *    ...\n *    shouldHandleRequest: matchPattern({method: 'GET', url: 'https://example.com' }),\n *    ...\n *  })\n */\nexport function matchPattern(pattern: RequestPattern): RequestPredicate {\n  const internalPattern = getInternalPattern(pattern);\n\n  return (req) => {\n    if (internalPattern.method && internalPattern.url) {\n      return (\n        isMatchingMethod(req.method, internalPattern.method) &&\n        isMatchingUrl(req.url, internalPattern.url)\n      );\n    }\n\n    if (internalPattern.method) {\n      return isMatchingMethod(req.method, internalPattern.method);\n    }\n\n    if (internalPattern.url) {\n      return isMatchingUrl(req.url, internalPattern.url);\n    }\n\n    return false;\n  };\n}\n\nfunction getInternalPattern(pattern: RequestPattern): InternalRequestPattern {\n  return {\n    method: getInternalMethodPattern(pattern.method),\n    url: pattern.url,\n  };\n}\n\nfunction getInternalMethodPattern(\n  pattern: RequestPattern['method']\n): InternalRequestPattern['method'] {\n  if (typeof pattern === 'string') {\n    return new Set([pattern]);\n  }\n\n  if (Array.isArray(pattern)) {\n    return new Set(pattern);\n  }\n\n  return pattern;\n}\n\nfunction isMatchingUrl(\n  url: string,\n  pattern: InternalRequestPattern['url']\n): boolean {\n  if (typeof pattern === 'string') {\n    return url === pattern;\n  }\n\n  if (pattern instanceof RegExp) {\n    return pattern.test(url);\n  }\n\n  return false;\n}\n\nfunction isMatchingMethod(\n  method: string,\n  pattern: InternalRequestPattern['method']\n): boolean {\n  if (pattern instanceof RegExp) {\n    return pattern.test(method);\n  }\n\n  if (pattern instanceof Set) {\n    return pattern.has(method);\n  }\n\n  return false;\n}\n","import { HttpRequest } from '@angular/common/http';\nimport { Subject } from 'rxjs';\nimport { RetryState } from './internal';\n\nexport type Predicate<T> = (input: T) => boolean;\n\nexport type RequestPredicate = Predicate<HttpRequest<unknown>>;\nexport type ErrorPredicate = Predicate<unknown>;\nexport type DelayFn = (state: RetryState) => number;\n\nexport interface RetryPolicy {\n  /** Predicate for matching requests to retry */\n  shouldHandleRequest: RequestPredicate;\n  /** Predicate for matching errors to retry */\n  shouldHandleError: ErrorPredicate;\n  /** The delay function to use for calculating the delay between retries */\n  delay: DelayFn;\n  /** The maximum number of retry attempts */\n  maxRetryAttempts?: number;\n  /** The maximum total delay in milliseconds */\n  maxTotalDelay?: number;\n}\n\nexport type RetryInterceptorRequestType =\n  | 'RequestIgnored'\n  | 'IgnoredRequestFailed'\n  | 'UnhandledError'\n  | 'FailedTryingAgain'\n  | 'FailedMaxAttemptsExceeded'\n  | 'MaxDelayExceeded'\n  | 'Succeeded';\nexport const RetryInterceptorRequestTypes = {\n  RequestIgnored: 'RequestIgnored',\n  IgnoredRequestFailed: 'IgnoredRequestFailed',\n  UnhandledError: 'UnhandledError',\n  FailedTryingAgain: 'FailedTryingAgain',\n  FailedMaxAttemptsExceeded: 'FailedMaxAttemptsExceeded',\n  MaxDelayExceeded: 'MaxDelayExceeded',\n  Succeeded: 'Succeeded',\n} as const satisfies { [key in RetryInterceptorRequestType]: key };\n\ninterface BaseEvent<T extends RetryInterceptorRequestType> {\n  req: HttpRequest<unknown>;\n  type: T;\n}\n\ninterface ErrorEvent {\n  err: unknown;\n}\n\ninterface MetricEvent {\n  /** The number of the current attempt\n   * 1st attempt is 1, 2nd attempt is 2, etc.\n   */\n  attempt: number;\n  /** The time in milliseconds since the request was received */\n  totalTime: number;\n}\n\nexport type RetryInterceptorRequestIgnoredEvent = BaseEvent<'RequestIgnored'>;\n\nexport type RetryInterceptorIgnoredRequestFailed =\n  BaseEvent<'IgnoredRequestFailed'> & ErrorEvent;\n\nexport type RetryInterceptorUnhandledErrorEvent = BaseEvent<'UnhandledError'> &\n  ErrorEvent &\n  MetricEvent;\n\nexport type RetryInterceptorRequestFailedTryingAgainEvent =\n  BaseEvent<'FailedTryingAgain'> & ErrorEvent & MetricEvent;\n\nexport type RetryInterceptorRequestFailedMaxAttemptsExceededEvent =\n  BaseEvent<'FailedMaxAttemptsExceeded'> & ErrorEvent & MetricEvent;\n\nexport type RetryInterceptorRequestMaxDelayExceededEvent =\n  BaseEvent<'MaxDelayExceeded'> & MetricEvent;\n\nexport type RetryInterceptorRequestSucceededEvent = BaseEvent<'Succeeded'> & {\n  res: unknown;\n} & MetricEvent;\n\nexport type RetryInterceptorEvent =\n  | RetryInterceptorRequestIgnoredEvent\n  | RetryInterceptorIgnoredRequestFailed\n  | RetryInterceptorUnhandledErrorEvent\n  | RetryInterceptorRequestFailedTryingAgainEvent\n  | RetryInterceptorRequestFailedMaxAttemptsExceededEvent\n  | RetryInterceptorRequestMaxDelayExceededEvent\n  | RetryInterceptorRequestSucceededEvent;\n\nexport interface RetryInterceptorOptions {\n  /**\n   * An optional Subject for emitting retry events\n   */\n  events$?: Subject<RetryInterceptorEvent>;\n}\n\nexport interface PredicateBuilder<T> {\n  build: () => Predicate<T>;\n  handle: (predicate: Predicate<T>) => PredicateBuilder<T>;\n}\n","import { HttpInterceptorFn } from '@angular/common/http';\nimport { Subject, tap } from 'rxjs';\nimport {\n  HttpVisibilityInterceptorError,\n  HttpVisibilityInterceptorHttpEvent,\n} from './types';\n\nexport interface CreateHttpVisibilityInterceptorFnConfig {\n  httpEvents$: Subject<HttpVisibilityInterceptorHttpEvent<unknown>>;\n  errors$: Subject<HttpVisibilityInterceptorError>;\n}\n\nexport function createHttpVisibilityInterceptorFn({\n  httpEvents$,\n  errors$,\n}: CreateHttpVisibilityInterceptorFnConfig): HttpInterceptorFn {\n  return (req, next) => {\n    const start = Date.now();\n\n    return next(req).pipe(\n      tap({\n        next: (event) =>\n          httpEvents$.next({ event, req, duration: Date.now() - start }),\n        error: (err: unknown) =>\n          errors$.next({ err, req, duration: Date.now() - start }),\n      })\n    );\n  };\n}\n","import {\n  HttpEvent,\n  HttpHandler,\n  HttpInterceptor,\n  HttpInterceptorFn,\n  HttpRequest,\n} from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable, Subject } from 'rxjs';\nimport { createHttpVisibilityInterceptorFn } from './http-visibility-interceptor.fn';\nimport {\n  HttpVisibilityInterceptorError,\n  HttpVisibilityInterceptorHttpEvent,\n} from './types';\n\n@Injectable()\nexport class HttpVisibilityInterceptorService implements HttpInterceptor {\n  private readonly _httpEvents$ = new Subject<\n    HttpVisibilityInterceptorHttpEvent<unknown>\n  >();\n  private readonly _errors$ = new Subject<HttpVisibilityInterceptorError>();\n\n  private readonly interceptorFn: HttpInterceptorFn;\n\n  constructor() {\n    this.interceptorFn = createHttpVisibilityInterceptorFn({\n      httpEvents$: this._httpEvents$,\n      errors$: this._errors$,\n    });\n  }\n\n  intercept(\n    req: HttpRequest<unknown>,\n    next: HttpHandler\n  ): Observable<HttpEvent<unknown>> {\n    return this.interceptorFn(req, next.handle);\n  }\n\n  public observeHttpEvents(): Observable<\n    HttpVisibilityInterceptorHttpEvent<unknown>\n  > {\n    return this._httpEvents$.asObservable();\n  }\n\n  public observeErrors(): Observable<HttpVisibilityInterceptorError> {\n    return this._errors$.asObservable();\n  }\n}\n","import { HttpEvent, HttpRequest } from '@angular/common/http';\n\nexport interface HttpVisibilityInterceptorHttpEvent<T> {\n  event: HttpEvent<T>;\n  req: HttpRequest<T>;\n  /**\n   * Time in milliseconds since interceptor received the request.\n   */\n  duration: number;\n}\nexport function isHttpVisibilityInterceptorHttpEvent<T>(\n  event: HttpVisibilityInterceptorHttpEvent<T> | HttpVisibilityInterceptorError\n): event is HttpVisibilityInterceptorHttpEvent<T> {\n  return 'event' in event;\n}\n\nexport interface HttpVisibilityInterceptorError {\n  err: unknown;\n  req: HttpRequest<unknown>;\n  /**\n   * Time in milliseconds since interceptor received the request.\n   */\n  duration: number;\n}\nexport function isHttpVisibilityInterceptorError(\n  event:\n    | HttpVisibilityInterceptorHttpEvent<unknown>\n    | HttpVisibilityInterceptorError\n): event is HttpVisibilityInterceptorError {\n  return 'err' in event;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid"],"mappings":";;;;;;AAEA;;;;AAIG;SACa,aAAa,CAAC,KAAa,EAAE,SAAS,GAAG,KAAK,EAAA;IAC5D,IAAI,KAAK,GAAG,CAAC,EAAE;AACb,QAAA,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;AAC7D,KAAA;AAED,IAAA,IAAI,SAAS,EAAE;QACb,OAAO,CAAC,KAAK,MAAM,KAAK,CAAC,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;AACrD,KAAA;AAED,IAAA,OAAO,MAAM,KAAK,CAAC;AACrB;;ACfA;;;;;AAKG;AACG,SAAU,gBAAgB,CAC9B,YAAoB,EACpB,MAAM,GAAG,CAAC,EACV,SAAS,GAAG,KAAK,EAAA;IAEjB,IAAI,YAAY,IAAI,CAAC,EAAE;AACrB,QAAA,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;AACzD,KAAA;IAED,IAAI,MAAM,IAAI,CAAC,EAAE;AACf,QAAA,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;AAClD,KAAA;AAED,IAAA,IAAI,SAAS,EAAE;AACb,QAAA,OAAO,CAAC,KAAK,KACX,KAAK,CAAC,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,YAAY,GAAG,MAAM,KAAK,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;AAC1E,KAAA;AAED,IAAA,OAAO,CAAC,KAAK,KAAK,YAAY,GAAG,MAAM,KAAK,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;AACjE;;ACnBA;;;;;;AAMG;AAEG,SAAU,SAAS,CACvB,OAAgB,EAChB,OAAsB,EACtB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