@sentry/core

  • Version 7.10.0
  • Published
  • 221 kB
  • 4 dependencies
  • BSD-3-Clause license

Install

npm i @sentry/core
yarn add @sentry/core
pnpm add @sentry/core

Overview

Base implementation for all Sentry JavaScript SDKs

Index

Variables

variable SDK_VERSION

const SDK_VERSION: string;

    Functions

    function createTransport

    createTransport: (
    options: InternalBaseTransportOptions,
    makeRequest: TransportRequestExecutor,
    buffer?: PromiseBuffer<void>
    ) => Transport;
    • Creates an instance of a Sentry Transport

      Parameter options

      Parameter makeRequest

    function getEnvelopeEndpointWithUrlEncodedAuth

    getEnvelopeEndpointWithUrlEncodedAuth: (
    dsn: DsnComponents,
    tunnelOrOptions?: string | ClientOptions
    ) => string;
    • Returns the envelope endpoint URL with auth in the query string.

      Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.

    function getIntegrationsToSetup

    getIntegrationsToSetup: (options: Options) => Integration[];
    • Gets integration to install

    function getReportDialogEndpoint

    getReportDialogEndpoint: (
    dsnLike: DsnLike,
    dialogOptions: { [key: string]: any; user?: { name?: string; email?: string } }
    ) => string;
    • Returns the url to the report dialog endpoint.

    function initAndBind

    initAndBind: <F extends Client, O extends ClientOptions>(
    clientClass: ClientClass<F, O>,
    options: O
    ) => void;
    • Internal function to create a new SDK client instance. The client is installed and then bound to the current scope.

      Parameter clientClass

      The client class to instantiate.

      Parameter options

      Options to pass to the client.

    Classes

    class BaseClient

    abstract class BaseClient<O extends ClientOptions> implements Client<O> {}
    • Base implementation for all JavaScript SDK clients.

      Call the constructor with the corresponding options specific to the client subclass. To access these options later, use Client.getOptions.

      If a Dsn is specified in the options, it will be parsed and stored. Use Client.getDsn to retrieve the Dsn at any moment. In case the Dsn is invalid, the constructor will throw a SentryException. Note that without a valid Dsn, the SDK will not send any events to Sentry.

      Before sending an event, it is passed through BaseClient._prepareEvent to add SDK information and scope data (breadcrumbs and context). To add more custom information, override this method and extend the resulting prepared event.

      To issue automatically created events (e.g. via instrumentation), use Client.captureEvent. It will prepare the event and pass it through the callback lifecycle. To issue auto-breadcrumbs, use Client.addBreadcrumb.

      Example 1

      class NodeClient extends BaseClient { public constructor(options: NodeOptions) { super(options); }

      // ... }

    constructor

    protected constructor(options: ClientOptions);
    • Initializes this client instance.

      Parameter options

      Options for the client.

    method captureEvent

    captureEvent: (
    event: Event,
    hint?: EventHint,
    scope?: Scope
    ) => string | undefined;

    method captureException

    captureException: (
    exception: any,
    hint?: EventHint,
    scope?: Scope
    ) => string | undefined;

    method captureMessage

    captureMessage: (
    message: string,
    level?: Severity | SeverityLevel,
    hint?: EventHint,
    scope?: Scope
    ) => string | undefined;

    method captureSession

    captureSession: (session: Session) => void;

    method close

    close: (timeout?: number) => PromiseLike<boolean>;

    method eventFromException

    abstract eventFromException: (
    _exception: any,
    _hint?: EventHint
    ) => PromiseLike<Event>;

    method eventFromMessage

    abstract eventFromMessage: (
    _message: string,
    _level?: Severity | SeverityLevel,
    _hint?: EventHint
    ) => PromiseLike<Event>;

    method flush

    flush: (timeout?: number) => PromiseLike<boolean>;

    method getDsn

    getDsn: () => DsnComponents | undefined;

    method getIntegration

    getIntegration: <T extends Integration>(
    integration: IntegrationClass<T>
    ) => T | null;

    method getIntegrationById

    getIntegrationById: (integrationId: string) => Integration | undefined;
    • Gets an installed integration by its id.

      Returns

      The installed integration or undefined if no integration with that id was installed.

    method getOptions

    getOptions: () => O;

    method getTransport

    getTransport: () => Transport | undefined;

    method recordDroppedEvent

    recordDroppedEvent: (reason: EventDropReason, category: DataCategory) => void;

    method sendEvent

    sendEvent: (event: Event, hint?: EventHint) => void;

    method sendSession

    sendSession: (session: Session | SessionAggregates) => void;

    method setupIntegrations

    setupIntegrations: () => void;
    • Sets up the integrations

    class FunctionToString

    class FunctionToString implements Integration {}
    • Patch toString calls to return proper name for wrapped functions

    property id

    static id: string;

    property name

    name: string;

    method setupOnce

    setupOnce: () => void;

    class InboundFilters

    class InboundFilters implements Integration {}
    • Inbound filters configurable by the user

    constructor

    constructor(_options?: Partial<InboundFiltersOptions>);

      property id

      static id: string;

      property name

      name: string;

      method setupOnce

      setupOnce: (
      addGlobalEventProcessor: (processor: EventProcessor) => void,
      getCurrentHub: () => Hub
      ) => void;

      Type Aliases

      type ClientClass

      type ClientClass<F extends Client, O extends ClientOptions> = new (options: O) => F;
      • A class object that can instantiate Client objects.

      Namespaces

      namespace Integrations

      module 'types/integrations/index.d.ts' {}

        class FunctionToString

        class FunctionToString implements Integration {}
        • Patch toString calls to return proper name for wrapped functions

        property id

        static id: string;

        property name

        name: string;

        method setupOnce

        setupOnce: () => void;

        class InboundFilters

        class InboundFilters implements Integration {}
        • Inbound filters configurable by the user

        constructor

        constructor(_options?: Partial<InboundFiltersOptions>);

          property id

          static id: string;

          property name

          name: string;

          method setupOnce

          setupOnce: (
          addGlobalEventProcessor: (processor: EventProcessor) => void,
          getCurrentHub: () => Hub
          ) => void;

          Package Files (10)

          Dependencies (4)

          Dev Dependencies (0)

          No dev dependencies.

          Peer Dependencies (0)

          No peer dependencies.

          Badge

          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@sentry/core.

          • Markdown
            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@sentry/core)
          • HTML
            <a href="https://www.jsdocs.io/package/@sentry/core"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>