UNPKG

1.52 kBTypeScriptView Raw
1import { Attachment, AttachmentItem, DataCategory, Envelope, EnvelopeItemType, TextEncoderInternal } from '@sentry/types';
2/**
3 * Creates an envelope.
4 * Make sure to always explicitly provide the generic to this function
5 * so that the envelope types resolve correctly.
6 */
7export declare function createEnvelope<E extends Envelope>(headers: E[0], items?: E[1]): E;
8/**
9 * Add an item to an envelope.
10 * Make sure to always explicitly provide the generic to this function
11 * so that the envelope types resolve correctly.
12 */
13export declare function addItemToEnvelope<E extends Envelope>(envelope: E, newItem: E[1][number]): E;
14/**
15 * Convenience function to loop through the items and item types of an envelope.
16 * (This function was mostly created because working with envelope types is painful at the moment)
17 */
18export declare function forEachEnvelopeItem<E extends Envelope>(envelope: Envelope, callback: (envelopeItem: E[1][number], envelopeItemType: E[1][number][0]['type']) => void): void;
19/**
20 * Serializes an envelope.
21 */
22export declare function serializeEnvelope(envelope: Envelope, textEncoder?: TextEncoderInternal): string | Uint8Array;
23/**
24 * Creates attachment envelope items
25 */
26export declare function createAttachmentEnvelopeItem(attachment: Attachment, textEncoder?: TextEncoderInternal): AttachmentItem;
27/**
28 * Maps the type of an envelope item to a data category.
29 */
30export declare function envelopeItemTypeToDataCategory(type: EnvelopeItemType): DataCategory;
31//# sourceMappingURL=envelope.d.ts.map
\No newline at end of file