@@ -322,47 +322,37 @@ export class Scope implements ScopeInterface {
322322
323323    const  scopeToMerge  =  typeof  captureContext  ===  'function'  ? captureContext ( this )  : captureContext ; 
324324
325-     if  ( scopeToMerge  instanceof  Scope )  { 
326-       const  scopeData  =  scopeToMerge . getScopeData ( ) ; 
327- 
328-       this . _tags  =  {  ...this . _tags ,  ...scopeData . tags  } ; 
329-       this . _extra  =  {  ...this . _extra ,  ...scopeData . extra  } ; 
330-       this . _contexts  =  {  ...this . _contexts ,  ...scopeData . contexts  } ; 
331-       if  ( scopeData . user  &&  Object . keys ( scopeData . user ) . length )  { 
332-         this . _user  =  scopeData . user ; 
333-       } 
334-       if  ( scopeData . level )  { 
335-         this . _level  =  scopeData . level ; 
336-       } 
337-       if  ( scopeData . fingerprint . length )  { 
338-         this . _fingerprint  =  scopeData . fingerprint ; 
339-       } 
340-       if  ( scopeToMerge . getRequestSession ( ) )  { 
341-         this . _requestSession  =  scopeToMerge . getRequestSession ( ) ; 
342-       } 
343-       if  ( scopeData . propagationContext )  { 
344-         this . _propagationContext  =  scopeData . propagationContext ; 
345-       } 
346-     }  else  if  ( isPlainObject ( scopeToMerge ) )  { 
347-       const  scopeContext  =  captureContext  as  ScopeContext ; 
348-       this . _tags  =  {  ...this . _tags ,  ...scopeContext . tags  } ; 
349-       this . _extra  =  {  ...this . _extra ,  ...scopeContext . extra  } ; 
350-       this . _contexts  =  {  ...this . _contexts ,  ...scopeContext . contexts  } ; 
351-       if  ( scopeContext . user )  { 
352-         this . _user  =  scopeContext . user ; 
353-       } 
354-       if  ( scopeContext . level )  { 
355-         this . _level  =  scopeContext . level ; 
356-       } 
357-       if  ( scopeContext . fingerprint )  { 
358-         this . _fingerprint  =  scopeContext . fingerprint ; 
359-       } 
360-       if  ( scopeContext . requestSession )  { 
361-         this . _requestSession  =  scopeContext . requestSession ; 
362-       } 
363-       if  ( scopeContext . propagationContext )  { 
364-         this . _propagationContext  =  scopeContext . propagationContext ; 
365-       } 
325+     const  [ scopeInstance ,  requestSession ]  = 
326+       scopeToMerge  instanceof  Scope 
327+         ? [ scopeToMerge . getScopeData ( ) ,  scopeToMerge . getRequestSession ( ) ] 
328+         : isPlainObject ( scopeToMerge ) 
329+           ? [ captureContext  as  ScopeContext ,  ( captureContext  as  ScopeContext ) . requestSession ] 
330+           : [ ] ; 
331+ 
332+     const  {  tags,  extra,  user,  contexts,  level,  fingerprint =  [ ] ,  propagationContext }  =  scopeInstance  ||  { } ; 
333+ 
334+     this . _tags  =  {  ...this . _tags ,  ...tags  } ; 
335+     this . _extra  =  {  ...this . _extra ,  ...extra  } ; 
336+     this . _contexts  =  {  ...this . _contexts ,  ...contexts  } ; 
337+ 
338+     if  ( user  &&  Object . keys ( user ) . length )  { 
339+       this . _user  =  user ; 
340+     } 
341+ 
342+     if  ( level )  { 
343+       this . _level  =  level ; 
344+     } 
345+ 
346+     if  ( fingerprint . length )  { 
347+       this . _fingerprint  =  fingerprint ; 
348+     } 
349+ 
350+     if  ( propagationContext )  { 
351+       this . _propagationContext  =  propagationContext ; 
352+     } 
353+ 
354+     if  ( requestSession )  { 
355+       this . _requestSession  =  requestSession ; 
366356    } 
367357
368358    return  this ; 
@@ -450,34 +440,19 @@ export class Scope implements ScopeInterface {
450440
451441  /** @inheritDoc  */ 
452442  public  getScopeData ( ) : ScopeData  { 
453-     const  { 
454-       _breadcrumbs, 
455-       _attachments, 
456-       _contexts, 
457-       _tags, 
458-       _extra, 
459-       _user, 
460-       _level, 
461-       _fingerprint, 
462-       _eventProcessors, 
463-       _propagationContext, 
464-       _sdkProcessingMetadata, 
465-       _transactionName, 
466-     }  =  this ; 
467- 
468443    return  { 
469-       breadcrumbs : _breadcrumbs , 
470-       attachments : _attachments , 
471-       contexts : _contexts , 
472-       tags : _tags , 
473-       extra : _extra , 
474-       user : _user , 
475-       level : _level , 
476-       fingerprint : _fingerprint  ||  [ ] , 
477-       eventProcessors : _eventProcessors , 
478-       propagationContext : _propagationContext , 
479-       sdkProcessingMetadata : _sdkProcessingMetadata , 
480-       transactionName : _transactionName , 
444+       breadcrumbs : this . _breadcrumbs , 
445+       attachments : this . _attachments , 
446+       contexts : this . _contexts , 
447+       tags : this . _tags , 
448+       extra : this . _extra , 
449+       user : this . _user , 
450+       level : this . _level , 
451+       fingerprint : this . _fingerprint  ||  [ ] , 
452+       eventProcessors : this . _eventProcessors , 
453+       propagationContext : this . _propagationContext , 
454+       sdkProcessingMetadata : this . _sdkProcessingMetadata , 
455+       transactionName : this . _transactionName , 
481456      span : _getSpanForScope ( this ) , 
482457    } ; 
483458  } 
0 commit comments