Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace Utils

Index

Variables

print: { clear: any; commit: any } = ...

Type declaration

    • (lines?: string | string[]): { (lines?: string | string[]): ...; clear(): ...; commit(): ...; }
    • Parameters

      • lines: string | string[] = ""

      Returns { (lines?: string | string[]): ...; clear(): ...; commit(): ...; }

  • clear:function
    • clear(): { (lines?: string | string[]): ...; clear(): ...; commit(): ...; }
    • Returns { (lines?: string | string[]): ...; clear(): ...; commit(): ...; }

  • commit:function
    • commit(): { (lines?: string | string[]): ...; clear(): ...; commit(): ...; }
    • Returns { (lines?: string | string[]): ...; clear(): ...; commit(): ...; }

Functions

  • ask(question: string): Promise<string>
  • Parameters

    • question: string

    Returns Promise<string>

  • assert(condition: any, error?: string | ErrorConstructor, ctor?: ErrorConstructor): asserts condition
  • Parameters

    • condition: any
    • Optional error: string | ErrorConstructor
    • ctor: ErrorConstructor = Error

    Returns asserts condition

  • createDecompressor(res: Response<unknown>): Transform
  • Parameters

    • res: Response<unknown>

    Returns Transform

  • detectTokenUrl(baseUrl: string): Promise<string>
  • Given a FHIR server baseURL, looks up it's .well-known/smart-configuration and/or it's CapabilityStatement (whichever arrives first) and resolves with the token endpoint as defined there.

    Parameters

    • baseUrl: string

      The base URL of the FHIR server

    Returns Promise<string>

  • exit(arg: any, details?: Record<string, any>): void
  • Parameters

    • arg: any
    • Optional details: Record<string, any>

    Returns void

  • fhirInstant(input: any): string
  • Parameters

    • input: any

    Returns string

  • formatDuration(ms: number): string
  • Parameters

    • ms: number

    Returns string

  • generateProgress(pct?: number, length?: number): string
  • Generates a progress indicator

    Parameters

    • pct: number = 0

      The percentage

    • length: number = 40

    Returns string

  • Given a token response, computes and returns the expiresAt timestamp. Note that this should only be used immediately after an access token is received, otherwise the computed timestamp will be incorrect.

    Parameters

    Returns number

  • getCapabilityStatement(baseUrl: string, noCache?: boolean): Promise<Response<fhir4.CapabilityStatement>>
  • Given a baseUrl fetches the CapabilityStatement. Note that this request is cached by default!

    Parameters

    • baseUrl: string

      The server base url

    • noCache: boolean = false

      Pass true to disable caching

    Returns Promise<Response<fhir4.CapabilityStatement>>

  • getTokenEndpointFromCapabilityStatement(baseUrl: string): Promise<string>
  • Parameters

    • baseUrl: string

    Returns Promise<string>

  • getTokenEndpointFromWellKnownSmartConfig(baseUrl: string): Promise<string>
  • Parameters

    • baseUrl: string

    Returns Promise<string>

  • getWellKnownSmartConfig(baseUrl: string, noCache?: boolean): Promise<Response<JsonObject>>
  • Given a baseUrl fetches a /.well-known/smart-configuration statement from the root of the baseUrl. Note that this request is cached by default!

    Parameters

    • baseUrl: string

      The server base url

    • noCache: boolean = false

      Pass true to disable caching

    Returns Promise<Response<JsonObject>>

  • humanFileSize(fileSizeInBytes?: number, useBits?: boolean): string
  • Returns the byte size with units

    Parameters

    • fileSizeInBytes: number = 0

      The size to format

    • useBits: boolean = false

      If true, will divide by 1000 instead of 1024

    Returns string

  • wait(ms: number, signal?: AbortSignal): Promise<void>
  • Simple utility for waiting. Returns a promise that will resolve after the given number of milliseconds. The timer can be aborted if an AbortSignal is passed as second argument.

    Parameters

    • ms: number

      Milliseconds to wait

    • Optional signal: AbortSignal

      Pass an AbortSignal if you want to abort the waiting

    Returns Promise<void>

Generated using TypeDoc