Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(types): Add Envelope types (#4527)
To prep for the introduction of formal envelopes API, add types representing envelopes and their items. These are based on the documentation from the develop docs at the time of this patch. Envelope items are stored as a tuple of length 2 (item headers and payload) to reduce bundle size. This is as array access is smaller than having to access through object properties, and they will stay constant. Each Envelope is generic over a `BaseEnvelope` type, which allows for items and headers to be configured, but sets a `CommonEnvelopeHeaders` alongside a default `UnknownEnvelopeItem` (as per the spec). Each Envelope item is generic over a `BaseEnvelopeItem` type, which establishs `CommonEnvelopeItemHeaders` over an arbitrary item payload. Envelope items are defined for events, attachments, user feedback, sessions, and client reports. Envelopes are defined for events, sessions, and client reports. This is as attachments and user feedback (for now) must be in the envelope alongside the event. As User Feedback and Attachment envelopes are currently not supported in the SDK, they are not exported, but will be once v7 is introduced. The next step from the patch is to add the public API around creating and mutating Envelopes of different natures, as well as mapping from an Envelope -> `SentryRequest`. See: https://develop.sentry.dev/sdk/envelopes/
- Loading branch information