Skip to content

Commit

Permalink
update with lint format
Browse files Browse the repository at this point in the history
  • Loading branch information
JhontSouth committed Nov 2, 2023
1 parent 93d6f1d commit dedd0ef
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 48 deletions.
16 changes: 8 additions & 8 deletions libraries/botbuilder/tests/teamsInfo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ describe('TeamsInfo', function () {
try {
await TeamsInfo.sendMeetingNotification(context, notification, meetingId);
} catch (e) {
assert.deepEqual(errorResponse, e.body);
assert.deepEqual(errorResponse, e.details);
isErrorThrown = true;
}

Expand Down Expand Up @@ -1214,7 +1214,7 @@ describe('TeamsInfo', function () {
try {
await TeamsInfo.sendMessageToListOfUsers(context, activity, tenantId, members);
} catch (e) {
assert.deepEqual(errorResponse, e.errors[0].body);
assert.deepEqual(errorResponse, e.errors[0].details);
isErrorThrown = true;
}

Expand Down Expand Up @@ -1307,7 +1307,7 @@ describe('TeamsInfo', function () {
try {
await TeamsInfo.sendMessageToAllUsersInTenant(context, activity, tenantId);
} catch (e) {
assert.deepEqual(errorResponse, e.errors[0].body);
assert.deepEqual(errorResponse, e.errors[0].details);
isErrorThrown = true;
}

Expand Down Expand Up @@ -1395,7 +1395,7 @@ describe('TeamsInfo', function () {
try {
await TeamsInfo.sendMessageToAllUsersInTeam(context, activity, tenantId, teamId);
} catch (e) {
assert.deepEqual(errorResponse, e.errors[0].body);
assert.deepEqual(errorResponse, e.errors[0].details);
isErrorThrown = true;
}

Expand Down Expand Up @@ -1502,7 +1502,7 @@ describe('TeamsInfo', function () {
try {
await TeamsInfo.sendMessageToListOfChannels(context, activity, tenantId, members);
} catch (e) {
assert.deepEqual(errorResponse, e.errors[0].body);
assert.deepEqual(errorResponse, e.errors[0].details);
isErrorThrown = true;
}

Expand Down Expand Up @@ -1579,7 +1579,7 @@ describe('TeamsInfo', function () {
try {
await TeamsInfo.getOperationState(context, operationId);
} catch (e) {
assert.deepEqual(errorResponse, e.errors[0].body);
assert.deepEqual(errorResponse, e.errors[0].details);
isErrorThrown = true;
}

Expand Down Expand Up @@ -1648,7 +1648,7 @@ describe('TeamsInfo', function () {
try {
await TeamsInfo.getFailedEntries(context, operationId);
} catch (e) {
assert.deepEqual(errorResponse, e.errors[0].body);
assert.deepEqual(errorResponse, e.errors[0].details);
isErrorThrown = true;
}

Expand Down Expand Up @@ -1697,7 +1697,7 @@ describe('TeamsInfo', function () {
try {
await TeamsInfo.cancelOperation(context, operationId);
} catch (e) {
assert.deepEqual(errorResponse, e.errors[0].body);
assert.deepEqual(errorResponse, e.errors[0].details);
isErrorThrown = true;
}

Expand Down
5 changes: 2 additions & 3 deletions libraries/botframework-connector/src/auth/appCredentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
*/

import { ConfidentialClientApplication } from '@azure/msal-node';
import { ServiceClientCredentials, WebResource } from "@azure/core-http";
import {TokenCredentials} from "./tokenCredentials"
import * as adal from 'adal-node';
import { ServiceClientCredentials, WebResource } from '@azure/core-http';
import { TokenCredentials } from './tokenCredentials';
import { AuthenticationConstants } from './authenticationConstants';
import { AuthenticatorResult } from './authenticatorResult';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import type { ServiceClientCredentialsFactory } from './serviceClientCredentials

// eslint-disable-next-line @typescript-eslint/no-var-requires
const packageInfo: Record<'name' | 'version', string> = require('../../package.json');
export const USER_AGENT = `Microsoft-BotFramework/3.1 ${packageInfo.name}/${packageInfo.version
} ${getDefaultUserAgentValue()} `;
export const USER_AGENT = `Microsoft-BotFramework/3.1 ${packageInfo.name}/${
packageInfo.version
} ${getDefaultUserAgentValue()} `;

/**
* @internal
Expand Down
59 changes: 28 additions & 31 deletions libraries/botframework-connector/src/auth/tokenCredentials.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,42 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

import { HttpHeaders, Constants, WebResourceLike, ServiceClientCredentials } from "@azure/core-http";
import { HttpHeaders, Constants, WebResourceLike, ServiceClientCredentials } from '@azure/core-http';

const HeaderConstants = Constants.HeaderConstants;
const DEFAULT_AUTHORIZATION_SCHEME = "Bearer";
const DEFAULT_AUTHORIZATION_SCHEME = 'Bearer';

/**
* A credentials object that uses a token string and a authorzation scheme to authenticate.
*/
export class TokenCredentials implements ServiceClientCredentials {
token: string;
authorizationScheme: string = DEFAULT_AUTHORIZATION_SCHEME;
token: string;
authorizationScheme: string = DEFAULT_AUTHORIZATION_SCHEME;

/**
* Creates a new TokenCredentials object.
*
* @constructor
* @param {string} token The token.
* @param {string} [authorizationScheme] The authorization scheme.
*/
constructor(token: string, authorizationScheme: string = DEFAULT_AUTHORIZATION_SCHEME) {
if (!token) {
throw new Error("token cannot be null or undefined.");
/**
* Creates a new TokenCredentials object.
*
* @class
* @param {string} token The token.
* @param {string} [authorizationScheme] The authorization scheme.
*/
constructor(token: string, authorizationScheme: string = DEFAULT_AUTHORIZATION_SCHEME) {
if (!token) {
throw new Error('token cannot be null or undefined.');
}
this.token = token;
this.authorizationScheme = authorizationScheme;
}
this.token = token;
this.authorizationScheme = authorizationScheme;
}

/**
* Signs a request with the Authentication header.
*
* @param {WebResourceLike} webResource The WebResourceLike to be signed.
* @return {Promise<WebResourceLike>} The signed request object.
*/
signRequest(webResource: WebResourceLike) {
if (!webResource.headers) webResource.headers = new HttpHeaders();
webResource.headers.set(
HeaderConstants.AUTHORIZATION,
`${this.authorizationScheme} ${this.token}`
);
return Promise.resolve(webResource);
}
/**
* Signs a request with the Authentication header.
*
* @param {WebResourceLike} webResource The WebResourceLike to be signed.
* @returns {Promise<WebResourceLike>} The signed request object.
*/
signRequest(webResource: WebResourceLike) {
if (!webResource.headers) webResource.headers = new HttpHeaders();
webResource.headers.set(HeaderConstants.AUTHORIZATION, `${this.authorizationScheme} ${this.token}`);
return Promise.resolve(webResource);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/

import { CompositeMapper } from "@azure/core-http"
import { CompositeMapper } from '@azure/core-http';

export const ChannelInfo: CompositeMapper = {
serializedName: 'ChannelInfo',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/

import { OperationURLParameter, OperationQueryParameter } from "@azure/core-http"
import { OperationURLParameter, OperationQueryParameter } from '@azure/core-http';

export const teamId: OperationURLParameter = {
parameterPath: 'teamId',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the MIT License.
*/

import { ServiceCallback, RequestOptionsBase, Serializer, OperationSpec } from "@azure/core-http"
import { ServiceCallback, RequestOptionsBase, Serializer, OperationSpec } from '@azure/core-http'
import * as Models from '../models';
import * as Mappers from '../models/teamsMappers';
import * as Parameters from '../models/parameters';
Expand Down
3 changes: 2 additions & 1 deletion libraries/tests.uischema
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"triggers",
"generator",
"selector",
"schema"
"schema",
"dialogs"
],
"label": "Adaptive dialog",
"order": [
Expand Down

0 comments on commit dedd0ef

Please sign in to comment.