Skip to content

Commit a7098d5

Browse files
committed
Fix build and lint
1 parent bd4dba1 commit a7098d5

File tree

10 files changed

+56
-2
lines changed

10 files changed

+56
-2
lines changed

dev-packages/node-integration-tests/suites/sessions/server.ts

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import express from 'express';
1313

1414
const app = express();
1515

16+
// eslint-disable-next-line deprecation/deprecation
1617
const flusher = (Sentry.getClient() as Sentry.NodeClient)['_sessionFlusher'] as SessionFlusher;
1718

1819
// Flush after 2 seconds (to avoid waiting for the default 60s)

packages/core/src/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ export { inboundFiltersIntegration } from './integrations/inboundfilters';
9393
export { linkedErrorsIntegration } from './integrations/linkederrors';
9494
export { moduleMetadataIntegration } from './integrations/metadata';
9595
export { requestDataIntegration } from './integrations/requestdata';
96-
export { serverRequestSessionIntegration } from './integrations/serverrequestsession';
9796
export { captureConsoleIntegration } from './integrations/captureconsole';
9897
// eslint-disable-next-line deprecation/deprecation
9998
export { debugIntegration } from './integrations/debug';

packages/core/src/scope.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class ScopeClass implements ScopeInterface {
9494
protected _session?: Session;
9595

9696
/** Request Mode Session Status */
97+
// eslint-disable-next-line deprecation/deprecation
9798
protected _requestSession?: RequestSession;
9899

99100
/** The client on this scope */
@@ -222,13 +223,15 @@ class ScopeClass implements ScopeInterface {
222223
/**
223224
* @inheritDoc
224225
*/
226+
// eslint-disable-next-line deprecation/deprecation
225227
public getRequestSession(): RequestSession | undefined {
226228
return this._requestSession;
227229
}
228230

229231
/**
230232
* @inheritDoc
231233
*/
234+
// eslint-disable-next-line deprecation/deprecation
232235
public setRequestSession(requestSession?: RequestSession): this {
233236
this._requestSession = requestSession;
234237
return this;
@@ -350,7 +353,8 @@ class ScopeClass implements ScopeInterface {
350353

351354
const [scopeInstance, requestSession] =
352355
scopeToMerge instanceof Scope
353-
? [scopeToMerge.getScopeData(), scopeToMerge.getRequestSession()]
356+
? // eslint-disable-next-line deprecation/deprecation
357+
[scopeToMerge.getScopeData(), scopeToMerge.getRequestSession()]
354358
: isPlainObject(scopeToMerge)
355359
? [captureContext as ScopeContext, (captureContext as ScopeContext).requestSession]
356360
: [];

packages/core/test/lib/scope.test.ts

+9
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,10 @@ describe('Scope', () => {
261261

262262
test('_requestSession clone', () => {
263263
const parentScope = new Scope();
264+
// eslint-disable-next-line deprecation/deprecation
264265
parentScope.setRequestSession({ status: 'errored' });
265266
const scope = parentScope.clone();
267+
// eslint-disable-next-line deprecation/deprecation
266268
expect(parentScope.getRequestSession()).toEqual(scope.getRequestSession());
267269
});
268270

@@ -288,15 +290,19 @@ describe('Scope', () => {
288290
// Test that ensures if the status value of `status` of `_requestSession` is changed in a child scope
289291
// that it should also change in parent scope because we are copying the reference to the object
290292
const parentScope = new Scope();
293+
// eslint-disable-next-line deprecation/deprecation
291294
parentScope.setRequestSession({ status: 'errored' });
292295

293296
const scope = parentScope.clone();
297+
// eslint-disable-next-line deprecation/deprecation
294298
const requestSession = scope.getRequestSession();
295299
if (requestSession) {
296300
requestSession.status = 'ok';
297301
}
298302

303+
// eslint-disable-next-line deprecation/deprecation
299304
expect(parentScope.getRequestSession()).toEqual({ status: 'ok' });
305+
// eslint-disable-next-line deprecation/deprecation
300306
expect(scope.getRequestSession()).toEqual({ status: 'ok' });
301307
});
302308

@@ -316,6 +322,7 @@ describe('Scope', () => {
316322
scope.setUser({ id: '1' });
317323
scope.setFingerprint(['abcd']);
318324
scope.addBreadcrumb({ message: 'test' });
325+
// eslint-disable-next-line deprecation/deprecation
319326
scope.setRequestSession({ status: 'ok' });
320327
expect(scope['_extra']).toEqual({ a: 2 });
321328
scope.clear();
@@ -349,6 +356,7 @@ describe('Scope', () => {
349356
scope.setUser({ id: '1337' });
350357
scope.setLevel('info');
351358
scope.setFingerprint(['foo']);
359+
// eslint-disable-next-line deprecation/deprecation
352360
scope.setRequestSession({ status: 'ok' });
353361
});
354362

@@ -453,6 +461,7 @@ describe('Scope', () => {
453461
level: 'warning' as const,
454462
tags: { bar: '3', baz: '4' },
455463
user: { id: '42' },
464+
// eslint-disable-next-line deprecation/deprecation
456465
requestSession: { status: 'errored' as RequestSessionStatus },
457466
propagationContext: {
458467
traceId: '8949daf83f4a4a70bee4c1eb9ab242ed',

packages/core/test/lib/sessionflusher.test.ts

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ describe('Session Flusher', () => {
1919
});
2020

2121
test('test incrementSessionStatusCount updates the internal SessionFlusher state', () => {
22+
// eslint-disable-next-line deprecation/deprecation
2223
const flusher = new SessionFlusher(mockClient, { release: '1.0.0', environment: 'dev' });
2324

2425
const date = new Date('2021-04-08T12:18:23.043Z');
@@ -42,6 +43,7 @@ describe('Session Flusher', () => {
4243
});
4344

4445
test('test undefined attributes are excluded, on incrementSessionStatusCount call', () => {
46+
// eslint-disable-next-line deprecation/deprecation
4547
const flusher = new SessionFlusher(mockClient, { release: '1.0.0' });
4648

4749
const date = new Date('2021-04-08T12:18:23.043Z');
@@ -55,6 +57,7 @@ describe('Session Flusher', () => {
5557
});
5658

5759
test('flush is called every 60 seconds after initialisation of an instance of SessionFlusher', () => {
60+
// eslint-disable-next-line deprecation/deprecation
5861
const flusher = new SessionFlusher(mockClient, { release: '1.0.0', environment: 'dev' });
5962
const flusherFlushFunc = jest.spyOn(flusher, 'flush');
6063
jest.advanceTimersByTime(59000);
@@ -68,6 +71,7 @@ describe('Session Flusher', () => {
6871
});
6972

7073
test('sendSessions is called on flush if sessions were captured', () => {
74+
// eslint-disable-next-line deprecation/deprecation
7175
const flusher = new SessionFlusher(mockClient, { release: '1.0.0', environment: 'dev' });
7276
const flusherFlushFunc = jest.spyOn(flusher, 'flush');
7377
const date = new Date('2021-04-08T12:18:23.043Z');
@@ -88,6 +92,7 @@ describe('Session Flusher', () => {
8892
});
8993

9094
test('sendSessions is not called on flush if no sessions were captured', () => {
95+
// eslint-disable-next-line deprecation/deprecation
9196
const flusher = new SessionFlusher(mockClient, { release: '1.0.0', environment: 'dev' });
9297
const flusherFlushFunc = jest.spyOn(flusher, 'flush');
9398

@@ -98,12 +103,14 @@ describe('Session Flusher', () => {
98103
});
99104

100105
test('calling close on SessionFlusher should disable SessionFlusher', () => {
106+
// eslint-disable-next-line deprecation/deprecation
101107
const flusher = new SessionFlusher(mockClient, { release: '1.0.x' });
102108
flusher.close();
103109
expect((flusher as any)._isEnabled).toEqual(false);
104110
});
105111

106112
test('calling close on SessionFlusher will force call flush', () => {
113+
// eslint-disable-next-line deprecation/deprecation
107114
const flusher = new SessionFlusher(mockClient, { release: '1.0.x' });
108115
const flusherFlushFunc = jest.spyOn(flusher, 'flush');
109116
const date = new Date('2021-04-08T12:18:23.043Z');

packages/node/src/integrations/http/SentryHttpInstrumentation.ts

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ export class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpIns
149149

150150
const client = getClient<NodeClient>();
151151
if (client && client.getOptions().autoSessionTracking) {
152+
// eslint-disable-next-line deprecation/deprecation
152153
isolationScope.setRequestSession({ status: 'ok' });
153154
}
154155

packages/node/src/integrations/tracing/express.ts

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export function expressErrorHandler(options?: ExpressHandlerOptions): ExpressMid
129129
// running in SessionAggregates mode
130130
const isSessionAggregatesMode = client['_sessionFlusher'] !== undefined;
131131
if (isSessionAggregatesMode) {
132+
// eslint-disable-next-line deprecation/deprecation
132133
const requestSession = getIsolationScope().getRequestSession();
133134
// If an error bubbles to the `errorHandler`, then this is an unhandled error, and should be reported as a
134135
// Crashed session. The `_requestSession.status` is checked to ensure that this error is happening within

packages/node/test/integrations/express.test.ts

+7
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ describe('expressErrorHandler()', () => {
5959

6060
jest.spyOn<any, any>(client, '_captureRequestSession');
6161

62+
// eslint-disable-next-line deprecation/deprecation
6263
getIsolationScope().setRequestSession({ status: 'ok' });
6364

6465
let isolationScope: Scope;
@@ -68,6 +69,7 @@ describe('expressErrorHandler()', () => {
6869
});
6970

7071
setImmediate(() => {
72+
// eslint-disable-next-line deprecation/deprecation
7173
expect(isolationScope.getRequestSession()).toEqual({ status: 'ok' });
7274
done();
7375
});
@@ -80,6 +82,7 @@ describe('expressErrorHandler()', () => {
8082

8183
jest.spyOn<any, any>(client, '_captureRequestSession');
8284

85+
// eslint-disable-next-line deprecation/deprecation
8386
getIsolationScope().setRequestSession({ status: 'ok' });
8487

8588
let isolationScope: Scope;
@@ -89,6 +92,7 @@ describe('expressErrorHandler()', () => {
8992
});
9093

9194
setImmediate(() => {
95+
// eslint-disable-next-line deprecation/deprecation
9296
expect(isolationScope.getRequestSession()).toEqual({ status: 'ok' });
9397
done();
9498
});
@@ -106,8 +110,10 @@ describe('expressErrorHandler()', () => {
106110
jest.spyOn<any, any>(client, '_captureRequestSession');
107111

108112
withScope(() => {
113+
// eslint-disable-next-line deprecation/deprecation
109114
getIsolationScope().setRequestSession({ status: 'ok' });
110115
sentryErrorMiddleware({ name: 'error', message: 'this is an error' }, req, res, () => {
116+
// eslint-disable-next-line deprecation/deprecation
111117
expect(getIsolationScope().getRequestSession()).toEqual({ status: 'crashed' });
112118
});
113119
});
@@ -130,6 +136,7 @@ describe('expressErrorHandler()', () => {
130136
});
131137

132138
setImmediate(() => {
139+
// eslint-disable-next-line deprecation/deprecation
133140
expect(isolationScope.getRequestSession()).toEqual(undefined);
134141
done();
135142
});

packages/node/test/sdk/client.test.ts

+22
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,12 @@ describe('NodeClient', () => {
8282
initOpenTelemetry(client);
8383

8484
withIsolationScope(isolationScope => {
85+
// eslint-disable-next-line deprecation/deprecation
8586
isolationScope.setRequestSession({ status: 'ok' });
8687

8788
client.captureException(new Error('test exception'));
8889

90+
// eslint-disable-next-line deprecation/deprecation
8991
const requestSession = isolationScope.getRequestSession();
9092
expect(requestSession!.status).toEqual('ok');
9193
});
@@ -103,10 +105,12 @@ describe('NodeClient', () => {
103105
client.initSessionFlusher();
104106

105107
withIsolationScope(isolationScope => {
108+
// eslint-disable-next-line deprecation/deprecation
106109
isolationScope.setRequestSession({ status: 'ok' });
107110

108111
client.captureException(new Error('test exception'));
109112

113+
// eslint-disable-next-line deprecation/deprecation
110114
const requestSession = isolationScope.getRequestSession();
111115
expect(requestSession!.status).toEqual('ok');
112116
});
@@ -124,10 +128,12 @@ describe('NodeClient', () => {
124128
client.initSessionFlusher();
125129

126130
withIsolationScope(isolationScope => {
131+
// eslint-disable-next-line deprecation/deprecation
127132
isolationScope.setRequestSession({ status: 'crashed' });
128133

129134
client.captureException(new Error('test exception'));
130135

136+
// eslint-disable-next-line deprecation/deprecation
131137
const requestSession = isolationScope.getRequestSession();
132138
expect(requestSession!.status).toEqual('crashed');
133139
});
@@ -145,10 +151,12 @@ describe('NodeClient', () => {
145151
client.initSessionFlusher();
146152

147153
withIsolationScope(isolationScope => {
154+
// eslint-disable-next-line deprecation/deprecation
148155
isolationScope.setRequestSession({ status: 'ok' });
149156

150157
client.captureException(new Error('test exception'));
151158

159+
// eslint-disable-next-line deprecation/deprecation
152160
const requestSession = isolationScope.getRequestSession();
153161
expect(requestSession!.status).toEqual('errored');
154162
});
@@ -167,13 +175,15 @@ describe('NodeClient', () => {
167175

168176
let isolationScope: Scope;
169177
withIsolationScope(_isolationScope => {
178+
// eslint-disable-next-line deprecation/deprecation
170179
_isolationScope.setRequestSession({ status: 'ok' });
171180
isolationScope = _isolationScope;
172181
});
173182

174183
client.captureException(new Error('test exception'));
175184

176185
setImmediate(() => {
186+
// eslint-disable-next-line deprecation/deprecation
177187
const requestSession = isolationScope.getRequestSession();
178188
expect(requestSession).toEqual({ status: 'ok' });
179189
done();
@@ -194,8 +204,10 @@ describe('NodeClient', () => {
194204
client.initSessionFlusher();
195205

196206
withIsolationScope(isolationScope => {
207+
// eslint-disable-next-line deprecation/deprecation
197208
isolationScope.setRequestSession({ status: 'ok' });
198209
client.captureEvent({ message: 'message', exception: { values: [{ type: 'exception type 1' }] } });
210+
// eslint-disable-next-line deprecation/deprecation
199211
const requestSession = isolationScope.getRequestSession();
200212
expect(requestSession!.status).toEqual('ok');
201213
});
@@ -209,10 +221,12 @@ describe('NodeClient', () => {
209221
client.initSessionFlusher();
210222

211223
withIsolationScope(isolationScope => {
224+
// eslint-disable-next-line deprecation/deprecation
212225
isolationScope.setRequestSession({ status: 'ok' });
213226

214227
client.captureEvent({ message: 'message', exception: { values: [{ type: 'exception type 1' }] } });
215228

229+
// eslint-disable-next-line deprecation/deprecation
216230
const requestSession = isolationScope.getRequestSession();
217231
expect(requestSession!.status).toEqual('errored');
218232
});
@@ -230,10 +244,12 @@ describe('NodeClient', () => {
230244
client.initSessionFlusher();
231245

232246
withIsolationScope(isolationScope => {
247+
// eslint-disable-next-line deprecation/deprecation
233248
isolationScope.setRequestSession({ status: 'ok' });
234249

235250
client.captureEvent({ message: 'message' });
236251

252+
// eslint-disable-next-line deprecation/deprecation
237253
const requestSession = isolationScope.getRequestSession();
238254
expect(requestSession!.status).toEqual('ok');
239255
});
@@ -254,6 +270,7 @@ describe('NodeClient', () => {
254270
isolationScope.clear();
255271
client.captureEvent({ message: 'message', exception: { values: [{ type: 'exception type 1' }] } });
256272

273+
// eslint-disable-next-line deprecation/deprecation
257274
expect(isolationScope.getRequestSession()).toEqual(undefined);
258275
});
259276
});
@@ -270,10 +287,12 @@ describe('NodeClient', () => {
270287
client.initSessionFlusher();
271288

272289
withIsolationScope(isolationScope => {
290+
// eslint-disable-next-line deprecation/deprecation
273291
isolationScope.setRequestSession({ status: 'ok' });
274292

275293
client.captureEvent({ message: 'message', type: 'transaction' });
276294

295+
// eslint-disable-next-line deprecation/deprecation
277296
const requestSession = isolationScope.getRequestSession();
278297
expect(requestSession!.status).toEqual('ok');
279298
});
@@ -287,10 +306,12 @@ describe('NodeClient', () => {
287306
initOpenTelemetry(client);
288307

289308
withIsolationScope(isolationScope => {
309+
// eslint-disable-next-line deprecation/deprecation
290310
isolationScope.setRequestSession({ status: 'ok' });
291311

292312
client.captureEvent({ message: 'message', exception: { values: [{ type: 'exception type 1' }] } });
293313

314+
// eslint-disable-next-line deprecation/deprecation
294315
const requestSession = isolationScope.getRequestSession();
295316
expect(requestSession!.status).toEqual('ok');
296317
});
@@ -527,6 +548,7 @@ describe('flush/close', () => {
527548
// not due to the interval running every 60s
528549
clearInterval(client['_sessionFlusher']!['_intervalId']);
529550

551+
// eslint-disable-next-line deprecation/deprecation
530552
const sessionFlusherFlushFunc = jest.spyOn(SessionFlusher.prototype, 'flush');
531553

532554
const delay = 1;

packages/types/src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,13 @@ export type SessionContext = SessionContext_imported;
419419
/** @deprecated This type has been moved to `@sentry/core`. */
420420
export type SessionStatus = SessionStatus_imported;
421421
/** @deprecated This type has been moved to `@sentry/core`. */
422+
// eslint-disable-next-line deprecation/deprecation
422423
export type RequestSession = RequestSession_imported;
423424
/** @deprecated This type has been moved to `@sentry/core`. */
425+
// eslint-disable-next-line deprecation/deprecation
424426
export type RequestSessionStatus = RequestSessionStatus_imported;
425427
/** @deprecated This type has been moved to `@sentry/core`. */
428+
// eslint-disable-next-line deprecation/deprecation
426429
export type SessionFlusherLike = SessionFlusherLike_imported;
427430
/** @deprecated This type has been moved to `@sentry/core`. */
428431
export type SerializedSession = SerializedSession_imported;

0 commit comments

Comments
 (0)