Skip to content

Commit

Permalink
feat: Add top level getCurrentScope() method (#9800)
Browse files Browse the repository at this point in the history
This can be used instead of `getCurrentHub().getScope()`, and is a step
towards getting rid of `getCurrentHub()` as a top level API.
  • Loading branch information
mydea committed Dec 13, 2023
1 parent 380a552 commit 7303cda
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/astro/src/index.server.ts
Expand Up @@ -25,6 +25,7 @@ export {
getHubFromCarrier,
getCurrentHub,
getClient,
getCurrentScope,
Hub,
makeMain,
Scope,
Expand Down
1 change: 1 addition & 0 deletions packages/browser/src/exports.ts
Expand Up @@ -36,6 +36,7 @@ export {
getHubFromCarrier,
getCurrentHub,
getClient,
getCurrentScope,
Hub,
lastEventId,
makeMain,
Expand Down
1 change: 1 addition & 0 deletions packages/bun/src/index.ts
Expand Up @@ -42,6 +42,7 @@ export {
getHubFromCarrier,
getCurrentHub,
getClient,
getCurrentScope,
Hub,
lastEventId,
makeMain,
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/exports.ts
Expand Up @@ -308,3 +308,10 @@ export function lastEventId(): string | undefined {
export function getClient<C extends Client>(): C | undefined {
return getCurrentHub().getClient<C>();
}

/**
* Get the currently active scope.
*/
export function getCurrentScope(): Scope {
return getCurrentHub().getScope();
}
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Expand Up @@ -26,6 +26,7 @@ export {
setUser,
withScope,
getClient,
getCurrentScope,
} from './exports';
export {
getCurrentHub,
Expand Down
1 change: 1 addition & 0 deletions packages/deno/src/index.ts
Expand Up @@ -41,6 +41,7 @@ export {
getHubFromCarrier,
getCurrentHub,
getClient,
getCurrentScope,
Hub,
lastEventId,
makeMain,
Expand Down
1 change: 1 addition & 0 deletions packages/node/src/index.ts
Expand Up @@ -41,6 +41,7 @@ export {
getHubFromCarrier,
getCurrentHub,
getClient,
getCurrentScope,
Hub,
lastEventId,
makeMain,
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/index.ts
Expand Up @@ -29,6 +29,7 @@ export {
getActiveTransaction,
getCurrentHub,
getClient,
getCurrentScope,
getHubFromCarrier,
makeMain,
setContext,
Expand Down
1 change: 1 addition & 0 deletions packages/sveltekit/src/server/index.ts
Expand Up @@ -22,6 +22,7 @@ export {
getHubFromCarrier,
getCurrentHub,
getClient,
getCurrentScope,
Hub,
makeMain,
Scope,
Expand Down
1 change: 1 addition & 0 deletions packages/vercel-edge/src/index.ts
Expand Up @@ -41,6 +41,7 @@ export {
getHubFromCarrier,
getCurrentHub,
getClient,
getCurrentScope,
Hub,
lastEventId,
makeMain,
Expand Down

0 comments on commit 7303cda

Please sign in to comment.