From 3755b5e51511f453285f9d8c2d2d97a2c1448a67 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Wed, 5 Oct 2022 12:40:31 +0200 Subject: [PATCH] deprecate `@sentry/hub` exports --- packages/hub/src/index.ts | 171 +++++++++++++++++++++-- packages/hub/test/exports.test.ts | 2 + packages/hub/test/global.test.ts | 2 + packages/hub/test/hub.test.ts | 2 + packages/hub/test/scope.test.ts | 2 + packages/hub/test/session.test.ts | 2 + packages/hub/test/sessionflusher.test.ts | 2 + 7 files changed, 170 insertions(+), 13 deletions(-) diff --git a/packages/hub/src/index.ts b/packages/hub/src/index.ts index 70c0fd3e1f5c..3022d2caefa8 100644 --- a/packages/hub/src/index.ts +++ b/packages/hub/src/index.ts @@ -1,29 +1,174 @@ +/* eslint-disable deprecation/deprecation */ + export type { Carrier, Layer } from '@sentry/core'; +import { + addBreadcrumb as addBreadcrumbCore, + addGlobalEventProcessor as addGlobalEventProcessorCore, + captureEvent as captureEventCore, + captureException as captureExceptionCore, + captureMessage as captureMessageCore, + closeSession as closeSessionCore, + configureScope as configureScopeCore, + getCurrentHub as getCurrentHubCore, + getHubFromCarrier as getHubFromCarrierCore, + getMainCarrier as getMainCarrierCore, + Hub, + makeMain as makeMainCore, + makeSession as makeSessionCore, + Scope, + SessionFlusher as SessionFlusherCore, + setContext as setContextCore, + setExtra as setExtraCore, + setExtras as setExtrasCore, + setHubOnCarrier as setHubOnCarrierCore, + setTag as setTagCore, + setTags as setTagsCore, + setUser as setUserCore, + startTransaction as startTransactionCore, + updateSession as updateSessionCore, + withScope as withScopeCore, +} from '@sentry/core'; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const getCurrentHub = getCurrentHubCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const addGlobalEventProcessor = addGlobalEventProcessorCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const getHubFromCarrier = getHubFromCarrierCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const getMainCarrier = getMainCarrierCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const makeMain = makeMainCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const setHubOnCarrier = setHubOnCarrierCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const SessionFlusher = SessionFlusherCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const closeSession = closeSessionCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const makeSession = makeSessionCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const updateSession = updateSessionCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const addBreadcrumb = addBreadcrumbCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const captureException = captureExceptionCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const captureEvent = captureEventCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const captureMessage = captureMessageCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const configureScope = configureScopeCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const startTransaction = startTransactionCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const setContext = setContextCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const setExtra = setExtraCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const setExtras = setExtrasCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const setTag = setTagCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const setTags = setTagsCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const setUser = setUserCore; + +/** + * @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8. + */ +const withScope = withScopeCore; + export { - getCurrentHub, + addBreadcrumb, addGlobalEventProcessor, - Scope, + captureEvent, + captureException, + captureMessage, + closeSession, + configureScope, + getCurrentHub, getHubFromCarrier, getMainCarrier, Hub, makeMain, - setHubOnCarrier, - SessionFlusher, - closeSession, makeSession, - updateSession, - addBreadcrumb, - captureException, - captureEvent, - captureMessage, - configureScope, - startTransaction, + Scope, + SessionFlusher, setContext, setExtra, setExtras, + setHubOnCarrier, setTag, setTags, setUser, + startTransaction, + updateSession, withScope, -} from '@sentry/core'; +}; diff --git a/packages/hub/test/exports.test.ts b/packages/hub/test/exports.test.ts index f47e65220e49..a0fabf8061f6 100644 --- a/packages/hub/test/exports.test.ts +++ b/packages/hub/test/exports.test.ts @@ -1,3 +1,5 @@ +/* eslint-disable deprecation/deprecation */ + import { captureEvent, captureException, diff --git a/packages/hub/test/global.test.ts b/packages/hub/test/global.test.ts index 8dc32acb7fc7..66383af45c52 100644 --- a/packages/hub/test/global.test.ts +++ b/packages/hub/test/global.test.ts @@ -1,3 +1,5 @@ +/* eslint-disable deprecation/deprecation */ + import { getGlobalObject } from '@sentry/utils'; import { getCurrentHub, getHubFromCarrier, Hub } from '../src'; diff --git a/packages/hub/test/hub.test.ts b/packages/hub/test/hub.test.ts index 4513c92aaa94..5ce521ead4c4 100644 --- a/packages/hub/test/hub.test.ts +++ b/packages/hub/test/hub.test.ts @@ -1,4 +1,6 @@ /* eslint-disable @typescript-eslint/unbound-method */ +/* eslint-disable deprecation/deprecation */ + import { Client, Event } from '@sentry/types'; import { getCurrentHub, Hub, Scope } from '../src'; diff --git a/packages/hub/test/scope.test.ts b/packages/hub/test/scope.test.ts index d5584f38e596..7a65c436dcc3 100644 --- a/packages/hub/test/scope.test.ts +++ b/packages/hub/test/scope.test.ts @@ -1,3 +1,5 @@ +/* eslint-disable deprecation/deprecation */ + import { Event, EventHint, RequestSessionStatus } from '@sentry/types'; import { getGlobalObject } from '@sentry/utils'; diff --git a/packages/hub/test/session.test.ts b/packages/hub/test/session.test.ts index 12d8ea713e20..9de03fa34940 100644 --- a/packages/hub/test/session.test.ts +++ b/packages/hub/test/session.test.ts @@ -1,3 +1,5 @@ +/* eslint-disable deprecation/deprecation */ + import { SessionContext } from '@sentry/types'; import { timestampInSeconds } from '@sentry/utils'; diff --git a/packages/hub/test/sessionflusher.test.ts b/packages/hub/test/sessionflusher.test.ts index 5c26d37502f1..b743eeca1e70 100644 --- a/packages/hub/test/sessionflusher.test.ts +++ b/packages/hub/test/sessionflusher.test.ts @@ -1,3 +1,5 @@ +/* eslint-disable deprecation/deprecation */ + import { Client } from '@sentry/types'; import { SessionFlusher } from '../src';