Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

  • Append a timestamp to a log file as a newline.

    Parameters

    • file: FileConfig

      log file path and string to append

    Returns DataResponse

    Success or Failure Message

  • concurrentPromises(args: any[][], func: (...args: any[]) => Promise<any>, limit?: number): Promise<any[]>
  • Run all concurrent promises on an array of data. Set a limit to determine how many can run at the same time.

    Parameters

    • args: any[][]

      array of arrays containing params for each run

    • func: (...args: any[]) => Promise<any>

      function to run concurrently that returns a promise

        • (...args: any[]): Promise<any>
        • Parameters

          • Rest ...args: any[]

          Returns Promise<any>

    • limit: number = 10

      how many concurrent promises should be running

    Returns Promise<any[]>

    array containing results

  • convertSinceToTimestamp(since?: string): number
  • Parameters

    • since: string = ''

    Returns number

  • Asynchronously create files at their specified paths. Response data is returned once all files have been created, or if there is an error.

    Parameters

    • files: FileConfig[]

      list of files (path and data) to be created

    • lgr: Function = ...

      logger function to log activity

    Returns Promise<FileResponse>

    Success or Failure Message and Files

  • createIdentityAxiosClient(did: string, method: string, signature: string): Promise<DataResponse>
  • Create an Axios Client to pair with Identity Propogation and Deletion Commands.

    Parameters

    • did: string

      did string

    • method: string

      delete or put method for axios client

    • signature: string

      jws of identity.json for identity creation/deletion

    Returns Promise<DataResponse>

    Success or Failure Message from API endpoint

  • Asynchronously delete files at their specified paths. Response data is returned once all files have been deleted, or if there is an error.

    Parameters

    • files: FileConfig[]

      list of files (path) to be deleted

    • lgr: Function = ...

      logger function to log activity

    Returns Promise<FileResponse>

    Success or Failure Message and list of deleted files

  • Asynchronously delete all files in a specified directory that match a specified regular expression. This uses regex.test() to determine if it should be deleted. This does not search for files recursively.

    Parameters

    • regex: RegExp

      regular expression matching files you want deleted

    • dir: FileConfig

      root directory that the files are all in

    • lgr: Function = ...

      logger function to log activity

    Returns Promise<FileResponse>

    outcome of request and all files deleted

  • generateLogger(path: string): Function
  • Generate a logger to pass a string to a file. Empty strings will return as a line divider.

    Parameters

    • path: string

      absolute path to log file

    Returns Function

    logger function

  • Get the redirect url to determine a final destination of a url string. If a proxyConfig is specified and the first attempt times out a second attempt will be made using the proxy.

    Parameters

    • url: string

      url that will redirect

    • proxyConfig: ProxyConfig = false

      config object for proxy service to use

    • forceProxy: boolean = false

      force the proxy to be used the first time instead of on the second attempt

    Returns Promise<DataResponse>

    success of attempt and redirect url

  • handleRuntypeFail(error: any): string
  • Handles RunType Failures and returns a human readable message. If PSQR_ENV is set to debug, this will output a stack trace.

    Parameters

    • error: any

      error object to manage

    Returns string

    proper error message to use

  • Asynchronously retrieve content of files at their specified paths. Response data is returned once all files have been retrieved, or if there is an error.

    Parameters

    • files: FileConfig[]

      list of files (path) to get the contents of

    Returns Promise<FileResponse>

    Success or Failure Message and all file data

  • Asynchronously retrieve all files in a specified directory that match a specified regular expression. This uses regex.test() to determine if it should be included. This does not search for files recursively.

    Parameters

    • regex: RegExp

      regular expression matching files you want included

    • dir: FileConfig

      root directory that the files are all in

    Returns Promise<FileResponse>

    outcome of request and all file data