@@ -6,35 +6,35 @@ import { EventPluginContext } from './plugins/EventPluginContext';
6
6
import { Utils } from './Utils' ;
7
7
8
8
export class EventBuilder {
9
- public target :IEvent ;
10
- public client :ExceptionlessClient ;
11
- public pluginContextData :ContextData ;
9
+ public target : IEvent ;
10
+ public client : ExceptionlessClient ;
11
+ public pluginContextData : ContextData ;
12
12
13
- private _validIdentifierErrorMessage :string = 'must contain between 8 and 100 alphanumeric or \'-\' characters.' ; // optimization for minifier.
13
+ private _validIdentifierErrorMessage : string = 'must contain between 8 and 100 alphanumeric or \'-\' characters.' ; // optimization for minifier.
14
14
15
- constructor ( event :IEvent , client :ExceptionlessClient , pluginContextData ?:ContextData ) {
15
+ constructor ( event : IEvent , client : ExceptionlessClient , pluginContextData ?: ContextData ) {
16
16
this . target = event ;
17
17
this . client = client ;
18
18
this . pluginContextData = pluginContextData || new ContextData ( ) ;
19
19
}
20
20
21
- public setType ( type :string ) : EventBuilder {
21
+ public setType ( type : string ) : EventBuilder {
22
22
if ( ! ! type ) {
23
23
this . target . type = type ;
24
24
}
25
25
26
26
return this ;
27
27
}
28
28
29
- public setSource ( source :string ) : EventBuilder {
29
+ public setSource ( source : string ) : EventBuilder {
30
30
if ( ! ! source ) {
31
31
this . target . source = source ;
32
32
}
33
33
34
34
return this ;
35
35
}
36
36
37
- public setSessionId ( sessionId :string ) : EventBuilder {
37
+ public setSessionId ( sessionId : string ) : EventBuilder {
38
38
if ( ! this . isValidIdentifier ( sessionId ) ) {
39
39
throw new Error ( `SessionId ${ this . _validIdentifierErrorMessage } ` ) ;
40
40
}
@@ -43,7 +43,7 @@ export class EventBuilder {
43
43
return this ;
44
44
}
45
45
46
- public setReferenceId ( referenceId :string ) : EventBuilder {
46
+ public setReferenceId ( referenceId : string ) : EventBuilder {
47
47
if ( ! this . isValidIdentifier ( referenceId ) ) {
48
48
throw new Error ( `ReferenceId ${ this . _validIdentifierErrorMessage } ` ) ;
49
49
}
@@ -52,7 +52,7 @@ export class EventBuilder {
52
52
return this ;
53
53
}
54
54
55
- public setMessage ( message :string ) : EventBuilder {
55
+ public setMessage ( message : string ) : EventBuilder {
56
56
if ( ! ! message ) {
57
57
this . target . message = message ;
58
58
}
@@ -73,10 +73,10 @@ export class EventBuilder {
73
73
return this ;
74
74
}
75
75
76
- public setUserIdentity ( userInfo :IUserInfo ) : EventBuilder ;
77
- public setUserIdentity ( identity :string ) : EventBuilder ;
78
- public setUserIdentity ( identity :string , name :string ) : EventBuilder ;
79
- public setUserIdentity ( userInfoOrIdentity :IUserInfo | string , name ?:string ) : EventBuilder {
76
+ public setUserIdentity ( userInfo : IUserInfo ) : EventBuilder ;
77
+ public setUserIdentity ( identity : string ) : EventBuilder ;
78
+ public setUserIdentity ( identity : string , name : string ) : EventBuilder ;
79
+ public setUserIdentity ( userInfoOrIdentity : IUserInfo | string , name ?: string ) : EventBuilder {
80
80
let userInfo = typeof userInfoOrIdentity !== 'string' ? userInfoOrIdentity : { identity : userInfoOrIdentity , name : name } ;
81
81
if ( ! userInfo || ( ! userInfo . identity && ! userInfo . name ) ) {
82
82
return this ;
@@ -86,15 +86,15 @@ export class EventBuilder {
86
86
return this ;
87
87
}
88
88
89
- public setValue ( value :number ) : EventBuilder {
89
+ public setValue ( value : number ) : EventBuilder {
90
90
if ( ! ! value ) {
91
91
this . target . value = value ;
92
92
}
93
93
94
94
return this ;
95
95
}
96
96
97
- public addTags ( ...tags :string [ ] ) : EventBuilder {
97
+ public addTags ( ...tags : string [ ] ) : EventBuilder {
98
98
this . target . tags = Utils . addRange < string > ( this . target . tags , ...tags ) ;
99
99
return this ;
100
100
}
@@ -107,7 +107,7 @@ export class EventBuilder {
107
107
* @param maxDepth The max depth of the object to include.
108
108
* @param excludedPropertyNames Any property names that should be excluded.
109
109
*/
110
- public setProperty ( name :string , value :any , maxDepth ?:number , excludedPropertyNames ?:string [ ] ) : EventBuilder {
110
+ public setProperty ( name : string , value : any , maxDepth ?: number , excludedPropertyNames ?: string [ ] ) : EventBuilder {
111
111
if ( ! name || ( value === undefined || value == null ) ) {
112
112
return this ;
113
113
}
@@ -124,27 +124,27 @@ export class EventBuilder {
124
124
return this ;
125
125
}
126
126
127
- public markAsCritical ( critical :boolean ) : EventBuilder {
127
+ public markAsCritical ( critical : boolean ) : EventBuilder {
128
128
if ( critical ) {
129
129
this . addTags ( 'Critical' ) ;
130
130
}
131
131
132
132
return this ;
133
133
}
134
134
135
- public addRequestInfo ( request :Object ) : EventBuilder {
135
+ public addRequestInfo ( request : Object ) : EventBuilder {
136
136
if ( ! ! request ) {
137
137
this . pluginContextData [ '@request' ] = request ;
138
138
}
139
139
140
140
return this ;
141
141
}
142
142
143
- public submit ( callback ?:( context :EventPluginContext ) => void ) : void {
143
+ public submit ( callback ?: ( context : EventPluginContext ) => void ) : void {
144
144
this . client . submitEvent ( this . target , this . pluginContextData , callback ) ;
145
145
}
146
146
147
- private isValidIdentifier ( value :string ) : boolean {
147
+ private isValidIdentifier ( value : string ) : boolean {
148
148
if ( ! value ) {
149
149
return true ;
150
150
}
0 commit comments