The pings database is an abstraction layer on top of the underlying storage.

Ping data is saved to the database in the following format:

{ "": { "path": string, "payload": PingPayload, "headers": PingHeaders, } }

Constructors

Properties

observer?: Observer
store: default

Methods

  • Attach an observer that reacts to the pings storage changes.

    Parameters

    • observer: Observer

      The new observer to attach.

    Returns void

  • Deletes a specific ping from the database.

    Parameters

    • identifier: string

      The identifier of the ping to delete.

    Returns void

  • Gets all pings from the pings database. Deletes any data in unexpected format that is found.

    Note

    The return value of this function can be turned into an object using Object.fromEntries.

    Returns PingArray

    List of all currently stored pings in ascending order by date.

  • Delete surplus of pings in the database by count or database size and return list of remaining pings. Pings are deleted from oldest to newest.

    The size of the database will be calculated (by accumulating each ping's size in bytes) and in case the quota is exceeded, outstanding pings get deleted.

    Note: deletion-request pings are never deleted.

    Parameters

    • maxCount: number = 250

      The max number of pings in the database. Default: 250.

    • maxSize: number = ...

      The max size of the database (in bytes). Default: 10MB.

    Returns PingArray

    List of all currently stored pings, in ascending order by date. deletion-request pings are always in the front of the list.

  • Records a new ping to the ping database.

    Parameters

    • path: string

      The path where this ping must be submitted to.

    • identifier: string

      The identifier under which to store the ping.

    • payload: JSONObject

      The payload of the ping to record.

    • Optional headers: Record<string, string>

      Optional headers to include on the final ping request.

    Returns void

  • Scans the database for pending pings and enqueues them.

    Important

    This function will also clear off pings in case the database is exceeding the ping or size quota.

    Returns void

Generated using TypeDoc