1
1
import { Breadcrumb , Context , SdkInfo , SentryEvent } from '@sentry/shim' ;
2
2
import { DSN } from './dsn' ;
3
- import { Backend , Frontend , Options , Scope } from './interfaces' ;
3
+ import { Backend , Client , Options , Scope } from './interfaces' ;
4
4
import { SendStatus } from './status' ;
5
5
6
6
/**
@@ -17,49 +17,49 @@ const MAX_BREADCRUMBS = 100;
17
17
18
18
/** A class object that can instanciate Backend objects. */
19
19
export interface BackendClass < B extends Backend , O extends Options > {
20
- new ( frontend : Frontend < O > ) : B ;
20
+ new ( options : O ) : B ;
21
21
}
22
22
23
23
/**
24
- * Base implementation for all JavaScript SDK frontends .
24
+ * Base implementation for all JavaScript SDK clients .
25
25
*
26
26
* Call the constructor with the corresponding backend constructor and options
27
- * specific to the frontend subclass. To access these options later, use
28
- * {@link Frontend .getOptions}. Also, the Backend instance is available via
29
- * {@link Frontend .getBackend}.
27
+ * specific to the client subclass. To access these options later, use
28
+ * {@link Client .getOptions}. Also, the Backend instance is available via
29
+ * {@link Client .getBackend}.
30
30
*
31
31
* Subclasses must implement one abstract method: {@link getSdkInfo}. It must
32
32
* return the unique name and the version of the SDK.
33
33
*
34
34
* If a DSN is specified in the options, it will be parsed and stored. Use
35
- * {@link Frontend .getDSN} to retrieve the DSN at any moment. In case the DSN is
35
+ * {@link Client .getDSN} to retrieve the DSN at any moment. In case the DSN is
36
36
* invalid, the constructor will throw a {@link SentryException}. Note that
37
37
* without a valid DSN, the SDK will not send any events to Sentry.
38
38
*
39
39
* Before sending an event via the backend, it is passed through
40
- * {@link FrontendBase .prepareEvent} to add SDK information and scope data
40
+ * {@link BaseClient .prepareEvent} to add SDK information and scope data
41
41
* (breadcrumbs and context). To add more custom information, override this
42
42
* method and extend the resulting prepared event.
43
43
*
44
44
* To issue automatically created events (e.g. via instrumentation), use
45
- * {@link Frontend .captureEvent}. It will prepare the event and pass it through
45
+ * {@link Client .captureEvent}. It will prepare the event and pass it through
46
46
* the callback lifecycle. To issue auto-breadcrumbs, use
47
- * {@link Frontend .addBreadcrumb}.
47
+ * {@link Client .addBreadcrumb}.
48
48
*
49
49
* @example
50
- * class NodeFrontend extends FrontendBase <NodeBackend, NodeOptions> {
50
+ * class NodeClient extends BaseClient <NodeBackend, NodeOptions> {
51
51
* public constructor(options: NodeOptions) {
52
52
* super(NodeBackend, options);
53
53
* }
54
54
*
55
55
* // ...
56
56
* }
57
57
*/
58
- export abstract class FrontendBase < B extends Backend , O extends Options >
59
- implements Frontend < O > {
58
+ export abstract class BaseClient < B extends Backend , O extends Options >
59
+ implements Client < O > {
60
60
/**
61
61
* The backend used to physically interact in the enviornment. Usually, this
62
- * will correspond to the frontend . When composing SDKs, however, the Backend
62
+ * will correspond to the client . When composing SDKs, however, the Backend
63
63
* from the root SDK will be used.
64
64
*/
65
65
private readonly backend : B ;
@@ -76,7 +76,7 @@ export abstract class FrontendBase<B extends Backend, O extends Options>
76
76
/**
77
77
* A scope instance containing breadcrumbs and context, used if none is
78
78
* specified to the public methods. This is specifically used in standalone
79
- * mode, when the Frontend is directly instanciated by the user.
79
+ * mode, when the Client is directly instanciated by the user.
80
80
*/
81
81
private readonly internalScope : Scope ;
82
82
@@ -87,13 +87,13 @@ export abstract class FrontendBase<B extends Backend, O extends Options>
87
87
private installed ?: boolean ;
88
88
89
89
/**
90
- * Initializes this frontend instance.
90
+ * Initializes this client instance.
91
91
*
92
92
* @param backendClass A constructor function to create the backend.
93
- * @param options Options for the frontend .
93
+ * @param options Options for the client .
94
94
*/
95
95
protected constructor ( backendClass : BackendClass < B , O > , options : O ) {
96
- this . backend = new backendClass ( this ) ;
96
+ this . backend = new backendClass ( options ) ;
97
97
this . options = options ;
98
98
99
99
if ( options . dsn ) {
@@ -259,7 +259,7 @@ export abstract class FrontendBase<B extends Backend, O extends Options>
259
259
* Adds common information to events.
260
260
*
261
261
* The information includes release and environment from `options`, SDK
262
- * information returned by {@link FrontendBase .getSdkInfo}, as well as
262
+ * information returned by {@link BaseClient .getSdkInfo}, as well as
263
263
* breadcrumbs and context (extra, tags and user) from the scope.
264
264
*
265
265
* Information that is already present in the event is never overwritten. For
0 commit comments