@web3-storage/toucan-js
Version:
Cloudflare Workers client for Sentry (fork)
67 lines • 2.55 kB
TypeScript
/// <reference types="@cloudflare/workers-types" />
import { Options as SentryOptions, Event as SentryEvent, Breadcrumb as SentryBreadcrumb, StackFrame, SamplingContext as SentrySamplingContext } from '@sentry/types';
export declare type RewriteFrames = {
root?: string;
iteratee?: (frame: StackFrame) => StackFrame;
};
export declare type Context = {
waitUntil: (promise: Promise<any>) => void;
request?: Request;
};
declare type WithEvent = {
event: FetchEvent | ScheduledEvent;
};
declare type WithContext = {
context: Context;
request?: Request;
};
declare type WithRequest = {
request: Request;
};
declare type SamplingContext = {
request?: SentrySamplingContext['request'];
};
declare type OtherOptions = {
dsn?: SentryOptions['dsn'];
allowedCookies?: string[] | RegExp;
allowedHeaders?: string[] | RegExp;
allowedSearchParams?: string[] | RegExp;
attachStacktrace?: SentryOptions['attachStacktrace'];
beforeSend?: (event: Event) => Event;
debug?: SentryOptions['debug'];
environment?: SentryOptions['environment'];
maxBreadcrumbs?: SentryOptions['maxBreadcrumbs'];
pkg?: Record<string, any>;
release?: SentryOptions['release'];
rewriteFrames?: RewriteFrames;
/**
* @deprecated Use tracesSampleRate.
*/
sampleRate?: SentryOptions['sampleRate'];
tracesSampleRate?: SentryOptions['tracesSampleRate'];
tracesSampler?: (samplingContext: SamplingContext) => number | boolean;
transportOptions?: Compute<Pick<NonNullable<SentryOptions['transportOptions']>, 'headers'>>;
};
export declare type Options = (WithEvent & OtherOptions) | (WithContext & OtherOptions) | (WithRequest & OtherOptions);
export declare type Level = 'critical' | 'fatal' | 'error' | 'warning' | 'info' | 'log' | 'debug';
export declare type Breadcrumb = Compute<Omit<SentryBreadcrumb, 'level'> & {
level?: Level;
}>;
export declare type Event = Compute<Omit<SentryEvent, 'level' | 'breadcrumbs'> & {
level?: Level;
breadcrumbs?: Breadcrumb[];
}>;
/**
* Force TS to load a type that has not been computed
* (to resolve composed types that TS hasn't resolved).
* https://pirix-gh.github.io/ts-toolbelt/modules/_any_compute_.html
*
* @example
* // becomes {foo: string, baz: boolean}
* type Foo = Compute<{bar: string} & {baz: boolean}>
*/
declare type Compute<A extends any> = A extends Function ? A : {
[K in keyof A]: A[K];
} & {};
export {};
//# sourceMappingURL=types.d.ts.map