Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions packages/browser/src/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ export interface BrowserOptions extends Options {
* This is the opposite of {@link Options.denyUrls}.
* By default, all errors will be sent.
*/
allowUrls?: Array<string | RegExp>;
allowUrls?: Array<string | RegExp> | undefined;

/**
* A pattern for error URLs which should not be sent to Sentry.
* To allow certain errors instead, use {@link Options.allowUrls}.
* By default, all errors will be sent.
*/
denyUrls?: Array<string | RegExp>;
denyUrls?: Array<string | RegExp> | undefined;

/** @deprecated use {@link Options.allowUrls} instead. */
whitelistUrls?: Array<string | RegExp>;
whitelistUrls?: Array<string | RegExp> | undefined;

/** @deprecated use {@link Options.denyUrls} instead. */
blacklistUrls?: Array<string | RegExp>;
blacklistUrls?: Array<string | RegExp> | undefined;
}

/**
Expand All @@ -39,13 +39,17 @@ export class BrowserBackend extends BaseBackend<BrowserOptions> {
/**
* @inheritDoc
*/
public eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event> {
public eventFromException(exception: unknown, hint?: EventHint | undefined): PromiseLike<Event> {
return eventFromException(this._options, exception, hint);
}
/**
* @inheritDoc
*/
public eventFromMessage(message: string, level: Severity = Severity.Info, hint?: EventHint): PromiseLike<Event> {
public eventFromMessage(
message: string,
level: Severity = Severity.Info,
hint?: EventHint | undefined,
): PromiseLike<Event> {
return eventFromMessage(this._options, message, level, hint);
}

Expand Down
8 changes: 6 additions & 2 deletions packages/core/src/basebackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,18 @@ export abstract class BaseBackend<O extends Options> implements Backend {
* @inheritDoc
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public eventFromException(_exception: any, _hint?: EventHint): PromiseLike<Event> {
public eventFromException(_exception: any, _hint?: EventHint | undefined): PromiseLike<Event> {
throw new SentryError('Backend has to implement `eventFromException` method');
}

/**
* @inheritDoc
*/
public eventFromMessage(_message: string, _level?: Severity, _hint?: EventHint): PromiseLike<Event> {
public eventFromMessage(
_message: string,
_level?: Severity | undefined,
_hint?: EventHint | undefined,
): PromiseLike<Event> {
throw new SentryError('Backend has to implement `eventFromMessage` method');
}

Expand Down
8 changes: 6 additions & 2 deletions packages/node/src/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class NodeBackend extends BaseBackend<NodeOptions> {
* @inheritDoc
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public eventFromException(exception: any, hint?: EventHint): PromiseLike<Event> {
public eventFromException(exception: any, hint?: EventHint | undefined): PromiseLike<Event> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let ex: any = exception;
const providedMechanism: Mechanism | undefined =
Expand Down Expand Up @@ -73,7 +73,11 @@ export class NodeBackend extends BaseBackend<NodeOptions> {
/**
* @inheritDoc
*/
public eventFromMessage(message: string, level: Severity = Severity.Info, hint?: EventHint): PromiseLike<Event> {
public eventFromMessage(
message: string,
level: Severity = Severity.Info,
hint?: EventHint | undefined,
): PromiseLike<Event> {
const event: Event = {
event_id: hint && hint.event_id,
level,
Expand Down
14 changes: 7 additions & 7 deletions packages/node/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ import { Options } from '@sentry/types';
*/
export interface NodeOptions extends Options {
/** Sets an optional server name (device name) */
serverName?: string;
serverName?: string | undefined;

/** Maximum time in milliseconds to wait to drain the request queue, before the process is allowed to exit. */
shutdownTimeout?: number;
shutdownTimeout?: number | undefined;

/** Set a HTTP proxy that should be used for outbound requests. */
httpProxy?: string;
httpProxy?: string | undefined;

/** Set a HTTPS proxy that should be used for outbound requests. */
httpsProxy?: string;
httpsProxy?: string | undefined;

/** HTTPS proxy certificates path */
caCerts?: string;
caCerts?: string | undefined;

/** Sets the number of context lines for each frame when loading a file. */
frameContextLines?: number;
frameContextLines?: number | undefined;

/** Callback that is executed when a fatal global error occurs. */
onFatalError?(error: Error): void;
onFatalError?(error: Error): void | undefined;
}
60 changes: 31 additions & 29 deletions packages/types/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,88 +12,88 @@ export interface Options {
/**
* Enable debug functionality in the SDK itself
*/
debug?: boolean;
debug?: boolean | undefined;

/**
* Specifies whether this SDK should activate and send events to Sentry.
* Disabling the SDK reduces all overhead from instrumentation, collecting
* breadcrumbs and capturing events. Defaults to true.
*/
enabled?: boolean;
enabled?: boolean | undefined;

/**
* The Dsn used to connect to Sentry and identify the project. If omitted, the
* SDK will not send any data to Sentry.
*/
dsn?: string;
dsn?: string | undefined;

/**
* If this is set to false, default integrations will not be added, otherwise this will internally be set to the
* recommended default integrations.
* TODO: We should consider changing this to `boolean | Integration[]`
*/
defaultIntegrations?: false | Integration[];
defaultIntegrations?: false | Integration[] | undefined;

/**
* List of integrations that should be installed after SDK was initialized.
* Accepts either a list of integrations or a function that receives
* default integrations and returns a new, updated list.
*/
integrations?: Integration[] | ((integrations: Integration[]) => Integration[]);
integrations?: Integration[] | ((integrations: Integration[]) => Integration[]) | undefined;

/**
* A pattern for error messages which should not be sent to Sentry.
* By default, all errors will be sent.
*/
ignoreErrors?: Array<string | RegExp>;
ignoreErrors?: Array<string | RegExp> | undefined;

/**
* Transport object that should be used to send events to Sentry
*/
transport?: TransportClass<Transport>;
transport?: TransportClass<Transport> | undefined;

/**
* Options for the default transport that the SDK uses.
*/
transportOptions?: TransportOptions;
transportOptions?: TransportOptions | undefined;

/**
* A URL to an envelope tunnel endpoint. An envelope tunnel is an HTTP endpoint
* that accepts Sentry envelopes for forwarding. This can be used to force data
* through a custom server independent of the type of data.
*/
tunnel?: string;
tunnel?: string | undefined;

/**
* The release identifier used when uploading respective source maps. Specify
* this value to allow Sentry to resolve the correct source maps when
* processing events.
*/
release?: string;
release?: string | undefined;

/** The current environment of your application (e.g. "production"). */
environment?: string;
environment?: string | undefined;

/** Sets the distribution for all events */
dist?: string;
dist?: string | undefined;

/**
* The maximum number of breadcrumbs sent with events. Defaults to 100.
* Values over 100 will be ignored and 100 used instead.
*/
maxBreadcrumbs?: number;
maxBreadcrumbs?: number | undefined;

/** Console logging verbosity for the SDK Client. */
logLevel?: LogLevel;
logLevel?: LogLevel | undefined;

/** A global sample rate to apply to all events (0 - 1). */
sampleRate?: number;
sampleRate?: number | undefined;

/** Attaches stacktraces to pure capture message / log integrations */
attachStacktrace?: boolean;
attachStacktrace?: boolean | undefined;

/** Maxium number of chars a single value can have before it will be truncated. */
maxValueLength?: number;
maxValueLength?: number | undefined;

/**
* Maximum number of levels that normalization algorithm will traverse in objects and arrays.
Expand All @@ -104,7 +104,7 @@ export interface Options {
* - `extra`
* Defaults to `3`. Set to `0` to disable.
*/
normalizeDepth?: number;
normalizeDepth?: number | undefined;

/**
* Controls how many milliseconds to wait before shutting down. The default is
Expand All @@ -113,7 +113,7 @@ export interface Options {
* high can cause the application to block for users with network connectivity
* problems.
*/
shutdownTimeout?: number;
shutdownTimeout?: number | undefined;

/**
* Sample rate to determine trace sampling.
Expand All @@ -124,31 +124,33 @@ export interface Options {
* Tracing is enabled if either this or `tracesSampler` is defined. If both are defined, `tracesSampleRate` is
* ignored.
*/
tracesSampleRate?: number;
tracesSampleRate?: number | undefined;

/**
* A flag enabling Sessions Tracking feature.
* By default, Sessions Tracking is enabled.
*/
autoSessionTracking?: boolean;
autoSessionTracking?: boolean | undefined;

/**
* Initial data to populate scope.
*/
initialScope?: CaptureContext;
initialScope?: CaptureContext | undefined;

/**
* Set of metadata about the SDK that can be internally used to enhance envelopes and events,
* and provide additional data about every request.
* */
_metadata?: SdkMetadata;
_metadata?: SdkMetadata | undefined;

/**
* Options which are in beta, or otherwise not guaranteed to be stable.
*/
_experiments?: {
[key: string]: any;
};
_experiments?:
| {
[key: string]: any;
}
| undefined;

/**
* Function to compute tracing sample rate dynamically and filter unwanted traces.
Expand All @@ -162,7 +164,7 @@ export interface Options {
* @returns A sample rate between 0 and 1 (0 drops the trace, 1 guarantees it will be sent). Returning `true` is
* equivalent to returning 1 and returning `false` is equivalent to returning 0.
*/
tracesSampler?(samplingContext: SamplingContext): number | boolean;
tracesSampler?: undefined | ((samplingContext: SamplingContext) => number | boolean);

/**
* A callback invoked during event submission, allowing to optionally modify
Expand All @@ -176,7 +178,7 @@ export interface Options {
* @param hint May contain additional information about the original exception.
* @returns A new event that will be sent | null.
*/
beforeSend?(event: Event, hint?: EventHint): PromiseLike<Event | null> | Event | null;
beforeSend?: undefined | ((event: Event, hint?: EventHint) => PromiseLike<Event | null> | Event | null);

/**
* A callback invoked when adding a breadcrumb, allowing to optionally modify
Expand All @@ -189,5 +191,5 @@ export interface Options {
* @param breadcrumb The breadcrumb as created by the SDK.
* @returns The breadcrumb that will be added | null.
*/
beforeBreadcrumb?(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): Breadcrumb | null;
beforeBreadcrumb?: undefined | ((breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => Breadcrumb | null);
}