From dba8ead870ba9da3336b5d698bea65ba980d9967 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Tue, 27 Feb 2024 16:30:26 -0500 Subject: [PATCH] fix(types): Improve attachment type - add docstring and comments for all fields - make attachmentType type more specific --- packages/types/src/attachment.ts | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/types/src/attachment.ts b/packages/types/src/attachment.ts index 55cc795732ea..44f4123c7ad2 100644 --- a/packages/types/src/attachment.ts +++ b/packages/types/src/attachment.ts @@ -1,6 +1,27 @@ +/** + * An attachment to an event. This is used to upload arbitrary data to Sentry. + * + * Please take care to not add sensitive information in attachments. + * + * https://develop.sentry.dev/sdk/envelopes/#attachment + */ export interface Attachment { + /** + * The attachment data. Can be a string or a binary data (byte array) + */ data: string | Uint8Array; + /** + * The name of the uploaded file without a path component + */ filename: string; + /** + * The content type of the attachment payload. Defaults to `application/octet-stream` if not specified. + * + * Any valid [media type](https://www.iana.org/assignments/media-types/media-types.xhtml) is allowed. + */ contentType?: string; - attachmentType?: string; + /** + * The type of the attachment. Defaults to `event.attachment` if not specified. + */ + attachmentType?: 'event.attachment' | 'event.minidump' | 'event.applecrashreport' | 'unreal.context' | 'unreal.logs'; }