Edtran/security Fix eslint (#4)
* Install eslint-plugin-security * Fix eslint errors * Remove tslint rules * Add task to run ESLint * Add missing properties * Add missing brace
This commit is contained in:
Родитель
a8cf19d08b
Коммит
7873ef89b7
|
@ -7,6 +7,7 @@ module.exports = {
|
|||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:security/recommended'
|
||||
],
|
||||
rules: {
|
||||
'no-async-promise-executor': 'off',
|
||||
|
|
|
@ -27,3 +27,6 @@ jobs:
|
|||
|
||||
- name: Run tests
|
||||
run: npm run test
|
||||
|
||||
- name: Run ESLint
|
||||
run: npm run lint
|
|
@ -2258,6 +2258,15 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"eslint-plugin-security": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-security/-/eslint-plugin-security-1.4.0.tgz",
|
||||
"integrity": "sha512-xlS7P2PLMXeqfhyf3NpqbvbnW04kN8M9NtmhpR3XGyOvt/vNKS7XPXT5EDbwKW9vCjWH4PpfQvgD/+JgN0VJKA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-regex": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"eslint-scope": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
"@typescript-eslint/eslint-plugin": "^4.1.1",
|
||||
"@typescript-eslint/parser": "^4.1.1",
|
||||
"eslint": "^7.9.0",
|
||||
"eslint-plugin-security": "^1.4.0",
|
||||
"jest": "^26.4.2",
|
||||
"ts-jest": "^26.3.0",
|
||||
"typescript": "^3.9.5"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import Constants from '../common/Constants';
|
||||
import HttpHeaders from '../http/HttpHeaders';
|
||||
|
@ -42,11 +43,11 @@ export default class AmsHelper {
|
|||
type: HttpRequestType.POST,
|
||||
url
|
||||
};
|
||||
const responseData = await HttpClient.MakeRequest({...requestParameters, url: "https://httpbin.org/post" });
|
||||
return HttpClient.MakeRequest<any>(requestParameters); // tslint:disable-line:no-any
|
||||
|
||||
return HttpClient.MakeRequest<any>(requestParameters);
|
||||
}
|
||||
|
||||
public static async uploadDocument(documentId: string, file: IFileInfo, ic3Info: IIC3Info): Promise<any> { // tslint:disable-line:no-any
|
||||
public static async uploadDocument(documentId: string, file: IFileInfo, ic3Info: IIC3Info): Promise<any> {
|
||||
console.log(`AmsHelper.ts uploadDocument(): ${documentId}, ${file}, ${ic3Info}`);
|
||||
const isFileImage = Util.isDocumentTypeImage(file.type);
|
||||
const url = ServiceEndpointHelper.getAmsObjectContentUrl(documentId, ic3Info.RegionGtms, isFileImage);
|
||||
|
@ -58,9 +59,8 @@ export default class AmsHelper {
|
|||
type: HttpRequestType.PUT,
|
||||
url
|
||||
};
|
||||
const responseData = await HttpClient.MakeRequest({...requestParameters, url: "https://httpbin.org/put" });
|
||||
console.log("EHTESH", responseData);
|
||||
return HttpClient.MakeRequest<any>(requestParameters); // tslint:disable-line:no-any
|
||||
|
||||
return HttpClient.MakeRequest<any>(requestParameters);
|
||||
}
|
||||
|
||||
public static getFileStatus(fileInfo: IFileMetadata, ic3Info: IIC3Info): Promise<FileStatus> {
|
||||
|
@ -97,19 +97,18 @@ export default class AmsHelper {
|
|||
return new Promise<Blob>((resolve) => {
|
||||
this.getViewUri(statusUri, ic3Info).then((vUrl: string) => {
|
||||
const headers = new Headers();
|
||||
/* tslint:disable:no-string-literal object-literal-key-quotes*/
|
||||
headers.append("Authorization", "skype_token " + ic3Info.SkypeToken);
|
||||
headers.append("X-MS-Client-Version", Constants.ClientVersion);
|
||||
if (isFileImage) {
|
||||
headers.append("accept", Constants.AMSAcceptHeaderValue);
|
||||
headers.append("Accept-Encoding", Constants.AMSAcceptEncodingHeaderValue);
|
||||
}
|
||||
/* tslint:enable:no-string-literal object-literal-key-quotes*/
|
||||
|
||||
const requestParameters: RequestInit = {
|
||||
headers,
|
||||
method: HttpRequestType.GET
|
||||
};
|
||||
return fetch(vUrl, requestParameters) // tslint:disable-line:no-any
|
||||
return fetch(vUrl, requestParameters)
|
||||
.then((response) => {
|
||||
resolve((response.blob()));
|
||||
})
|
||||
|
@ -148,7 +147,7 @@ export default class AmsHelper {
|
|||
|
||||
private static getViewStatus(url: string, ic3Info: IIC3Info): Promise<IAMSViewResponse> {
|
||||
console.log(`AmsHelper.ts getViewStatus(): ${url}, ${ic3Info}`);
|
||||
return new Promise((resolve: () => any) => { // tslint:disable-line:no-any
|
||||
return new Promise((resolve: () => any) => {
|
||||
setTimeout(resolve, Constants.DelayForAms);
|
||||
}).then(() => {
|
||||
const headers = RequestHelper.getDefaultAMSViewHeaders(ic3Info.SkypeToken);
|
||||
|
@ -157,7 +156,7 @@ export default class AmsHelper {
|
|||
type: HttpRequestType.GET,
|
||||
url
|
||||
};
|
||||
return HttpClient.MakeRequest<any>(requestParameters) // tslint:disable-line:no-any
|
||||
return HttpClient.MakeRequest<any>(requestParameters)
|
||||
.then((response: IAMSViewResponse): Promise<IAMSViewResponse> => {
|
||||
if (response.status_location && !response.view_state) {
|
||||
return this.getViewStatus(response.status_location, ic3Info);
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-inferrable-types */
|
||||
|
||||
import Constants from './Constants';
|
||||
import HttpHeaders from '../http/HttpHeaders';
|
||||
import Utilities from '../common/Utilities';
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable no-useless-escape */
|
||||
|
||||
import Constants from "./Constants";
|
||||
import DeliveryMode from "../model/DeliveryMode";
|
||||
import FileSharingProtocolType from "../model/FileSharingProtocolType";
|
||||
|
@ -61,7 +65,7 @@ export default class Util {
|
|||
}
|
||||
|
||||
public static createTypingStatusThreadMessageData(typingStatus: TypingStatus, optionalProperties?: IMessageProperties): IMessagePayload {
|
||||
let messageType: string = "";
|
||||
let messageType = "";
|
||||
switch (typingStatus) {
|
||||
case TypingStatus.Typing:
|
||||
messageType = MessagePayloadType.ControlTyping;
|
||||
|
@ -151,7 +155,7 @@ export default class Util {
|
|||
let name = '';
|
||||
let extension = '';
|
||||
if (nameAndExtensionMatcher.length > 1) {
|
||||
extension = nameAndExtensionMatcher.pop()!.toLowerCase();
|
||||
extension = nameAndExtensionMatcher.pop()!.toLowerCase(); // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
||||
name = nameAndExtensionMatcher.join('.');
|
||||
} else {
|
||||
extension = '';
|
||||
|
@ -228,8 +232,8 @@ export default class Util {
|
|||
return (matches && matches[1]) ? matches[1] : undefined;
|
||||
}
|
||||
|
||||
public static isSystemMessage(message: IIC3Message) {
|
||||
let isSystemMessage: boolean = false;
|
||||
public static isSystemMessage(message: IIC3Message): boolean {
|
||||
let isSystemMessage = false;
|
||||
if (!Utilities.isNullOrEmptyString(message.messagetype)) {
|
||||
isSystemMessage = Util.getSystemMessageTypes().reduce((isSystemMessageTillNow: any, systemMessageType: any) => {
|
||||
return isSystemMessageTillNow || message.messagetype.toLowerCase().indexOf(systemMessageType.toLowerCase()) === 0;
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import HttpHeaders from "../http/HttpHeaders";
|
||||
import ITimer from "./ITimer";
|
||||
|
||||
export default class Utilities {
|
||||
public static isNullOrEmptyString(s: string) {
|
||||
public static isNullOrEmptyString(s: string): boolean {
|
||||
return Utilities.isNullOrUndefined(s) || s === "";
|
||||
}
|
||||
|
||||
public static isNullOrUndefinedOrEmptyArray(obj: any[]) {
|
||||
public static isNullOrUndefinedOrEmptyArray(obj: any[]): boolean {
|
||||
return Utilities.isNullOrUndefined(obj) || obj.length === 0;
|
||||
}
|
||||
|
||||
public static isNullOrUndefined(obj: any) {
|
||||
public static isNullOrUndefined(obj: any): boolean { // eslint-disable-line @typescript-eslint/explicit-module-boundary-types
|
||||
return (obj === null || obj === undefined);
|
||||
}
|
||||
|
||||
public static isPrimitiveString(obj: any) {
|
||||
public static isPrimitiveString(obj: any): boolean { // eslint-disable-line @typescript-eslint/explicit-module-boundary-types
|
||||
return (typeof obj === "string");
|
||||
}
|
||||
|
||||
|
@ -22,11 +24,11 @@ export default class Utilities {
|
|||
return (!Utilities.isNullOrUndefined(input) && input.toLowerCase() === "true");
|
||||
}
|
||||
|
||||
public static sanitizeUrlWithBackSlash(url: string) {
|
||||
public static sanitizeUrlWithBackSlash(url: string): string {
|
||||
return url.endsWith("/") ? url : url + "/";
|
||||
}
|
||||
|
||||
public static getRegistrationTokenValue(registrationTokenHeader: string) {
|
||||
public static getRegistrationTokenValue(registrationTokenHeader: string): string {
|
||||
const regToken = registrationTokenHeader.match(/registrationToken=(.+); expires=(\d+)/);
|
||||
if (regToken && regToken.length >= 2) {
|
||||
return HttpHeaders.RegistrationTokenHeaderValue + regToken[1];
|
||||
|
@ -41,8 +43,8 @@ export default class Utilities {
|
|||
finalPath += "?";
|
||||
}
|
||||
for (const queryParamKey in queryParameters) {
|
||||
if (queryParameters.hasOwnProperty(queryParamKey)) {
|
||||
let queryParamData = queryParamKey + "=" + queryParameters[queryParamKey];
|
||||
if (queryParameters.hasOwnProperty(queryParamKey)) { // eslint-disable-line no-prototype-builtins
|
||||
let queryParamData = queryParamKey + "=" + queryParameters[queryParamKey]; // eslint-disable-line security/detect-object-injection
|
||||
if (finalPath[finalPath.length - 1] !== "?") {
|
||||
queryParamData = "&" + queryParamData;
|
||||
}
|
||||
|
@ -53,10 +55,10 @@ export default class Utilities {
|
|||
return finalPath;
|
||||
}
|
||||
|
||||
public static getResponseHeader(jqXHR: any, headerName: string): string {
|
||||
public static getResponseHeader(jqXHR: any, headerName: string): string { // eslint-disable-line @typescript-eslint/explicit-module-boundary-types
|
||||
let headerValue;
|
||||
if (!Utilities.isNullOrUndefined(jqXHR)) {
|
||||
headerValue = jqXHR.headers[headerName];
|
||||
headerValue = jqXHR.headers[headerName]; // eslint-disable-line security/detect-object-injection
|
||||
}
|
||||
return headerValue;
|
||||
}
|
||||
|
@ -77,7 +79,7 @@ export default class Utilities {
|
|||
};
|
||||
}
|
||||
|
||||
public static concatArrays(arr1: any[], arr2: any[]) {
|
||||
public static concatArrays(arr1: any[], arr2: any[]): void {
|
||||
if (!Utilities.isNullOrUndefined(arr1) && !Utilities.isNullOrUndefined(arr2)) {
|
||||
arr2.forEach((entry) => {
|
||||
arr1.push(entry);
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
|
||||
import HostType from "../interfaces/HostType";
|
||||
import ProtocolType from "../interfaces/ProtocoleType";
|
||||
import IConversation from "../model/IConversation";
|
||||
|
@ -55,7 +58,7 @@ export default abstract class ClientBridge implements IRawSDK {
|
|||
public abstract sendMessageToBot(conversation: IRawConversation, botId: string, botMessage: IRawBotMessage): Promise<void>;
|
||||
public abstract getMembers(conversation: IRawConversation): Promise<IPerson[]>;
|
||||
|
||||
public setDebug(flag: boolean) {
|
||||
public setDebug(flag: boolean): void {
|
||||
this.debug = flag;
|
||||
}
|
||||
|
||||
|
@ -82,11 +85,11 @@ export default abstract class ClientBridge implements IRawSDK {
|
|||
});
|
||||
}
|
||||
|
||||
public async registerOnNewMessage(conversation: IRawConversation, callback: (message: IRawMessage) => void) {
|
||||
public async registerOnNewMessage(conversation: IRawConversation, callback: (message: IRawMessage) => void): Promise<void> {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public async registerOnThreadUpdate(conversation: IRawConversation, callback: (message: IRawThread) => void) {
|
||||
public async registerOnThreadUpdate(conversation: IRawConversation, callback: (message: IRawThread) => void): Promise<void> {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
|
||||
import ClientBridge from "./ClientBridge";
|
||||
import FileSharingProtocolType from "../model/FileSharingProtocolType";
|
||||
import FileStatus from "../model/FileStatus";
|
||||
|
@ -94,17 +96,17 @@ export default class FramelessBridge extends ClientBridge {
|
|||
return this.protocolAdapter.getMembers(conversation);
|
||||
}
|
||||
|
||||
public async registerOnNewMessage(conversation: IRawConversation, callback: (message: IRawMessage) => void) {
|
||||
public async registerOnNewMessage(conversation: IRawConversation, callback: (message: IRawMessage) => void): Promise<void> {
|
||||
this.protocolAdapter.registerOnNewMessage(conversation, callback);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public async registerOnThreadUpdate(conversation: IRawConversation, callback: (message: IRawThread) => void) {
|
||||
public async registerOnThreadUpdate(conversation: IRawConversation, callback: (message: IRawThread) => void): Promise<void> {
|
||||
this.protocolAdapter.registerOnThreadUpdate(conversation, callback);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public setDebug(flag: boolean = false) {
|
||||
public setDebug(flag = false): void {
|
||||
this.protocolAdapter.setDebug(flag);
|
||||
}
|
||||
}
|
|
@ -1,3 +1,7 @@
|
|||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import AmsHelper from "../ams/AmsHelper";
|
||||
import Constants from "../common/Constants";
|
||||
import FileSharingProtocolType from "../model/FileSharingProtocolType";
|
||||
|
@ -65,11 +69,11 @@ export default abstract class IC3ClientAdapter implements IIC3Adapter {
|
|||
this.debug = false;
|
||||
}
|
||||
|
||||
public startPolling() {
|
||||
public startPolling(): void {
|
||||
this.ic3Initializer && this.ic3Initializer.startPolling();
|
||||
}
|
||||
|
||||
public stopPolling() {
|
||||
public stopPolling(): void {
|
||||
this.ic3Initializer && this.ic3Initializer.stopPolling();
|
||||
}
|
||||
|
||||
|
@ -97,7 +101,7 @@ export default abstract class IC3ClientAdapter implements IIC3Adapter {
|
|||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public joinConversation(conversationId: string, sendHeartBeat: boolean = true): Promise<IRawConversation> {
|
||||
public joinConversation(conversationId: string, sendHeartBeat = true): Promise<IRawConversation> {
|
||||
const timer = Utilities.timer();
|
||||
const conversation: IRawConversation = {
|
||||
id: conversationId
|
||||
|
@ -114,7 +118,7 @@ export default abstract class IC3ClientAdapter implements IIC3Adapter {
|
|||
ElapsedTimeInMilliseconds: timer.milliSecondsElapsed,
|
||||
EndpointUrl: this.EndpointUrl,
|
||||
EndpointId: this.EndpointId
|
||||
} as any);
|
||||
});
|
||||
|
||||
if (!Utilities.isNullOrUndefined(sendHeartBeat) && sendHeartBeat === true) {
|
||||
this.sendHeartBeat(conversation.id);
|
||||
|
@ -135,14 +139,14 @@ export default abstract class IC3ClientAdapter implements IIC3Adapter {
|
|||
return this.sendMessageToIC3(conversationId, messagePayload).then(() => {
|
||||
this.liveStateFailureCount = 0;
|
||||
return Promise.resolve();
|
||||
}).catch((e: any) => {
|
||||
}).catch((e) => {
|
||||
this.liveStateFailureCount++;
|
||||
if (this.liveStateFailureCount >= Constants.liveStateRetryCount) {
|
||||
this.logger?.log(LogLevel.ERROR, IC3TelemetryEvent.SendLiveStateFailure, {
|
||||
ExceptionDetails: e,
|
||||
EndpointUrl: this.EndpointUrl,
|
||||
EndpointId: this.EndpointId
|
||||
} as any);
|
||||
});
|
||||
this.stopHeartBeat();
|
||||
this.liveStateFailureCount = 0;
|
||||
}
|
||||
|
@ -154,7 +158,7 @@ export default abstract class IC3ClientAdapter implements IIC3Adapter {
|
|||
*
|
||||
* @param conversationId Conversation id
|
||||
*/
|
||||
public sendHeartBeat(conversationId: string) {
|
||||
public sendHeartBeat(conversationId: string): void {
|
||||
if (!this.heartBeatTimer) {
|
||||
this.debug && console.debug("IC3Core/sendHeartBeat");
|
||||
this.sendLiveState(conversationId);
|
||||
|
@ -162,7 +166,7 @@ export default abstract class IC3ClientAdapter implements IIC3Adapter {
|
|||
}
|
||||
}
|
||||
|
||||
public stopHeartBeat() {
|
||||
public stopHeartBeat(): void {
|
||||
clearInterval(this.heartBeatTimer);
|
||||
}
|
||||
|
||||
|
@ -208,7 +212,7 @@ export default abstract class IC3ClientAdapter implements IIC3Adapter {
|
|||
this.logger?.log(LogLevel.INFO, IC3TelemetryEvent.RegisterOnNewMessage, {
|
||||
EndpointUrl: this.EndpointUrl,
|
||||
EndpointId: this.EndpointId
|
||||
} as any);
|
||||
});
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
|
@ -217,7 +221,7 @@ export default abstract class IC3ClientAdapter implements IIC3Adapter {
|
|||
this.logger?.log(LogLevel.INFO, IC3TelemetryEvent.RegisterOnThreadUpdate, {
|
||||
EndpointUrl: this.EndpointUrl,
|
||||
EndpointId: this.EndpointId
|
||||
} as any);
|
||||
});
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
|
@ -386,7 +390,7 @@ export default abstract class IC3ClientAdapter implements IIC3Adapter {
|
|||
return HttpClient.MakeRequest<any>(requestParameters);
|
||||
}
|
||||
|
||||
protected onNewMessage(conversation: IRawConversation, message: IIC3Message, resourceType?: ResourceType) {
|
||||
protected onNewMessage(conversation: IRawConversation, message: IIC3Message, resourceType?: ResourceType): void {
|
||||
const timer = Utilities.timer();
|
||||
try {
|
||||
if (conversation) {
|
||||
|
@ -407,12 +411,12 @@ export default abstract class IC3ClientAdapter implements IIC3Adapter {
|
|||
ElapsedTimeInMilliseconds: elapsedTimeInMilliseconds,
|
||||
EndpointUrl: this.EndpointUrl,
|
||||
EndpointId: this.EndpointId
|
||||
} as any);
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
protected onThreadUpdate(conversation: IRawConversation, message: IIC3Thread) {
|
||||
protected onThreadUpdate(conversation: IRawConversation, message: IIC3Thread): void {
|
||||
const timer = Utilities.timer();
|
||||
try {
|
||||
if (conversation) {
|
||||
|
@ -431,7 +435,7 @@ export default abstract class IC3ClientAdapter implements IIC3Adapter {
|
|||
ElapsedTimeInMilliseconds: elapsedTimeInMilliseconds,
|
||||
EndpointUrl: this.EndpointUrl,
|
||||
EndpointId: this.EndpointId
|
||||
} as any);
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -454,7 +458,7 @@ export default abstract class IC3ClientAdapter implements IIC3Adapter {
|
|||
private getMessagesFromBackwardLinkUrl(backwardLinkUrl: string, startTime: number): Promise<IIC3GetMessagesResponse> {
|
||||
const startTimeQueryParameter = { startTime };
|
||||
const url = Utilities.addQueryParametersToPath(backwardLinkUrl, startTimeQueryParameter);
|
||||
const headers:any = RequestHelper.getDefaultIC3Headers();
|
||||
const headers: any = RequestHelper.getDefaultIC3Headers();
|
||||
headers[HttpHeaders.RegistrationTokenHeader] = this.ic3Info!.RegistrationToken;
|
||||
headers[HttpHeaders.ContentTypeHeader] = Constants.ContentTypeJson;
|
||||
const requestParameters: IHttpRequestAttributes = {
|
||||
|
@ -480,7 +484,7 @@ export default abstract class IC3ClientAdapter implements IIC3Adapter {
|
|||
}
|
||||
}
|
||||
|
||||
public setDebug(flag: boolean = false) {
|
||||
public setDebug(flag = false): void {
|
||||
this.debug = flag;
|
||||
}
|
||||
}
|
|
@ -1,3 +1,7 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable security/detect-object-injection */
|
||||
|
||||
import Constants from '../common/Constants';
|
||||
import HostType from "../interfaces/HostType";
|
||||
import HttpHeaders from '../http/HttpHeaders';
|
||||
|
@ -38,11 +42,11 @@ export default class IC3ClientV1Adapter extends IC3ClientAdapter implements IIC3
|
|||
this.ic3Initializer = new IC3Initializer();
|
||||
}
|
||||
|
||||
public startPolling() {
|
||||
public startPolling(): void {
|
||||
super.startPolling();
|
||||
}
|
||||
|
||||
public stopPolling() {
|
||||
public stopPolling(): void {
|
||||
super.stopPolling();
|
||||
}
|
||||
|
||||
|
@ -81,7 +85,7 @@ export default class IC3ClientV1Adapter extends IC3ClientAdapter implements IIC3
|
|||
});
|
||||
}
|
||||
|
||||
public async dispose() {
|
||||
public async dispose(): Promise<void> {
|
||||
this.ic3Initializer?.stopPolling();
|
||||
this.heartBeatTimer && clearInterval(this.heartBeatTimer);
|
||||
Promise.resolve();
|
||||
|
@ -96,14 +100,14 @@ export default class IC3ClientV1Adapter extends IC3ClientAdapter implements IIC3
|
|||
members: thread.members
|
||||
};
|
||||
return conversation;
|
||||
}).catch((ex: any) => {
|
||||
}).catch((ex) => {
|
||||
const elapsedTimeInMilliseconds = timer.milliSecondsElapsed;
|
||||
this.logger && this.logger.log(LogLevel.WARN, IC3TelemetryEvent.JoinConversationV1GetThreadRequestFailed,
|
||||
{
|
||||
Description: `Unable to retrieve thread: ${ex}`,
|
||||
ElapsedTimeInMilliseconds: elapsedTimeInMilliseconds,
|
||||
EndpointUrl: this.EndpointUrl, EndpointId: this.ic3Info!.endpointId
|
||||
} as any);
|
||||
});
|
||||
|
||||
this.internalConversationsData[conversation.id] = {
|
||||
id: conversationId,
|
||||
|
@ -262,7 +266,7 @@ export default class IC3ClientV1Adapter extends IC3ClientAdapter implements IIC3
|
|||
this.logger && this.logger.log(LogLevel.INFO, IC3TelemetryEvent.UpdateToken, {
|
||||
EndpointUrl: this.EndpointUrl,
|
||||
EndpointId: this.ic3Info!.endpointId
|
||||
} as any);
|
||||
});
|
||||
const pollDataFromOngoingPoll: IIC3EventMessage[] = [];
|
||||
const handlePollDataFromOngoingPoll = (pollData: IIC3PollResponse) => {
|
||||
if (pollData && pollData.eventMessages) {
|
||||
|
@ -280,7 +284,7 @@ export default class IC3ClientV1Adapter extends IC3ClientAdapter implements IIC3
|
|||
const currentIc3Initializer = this.ic3Initializer!;
|
||||
const newIc3Initializer = new IC3Initializer();
|
||||
|
||||
const currentUpdateTokenClearTimeoutHandle: any = this.updateTokenClearTimeoutHandle; // tslint:disable-line:no-any
|
||||
const currentUpdateTokenClearTimeoutHandle: any = this.updateTokenClearTimeoutHandle;
|
||||
const currentIc3Info: IIC3Info = this.ic3Info!;
|
||||
let newIc3Info: IIC3Info;
|
||||
let matchingIC3EventIndex: MatchingIC3EventIndex;
|
||||
|
@ -336,8 +340,8 @@ export default class IC3ClientV1Adapter extends IC3ClientAdapter implements IIC3
|
|||
if (currentRetryCount === Constants.stabilizePollMaxRetryCount) {
|
||||
resolve({ newPollIndex: -1, previousPollIndex: -1 });
|
||||
} else {
|
||||
let ongoingPollIndex: number = 0;
|
||||
let newPollIndex: number = 0;
|
||||
let ongoingPollIndex = 0;
|
||||
let newPollIndex = 0;
|
||||
|
||||
while (ongoingPollIndex < pollDataFromOngoingPoll.length && newPollIndex < pollDataFromNewPoll.length) {
|
||||
const ongoingPollData = pollDataFromOngoingPoll[ongoingPollIndex];
|
||||
|
@ -376,7 +380,7 @@ export default class IC3ClientV1Adapter extends IC3ClientAdapter implements IIC3
|
|||
this.logger && this.logger.log(LogLevel.INFO, IC3TelemetryEvent.SyncingPollData, {
|
||||
EndpointUrl: this.EndpointUrl,
|
||||
EndpointId: this.ic3Info!.endpointId
|
||||
} as any);
|
||||
});
|
||||
|
||||
let previousPollLastIndex = matchingIC3EventIndex.previousPollIndex;
|
||||
let newPollStartIndex = matchingIC3EventIndex.newPollIndex + 1;
|
||||
|
|
|
@ -19,16 +19,16 @@ import IIC3V1EndpointRequest from "../interfaces/IIC3V1EndpointRequest";
|
|||
import IIC3V1Subscription from "../interfaces/IIC3V1Subscription";
|
||||
|
||||
export default class IC3Initializer {
|
||||
public debug: boolean = false;
|
||||
public debug = false;
|
||||
private current404RetryCount: number;
|
||||
private currentOtherRetryCount: number;
|
||||
private skipUnsubscribe: boolean;
|
||||
private telemetryMessage: string;
|
||||
private errorCode: string;
|
||||
private ic3Info: IIC3Info | any;
|
||||
private poller: Poller | any;
|
||||
private ic3Info: IIC3Info | any; // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
private poller: Poller | any; // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
private logger?: IRawLogger;
|
||||
private pollDataHandler: (data: any) => void;
|
||||
private pollDataHandler: (data: any) => void; // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
|
||||
constructor() {
|
||||
this.current404RetryCount = 0;
|
||||
|
@ -36,7 +36,7 @@ export default class IC3Initializer {
|
|||
this.skipUnsubscribe = false;
|
||||
this.telemetryMessage = "";
|
||||
this.errorCode = '';
|
||||
this.pollDataHandler = (data: any) => {};
|
||||
this.pollDataHandler = (data: any) => {}; // eslint-disable-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function, @typescript-eslint/no-explicit-any
|
||||
this.resetRetryCount();
|
||||
}
|
||||
|
||||
|
@ -44,12 +44,12 @@ export default class IC3Initializer {
|
|||
this.logger = logger;
|
||||
}
|
||||
|
||||
public getPoller() {
|
||||
public getPoller(): any { // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
const pollDataHandler = this.pollDataHandler.bind(this);
|
||||
if (!this.poller) {
|
||||
this.poller = new Poller(this.ic3Info, pollDataHandler,
|
||||
this.redirectErrorHandler.bind(this),
|
||||
this.onRequestCreationFailure.bind(this) as any
|
||||
this.onRequestCreationFailure.bind(this) as any // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
);
|
||||
}
|
||||
return this.poller;
|
||||
|
@ -64,7 +64,7 @@ export default class IC3Initializer {
|
|||
this.ic3Info = localIc3Info;
|
||||
}
|
||||
|
||||
public initializeIC3(pollDataHandler?: (data: any) => void): Promise<IIC3Info> {
|
||||
public initializeIC3(pollDataHandler?: (data: any) => void): Promise<IIC3Info> { // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
if (pollDataHandler) {
|
||||
this.pollDataHandler = pollDataHandler;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ export default class IC3Initializer {
|
|||
Description: `Endpoint to poll is ${JSON.stringify(this.ic3Info.RegionGtms.chatService)}`,
|
||||
EndpointUrl: this.ic3Info.RegionGtms.chatService,
|
||||
EndpointId: this.ic3Info.endpointId
|
||||
} as any);
|
||||
});
|
||||
|
||||
const initializeIC3Promise = this.createEndpoint()
|
||||
.then(() => this.createSubscription())
|
||||
|
@ -87,29 +87,29 @@ export default class IC3Initializer {
|
|||
return initializeIC3Promise;
|
||||
}
|
||||
|
||||
public startPolling(handlePollData?: (data: any) => void): void {
|
||||
public startPolling(handlePollData?: (data: any) => void): void { // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
const handler = !handlePollData && this.pollDataHandler? this.pollDataHandler.bind(this): this.pollDataHandler;
|
||||
if (!this.poller) {
|
||||
this.poller = new Poller(this.ic3Info, handler,
|
||||
this.redirectErrorHandler.bind(this),
|
||||
this.onRequestCreationFailure.bind(this) as any
|
||||
this.onRequestCreationFailure.bind(this) as any // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
);
|
||||
}
|
||||
this.poller.ic3Info = this.ic3Info;
|
||||
this.logger?.log(LogLevel.INFO, IC3TelemetryEvent.IC3StartedPolling, {
|
||||
EndpointUrl: this.ic3Info.RegionGtms.chatService,
|
||||
EndpointId: this.ic3Info.endpointId
|
||||
} as any);
|
||||
});
|
||||
this.poller.start();
|
||||
}
|
||||
|
||||
public stopPolling(oldInitializer?: boolean) {
|
||||
public stopPolling(oldInitializer?: boolean): void {
|
||||
const initializer = oldInitializer ? Constants.oldInitializer : Constants.newInitializer;
|
||||
this.logger?.log(LogLevel.INFO, IC3TelemetryEvent.IC3StoppedPolling, {
|
||||
Description: `${initializer} stopped polling.`,
|
||||
EndpointUrl: this.ic3Info.RegionGtms.chatService,
|
||||
EndpointId: this.ic3Info.endpointId
|
||||
} as any);
|
||||
});
|
||||
|
||||
if (this.poller) {
|
||||
this.poller.stop();
|
||||
|
@ -126,11 +126,11 @@ export default class IC3Initializer {
|
|||
this.currentOtherRetryCount = 0;
|
||||
}
|
||||
|
||||
private onEndpointCreationFailure(jqXHR: any) {
|
||||
private onEndpointCreationFailure(jqXHR: any) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
this.onRequestCreationFailure(jqXHR, Constants.endpointRequestLog);
|
||||
}
|
||||
|
||||
private onEndpointCreationSuccess(jqXHR: any) {
|
||||
private onEndpointCreationSuccess(jqXHR: any) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
const registrationTokenHeader = Utilities.getResponseHeader(jqXHR, HttpHeaders.SetRegistrationTokenHeader);
|
||||
if (!Utilities.isNullOrUndefined(registrationTokenHeader)) {
|
||||
this.ic3Info.RegistrationToken = Utilities.getRegistrationTokenValue(registrationTokenHeader);
|
||||
|
@ -138,13 +138,13 @@ export default class IC3Initializer {
|
|||
const locationHeader = Utilities.getResponseHeader(jqXHR, HttpHeaders.LocationHeader);
|
||||
if (!Utilities.isNullOrUndefined(locationHeader)) {
|
||||
// location header value: <CHAT_SERVICE_URL>/v1/users/ME/endpoints/%7B<ENDPOINT_ID>%7D
|
||||
const epidMatch = locationHeader.match(/endpoints\/(%7B[\da-z\-]+%7D)/);
|
||||
(this.ic3Info as any).endpointId = epidMatch && epidMatch[1];
|
||||
const epidMatch = locationHeader.match(/endpoints\/(%7B[\da-z\-]+%7D)/); // eslint-disable-line no-useless-escape
|
||||
this.ic3Info.endpointId = epidMatch && epidMatch[1];
|
||||
this.logger?.log(LogLevel.INFO, IC3TelemetryEvent.IC3EndpointCreationSuccess, {
|
||||
Description: `IC3 endpoint Id is ${this.ic3Info.endpointId}`,
|
||||
EndpointUrl: this.ic3Info.RegionGtms.chatService,
|
||||
EndpointId: this.ic3Info.endpointId
|
||||
} as any);
|
||||
});
|
||||
|
||||
if (jqXHR.status === HttpCode.Created && Util.parseChatServiceHostUrl(locationHeader) !== this.ic3Info.RegionGtms.chatService) {
|
||||
this.ic3Info.RegionGtms.chatService = Util.parseChatServiceHostUrl(locationHeader);
|
||||
|
@ -152,7 +152,7 @@ export default class IC3Initializer {
|
|||
Description: `Endpoint changed`,
|
||||
EndpointUrl: this.ic3Info.RegionGtms.chatService,
|
||||
EndpointId: this.ic3Info.endpointId
|
||||
} as any);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ export default class IC3Initializer {
|
|||
*/
|
||||
private createEndpointRequest() {
|
||||
const url = ServiceEndpointHelper.getV1EndpointUrl(this.ic3Info.RegionGtms);
|
||||
const headers: any = RequestHelper.getDefaultIC3Headers();
|
||||
const headers: any = RequestHelper.getDefaultIC3Headers(); // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
headers[HttpHeaders.AuthenticationHeader] = HttpHeaders.SkypeTokenHeaderValue + this.ic3Info.SkypeToken;
|
||||
headers[HttpHeaders.ContentTypeHeader] = Constants.ContentTypeJson;
|
||||
const features = [
|
||||
|
@ -208,11 +208,11 @@ export default class IC3Initializer {
|
|||
});
|
||||
}
|
||||
|
||||
private onSubscriptionCreationFailure(jqXHR: any) {
|
||||
private onSubscriptionCreationFailure(jqXHR: any) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
this.onRequestCreationFailure(jqXHR, Constants.subscriptionRequestLog);
|
||||
}
|
||||
|
||||
private onSubscriptionCreationSuccess(jqXHR: any) {
|
||||
private onSubscriptionCreationSuccess(jqXHR: any) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
const locationHeader = Utilities.getResponseHeader(jqXHR, HttpHeaders.LocationHeader) || "";
|
||||
if (jqXHR.status === HttpCode.Created &&
|
||||
!Utilities.isNullOrUndefined(locationHeader) && Util.parseChatServiceHostUrl(locationHeader) !== this.ic3Info.RegionGtms.chatService) {
|
||||
|
@ -221,7 +221,7 @@ export default class IC3Initializer {
|
|||
Description: `Endpoint changed`,
|
||||
EndpointUrl: this.ic3Info.RegionGtms.chatService,
|
||||
EndpointId: this.ic3Info.endpointId
|
||||
} as any);
|
||||
});
|
||||
}
|
||||
const subscriptionIdMatch = locationHeader.match(/\/(\d+)$/);
|
||||
if (subscriptionIdMatch) {
|
||||
|
@ -231,7 +231,7 @@ export default class IC3Initializer {
|
|||
|
||||
private createSubscriptionRequest(): Promise<void> {
|
||||
const url = ServiceEndpointHelper.getV1SubscriptionUrl(this.ic3Info.RegionGtms);
|
||||
const headers: any = RequestHelper.getDefaultIC3Headers();
|
||||
const headers: any = RequestHelper.getDefaultIC3Headers(); // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
headers[HttpHeaders.RegistrationTokenHeader] = this.ic3Info.RegistrationToken;
|
||||
headers[HttpHeaders.ContentTypeHeader] = Constants.ContentTypeJson;
|
||||
const payload: IIC3V1Subscription = {
|
||||
|
@ -265,7 +265,7 @@ export default class IC3Initializer {
|
|||
return this.createSubscriptionRequest();
|
||||
}
|
||||
|
||||
private onSetEndpointPropertyCreationFailure(jqXHR: any) {
|
||||
private onSetEndpointPropertyCreationFailure(jqXHR: any) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
this.onRequestCreationFailure(jqXHR, Constants.setPropertiesRequestLog);
|
||||
}
|
||||
|
||||
|
@ -274,10 +274,10 @@ export default class IC3Initializer {
|
|||
return Promise.resolve();
|
||||
}
|
||||
const url = ServiceEndpointHelper.getV1SetPropertiesUrl(this.ic3Info.RegionGtms);
|
||||
const payload: any = {};
|
||||
const payload: any = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
const property = HttpHeaders.SetEndpointProperty;
|
||||
payload[property] = true;
|
||||
const headers: any = RequestHelper.getDefaultIC3Headers();
|
||||
payload[property] = true; // eslint-disable-line security/detect-object-injection
|
||||
const headers: any = RequestHelper.getDefaultIC3Headers(); // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
headers[HttpHeaders.AuthenticationHeader] = HttpHeaders.SkypeTokenHeaderValue + this.ic3Info.SkypeToken;
|
||||
headers[HttpHeaders.RegistrationTokenHeader] = this.ic3Info.RegistrationToken;
|
||||
headers[HttpHeaders.ContentTypeHeader] = Constants.ContentTypeJson;
|
||||
|
@ -298,7 +298,7 @@ export default class IC3Initializer {
|
|||
return HttpClient.MakeRequest<void>(requestParameters);
|
||||
}
|
||||
|
||||
private onUnsubscribeCreationFailure(jqXHR: any) {
|
||||
private onUnsubscribeCreationFailure(jqXHR: any) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
this.onRequestCreationFailure(jqXHR, Constants.unsubscribeRequestLog);
|
||||
}
|
||||
|
||||
|
@ -307,8 +307,8 @@ export default class IC3Initializer {
|
|||
this.skipUnsubscribe = true;
|
||||
return Promise.resolve();
|
||||
}
|
||||
const url = ServiceEndpointHelper.getV1DeleteEndpointUrl(this.ic3Info.RegionGtms, this.ic3Info.endpointId as any);
|
||||
const headers: any = RequestHelper.getDefaultIC3Headers();
|
||||
const url = ServiceEndpointHelper.getV1DeleteEndpointUrl(this.ic3Info.RegionGtms, this.ic3Info.endpointId);
|
||||
const headers: any = RequestHelper.getDefaultIC3Headers(); // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
headers[HttpHeaders.AuthenticationHeader] = HttpHeaders.SkypeTokenHeaderValue + this.ic3Info.SkypeToken;
|
||||
headers[HttpHeaders.RegistrationTokenHeader] = this.ic3Info.RegistrationToken;
|
||||
headers[HttpHeaders.ContentTypeHeader] = Constants.ContentTypeJson;
|
||||
|
@ -328,7 +328,7 @@ export default class IC3Initializer {
|
|||
return HttpClient.MakeRequest<void>(requestParameters);
|
||||
}
|
||||
|
||||
private onRequestCreationFailure(jqXHR: any, request: string) {
|
||||
private onRequestCreationFailure(jqXHR: any, request: string) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
const locationHeader = Utilities.getResponseHeader(jqXHR, HttpHeaders.LocationHeader);
|
||||
this.telemetryMessage = `${request} failed. Error Code: ${jqXHR.status}.`;
|
||||
this.errorCode = jqXHR.status.toString();
|
||||
|
@ -339,7 +339,7 @@ export default class IC3Initializer {
|
|||
ErrorCode: jqXHR.status.toString(),
|
||||
EndpointUrl: this.ic3Info.RegionGtms.chatService,
|
||||
EndpointId: this.ic3Info.endpointId
|
||||
} as any);
|
||||
});
|
||||
this.onRequestCreationFailureRedirect(jqXHR);
|
||||
} else {
|
||||
// Don't unsubscribe if the endpoint already doesn't exist (729)
|
||||
|
@ -348,13 +348,13 @@ export default class IC3Initializer {
|
|||
ErrorCode: jqXHR.status.toString(),
|
||||
EndpointUrl: this.ic3Info.RegionGtms.chatService,
|
||||
EndpointId: this.ic3Info.endpointId
|
||||
} as any);
|
||||
});
|
||||
this.current404RetryCount = 0;
|
||||
this.currentOtherRetryCount++;
|
||||
}
|
||||
}
|
||||
|
||||
private redirectErrorHandler(e: any): Promise<IIC3Info> {
|
||||
private redirectErrorHandler(e: any): Promise<IIC3Info> { // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
if ((e.message === Constants.Reset_Flag) && this.current404RetryCount <= Constants.retry404Count
|
||||
&& this.currentOtherRetryCount <= Constants.retryCount) {
|
||||
return this.reset().then(() => {
|
||||
|
@ -367,7 +367,7 @@ export default class IC3Initializer {
|
|||
ExceptionDetails: e,
|
||||
EndpointUrl: this.ic3Info.RegionGtms.chatService,
|
||||
EndpointId: this.ic3Info.endpointId
|
||||
} as any);
|
||||
});
|
||||
|
||||
return this.reset().then(() => {
|
||||
return Promise.reject(e.message);
|
||||
|
@ -375,7 +375,7 @@ export default class IC3Initializer {
|
|||
}
|
||||
}
|
||||
|
||||
private onRequestCreationFailureRedirect(jqXHR: any) {
|
||||
private onRequestCreationFailureRedirect(jqXHR: any) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
this.current404RetryCount++;
|
||||
this.currentOtherRetryCount = 0;
|
||||
this.ic3Info.RegionGtms.chatService = Util.parseChatServiceHostUrl(Utilities.getResponseHeader(jqXHR, HttpHeaders.LocationHeader));
|
||||
|
@ -383,6 +383,6 @@ export default class IC3Initializer {
|
|||
Description: `Endpoint changed.`,
|
||||
EndpointUrl: this.ic3Info.RegionGtms.chatService,
|
||||
EndpointId: this.ic3Info.endpointId
|
||||
} as any);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import ClientBridgeFactory from "./ClientBridgeFactory";
|
||||
import IClientSDKInitializationParameters from "../model/IClientSDKInitializationParameters";
|
||||
import IProtocolInfo from "../common/IProtocolInfo";
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import Utilities from "../common/Utilities";
|
||||
import Constants from "../common/Constants";
|
||||
import IC3TelemetryEvent from "../logging/IC3TelemetryEvent";
|
||||
|
@ -159,7 +161,7 @@ export class HttpClient {
|
|||
return isClientError;
|
||||
}
|
||||
|
||||
public static setLogger(logger: IRawLogger) {
|
||||
public static setLogger(logger: IRawLogger): void {
|
||||
HttpClient.logger = logger;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import Constants from '../common/Constants';
|
||||
import IIC3GetMessagesRequestQueryParameters from '../model/IIC3GetMessagesRequestQueryParameters';
|
||||
import {uuidv4} from '../utils/uuid';
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
declare module 'IC3Client' {
|
||||
global {
|
||||
interface Window {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import IIC3Info from "./IIC3Info";
|
||||
import IRawSDK from "./IRawSDK";
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import IIC3ConversationStatusProperties from "./IIC3ConversationStatusProperties";
|
||||
|
||||
export default interface IIC3ConversationProperties {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export default interface IIC3ConversationStatusProperties {
|
||||
AddedBy?: any;
|
||||
AddedToConversations?: any[];
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export default interface IIC3ThreadMember {
|
||||
id: string;
|
||||
type: string;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import IC3ThreadType from "../enums/IC3ThreadType";
|
||||
|
||||
export default interface IIC3ThreadProperties {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import IIC3V1Subscription from './IIC3V1Subscription';
|
||||
|
||||
export default interface IIC3V1EndpointResponse {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export default interface IRawBotMessage {
|
||||
[key: string]: any;
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export default interface IRawThread {
|
||||
id: string;
|
||||
type: string;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
export default interface IIC3TelemetryCustomData {
|
||||
ElapsedTimeInMilliseconds?: number;
|
||||
ErrorCode?: string;
|
||||
EndpointUrl?: string;
|
||||
EndpointId?: string;
|
||||
ExceptionDetails?: object;
|
||||
Description?: string;
|
||||
ShouldBubbleToHost?: boolean;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import IConversationTelemetryContext from "./IConversationTelemetryContext";
|
||||
import IGlobalTelemetryContext from "./IGlobalTelemetryContext";
|
||||
import ISDKTelemetryContext from "./ISDKTelemetryContext";
|
||||
|
|
|
@ -24,7 +24,7 @@ export default class RawLogger implements IRawLogger {
|
|||
}
|
||||
}
|
||||
|
||||
public logEvent(logLevel: LogLevel, logData: IIC3SDKLogData) {
|
||||
public logEvent(logLevel: LogLevel, logData: IIC3SDKLogData): void {
|
||||
if (this.isLoggingEnabled()) {
|
||||
setTimeout(this.logger.logClientSdkTelemetryEvent.bind(this.logger), 0, logLevel, logData);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import IRawSDK from "../interfaces/IRawSDK";
|
||||
import IIC3TelemetryCustomData from "./IIC3TelemetryCustomData";
|
||||
import { IIC3SDKLogData } from "./ILogData";
|
||||
|
|
|
@ -10,7 +10,7 @@ export default class ConversationGenerator {
|
|||
this.fileMessagesObservers = [];
|
||||
}
|
||||
|
||||
public generateMessage(conversationId: string, message: IMessage) {
|
||||
public generateMessage(conversationId: string, message: IMessage): void {
|
||||
const conversation = {
|
||||
id: conversationId
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ export default class ConversationGenerator {
|
|||
});
|
||||
}
|
||||
|
||||
public generateFileMessage(conversationId: string, message: IMessage, file: File) {
|
||||
public generateFileMessage(conversationId: string, message: IMessage, file: File): void {
|
||||
const conversation = {
|
||||
id: conversationId
|
||||
};
|
||||
|
@ -30,11 +30,11 @@ export default class ConversationGenerator {
|
|||
});
|
||||
}
|
||||
|
||||
public subscribeToMessages(subscriber: (conversation: IConversation, message: IMessage) => void) {
|
||||
public subscribeToMessages(subscriber: (conversation: IConversation, message: IMessage) => void): void {
|
||||
this.messagesObservers.push(subscriber);
|
||||
}
|
||||
|
||||
public subscribeToFileMessages(subscriber: (conversation: IConversation, message: IMessage, file: File) => void) {
|
||||
public subscribeToFileMessages(subscriber: (conversation: IConversation, message: IMessage, file: File) => void): void {
|
||||
this.fileMessagesObservers.push(subscriber);
|
||||
}
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export default interface IBotMessage {
|
||||
[key: string]: any;
|
||||
}
|
|
@ -6,7 +6,6 @@ import IFileMetadata from './IFileMetadata';
|
|||
import IMessage from './IMessage';
|
||||
import IMessageProperties from './IMessageProperties';
|
||||
import IPerson from './IPerson';
|
||||
import IRawConversation from './IRawConversation';
|
||||
import IThread from './IThread';
|
||||
import TypingStatus from './TypingStatus';
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export default interface IThread {
|
||||
id: string;
|
||||
type: string;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import IIC3Info from "../interfaces/IIC3Info";
|
||||
import ServiceEndpointHelper from "../common/ServiceEndpointHelper";
|
||||
import V1PollingHelper from "./V1PollingHelper";
|
||||
|
@ -7,7 +10,7 @@ export default class Poller {
|
|||
private _onNewData: (data: any) => void;
|
||||
private _onError: (error: any) => any;
|
||||
private _ic3Info: IIC3Info;
|
||||
private isPolling: boolean = false;
|
||||
private isPolling = false;
|
||||
private callbackOnFailure: (jqXHR: any, request: string) => void;
|
||||
|
||||
constructor(ic3Info: IIC3Info, onNewData: (data: any) => void, onError: (error: any) => any, callbackOnFailure: (jqXHR: any, request?: string) => void) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import Constants from "../common/Constants";
|
||||
import { HttpClient, IHttpRequestAttributes } from "../http/HttpClient";
|
||||
import HttpHeaders from "../http/HttpHeaders";
|
||||
|
|
|
@ -7,7 +7,7 @@ import IAxiosRetryOptions from "../http/IAxiosRetryOptions";
|
|||
* @param axios Axios instance.
|
||||
* @param axiosRetryOptions Options for axios retry.
|
||||
*/
|
||||
const axiosRetry = (axios: AxiosInstance, axiosRetryOptions: IAxiosRetryOptions) => {
|
||||
const axiosRetry = (axios: AxiosInstance, axiosRetryOptions: IAxiosRetryOptions) => { // eslint-disable-line @typescript-eslint/explicit-module-boundary-types
|
||||
const { retries } = axiosRetryOptions;
|
||||
|
||||
let currentTry = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export const uuidv4 = () => {
|
||||
export const uuidv4 = (): string => {
|
||||
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
||||
const r = Math.random() * 16 | 0, v = c === "x" ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
|
|
Загрузка…
Ссылка в новой задаче