Skip to content

Commit

Permalink
update lint formats
Browse files Browse the repository at this point in the history
  • Loading branch information
JhontSouth committed Oct 31, 2023
1 parent c76a36d commit 9fd7081
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 18 deletions.
4 changes: 2 additions & 2 deletions libraries/botbuilder-ai/etc/botbuilder-ai.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import { DialogTurnResult } from 'botbuilder-dialogs';
import { EnumExpression } from 'adaptive-expressions';
import { Expression } from 'adaptive-expressions';
import { IntExpression } from 'adaptive-expressions';
import * as msRest from '@azure/ms-rest-js';
import { NumberExpression } from 'adaptive-expressions';
import { ObjectExpression } from 'adaptive-expressions';
import { Recognizer } from 'botbuilder-dialogs';
import { RecognizerConfiguration } from 'botbuilder-dialogs';
import { RecognizerResult } from 'botbuilder-core';
import { RequestOptionsBase } from '@azure/core-http';
import { ServiceCollection } from 'botbuilder-dialogs-adaptive-runtime-core';
import { StringExpression } from 'adaptive-expressions';
import { TemplateInterface } from 'botbuilder-dialogs';
Expand Down Expand Up @@ -290,7 +290,7 @@ export class LuisComponentRegistration extends ComponentRegistration {
}

