11/* eslint-disable max-lines */
22import { Scope , Session } from '@sentry/hub' ;
33import {
4- AttachmentItem ,
4+ Attachment ,
55 Client ,
66 ClientOptions ,
77 DataCategory ,
@@ -19,6 +19,7 @@ import {
1919 Transport ,
2020} from '@sentry/types' ;
2121import {
22+ addItemToEnvelope ,
2223 checkOrSetAlreadyCaught ,
2324 createAttachmentEnvelopeItem ,
2425 dateTimestampInSeconds ,
@@ -275,9 +276,14 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
275276 /**
276277 * @inheritDoc
277278 */
278- public sendEvent ( event : Event , attachments ?: AttachmentItem [ ] ) : void {
279+ public sendEvent ( event : Event , attachments ?: Attachment [ ] ) : void {
279280 if ( this . _dsn ) {
280- const env = createEventEnvelope ( event , this . _dsn , attachments , this . _options . _metadata , this . _options . tunnel ) ;
281+ const env = createEventEnvelope ( event , this . _dsn , this . _options . _metadata , this . _options . tunnel ) ;
282+
283+ for ( const attachment of attachments || [ ] ) {
284+ addItemToEnvelope ( env , createAttachmentEnvelopeItem ( attachment ) ) ;
285+ }
286+
281287 this . _sendEnvelope ( env ) ;
282288 }
283289 }
@@ -543,7 +549,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
543549 * @param event The Sentry event to send
544550 */
545551 // TODO(v7): refactor: get rid of method?
546- protected _sendEvent ( event : Event , attachments ?: AttachmentItem [ ] ) : void {
552+ protected _sendEvent ( event : Event , attachments ?: Attachment [ ] ) : void {
547553 this . sendEvent ( event , attachments ) ;
548554 }
549555
@@ -662,10 +668,10 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
662668 }
663669
664670 /**
665- * Loads attachment items from scope
671+ * Loads attachments from scope
666672 */
667- protected _attachmentsFromScope ( scope : Scope | undefined ) : AttachmentItem [ ] {
668- return scope ?. getAttachments ( ) ?. map ( a => createAttachmentEnvelopeItem ( a ) ) || [ ] ;
673+ protected _attachmentsFromScope ( scope : Scope | undefined ) : Attachment [ ] {
674+ return scope ?. getAttachments ( ) || [ ] ;
669675 }
670676
671677 /**
0 commit comments