@@ -142,18 +142,6 @@ export class Hub implements HubInterface {
142
142
this . _isolationScope = assignedIsolationScope ;
143
143
}
144
144
145
- /**
146
- * Checks if this hub's version is older than the given version.
147
- *
148
- * @param version A version number to compare to.
149
- * @return True if the given version is newer; otherwise false.
150
- *
151
- * @deprecated This will be removed in v8.
152
- */
153
- public isOlderThan ( version : number ) : boolean {
154
- return this . _version < version ;
155
- }
156
-
157
145
/**
158
146
* This binds the given client to the current scope.
159
147
* @param client An SDK client (client) instance.
@@ -170,72 +158,37 @@ export class Hub implements HubInterface {
170
158
}
171
159
}
172
160
173
- /**
174
- * @inheritDoc
175
- *
176
- * @deprecated Use `withScope` instead.
177
- */
178
- public pushScope ( ) : ScopeInterface {
179
- // We want to clone the content of prev scope
180
- // eslint-disable-next-line deprecation/deprecation
181
- const scope = this . getScope ( ) . clone ( ) ;
182
- // eslint-disable-next-line deprecation/deprecation
183
- this . getStack ( ) . push ( {
184
- // eslint-disable-next-line deprecation/deprecation
185
- client : this . getClient ( ) ,
186
- scope,
187
- } ) ;
188
- return scope ;
189
- }
190
-
191
- /**
192
- * @inheritDoc
193
- *
194
- * @deprecated Use `withScope` instead.
195
- */
196
- public popScope ( ) : boolean {
197
- // eslint-disable-next-line deprecation/deprecation
198
- if ( this . getStack ( ) . length <= 1 ) return false ;
199
- // eslint-disable-next-line deprecation/deprecation
200
- return ! ! this . getStack ( ) . pop ( ) ;
201
- }
202
-
203
161
/**
204
162
* @inheritDoc
205
163
*
206
164
* @deprecated Use `Sentry.withScope()` instead.
207
165
*/
208
166
public withScope < T > ( callback : ( scope : ScopeInterface ) => T ) : T {
209
- // eslint-disable-next-line deprecation/deprecation
210
- const scope = this . pushScope ( ) ;
167
+ const scope = this . _pushScope ( ) ;
211
168
212
169
let maybePromiseResult : T ;
213
170
try {
214
171
maybePromiseResult = callback ( scope ) ;
215
172
} catch ( e ) {
216
- // eslint-disable-next-line deprecation/deprecation
217
- this . popScope ( ) ;
173
+ this . _popScope ( ) ;
218
174
throw e ;
219
175
}
220
176
221
177
if ( isThenable ( maybePromiseResult ) ) {
222
178
// @ts -expect-error - isThenable returns the wrong type
223
179
return maybePromiseResult . then (
224
180
res => {
225
- // eslint-disable-next-line deprecation/deprecation
226
- this . popScope ( ) ;
181
+ this . _popScope ( ) ;
227
182
return res ;
228
183
} ,
229
184
e => {
230
- // eslint-disable-next-line deprecation/deprecation
231
- this . popScope ( ) ;
185
+ this . _popScope ( ) ;
232
186
throw e ;
233
187
} ,
234
188
) ;
235
189
}
236
190
237
- // eslint-disable-next-line deprecation/deprecation
238
- this . popScope ( ) ;
191
+ this . _popScope ( ) ;
239
192
return maybePromiseResult ;
240
193
}
241
194
@@ -501,20 +454,6 @@ export class Hub implements HubInterface {
501
454
return session ;
502
455
}
503
456
504
- /**
505
- * Returns if default PII should be sent to Sentry and propagated in ourgoing requests
506
- * when Tracing is used.
507
- *
508
- * @deprecated Use top-level `getClient().getOptions().sendDefaultPii` instead. This function
509
- * only unnecessarily increased API surface but only wrapped accessing the option.
510
- */
511
- public shouldSendDefaultPii ( ) : boolean {
512
- // eslint-disable-next-line deprecation/deprecation
513
- const client = this . getClient ( ) ;
514
- const options = client && client . getOptions ( ) ;
515
- return Boolean ( options && options . sendDefaultPii ) ;
516
- }
517
-
518
457
/**
519
458
* Sends the current Session on the scope
520
459
*/
@@ -527,6 +466,32 @@ export class Hub implements HubInterface {
527
466
client . captureSession ( session ) ;
528
467
}
529
468
}
469
+
470
+ /**
471
+ * Push a scope to the stack.
472
+ */
473
+ private _pushScope ( ) : ScopeInterface {
474
+ // We want to clone the content of prev scope
475
+ // eslint-disable-next-line deprecation/deprecation
476
+ const scope = this . getScope ( ) . clone ( ) ;
477
+ // eslint-disable-next-line deprecation/deprecation
478
+ this . getStack ( ) . push ( {
479
+ // eslint-disable-next-line deprecation/deprecation
480
+ client : this . getClient ( ) ,
481
+ scope,
482
+ } ) ;
483
+ return scope ;
484
+ }
485
+
486
+ /**
487
+ * Pop a scope from the stack.
488
+ */
489
+ private _popScope ( ) : boolean {
490
+ // eslint-disable-next-line deprecation/deprecation
491
+ if ( this . getStack ( ) . length <= 1 ) return false ;
492
+ // eslint-disable-next-line deprecation/deprecation
493
+ return ! ! this . getStack ( ) . pop ( ) ;
494
+ }
530
495
}
531
496
532
497
/**
0 commit comments