From 6c0b28cb96c36342a96564de61564c236b20127e Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Wed, 6 Mar 2024 15:04:18 +0000 Subject: [PATCH 1/2] fix(types): Add `AttachmentType` --- packages/types/src/attachment.ts | 9 ++++++++- packages/types/src/envelope.ts | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/types/src/attachment.ts b/packages/types/src/attachment.ts index 44f4123c7ad2..1e619cf108ea 100644 --- a/packages/types/src/attachment.ts +++ b/packages/types/src/attachment.ts @@ -1,3 +1,10 @@ +export type AttachmentType = + | 'event.attachment' + | 'event.minidump' + | 'event.applecrashreport' + | 'unreal.context' + | 'unreal.logs'; + /** * An attachment to an event. This is used to upload arbitrary data to Sentry. * @@ -23,5 +30,5 @@ export interface Attachment { /** * The type of the attachment. Defaults to `event.attachment` if not specified. */ - attachmentType?: 'event.attachment' | 'event.minidump' | 'event.applecrashreport' | 'unreal.context' | 'unreal.logs'; + attachmentType?: AttachmentType; } diff --git a/packages/types/src/envelope.ts b/packages/types/src/envelope.ts index 05db8f118c70..fd421235d483 100644 --- a/packages/types/src/envelope.ts +++ b/packages/types/src/envelope.ts @@ -1,3 +1,4 @@ +import type { AttachmentType } from './attachment'; import type { SerializedCheckIn } from './checkin'; import type { ClientReport } from './clientreport'; import type { DsnComponents } from './dsn'; @@ -66,7 +67,7 @@ type AttachmentItemHeaders = { length: number; filename: string; content_type?: string; - attachment_type?: string; + attachment_type?: AttachmentType; }; type UserFeedbackItemHeaders = { type: 'user_report' }; type FeedbackItemHeaders = { type: 'feedback' }; From d60b05ac2ef59ca13a0d041ed5e752b5a38fb082 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Wed, 6 Mar 2024 16:35:24 +0000 Subject: [PATCH 2/2] Fix test --- packages/core/test/lib/transports/base.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/test/lib/transports/base.test.ts b/packages/core/test/lib/transports/base.test.ts index 1425c55c45a7..a8198ce38b3d 100644 --- a/packages/core/test/lib/transports/base.test.ts +++ b/packages/core/test/lib/transports/base.test.ts @@ -22,7 +22,7 @@ const ATTACHMENT_ENVELOPE = createEnvelope( length: 20, filename: 'test-file.txt', content_type: 'text/plain', - attachment_type: 'text', + attachment_type: 'event.attachment', }, 'attachment content', ] as AttachmentItem,