// @public
export interface LuisPredictionOptions extends msRest.RequestOptionsBase {
export interface LuisPredictionOptions extends RequestOptionsBase {
bingSpellCheckSubscriptionKey?: string;
includeAllIntents?: boolean;
includeInstanceData?: boolean;
Expand Down
1 change: 1 addition & 0 deletions libraries/botbuilder-ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
}
},
"dependencies": {
"@azure/core-http": "^3.0.2",
"adaptive-expressions": "4.1.6",
"botbuilder-core": "4.1.6",
"botbuilder-dialogs": "4.1.6",
Expand Down
1 change: 0 additions & 1 deletion libraries/botbuilder-ai/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,3 @@ export {
RankerTypes,
ServiceType,
} from './qnamaker-interfaces';

16 changes: 8 additions & 8 deletions libraries/botbuilder-ai/src/luisRuntimeClientContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/

import { ServiceClient, ServiceClientCredentials, ServiceClientOptions, getDefaultUserAgentValue } from "@azure/core-http";
import { ServiceClient, ServiceClientCredentials, ServiceClientOptions } from '@azure/core-http';

/**
* Client for LUIS context
*/
export class LUISRuntimeClientContext extends ServiceClient {
endpoint: string;
credentials: ServiceClientCredentials;

/**
* Initializes a new instance of the LUISRuntimeClientContext class.
*
* @param credentials Subscription credentials which uniquely identify client subscription.
* @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:
* https://westus.api.cognitive.microsoft.com).
* @param credentials Subscription credentials which uniquely identify client subscription.
* @param [options] The parameter options
*/
constructor(credentials: ServiceClientCredentials, endpoint: string, options?: ServiceClientOptions) {
Expand All @@ -32,14 +36,10 @@ export class LUISRuntimeClientContext extends ServiceClient {
options = {};
}

if (!options.userAgent) {
const defaultUserAgent = getDefaultUserAgentValue();
}

super(credentials, options);

this.baseUri = "{Endpoint}/luis/v3.0-preview";
this.requestContentType = "application/json; charset=utf-8";
this.baseUri = '{Endpoint}/luis/v3.0-preview';
this.requestContentType = 'application/json; charset=utf-8';
this.endpoint = endpoint;
this.credentials = credentials;
}
Expand Down
3 changes: 1 addition & 2 deletions libraries/botbuilder-ai/src/luisV2-models/sentiment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/


import { RequestOptionsBase, HttpResponse } from '@azure/core-http';

/**
Expand Down
8 changes: 5 additions & 3 deletions libraries/botbuilder-ai/tests/luisRecognizer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ describe('LuisRecognizer', function () {
assert(res.entities.Address[0].$instance.State[0].score);
assert(
res.entities.Address[0].$instance.State[0].score > 0 &&
res.entities.Address[0].$instance.State[0].score <= 1
res.entities.Address[0].$instance.State[0].score <= 1
);
});

Expand Down Expand Up @@ -500,7 +500,8 @@ describe('LuisRecognizer', function () {
returnStatusCode(400);

const context = new TestContext({ text: 'Hello world!' });
const errorResponse = "Response 400: The request's body or parameters are incorrect, meaning they are missing, malformed, or too large.";
const errorResponse =
"Response 400: The request's body or parameters are incorrect, meaning they are missing, malformed, or too large.";
try {
await recognizer.recognize(context);
} catch (error) {
Expand Down Expand Up @@ -560,7 +561,8 @@ describe('LuisRecognizer', function () {
returnStatusCode(414);

const context = new TestContext({ text: 'Hello world!' });
const errorResponse = 'Response 414: The query is too long. Please reduce the query length to 500 or less characters.';
const errorResponse =
'Response 414: The query is too long. Please reduce the query length to 500 or less characters.';
try {
await recognizer.recognize(context);
} catch (error) {
Expand Down
1 change: 1 addition & 0 deletions libraries/botframework-connector/src/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ export * from './userTokenClient';

export { MsalAppCredentials } from './msalAppCredentials';
export { MsalServiceClientCredentialsFactory } from './msalServiceClientCredentialsFactory';
export { TokenCredentials } from './tokenCredentials';
45 changes: 45 additions & 0 deletions libraries/botframework-connector/src/auth/tokenCredentials.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// 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";

const HeaderConstants = Constants.HeaderConstants;
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;

/**
* 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.");
}
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);
}
}
47 changes: 45 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
resolved "https://registry.yarnpkg.com/@azure/core-asynciterator-polyfill/-/core-asynciterator-polyfill-1.0.0.tgz#dcccebb88406e5c76e0e1d52e8cc4c43a68b3ee7"
integrity sha512-kmv8CGrPfN9SwMwrkiBK9VTQYxdFQEGe0BmQk+M8io56P9KNzpAxcWE/1fxJj7uouwN4kXF0BHW8DNlgx+wtCg==

"@azure/core-auth@^1.1.4":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@azure/core-auth/-/core-auth-1.5.0.tgz#a41848c5c31cb3b7c84c409885267d55a2c92e44"
integrity sha512-udzoBuYG1VBoHVohDTrvKjyzel34zt77Bhp7dQntVGGD0ehVq48owENbBG8fIgkHRNUBQH5k1r0hpoMu5L8+kw==
dependencies:
"@azure/abort-controller" "^1.0.0"
"@azure/core-util" "^1.1.0"
tslib "^2.2.0"

"@azure/core-auth@^1.2.0", "@azure/core-auth@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@azure/core-auth/-/core-auth-1.4.0.tgz#6fa9661c1705857820dbc216df5ba5665ac36a9e"
Expand Down Expand Up @@ -134,6 +143,14 @@
dependencies:
tslib "^2.0.0"

"@azure/core-util@^1.1.0":
version "1.6.1"
resolved "https://registry.yarnpkg.com/@azure/core-util/-/core-util-1.6.1.tgz#fea221c4fa43c26543bccf799beb30c1c7878f5a"
integrity sha512-h5taHeySlsV9qxuK64KZxy4iln1BtMYlNt5jbuEFN3UFSAd1EwKg/Gjl5a6tZ/W8t6li3xPnutOx7zbDyXnPmQ==
dependencies:
"@azure/abort-controller" "^1.0.0"
tslib "^2.2.0"

"@azure/core-util@^1.1.1":
version "1.3.2"
resolved "https://registry.yarnpkg.com/@azure/core-util/-/core-util-1.3.2.tgz#3f8cfda1e87fac0ce84f8c1a42fcd6d2a986632d"
Expand Down Expand Up @@ -214,6 +231,20 @@
resolved "https://registry.yarnpkg.com/@azure/ms-rest-azure-env/-/ms-rest-azure-env-2.0.0.tgz#45809f89763a480924e21d3c620cd40866771625"
integrity sha512-dG76W7ElfLi+fbTjnZVGj+M9e0BIEJmRxU6fHaUQ12bZBe8EJKYb2GV50YWNaP2uJiVQ5+7nXEVj1VN1UQtaEw==

"@azure/ms-rest-js@^2.7.0":
version "2.7.0"
resolved "https://registry.yarnpkg.com/@azure/ms-rest-js/-/ms-rest-js-2.7.0.tgz#8639065577ffdf4946951e1d246334ebfd72d537"
integrity sha512-ngbzWbqF+NmztDOpLBVDxYM+XLcUj7nKhxGbSU9WtIsXfRB//cf2ZbAG5HkOrhU9/wd/ORRB6lM/d69RKVjiyA==
dependencies:
"@azure/core-auth" "^1.1.4"
abort-controller "^3.0.0"
form-data "^2.5.0"
node-fetch "^2.6.7"
tslib "^1.10.0"
tunnel "0.0.6"
uuid "^8.3.2"
xml2js "^0.5.0"

"@azure/msal-browser@^2.16.0":
version "2.17.0"
resolved "https://registry.yarnpkg.com/@azure/msal-browser/-/msal-browser-2.17.0.tgz#beb7d91e6123534b42c0d2ce85eda42a136a8555"
Expand Down Expand Up @@ -2654,6 +2685,13 @@ abbrev@1:
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==

abort-controller@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392"
integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==
dependencies:
event-target-shim "^5.0.0"

accepts@^1.3.7, accepts@~1.3.8:
version "1.3.8"
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e"
Expand Down Expand Up @@ -5857,6 +5895,11 @@ event-emitter@~0.3.5:
d "1"
es5-ext "~0.10.14"

event-target-shim@^5.0.0:
version "5.0.1"
resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789"
integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==

events@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/events/-/events-3.2.0.tgz#93b87c18f8efcd4202a461aec4dfc0556b639379"
Expand Down Expand Up @@ -13009,7 +13052,7 @@ tsconfig-paths@^3.9.0:
minimist "^1.2.0"
strip-bom "^3.0.0"

tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
Expand Down Expand Up @@ -13046,7 +13089,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.1.tgz#3f05251ee17904dfd0677546670db9651682b811"
integrity sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==

tunnel@^0.0.6:
tunnel@0.0.6, tunnel@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c"
integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==
Expand Down

0 comments on commit 9fd7081

Please sign in to comment.