UNPKG

1.42 kBTypeScriptView Raw
1import type { Envelope, InternalBaseTransportOptions, Transport } from '@sentry/types';
2export declare const MIN_DELAY = 100;
3export declare const START_DELAY = 5000;
4export interface OfflineStore {
5 insert(env: Envelope): Promise<void>;
6 pop(): Promise<Envelope | undefined>;
7}
8export type CreateOfflineStore = (options: OfflineTransportOptions) => OfflineStore;
9export interface OfflineTransportOptions extends InternalBaseTransportOptions {
10 /**
11 * A function that creates the offline store instance.
12 */
13 createStore?: CreateOfflineStore;
14 /**
15 * Flush the offline store shortly after startup.
16 *
17 * Defaults: false
18 */
19 flushAtStartup?: boolean;
20 /**
21 * Called before an event is stored.
22 *
23 * Return false to drop the envelope rather than store it.
24 *
25 * @param envelope The envelope that failed to send.
26 * @param error The error that occurred.
27 * @param retryDelay The current retry delay in milliseconds.
28 */
29 shouldStore?: (envelope: Envelope, error: Error, retryDelay: number) => boolean | Promise<boolean>;
30}
31/**
32 * Wraps a transport and stores and retries events when they fail to send.
33 *
34 * @param createTransport The transport to wrap.
35 */
36export declare function makeOfflineTransport<TO>(createTransport: (options: TO) => Transport): (options: TO & OfflineTransportOptions) => Transport;
37//# sourceMappingURL=offline.d.ts.map
\No newline at end of file