Skip to content

Commit

Permalink
fix circular dependency check
Browse files Browse the repository at this point in the history
  • Loading branch information
mydea committed Nov 14, 2023
1 parent e0a3f1a commit f8ed063
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
15 changes: 15 additions & 0 deletions packages/core/src/baseclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {

import { getEnvelopeEndpointWithUrlEncodedAuth } from './api';
import { createEventEnvelope, createSessionEnvelope } from './envelope';
import { getCurrentHub } from './hub';
import type { IntegrationIndex } from './integration';
import { setupIntegration, setupIntegrations } from './integration';
import type { Scope } from './scope';
Expand Down Expand Up @@ -823,3 +824,17 @@ function isErrorEvent(event: Event): event is ErrorEvent {
function isTransactionEvent(event: Event): event is TransactionEvent {
return event.type === 'transaction';
}

/**
* Add an event processor to the current client.
* This event processor will run for all events processed by this client.
*/
export function addEventProcessor(callback: EventProcessor): void {
const client = getCurrentHub().getClient();

if (!client || !client.addEventProcessor) {
return;
}

client.addEventProcessor(callback);
}
16 changes: 0 additions & 16 deletions packages/core/src/eventProcessors.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import type { Event, EventHint, EventProcessor } from '@sentry/types';
import { getGlobalSingleton, isThenable, logger, SyncPromise } from '@sentry/utils';

import { getCurrentHub } from './hub';

/**
* Returns the global event processors.
* @deprecated Global event processors will be removed in v8.
Expand All @@ -20,20 +18,6 @@ export function addGlobalEventProcessor(callback: EventProcessor): void {
getGlobalEventProcessors().push(callback);
}

/**
* Add an event processor to the current client.
* This event processor will run for all events processed by this client.
*/
export function addEventProcessor(callback: EventProcessor): void {
const client = getCurrentHub().getClient();

if (!client || !client.addEventProcessor) {
return;
}

client.addEventProcessor(callback);
}

/**
* Process an array of event processors, returning the processed event (or `null` if the event was dropped).
*/
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ export { Scope } from './scope';
export {
// eslint-disable-next-line deprecation/deprecation
addGlobalEventProcessor,
addEventProcessor,
} from './eventProcessors';
export { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint } from './api';
export { BaseClient } from './baseclient';
export { BaseClient, addEventProcessor } from './baseclient';
export { ServerRuntimeClient } from './server-runtime-client';
export { initAndBind } from './sdk';
export { createTransport } from './transports/base';
Expand Down

0 comments on commit f8ed063

Please sign in to comment.