Skip to content

Instantly share code, notes, and snippets.

@samnung
Created November 10, 2021 20:17
Show Gist options
  • Save samnung/0df6965594395f142b76db86b449f9df to your computer and use it in GitHub Desktop.
Save samnung/0df6965594395f142b76db86b449f9df to your computer and use it in GitHub Desktop.
TypeScript Definition file for hapi-sentry package
declare module 'hapi-sentry' {
import { Plugin } from '@hapi/hapi'
export interface Options {
/**
* uri to be used as base for captured urls
*/
baseUri?: string
scope?: {
/**
* An array of tags to be sent with every event
*/
tags?: {
/**
* The name of a tag
*/
name: string
/**
* The value of a tag
*/
value: any
}
/**
* An object of arbitrary format to be sent as extra data on every event
*/
extra: Record<string, unknown>
}
/**
* A @sentry/node instance which was already initialized (using Sentry.init) OR an options object to be passed
* to an internally initialized @sentry/node (client.dsn is only required in the latter case)
* @required
*/
client: {
/**
* The Dsn used to connect to Sentry and identify the project. If false, the SDK will not send any data to
* Sentry.
* @required
*/
dsn: string | false
/**
* Turn debug mode on/off
*/
debug?: boolean
/**
* Tag events with the version/release identifier of your application
*/
release?: string
/**
* The current environment of your application (e.g. 'production')
*/
environment?: string
/**
* A global sample rate to apply to all events (0 - 1)
*/
sampleRate?: number
/**
* The maximum number of breadcrumbs sent with events. Default: 100
*/
maxBreadcrumbs?: number
/**
* Attaches stacktraces to pure capture message / log integrations
*/
attachStacktrace?: any
/**
* If this flag is enabled, certain personally identifiable information is added by active integrations
*/
sendDefaultPii?: boolean
/**
* Overwrite the server name (device name)
*/
serverName?: string
/**
* A callback invoked during event submission, allowing to optionally modify the event before it is sent to
* Sentry
*/
beforeSend?: () => void
/**
* A callback invoked when adding a breadcrumb, allowing to optionally modify it before adding it to future
* events.
*/
beforeBreadcrumb?: () => void
}
/**
* Whether or not to track the user via the per-request scope. Default: true
*/
trackUser?: boolean
/**
* Handles capturing server.log and request.log events. Default: false
*/
catchLogErrors?: boolean | Array<string>
/**
* Whether or not to use Domains for seperating request processing. Only activate this feature, if you really
* need to seperate breadcrumbs, etc. of requests. It utilizes a deprecated Node.js feature which reduces performance. Default: false
*/
useDomainPerRequest?: boolean
}
const plugin: Plugin<Options>
export default plugin
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment