Options
All
  • Public
  • Public/Protected
  • All
Menu

Module core/pings/maker

Index

References

default

Renames and re-exports collectAndStorePing

Functions

buildClientInfoSection

  • Builds the client_info section of a ping.

    Parameters

    • ping: default

      The ping to build the client_info section for.

    Returns Promise<ClientInfo>

    The final client_info section in its payload format.

buildPingInfoSection

  • Builds the ping_info section of a ping.

    Parameters

    • ping: default

      The ping to build the ping_info section for.

    • Optional reason: string

      The reason for submitting this ping.

    Returns Promise<PingInfo>

    The final ping_info section in its payload format.

collectAndStorePing

  • collectAndStorePing(identifier: string, ping: default, reason?: string): Promise<void>
  • Collects and stores a ping on the pings database.

    This function will trigger the AfterPingCollection event. This event is triggered after logging the ping, which happens if logPings is set. We will log the payload before it suffers any change by plugins listening to this event.

    Parameters

    • identifier: string

      The pings UUID identifier.

    • ping: default

      The ping to submit.

    • Optional reason: string

      An optional reason code to include in the ping.

    Returns Promise<void>

    A promise that is resolved once collection and storing is done.

collectPing

  • Collects a snapshot for the given ping from storage and attach required meta information.

    Parameters

    • ping: default

      The ping to collect for.

    • Optional reason: string

      An optional reason code to include in the ping.

    Returns Promise<PingPayload | undefined>

    A fully assembled JSON representation of the ping payload. If there is no data stored for the ping, undefined is returned.

getPingHeaders

  • getPingHeaders(): Record<string, string> | undefined
  • Gathers all the headers to be included to the final ping request.

    This guarantees that if headers are disabled after the ping collection, ping submission will still contain the desired headers.

    The current headers gathered here are:

    • [X-Debug-ID]
    • [X-Source-Tags]

    Returns Record<string, string> | undefined

    An object containing all the headers and their values or undefined in case no custom headers were set.

getSequenceNumber

  • getSequenceNumber(ping: default): Promise<number>
  • Gets, and then increments, the sequence number for a given ping.

    Parameters

    • ping: default

      The ping for which we want to get the sequence number.

    Returns Promise<number>

    The current number (before incrementing).

getStartEndTimes

  • getStartEndTimes(ping: default): Promise<{ endTime: string; startTime: string }>
  • Gets the formatted start and end times for this ping and updates for the next ping.

    Parameters

    • ping: default

      The ping for which we want to get the times.

    Returns Promise<{ endTime: string; startTime: string }>

    An object containing start and times in their payload format.

makePath

  • makePath(identifier: string, ping: default): string
  • Build a pings submition path.

    Parameters

    • identifier: string

      The pings UUID identifier.

    • ping: default

      The ping to build a path for.

    Returns string

    The final submission path.

Generated using TypeDoc