Skip to content

Commit a75ecb6

Browse files
chore(npm): update dependencies, add tslint
1 parent 02e122a commit a75ecb6

3 files changed

Lines changed: 131 additions & 9 deletions

File tree

src/directLine.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class DirectLine implements IBotConnection {
110110
if (connectionStatus === ConnectionStatus.Uninitialized) {
111111
this.connectionStatus$.next(ConnectionStatus.Connecting);
112112

113-
//if token and streamUrl are defined it means reconnect has already been done. Skipping it.
113+
// if token and streamUrl are defined it means reconnect has already been done. Skipping it.
114114
if (this.token && this.streamUrl) {
115115
this.connectionStatus$.next(ConnectionStatus.Online);
116116
return of(connectionStatus);
@@ -132,8 +132,7 @@ export class DirectLine implements IBotConnection {
132132
map(_ => connectionStatus)
133133
);
134134
}
135-
}
136-
else {
135+
} else {
137136
return of(connectionStatus);
138137
}
139138
}),
@@ -189,7 +188,7 @@ export class DirectLine implements IBotConnection {
189188
}
190189

191190
private startConversation() {
192-
//if conversationid is set here, it means we need to call the reconnect api, else it is a new conversation
191+
// if conversationid is set here, it means we need to call the reconnect api, else it is a new conversation
193192
const url = this.conversationId
194193
? `${this.domain}/conversations/${this.conversationId}?watermark=${this.watermark}`
195194
: `${this.domain}/conversations`;
@@ -304,10 +303,16 @@ export class DirectLine implements IBotConnection {
304303
})
305304
.pipe(
306305
map((ajaxResponse: any) => {
307-
konsole.log("getSessionId response: " + ajaxResponse.response.sessionId);
308-
return ajaxResponse.response.sessionId as string;
306+
if (ajaxResponse && ajaxResponse.response && ajaxResponse.response.sessionId) {
307+
konsole.log("getSessionId response: " + ajaxResponse.response.sessionId);
308+
return ajaxResponse.response.sessionId as string;
309+
}
310+
return '';
309311
}),
310-
catchError((error: any) => this.catchPostError(error))
312+
catchError((error: any) => {
313+
konsole.log("getSessionId error: " + error.status);
314+
return of('');
315+
})
311316
)
312317
),
313318
catchError(error => this.catchExpiredToken(error))
@@ -530,7 +535,7 @@ export class DirectLine implements IBotConnection {
530535
this.token = result.response.token;
531536
this.streamUrl = result.response.streamUrl;
532537
}),
533-
map(_ => null),
538+
map(() => null),
534539
retryWhen(error$ => error$
535540
.pipe(
536541
mergeMap(error => {

src/directline.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface UnknownMedia{
2424
contentType: string,
2525
contentUrl: string,
2626
name?: string,
27-
thumbnailUrl?: string
27+
thumbnailUrl?: string
2828
}
2929

3030
export type CardActionTypes = "openUrl" | "imBack" | "postBack" | "playAudio" | "playVideo" | "showImage" | "downloadFile" | "signin" | "call";

tslint.json

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
{
2+
"rulesDirectory": [
3+
],
4+
"rules": {
5+
"arrow-return-shorthand": true,
6+
"callable-types": true,
7+
"class-name": true,
8+
"comment-format": [
9+
true,
10+
"check-space"
11+
],
12+
"deprecation": {
13+
"severity": "warn"
14+
},
15+
"eofline": true,
16+
"forin": true,
17+
"import-blacklist": [
18+
true,
19+
"rxjs/Rx"
20+
],
21+
"import-spacing": true,
22+
"indent": [
23+
true,
24+
"spaces"
25+
],
26+
"interface-over-type-literal": true,
27+
"member-access": false,
28+
"member-ordering": [
29+
true,
30+
{
31+
"order": [
32+
"static-field",
33+
"instance-field",
34+
"static-method",
35+
"instance-method"
36+
]
37+
}
38+
],
39+
"no-arg": true,
40+
"no-bitwise": true,
41+
"no-console": [
42+
true,
43+
"debug",
44+
"info",
45+
"time",
46+
"timeEnd",
47+
"trace"
48+
],
49+
"no-construct": true,
50+
"no-debugger": true,
51+
"no-duplicate-super": true,
52+
"no-empty": false,
53+
"no-empty-interface": true,
54+
"no-eval": true,
55+
"no-misused-new": true,
56+
"no-non-null-assertion": true,
57+
"no-shadowed-variable": true,
58+
"no-string-literal": false,
59+
"no-string-throw": true,
60+
"no-switch-case-fall-through": true,
61+
"no-unnecessary-initializer": true,
62+
"no-unused-expression": true,
63+
"no-use-before-declare": true,
64+
"no-var-keyword": true,
65+
"object-literal-sort-keys": false,
66+
"one-line": [
67+
true,
68+
"check-open-brace",
69+
"check-catch",
70+
"check-else",
71+
"check-whitespace"
72+
],
73+
"radix": true,
74+
"typedef-whitespace": [
75+
true,
76+
{
77+
"call-signature": "nospace",
78+
"index-signature": "nospace",
79+
"parameter": "nospace",
80+
"property-declaration": "nospace",
81+
"variable-declaration": "nospace"
82+
}
83+
],
84+
"unified-signatures": true,
85+
"variable-name": false,
86+
"whitespace": [
87+
true,
88+
"check-branch",
89+
"check-decl",
90+
"check-operator",
91+
"check-separator",
92+
"check-type"
93+
],
94+
"directive-selector": [
95+
true,
96+
"attribute",
97+
"app",
98+
"camelCase"
99+
],
100+
"component-selector": [
101+
true,
102+
"element",
103+
"app",
104+
"kebab-case"
105+
],
106+
"no-output-on-prefix": true,
107+
"use-input-property-decorator": true,
108+
"use-output-property-decorator": true,
109+
"use-host-property-decorator": true,
110+
"no-input-rename": true,
111+
"no-output-rename": true,
112+
"use-life-cycle-interface": true,
113+
"use-pipe-transform-interface": true,
114+
"component-class-suffix": true,
115+
"directive-class-suffix": true
116+
}
117+
}

0 commit comments

Comments
 (0)