From 8834a294da9b59b1bb5351074bf950a233f068d1 Mon Sep 17 00:00:00 2001 From: JhontSouth Date: Tue, 22 Oct 2024 10:20:55 -0500 Subject: [PATCH 1/8] fix eslint issues in botbuilder --- libraries/botbuilder/eslint.config.cjs | 10 - libraries/botbuilder/package.json | 2 +- libraries/botbuilder/src/activityValidator.ts | 1 - .../botbuilder/src/botFrameworkAdapter.ts | 256 +++++++----------- .../botbuilder/src/botFrameworkHttpAdapter.ts | 2 +- .../botbuilder/src/botFrameworkHttpClient.ts | 8 +- .../botbuilder/src/channelServiceHandler.ts | 5 +- .../src/channelServiceHandlerBase.ts | 117 +++----- .../botbuilder/src/channelServiceRoutes.ts | 33 ++- libraries/botbuilder/src/cloudAdapter.ts | 51 ++-- libraries/botbuilder/src/eventFactory.ts | 8 +- .../botbuilder/src/fileTranscriptStore.ts | 14 +- .../botbuilder/src/inspectionMiddleware.ts | 22 +- .../src/interfaces/connectorClientBuilder.ts | 3 +- .../botbuilder/src/interfaces/request.ts | 2 +- .../botbuilder/src/interfaces/response.ts | 2 +- .../botbuilder/src/interfaces/webRequest.ts | 2 - .../botbuilder/src/interfaces/webResponse.ts | 6 - libraries/botbuilder/src/routeConstants.ts | 1 - .../botbuilder/src/setSpeakMiddleware.ts | 9 +- .../sharepoint/sharePointActivityHandler.ts | 32 +-- .../src/skills/cloudSkillHandler.ts | 33 +-- .../botbuilder/src/skills/skillHandler.ts | 30 +- .../botbuilder/src/skills/skillHandlerImpl.ts | 20 +- .../botbuilder/src/skills/skillHttpClient.ts | 21 +- libraries/botbuilder/src/statusCodeError.ts | 6 +- .../src/streaming/streamingHttpClient.ts | 4 +- .../botbuilder/src/streaming/tokenResolver.ts | 11 +- .../teams/teamsSSOTokenExchangeMiddleware.ts | 15 +- .../botbuilder/src/teamsActivityHandler.ts | 207 +++++--------- .../botbuilder/src/teamsActivityHelpers.ts | 9 +- libraries/botbuilder/src/teamsInfo.ts | 62 ++--- libraries/botbuilder/src/zod.ts | 2 +- .../tests/botFrameworkAdapter.test.js | 208 +++++++------- .../tests/botFrameworkHttpClient.test.js | 24 +- .../tests/channelServiceHandler.test.js | 24 +- .../tests/channelServiceRoutes.test.js | 60 ++-- .../botbuilder/tests/cloudAdapter.test.js | 18 +- .../tests/eventFactoryTests.test.js | 6 +- .../tests/fileTranscriptStore.test.js | 48 ++-- .../tests/inspectionMiddleware.test.js | 70 ++--- .../tests/skills/skillHandler.test.js | 22 +- .../tests/skills/skillHttpClient.test.js | 2 +- .../botbuilder/tests/statusCodeError.test.js | 4 +- .../botFrameworkAdapterStreaming.test.js | 50 ++-- .../tests/streaming/mockHttpRequest.js | 2 +- .../tests/streaming/mockStreamingRequest.js | 4 +- .../streaming/streamingHttpClient.test.js | 6 +- .../tests/streaming/tokenResolver.test.js | 2 +- .../teamsSSOTokenExchangeMiddleware.test.js | 8 +- .../tests/teamsActivityHandler.test.js | 94 +++---- libraries/botbuilder/tests/teamsInfo.test.js | 80 +++--- package.json | 1 + 53 files changed, 729 insertions(+), 1010 deletions(-) delete mode 100644 libraries/botbuilder/eslint.config.cjs diff --git a/libraries/botbuilder/eslint.config.cjs b/libraries/botbuilder/eslint.config.cjs deleted file mode 100644 index 63647b52cc..0000000000 --- a/libraries/botbuilder/eslint.config.cjs +++ /dev/null @@ -1,10 +0,0 @@ -const onlyWarn = require("eslint-plugin-only-warn"); -const sharedConfig = require("../../eslint.config.cjs") - -module.exports = [ - ...sharedConfig, - { - plugins: { - "only-warn": onlyWarn, - }, - }]; diff --git a/libraries/botbuilder/package.json b/libraries/botbuilder/package.json index 18775a5582..0c8294cfe9 100644 --- a/libraries/botbuilder/package.json +++ b/libraries/botbuilder/package.json @@ -56,7 +56,7 @@ "build:rollup": "yarn clean && yarn build && api-extractor run --verbose --local", "clean": "rimraf _ts3.4 lib tsconfig.tsbuildinfo", "depcheck": "depcheck --config ../../.depcheckrc", - "lint": "eslint .", + "lint": "eslint . --config ../../eslint.config.cjs", "postbuild": "downlevel-dts lib _ts3.4/lib --checksum", "test": "npm-run-all build test:mocha", "test:compat": "api-extractor run --verbose", diff --git a/libraries/botbuilder/src/activityValidator.ts b/libraries/botbuilder/src/activityValidator.ts index d6d6c37978..d6c34f6c24 100644 --- a/libraries/botbuilder/src/activityValidator.ts +++ b/libraries/botbuilder/src/activityValidator.ts @@ -10,7 +10,6 @@ import { Activity, ActivityTimestamps } from 'botbuilder-core'; /** * Validates an [Activity](xref:botbuilder-core.Activity) and formats the timestamp fields. - * * @param activity [Activity](xref:botbuilder-core.Activity) to be validated. * @returns The [Activity](xref:botframework-schema.Activity). */ diff --git a/libraries/botbuilder/src/botFrameworkAdapter.ts b/libraries/botbuilder/src/botFrameworkAdapter.ts index 7df7cc2599..7db7a334f0 100644 --- a/libraries/botbuilder/src/botFrameworkAdapter.ts +++ b/libraries/botbuilder/src/botFrameworkAdapter.ts @@ -157,7 +157,8 @@ const TYPE = type(); const RELEASE = release(); const NODE_VERSION = process.version; -const pjson: Record<'version', string> = require('../package.json'); // eslint-disable-line @typescript-eslint/no-var-requires +// eslint-disable-next-line @typescript-eslint/no-require-imports +const pjson: Record<'version', string> = require('../package.json'); export const USER_AGENT = `Microsoft-BotFramework/3.1 BotBuilder/${pjson.version} (Node.js,Version=${NODE_VERSION}; ${TYPE} ${RELEASE}; ${ARCHITECTURE})`; const OAUTH_ENDPOINT = 'https://api.botframework.com'; @@ -166,7 +167,6 @@ const US_GOV_OAUTH_ENDPOINT = 'https://api.botframework.azure.us'; /** * A [BotAdapter](xref:botbuilder-core.BotAdapter) that can connect a bot to a service endpoint. * Implements [IUserTokenProvider](xref:botbuilder-core.IUserTokenProvider). - * * @remarks * The bot adapter encapsulates authentication processes and sends activities to and receives * activities from the Bot Connector Service. When your bot receives an activity, the adapter @@ -203,7 +203,8 @@ const US_GOV_OAUTH_ENDPOINT = 'https://api.botframework.azure.us'; */ export class BotFrameworkAdapter extends BotAdapter - implements BotFrameworkHttpAdapter, ConnectorClientBuilder, ExtendedUserTokenProvider, RequestHandler { + implements BotFrameworkHttpAdapter, ConnectorClientBuilder, ExtendedUserTokenProvider, RequestHandler +{ // These keys are public to permit access to the keys from the adapter when it's a being // from library that does not have access to static properties off of BotFrameworkAdapter. // E.g. botbuilder-dialogs @@ -226,9 +227,7 @@ export class BotFrameworkAdapter /** * Creates a new instance of the [BotFrameworkAdapter](xref:botbuilder.BotFrameworkAdapter) class. - * * @param settings Optional. The settings to use for this adapter instance. - * * @remarks * If the `settings` parameter does not include * [channelService](xref:botbuilder.BotFrameworkAdapterSettings.channelService) or @@ -251,7 +250,7 @@ export class BotFrameworkAdapter this.settings.appId, settings.certificateThumbprint, settings.certificatePrivateKey, - this.settings.channelAuthTenant + this.settings.channelAuthTenant, ); this.credentialsProvider = new SimpleCredentialProvider(this.credentials.appId, ''); } else { @@ -259,18 +258,18 @@ export class BotFrameworkAdapter this.credentials = new MicrosoftGovernmentAppCredentials( this.settings.appId, this.settings.appPassword || '', - this.settings.channelAuthTenant + this.settings.channelAuthTenant, ); } else { this.credentials = new MicrosoftAppCredentials( this.settings.appId, this.settings.appPassword || '', - this.settings.channelAuthTenant + this.settings.channelAuthTenant, ); } this.credentialsProvider = new SimpleCredentialProvider( this.credentials.appId, - this.settings.appPassword || '' + this.settings.appPassword || '', ); } @@ -298,26 +297,23 @@ export class BotFrameworkAdapter // Relocate the tenantId field used by MS Teams to a new location (from channelData to conversation) // This will only occur on activities from teams that include tenant info in channelData but NOT in conversation, // thus should be future friendly. However, once the the transition is complete. we can remove this. - this.use( - async (context, next): Promise => { - if ( - context.activity.channelId === 'msteams' && - context.activity && - context.activity.conversation && - !context.activity.conversation.tenantId && - context.activity.channelData && - context.activity.channelData.tenant - ) { - context.activity.conversation.tenantId = context.activity.channelData.tenant.id; - } - await next(); + this.use(async (context, next): Promise => { + if ( + context.activity.channelId === 'msteams' && + context.activity && + context.activity.conversation && + !context.activity.conversation.tenantId && + context.activity.channelData && + context.activity.channelData.tenant + ) { + context.activity.conversation.tenantId = context.activity.channelData.tenant.id; } - ); + await next(); + }); } /** * Used in streaming contexts to check if the streaming connection is still open for the bot to send activities. - * * @returns True if the streaming connection is open, otherwise false. */ get isStreamingConnectionOpen(): boolean { @@ -326,11 +322,9 @@ export class BotFrameworkAdapter /** * Asynchronously resumes a conversation with a user, possibly after some time has gone by. - * * @param reference A reference to the conversation to continue. * @param oAuthScope The intended recipient of any sent activities. * @param logic The asynchronous method to call after the adapter middleware runs. - * * @remarks * This is often referred to as a _proactive notification_, the bot can proactively * send a message to a conversation or user without waiting for an incoming message. @@ -372,12 +366,11 @@ export class BotFrameworkAdapter */ async continueConversation( reference: Partial, - logic: (context: TurnContext) => Promise + logic: (context: TurnContext) => Promise, ): Promise; /** * Asynchronously resumes a conversation with a user, possibly after some time has gone by. - * * @param reference [ConversationReference](xref:botframework-schema.ConversationReference) of the conversation to continue. * @param oAuthScope The intended recipient of any sent activities or the function to call to continue the conversation. * @param logic Optional. The asynchronous method to call after the adapter middleware runs. @@ -385,7 +378,7 @@ export class BotFrameworkAdapter async continueConversation( reference: Partial, oAuthScope: string, - logic: (context: TurnContext) => Promise + logic: (context: TurnContext) => Promise, ): Promise; /** @@ -394,7 +387,7 @@ export class BotFrameworkAdapter async continueConversation( reference: Partial, oAuthScopeOrlogic: string | ((context: TurnContext) => Promise), - maybeLogic?: (context: TurnContext) => Promise + maybeLogic?: (context: TurnContext) => Promise, ): Promise { let audience: string; if (LogicT.safeParse(oAuthScopeOrlogic).success) { @@ -430,7 +423,7 @@ export class BotFrameworkAdapter const request = TurnContext.applyConversationReference( { type: ActivityTypes.Event, name: ActivityEventNames.ContinueConversation }, reference, - true + true, ); const context = this.createContext(request); @@ -443,11 +436,9 @@ export class BotFrameworkAdapter /** * Asynchronously creates and starts a conversation with a user on a channel. - * * @param {Partial} reference A reference for the conversation to create. * @param {(context: TurnContext) => Promise} logic The asynchronous method to call after the adapter middleware runs. * @returns {Promise} a promise representing the asynchronous operation - * * @summary * To use this method, you need both the bot's and the user's account information on a channel. * The Bot Connector service supports the creating of group conversations; however, this @@ -488,12 +479,11 @@ export class BotFrameworkAdapter */ createConversation( reference: Partial, - logic: (context: TurnContext) => Promise + logic: (context: TurnContext) => Promise, ): Promise; /** * Asynchronously creates and starts a conversation with a user on a channel. - * * @param {Partial} reference A reference for the conversation to create. * @param {Partial} parameters Parameters used when creating the conversation * @param {(context: TurnContext) => Promise} logic The asynchronous method to call after the adapter middleware runs. @@ -502,7 +492,7 @@ export class BotFrameworkAdapter createConversation( reference: Partial, parameters: Partial, - logic: (context: TurnContext) => Promise + logic: (context: TurnContext) => Promise, ): Promise; /** @@ -511,7 +501,7 @@ export class BotFrameworkAdapter async createConversation( reference: Partial, parametersOrLogic: Partial | ((context: TurnContext) => Promise), - maybeLogic?: (context: TurnContext) => Promise + maybeLogic?: (context: TurnContext) => Promise, ): Promise { if (!reference.serviceUrl) { throw new Error('BotFrameworkAdapter.createConversation(): missing serviceUrl.'); @@ -534,7 +524,7 @@ export class BotFrameworkAdapter activity: null, channelData: null, }, - parameters + parameters, ); const client = this.createConnectorClient(reference.serviceUrl); @@ -554,7 +544,7 @@ export class BotFrameworkAdapter const request = TurnContext.applyConversationReference( { type: ActivityTypes.Event, name: ActivityEventNames.CreateConversation }, reference, - true + true, ); request.conversation = { @@ -582,10 +572,8 @@ export class BotFrameworkAdapter * This interface supports the framework and is not intended to be called directly for your code. * Use [TurnContext.deleteActivity](xref:botbuilder-core.TurnContext.deleteActivity) to delete * an activity from your bot code. - * * @param context The context object for the turn. * @param reference Conversation reference information for the activity to delete. - * * @remarks * Not all channels support this operation. For channels that don't, this call may throw an exception. */ @@ -602,17 +590,15 @@ export class BotFrameworkAdapter const client: ConnectorClient = this.getOrCreateConnectorClient( context, reference.serviceUrl, - this.credentials + this.credentials, ); await client.conversations.deleteActivity(reference.conversation.id, reference.activityId); } /** * Asynchronously removes a member from the current conversation. - * * @param context The context object for the turn. * @param memberId The ID of the member to remove from the conversation. - * * @remarks * Remove a member's identity information from the conversation. * @@ -633,13 +619,10 @@ export class BotFrameworkAdapter /** * Asynchronously lists the members of a given activity. - * * @param context The context object for the turn. * @param activityId Optional. The ID of the activity to get the members of. If not specified, the current activity ID is used. - * * @returns An array of [ChannelAccount](xref:botframework-schema.ChannelAccount) objects for * the users involved in a given activity. - * * @remarks * Returns an array of [ChannelAccount](xref:botframework-schema.ChannelAccount) objects for * the users involved in a given activity. @@ -659,7 +642,7 @@ export class BotFrameworkAdapter } if (!activityId) { throw new Error( - 'BotFrameworkAdapter.getActivityMembers(): missing both activityId and context.activity.id' + 'BotFrameworkAdapter.getActivityMembers(): missing both activityId and context.activity.id', ); } const serviceUrl: string = context.activity.serviceUrl; @@ -671,12 +654,9 @@ export class BotFrameworkAdapter /** * Asynchronously lists the members of the current conversation. - * * @param context The context object for the turn. - * * @returns An array of [ChannelAccount](xref:botframework-schema.ChannelAccount) objects for * all users currently involved in a conversation. - * * @remarks * Returns an array of [ChannelAccount](xref:botframework-schema.ChannelAccount) objects for * all users currently involved in a conversation. @@ -700,15 +680,12 @@ export class BotFrameworkAdapter /** * For the specified channel, asynchronously gets a page of the conversations in which this bot has participated. - * * @param contextOrServiceUrl The URL of the channel server to query or a * [TurnContext](xref:botbuilder-core.TurnContext) object from a conversation on the channel. * @param continuationToken Optional. The continuation token from the previous page of results. * Omit this parameter or use `undefined` to retrieve the first page of results. - * * @returns A [ConversationsResult](xref:botframework-schema.ConversationsResult) object containing a page of results * and a continuation token. - * * @remarks * The the return value's [conversations](xref:botframework-schema.ConversationsResult.conversations) property contains a page of * [ConversationMembers](xref:botframework-schema.ConversationMembers) objects. Each object's @@ -724,7 +701,7 @@ export class BotFrameworkAdapter */ async getConversations( contextOrServiceUrl: TurnContext | string, - continuationToken?: string + continuationToken?: string, ): Promise { let client: ConnectorClient; if (typeof contextOrServiceUrl === 'object') { @@ -735,18 +712,16 @@ export class BotFrameworkAdapter } return await client.conversations.getConversations( - continuationToken ? { continuationToken: continuationToken } : undefined + continuationToken ? { continuationToken: continuationToken } : undefined, ); } /** * Asynchronously attempts to retrieve the token for a user that's in a login flow. - * * @param context The context object for the turn. * @param connectionName The name of the auth connection to use. * @param magicCode Optional. The validation code the user entered. * @param oAuthAppCredentials AppCredentials for OAuth. - * * @returns A [TokenResponse](xref:botframework-schema.TokenResponse) object that contains the user token. */ async getUserToken(context: TurnContext, connectionName: string, magicCode?: string): Promise; @@ -754,23 +729,21 @@ export class BotFrameworkAdapter context: TurnContext, connectionName: string, magicCode?: string, - oAuthAppCredentials?: CoreAppCredentials + oAuthAppCredentials?: CoreAppCredentials, ): Promise; /** * Asynchronously attempts to retrieve the token for a user that's in a login flow. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for the turn. * @param connectionName The name of the auth connection to use. * @param magicCode Optional. The validation code the user entered. * @param oAuthAppCredentials Optional. [AppCredentials](xref:botframework-connector.AppCredentials) for OAuth. - * * @returns A [TokenResponse](xref:botframework-schema.TokenResponse) object that contains the user token. */ async getUserToken( context: TurnContext, connectionName: string, magicCode?: string, - oAuthAppCredentials?: AppCredentials + oAuthAppCredentials?: AppCredentials, ): Promise { if (!context.activity.from || !context.activity.from.id) { throw new Error('BotFrameworkAdapter.getUserToken(): missing from or from.id'); @@ -787,7 +760,7 @@ export class BotFrameworkAdapter const result: TokenApiModels.UserTokenGetTokenResponse = await client.userToken.getToken( userId, connectionName, - { code: magicCode, channelId: context.activity.channelId } + { code: magicCode, channelId: context.activity.channelId }, ); if (!result || !result.token || result._response.status == 404) { return undefined; @@ -798,7 +771,6 @@ export class BotFrameworkAdapter /** * Asynchronously signs out the user from the token server. - * * @param context The context object for the turn. * @param connectionName The name of the auth connection to use. * @param userId The ID of user to sign out. @@ -809,11 +781,10 @@ export class BotFrameworkAdapter context: TurnContext, connectionName?: string, userId?: string, - oAuthAppCredentials?: CoreAppCredentials + oAuthAppCredentials?: CoreAppCredentials, ): Promise; /** * Asynchronously signs out the user from the token server. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for the turn. * @param connectionName Optional. The name of the auth connection to use. * @param userId Optional. The ID of the user to sign out. @@ -823,7 +794,7 @@ export class BotFrameworkAdapter context: TurnContext, connectionName?: string, userId?: string, - oAuthAppCredentials?: AppCredentials + oAuthAppCredentials?: AppCredentials, ): Promise { if (!context.activity.from || !context.activity.from.id) { throw new Error('BotFrameworkAdapter.signOutUser(): missing from or from.id'); @@ -846,7 +817,6 @@ export class BotFrameworkAdapter /** * Asynchronously gets a sign-in link from the token server that can be sent as part * of a [SigninCard](xref:botframework-schema.SigninCard). - * * @param context The context object for the turn. * @param connectionName The name of the auth connection to use. * @param oAuthAppCredentials AppCredentials for OAuth. @@ -858,19 +828,18 @@ export class BotFrameworkAdapter connectionName: string, oAuthAppCredentials?: AppCredentials, userId?: string, - finalRedirect?: string + finalRedirect?: string, ): Promise; async getSignInLink( context: TurnContext, connectionName: string, oAuthAppCredentials?: CoreAppCredentials, userId?: string, - finalRedirect?: string + finalRedirect?: string, ): Promise; /** * Asynchronously gets a sign-in link from the token server that can be sent as part * of a [SigninCard](xref:botframework-schema.SigninCard). - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for the turn. * @param connectionName The name of the auth connection to use. * @param oAuthAppCredentials Optional. [AppCredentials](xref:botframework-connector.AppCredentials) for OAuth. @@ -883,11 +852,11 @@ export class BotFrameworkAdapter connectionName: string, oAuthAppCredentials?: AppCredentials, userId?: string, - finalRedirect?: string + finalRedirect?: string, ): Promise { if (userId && userId != context.activity.from.id) { throw new ReferenceError( - "cannot retrieve OAuth signin link for a user that's different from the conversation" + "cannot retrieve OAuth signin link for a user that's different from the conversation", ); } @@ -911,14 +880,12 @@ export class BotFrameworkAdapter /** * Asynchronously retrieves the token status for each configured connection for the given user. - * * @param context The context object for the turn. * @param userId Optional. If present, the ID of the user to retrieve the token status for. * Otherwise, the ID of the user who sent the current activity is used. * @param includeFilter Optional. A comma-separated list of connection's to include. If present, * the `includeFilter` parameter limits the tokens this method returns. * @param oAuthAppCredentials AppCredentials for OAuth. - * * @returns The [TokenStatus](xref:botframework-connector.TokenStatus) objects retrieved. */ async getTokenStatus(context: TurnContext, userId?: string, includeFilter?: string): Promise; @@ -926,25 +893,23 @@ export class BotFrameworkAdapter context: TurnContext, userId?: string, includeFilter?: string, - oAuthAppCredentials?: CoreAppCredentials + oAuthAppCredentials?: CoreAppCredentials, ): Promise; /** * Asynchronously retrieves the token status for each configured connection for the given user. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for the turn. * @param userId Optional. If present, the ID of the user to retrieve the token status for. * Otherwise, the ID of the user who sent the current activity is used. * @param includeFilter Optional. A comma-separated list of connection's to include. If present, * the `includeFilter` parameter limits the tokens this method returns. * @param oAuthAppCredentials Optional. [AppCredentials](xref:botframework-connector.AppCredentials) for OAuth. - * * @returns The [TokenStatus](xref:botframework-connector.TokenStatus) objects retrieved. */ async getTokenStatus( context: TurnContext, userId?: string, includeFilter?: string, - oAuthAppCredentials?: AppCredentials + oAuthAppCredentials?: AppCredentials, ): Promise { if (!userId && (!context.activity.from || !context.activity.from.id)) { throw new Error('BotFrameworkAdapter.getTokenStatus(): missing from or from.id'); @@ -965,40 +930,36 @@ export class BotFrameworkAdapter /** * Asynchronously signs out the user from the token server. - * * @param context The context object for the turn. * @param connectionName The name of the auth connection to use. * @param resourceUrls The list of resource URLs to retrieve tokens for. * @param oAuthAppCredentials AppCredentials for OAuth. - * * @returns A map of the [TokenResponse](xref:botframework-schema.TokenResponse) objects by resource URL. */ async getAadTokens( context: TurnContext, connectionName: string, - resourceUrls: string[] + resourceUrls: string[], ): Promise<{ [propertyName: string]: TokenResponse }>; async getAadTokens( context: TurnContext, connectionName: string, resourceUrls: string[], - oAuthAppCredentials?: CoreAppCredentials + oAuthAppCredentials?: CoreAppCredentials, ): Promise<{ [propertyName: string]: TokenResponse }>; /** * Asynchronously signs out the user from the token server. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for the turn. * @param connectionName The name of the auth connection to use. * @param resourceUrls The list of resource URLs to retrieve tokens for. * @param oAuthAppCredentials Optional. [AppCredentials](xref:botframework-connector.AppCredentials) for OAuth. - * * @returns A map of the [TokenResponse](xref:botframework-schema.TokenResponse) objects by resource URL. */ async getAadTokens( context: TurnContext, connectionName: string, resourceUrls: string[], - oAuthAppCredentials?: AppCredentials + oAuthAppCredentials?: AppCredentials, ): Promise<{ [propertyName: string]: TokenResponse }> { if (!context.activity.from || !context.activity.from.id) { throw new Error('BotFrameworkAdapter.getAadTokens(): missing from or from.id'); @@ -1014,14 +975,13 @@ export class BotFrameworkAdapter userId, connectionName, { resourceUrls: resourceUrls }, - { channelId: context.activity.channelId } + { channelId: context.activity.channelId }, ) )._response.parsedBody as { [propertyName: string]: TokenResponse }; } /** * Asynchronously Get the raw signin resource to be sent to the user for signin. - * * @param context The context object for the turn. * @param connectionName The name of the auth connection to use. * @param userId The user id that will be associated with the token. @@ -1034,7 +994,7 @@ export class BotFrameworkAdapter connectionName: string, userId?: string, finalRedirect?: string, - appCredentials?: CoreAppCredentials + appCredentials?: CoreAppCredentials, ): Promise { if (!connectionName) { throw new Error('getUserToken() requires a connectionName but none was provided.'); @@ -1047,7 +1007,7 @@ export class BotFrameworkAdapter // The provided userId doesn't match the from.id on the activity. (same for finalRedirect) if (userId && context.activity.from.id !== userId) { throw new Error( - 'BotFrameworkAdapter.getSiginInResource(): cannot get signin resource for a user that is different from the conversation' + 'BotFrameworkAdapter.getSiginInResource(): cannot get signin resource for a user that is different from the conversation', ); } @@ -1070,7 +1030,6 @@ export class BotFrameworkAdapter /** * Asynchronously Performs a token exchange operation such as for single sign-on. - * * @param context Context for the current turn of conversation with the user. * @param connectionName Name of the auth connection to use. * @param userId The user id that will be associated with the token. @@ -1082,11 +1041,10 @@ export class BotFrameworkAdapter connectionName: string, userId: string, tokenExchangeRequest: TokenExchangeRequest, - appCredentials?: CoreAppCredentials + appCredentials?: CoreAppCredentials, ): Promise; /** * Asynchronously Performs a token exchange operation such as for single sign-on. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for the turn. * @param connectionName Name of the auth connection to use. * @param userId The user id that will be associated with the token. @@ -1099,7 +1057,7 @@ export class BotFrameworkAdapter connectionName: string, userId: string, tokenExchangeRequest: TokenExchangeRequest, - appCredentials?: AppCredentials + appCredentials?: AppCredentials, ): Promise { if (!connectionName) { throw new Error('exchangeToken() requires a connectionName but none was provided.'); @@ -1111,7 +1069,7 @@ export class BotFrameworkAdapter if (tokenExchangeRequest && !tokenExchangeRequest.token && !tokenExchangeRequest.uri) { throw new Error( - 'BotFrameworkAdapter.exchangeToken(): Either a Token or Uri property is required on the TokenExchangeRequest' + 'BotFrameworkAdapter.exchangeToken(): Either a Token or Uri property is required on the TokenExchangeRequest', ); } @@ -1123,7 +1081,7 @@ export class BotFrameworkAdapter userId, connectionName, context.activity.channelId, - tokenExchangeRequest + tokenExchangeRequest, ) )._response.parsedBody as TokenResponse; } @@ -1132,10 +1090,8 @@ export class BotFrameworkAdapter * Asynchronously sends an emulated OAuth card for a channel. * * This method supports the framework and is not intended to be called directly for your code. - * * @param contextOrServiceUrl The URL of the emulator. * @param emulate `true` to send an emulated OAuth card to the emulator; or `false` to not send the card. - * * @remarks * When testing a bot in the Bot Framework Emulator, this method can emulate the OAuth card interaction. */ @@ -1147,11 +1103,9 @@ export class BotFrameworkAdapter /** * Asynchronously creates a turn context and runs the middleware pipeline for an incoming activity. - * * @param req An Express or Restify style request object. * @param res An Express or Restify style response object. * @param logic The function to call at the end of the middleware pipeline. - * * @remarks * This is the main way a bot receives incoming messages and defines a turn in the conversation. This method: * @@ -1198,7 +1152,7 @@ export class BotFrameworkAdapter async processActivity( req: WebRequest, res: WebResponse, - logic: (context: TurnContext) => Promise + logic: (context: TurnContext) => Promise, ): Promise { let body: any; let status: number; @@ -1289,10 +1243,8 @@ export class BotFrameworkAdapter * Asynchronously creates a turn context and runs the middleware pipeline for an incoming activity. * * Use [CloudAdapter.processActivityDirect] instead. - * * @param activity The activity to process. * @param logic The function to call at the end of the middleware pipeline. - * * @remarks * This is the main way a bot receives incoming messages and defines a turn in the conversation. This method: * @@ -1339,12 +1291,9 @@ export class BotFrameworkAdapter * This method supports the framework and is not intended to be called directly for your code. * Use the turn context's [sendActivity](xref:botbuilder-core.TurnContext.sendActivity) or * [sendActivities](xref:botbuilder-core.TurnContext.sendActivities) method from your bot code. - * * @param context The context object for the turn. * @param activities The activities to send. - * * @returns An array of [ResourceResponse](xref:) - * * @remarks * The activities will be sent one after another in the order in which they're received. A * response object will be returned for each sent activity. For `message` activities this will @@ -1374,7 +1323,7 @@ export class BotFrameworkAdapter if (activity && BotFrameworkAdapter.isStreamingServiceUrl(activity.serviceUrl)) { if (!this.isStreamingConnectionOpen) { throw new Error( - 'BotFrameworkAdapter.sendActivities(): Unable to send activity as Streaming connection is closed.' + 'BotFrameworkAdapter.sendActivities(): Unable to send activity as Streaming connection is closed.', ); } TokenResolver.checkForOAuthCards(this, context, activity as Activity); @@ -1388,12 +1337,12 @@ export class BotFrameworkAdapter await client.conversations.replyToActivity( activity.conversation.id, activity.replyToId, - activity - ) + activity, + ), ); } else { responses.push( - await client.conversations.sendToConversation(activity.conversation.id, activity) + await client.conversations.sendToConversation(activity.conversation.id, activity), ); } break; @@ -1409,7 +1358,6 @@ export class BotFrameworkAdapter * This interface supports the framework and is not intended to be called directly for your code. * Use [TurnContext.updateActivity](xref:botbuilder-core.TurnContext.updateActivity) to update * an activity from your bot code. - * * @param context The context object for the turn. * @param activity The updated version of the activity to replace. * @returns A `Promise` representing the [ResourceResponse](xref:botframework-schema.ResourceResponse) for the operation. @@ -1433,7 +1381,6 @@ export class BotFrameworkAdapter /** * Creates a connector client. - * * @param serviceUrl The client's service URL. * @returns The [ConnectorClient](xref:botbuilder-connector.ConnectorClient) instance. * @remarks @@ -1445,7 +1392,6 @@ export class BotFrameworkAdapter /** * Create a ConnectorClient with a ClaimsIdentity. - * * @remarks * If the ClaimsIdentity contains the claims for a Skills request, create a ConnectorClient for use with Skills. * Derives the correct audience from the ClaimsIdentity, or the instance's credentials property. @@ -1455,7 +1401,6 @@ export class BotFrameworkAdapter async createConnectorClientWithIdentity(serviceUrl: string, identity: ClaimsIdentity): Promise; /** * Create a ConnectorClient with a ClaimsIdentity and an explicit audience. - * * @remarks * If the trimmed audience is not a non-zero length string, the audience will be derived from the ClaimsIdentity or * the instance's credentials property. @@ -1466,11 +1411,10 @@ export class BotFrameworkAdapter async createConnectorClientWithIdentity( serviceUrl: string, identity: ClaimsIdentity, - audience: string + audience: string, ): Promise; /** * Create a [ConnectorClient](xref:botbuilder-connector.ConnectorClient) with a [ClaimsIdentity](xref:botbuilder-connector.ClaimsIdentity). - * * @remarks * If the [ClaimsIdentity](xref:botbuilder-connector.ClaimsIdentity) contains the claims for a Skills request, create a [ConnectorClient](xref:botbuilder-connector.ConnectorClient) for use with Skills. * Derives the correct audience from the [ClaimsIdentity](xref:botbuilder-connector.ClaimsIdentity), or the instance's credentials property. @@ -1482,7 +1426,7 @@ export class BotFrameworkAdapter async createConnectorClientWithIdentity( serviceUrl: string, identity: ClaimsIdentity, - audience?: string + audience?: string, ): Promise { if (!identity) { throw new Error('BotFrameworkAdapter.createConnectorClientWithIdentity(): invalid identity parameter.'); @@ -1506,7 +1450,7 @@ export class BotFrameworkAdapter // for a non-existent streaming connection results in an error if (!this.streamingServer) { throw new Error( - `Cannot create streaming connector client for serviceUrl ${serviceUrl} without a streaming connection. Call 'useWebSocket' or 'useNamedPipe' to start a streaming connection.` + `Cannot create streaming connector client for serviceUrl ${serviceUrl} without a streaming connection. Call 'useWebSocket' or 'useNamedPipe' to start a streaming connection.`, ); } @@ -1576,7 +1520,7 @@ export class BotFrameworkAdapter private getOrCreateConnectorClient( context: TurnContext, serviceUrl: string, - credentials: AppCredentials + credentials: AppCredentials, ): ConnectorClient { if (!context || !context.turnState) throw new Error('invalid context parameter'); if (!serviceUrl) throw new Error('invalid serviceUrl'); @@ -1593,10 +1537,8 @@ export class BotFrameworkAdapter /** * Returns the correct [OAuthScope](xref:botframework-connector.AppCredentials.OAuthScope) for [AppCredentials](xref:botframework-connector.AppCredentials). - * * @param botAppId The bot's AppId. * @param claims The [Claim](xref:botbuilder-connector.Claim) list to check. - * * @returns The current credentials' OAuthScope. */ private async getOAuthScope(botAppId: string, claims: Claim[]): Promise { @@ -1629,7 +1571,7 @@ export class BotFrameworkAdapter appId, this.settings.certificateThumbprint, this.settings.certificatePrivateKey, - this.settings.channelAuthTenant + this.settings.channelAuthTenant, ); } else { if (JwtTokenValidation.isGovernment(this.settings.channelService)) { @@ -1637,14 +1579,14 @@ export class BotFrameworkAdapter appId, appPassword, this.settings.channelAuthTenant, - oAuthScope + oAuthScope, ); } else { credentials = new MicrosoftAppCredentials( appId, appPassword, this.settings.channelAuthTenant, - oAuthScope + oAuthScope, ); } } @@ -1654,20 +1596,16 @@ export class BotFrameworkAdapter /** * Creates an OAuth API client. - * * @param serviceUrl The client's service URL. * @param oAuthAppCredentials AppCredentials for OAuth. - * * @remarks * Override this in a derived class to create a mock OAuth API client for unit testing. */ protected createTokenApiClient(serviceUrl: string, oAuthAppCredentials?: CoreAppCredentials): TokenApiClient; /** * Creates an OAuth API client. - * * @param serviceUrl The client's service URL. * @param oAuthAppCredentials Optional. The [AppCredentials](xref:botframework-connector.AppCredentials)for OAuth. - * * @remarks * Override this in a derived class to create a mock OAuth API client for unit testing. * @returns The client. @@ -1681,7 +1619,6 @@ export class BotFrameworkAdapter /** * Allows for the overriding of authentication in unit tests. - * * @param request Received request. * @param authHeader Received authentication header. */ @@ -1711,14 +1648,13 @@ export class BotFrameworkAdapter authHeader, this.credentialsProvider, this.settings.channelService, - this.authConfiguration + this.authConfiguration, ); } /** * Generates the CallerId property for the activity based on * https://github.com/microsoft/botframework-obi/blob/main/protocols/botframework-activity/botframework-activity.md#appendix-v---caller-id-values. - * * @param identity The inbound claims. * @returns {Promise} a promise representing the generated callerId. */ @@ -1755,7 +1691,6 @@ export class BotFrameworkAdapter /** * Gets the OAuth API endpoint. - * * @param contextOrServiceUrl The URL of the channel server to query or * a [TurnContext](xref:botbuilder-core.TurnContext). For a turn context, the context's * [activity](xref:botbuilder-core.TurnContext.activity).[serviceUrl](xref:botframework-schema.Activity.serviceUrl) @@ -1770,17 +1705,15 @@ export class BotFrameworkAdapter ? contextOrServiceUrl.activity.serviceUrl : contextOrServiceUrl : this.settings.oAuthEndpoint - ? this.settings.oAuthEndpoint - : JwtTokenValidation.isGovernment(this.settings.channelService) - ? US_GOV_OAUTH_ENDPOINT - : OAUTH_ENDPOINT; + ? this.settings.oAuthEndpoint + : JwtTokenValidation.isGovernment(this.settings.channelService) + ? US_GOV_OAUTH_ENDPOINT + : OAUTH_ENDPOINT; } /** * Checks the environment and can set a flag to emulate OAuth cards. - * * @param context The context object for the turn. - * * @remarks * Override this in a derived class to control how OAuth cards are emulated for unit testing. */ @@ -1792,7 +1725,6 @@ export class BotFrameworkAdapter /** * Creates a turn context. - * * @param request An incoming request body. * @returns A new [TurnContext](xref:botbuilder-core.TurnContext) instance. * @remarks @@ -1805,7 +1737,6 @@ export class BotFrameworkAdapter /** * Checks the validity of the request and attempts to map it the correct virtual endpoint, * then generates and returns a response if appropriate. - * * @param request A ReceiveRequest from the connected channel. * @returns A response created by the BotAdapter to be sent to the client that originated the request. */ @@ -1854,7 +1785,7 @@ export class BotFrameworkAdapter response.setBody( `Invalid verb received for ${request.verb.toLocaleLowerCase()}. Only GET and POST are accepted. Verb: ${ request.verb - }` + }`, ); return response; @@ -1893,7 +1824,6 @@ export class BotFrameworkAdapter /** * Process a web request by applying a logic function. - * * @param req An incoming HTTP [Request](xref:botbuilder.Request) * @param res The corresponding HTTP [Response](xref:botbuilder.Response) * @param logic The logic function to apply @@ -1904,7 +1834,6 @@ export class BotFrameworkAdapter /** * Handle a web socket connection by applying a logic function to * each streaming request. - * * @param req An incoming HTTP [Request](xref:botbuilder.Request) * @param socket The corresponding [INodeSocket](xref:botframework-streaming.INodeSocket) * @param head The corresponding [INodeBuffer](xref:botframework-streaming.INodeBuffer) @@ -1915,7 +1844,7 @@ export class BotFrameworkAdapter req: Request, socket: INodeSocket, head: INodeBuffer, - logic: (context: TurnContext) => Promise + logic: (context: TurnContext) => Promise, ): Promise; /** @@ -1925,14 +1854,14 @@ export class BotFrameworkAdapter req: Request, resOrSocket: Response | INodeSocket, logicOrHead: ((context: TurnContext) => Promise) | INodeBuffer, - maybeLogic?: (context: TurnContext) => Promise + maybeLogic?: (context: TurnContext) => Promise, ): Promise { if (maybeLogic) { return this.useWebSocket( req, INodeSocketT.parse(resOrSocket), INodeBufferT.parse(logicOrHead), - LogicT.parse(maybeLogic) + LogicT.parse(maybeLogic), ); } else { return this.processActivity(req, ResponseT.parse(resOrSocket), LogicT.parse(logicOrHead)); @@ -1941,7 +1870,6 @@ export class BotFrameworkAdapter /** * Connects the handler to a Named Pipe server and begins listening for incoming requests. - * * @param logic The logic that will handle incoming requests. * @param pipeName The name of the named pipe to use when creating the server. * @param retryCount Number of times to attempt to bind incoming and outgoing pipe @@ -1951,7 +1879,7 @@ export class BotFrameworkAdapter logic: (context: TurnContext) => Promise, pipeName = defaultPipeName, retryCount = 7, - onListen?: () => void + onListen?: () => void, ): Promise { if (!logic) { throw new Error('Bot logic needs to be provided to `useNamedPipe`'); @@ -1967,7 +1895,7 @@ export class BotFrameworkAdapter // Each BotFrameworkAdapter instance is scoped to a stream, so switching streams // results in dropped conversations that the bot cannot reconnect to. throw new Error( - 'This BotFrameworkAdapter instance is already connected to a different stream. Use a new instance to connect to the provided pipeName.' + 'This BotFrameworkAdapter instance is already connected to a different stream. Use a new instance to connect to the provided pipeName.', ); } } @@ -1979,7 +1907,6 @@ export class BotFrameworkAdapter /** * Process the initial request to establish a long lived connection via a streaming server. - * * @param req The connection request. * @param socket The raw socket connection between the bot (server) and channel/caller (client). * @param head The first packet of the upgraded stream. @@ -1989,7 +1916,7 @@ export class BotFrameworkAdapter req: WebRequest, socket: INodeSocket, head: INodeBuffer, - logic: (context: TurnContext) => Promise + logic: (context: TurnContext) => Promise, ): Promise { // Use the provided NodeWebSocketFactoryBase on BotFrameworkAdapter construction, // otherwise create a new NodeWebSocketFactory. @@ -2037,7 +1964,7 @@ export class BotFrameworkAdapter authHeader, this.credentialsProvider, channelService, - channelIdHeader + channelIdHeader, ); if (!claims.isAuthenticated) { @@ -2047,7 +1974,6 @@ export class BotFrameworkAdapter /** * Connects the handler to a WebSocket server and begins listening for incoming requests. - * * @param socket The socket to use when creating the server. */ private async startWebSocket(socket: ISocket): Promise { @@ -2070,7 +1996,7 @@ export class BotFrameworkAdapter : await attachmentStream.readAsString(); return { contentType, content }; - }) + }), ); return activity; @@ -2078,7 +2004,7 @@ export class BotFrameworkAdapter private async handleVersionRequest( request: IReceiveRequest, - response: StreamingResponse + response: StreamingResponse, ): Promise { if (request.verb.toLocaleUpperCase() === GET) { response.statusCode = StatusCodes.OK; @@ -2105,7 +2031,7 @@ export class BotFrameworkAdapter } else { response.statusCode = StatusCodes.METHOD_NOT_ALLOWED; response.setBody( - `Invalid verb received for path: ${request.path}. Only GET is accepted. Verb: ${request.verb}` + `Invalid verb received for path: ${request.path}. Only GET is accepted. Verb: ${request.verb}`, ); } @@ -2115,9 +2041,8 @@ export class BotFrameworkAdapter /** * Determine if the serviceUrl was sent via an Http/Https connection or Streaming * This can be determined by looking at the ServiceUrl property: - * (1) All channels that send messages via http/https are not streaming - * (2) Channels that send messages via streaming have a ServiceUrl that does not begin with http/https. - * + * (1) All channels that send messages via http/https are not streaming + * (2) Channels that send messages via streaming have a ServiceUrl that does not begin with http/https. * @param serviceUrl the serviceUrl provided in the resquest. * @returns True if the serviceUrl is a streaming url, otherwise false. */ @@ -2160,7 +2085,6 @@ function parseRequest(req: WebRequest): Promise { /** * Creates an error message with status code to write to socket, then closes the connection. - * * @param socket The raw socket connection between the bot (server) and channel/caller (client). * @param err The error. If the error includes a status code, it will be included in the message written to the socket. */ @@ -2169,11 +2093,13 @@ function abortWebSocketUpgrade(socket: INodeSocket, err: any): void { const connectionHeader = "Connection: 'close'\r\n"; let message = ''; - AuthenticationError.isStatusCodeError(err) - ? (message = `HTTP/1.1 ${err.statusCode} ${StatusCodes[err.statusCode]}\r\n${ - err.message - }\r\n${connectionHeader}\r\n`) - : (message = AuthenticationError.determineStatusCodeAndBuildMessage(err)); + if (AuthenticationError.isStatusCodeError(err)) { + message = `HTTP/1.1 ${err.statusCode} ${StatusCodes[err.statusCode]}\r\n${ + err.message + }\r\n${connectionHeader}\r\n`; + } else { + message = AuthenticationError.determineStatusCodeAndBuildMessage(err); + } socket.write(message); } diff --git a/libraries/botbuilder/src/botFrameworkHttpAdapter.ts b/libraries/botbuilder/src/botFrameworkHttpAdapter.ts index 5e174b67db..0de6b76d07 100644 --- a/libraries/botbuilder/src/botFrameworkHttpAdapter.ts +++ b/libraries/botbuilder/src/botFrameworkHttpAdapter.ts @@ -24,7 +24,7 @@ export interface BotFrameworkHttpAdapter { req: Request, socket: INodeSocket, head: INodeBuffer, - logic: (context: TurnContext) => Promise + logic: (context: TurnContext) => Promise, ): Promise; /** diff --git a/libraries/botbuilder/src/botFrameworkHttpClient.ts b/libraries/botbuilder/src/botFrameworkHttpClient.ts index 1586cf64f5..9ca4c50934 100644 --- a/libraries/botbuilder/src/botFrameworkHttpClient.ts +++ b/libraries/botbuilder/src/botFrameworkHttpClient.ts @@ -37,7 +37,6 @@ export class BotFrameworkHttpClient implements BotFrameworkClient { /** * Creates a new instance of the [BotFrameworkHttpClient](xref:botbuilder.BotFrameworkHttpClient) class - * * @param credentialProvider An instance of [ICredentialProvider](xref:botframework-connector.ICredentialProvider). * @param channelService Optional. The channel service. */ @@ -52,7 +51,6 @@ export class BotFrameworkHttpClient implements BotFrameworkClient { /** * Forwards an activity to another bot. - * * @remarks * @template T The type of body in the InvokeResponse. * @param fromBotId The MicrosoftAppId of the bot sending the activity. @@ -69,12 +67,12 @@ export class BotFrameworkHttpClient implements BotFrameworkClient { toUrl: string, serviceUrl: string, conversationId: string, - activity: Activity + activity: Activity, ): Promise> { const appCredentials = await this.getAppCredentials(fromBotId, toBotId); if (!appCredentials) { throw new Error( - 'BotFrameworkHttpClient.postActivity(): Unable to get appCredentials to connect to the skill' + 'BotFrameworkHttpClient.postActivity(): Unable to get appCredentials to connect to the skill', ); } @@ -149,10 +147,8 @@ export class BotFrameworkHttpClient implements BotFrameworkClient { /** * Logic to build an [AppCredentials](xref:botframework-connector.AppCredentials) to be used to acquire tokens for this `HttpClient`. - * * @param appId The application id. * @param oAuthScope Optional. The OAuth scope. - * * @returns The app credentials to be used to acquire tokens. */ protected async buildCredentials(appId: string, oAuthScope?: string): Promise { diff --git a/libraries/botbuilder/src/channelServiceHandler.ts b/libraries/botbuilder/src/channelServiceHandler.ts index 1cf75ce0ff..0ccac805c6 100644 --- a/libraries/botbuilder/src/channelServiceHandler.ts +++ b/libraries/botbuilder/src/channelServiceHandler.ts @@ -22,7 +22,6 @@ import { export class ChannelServiceHandler extends ChannelServiceHandlerBase { /** * Initializes a new instance of the ChannelServiceHandler class, using a credential provider. - * * @param credentialProvider The credential provider. * @param authConfig The authentication configuration. * @param channelService A string representing the channel provider. @@ -30,7 +29,7 @@ export class ChannelServiceHandler extends ChannelServiceHandlerBase { constructor( private readonly credentialProvider: ICredentialProvider, private readonly authConfig: AuthenticationConfiguration, - protected readonly channelService = process.env[AuthenticationConstants.ChannelService] + protected readonly channelService = process.env[AuthenticationConstants.ChannelService], ) { super(); @@ -62,7 +61,7 @@ export class ChannelServiceHandler extends ChannelServiceHandlerBase { this.channelService, 'unknown', undefined, - this.authConfig + this.authConfig, ); } } diff --git a/libraries/botbuilder/src/channelServiceHandlerBase.ts b/libraries/botbuilder/src/channelServiceHandlerBase.ts index 02a91a8537..8ee7a124ea 100644 --- a/libraries/botbuilder/src/channelServiceHandlerBase.ts +++ b/libraries/botbuilder/src/channelServiceHandlerBase.ts @@ -25,7 +25,6 @@ import { export abstract class ChannelServiceHandlerBase { /** * Sends an [Activity](xref:botframework-schema.Activity) to the end of a conversation. - * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param activity The [Activity](xref:botframework-schema.Activity) to send. @@ -34,7 +33,7 @@ export abstract class ChannelServiceHandlerBase { async handleSendToConversation( authHeader: string, conversationId: string, - activity: Activity + activity: Activity, ): Promise { const claimsIdentity = await this.authenticate(authHeader); return this.onSendToConversation(claimsIdentity, conversationId, activity); @@ -42,7 +41,6 @@ export abstract class ChannelServiceHandlerBase { /** * Sends a reply to an [Activity](xref:botframework-schema.Activity). - * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param activityId The activity Id the reply is to. @@ -53,7 +51,7 @@ export abstract class ChannelServiceHandlerBase { authHeader: string, conversationId: string, activityId: string, - activity: Activity + activity: Activity, ): Promise { const claimsIdentity = await this.authenticate(authHeader); return this.onReplyToActivity(claimsIdentity, conversationId, activityId, activity); @@ -61,7 +59,6 @@ export abstract class ChannelServiceHandlerBase { /** * Edits a previously sent existing [Activity](xref:botframework-schema.Activity). - * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param activityId The activity Id to update. @@ -72,7 +69,7 @@ export abstract class ChannelServiceHandlerBase { authHeader: string, conversationId: string, activityId: string, - activity: Activity + activity: Activity, ): Promise { const claimsIdentity = await this.authenticate(authHeader); return this.onUpdateActivity(claimsIdentity, conversationId, activityId, activity); @@ -80,7 +77,6 @@ export abstract class ChannelServiceHandlerBase { /** * Deletes an existing [Activity](xref:botframework-schema.Activity). - * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param activityId The activity Id to delete. @@ -92,7 +88,6 @@ export abstract class ChannelServiceHandlerBase { /** * Enumerates the members of an [Activity](xref:botframework-schema.Activity). - * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param activityId The activity Id. @@ -101,7 +96,7 @@ export abstract class ChannelServiceHandlerBase { async handleGetActivityMembers( authHeader: string, conversationId: string, - activityId: string + activityId: string, ): Promise { const claimsIdentity = await this.authenticate(authHeader); return this.onGetActivityMembers(claimsIdentity, conversationId, activityId); @@ -109,14 +104,13 @@ export abstract class ChannelServiceHandlerBase { /** * Creates a new Conversation. - * * @param authHeader The authentication header. * @param parameters [ConversationParameters](xref:botbuilder-core.ConversationParameters) to create the conversation from. * @returns A `Promise` representation for the operation. */ async handleCreateConversation( authHeader: string, - parameters: ConversationParameters + parameters: ConversationParameters, ): Promise { const claimsIdentity = await this.authenticate(authHeader); return this.onCreateConversation(claimsIdentity, parameters); @@ -124,7 +118,6 @@ export abstract class ChannelServiceHandlerBase { /** * Lists the Conversations in which the bot has participated. - * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param continuationToken A skip or continuation token. @@ -133,7 +126,7 @@ export abstract class ChannelServiceHandlerBase { async handleGetConversations( authHeader: string, conversationId: string, - continuationToken?: string /* some default */ + continuationToken?: string /* some default */, ): Promise { const claimsIdentity = await this.authenticate(authHeader); return this.onGetConversations(claimsIdentity, conversationId, continuationToken); @@ -141,7 +134,6 @@ export abstract class ChannelServiceHandlerBase { /** * Enumerates the members of a conversation. - * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @returns The enumerated [ChannelAccount](xref:botframework-schema.ChannelAccount) list. @@ -153,7 +145,6 @@ export abstract class ChannelServiceHandlerBase { /** * Gets the account of a single conversation member. - * * @param authHeader The authentication header. * @param userId The user Id. * @param conversationId The conversation Id. @@ -162,7 +153,7 @@ export abstract class ChannelServiceHandlerBase { async handleGetConversationMember( authHeader: string, userId: string, - conversationId: string + conversationId: string, ): Promise { const claimsIdentity = await this.authenticate(authHeader); return this.onGetConversationMember(claimsIdentity, userId, conversationId); @@ -170,7 +161,6 @@ export abstract class ChannelServiceHandlerBase { /** * Enumerates the members of a conversation one page at a time. - * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param pageSize Suggested page size. @@ -181,7 +171,7 @@ export abstract class ChannelServiceHandlerBase { authHeader: string, conversationId: string, pageSize = -1, - continuationToken?: string + continuationToken?: string, ): Promise { const claimsIdentity = await this.authenticate(authHeader); return this.onGetConversationPagedMembers(claimsIdentity, conversationId, pageSize, continuationToken); @@ -189,7 +179,6 @@ export abstract class ChannelServiceHandlerBase { /** * Deletes a member from a conversation. - * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param memberId Id of the member to delete from this conversation. @@ -201,7 +190,6 @@ export abstract class ChannelServiceHandlerBase { /** * Uploads the historic activities of the conversation. - * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param transcript [Transcript](xref:botframework-schema.Transcript) of activities. @@ -210,7 +198,7 @@ export abstract class ChannelServiceHandlerBase { async handleSendConversationHistory( authHeader: string, conversationId: string, - transcript: Transcript + transcript: Transcript, ): Promise { const claimsIdentity = await this.authenticate(authHeader); return this.onSendConversationHistory(claimsIdentity, conversationId, transcript); @@ -218,7 +206,6 @@ export abstract class ChannelServiceHandlerBase { /** * Stores data in a compliant store when dealing with enterprises. - * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param attachmentUpload [AttachmentData](xref:botframework-schema.AttachmentData). @@ -227,7 +214,7 @@ export abstract class ChannelServiceHandlerBase { async handleUploadAttachment( authHeader: string, conversationId: string, - attachmentUpload: AttachmentData + attachmentUpload: AttachmentData, ): Promise { const claimsIdentity = await this.authenticate(authHeader); return this.onUploadAttachment(claimsIdentity, conversationId, attachmentUpload); @@ -235,13 +222,12 @@ export abstract class ChannelServiceHandlerBase { /** * SendToConversation() API for Skill. - * * @remarks * This method allows you to send an activity to the end of a conversation. * This is slightly different from ReplyToActivity(). - * * SendToConversation(conversationId) - will append the activity to the end + * SendToConversation(conversationId) - will append the activity to the end * of the conversation according to the timestamp or semantics of the channel. - * * ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply + * ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply * to another activity, if the channel supports it. If the channel does not * support nested replies, ReplyToActivity falls back to SendToConversation. * @@ -256,26 +242,25 @@ export abstract class ChannelServiceHandlerBase { protected async onSendToConversation( _claimsIdentity: ClaimsIdentity, _conversationId: string, - _activity: Activity + _activity: Activity, ): Promise { throw new StatusCodeError( StatusCodes.NOT_IMPLEMENTED, `ChannelServiceHandler.onSendToConversation(): ${StatusCodes.NOT_IMPLEMENTED}: ${ STATUS_CODES[StatusCodes.NOT_IMPLEMENTED] - }` + }`, ); } /** * ReplyToActivity() API for Skill. - * * @remarks * This method allows you to reply to an activity. * * This is slightly different from SendToConversation(). - * * SendToConversation(conversationId) - will append the activity to the end + * SendToConversation(conversationId) - will append the activity to the end * of the conversation according to the timestamp or semantics of the channel. - * * ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply + * ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply * to another activity, if the channel supports it. If the channel does not * support nested replies, ReplyToActivity falls back to SendToConversation. * @@ -292,19 +277,18 @@ export abstract class ChannelServiceHandlerBase { _claimsIdentity: ClaimsIdentity, _conversationId: string, _activityId: string, - _activity: Activity + _activity: Activity, ): Promise { throw new StatusCodeError( StatusCodes.NOT_IMPLEMENTED, `ChannelServiceHandler.onReplyToActivity(): ${StatusCodes.NOT_IMPLEMENTED}: ${ STATUS_CODES[StatusCodes.NOT_IMPLEMENTED] - }` + }`, ); } /** * UpdateActivity() API for Skill. - * * @remarks * Edit an existing activity. * @@ -321,26 +305,23 @@ export abstract class ChannelServiceHandlerBase { _claimsIdentity: ClaimsIdentity, _conversationId: string, _activityId: string, - _activity: Activity + _activity: Activity, ): Promise { throw new StatusCodeError( StatusCodes.NOT_IMPLEMENTED, `ChannelServiceHandler.onUpdateActivity(): ${StatusCodes.NOT_IMPLEMENTED}: ${ STATUS_CODES[StatusCodes.NOT_IMPLEMENTED] - }` + }`, ); } /** * DeleteActivity() API for Skill. - * * @remarks * Delete an existing activity. * * Some channels allow you to delete an existing activity, and if successful * this method will remove the specified activity. - * - * * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim. * @param _conversationId Conversation ID. * @param _activityId activityId to delete. @@ -348,19 +329,18 @@ export abstract class ChannelServiceHandlerBase { protected async onDeleteActivity( _claimsIdentity: ClaimsIdentity, _conversationId: string, - _activityId: string + _activityId: string, ): Promise { throw new StatusCodeError( StatusCodes.NOT_IMPLEMENTED, `ChannelServiceHandler.onDeleteActivity(): ${StatusCodes.NOT_IMPLEMENTED}: ${ STATUS_CODES[StatusCodes.NOT_IMPLEMENTED] - }` + }`, ); } /** * GetActivityMembers() API for Skill. - * * @remarks * Enumerate the members of an activity. * @@ -374,51 +354,48 @@ export abstract class ChannelServiceHandlerBase { protected async onGetActivityMembers( _claimsIdentity: ClaimsIdentity, _conversationId: string, - _activityId: string + _activityId: string, ): Promise { throw new StatusCodeError( StatusCodes.NOT_IMPLEMENTED, `ChannelServiceHandler.onGetActivityMembers(): ${StatusCodes.NOT_IMPLEMENTED}: ${ STATUS_CODES[StatusCodes.NOT_IMPLEMENTED] - }` + }`, ); } /** * CreateConversation() API for Skill. - * * @remarks * Create a new Conversation. * * POST to this method with a - * * Bot being the bot creating the conversation - * * IsGroup set to true if this is not a direct message (default is false) - * * Array containing the members to include in the conversation + * Bot being the bot creating the conversation + * IsGroup set to true if this is not a direct message (default is false) + * Array containing the members to include in the conversation * * The return value is a ResourceResponse which contains a conversation id * which is suitable for use in the message payload and REST API uris. * * Most channels only support the semantics of bots initiating a direct * message conversation. - * * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim. * @param _parameters Parameters to create the conversation from. */ protected async onCreateConversation( _claimsIdentity: ClaimsIdentity, - _parameters: ConversationParameters + _parameters: ConversationParameters, ): Promise { throw new StatusCodeError( StatusCodes.NOT_IMPLEMENTED, `ChannelServiceHandler.onCreateConversation(): ${StatusCodes.NOT_IMPLEMENTED}: ${ STATUS_CODES[StatusCodes.NOT_IMPLEMENTED] - }` + }`, ); } /** * onGetConversations() API for Skill. - * * @remarks * List the Conversations in which this bot has participated. * @@ -431,7 +408,6 @@ export abstract class ChannelServiceHandlerBase { * * Each ConversationMembers object contains the ID of the conversation and an * array of ChannelAccounts that describe the members of the conversation. - * * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim. * @param _conversationId Conversation ID. * @param _continuationToken Skip or continuation token. @@ -439,19 +415,18 @@ export abstract class ChannelServiceHandlerBase { protected async onGetConversations( _claimsIdentity: ClaimsIdentity, _conversationId: string, - _continuationToken?: string + _continuationToken?: string, ): Promise { throw new StatusCodeError( StatusCodes.NOT_IMPLEMENTED, `ChannelServiceHandler.onGetConversations(): ${StatusCodes.NOT_IMPLEMENTED}: ${ STATUS_CODES[StatusCodes.NOT_IMPLEMENTED] - }` + }`, ); } /** * getConversationMembers() API for Skill. - * * @remarks * Enumerate the members of a conversation. * @@ -462,19 +437,18 @@ export abstract class ChannelServiceHandlerBase { */ protected async onGetConversationMembers( _claimsIdentity: ClaimsIdentity, - _conversationId: string + _conversationId: string, ): Promise { throw new StatusCodeError( StatusCodes.NOT_IMPLEMENTED, `ChannelServiceHandler.onGetConversationMembers(): ${StatusCodes.NOT_IMPLEMENTED}: ${ STATUS_CODES[StatusCodes.NOT_IMPLEMENTED] - }` + }`, ); } /** * getConversationMember() API for Skill. - * * @remarks * Get the account of a single conversation member. * @@ -487,19 +461,18 @@ export abstract class ChannelServiceHandlerBase { protected async onGetConversationMember( _claimsIdentity: ClaimsIdentity, _userId: string, - _conversationId: string + _conversationId: string, ): Promise { throw new StatusCodeError( StatusCodes.NOT_IMPLEMENTED, `ChannelServiceHandler.onGetConversationMember(): ${StatusCodes.NOT_IMPLEMENTED}: ${ STATUS_CODES[StatusCodes.NOT_IMPLEMENTED] - }` + }`, ); } /** * getConversationPagedMembers() API for Skill. - * * @remarks * Enumerate the members of a conversation one page at a time. * @@ -527,19 +500,18 @@ export abstract class ChannelServiceHandlerBase { _claimsIdentity: ClaimsIdentity, _conversationId: string, _pageSize = -1, - _continuationToken?: string + _continuationToken?: string, ): Promise { throw new StatusCodeError( StatusCodes.NOT_IMPLEMENTED, `ChannelServiceHandler.onGetConversationPagedMembers(): ${StatusCodes.NOT_IMPLEMENTED}: ${ STATUS_CODES[StatusCodes.NOT_IMPLEMENTED] - }` + }`, ); } /** * DeleteConversationMember() API for Skill. - * * @remarks * Deletes a member from a conversation. * @@ -553,19 +525,18 @@ export abstract class ChannelServiceHandlerBase { protected async onDeleteConversationMember( _claimsIdentity: ClaimsIdentity, _conversationId: string, - _memberId: string + _memberId: string, ): Promise { throw new StatusCodeError( StatusCodes.NOT_IMPLEMENTED, `ChannelServiceHandler.onDeleteConversationMember(): ${StatusCodes.NOT_IMPLEMENTED}: ${ STATUS_CODES[StatusCodes.NOT_IMPLEMENTED] - }` + }`, ); } /** * SendConversationHistory() API for Skill. - * * @remarks * This method allows you to upload the historic activities to the * conversation. @@ -581,19 +552,18 @@ export abstract class ChannelServiceHandlerBase { protected async onSendConversationHistory( _claimsIdentity: ClaimsIdentity, _conversationId: string, - _transcript: Transcript + _transcript: Transcript, ): Promise { throw new StatusCodeError( StatusCodes.NOT_IMPLEMENTED, `ChannelServiceHandler.onSendConversationHistory(): ${StatusCodes.NOT_IMPLEMENTED}: ${ STATUS_CODES[StatusCodes.NOT_IMPLEMENTED] - }` + }`, ); } /** * UploadAttachment() API for Skill. - * * @remarks * Upload an attachment directly into a channel's blob storage. * @@ -609,19 +579,18 @@ export abstract class ChannelServiceHandlerBase { protected async onUploadAttachment( _claimsIdentity: ClaimsIdentity, _conversationId: string, - _attachmentUpload: AttachmentData + _attachmentUpload: AttachmentData, ): Promise { throw new StatusCodeError( StatusCodes.NOT_IMPLEMENTED, `ChannelServiceHandler.onUploadAttachment(): ${StatusCodes.NOT_IMPLEMENTED}: ${ STATUS_CODES[StatusCodes.NOT_IMPLEMENTED] - }` + }`, ); } /** * Helper to authenticate the header token and extract the claims. - * * @param authHeader HTTP authorization header * @returns a promise resolving to the authorization header claims */ diff --git a/libraries/botbuilder/src/channelServiceRoutes.ts b/libraries/botbuilder/src/channelServiceRoutes.ts index b2c597a543..7a889e267d 100644 --- a/libraries/botbuilder/src/channelServiceRoutes.ts +++ b/libraries/botbuilder/src/channelServiceRoutes.ts @@ -43,7 +43,6 @@ export class ChannelServiceRoutes { /** * Registers all Channel Service paths on the provided WebServer. - * * @param server WebServer * @param basePath Optional basePath which is appended before the service's REST API is configured on the WebServer. */ @@ -58,7 +57,7 @@ export class ChannelServiceRoutes { server.get(basePath + RouteConstants.ConversationMember, this.processGetConversationMember.bind(this)); server.get( basePath + RouteConstants.ConversationPagedMembers, - this.processGetConversationPagedMembers.bind(this) + this.processGetConversationPagedMembers.bind(this), ); server.post(basePath + RouteConstants.ConversationHistory, this.processSendConversationHistory.bind(this)); server.post(basePath + RouteConstants.Attachments, this.processUploadAttachment.bind(this)); @@ -68,7 +67,7 @@ export class ChannelServiceRoutes { if (typeof server.delete === 'function') { server.delete( basePath + RouteConstants.ConversationMember, - this.processDeleteConversationMember.bind(this) + this.processDeleteConversationMember.bind(this), ); server.delete(basePath + RouteConstants.Activity, this.processDeleteActivity.bind(this)); } else if (typeof server.del === 'function') { @@ -80,7 +79,7 @@ export class ChannelServiceRoutes { /** * @private */ - private processSendToConversation(req: WebRequest, res: WebResponse, next: Function): void { + private processSendToConversation(req: WebRequest, res: WebResponse, next: () => void): void { const authHeader = req.headers.authorization || req.headers.Authorization || ''; ChannelServiceRoutes.readActivity(req) .then((activity) => { @@ -106,7 +105,7 @@ export class ChannelServiceRoutes { /** * @private */ - private processReplyToActivity(req: WebRequest, res: WebResponse, next: Function): void { + private processReplyToActivity(req: WebRequest, res: WebResponse, next: () => void): void { const authHeader = req.headers.authorization || req.headers.Authorization || ''; ChannelServiceRoutes.readActivity(req) .then((activity) => { @@ -132,7 +131,7 @@ export class ChannelServiceRoutes { /** * @private */ - private processUpdateActivity(req: WebRequest, res: WebResponse, next: Function): void { + private processUpdateActivity(req: WebRequest, res: WebResponse, next: () => void): void { const authHeader = req.headers.authorization || req.headers.Authorization || ''; ChannelServiceRoutes.readActivity(req) .then((activity) => { @@ -158,7 +157,7 @@ export class ChannelServiceRoutes { /** * @private */ - private processDeleteActivity(req: WebRequest, res: WebResponse, next: Function): void { + private processDeleteActivity(req: WebRequest, res: WebResponse, next: () => void): void { const authHeader = req.headers.authorization || req.headers.Authorization || ''; this.channelServiceHandler .handleDeleteActivity(authHeader, req.params.conversationId, req.params.activityId) @@ -175,7 +174,7 @@ export class ChannelServiceRoutes { /** * @private */ - private processGetActivityMembers(req: WebRequest, res: WebResponse, next: Function): void { + private processGetActivityMembers(req: WebRequest, res: WebResponse, next: () => void): void { const authHeader = req.headers.authorization || req.headers.Authorization || ''; this.channelServiceHandler .handleGetActivityMembers(authHeader, req.params.conversationId, req.params.activityId) @@ -195,7 +194,7 @@ export class ChannelServiceRoutes { /** * @private */ - private processCreateConversation(req: WebRequest, res: WebResponse, next: Function): void { + private processCreateConversation(req: WebRequest, res: WebResponse, next: () => void): void { const authHeader = req.headers.authorization || req.headers.Authorization || ''; ChannelServiceRoutes.readBody(req).then((conversationParameters) => { this.channelServiceHandler @@ -217,7 +216,7 @@ export class ChannelServiceRoutes { /** * @private */ - private processGetConversations(req: WebRequest, res: WebResponse, next: Function): void { + private processGetConversations(req: WebRequest, res: WebResponse, next: () => void): void { const authHeader = req.headers.authorization || req.headers.Authorization || ''; this.channelServiceHandler .handleGetConversations(authHeader, req.params.conversationId, req.query.continuationToken) @@ -237,7 +236,7 @@ export class ChannelServiceRoutes { /** * @private */ - private processGetConversationMembers(req: WebRequest, res: WebResponse, next: Function): void { + private processGetConversationMembers(req: WebRequest, res: WebResponse, next: () => void): void { const authHeader = req.headers.authorization || req.headers.Authorization || ''; this.channelServiceHandler .handleGetConversationMembers(authHeader, req.params.conversationId) @@ -257,7 +256,7 @@ export class ChannelServiceRoutes { /** * @private */ - private processGetConversationMember(req: WebRequest, res: WebResponse, next: Function): void { + private processGetConversationMember(req: WebRequest, res: WebResponse, next: () => void): void { const authHeader = req.headers.authorization || req.headers.Authorization || ''; this.channelServiceHandler .handleGetConversationMember(authHeader, req.params.memberId, req.params.conversationId) @@ -277,7 +276,7 @@ export class ChannelServiceRoutes { /** * @private */ - private processGetConversationPagedMembers(req: WebRequest, res: WebResponse, next: Function): void { + private processGetConversationPagedMembers(req: WebRequest, res: WebResponse, next: () => void): void { const authHeader = req.headers.authorization || req.headers.Authorization || ''; let pageSize = parseInt(req.query.pageSize); if (isNaN(pageSize)) { @@ -288,7 +287,7 @@ export class ChannelServiceRoutes { authHeader, req.params.conversationId, pageSize, - req.query.continuationToken + req.query.continuationToken, ) .then((pagedMembersResult) => { res.status(200); @@ -306,7 +305,7 @@ export class ChannelServiceRoutes { /** * @private */ - private processDeleteConversationMember(req: WebRequest, res: WebResponse, next: Function): void { + private processDeleteConversationMember(req: WebRequest, res: WebResponse, next: () => void): void { const authHeader = req.headers.authorization || req.headers.Authorization || ''; this.channelServiceHandler .handleDeleteConversationMember(authHeader, req.params.conversationId, req.params.memberId) @@ -323,7 +322,7 @@ export class ChannelServiceRoutes { /** * @private */ - private processSendConversationHistory(req: WebRequest, res: WebResponse, next: Function): void { + private processSendConversationHistory(req: WebRequest, res: WebResponse, next: () => void): void { const authHeader = req.headers.authorization || req.headers.Authorization || ''; ChannelServiceRoutes.readBody(req) .then((transcript) => { @@ -349,7 +348,7 @@ export class ChannelServiceRoutes { /** * @private */ - private processUploadAttachment(req: WebRequest, res: WebResponse, next: Function): void { + private processUploadAttachment(req: WebRequest, res: WebResponse, next: () => void): void { const authHeader = req.headers.authorization || req.headers.Authorization || ''; ChannelServiceRoutes.readBody(req) .then((attachmentData) => { diff --git a/libraries/botbuilder/src/cloudAdapter.ts b/libraries/botbuilder/src/cloudAdapter.ts index c914aa8f93..56f4393a66 100644 --- a/libraries/botbuilder/src/cloudAdapter.ts +++ b/libraries/botbuilder/src/cloudAdapter.ts @@ -47,7 +47,6 @@ const ActivityT = z.custom((val) => z.record(z.unknown()).safeParse(va export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAdapter { /** * Initializes a new instance of the [CloudAdapter](xref:botbuilder:CloudAdapter) class. - * * @param botFrameworkAuthentication Optional [BotFrameworkAuthentication](xref:botframework-connector.BotFrameworkAuthentication) instance */ constructor(botFrameworkAuthentication: BotFrameworkAuthentication = BotFrameworkAuthenticationFactory.create()) { @@ -56,7 +55,6 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd /** * Process a web request by applying a logic function. - * * @param req An incoming HTTP [Request](xref:botbuilder.Request) * @param req The corresponding HTTP [Response](xref:botbuilder.Response) * @param logic The logic function to apply @@ -67,7 +65,6 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd /** * Handle a web socket connection by applying a logic function to * each streaming request. - * * @param req An incoming HTTP [Request](xref:botbuilder.Request) * @param socket The corresponding [INodeSocket](xref:botframework-streaming.INodeSocket) * @param head The corresponding [INodeBuffer](xref:botframework-streaming.INodeBuffer) @@ -78,7 +75,7 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd req: Request, socket: INodeSocket, head: INodeBuffer, - logic: (context: TurnContext) => Promise + logic: (context: TurnContext) => Promise, ): Promise; /** @@ -105,7 +102,7 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd req: Request, resOrSocket: Response | INodeSocket | INodeDuplex, logicOrHead: ((context: TurnContext) => Promise) | INodeBuffer, - maybeLogic?: (context: TurnContext) => Promise + maybeLogic?: (context: TurnContext) => Promise, ): Promise { // Early return with web socket handler if function invocation matches that signature if (maybeLogic) { @@ -139,7 +136,7 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd if (!z.record(z.unknown()).safeParse(req.body).success) { return end( StatusCodes.BAD_REQUEST, - '`req.body` not an object, make sure you are using middleware to parse incoming requests.' + '`req.body` not an object, make sure you are using middleware to parse incoming requests.', ); } @@ -158,14 +155,13 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd console.error(err); return end( err instanceof AuthenticationError ? StatusCodes.UNAUTHORIZED : StatusCodes.INTERNAL_SERVER_ERROR, - err.message ?? err + err.message ?? err, ); } } /** * Asynchronously process an activity running the provided logic function. - * * @param authorization The authorization header in the format: "Bearer [longString]" or the AuthenticateRequestResult for this turn. * @param activity The activity to process. * @param logic The logic function to apply. @@ -174,12 +170,14 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd async processActivityDirect( authorization: string | AuthenticateRequestResult, activity: Activity, - logic: (context: TurnContext) => Promise + logic: (context: TurnContext) => Promise, ): Promise { try { - typeof authorization === 'string' - ? await this.processActivity(authorization, activity, logic) - : await this.processActivity(authorization, activity, logic); + if (typeof authorization === 'string') { + await this.processActivity(authorization, activity, logic); + } else { + await this.processActivity(authorization, activity, logic); + } } catch (err) { throw new Error(`CloudAdapter.processActivityDirect(): ERROR\n ${err.stack}`); } @@ -187,7 +185,6 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd /** * Used to connect the adapter to a named pipe. - * * @param pipeName Pipe name to connect to (note: yields two named pipe servers by appending ".incoming" and ".outgoing" to this name) * @param logic The logic function to call for resulting bot turns. * @param appId The Bot application ID @@ -201,7 +198,7 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd appId: string, audience: string, callerId?: string, - retryCount = 7 + retryCount = 7, ): Promise { z.object({ pipeName: z.string(), @@ -221,7 +218,7 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd // Creat request handler const requestHandler = new StreamingRequestHandler( authenticateRequestResult, - (authenticateRequestResult, activity) => this.processActivity(authenticateRequestResult, activity, logic) + (authenticateRequestResult, activity) => this.processActivity(authenticateRequestResult, activity, logic), ); // Create server @@ -238,7 +235,7 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd req: Request, socket: INodeSocket, head: INodeBuffer, - logic: (context: TurnContext) => Promise + logic: (context: TurnContext) => Promise, ): Promise { // Grab the auth header from the inbound http request const authHeader = z.string().parse(req.headers.Authorization ?? req.headers.authorization ?? ''); @@ -249,19 +246,19 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd // Authenticate inbound request const authenticateRequestResult = await this.botFrameworkAuthentication.authenticateStreamingRequest( authHeader, - channelIdHeader + channelIdHeader, ); // Creat request handler const requestHandler = new StreamingRequestHandler( authenticateRequestResult, - (authenticateRequestResult, activity) => this.processActivity(authenticateRequestResult, activity, logic) + (authenticateRequestResult, activity) => this.processActivity(authenticateRequestResult, activity, logic), ); // Create server const server = new WebSocketServer( await new NodeWebSocketFactory().createWebSocket(req, socket, head), - requestHandler + requestHandler, ); // Attach server to request handler @@ -284,8 +281,8 @@ class StreamingRequestHandler extends RequestHandler { private readonly authenticateRequestResult: AuthenticateRequestResult, private readonly processActivity: ( authenticateRequestResult: AuthenticateRequestResult, - activity: Activity - ) => Promise + activity: Activity, + ) => Promise, ) { super(); @@ -311,14 +308,14 @@ class StreamingRequestHandler extends RequestHandler { if (!request.verb || !request.path) { return end( StatusCodes.BAD_REQUEST, - `Request missing verb and/or path. Verb: ${request.verb}, Path: ${request.path}` + `Request missing verb and/or path. Verb: ${request.verb}, Path: ${request.path}`, ); } if (request.verb.toUpperCase() !== POST && request.verb.toUpperCase() !== GET) { return end( StatusCodes.METHOD_NOT_ALLOWED, - `Invalid verb received. Only GET and POST are accepted. Verb: ${request.verb}` + `Invalid verb received. Only GET and POST are accepted. Verb: ${request.verb}`, ); } @@ -328,7 +325,7 @@ class StreamingRequestHandler extends RequestHandler { } else { return end( StatusCodes.METHOD_NOT_ALLOWED, - `Invalid verb received for path: ${request.path}. Only GET is accepted. Verb: ${request.verb}` + `Invalid verb received for path: ${request.path}. Only GET is accepted. Verb: ${request.verb}`, ); } } @@ -349,7 +346,7 @@ class StreamingRequestHandler extends RequestHandler { : await attachmentStream.readAsString(); return { contentType, content }; - }) + }), ); } catch (err) { return end(StatusCodes.BAD_REQUEST, `Request body missing or malformed: ${err}`); @@ -377,7 +374,7 @@ class StreamingConnectorFactory implements ConnectorFactory { if (serviceUrl !== this.serviceUrl) { throw new Error( - 'This is a streaming scenario, all connectors from this factory must all be for the same url.' + 'This is a streaming scenario, all connectors from this factory must all be for the same url.', ); } @@ -411,7 +408,7 @@ class StreamingHttpClient implements HttpClient { private async createHttpResponse( receiveResponse: IReceiveResponse, - httpRequest: WebResource + httpRequest: WebResource, ): Promise { const [bodyAsText] = (await Promise.all(receiveResponse.streams?.map((stream) => stream.readAsString()) ?? [])) ?? []; diff --git a/libraries/botbuilder/src/eventFactory.ts b/libraries/botbuilder/src/eventFactory.ts index e73380ea68..d9fd437b58 100644 --- a/libraries/botbuilder/src/eventFactory.ts +++ b/libraries/botbuilder/src/eventFactory.ts @@ -24,7 +24,6 @@ import { HandoffEventNames } from './handoffEventNames'; export class EventFactory { /** * Create handoff initiation event. - * * @param context The context object for the turn. * @param handoffContext Agent hub-specific context. * @param transcript Transcript of the conversation. @@ -33,7 +32,7 @@ export class EventFactory { static createHandoffInitiation( context: TurnContext, handoffContext: T, - transcript?: Transcript + transcript?: Transcript, ): Activity { if (!context) { throw new TypeError('EventFactory.createHandoffInitiation(): Missing context.'); @@ -42,7 +41,7 @@ export class EventFactory { const handoffEvent = this.createHandoffEvent( HandoffEventNames.InitiateHandoff, handoffContext, - context.activity.conversation + context.activity.conversation, ); handoffEvent.from = context.activity.from; @@ -65,7 +64,6 @@ export class EventFactory { /** * Create handoff status event. - * * @param conversation Conversation being handed over. * @param state State, possible values are: "accepted", "failed", "completed". * @param message Additional message for failed handoff. @@ -89,7 +87,7 @@ export class EventFactory { private static createHandoffEvent( name: string, value: T, - conversation: ConversationAccount + conversation: ConversationAccount, ): Activity { const handoffEvent: Partial = { type: ActivityTypes.Event }; diff --git a/libraries/botbuilder/src/fileTranscriptStore.ts b/libraries/botbuilder/src/fileTranscriptStore.ts index 7fc325d234..14fb0562ae 100644 --- a/libraries/botbuilder/src/fileTranscriptStore.ts +++ b/libraries/botbuilder/src/fileTranscriptStore.ts @@ -83,7 +83,6 @@ function parseActivity(json: string): Activity { /** * The file transcript store stores transcripts in file system with each activity as a file. - * * @remarks * This class provides an interface to log all incoming and outgoing activities to the filesystem. * It implements the features necessary to work alongside the TranscriptLoggerMiddleware plugin. @@ -103,7 +102,6 @@ export class FileTranscriptStore implements TranscriptStore { /** * Creates an instance of FileTranscriptStore. - * * @param folder Root folder where transcript will be stored. */ constructor(folder: string) { @@ -116,7 +114,6 @@ export class FileTranscriptStore implements TranscriptStore { /** * Log an activity to the transcript. - * * @param activity Activity being logged. * @returns {Promise} a promise representing the asynchronous operation. */ @@ -133,7 +130,6 @@ export class FileTranscriptStore implements TranscriptStore { /** * Get all activities associated with a conversation id (aka get the transcript). - * * @param channelId Channel Id. * @param conversationId Conversation Id. * @param continuationToken (Optional) Continuation token to page through results. @@ -144,7 +140,7 @@ export class FileTranscriptStore implements TranscriptStore { channelId: string, conversationId: string, continuationToken?: string, - startDate?: Date + startDate?: Date, ): Promise> { if (!channelId) { throw new Error('Missing channelId'); @@ -165,7 +161,8 @@ export class FileTranscriptStore implements TranscriptStore { const transcriptFolderContents = await readdir(transcriptFolder); const include = includeWhen((fileName) => !continuationToken || parse(fileName).name === continuationToken); const items = transcriptFolderContents.filter( - (transcript) => transcript.endsWith('.json') && withDateFilter(startDate, transcript) && include(transcript) + (transcript) => + transcript.endsWith('.json') && withDateFilter(startDate, transcript) && include(transcript), ); pagedResult.items = await Promise.all( @@ -175,7 +172,7 @@ export class FileTranscriptStore implements TranscriptStore { .map(async (activityFilename) => { const json = await readFile(join(transcriptFolder, activityFilename), 'utf8'); return parseActivity(json); - }) + }), ); const { length } = pagedResult.items; if (length === FileTranscriptStore.PageSize && items[length]) { @@ -186,7 +183,6 @@ export class FileTranscriptStore implements TranscriptStore { /** * List all the logged conversations for a given channelId. - * * @param channelId Channel Id. * @param continuationToken (Optional) Continuation token to page through results. * @returns {Promise>} PagedResult of transcripts. @@ -218,7 +214,6 @@ export class FileTranscriptStore implements TranscriptStore { /** * Delete a conversation and all of it's activities. - * * @param channelId Channel Id where conversation took place. * @param conversationId Id of the conversation to delete. * @returns {Promise} A promise representing the asynchronous operation. @@ -239,7 +234,6 @@ export class FileTranscriptStore implements TranscriptStore { /** * Saves the [Activity](xref:botframework-schema.Activity) as a JSON file. - * * @param activity The [Activity](xref:botframework-schema.Activity) to transcript. * @param transcriptPath The path where the transcript will be saved. * @param activityFilename The name for the file. diff --git a/libraries/botbuilder/src/inspectionMiddleware.ts b/libraries/botbuilder/src/inspectionMiddleware.ts index 4fed361e04..71ba00161f 100644 --- a/libraries/botbuilder/src/inspectionMiddleware.ts +++ b/libraries/botbuilder/src/inspectionMiddleware.ts @@ -83,14 +83,13 @@ class TraceActivity { abstract class InterceptionMiddleware implements Middleware { /** * Implement middleware signature - * * @param turnContext {TurnContext} An incoming TurnContext object. * @param next {function} The next delegate function. */ async onTurn(turnContext: TurnContext, next: () => Promise): Promise { const { shouldForwardToApplication, shouldIntercept } = await this.invokeInbound( turnContext, - TraceActivity.fromActivity(turnContext.activity, 'ReceivedActivity', 'Received Activity') + TraceActivity.fromActivity(turnContext.activity, 'ReceivedActivity', 'Received Activity'), ); if (shouldIntercept) { @@ -165,10 +164,8 @@ abstract class InterceptionMiddleware implements Middleware { /** * InspectionMiddleware for emulator inspection of runtime Activities and BotState. - * * @remarks * InspectionMiddleware for emulator inspection of runtime Activities and BotState. - * * @deprecated This class will be removed in a future version of the framework. */ export class InspectionMiddleware extends InterceptionMiddleware { @@ -182,7 +179,6 @@ export class InspectionMiddleware extends InterceptionMiddleware { /** * Create the Inspection middleware for sending trace activities out to an emulator session - * * @param inspectionState A state management object for inspection state. * @param userState A state management object for user state. * @param conversationState A state management object for conversation state. @@ -192,7 +188,7 @@ export class InspectionMiddleware extends InterceptionMiddleware { inspectionState: InspectionState, userState?: UserState, conversationState?: ConversationState, - credentials?: Partial + credentials?: Partial, ) { super(); @@ -206,7 +202,6 @@ export class InspectionMiddleware extends InterceptionMiddleware { /** * Indentifies open and attach commands and calls the appropriate method. - * * @param turnContext The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @returns True if the command is open or attached, otherwise false. */ @@ -236,7 +231,6 @@ export class InspectionMiddleware extends InterceptionMiddleware { /** * Processes inbound activities. - * * @param turnContext The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param traceActivity The trace activity. * @returns {Promise} A promise representing the asynchronous operation. @@ -260,7 +254,6 @@ export class InspectionMiddleware extends InterceptionMiddleware { /** * Processes outbound activities. - * * @param turnContext The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param traceActivities A collection of trace activities. */ @@ -278,7 +271,6 @@ export class InspectionMiddleware extends InterceptionMiddleware { /** * Processes the state management object. - * * @param turnContext The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. */ protected async traceState(turnContext: TurnContext): Promise { @@ -312,7 +304,7 @@ export class InspectionMiddleware extends InterceptionMiddleware { const sessions = await this.inspectionStateAccessor.get(turnContext, InspectionSessionsByStatus.DefaultValue); const sessionId = this.openCommand(sessions, TurnContext.getConversationReference(turnContext.activity)); await turnContext.sendActivity( - TraceActivity.makeCommandActivity(`${InspectionMiddleware.command} attach ${sessionId}`) + TraceActivity.makeCommandActivity(`${InspectionMiddleware.command} attach ${sessionId}`), ); await this.inspectionState.saveChanges(turnContext, false); } @@ -336,7 +328,7 @@ export class InspectionMiddleware extends InterceptionMiddleware { */ private openCommand( sessions: InspectionSessionsByStatus, - conversationReference: Partial + conversationReference: Partial, ): string { const sessionId = uuidv4(); sessions.openedSessions[sessionId] = conversationReference; @@ -376,7 +368,7 @@ export class InspectionMiddleware extends InterceptionMiddleware { private async invokeSend( turnContext: TurnContext, session: InspectionSession, - activity: Partial + activity: Partial, ): Promise { if (await session.send(activity)) { return true; @@ -441,16 +433,13 @@ class InspectionSessionsByStatus { /** * InspectionState for use by the InspectionMiddleware for emulator inspection of runtime Activities and BotState. - * * @remarks * InspectionState for use by the InspectionMiddleware for emulator inspection of runtime Activities and BotState. - * * @deprecated This class will be removed in a future version of the framework. */ export class InspectionState extends BotState { /** * Creates a new instance of the [InspectionState](xref:botbuilder.InspectionState) class. - * * @param storage The [Storage](xref:botbuilder-core.Storage) layer this state management object will use to store and retrieve state. */ constructor(storage: Storage) { @@ -461,7 +450,6 @@ export class InspectionState extends BotState { /** * Gets the key to use when reading and writing state to and from storage. - * * @param _turnContext The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @returns The storage key. */ diff --git a/libraries/botbuilder/src/interfaces/connectorClientBuilder.ts b/libraries/botbuilder/src/interfaces/connectorClientBuilder.ts index 5645674239..1ebfddc7d2 100644 --- a/libraries/botbuilder/src/interfaces/connectorClientBuilder.ts +++ b/libraries/botbuilder/src/interfaces/connectorClientBuilder.ts @@ -14,7 +14,6 @@ import { ClaimsIdentity, ConnectorClient } from 'botframework-connector'; export interface ConnectorClientBuilder { /** * Creates the connector client asynchronous. - * * @param serviceUrl The service URL. * @param claimsIdentity The claims claimsIdentity. * @param audience The target audience for the ConnectorClient. @@ -22,6 +21,6 @@ export interface ConnectorClientBuilder { createConnectorClientWithIdentity: ( serviceUrl: string, claimsIdentity: ClaimsIdentity, - audience: string + audience: string, ) => Promise; } diff --git a/libraries/botbuilder/src/interfaces/request.ts b/libraries/botbuilder/src/interfaces/request.ts index 741170b574..d344eac0f3 100644 --- a/libraries/botbuilder/src/interfaces/request.ts +++ b/libraries/botbuilder/src/interfaces/request.ts @@ -7,7 +7,7 @@ */ export interface Request< Body extends Record = Record, - Headers extends Record = Record + Headers extends Record = Record, > { body?: Body; headers: Headers; diff --git a/libraries/botbuilder/src/interfaces/response.ts b/libraries/botbuilder/src/interfaces/response.ts index 13936873fd..b9ed0bcb8d 100644 --- a/libraries/botbuilder/src/interfaces/response.ts +++ b/libraries/botbuilder/src/interfaces/response.ts @@ -25,5 +25,5 @@ export const ResponseT = z.custom( typeof val.status === 'function', { message: 'Response', - } + }, ); diff --git a/libraries/botbuilder/src/interfaces/webRequest.ts b/libraries/botbuilder/src/interfaces/webRequest.ts index 448580c9ca..cbb4a5d363 100644 --- a/libraries/botbuilder/src/interfaces/webRequest.ts +++ b/libraries/botbuilder/src/interfaces/webRequest.ts @@ -41,10 +41,8 @@ export interface WebRequest { * When implemented in a derived class, adds a listener for an event. * The framework uses this method to retrieve the request body when the * [body](xref:botbuilder.WebRequest.body) property is `null` or `undefined`. - * * @param event The event name. * @param args Arguments used to handle the event. - * * @returns A reference to the request object. */ on?(event: string, ...args: any[]): any; diff --git a/libraries/botbuilder/src/interfaces/webResponse.ts b/libraries/botbuilder/src/interfaces/webResponse.ts index 9b3a8b4862..ed9b3aa2a3 100644 --- a/libraries/botbuilder/src/interfaces/webResponse.ts +++ b/libraries/botbuilder/src/interfaces/webResponse.ts @@ -20,27 +20,21 @@ export interface WebResponse { /** * When implemented in a derived class, sends a FIN packet. - * * @param args The arguments for the end event. - * * @returns A reference to the response object. */ end(...args: any[]): any; /** * When implemented in a derived class, sends the response. - * * @param body The response payload. - * * @returns A reference to the response object. */ send(body: any): any; /** * When implemented in a derived class, sets the HTTP status code for the response. - * * @param status The status code to use. - * * @returns The status code. */ status(status: number): any; diff --git a/libraries/botbuilder/src/routeConstants.ts b/libraries/botbuilder/src/routeConstants.ts index 476924973e..a68b84e876 100644 --- a/libraries/botbuilder/src/routeConstants.ts +++ b/libraries/botbuilder/src/routeConstants.ts @@ -9,7 +9,6 @@ /** * Constants representing the API path that immediately follows the basePath. * These are currently internal but we will re-evaluate making them public, in the future. - * * @example * RouteConstants.Activities = '/v3/conversations/:conversationId/activities'. */ diff --git a/libraries/botbuilder/src/setSpeakMiddleware.ts b/libraries/botbuilder/src/setSpeakMiddleware.ts index 78480d4c99..6f6e30f0f2 100644 --- a/libraries/botbuilder/src/setSpeakMiddleware.ts +++ b/libraries/botbuilder/src/setSpeakMiddleware.ts @@ -38,15 +38,16 @@ function hasTag(tag: string, nodes: unknown[]): boolean { export class SetSpeakMiddleware implements Middleware { /** * Initializes a new instance of the SetSpeakMiddleware class. - * * @param voiceName The SSML voice name attribute value. * @param fallbackToTextForSpeak true if an empty Activity.Speak is populated with Activity.Text. */ - constructor(private readonly voiceName: string | null, private readonly fallbackToTextForSpeak: boolean) {} + constructor( + private readonly voiceName: string | null, + private readonly fallbackToTextForSpeak: boolean, + ) {} /** * Processes an incoming activity. - * * @param turnContext The context object for this turn. * @param next The delegate to call to continue the bot middleware pipeline. * @returns A promise representing the async operation. @@ -78,7 +79,7 @@ export class SetSpeakMiddleware implements Middleware { }'>${activity.speak}`; } } - }) + }), ); return next(); diff --git a/libraries/botbuilder/src/sharepoint/sharePointActivityHandler.ts b/libraries/botbuilder/src/sharepoint/sharePointActivityHandler.ts index 0a017f68b7..1f92d286bc 100644 --- a/libraries/botbuilder/src/sharepoint/sharePointActivityHandler.ts +++ b/libraries/botbuilder/src/sharepoint/sharePointActivityHandler.ts @@ -26,8 +26,7 @@ export class SharePointActivityHandler extends ActivityHandler { /** * Invoked when an invoke activity is received from the connector. * Invoke activities can be used to communicate many different things. - * * Invoke activities communicate programmatic commands from a client or channel to a bot. - * + * Invoke activities communicate programmatic commands from a client or channel to a bot. * @param context A strongly-typed context object for this turn * @returns A task that represents the work queued to execute */ @@ -39,32 +38,32 @@ export class SharePointActivityHandler extends ActivityHandler { switch (context.activity.name) { case 'cardExtension/getCardView': return ActivityHandler.createInvokeResponse( - await this.onSharePointTaskGetCardViewAsync(context, context.activity.value as AceRequest) + await this.onSharePointTaskGetCardViewAsync(context, context.activity.value as AceRequest), ); case 'cardExtension/getQuickView': return ActivityHandler.createInvokeResponse( - await this.onSharePointTaskGetQuickViewAsync(context, context.activity.value as AceRequest) + await this.onSharePointTaskGetQuickViewAsync(context, context.activity.value as AceRequest), ); case 'cardExtension/getPropertyPaneConfiguration': return ActivityHandler.createInvokeResponse( await this.onSharePointTaskGetPropertyPaneConfigurationAsync( context, - context.activity.value as AceRequest - ) + context.activity.value as AceRequest, + ), ); case 'cardExtension/setPropertyPaneConfiguration': return ActivityHandler.createInvokeResponse( await this.onSharePointTaskSetPropertyPaneConfigurationAsync( context, - context.activity.value as AceRequest - ) + context.activity.value as AceRequest, + ), ); case 'cardExtension/handleAction': return ActivityHandler.createInvokeResponse( - await this.onSharePointTaskHandleActionAsync(context, context.activity.value as AceRequest) + await this.onSharePointTaskHandleActionAsync(context, context.activity.value as AceRequest), ); default: return super.onInvokeActivity(context); @@ -82,70 +81,65 @@ export class SharePointActivityHandler extends ActivityHandler { /** * Override this in a derived class to provide logic for when a card view is fetched - * * @param _context - A strongly-typed context object for this turn * @param _aceRequest - The Ace invoke request value payload * @returns A Card View Response for the request */ protected async onSharePointTaskGetCardViewAsync( _context: TurnContext, - _aceRequest: AceRequest + _aceRequest: AceRequest, ): Promise { throw new Error('NotImplemented'); } /** * Override this in a derived class to provide logic for when a quick view is fetched - * * @param _context - A strongly-typed context object for this turn * @param _aceRequest - The Ace invoke request value payload * @returns A Quick View Response for the request */ protected async onSharePointTaskGetQuickViewAsync( _context: TurnContext, - _aceRequest: AceRequest + _aceRequest: AceRequest, ): Promise { throw new Error('NotImplemented'); } /** * Override this in a derived class to provide logic for getting configuration pane properties. - * * @param _context - A strongly-typed context object for this turn * @param _aceRequest - The Ace invoke request value payload * @returns A Property Pane Configuration Response for the request */ protected async onSharePointTaskGetPropertyPaneConfigurationAsync( _context: TurnContext, - _aceRequest: AceRequest + _aceRequest: AceRequest, ): Promise { throw new Error('NotImplemented'); } /** * Override this in a derived class to provide logic for setting configuration pane properties. - * * @param _context - A strongly-typed context object for this turn * @param _aceRequest - The Ace invoke request value payload * @returns A Card view or no-op action response */ protected async onSharePointTaskSetPropertyPaneConfigurationAsync( _context: TurnContext, - _aceRequest: AceRequest + _aceRequest: AceRequest, ): Promise { throw new Error('NotImplemented'); } /** * Override this in a derived class to provide logic for setting configuration pane properties. - * * @param _context - A strongly-typed context object for this turn * @param _aceRequest - The Ace invoke request value payload * @returns A handle action response */ protected async onSharePointTaskHandleActionAsync( _context: TurnContext, - _aceRequest: AceRequest + _aceRequest: AceRequest, ): Promise { throw new Error('NotImplemented'); } diff --git a/libraries/botbuilder/src/skills/cloudSkillHandler.ts b/libraries/botbuilder/src/skills/cloudSkillHandler.ts index 027995a96e..b53f94b29e 100644 --- a/libraries/botbuilder/src/skills/cloudSkillHandler.ts +++ b/libraries/botbuilder/src/skills/cloudSkillHandler.ts @@ -29,7 +29,6 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { /** * Initializes a new instance of the CloudSkillHandler class. - * * @param adapter An instance of the BotAdapter that will handle the request. * @param logic The Bot logic function * @param conversationIdFactory A SkillConversationIdFactoryBase to unpack the conversation ID and map it to the calling bot. @@ -39,7 +38,7 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { adapter: BotAdapter, logic: (context: TurnContext) => Promise, conversationIdFactory: SkillConversationIdFactoryBase, - auth: BotFrameworkAuthentication + auth: BotFrameworkAuthentication, ) { super(auth); @@ -60,20 +59,19 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { adapter, logic, conversationIdFactory, - () => auth.getOriginatingAudience() + () => auth.getOriginatingAudience(), ); } /** * sendToConversation() API for Skill. - * * @remarks * This method allows you to send an activity to the end of a conversation. * * This is slightly different from replyToActivity(). - * * sendToConversation(conversationId) - will append the activity to the end + * sendToConversation(conversationId) - will append the activity to the end * of the conversation according to the timestamp or semantics of the channel. - * * replyToActivity(conversationId,ActivityId) - adds the activity as a reply + * replyToActivity(conversationId,ActivityId) - adds the activity as a reply * to another activity, if the channel supports it. If the channel does not * support nested replies, replyToActivity falls back to sendToConversation. * @@ -88,21 +86,20 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { protected onSendToConversation( claimsIdentity: ClaimsIdentity, conversationId: string, - activity: Activity + activity: Activity, ): Promise { return this.inner.onSendToConversation(claimsIdentity, conversationId, activity); } /** * replyToActivity() API for Skill. - * * @remarks * This method allows you to reply to an activity. * * This is slightly different from sendToConversation(). - * * sendToConversation(conversationId) - will append the activity to the end + * sendToConversation(conversationId) - will append the activity to the end * of the conversation according to the timestamp or semantics of the channel. - * * replyToActivity(conversationId,ActivityId) - adds the activity as a reply + * replyToActivity(conversationId,ActivityId) - adds the activity as a reply * to another activity, if the channel supports it. If the channel does not * support nested replies, replyToActivity falls back to sendToConversation. * @@ -119,15 +116,14 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string, - activity: Activity + activity: Activity, ): Promise { return this.inner.onReplyToActivity(claimsIdentity, conversationId, activityId, activity); } /** * - * UpdateActivity() API for Skill. - * + *UpdateActivity() API for Skill. * @remarks * Edit an existing activity. * @@ -145,21 +141,18 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string, - activity: Activity + activity: Activity, ): Promise { return this.inner.onUpdateActivity(claimsIdentity, conversationId, activityId, activity); } /** * DeleteActivity() API for Skill. - * * @remarks * Delete an existing activity. * * Some channels allow you to delete an existing activity, and if successful * this method will remove the specified activity. - * - * * @param claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim. * @param conversationId Conversation ID. * @param activityId activityId to delete. @@ -168,14 +161,13 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { protected async onDeleteActivity( claimsIdentity: ClaimsIdentity, conversationId: string, - activityId: string + activityId: string, ): Promise { return this.inner.onDeleteActivity(claimsIdentity, conversationId, activityId); } /** * getConversationMember() API for Skill. - * * @remarks * Get the account of a single conversation member. * @@ -184,13 +176,12 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { * @param claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim. * @param userId User ID. * @param conversationId Conversation ID. - * * @returns The ChannelAccount object representing the member of the conversation. */ protected async onGetConversationMember( claimsIdentity: ClaimsIdentity, userId: string, - conversationId: string + conversationId: string, ): Promise { return this.inner.onGetMember(claimsIdentity, userId, conversationId); } diff --git a/libraries/botbuilder/src/skills/skillHandler.ts b/libraries/botbuilder/src/skills/skillHandler.ts index df81af5eb8..17a6cf56cc 100644 --- a/libraries/botbuilder/src/skills/skillHandler.ts +++ b/libraries/botbuilder/src/skills/skillHandler.ts @@ -29,7 +29,6 @@ import { export class SkillHandler extends ChannelServiceHandler { /** * Used to access the CovnersationReference sent from the Skill to the Parent. - * * @remarks * The value is the same as the SkillConversationReferenceKey exported from botbuilder-core. */ @@ -40,7 +39,6 @@ export class SkillHandler extends ChannelServiceHandler { /** * Initializes a new instance of the SkillHandler class. - * * @param adapter An instance of the BotAdapter that will handle the request. * @param bot The ActivityHandlerBase instance. * @param conversationIdFactory A SkillConversationIdFactoryBase to unpack the conversation ID and map it to the calling bot. @@ -54,7 +52,7 @@ export class SkillHandler extends ChannelServiceHandler { conversationIdFactory: SkillConversationIdFactoryBase, credentialProvider: ICredentialProvider, authConfig: AuthenticationConfiguration, - channelService?: string + channelService?: string, ) { super(credentialProvider, authConfig, channelService); @@ -78,20 +76,19 @@ export class SkillHandler extends ChannelServiceHandler { () => JwtTokenValidation.isGovernment(channelService) ? GovernmentConstants.ToChannelFromBotOAuthScope - : AuthenticationConstants.ToChannelFromBotOAuthScope + : AuthenticationConstants.ToChannelFromBotOAuthScope, ); } /** * sendToConversation() API for Skill. - * * @remarks * This method allows you to send an activity to the end of a conversation. * * This is slightly different from replyToActivity(). - * * sendToConversation(conversationId) - will append the activity to the end + * sendToConversation(conversationId) - will append the activity to the end * of the conversation according to the timestamp or semantics of the channel. - * * replyToActivity(conversationId,ActivityId) - adds the activity as a reply + * replyToActivity(conversationId,ActivityId) - adds the activity as a reply * to another activity, if the channel supports it. If the channel does not * support nested replies, replyToActivity falls back to sendToConversation. * @@ -106,21 +103,20 @@ export class SkillHandler extends ChannelServiceHandler { protected onSendToConversation( claimsIdentity: ClaimsIdentity, conversationId: string, - activity: Activity + activity: Activity, ): Promise { return this.inner.onSendToConversation(claimsIdentity, conversationId, activity); } /** * replyToActivity() API for Skill. - * * @remarks * This method allows you to reply to an activity. * * This is slightly different from sendToConversation(). - * * sendToConversation(conversationId) - will append the activity to the end + * sendToConversation(conversationId) - will append the activity to the end * of the conversation according to the timestamp or semantics of the channel. - * * replyToActivity(conversationId,ActivityId) - adds the activity as a reply + * replyToActivity(conversationId,ActivityId) - adds the activity as a reply * to another activity, if the channel supports it. If the channel does not * support nested replies, replyToActivity falls back to sendToConversation. * @@ -137,15 +133,14 @@ export class SkillHandler extends ChannelServiceHandler { claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string, - activity: Activity + activity: Activity, ): Promise { return this.inner.onReplyToActivity(claimsIdentity, conversationId, activityId, activity); } /** * - * UpdateActivity() API for Skill. - * + *UpdateActivity() API for Skill. * @remarks * Edit an existing activity. * @@ -163,21 +158,18 @@ export class SkillHandler extends ChannelServiceHandler { claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string, - activity: Activity + activity: Activity, ): Promise { return this.inner.onUpdateActivity(claimsIdentity, conversationId, activityId, activity); } /** * DeleteActivity() API for Skill. - * * @remarks * Delete an existing activity. * * Some channels allow you to delete an existing activity, and if successful * this method will remove the specified activity. - * - * * @param claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim. * @param conversationId Conversation ID. * @param activityId activityId to delete. @@ -186,7 +178,7 @@ export class SkillHandler extends ChannelServiceHandler { protected async onDeleteActivity( claimsIdentity: ClaimsIdentity, conversationId: string, - activityId: string + activityId: string, ): Promise { return this.inner.onDeleteActivity(claimsIdentity, conversationId, activityId); } diff --git a/libraries/botbuilder/src/skills/skillHandlerImpl.ts b/libraries/botbuilder/src/skills/skillHandlerImpl.ts index a12b778a77..b44fe0ac52 100644 --- a/libraries/botbuilder/src/skills/skillHandlerImpl.ts +++ b/libraries/botbuilder/src/skills/skillHandlerImpl.ts @@ -28,7 +28,7 @@ export class SkillHandlerImpl { private readonly adapter: BotAdapter, private readonly logic: (context: TurnContext) => Promise, private readonly conversationIdFactory: SkillConversationIdFactoryBase, - private readonly getOauthScope: () => string | undefined = () => undefined + private readonly getOauthScope: () => string | undefined = () => undefined, ) {} /** @@ -37,7 +37,7 @@ export class SkillHandlerImpl { onSendToConversation( claimsIdentity: ClaimsIdentity, conversationId: string, - activity: Activity + activity: Activity, ): Promise { return this.processActivity(claimsIdentity, conversationId, null, activity); } @@ -49,7 +49,7 @@ export class SkillHandlerImpl { claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string, - activity: Activity + activity: Activity, ): Promise { return this.processActivity(claimsIdentity, conversationId, activityId, activity); } @@ -61,7 +61,7 @@ export class SkillHandlerImpl { claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string, - activity: Activity + activity: Activity, ): Promise { let resourceResponse: ResourceResponse | void; @@ -70,7 +70,7 @@ export class SkillHandlerImpl { context.activity.id = activityId; context.activity.callerId = `${CallerIdConstants.BotToBotPrefix}${JwtTokenValidation.getAppIdFromClaims( - claimsIdentity.claims + claimsIdentity.claims, )}`; resourceResponse = await context.updateActivity(newActivity); @@ -84,7 +84,7 @@ export class SkillHandlerImpl { */ async onDeleteActivity(claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string): Promise { return this.continueConversation(claimsIdentity, conversationId, (context) => - context.deleteActivity(activityId) + context.deleteActivity(activityId), ); } @@ -135,7 +135,7 @@ export class SkillHandlerImpl { claimsIdentity: ClaimsIdentity, conversationId: string, replyToActivityId: string, - activity: Activity + activity: Activity, ): Promise { let resourceResponse: ResourceResponse; @@ -151,7 +151,7 @@ export class SkillHandlerImpl { context.activity.id = replyToActivityId; context.activity.callerId = `${CallerIdConstants.BotToBotPrefix}${JwtTokenValidation.getAppIdFromClaims( - claimsIdentity.claims + claimsIdentity.claims, )}`; switch (newActivity.type) { @@ -185,7 +185,7 @@ export class SkillHandlerImpl { private async continueConversation( claimsIdentity: ClaimsIdentity, conversationId: string, - callback: (context: TurnContext, ref: SkillConversationReference) => Promise + callback: (context: TurnContext, ref: SkillConversationReference) => Promise, ): Promise { const ref = await this.getSkillConversationReference(conversationId); @@ -199,7 +199,7 @@ export class SkillHandlerImpl { claimsIdentity, ref.conversationReference, ref.oAuthScope, - continueCallback + continueCallback, ); } catch (err) { if (err.message === 'NotImplemented') { diff --git a/libraries/botbuilder/src/skills/skillHttpClient.ts b/libraries/botbuilder/src/skills/skillHttpClient.ts index 28c74bcb66..22ad0aab6d 100644 --- a/libraries/botbuilder/src/skills/skillHttpClient.ts +++ b/libraries/botbuilder/src/skills/skillHttpClient.ts @@ -30,7 +30,6 @@ export class SkillHttpClient extends BotFrameworkHttpClient { /** * Creates a new instance of the [SkillHttpClient](xref:botbuilder-core.SkillHttpClient) class. - * * @param credentialProvider An instance of [ICredentialProvider](xref:botframework-connector.ICredentialProvider). * @param conversationIdFactory An instance of a class derived from [SkillConversationIdFactoryBase](xref:botbuilder-core.SkillConversationIdFactoryBase). * @param channelService Optional. The channel service. @@ -38,7 +37,7 @@ export class SkillHttpClient extends BotFrameworkHttpClient { constructor( credentialProvider: ICredentialProvider, conversationIdFactory: SkillConversationIdFactoryBase, - channelService?: string + channelService?: string, ) { super(credentialProvider, channelService); if (!conversationIdFactory) { @@ -50,7 +49,6 @@ export class SkillHttpClient extends BotFrameworkHttpClient { /** * Uses the SkillConversationIdFactory to create or retrieve a Skill Conversation Id, and sends the activity. - * * @template T The type of body in the InvokeResponse. * @param originatingAudience The OAuth audience scope, used during token retrieval. (Either https://api.botframework.com or bot app id.) * @param fromBotId The MicrosoftAppId of the bot sending the activity. @@ -63,11 +61,10 @@ export class SkillHttpClient extends BotFrameworkHttpClient { fromBotId: string, toSkill: BotFrameworkSkill, callbackUrl: string, - activity: Activity + activity: Activity, ): Promise>; /** * Uses the SkillConversationIdFactory to create or retrieve a Skill Conversation Id, and sends the activity. - * * @deprecated This overload is deprecated. Please use SkillHttpClient.postToSkill() that takes an `originatingAudience`. * @param fromBotId The MicrosoftAppId of the bot sending the activity. * @param toSkill The skill to create the Conversation Id for. @@ -78,11 +75,10 @@ export class SkillHttpClient extends BotFrameworkHttpClient { fromBotId: string, toSkill: BotFrameworkSkill, callbackUrl: string, - activity: Activity + activity: Activity, ): Promise; /** * Uses the `SkillConversationIdFactory` to create or retrieve a Skill Conversation Id, and sends the [Activity](xref:botframework-schema.Activity). - * * @param audienceOrFromBotId The OAuth audience scope, used during token retrieval or the AppId of the bot sending the [Activity](xref:botframework-schema.Activity). * @param fromBotIdOrSkill The AppId of the bot sending the [Activity](xref:botframework-schema.Activity) or the skill to create the Conversation Id for. * @param toSkillOrCallbackUrl The skill to create the Conversation Id for or the callback Url for the skill host. @@ -95,7 +91,7 @@ export class SkillHttpClient extends BotFrameworkHttpClient { fromBotIdOrSkill: string | BotFrameworkSkill, toSkillOrCallbackUrl: BotFrameworkSkill | string, callbackUrlOrActivity: string | Activity, - activityToForward?: Activity + activityToForward?: Activity, ): Promise> { let originatingAudience: string; let fromBotId: string; @@ -125,13 +121,12 @@ export class SkillHttpClient extends BotFrameworkHttpClient { fromBotOAuthScope: originatingAudience, }; - skillConversationId = await this.conversationIdFactory.createSkillConversationIdWithOptions( - createIdOptions - ); + skillConversationId = + await this.conversationIdFactory.createSkillConversationIdWithOptions(createIdOptions); } catch (err) { if (err.message === 'Not Implemented') { skillConversationId = await this.conversationIdFactory.createSkillConversationId( - TurnContext.getConversationReference(activity) as ConversationReference + TurnContext.getConversationReference(activity) as ConversationReference, ); } else { throw err; @@ -144,7 +139,7 @@ export class SkillHttpClient extends BotFrameworkHttpClient { toSkill.skillEndpoint, callbackUrl, skillConversationId, - activity + activity, ); } } diff --git a/libraries/botbuilder/src/statusCodeError.ts b/libraries/botbuilder/src/statusCodeError.ts index 9c2e59d0d5..0f07b87d8e 100644 --- a/libraries/botbuilder/src/statusCodeError.ts +++ b/libraries/botbuilder/src/statusCodeError.ts @@ -14,11 +14,13 @@ import { StatusCodes } from 'botbuilder-core'; export class StatusCodeError extends Error { /** * Creates a new instance of the [StatusCodeError](xref:botbuilder.StatusCodeError) class. - * * @param statusCode The status code. * @param message Optional. The error message. */ - constructor(public readonly statusCode: StatusCodes, message?: string) { + constructor( + public readonly statusCode: StatusCodes, + message?: string, + ) { super(message); this.name = 'StatusCodeError'; diff --git a/libraries/botbuilder/src/streaming/streamingHttpClient.ts b/libraries/botbuilder/src/streaming/streamingHttpClient.ts index 0d631ba2bb..07aecf08c5 100644 --- a/libraries/botbuilder/src/streaming/streamingHttpClient.ts +++ b/libraries/botbuilder/src/streaming/streamingHttpClient.ts @@ -17,7 +17,6 @@ export class StreamingHttpClient implements HttpClient { /** * Creates a new streaming Http client. - * * @param server Transport server implementation to be used. */ constructor(server: IStreamingTransportServer) { @@ -31,7 +30,6 @@ export class StreamingHttpClient implements HttpClient { * This function hides the default sendRequest of the HttpClient, replacing it * with a version that takes the WebResource created by the BotFrameworkAdapter * and converting it to a form that can be sent over a streaming transport. - * * @param httpRequest The outgoing request created by the BotframeworkAdapter. * @returns The streaming transport compatible response to send back to the client. */ @@ -41,7 +39,7 @@ export class StreamingHttpClient implements HttpClient { } if (!this.server.isConnected) { throw new Error( - 'StreamingHttpClient.sendRequest(): Streaming connection is disconnected, and the request could not be sent.' + 'StreamingHttpClient.sendRequest(): Streaming connection is disconnected, and the request could not be sent.', ); } diff --git a/libraries/botbuilder/src/streaming/tokenResolver.ts b/libraries/botbuilder/src/streaming/tokenResolver.ts index 1ac144248e..7fc1e77cfe 100644 --- a/libraries/botbuilder/src/streaming/tokenResolver.ts +++ b/libraries/botbuilder/src/streaming/tokenResolver.ts @@ -31,7 +31,6 @@ export class TokenResolver { /** * Checks if we have token responses from OAuth cards. - * * @param adapter The [BotFrameworkAdapter](xref:botbuilder.BotFrameworkAdapter). * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param activity The [Activity](xref:botframework-schema.Activity) to be checked. @@ -60,7 +59,7 @@ export class TokenResolver { setTimeout( () => this.pollForToken(adapter, context, activity, oauthCard.connectionName, pollingTimeout, log), - TokenResolver.PollingIntervalMs + TokenResolver.PollingIntervalMs, ); } } @@ -75,7 +74,7 @@ export class TokenResolver { activity: Activity, connectionName: string, pollingTimeout: Date, - log?: string[] + log?: string[], ) { if (pollingTimeout > new Date()) { const tokenApiClientCredentials = context.turnState.get(adapter.TokenApiClientCredentialsKey); @@ -90,7 +89,7 @@ export class TokenResolver { TokenResolver.createTokenResponseActivity( TurnContext.getConversationReference(activity), tokenResponse.token, - connectionName + connectionName, ) ); // received a token, send it to the bot and end polling @@ -121,7 +120,7 @@ export class TokenResolver { if (log) log.push('Polling again'); setTimeout( () => this.pollForToken(adapter, context, activity, connectionName, pollingTimeout), - pollingIntervalMs + pollingIntervalMs, ); }); } @@ -130,7 +129,7 @@ export class TokenResolver { private static createTokenResponseActivity( relatesTo: Partial, token: string, - connectionName: string + connectionName: string, ): Partial { const tokenResponse: Partial = { id: uuidv4(), diff --git a/libraries/botbuilder/src/teams/teamsSSOTokenExchangeMiddleware.ts b/libraries/botbuilder/src/teams/teamsSSOTokenExchangeMiddleware.ts index 76a8f8378e..9a5247e1ef 100644 --- a/libraries/botbuilder/src/teams/teamsSSOTokenExchangeMiddleware.ts +++ b/libraries/botbuilder/src/teams/teamsSSOTokenExchangeMiddleware.ts @@ -50,7 +50,7 @@ async function sendInvokeResponse(context: TurnContext, body: unknown = null, st const ExchangeToken = z.custom>( (val: any) => typeof val.exchangeToken === 'function', - { message: 'ExtendedUserTokenProvider' } + { message: 'ExtendedUserTokenProvider' }, ); /** @@ -71,11 +71,13 @@ const ExchangeToken = z.custom> export class TeamsSSOTokenExchangeMiddleware implements Middleware { /** * Initializes a new instance of the TeamsSSOTokenExchangeMiddleware class. - * * @param storage The [Storage](xref:botbuilder-core.Storage) to use for deduplication * @param oAuthConnectionName The connection name to use for the single sign on token exchange */ - constructor(private readonly storage: Storage, private readonly oAuthConnectionName: string) { + constructor( + private readonly storage: Storage, + private readonly oAuthConnectionName: string, + ) { if (!storage) { throw new TypeError('`storage` parameter is required'); } @@ -87,7 +89,6 @@ export class TeamsSSOTokenExchangeMiddleware implements Middleware { /** * Called each time the bot receives a new request. - * * @param context Context for current turn of conversation with the user. * @param next Function to call to continue execution to the next step in the middleware chain. */ @@ -142,7 +143,7 @@ export class TeamsSSOTokenExchangeMiddleware implements Middleware { try { const userTokenClient = context.turnState.get( - (context.adapter as CloudAdapterBase).UserTokenClientKey + (context.adapter as CloudAdapterBase).UserTokenClientKey, ); const exchangeToken = ExchangeToken.safeParse(context.adapter); @@ -151,14 +152,14 @@ export class TeamsSSOTokenExchangeMiddleware implements Middleware { context.activity.from.id, this.oAuthConnectionName, context.activity.channelId, - { token: tokenExchangeRequest.token } + { token: tokenExchangeRequest.token }, ); } else if (exchangeToken.success) { tokenExchangeResponse = await exchangeToken.data.exchangeToken( context, this.oAuthConnectionName, context.activity.from.id, - { token: tokenExchangeRequest.token } + { token: tokenExchangeRequest.token }, ); } else { new Error('Token Exchange is not supported by the current adapter.'); diff --git a/libraries/botbuilder/src/teamsActivityHandler.ts b/libraries/botbuilder/src/teamsActivityHandler.ts index fe95022307..40e07e9ab2 100644 --- a/libraries/botbuilder/src/teamsActivityHandler.ts +++ b/libraries/botbuilder/src/teamsActivityHandler.ts @@ -61,7 +61,6 @@ const TeamsMeetingEndT = z /** * Adds support for Microsoft Teams specific events and interactions. - * * @remarks * Developers may handle Message Update, Message Delete, and Conversation Update activities sent from Microsoft Teams via two methods: * 1. Overriding methods starting with `on..` and *not* ending in `..Event()` (e.g. `onTeamsMembersAdded()`), or instead @@ -77,7 +76,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Invoked when an invoke activity is received from the connector. * Invoke activities can be used to communicate many different things. - * * @param context A context object for this turn. * @returns An Invoke Response for the activity. */ @@ -90,15 +88,15 @@ export class TeamsActivityHandler extends ActivityHandler { switch (context.activity.name) { case 'config/fetch': return ActivityHandler.createInvokeResponse( - await this.handleTeamsConfigFetch(context, context.activity.value) + await this.handleTeamsConfigFetch(context, context.activity.value), ); case 'config/submit': return ActivityHandler.createInvokeResponse( - await this.handleTeamsConfigSubmit(context, context.activity.value) + await this.handleTeamsConfigSubmit(context, context.activity.value), ); case 'fileConsent/invoke': return ActivityHandler.createInvokeResponse( - await this.handleTeamsFileConsent(context, context.activity.value) + await this.handleTeamsFileConsent(context, context.activity.value), ); case 'actionableMessage/executeAction': @@ -107,43 +105,43 @@ export class TeamsActivityHandler extends ActivityHandler { case 'composeExtension/queryLink': return ActivityHandler.createInvokeResponse( - await this.handleTeamsAppBasedLinkQuery(context, context.activity.value) + await this.handleTeamsAppBasedLinkQuery(context, context.activity.value), ); case 'composeExtension/anonymousQueryLink': return ActivityHandler.createInvokeResponse( - await this.handleTeamsAnonymousAppBasedLinkQuery(context, context.activity.value) + await this.handleTeamsAnonymousAppBasedLinkQuery(context, context.activity.value), ); case 'composeExtension/query': return ActivityHandler.createInvokeResponse( - await this.handleTeamsMessagingExtensionQuery(context, context.activity.value) + await this.handleTeamsMessagingExtensionQuery(context, context.activity.value), ); case 'composeExtension/selectItem': return ActivityHandler.createInvokeResponse( - await this.handleTeamsMessagingExtensionSelectItem(context, context.activity.value) + await this.handleTeamsMessagingExtensionSelectItem(context, context.activity.value), ); case 'composeExtension/submitAction': return ActivityHandler.createInvokeResponse( await this.handleTeamsMessagingExtensionSubmitActionDispatch( context, - context.activity.value - ) + context.activity.value, + ), ); case 'composeExtension/fetchTask': return ActivityHandler.createInvokeResponse( - await this.handleTeamsMessagingExtensionFetchTask(context, context.activity.value) + await this.handleTeamsMessagingExtensionFetchTask(context, context.activity.value), ); case 'composeExtension/querySettingUrl': return ActivityHandler.createInvokeResponse( await this.handleTeamsMessagingExtensionConfigurationQuerySettingUrl( context, - context.activity.value - ) + context.activity.value, + ), ); case 'composeExtension/setting': @@ -156,22 +154,22 @@ export class TeamsActivityHandler extends ActivityHandler { case 'task/fetch': return ActivityHandler.createInvokeResponse( - await this.handleTeamsTaskModuleFetch(context, context.activity.value) + await this.handleTeamsTaskModuleFetch(context, context.activity.value), ); case 'task/submit': return ActivityHandler.createInvokeResponse( - await this.handleTeamsTaskModuleSubmit(context, context.activity.value) + await this.handleTeamsTaskModuleSubmit(context, context.activity.value), ); case 'tab/fetch': return ActivityHandler.createInvokeResponse( - await this.handleTeamsTabFetch(context, context.activity.value) + await this.handleTeamsTabFetch(context, context.activity.value), ); case 'tab/submit': return ActivityHandler.createInvokeResponse( - await this.handleTeamsTabSubmit(context, context.activity.value) + await this.handleTeamsTabSubmit(context, context.activity.value), ); default: @@ -195,7 +193,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Handles a Teams Card Action Invoke activity. - * * @param _context A context object for this turn. * @returns An Invoke Response for the activity. */ @@ -205,7 +202,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Handles a config/fetch invoke activity. - * * @param _context A context object for this turn. * @param _configData The object representing the configuration. * @returns A Config Response for the activity. @@ -216,7 +212,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Handles a config/submit invoke activity. - * * @param _context A context object for this turn. * @param _configData The object representing the configuration. * @returns A Config Response for the activity. @@ -230,14 +225,13 @@ export class TeamsActivityHandler extends ActivityHandler { * `handleTeamsFileConsentAccept` and `handleTeamsFileConsentDecline`. * Developers are not passed a pointer to the next `handleTeamsFileConsent` handler because the _wrapper_ around * the handler will call `onDialogs` handlers after delegating to `handleTeamsFileConsentAccept` or `handleTeamsFileConsentDecline`. - * * @param context A context object for this turn. * @param fileConsentCardResponse Represents the value of the invoke activity sent when the user acts on a file consent card. * @returns A promise that represents the work queued. */ protected async handleTeamsFileConsent( context: TurnContext, - fileConsentCardResponse: FileConsentCardResponse + fileConsentCardResponse: FileConsentCardResponse, ): Promise { switch (fileConsentCardResponse.action) { case 'accept': @@ -251,7 +245,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'fileConsent/invoke' with confirmation from user - * * @remarks * This type of invoke activity occur during the File Consent flow. * @param _context A context object for this turn. @@ -260,14 +253,13 @@ export class TeamsActivityHandler extends ActivityHandler { */ protected async handleTeamsFileConsentAccept( _context: TurnContext, - _fileConsentCardResponse: FileConsentCardResponse + _fileConsentCardResponse: FileConsentCardResponse, ): Promise { throw new Error('NotImplemented'); } /** * Receives invoke activities with Activity name of 'fileConsent/invoke' with decline from user - * * @remarks * This type of invoke activity occur during the File Consent flow. * @param _context A context object for this turn. @@ -276,28 +268,26 @@ export class TeamsActivityHandler extends ActivityHandler { */ protected async handleTeamsFileConsentDecline( _context: TurnContext, - _fileConsentCardResponse: FileConsentCardResponse + _fileConsentCardResponse: FileConsentCardResponse, ): Promise { throw new Error('NotImplemented'); } /** * Receives invoke activities with Activity name of 'actionableMessage/executeAction'. - * * @param _context A context object for this turn. * @param _query The O365 connector card HttpPOST invoke query. * @returns A promise that represents the work queued. */ protected async handleTeamsO365ConnectorCardAction( _context: TurnContext, - _query: O365ConnectorCardActionQuery + _query: O365ConnectorCardActionQuery, ): Promise { throw new Error('NotImplemented'); } /** * Invoked when a signIn invoke activity is received from the connector. - * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -312,77 +302,71 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'signin/verifyState'. - * * @param _context A context object for this turn. * @param _query Signin state (part of signin action auth flow) verification invoke query. * @returns A promise that represents the work queued. */ protected async handleTeamsSigninVerifyState( _context: TurnContext, - _query: SigninStateVerificationQuery + _query: SigninStateVerificationQuery, ): Promise { throw new Error('NotImplemented'); } /** * Receives invoke activities with Activity name of 'signin/tokenExchange' - * * @param _context A context object for this turn. * @param _query Signin state (part of signin action auth flow) verification invoke query * @returns A promise that represents the work queued. */ protected async handleTeamsSigninTokenExchange( _context: TurnContext, - _query: SigninStateVerificationQuery + _query: SigninStateVerificationQuery, ): Promise { throw new Error('NotImplemented'); } /** * Receives invoke activities with Activity name of 'composeExtension/onCardButtonClicked' - * * @param _context A context object for this turn. * @param _cardData Object representing the card data. * @returns A promise that represents the work queued. */ protected async handleTeamsMessagingExtensionCardButtonClicked( _context: TurnContext, - _cardData: any + _cardData: any, ): Promise { throw new Error('NotImplemented'); } /** * Receives invoke activities with Activity name of 'task/fetch' - * * @param _context A context object for this turn. * @param _taskModuleRequest The task module invoke request value payload. * @returns A Task Module Response for the request. */ protected async handleTeamsTaskModuleFetch( _context: TurnContext, - _taskModuleRequest: TaskModuleRequest + _taskModuleRequest: TaskModuleRequest, ): Promise { throw new Error('NotImplemented'); } /** * Receives invoke activities with Activity name of 'task/submit' - * * @param _context A context object for this turn. * @param _taskModuleRequest The task module invoke request value payload. * @returns A Task Module Response for the request. */ protected async handleTeamsTaskModuleSubmit( _context: TurnContext, - _taskModuleRequest: TaskModuleRequest + _taskModuleRequest: TaskModuleRequest, ): Promise { throw new Error('NotImplemented'); } /** * Receives invoke activities with Activity name of 'tab/fetch' - * * @param _context A context object for this turn. * @param _tabRequest The tab invoke request value payload. * @returns A Tab Response for the request. @@ -393,7 +377,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'tab/submit' - * * @param _context A context object for this turn. * @param _tabSubmit The tab submit invoke request value payload. * @returns A Tab Response for the request. @@ -404,7 +387,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'composeExtension/queryLink' - * * @remarks * Used in creating a Search-based Message Extension. * @param _context A context object for this turn. @@ -413,14 +395,13 @@ export class TeamsActivityHandler extends ActivityHandler { */ protected async handleTeamsAppBasedLinkQuery( _context: TurnContext, - _query: AppBasedLinkQuery + _query: AppBasedLinkQuery, ): Promise { throw new Error('NotImplemented'); } /** * Receives invoke activities with Activity name of 'composeExtension/anonymousQueryLink' - * * @remarks * Used in creating a Search-based Message Extension. * @param _context A context object for this turn. @@ -429,14 +410,13 @@ export class TeamsActivityHandler extends ActivityHandler { */ protected async handleTeamsAnonymousAppBasedLinkQuery( _context: TurnContext, - _query: AppBasedLinkQuery + _query: AppBasedLinkQuery, ): Promise { throw new Error('NotImplemented'); } /** * Receives invoke activities with the name 'composeExtension/query'. - * * @remarks * Used in creating a Search-based Message Extension. * @param _context A context object for this turn. @@ -445,14 +425,13 @@ export class TeamsActivityHandler extends ActivityHandler { */ protected async handleTeamsMessagingExtensionQuery( _context: TurnContext, - _query: MessagingExtensionQuery + _query: MessagingExtensionQuery, ): Promise { throw new Error('NotImplemented'); } /** * Receives invoke activities with the name 'composeExtension/selectItem'. - * * @remarks * Used in creating a Search-based Message Extension. * @param _context A context object for this turn. @@ -461,14 +440,13 @@ export class TeamsActivityHandler extends ActivityHandler { */ protected async handleTeamsMessagingExtensionSelectItem( _context: TurnContext, - _query: any + _query: any, ): Promise { throw new Error('NotImplemented'); } /** * Receives invoke activities with the name 'composeExtension/submitAction' and dispatches to botMessagePreview-flows as applicable. - * * @remarks * A handler registered through this method does not dispatch to the next handler (either `handleTeamsMessagingExtensionSubmitAction`, `handleTeamsMessagingExtensionBotMessagePreviewEdit`, or `handleTeamsMessagingExtensionBotMessagePreviewSend`). * This method exists for developers to optionally add more logic before the TeamsActivityHandler routes the activity to one of the @@ -479,7 +457,7 @@ export class TeamsActivityHandler extends ActivityHandler { */ protected async handleTeamsMessagingExtensionSubmitActionDispatch( context: TurnContext, - action: MessagingExtensionAction + action: MessagingExtensionAction, ): Promise { if (action.botMessagePreviewAction) { switch (action.botMessagePreviewAction) { @@ -497,14 +475,13 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with the name 'composeExtension/submitAction'. - * * @param _context A context object for this turn. * @param _action The messaging extension action. * @returns The Messaging Extension Action Response for the action. */ protected async handleTeamsMessagingExtensionSubmitAction( _context: TurnContext, - _action: MessagingExtensionAction + _action: MessagingExtensionAction, ): Promise { throw new Error('NotImplemented'); } @@ -512,14 +489,13 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with the name 'composeExtension/submitAction' with the 'botMessagePreview' property present on activity.value. * The value for 'botMessagePreview' is 'edit'. - * * @param _context A context object for this turn. * @param _action The messaging extension action. * @returns The Messaging Extension Action Response for the action. */ protected async handleTeamsMessagingExtensionBotMessagePreviewEdit( _context: TurnContext, - _action: MessagingExtensionAction + _action: MessagingExtensionAction, ): Promise { throw new Error('NotImplemented'); } @@ -527,49 +503,45 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with the name 'composeExtension/submitAction' with the 'botMessagePreview' property present on activity.value. * The value for 'botMessagePreview' is 'send'. - * * @param _context A context object for this turn. * @param _action The messaging extension action. * @returns The Messaging Extension Action Response for the action. */ protected async handleTeamsMessagingExtensionBotMessagePreviewSend( _context: TurnContext, - _action: MessagingExtensionAction + _action: MessagingExtensionAction, ): Promise { throw new Error('NotImplemented'); } /** * Receives invoke activities with the name 'composeExtension/fetchTask' - * * @param _context A context object for this turn. * @param _action The messaging extension action. * @returns The Messaging Extension Action Response for the action. */ protected async handleTeamsMessagingExtensionFetchTask( _context: TurnContext, - _action: MessagingExtensionAction + _action: MessagingExtensionAction, ): Promise { throw new Error('NotImplemented'); } /** * Receives invoke activities with the name 'composeExtension/querySettingUrl' - * * @param _context A context object for this turn. * @param _query The Messaging extension query. * @returns The Messaging Extension Action Response for the query. */ protected async handleTeamsMessagingExtensionConfigurationQuerySettingUrl( _context: TurnContext, - _query: MessagingExtensionQuery + _query: MessagingExtensionQuery, ): Promise { throw new Error('NotImplemented'); } /** * Receives invoke activities with the name 'composeExtension/setting' - * * @param _context A context object for this turn. * @param _settings Object representing the configuration settings. */ @@ -579,7 +551,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Override this method to change the dispatching of ConversationUpdate activities. - * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -640,7 +611,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Override this method to change the dispatching of MessageUpdate activities. - * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -665,7 +635,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Override this method to change the dispatching of MessageDelete activities. - * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -689,7 +658,6 @@ export class TeamsActivityHandler extends ActivityHandler { * Called in `dispatchMessageUpdateActivity()` to trigger the `'TeamsMessageUndelete'` handlers. * Override this in a derived class to provide logic for when a deleted message in a conversation is undeleted. * For example, when the user decides to "undo" a deleted message. - * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -700,7 +668,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Called in `dispatchMessageUpdateActivity()` to trigger the `'TeamsMessageEdit'` handlers. * Override this in a derived class to provide logic for when a message in a conversation is edited. - * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -712,7 +679,6 @@ export class TeamsActivityHandler extends ActivityHandler { * Called in `dispatchMessageDeleteActivity()` to trigger the `'TeamsMessageEdit'` handlers. * Override this in a derived class to provide logic for when a message in a conversation is soft deleted. * This means that the message as the option of being undeleted. - * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -724,7 +690,6 @@ export class TeamsActivityHandler extends ActivityHandler { * Called in `dispatchConversationUpdateActivity()` to trigger the `'TeamsMembersAdded'` handlers. * Override this in a derived class to provide logic for when members other than the bot * join the channel, such as your bot's welcome logic. - * * @remarks * If no handlers are registered for the `'TeamsMembersAdded'` event, the `'MembersAdded'` handlers will run instead. * @param context A context object for this turn. @@ -780,7 +745,6 @@ export class TeamsActivityHandler extends ActivityHandler { * Called in `dispatchConversationUpdateActivity()` to trigger the `'TeamsMembersRemoved'` handlers. * Override this in a derived class to provide logic for when members other than the bot * leave the channel, such as your bot's good-bye logic. - * * @remarks * If no handlers are registered for the `'TeamsMembersRemoved'` event, the `'MembersRemoved'` handlers will run instead. * @param context A context object for this turn. @@ -798,7 +762,6 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Channel Created event activity is received from the connector. * Channel Created corresponds to the user creating a new channel. * Override this in a derived class to provide logic for when a channel is created. - * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -810,7 +773,6 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Channel Deleted event activity is received from the connector. * Channel Deleted corresponds to the user deleting a channel. * Override this in a derived class to provide logic for when a channel is deleted. - * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -822,7 +784,6 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Channel Renamed event activity is received from the connector. * Channel Renamed corresponds to the user renaming a new channel. * Override this in a derived class to provide logic for when a channel is renamed. - * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -834,7 +795,6 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Team Archived event activity is received from the connector. * Team Archived corresponds to the user archiving a team. * Override this in a derived class to provide logic for when a team is archived. - * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -846,7 +806,6 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Team Deleted event activity is received from the connector. * Team Deleted corresponds to the user deleting a team. * Override this in a derived class to provide logic for when a team is deleted. - * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -858,7 +817,6 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Team Hard Deleted event activity is received from the connector. * Team Hard Deleted corresponds to the user hard-deleting a team. * Override this in a derived class to provide logic for when a team is hard-deleted. - * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -868,10 +826,9 @@ export class TeamsActivityHandler extends ActivityHandler { /** * - * Invoked when a Channel Restored event activity is received from the connector. - * Channel Restored corresponds to the user restoring a previously deleted channel. - * Override this in a derived class to provide logic for when a channel is restored. - * + *Invoked when a Channel Restored event activity is received from the connector. + *Channel Restored corresponds to the user restoring a previously deleted channel. + *Override this in a derived class to provide logic for when a channel is restored. * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -883,7 +840,6 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Team Renamed event activity is received from the connector. * Team Renamed corresponds to the user renaming a team. * Override this in a derived class to provide logic for when a team is renamed. - * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -895,7 +851,6 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Team Restored event activity is received from the connector. * Team Restored corresponds to the user restoring a team. * Override this in a derived class to provide logic for when a team is restored. - * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -907,7 +862,6 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Team Unarchived event activity is received from the connector. * Team Unarchived corresponds to the user unarchiving a team. * Override this in a derived class to provide logic for when a team is unarchived. - * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -918,7 +872,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsMessageUndelete events, such as for when a message in a conversation that is * observed by the bot goes from a soft delete state to the normal state. - * * @param handler A callback to handle the teams undelete message event. * @returns A promise that represents the work queued. */ @@ -931,7 +884,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsMessageEdit events, such as for when a message in a conversation that is * observed by the bot is edited. - * * @param handler A callback to handle the teams edit message event. * @returns A promise that represents the work queued. */ @@ -945,7 +897,6 @@ export class TeamsActivityHandler extends ActivityHandler { * Registers a handler for TeamsMessageSoftDelete events, such as for when a message in a conversation that is * observed by the bot is soft deleted. This means that the deleted message, up to a certain time period, * can be undoed. - * * @param handler A callback to handle the teams edit message event. * @returns A promise that represents the work queued. */ @@ -958,7 +909,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsMembersAdded events, such as for when members other than the bot * join the channel, such as your bot's welcome logic. - * * @param handler A callback to handle the teams members added event. * @returns A promise that represents the work queued. */ @@ -967,8 +917,8 @@ export class TeamsActivityHandler extends ActivityHandler { membersAdded: TeamsChannelAccount[], teamInfo: TeamInfo, context: TurnContext, - next: () => Promise - ) => Promise + next: () => Promise, + ) => Promise, ): this { return this.on('TeamsMembersAdded', async (context, next) => { const teamsChannelData = context.activity.channelData as TeamsChannelData; @@ -979,7 +929,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsMembersRemoved events, such as for when members other than the bot * leave the channel, such as your bot's good-bye logic. - * * @param handler A callback to handle the teams members removed event. * @returns A promise that represents the work queued. */ @@ -988,8 +937,8 @@ export class TeamsActivityHandler extends ActivityHandler { membersRemoved: TeamsChannelAccount[], teamInfo: TeamInfo, context: TurnContext, - next: () => Promise - ) => Promise + next: () => Promise, + ) => Promise, ): this { return this.on('TeamsMembersRemoved', async (context, next) => { const teamsChannelData = context.activity.channelData as TeamsChannelData; @@ -999,7 +948,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsChannelCreated events, such as for when a channel is created. - * * @param handler A callback to handle the teams channel created event. * @returns A promise that represents the work queued. */ @@ -1008,8 +956,8 @@ export class TeamsActivityHandler extends ActivityHandler { channelInfo: ChannelInfo, teamInfo: TeamInfo, context: TurnContext, - next: () => Promise - ) => Promise + next: () => Promise, + ) => Promise, ): this { return this.on('TeamsChannelCreated', async (context, next) => { const teamsChannelData = context.activity.channelData as TeamsChannelData; @@ -1019,7 +967,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsChannelDeleted events, such as for when a channel is deleted. - * * @param handler A callback to handle the teams channel deleted event. * @returns A promise that represents the work queued. */ @@ -1028,8 +975,8 @@ export class TeamsActivityHandler extends ActivityHandler { channelInfo: ChannelInfo, teamInfo: TeamInfo, context: TurnContext, - next: () => Promise - ) => Promise + next: () => Promise, + ) => Promise, ): this { return this.on('TeamsChannelDeleted', async (context, next) => { const teamsChannelData = context.activity.channelData as TeamsChannelData; @@ -1039,7 +986,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsChannelRenamed events, such as for when a channel is renamed. - * * @param handler A callback to handle the teams channel renamed event. * @returns A promise that represents the work queued. */ @@ -1048,8 +994,8 @@ export class TeamsActivityHandler extends ActivityHandler { channelInfo: ChannelInfo, teamInfo: TeamInfo, context: TurnContext, - next: () => Promise - ) => Promise + next: () => Promise, + ) => Promise, ): this { return this.on('TeamsChannelRenamed', async (context, next) => { const teamsChannelData = context.activity.channelData as TeamsChannelData; @@ -1059,12 +1005,11 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsTeamArchived events, such as for when a team is archived. - * * @param handler A callback to handle the teams team archived event. * @returns A promise that represents the work queued. */ onTeamsTeamArchivedEvent( - handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise + handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise, ): this { return this.on('TeamsTeamArchived', async (context, next) => { const teamsChannelData = context.activity.channelData as TeamsChannelData; @@ -1074,12 +1019,11 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsTeamDeleted events, such as for when a team is deleted. - * * @param handler A callback to handle the teams team deleted event. * @returns A promise that represents the work queued. */ onTeamsTeamDeletedEvent( - handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise + handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise, ): this { return this.on('TeamsTeamDeleted', async (context, next) => { const teamsChannelData = context.activity.channelData as TeamsChannelData; @@ -1089,12 +1033,11 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsTeamHardDeleted events, such as for when a team is hard-deleted. - * * @param handler A callback to handle the teams team hard deleted event. * @returns A promise that represents the work queued. */ onTeamsTeamHardDeletedEvent( - handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise + handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise, ): this { return this.on('TeamsTeamHardDeleted', async (context, next) => { const teamsChannelData = context.activity.channelData as TeamsChannelData; @@ -1104,7 +1047,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsChannelRestored events, such as for when a channel is restored. - * * @param handler A callback to handle the teams channel restored event. * @returns A promise that represents the work queued. */ @@ -1113,8 +1055,8 @@ export class TeamsActivityHandler extends ActivityHandler { channelInfo: ChannelInfo, teamInfo: TeamInfo, context: TurnContext, - next: () => Promise - ) => Promise + next: () => Promise, + ) => Promise, ): this { return this.on('TeamsChannelRestored', async (context, next) => { const teamsChannelData = context.activity.channelData as TeamsChannelData; @@ -1124,12 +1066,11 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsTeamRenamed events, such as for when a team is renamed. - * * @param handler A callback to handle the teams team renamed event. * @returns A promise that represents the work queued. */ onTeamsTeamRenamedEvent( - handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise + handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise, ): this { return this.on('TeamsTeamRenamed', async (context, next) => { const teamsChannelData = context.activity.channelData as TeamsChannelData; @@ -1139,12 +1080,11 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsTeamRestored events, such as for when a team is restored. - * * @param handler A callback to handle the teams team restored event. * @returns A promise that represents the work queued. */ onTeamsTeamRestoredEvent( - handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise + handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise, ): this { return this.on('TeamsTeamRestored', async (context, next) => { const teamsChannelData = context.activity.channelData as TeamsChannelData; @@ -1154,12 +1094,11 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsTeamUnarchived events, such as for when a team is unarchived. - * * @param handler A callback to handle the teams team unarchived event. * @returns A promise that represents the work queued. */ onTeamsTeamUnarchivedEvent( - handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise + handler: (teamInfo: TeamInfo, context: TurnContext, next: () => Promise) => Promise, ): this { return this.on('TeamsTeamUnarchived', async (context, next) => { const teamsChannelData = context.activity.channelData as TeamsChannelData; @@ -1169,10 +1108,8 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Runs the _event_ sub-type handlers, as appropriate, and then continues the event emission process. - * * @param context The context object for the current turn. * @returns A promise that represents the work queued. - * * @remarks * Override this method to support channel-specific behavior across multiple channels or to add * custom event sub-type events. @@ -1199,7 +1136,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Invoked when a Meeting Started event activity is received from the connector. * Override this in a derived class to provide logic for when a meeting is started. - * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -1210,7 +1146,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Invoked when a Meeting End event activity is received from the connector. * Override this in a derived class to provide logic for when a meeting is ended. - * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -1221,7 +1156,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Invoked when a read receipt for a previously sent message is received from the connector. * Override this in a derived class to provide logic for when the bot receives a read receipt event. - * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -1232,7 +1166,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Invoked when a Meeting Participant Join event activity is received from the connector. * Override this in a derived class to provide logic for when a meeting participant is joined. - * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -1243,7 +1176,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Invoked when a Meeting Participant Leave event activity is received from the connector. * Override this in a derived class to provide logic for when a meeting participant is left. - * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -1253,12 +1185,11 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for when a Teams meeting starts. - * * @param handler A callback that handles Meeting Start events. * @returns A promise that represents the work queued. */ onTeamsMeetingStartEvent( - handler: (meeting: MeetingStartEventDetails, context: TurnContext, next: () => Promise) => Promise + handler: (meeting: MeetingStartEventDetails, context: TurnContext, next: () => Promise) => Promise, ): this { return this.on('TeamsMeetingStart', async (context, next) => { const meeting = TeamsMeetingStartT.parse(context.activity.value); @@ -1271,19 +1202,18 @@ export class TeamsActivityHandler extends ActivityHandler { title: meeting.Title, }, context, - next + next, ); }); } /** * Registers a handler for when a Teams meeting ends. - * * @param handler A callback that handles Meeting End events. * @returns A promise that represents the work queued. */ onTeamsMeetingEndEvent( - handler: (meeting: MeetingEndEventDetails, context: TurnContext, next: () => Promise) => Promise + handler: (meeting: MeetingEndEventDetails, context: TurnContext, next: () => Promise) => Promise, ): this { return this.on('TeamsMeetingEnd', async (context, next) => { const meeting = TeamsMeetingEndT.parse(context.activity.value); @@ -1296,19 +1226,18 @@ export class TeamsActivityHandler extends ActivityHandler { title: meeting.Title, }, context, - next + next, ); }); } /** * Registers a handler for when a Read Receipt is sent. - * * @param handler A callback that handles Read Receipt events. * @returns A promise that represents the work queued. */ onTeamsReadReceiptEvent( - handler: (receiptInfo: ReadReceiptInfo, context: TurnContext, next: () => Promise) => Promise + handler: (receiptInfo: ReadReceiptInfo, context: TurnContext, next: () => Promise) => Promise, ): this { return this.on('TeamsReadReceipt', async (context, next) => { const receiptInfo = context.activity.value; @@ -1318,7 +1247,6 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for when a Teams meeting participant join. - * * @param handler A callback that handles Meeting Participant Join events. * @returns A promise that represents the work queued. */ @@ -1326,8 +1254,8 @@ export class TeamsActivityHandler extends ActivityHandler { handler: ( meeting: MeetingParticipantsEventDetails, context: TurnContext, - next: () => Promise - ) => Promise + next: () => Promise, + ) => Promise, ): this { return this.on('TeamsMeetingParticipantsJoin', async (context, next) => { const meeting = context.activity.value; @@ -1336,14 +1264,13 @@ export class TeamsActivityHandler extends ActivityHandler { members: meeting?.members, }, context, - next + next, ); }); } /** * Registers a handler for when a Teams meeting participant leave. - * * @param handler A callback that handles Meeting Participant Leave events. * @returns A promise that represents the work queued. */ @@ -1351,8 +1278,8 @@ export class TeamsActivityHandler extends ActivityHandler { handler: ( meeting: MeetingParticipantsEventDetails, context: TurnContext, - next: () => Promise - ) => Promise + next: () => Promise, + ) => Promise, ): this { return this.on('TeamsMeetingParticipantsLeave', async (context, next) => { const meeting = context.activity.value; @@ -1361,7 +1288,7 @@ export class TeamsActivityHandler extends ActivityHandler { members: meeting?.members, }, context, - next + next, ); }); } diff --git a/libraries/botbuilder/src/teamsActivityHelpers.ts b/libraries/botbuilder/src/teamsActivityHelpers.ts index 85b12f7fa9..5160855df5 100644 --- a/libraries/botbuilder/src/teamsActivityHelpers.ts +++ b/libraries/botbuilder/src/teamsActivityHelpers.ts @@ -20,7 +20,6 @@ function validateActivity(activity: Partial): void { /** * Gets the Team's selected channel id from the current activity. - * * @param activity The current [Activity](xref:botframework-schema.Activity). * @returns The current activity's team's selected channel, or empty string. */ @@ -32,7 +31,6 @@ export function teamsGetSelectedChannelId(activity: Activity): string { /** * Gets the TeamsMeetingInfo object from the current [Activity](xref:botframework-schema.Activity). - * * @param activity The current [Activity](xref:botframework-schema.Activity). * @returns The current [Activity](xref:botframework-schema.Activity)'s team meeting info, or null. */ @@ -48,7 +46,6 @@ export function teamsGetTeamMeetingInfo(activity: Activity): TeamsMeetingInfo | /** * Gets the TenantInfo object from the current [Activity](xref:botframework-schema.Activity). - * * @param activity The current [Activity](xref:botframework-schema.Activity). * @returns The current [Activity](xref:botframework-schema.Activity)'s tenant info, or null. */ @@ -64,7 +61,6 @@ export function teamsGetTenant(activity: Activity): TenantInfo | null { /** * Gets the TeamsInfo object from the current [Activity](xref:botframework-schema.Activity). - * * @param activity The current [Activity](xref:botframework-schema.Activity). * @returns The current [Activity](xref:botframework-schema.Activity)'s team's info, or null. */ @@ -82,7 +78,6 @@ export function teamsGetTeamInfo(activity: Activity): TeamInfo | null { /** * Gets the Team Id from the current [Activity](xref:botframework-schema.Activity). - * * @param activity The current [Activity](xref:botframework-schema.Activity). * @returns The current [Activity](xref:botframework-schema.Activity)'s team's Id, or null. */ @@ -93,7 +88,6 @@ export function teamsGetTeamId(activity: Activity): string | null { /** * Activity helper methods for Teams. - * * @param activity The current [Activity](xref:botframework-schema.Activity). * @returns The current [Activity](xref:botframework-schema.Activity)'s team's channel id, or null. */ @@ -111,7 +105,6 @@ export function teamsGetChannelId(activity: Activity): string | null { /** * Configures the current [Activity](xref:botframework-schema.Activity) to generate a notification within Teams. - * * @param activity The current [Activity](xref:botframework-schema.Activity). * @param alertInMeeting Sent to a meeting chat, this will cause the Teams client to render it in a notification popup as well as in the chat thread. * @param externalResourceUrl Url to external resource. Must be included in manifest's valid domains. @@ -119,7 +112,7 @@ export function teamsGetChannelId(activity: Activity): string | null { export function teamsNotifyUser( activity: Partial, alertInMeeting = false, - externalResourceUrl?: string + externalResourceUrl?: string, ): void { validateActivity(activity); diff --git a/libraries/botbuilder/src/teamsInfo.ts b/libraries/botbuilder/src/teamsInfo.ts index 736c143086..b5b0dbed49 100644 --- a/libraries/botbuilder/src/teamsInfo.ts +++ b/libraries/botbuilder/src/teamsInfo.ts @@ -47,7 +47,6 @@ export class TeamsInfo { /** * Gets the meeting participant for the given meeting id and participant id. This only works in * teams scoped meeting conversations. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param meetingId The meeting ID to fetch * @param participantId The participant ID to fetch @@ -58,7 +57,7 @@ export class TeamsInfo { context: TurnContext, meetingId?: string, participantId?: string, - tenantId?: string + tenantId?: string, ): Promise { if (!context) { throw new Error('context is required.'); @@ -98,7 +97,6 @@ export class TeamsInfo { /** * Gets the information for the given meeting id. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param meetingId The BASE64-encoded id of the Teams meeting. * @returns The [MeetingInfo](xref:botframework-schema.MeetingInfo) fetched @@ -124,7 +122,6 @@ export class TeamsInfo { /** * Gets the details for the given team id. This only works in teams scoped conversations. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param teamId The id of the Teams team. * @returns The [TeamDetails](xref:botbuilder-core.TeamDetails) fetched @@ -140,7 +137,6 @@ export class TeamsInfo { /** * Creates a new thread in a Teams chat and sends an [Activity](xref:botframework-schema.Activity) to that new thread. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param activity The [Activity](xref:botframework-schema.Activity) to send. * @param teamsChannelId The Team's Channel ID, note this is distinct from the Bot Framework activity property with same name. @@ -151,7 +147,7 @@ export class TeamsInfo { context: TurnContext, activity: Activity, teamsChannelId: string, - botAppId?: string + botAppId?: string, ): Promise<[ConversationReference, string]> { if (!context) { throw new Error('TurnContext cannot be null'); @@ -188,11 +184,11 @@ export class TeamsInfo { async (turnContext) => { conversationReference = TurnContext.getConversationReference(turnContext.activity); newActivityId = turnContext.activity.id; - } + }, ); } else { const connectorClient = (context.adapter as BotFrameworkAdapter).createConnectorClient( - context.activity.serviceUrl + context.activity.serviceUrl, ); const conversationResourceResponse = await connectorClient.conversations.createConversation(convoParams); conversationReference = TurnContext.getConversationReference(context.activity); @@ -205,7 +201,6 @@ export class TeamsInfo { /** * Returns a list of channels in a Team. This only works in teams scoped conversations. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param teamId ID of the Teams team. * @returns The list of [ChannelInfo](xref:botframework-schema.ChannelInfo) objects with the conversations. @@ -222,10 +217,8 @@ export class TeamsInfo { /** * Gets the conversation members of a one-on-one or group chat. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @returns The list of [TeamsChannelAccount](xref:botframework-schema.TeamsChannelAccount). - * * @deprecated Use `getPagedTeamMembers` instead. */ static async getMembers(context: TurnContext): Promise { @@ -241,7 +234,6 @@ export class TeamsInfo { /** * Gets a pagined list of members of one-on-one, group, or team conversation. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param pageSize Suggested number of entries on a page. * @param continuationToken A continuation token. @@ -250,7 +242,7 @@ export class TeamsInfo { static async getPagedMembers( context: TurnContext, pageSize?: number, - continuationToken?: string + continuationToken?: string, ): Promise { const teamId = this.getTeamId(context); const options: TeamsConnectorModels.ConversationsGetConversationPagedMembersOptionalParams = { @@ -268,7 +260,6 @@ export class TeamsInfo { /** * Gets the account of a single conversation member. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param userId ID of the user in question. * @returns The [TeamsChannelAccount](xref:botframework-schema.TeamsChannelAccount) of the member. @@ -286,11 +277,9 @@ export class TeamsInfo { /** * Gets the list of [TeamsChannelAccount](xref:botframework-schema.TeamsChannelAccount) within a team. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param teamId ID of the Teams team. * @returns The list of [TeamsChannelAccount](xref:botframework-schema.TeamsChannelAccount) of the members. - * * @deprecated Use `getPagedTeamMembers` instead. */ static async getTeamMembers(context: TurnContext, teamId?: string): Promise { @@ -303,7 +292,6 @@ export class TeamsInfo { /** * Gets a paginated list of members of a team. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param teamId ID of the Teams team. * @param pageSize The number of entries on the page. @@ -314,7 +302,7 @@ export class TeamsInfo { context: TurnContext, teamId?: string, pageSize?: number, - continuationToken?: string + continuationToken?: string, ): Promise { const t = teamId || this.getTeamId(context); if (!t) { @@ -330,7 +318,6 @@ export class TeamsInfo { /** * Gets the account of a member in a teams scoped conversation. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param teamId ID of the Teams team. * @param userId ID of the Teams user. @@ -346,7 +333,6 @@ export class TeamsInfo { /** * Sends a meeting notification to specific users in a Teams meeting. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param notification The meeting notification payload. * @param meetingId Id of the Teams meeting. @@ -357,7 +343,7 @@ export class TeamsInfo { static async sendMeetingNotification( context: TurnContext, notification: MeetingNotification, - meetingId?: string + meetingId?: string, ): Promise { const activity = context.activity; @@ -375,7 +361,6 @@ export class TeamsInfo { /** * Sends a message to the provided users in the list of Teams members. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param activity The activity to send. * @param tenantId The tenant ID. @@ -386,7 +371,7 @@ export class TeamsInfo { context: TurnContext, activity: Activity, tenantId: string, - members: TeamsMember[] + members: TeamsMember[], ): Promise { if (!activity) { throw new Error('activity is required.'); @@ -403,7 +388,6 @@ export class TeamsInfo { /** * Sends a message to all the users in a tenant. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param activity The activity to send. * @param tenantId The tenant ID. @@ -412,7 +396,7 @@ export class TeamsInfo { static async sendMessageToAllUsersInTenant( context: TurnContext, activity: Activity, - tenantId: string + tenantId: string, ): Promise { if (!activity) { throw new Error('activity is required.'); @@ -426,7 +410,6 @@ export class TeamsInfo { /** * Sends a message to all the users in a team. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param activity The activity to send. * @param tenantId The tenant ID. @@ -437,7 +420,7 @@ export class TeamsInfo { context: TurnContext, activity: Activity, tenantId: string, - teamId: string + teamId: string, ): Promise { if (!activity) { throw new Error('activity is required.'); @@ -452,13 +435,12 @@ export class TeamsInfo { return await this.getTeamsConnectorClient(context).teams.sendMessageToAllUsersInTeam( activity, tenantId, - teamId + teamId, ); } /** * Sends a message to the provided list of Teams channels. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param activity The activity to send. * @param tenantId The tenant ID. @@ -469,7 +451,7 @@ export class TeamsInfo { context: TurnContext, activity: Activity, tenantId: string, - members: TeamsMember[] + members: TeamsMember[], ): Promise { if (!activity) { throw new Error('activity is required.'); @@ -484,13 +466,12 @@ export class TeamsInfo { return await this.getTeamsConnectorClient(context).teams.sendMessageToListOfChannels( activity, tenantId, - members + members, ); } /** * Gets the operation state. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param operationId The operationId to get the state of. * @returns Promise with The state and responses of the operation. @@ -505,7 +486,6 @@ export class TeamsInfo { /** * Gets the failed entries of an executed operation. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param operationId The operationId to get the failed entries of. * @returns Promise with the list of failed entries of the operation. @@ -520,7 +500,6 @@ export class TeamsInfo { /** * Cancels a pending operation. - * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param operationId The id of the operation to cancel. * @returns Promise representing the asynchronous operation. @@ -538,15 +517,14 @@ export class TeamsInfo { */ private static async getMembersInternal( connectorClient: ConnectorClient, - conversationId: string + conversationId: string, ): Promise { if (!conversationId) { throw new Error('The getMembers operation needs a valid conversationId.'); } - const teamMembers: ChannelAccount[] = await connectorClient.conversations.getConversationMembers( - conversationId - ); + const teamMembers: ChannelAccount[] = + await connectorClient.conversations.getConversationMembers(conversationId); teamMembers.forEach((member): void => { member.aadObjectId = (member as any).objectId; }); @@ -560,7 +538,7 @@ export class TeamsInfo { private static async getPagedMembersInternal( connectorClient: ConnectorClient, conversationId: string, - options: TeamsConnectorModels.ConversationsGetConversationPagedMembersOptionalParams + options: TeamsConnectorModels.ConversationsGetConversationPagedMembersOptionalParams, ): Promise { if (!conversationId) { throw new Error('The getPagedMembers operation needs a valid conversationId.'); @@ -568,7 +546,7 @@ export class TeamsInfo { const pagedMembersResult: PagedMembersResult = await connectorClient.conversations.getConversationPagedMembers( conversationId, - options + options, ); const teamsPagedMembersResult: TeamsPagedMembersResult = { @@ -585,7 +563,7 @@ export class TeamsInfo { private static async getMemberInternal( connectorClient: ConnectorClient, conversationId: string, - userId: string + userId: string, ): Promise { if (!conversationId) { throw new Error('The getMember operation needs a valid conversationId.'); @@ -597,7 +575,7 @@ export class TeamsInfo { const teamMember: ChannelAccount = await connectorClient.conversations.getConversationMember( conversationId, - userId + userId, ); return teamMember as TeamsChannelAccount; diff --git a/libraries/botbuilder/src/zod.ts b/libraries/botbuilder/src/zod.ts index 5a90ebd52a..00f39909bf 100644 --- a/libraries/botbuilder/src/zod.ts +++ b/libraries/botbuilder/src/zod.ts @@ -16,7 +16,7 @@ export const INodeSocketT = z.custom( typeof val.once === 'function' && typeof val.pipe === 'function' && typeof val.write === 'function', - { message: 'INodeSocket' } + { message: 'INodeSocket' }, ); export const LogicT = z.custom<(context: TurnContext) => Promise>((val) => typeof val === 'function'); diff --git a/libraries/botbuilder/tests/botFrameworkAdapter.test.js b/libraries/botbuilder/tests/botFrameworkAdapter.test.js index ca5d995d69..29d1dc3f25 100644 --- a/libraries/botbuilder/tests/botFrameworkAdapter.test.js +++ b/libraries/botbuilder/tests/botFrameworkAdapter.test.js @@ -89,7 +89,7 @@ class AdapterUnderTest extends BotFrameworkAdapter { assert.strictEqual( authHeader, this.expectAuthHeader, - 'authenticateRequestInternal() not passed expected authHeader.' + 'authenticateRequestInternal() not passed expected authHeader.', ); return this.failAuth ? Promise.reject(new Error('failed auth')) : Promise.resolve({ claims: [] }); } @@ -344,7 +344,7 @@ describe('BotFrameworkAdapter', function () { assert.strictEqual( adapter.webSocketFactory, 'test-web-socket', - 'Adapter should have read settings.webSocketFactory' + 'Adapter should have read settings.webSocketFactory', ); }); }); @@ -368,7 +368,7 @@ describe('BotFrameworkAdapter', function () { const incoming = TurnContext.applyConversationReference( { type: 'message', text: 'foo', callerId: 'foo' }, reference, - true + true, ); incoming.channelId = 'msteams'; @@ -388,7 +388,7 @@ describe('BotFrameworkAdapter', function () { const incoming = TurnContext.applyConversationReference( { type: 'message', text: 'foo', callerId: 'foo' }, reference, - true + true, ); incoming.channelId = 'msteams'; @@ -407,7 +407,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest({ appId: 'bogusApp', appPassword: 'bogusPassword' }); await assert.rejects( adapter.testAuthenticateRequest(req, ''), - new Error('Unauthorized Access. Request is not authorized') + new Error('Unauthorized Access. Request is not authorized'), ); }); }); @@ -483,7 +483,7 @@ describe('BotFrameworkAdapter', function () { headers: new HttpHeaders(), readableStreamBody: undefined, bodyAsText: '', - }) + }), ); const adapter = new BotFrameworkAdapter({ clientOptions: { httpClient: { sendRequest } } }); @@ -497,14 +497,14 @@ describe('BotFrameworkAdapter', function () { assert( sendRequest.called, - 'sendRequest on HttpClient provided to BotFrameworkAdapter.clientOptions was not called when sending an activity' + 'sendRequest on HttpClient provided to BotFrameworkAdapter.clientOptions was not called when sending an activity', ); const [request] = sendRequest.args[0]; assert.deepStrictEqual( JSON.parse(request.body), outgoingMessageLocale, - 'sentActivity should flow through custom httpClient.sendRequest' + 'sentActivity should flow through custom httpClient.sendRequest', ); }); @@ -519,7 +519,7 @@ describe('BotFrameworkAdapter', function () { assert( connectorClient._requestPolicyFactories.find((policy) => policy === setUserAgent), - 'requestPolicyFactories from clientOptions parameter is not used.' + 'requestPolicyFactories from clientOptions parameter is not used.', ); }); }); @@ -555,7 +555,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new BotFrameworkAdapter(); await assert.rejects( adapter.createConnectorClientWithIdentity('https://serviceurl.com'), - new Error('BotFrameworkAdapter.createConnectorClientWithIdentity(): invalid identity parameter.') + new Error('BotFrameworkAdapter.createConnectorClientWithIdentity(): invalid identity parameter.'), ); }); @@ -575,7 +575,7 @@ describe('BotFrameworkAdapter', function () { .mock(adapter) .expects('buildCredentials') .callsFake((appId, oAuthScope) => - Promise.resolve(new MicrosoftAppCredentials(appId, '', undefined, oAuthScope)) + Promise.resolve(new MicrosoftAppCredentials(appId, '', undefined, oAuthScope)), ) .once(); @@ -606,7 +606,7 @@ describe('BotFrameworkAdapter', function () { .mock(adapter) .expects('buildCredentials') .callsFake((appId, oAuthScope) => - Promise.resolve(new MicrosoftAppCredentials(appId, '', undefined, oAuthScope)) + Promise.resolve(new MicrosoftAppCredentials(appId, '', undefined, oAuthScope)), ) .once(); @@ -635,7 +635,7 @@ describe('BotFrameworkAdapter', function () { .mock(adapter) .expects('buildCredentials') .callsFake((appId, oAuthScope) => - Promise.resolve(new MicrosoftAppCredentials(appId, '', undefined, oAuthScope)) + Promise.resolve(new MicrosoftAppCredentials(appId, '', undefined, oAuthScope)), ) .once(); @@ -655,7 +655,7 @@ describe('BotFrameworkAdapter', function () { const connector = await adapter.createConnectorClientWithIdentity( 'https://serviceurl.com', - new ClaimsIdentity([{ type: AuthenticationConstants.AppIdClaim, value: appId }]) + new ClaimsIdentity([{ type: AuthenticationConstants.AppIdClaim, value: appId }]), ); const credentials = connector.credentials; @@ -673,7 +673,7 @@ describe('BotFrameworkAdapter', function () { const connector = await adapter.createConnectorClientWithIdentity( 'https://serviceurl.com', - new ClaimsIdentity([{ type: AuthenticationConstants.AppIdClaim, value: appId }]) + new ClaimsIdentity([{ type: AuthenticationConstants.AppIdClaim, value: appId }]), ); const credentials = connector.credentials; @@ -692,7 +692,7 @@ describe('BotFrameworkAdapter', function () { const connector = await adapter.createConnectorClientWithIdentity( 'https://serviceurl.com', - new ClaimsIdentity([{ type: AuthenticationConstants.AudienceClaim, value: appId }]) + new ClaimsIdentity([{ type: AuthenticationConstants.AudienceClaim, value: appId }]), ); const credentials = connector.credentials; @@ -726,7 +726,7 @@ describe('BotFrameworkAdapter', function () { await context.sendActivity({ type: 'invokeResponse', text: '1st message' }); await context.sendActivity({ type: 'invokeResponse', text: '2nd message' }); }, - { activity } + { activity }, ); assertResponse(response, StatusCodes.OK, true); @@ -743,7 +743,7 @@ describe('BotFrameworkAdapter', function () { text: '2nd message', type: 'invokeResponse', }, - ] + ], ); }); @@ -760,7 +760,7 @@ describe('BotFrameworkAdapter', function () { await context.sendActivity({ type: 'invokeResponse', text: 'message' }); await context.sendActivity(testTraceMessage); }, - { activity } + { activity }, ); assertResponse(response, StatusCodes.OK, true); @@ -773,7 +773,7 @@ describe('BotFrameworkAdapter', function () { text: 'message', type: 'invokeResponse', }, - ] + ], ); }); @@ -790,7 +790,7 @@ describe('BotFrameworkAdapter', function () { await context.sendActivity({ type: 'invokeResponse', text: 'message' }); await context.sendActivity(testTraceMessage); }, - { activity } + { activity }, ); assertResponse(response, StatusCodes.OK, true); @@ -798,7 +798,7 @@ describe('BotFrameworkAdapter', function () { assert.deepStrictEqual( response.body.activities.map(({ type }) => type), - ['invokeResponse', 'trace'] + ['invokeResponse', 'trace'], ); }); @@ -843,7 +843,7 @@ describe('BotFrameworkAdapter', function () { assert.strictEqual( typeof context.activity.timestamp, 'object', - "'context.activity.timestamp' is not a date" + "'context.activity.timestamp' is not a date", ); assert(context.activity.timestamp instanceof Date, "'context.activity.timestamp' is not a date"); @@ -851,15 +851,15 @@ describe('BotFrameworkAdapter', function () { assert.strictEqual( typeof context.activity.localTimestamp, 'object', - "'context.activity.localTimestamp' is not a date" + "'context.activity.localTimestamp' is not a date", ); assert( context.activity.localTimestamp instanceof Date, - "'context.activity.localTimestamp' is not a date" + "'context.activity.localTimestamp' is not a date", ); }, - { activity } + { activity }, ); assertResponse(response, StatusCodes.OK); @@ -874,7 +874,7 @@ describe('BotFrameworkAdapter', function () { assert(!fake.called); assertResponse(response, 400, true); return true; - } + }, ); }); @@ -886,7 +886,7 @@ describe('BotFrameworkAdapter', function () { assert(!fake.called); assertResponse(response, 400, true); return true; - } + }, ); }); @@ -894,7 +894,7 @@ describe('BotFrameworkAdapter', function () { const activity = TurnContext.applyConversationReference( { type: 'message', text: 'foo', channelData: { tenant: { id: '1234' } } }, reference, - true + true, ); activity.channelId = 'msteams'; @@ -903,10 +903,10 @@ describe('BotFrameworkAdapter', function () { assert.strictEqual( context.activity.conversation.tenantId, '1234', - 'should have copied tenant id from channelData to conversation address' + 'should have copied tenant id from channelData to conversation address', ); }, - { activity } + { activity }, ); assertResponse(response, StatusCodes.OK); @@ -917,7 +917,7 @@ describe('BotFrameworkAdapter', function () { const activity = TurnContext.applyConversationReference( { type: 'message', text: 'foo', semanticAction: { state: 'start' } }, reference, - true + true, ); activity.channelId = 'msteams'; @@ -925,7 +925,7 @@ describe('BotFrameworkAdapter', function () { (context) => { assert(context.activity.semanticAction.state === 'start'); }, - { activity } + { activity }, ); assertResponse(response, StatusCodes.OK); @@ -936,7 +936,7 @@ describe('BotFrameworkAdapter', function () { const processIncoming = async ( incoming, handler, - { adapterArgs = {}, authDisabled = false, claims = [] } = {} + { adapterArgs = {}, authDisabled = false, claims = [] } = {}, ) => { // Sets up expectation for JWT validation to pass back claims mockReturns(JwtTokenValidation, 'authenticateRequest', new ClaimsIdentity(claims, true)); @@ -965,7 +965,7 @@ describe('BotFrameworkAdapter', function () { const incoming = TurnContext.applyConversationReference( { type: 'message', text: 'foo', callerId: 'foo' }, reference, - true + true, ); incoming.channelId = 'msteams'; @@ -986,7 +986,7 @@ describe('BotFrameworkAdapter', function () { (context) => { assert.strictEqual( context.activity.callerId, - `${CallerIdConstants.BotToBotPrefix}${skillConsumerAppId}` + `${CallerIdConstants.BotToBotPrefix}${skillConsumerAppId}`, ); }, { @@ -995,7 +995,7 @@ describe('BotFrameworkAdapter', function () { { type: AuthenticationConstants.AppIdClaim, value: skillConsumerAppId }, { type: AuthenticationConstants.VersionClaim, value: '1.0' }, ], - } + }, ); }); @@ -1003,7 +1003,7 @@ describe('BotFrameworkAdapter', function () { const incoming = TurnContext.applyConversationReference( { type: 'message', text: 'foo', callerId: 'foo' }, reference, - true + true, ); incoming.channelId = 'msteams'; @@ -1012,7 +1012,7 @@ describe('BotFrameworkAdapter', function () { (context) => { assert.strictEqual(context.activity.callerId, undefined); }, - { authDisabled: true } + { authDisabled: true }, ); }); @@ -1033,7 +1033,7 @@ describe('BotFrameworkAdapter', function () { { type: AuthenticationConstants.AudienceClaim, value: skillAppId }, { type: AuthenticationConstants.VersionClaim, value: '1.0' }, ], - } + }, ); }); }); @@ -1042,7 +1042,7 @@ describe('BotFrameworkAdapter', function () { const incoming = TurnContext.applyConversationReference( { type: 'message', text: 'foo', callerId: 'foo' }, reference, - true + true, ); incoming.channelId = 'msteams'; @@ -1063,7 +1063,7 @@ describe('BotFrameworkAdapter', function () { assert(!fake.called); return true; - } + }, ); }); @@ -1078,7 +1078,7 @@ describe('BotFrameworkAdapter', function () { assert(fake.called); return true; - } + }, ); }); @@ -1086,7 +1086,7 @@ describe('BotFrameworkAdapter', function () { const createConversation = async ( reference, handler, - { adapterArgs, createConversationParams, testAdapterArgs } = {} + { adapterArgs, createConversationParams, testAdapterArgs } = {}, ) => { const adapter = new AdapterUnderTest(adapterArgs, testAdapterArgs); @@ -1120,7 +1120,7 @@ describe('BotFrameworkAdapter', function () { assert(context.activity.conversation, 'activity has no conversation'); assert(context.activity.conversation.isGroup, 'activity isGroup is not true'); }, - { createConversationParams: { isGroup: true } } + { createConversationParams: { isGroup: true } }, ); }); @@ -1133,17 +1133,17 @@ describe('BotFrameworkAdapter', function () { assert.strictEqual( context.activity.conversation.id, 'convo2', - 'request has invalid conversation.id.' + 'request has invalid conversation.id.', ); assert.strictEqual( context.activity.serviceUrl, 'https://example.org/channel2', - 'request has invalid conversation.id.' + 'request has invalid conversation.id.', ); }, { testAdapterArgs: { newServiceUrl: 'https://example.org/channel2' }, - } + }, ); }); @@ -1158,7 +1158,7 @@ describe('BotFrameworkAdapter', function () { assert(!fake.called); return true; - } + }, ); }); @@ -1179,13 +1179,13 @@ describe('BotFrameworkAdapter', function () { assert.strictEqual( context.activity.conversation.tenantId, tenantReference.conversation.tenantId, - 'request has invalid tenantId on conversation.' + 'request has invalid tenantId on conversation.', ); assert.strictEqual( context.activity.channelData.tenant.id, tenantReference.conversation.tenantId, - 'request has invalid tenantId in channelData.' + 'request has invalid tenantId in channelData.', ); }); }); @@ -1198,7 +1198,7 @@ describe('BotFrameworkAdapter', function () { const responses = await adapter.sendActivities(context, [outgoingMessage]); assert.deepStrictEqual( responses.map(({ id }) => id), - ['5678'] + ['5678'], ); }); @@ -1251,7 +1251,7 @@ describe('BotFrameworkAdapter', function () { it('should return bots invokeResponse', async function () { const { response, verify } = await processActivity( (context) => context.sendActivity({ type: 'invokeResponse', value: { status: 200, body: 'body' } }), - { activity: incomingInvoke } + { activity: incomingInvoke }, ); assertResponse(response, StatusCodes.OK, true); verify(); @@ -1266,7 +1266,7 @@ describe('BotFrameworkAdapter', function () { assert(fake.called); return true; - } + }, ); }); @@ -1298,7 +1298,7 @@ describe('BotFrameworkAdapter', function () { const responses = await adapter.sendActivities(context, [copy]); assert.deepStrictEqual( responses.map(({ id }) => id), - ['5678'] + ['5678'], ); }); @@ -1404,7 +1404,7 @@ describe('BotFrameworkAdapter', function () { assert.strictEqual( testEndpoint, connector.ChannelValidation.OpenIdMetadataEndpoint, - 'ChannelValidation.OpenIdMetadataEndpoint was not set.' + 'ChannelValidation.OpenIdMetadataEndpoint was not set.', ); }); @@ -1415,7 +1415,7 @@ describe('BotFrameworkAdapter', function () { assert.strictEqual( testEndpoint, connector.GovernmentChannelValidation.OpenIdMetadataEndpoint, - 'GovernmentChannelValidation.OpenIdMetadataEndpoint was not set.' + 'GovernmentChannelValidation.OpenIdMetadataEndpoint was not set.', ); }); }); @@ -1431,7 +1431,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.deleteConversationMember({ activity: {} }), - new Error('BotFrameworkAdapter.deleteConversationMember(): missing serviceUrl') + new Error('BotFrameworkAdapter.deleteConversationMember(): missing serviceUrl'), ); }); @@ -1439,7 +1439,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.deleteConversationMember({ activity: { serviceUrl: 'https://test.com' } }), - new Error('BotFrameworkAdapter.deleteConversationMember(): missing conversation or conversation.id') + new Error('BotFrameworkAdapter.deleteConversationMember(): missing conversation or conversation.id'), ); }); @@ -1447,7 +1447,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.deleteConversationMember({ activity: { serviceUrl: 'https://test.com', conversation: {} } }), - new Error('BotFrameworkAdapter.deleteConversationMember(): missing conversation or conversation.id') + new Error('BotFrameworkAdapter.deleteConversationMember(): missing conversation or conversation.id'), ); }); @@ -1461,7 +1461,7 @@ describe('BotFrameworkAdapter', function () { await adapter.deleteConversationMember( { activity: { serviceUrl: 'https://test.com', conversation: { id: 'convo1' } } }, - 'test-member' + 'test-member', ); sandbox.verify(); @@ -1471,7 +1471,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.getActivityMembers({ activity: {} }), - new Error('BotFrameworkAdapter.getActivityMembers(): missing serviceUrl') + new Error('BotFrameworkAdapter.getActivityMembers(): missing serviceUrl'), ); }); @@ -1479,7 +1479,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.getActivityMembers({ activity: { serviceUrl: 'https://test.com' } }), - new Error('BotFrameworkAdapter.getActivityMembers(): missing conversation or conversation.id') + new Error('BotFrameworkAdapter.getActivityMembers(): missing conversation or conversation.id'), ); }); @@ -1487,7 +1487,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.getActivityMembers({ activity: { serviceUrl: 'https://test.com', conversation: {} } }), - new Error('BotFrameworkAdapter.getActivityMembers(): missing conversation or conversation.id') + new Error('BotFrameworkAdapter.getActivityMembers(): missing conversation or conversation.id'), ); }); @@ -1497,7 +1497,7 @@ describe('BotFrameworkAdapter', function () { adapter.getActivityMembers({ activity: { serviceUrl: 'https://test.com', conversation: { id: '1' } }, }), - new Error('BotFrameworkAdapter.getActivityMembers(): missing both activityId and context.activity.id') + new Error('BotFrameworkAdapter.getActivityMembers(): missing both activityId and context.activity.id'), ); }); @@ -1512,7 +1512,7 @@ describe('BotFrameworkAdapter', function () { await adapter.getActivityMembers( { activity: { serviceUrl: 'https://test.com', conversation: { id: 'convo1' } } }, - 'activityId' + 'activityId', ); sandbox.verify(); @@ -1522,7 +1522,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.getConversationMembers({ activity: {} }), - new Error('BotFrameworkAdapter.getConversationMembers(): missing serviceUrl') + new Error('BotFrameworkAdapter.getConversationMembers(): missing serviceUrl'), ); }); @@ -1530,7 +1530,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.getConversationMembers({ activity: { serviceUrl: 'https://test.com' } }), - new Error('BotFrameworkAdapter.getConversationMembers(): missing conversation or conversation.id') + new Error('BotFrameworkAdapter.getConversationMembers(): missing conversation or conversation.id'), ); }); @@ -1538,7 +1538,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.getConversationMembers({ activity: { serviceUrl: 'https://test.com', conversation: {} } }), - new Error('BotFrameworkAdapter.getConversationMembers(): missing conversation or conversation.id') + new Error('BotFrameworkAdapter.getConversationMembers(): missing conversation or conversation.id'), ); }); @@ -1561,7 +1561,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.getUserToken({ activity: {}, turnState: new Map() }), - new Error('BotFrameworkAdapter.getUserToken(): missing from or from.id') + new Error('BotFrameworkAdapter.getUserToken(): missing from or from.id'), ); }); @@ -1569,7 +1569,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.getUserToken({ activity: { from: {} }, turnState: new Map() }), - new Error('BotFrameworkAdapter.getUserToken(): missing from or from.id') + new Error('BotFrameworkAdapter.getUserToken(): missing from or from.id'), ); }); @@ -1577,7 +1577,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.getUserToken({ activity: { from: { id: 'some id' } }, turnState: new Map() }), - new Error('getUserToken() requires a connectionName but none was provided.') + new Error('getUserToken() requires a connectionName but none was provided.'), ); }); @@ -1590,7 +1590,7 @@ describe('BotFrameworkAdapter', function () { const token = await adapter.getUserToken( { activity: { channelId: 'The Facebook', from: { id: 'some id' } }, turnState: new Map() }, - 'aConnectionName' + 'aConnectionName', ); sandbox.verify(); @@ -1608,7 +1608,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.signOutUser({ activity: {}, turnState: new Map() }), - new Error('BotFrameworkAdapter.signOutUser(): missing from or from.id') + new Error('BotFrameworkAdapter.signOutUser(): missing from or from.id'), ); }); @@ -1616,7 +1616,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.signOutUser({ activity: { from: {} }, turnState: new Map() }), - new Error('BotFrameworkAdapter.signOutUser(): missing from or from.id') + new Error('BotFrameworkAdapter.signOutUser(): missing from or from.id'), ); }); @@ -1637,7 +1637,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.getAadTokens({ activity: {}, turnState: new Map() }), - new Error('BotFrameworkAdapter.getAadTokens(): missing from or from.id') + new Error('BotFrameworkAdapter.getAadTokens(): missing from or from.id'), ); }); @@ -1645,7 +1645,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.getAadTokens({ activity: { from: {} }, turnState: new Map() }), - new Error('BotFrameworkAdapter.getAadTokens(): missing from or from.id') + new Error('BotFrameworkAdapter.getAadTokens(): missing from or from.id'), ); }); @@ -1693,9 +1693,9 @@ describe('BotFrameworkAdapter', function () { context, 'aConnectionName', new MicrosoftAppCredentials('abc', 'abc'), - 'invalidId' + 'invalidId', ), - ReferenceError("cannot retrieve OAuth signin link for a user that's different from the conversation") + ReferenceError("cannot retrieve OAuth signin link for a user that's different from the conversation"), ); }); @@ -1711,7 +1711,7 @@ describe('BotFrameworkAdapter', function () { const response = await adapter.getSignInLink( context, 'aConnectionName', - new MicrosoftAppCredentials('abc', 'abc') + new MicrosoftAppCredentials('abc', 'abc'), ); assert(response, mockedUrl); verify(); @@ -1724,7 +1724,7 @@ describe('BotFrameworkAdapter', function () { 'aConnectionName', new MicrosoftAppCredentials('abc', 'abc'), incomingMessage.from.id, - 'http://finalredirect.com' + 'http://finalredirect.com', ); assert(response, mockedUrl); verify(); @@ -1755,7 +1755,7 @@ describe('BotFrameworkAdapter', function () { const { adapter, context } = getMockedAdapter(); await assert.rejects( adapter.getSignInResource(context), - new Error('getUserToken() requires a connectionName but none was provided.') + new Error('getUserToken() requires a connectionName but none was provided.'), ); }); @@ -1766,7 +1766,7 @@ describe('BotFrameworkAdapter', function () { const { adapter, context } = getMockedAdapter(activity); await assert.rejects( adapter.getSignInResource(context, 'TestConnectionName'), - new Error('BotFrameworkAdapter.getSignInResource(): missing from or from.id') + new Error('BotFrameworkAdapter.getSignInResource(): missing from or from.id'), ); }); @@ -1777,7 +1777,7 @@ describe('BotFrameworkAdapter', function () { const { adapter, context } = getMockedAdapter(activity); await assert.rejects( adapter.getSignInResource(context, 'TestConnectionName'), - new Error('BotFrameworkAdapter.getSignInResource(): missing from or from.id') + new Error('BotFrameworkAdapter.getSignInResource(): missing from or from.id'), ); }); @@ -1786,8 +1786,8 @@ describe('BotFrameworkAdapter', function () { await assert.rejects( adapter.getSignInResource(context, 'TestConnectionName', 'OtherUserId'), new Error( - 'BotFrameworkAdapter.getSiginInResource(): cannot get signin resource for a user that is different from the conversation' - ) + 'BotFrameworkAdapter.getSiginInResource(): cannot get signin resource for a user that is different from the conversation', + ), ); }); @@ -1815,7 +1815,7 @@ describe('BotFrameworkAdapter', function () { const { adapter, context } = getMockedAdapter(); await assert.rejects( adapter.exchangeToken(context), - new Error('exchangeToken() requires a connectionName but none was provided.') + new Error('exchangeToken() requires a connectionName but none was provided.'), ); }); @@ -1823,7 +1823,7 @@ describe('BotFrameworkAdapter', function () { const { adapter, context } = getMockedAdapter(); await assert.rejects( adapter.exchangeToken(context, 'TestConnectionName'), - new Error('exchangeToken() requires an userId but none was provided.') + new Error('exchangeToken() requires an userId but none was provided.'), ); }); @@ -1832,8 +1832,8 @@ describe('BotFrameworkAdapter', function () { await assert.rejects( adapter.exchangeToken(context, 'TestConnectionName', 'TestUser', {}), new Error( - 'BotFrameworkAdapter.exchangeToken(): Either a Token or Uri property is required on the TokenExchangeRequest' - ) + 'BotFrameworkAdapter.exchangeToken(): Either a Token or Uri property is required on the TokenExchangeRequest', + ), ); }); @@ -1881,7 +1881,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.getTokenStatus({ activity: {}, turnState: new Map() }), - new Error('BotFrameworkAdapter.getTokenStatus(): missing from or from.id') + new Error('BotFrameworkAdapter.getTokenStatus(): missing from or from.id'), ); }); @@ -1889,7 +1889,7 @@ describe('BotFrameworkAdapter', function () { const adapter = new AdapterUnderTest(); await assert.rejects( adapter.getTokenStatus({ activity: { from: {} }, turnState: new Map() }), - new Error('BotFrameworkAdapter.getTokenStatus(): missing from or from.id') + new Error('BotFrameworkAdapter.getTokenStatus(): missing from or from.id'), ); }); }); @@ -1902,7 +1902,7 @@ describe('BotFrameworkAdapter', function () { // Empty Claims assert.strictEqual( AuthenticationConstants.ToChannelFromBotOAuthScope, - await adapter.getOAuthScope('botAppId', []) + await adapter.getOAuthScope('botAppId', []), ); // Non-skill Claims @@ -1911,7 +1911,7 @@ describe('BotFrameworkAdapter', function () { await adapter.getOAuthScope('botAppId', [ { type: 'aud', value: 'botAppId' }, { type: 'azp', value: 'botAppId' }, - ]) + ]), ); const govAdapter = new BotFrameworkAdapter({ channelService: GovernmentConstants.ChannelService }); @@ -1921,7 +1921,7 @@ describe('BotFrameworkAdapter', function () { // Empty Claims assert.strictEqual( GovernmentConstants.ToChannelFromBotOAuthScope, - await govAdapter.getOAuthScope('botAppId', []) + await govAdapter.getOAuthScope('botAppId', []), ); // Non-skill Claims @@ -1930,7 +1930,7 @@ describe('BotFrameworkAdapter', function () { await govAdapter.getOAuthScope('botAppId', [ { type: 'aud', value: 'botAppId' }, { type: 'azp', value: 'botAppId' }, - ]) + ]), ); }); @@ -1960,7 +1960,7 @@ describe('BotFrameworkAdapter', function () { assert.strictEqual( context.activity.recipient.id, reference.bot.id, - 'request has invalid recipient.id.' + 'request has invalid recipient.id.', ); }); }); @@ -1974,7 +1974,7 @@ describe('BotFrameworkAdapter', function () { assert.strictEqual( context.activity.recipient.id, reference.bot.id, - 'request has invalid recipient.id.' + 'request has invalid recipient.id.', ); }); }); @@ -1988,7 +1988,7 @@ describe('BotFrameworkAdapter', function () { assert.strictEqual( context.activity.recipient.id, reference.bot.id, - 'request has invalid recipient.id.' + 'request has invalid recipient.id.', ); }); }); @@ -2006,7 +2006,7 @@ describe('BotFrameworkAdapter', function () { assert.strictEqual(context.activity.recipient.id, reference.bot.id); assert.strictEqual(context.turnState.get(context.adapter.OAuthScopeKey), oauthScope); }, - { oauthScope } + { oauthScope }, ); }); @@ -2023,12 +2023,12 @@ describe('BotFrameworkAdapter', function () { assert.strictEqual( context.turnState.get(context.adapter.OAuthScopeKey), - GovernmentConstants.ToChannelFromBotOAuthScope + GovernmentConstants.ToChannelFromBotOAuthScope, ); }, { adapterArgs: { channelService: GovernmentConstants.ChannelService }, - } + }, ); }); }); @@ -2086,7 +2086,7 @@ describe('BotFrameworkAdapter', function () { await assert.rejects( adapter.processActivityDirect(createActivity(), () => null), - new Error('BotFrameworkAdapter.processActivityDirect(): ERROR\n test-error') + new Error('BotFrameworkAdapter.processActivityDirect(): ERROR\n test-error'), ); sandbox.verify(); @@ -2098,7 +2098,7 @@ describe('BotFrameworkAdapter', function () { await assert.rejects( adapter.processActivityDirect(createActivity(), 'callbackLogic'), - new Error('BotFrameworkAdapter.processActivityDirect(): ERROR') + new Error('BotFrameworkAdapter.processActivityDirect(): ERROR'), ); sandbox.verify(); diff --git a/libraries/botbuilder/tests/botFrameworkHttpClient.test.js b/libraries/botbuilder/tests/botFrameworkHttpClient.test.js index e7068ff9ff..f8d54e0257 100644 --- a/libraries/botbuilder/tests/botFrameworkHttpClient.test.js +++ b/libraries/botbuilder/tests/botFrameworkHttpClient.test.js @@ -55,7 +55,7 @@ describe('BotFrameworkHttpClient', function () { it('should fail to construct without required parameters', function () { assert.throws( () => new BotFrameworkHttpClient(), - new Error('BotFrameworkHttpClient(): missing credentialProvider') + new Error('BotFrameworkHttpClient(): missing credentialProvider'), ); }); @@ -74,7 +74,7 @@ describe('BotFrameworkHttpClient', function () { 'http://skillUrl/api/good', 'serviceUrl', 'conversationId', - { type: 'message', conversation: {} } + { type: 'message', conversation: {} }, ); assert.strictEqual(response.status, 200); }); @@ -94,7 +94,7 @@ describe('BotFrameworkHttpClient', function () { 'http://skillUrl/api/bad', 'serviceUrl', 'conversationId', - { type: 'message', conversation: {} } + { type: 'message', conversation: {} }, ); assert.strictEqual(response.status, 404); }); @@ -114,7 +114,7 @@ describe('BotFrameworkHttpClient', function () { 'http://skillUrl/api/good', 'serviceUrl', 'conversationId', - { type: 'message', conversation: {} } + { type: 'message', conversation: {} }, ); assert.strictEqual(response.status, 200); }); @@ -135,9 +135,11 @@ describe('BotFrameworkHttpClient', function () { 'http://skillUrl/api/good', 'serviceUrl', 'conversationId', - { type: 'message', conversation: {} } + { type: 'message', conversation: {} }, + ), + new Error( + 'BotFrameworkHttpClient.postActivity(): Unable to get appCredentials to connect to the skill', ), - new Error('BotFrameworkHttpClient.postActivity(): Unable to get appCredentials to connect to the skill') ); }); @@ -153,7 +155,7 @@ describe('BotFrameworkHttpClient', function () { await assert.rejects( client.postActivity(fromBotId, 'toBotId', 'http://skillUrl/api/good', 'serviceUrl', 'conversationId'), - new Error('BotFrameworkHttpClient.postActivity(): missing activity') + new Error('BotFrameworkHttpClient.postActivity(): missing activity'), ); }); @@ -175,9 +177,9 @@ describe('BotFrameworkHttpClient', function () { 'http://skillUrl/api/good', 'serviceUrl', 'conversationId', - activity + activity, ), - new Error('BotFrameworkHttpClient.postActivity(): Activity must have a ConversationReference') + new Error('BotFrameworkHttpClient.postActivity(): Activity must have a ConversationReference'), ); }); @@ -197,7 +199,7 @@ describe('BotFrameworkHttpClient', function () { 'http://skillUrl/api/good', 'serviceUrl', 'conversationId', - activity + activity, ); assert.strictEqual(response.status, 200); assert.strictEqual(activity.recipient, undefined); @@ -220,7 +222,7 @@ describe('BotFrameworkHttpClient', function () { 'http://skillUrl/api/good', 'serviceUrl', 'conversationId', - forwardedActivity + forwardedActivity, ); assert.strictEqual(forwardedActivity.relatesTo, originalRelatesTo); }); diff --git a/libraries/botbuilder/tests/channelServiceHandler.test.js b/libraries/botbuilder/tests/channelServiceHandler.test.js index 97de7039b9..7ff074a00b 100644 --- a/libraries/botbuilder/tests/channelServiceHandler.test.js +++ b/libraries/botbuilder/tests/channelServiceHandler.test.js @@ -86,7 +86,7 @@ describe('ChannelServiceHandler', function () { await assert.rejects( handler.handleSendToConversation(AUTH_HEADER, 'convId', { type: ActivityTypes.Message }), - matchStatusCodeError('onSendToConversation') + matchStatusCodeError('onSendToConversation'), ); }); }); @@ -97,7 +97,7 @@ describe('ChannelServiceHandler', function () { await assert.rejects( handler.handleReplyToActivity(AUTH_HEADER, 'convId', ACTIVITY.id, ACTIVITY), - matchStatusCodeError('onReplyToActivity') + matchStatusCodeError('onReplyToActivity'), ); }); }); @@ -108,7 +108,7 @@ describe('ChannelServiceHandler', function () { await assert.rejects( handler.handleUpdateActivity(AUTH_HEADER, 'convId', ACTIVITY.id, ACTIVITY), - matchStatusCodeError('onUpdateActivity') + matchStatusCodeError('onUpdateActivity'), ); }); }); @@ -119,7 +119,7 @@ describe('ChannelServiceHandler', function () { await assert.rejects( handler.handleDeleteActivity(AUTH_HEADER, 'convId', ACTIVITY.id, ACTIVITY), - matchStatusCodeError('onDeleteActivity') + matchStatusCodeError('onDeleteActivity'), ); }); }); @@ -130,7 +130,7 @@ describe('ChannelServiceHandler', function () { await assert.rejects( handler.handleGetActivityMembers(AUTH_HEADER, 'convId', ACTIVITY.id), - matchStatusCodeError('onGetActivityMembers') + matchStatusCodeError('onGetActivityMembers'), ); }); }); @@ -141,7 +141,7 @@ describe('ChannelServiceHandler', function () { await assert.rejects( handler.handleCreateConversation(AUTH_HEADER, { isGroup: false }), - matchStatusCodeError('onCreateConversation') + matchStatusCodeError('onCreateConversation'), ); }); }); @@ -152,7 +152,7 @@ describe('ChannelServiceHandler', function () { await assert.rejects( handler.handleGetConversations(AUTH_HEADER, 'convId'), - matchStatusCodeError('onGetConversations') + matchStatusCodeError('onGetConversations'), ); }); }); @@ -163,7 +163,7 @@ describe('ChannelServiceHandler', function () { await assert.rejects( handler.handleGetConversationMembers(AUTH_HEADER, 'convId'), - matchStatusCodeError('onGetConversationMembers') + matchStatusCodeError('onGetConversationMembers'), ); }); @@ -172,7 +172,7 @@ describe('ChannelServiceHandler', function () { await assert.rejects( handler.handleGetConversationPagedMembers(AUTH_HEADER, 'convId'), - matchStatusCodeError('onGetConversationPagedMembers') + matchStatusCodeError('onGetConversationPagedMembers'), ); }); @@ -181,7 +181,7 @@ describe('ChannelServiceHandler', function () { await assert.rejects( handler.handleDeleteConversationMember(AUTH_HEADER, 'convId', 'memberId'), - matchStatusCodeError('onDeleteConversationMember') + matchStatusCodeError('onDeleteConversationMember'), ); }); }); @@ -192,7 +192,7 @@ describe('ChannelServiceHandler', function () { await assert.rejects( handler.handleSendConversationHistory(AUTH_HEADER, 'convId', { ACTIVITY }), - matchStatusCodeError('onSendConversationHistory') + matchStatusCodeError('onSendConversationHistory'), ); }); }); @@ -203,7 +203,7 @@ describe('ChannelServiceHandler', function () { await assert.rejects( handler.handleUploadAttachment(AUTH_HEADER, 'convId', { type: 'string', name: 'attachment' }), - matchStatusCodeError('onUploadAttachment') + matchStatusCodeError('onUploadAttachment'), ); }); }); diff --git a/libraries/botbuilder/tests/channelServiceRoutes.test.js b/libraries/botbuilder/tests/channelServiceRoutes.test.js index 6f3467be71..25a69d31cb 100644 --- a/libraries/botbuilder/tests/channelServiceRoutes.test.js +++ b/libraries/botbuilder/tests/channelServiceRoutes.test.js @@ -120,7 +120,7 @@ describe('channelServiceRoutes', function () { statusCode: 200, body: testResource, }, - done + done, ); const service = sandbox.createStubInstance(ChannelServiceHandler); @@ -145,7 +145,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -171,7 +171,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -197,7 +197,7 @@ describe('channelServiceRoutes', function () { statusCode: 200, body: testResource, }, - done + done, ); const service = sandbox.createStubInstance(ChannelServiceHandler); @@ -222,7 +222,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -249,7 +249,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -275,7 +275,7 @@ describe('channelServiceRoutes', function () { statusCode: 200, body: testResource, }, - done + done, ); const service = sandbox.createStubInstance(ChannelServiceHandler); @@ -300,7 +300,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -327,7 +327,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -353,7 +353,7 @@ describe('channelServiceRoutes', function () { statusCode: 200, body: {}, }, - done + done, ); const service = sandbox.createStubInstance(ChannelServiceHandler); @@ -378,7 +378,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -402,7 +402,7 @@ describe('channelServiceRoutes', function () { statusCode: 200, body: testResource, }, - done + done, ); const service = sandbox.createStubInstance(ChannelServiceHandler); @@ -427,7 +427,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -451,7 +451,7 @@ describe('channelServiceRoutes', function () { statusCode: 201, body: testResource, }, - done + done, ); const service = sandbox.createStubInstance(ChannelServiceHandler); @@ -476,7 +476,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -500,7 +500,7 @@ describe('channelServiceRoutes', function () { statusCode: 200, body: testResource, }, - done + done, ); const service = sandbox.createStubInstance(ChannelServiceHandler); @@ -525,7 +525,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -549,7 +549,7 @@ describe('channelServiceRoutes', function () { statusCode: 200, body: testResource, }, - done + done, ); const service = sandbox.createStubInstance(ChannelServiceHandler); @@ -574,7 +574,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -598,7 +598,7 @@ describe('channelServiceRoutes', function () { statusCode: 200, body: testResource, }, - done + done, ); const service = sandbox.createStubInstance(ChannelServiceHandler); @@ -623,7 +623,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -647,7 +647,7 @@ describe('channelServiceRoutes', function () { statusCode: 200, body: {}, }, - done + done, ); const service = sandbox.createStubInstance(ChannelServiceHandler); @@ -672,7 +672,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -696,7 +696,7 @@ describe('channelServiceRoutes', function () { statusCode: 200, body: testResource, }, - done + done, ); const service = sandbox.createStubInstance(ChannelServiceHandler); @@ -721,7 +721,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -748,7 +748,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -774,7 +774,7 @@ describe('channelServiceRoutes', function () { statusCode: 200, body: testResource, }, - done + done, ); const service = sandbox.createStubInstance(ChannelServiceHandler); @@ -799,7 +799,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -826,7 +826,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( err, resourceResponse, - `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}` + `expected: ${JSON.stringify(resourceResponse)}. received: ${JSON.stringify(err)}`, ); done(); }; @@ -885,7 +885,7 @@ describe('channelServiceRoutes', function () { assert.deepStrictEqual( body, source, - `expected: ${JSON.stringify(source)}. received: ${JSON.stringify(body)}` + `expected: ${JSON.stringify(source)}. received: ${JSON.stringify(body)}`, ); done(); }) diff --git a/libraries/botbuilder/tests/cloudAdapter.test.js b/libraries/botbuilder/tests/cloudAdapter.test.js index 013aa0fac4..a8674f7bf7 100644 --- a/libraries/botbuilder/tests/cloudAdapter.test.js +++ b/libraries/botbuilder/tests/cloudAdapter.test.js @@ -170,7 +170,7 @@ describe('CloudAdapter', function () { credentialsFactory, authConfig, undefined, - undefined + undefined, ); const adapter = new CloudAdapter(botFrameworkAuthentication); @@ -178,7 +178,7 @@ describe('CloudAdapter', function () { await adapter.process(req, res, logic); assert.equal(StatusCodes.UNAUTHORIZED, res.statusCode); - expect(consoleStub.calledWithMatch({ message: 'The token has expired' })).to.be.true; + expect(consoleStub.calledWithMatch({ message: 'The token has expired' })).to.equal(true); }); it('calls processActivityDirect with string authorization', async function () { @@ -205,7 +205,7 @@ describe('CloudAdapter', function () { const claimsIdentity = adapter.createClaimsIdentity('appId'); const audience = AuthenticationConstants.ToChannelFromBotOAuthScope; const botFrameworkAuthentication = new ConfigurationBotFrameworkAuthentication( - TestConfiguration.DefaultConfig + TestConfiguration.DefaultConfig, ); const connectorFactory = botFrameworkAuthentication.createConnectorFactory(claimsIdentity); //AuthenticateRequestResult @@ -249,7 +249,7 @@ describe('CloudAdapter', function () { await assert.rejects( adapter.processActivityDirect(authorization, activity, logic), - new Error('CloudAdapter.processActivityDirect(): ERROR\n error stack') + new Error('CloudAdapter.processActivityDirect(): ERROR\n error stack'), ); }); }); @@ -263,27 +263,27 @@ describe('CloudAdapter', function () { await assert.rejects( adapter.connectNamedPipe(undefined, noop, 'appId', 'audience', 'callerId'), - includesParam('pipeName') + includesParam('pipeName'), ); await assert.rejects( adapter.connectNamedPipe('pipeName', undefined, 'appId', 'audience', 'callerId'), - includesParam('logic') + includesParam('logic'), ); await assert.rejects( adapter.connectNamedPipe('pipeName', noop, undefined, 'audience', 'callerId'), - includesParam('appId') + includesParam('appId'), ); await assert.rejects( adapter.connectNamedPipe('pipeName', noop, 'appId', undefined, 'callerId'), - includesParam('audience') + includesParam('audience'), ); await assert.rejects( adapter.connectNamedPipe('pipeName', noop, 'appId', 'audience', 10), - includesParam('callerId') + includesParam('callerId'), ); }); diff --git a/libraries/botbuilder/tests/eventFactoryTests.test.js b/libraries/botbuilder/tests/eventFactoryTests.test.js index eab0c29322..9cb56595e5 100644 --- a/libraries/botbuilder/tests/eventFactoryTests.test.js +++ b/libraries/botbuilder/tests/eventFactoryTests.test.js @@ -42,7 +42,7 @@ describe('EventFactory', function () { it('should throw if turnContext is falsy', function () { assert.throws( () => EventFactory.createHandoffInitiation(null, 'some text'), - TypeError('EventFactory.createHandoffInitiation(): Missing context.') + TypeError('EventFactory.createHandoffInitiation(): Missing context.'), ); }); }); @@ -82,14 +82,14 @@ describe('EventFactory', function () { it('should throw if conversation is falsy', function () { assert.throws( () => EventFactory.createHandoffStatus(null, 'some text'), - TypeError('EventFactory.createHandoffStatus(): missing conversation.') + TypeError('EventFactory.createHandoffStatus(): missing conversation.'), ); }); it('should throw if state is falsy', function () { assert.throws( () => EventFactory.createHandoffStatus({}, null), - TypeError('EventFactory.createHandoffStatus(): missing state.') + TypeError('EventFactory.createHandoffStatus(): missing state.'), ); }); }); diff --git a/libraries/botbuilder/tests/fileTranscriptStore.test.js b/libraries/botbuilder/tests/fileTranscriptStore.test.js index 79979e1089..dbf7d892a1 100644 --- a/libraries/botbuilder/tests/fileTranscriptStore.test.js +++ b/libraries/botbuilder/tests/fileTranscriptStore.test.js @@ -27,14 +27,14 @@ describe('The FileTranscriptStore', function () { let pagedResult = await storage.getTranscriptActivities('test', 'deleteActivitySpec'); assert.ok( pagedResult.items.length === 1, - `Expected pagedResult.items.length to be 1 but it was ${pagedResult.items.length}` + `Expected pagedResult.items.length to be 1 but it was ${pagedResult.items.length}`, ); await storage.deleteTranscript('test', 'deleteActivitySpec'); pagedResult = await storage.getTranscriptActivities('test', 'deleteActivitySpec'); assert.ok( pagedResult.items.length === 0, - `Expected pagedResult.items.length to be 0 but it was ${pagedResult.items.length}` + `Expected pagedResult.items.length to be 0 but it was ${pagedResult.items.length}`, ); }); @@ -46,7 +46,7 @@ describe('The FileTranscriptStore', function () { const pagedResult = await storage.getTranscriptActivities('test', 'deleteActivitySpec'); assert.ok( pagedResult.items.length === 1, - `Expected pagedResult.items.length to be 1 but it was ${pagedResult.items.length}` + `Expected pagedResult.items.length to be 1 but it was ${pagedResult.items.length}`, ); }); @@ -72,7 +72,7 @@ describe('The FileTranscriptStore', function () { const pagedResult = await storage.getTranscriptActivities('otherChannelId', conversationId); assert.ok( !pagedResult.continuationToken, - 'expected pagedResult.continuationToken to be false but it was not' + 'expected pagedResult.continuationToken to be false but it was not', ); assert.ok(pagedResult.items.length === 0, 'Expected pagedResult.items.length to be 0 but it was not'); }); @@ -81,7 +81,7 @@ describe('The FileTranscriptStore', function () { const pagedResult = await storage.getTranscriptActivities('test', 'someOtherConversation'); assert.ok( !pagedResult.continuationToken, - 'expected pagedResult.continuationToken to be false but it was not' + 'expected pagedResult.continuationToken to be false but it was not', ); assert.ok(pagedResult.items.length === 0, 'Expected pagedResult.items.length to be 0 but it was not'); }); @@ -92,8 +92,8 @@ describe('The FileTranscriptStore', function () { pagedResult.items.forEach((item, index) => assert.ok( JSON.stringify(item) === JSON.stringify(activities[index]), - `item #${index} does not match what was persisted to disk` - ) + `item #${index} does not match what was persisted to disk`, + ), ); }); @@ -102,11 +102,11 @@ describe('The FileTranscriptStore', function () { 'test', conversationId, null, - new Date(startDate.getTime() + 60000 * 5) + new Date(startDate.getTime() + 60000 * 5), ); assert.ok( pagedResult.items.length === 5, - `Expected the pagedResult.items.length to be 5 but it was ${pagedResult.items.length}` + `Expected the pagedResult.items.length to be 5 but it was ${pagedResult.items.length}`, ); }); }); @@ -119,21 +119,21 @@ describe('The FileTranscriptStore', function () { it('no activity is passed to the "logActivity" function', async function () { await assert.rejects( storage.logActivity(null), - new Error('activity cannot be null for logActivity()', 'An error should exist') + new Error('activity cannot be null for logActivity()', 'An error should exist'), ); }); it('no channelId is passed to the "getTranscriptActivities" function', async function () { await assert.rejects( storage.getTranscriptActivities(null, '123456'), - new Error('Missing channelId', 'An error should exist') + new Error('Missing channelId', 'An error should exist'), ); }); it('no conversationId is passed to the "getTranscriptActivities" function', async function () { await assert.rejects( storage.getTranscriptActivities({}), - new Error('Missing conversationId', 'An error should exist') + new Error('Missing conversationId', 'An error should exist'), ); }); @@ -148,7 +148,7 @@ describe('The FileTranscriptStore', function () { it('no conversationId is passed to the "deleteTranscript" function', async function () { await assert.rejects( storage.deleteTranscript({}), - new Error('Missing conversationId', 'An error should exist') + new Error('Missing conversationId', 'An error should exist'), ); }); }); @@ -169,12 +169,12 @@ describe('The FileTranscriptStore', function () { const pagedResult = await storage.getTranscriptActivities('test', conversationId); assert.ok( typeof pagedResult.continuationToken === 'string', - `Expected a continuationToken but got ${pagedResult.continuationToken}` + `Expected a continuationToken but got ${pagedResult.continuationToken}`, ); const pagedResult1 = await storage.getTranscriptActivities( 'test', conversationId, - pagedResult.continuationToken + pagedResult.continuationToken, ); assert.ok(!!pagedResult1.items.length, 'Expected the pagedResult to contain items but it did not'); assert.ok(JSON.stringify(pagedResult) !== JSON.stringify(pagedResult1)); @@ -189,12 +189,12 @@ describe('The FileTranscriptStore', function () { set(target, p, value) { if (target[p]) { assert.fail( - 'This ID already returned by getTranscriptActivities and it should not have been' + 'This ID already returned by getTranscriptActivities and it should not have been', ); } return (target[p] = value); }, - } + }, ); let increments = ~~(activities.length / 20); while (increments--) { @@ -219,23 +219,23 @@ describe('The FileTranscriptStore', function () { set(target, p, value) { if (target[p]) { assert.fail( - 'This ID already returned by getTranscriptActivities and it should not have been' + 'This ID already returned by getTranscriptActivities and it should not have been', ); } return (target[p] = value); }, - } + }, ); while (i--) { continuationToken = pagedResult.continuationToken; pagedResult = await storage.getTranscriptActivities('test', conversationId, continuationToken); assert.ok( i === 0 || !!pagedResult.continuationToken, - 'Expected a continuationToken but did not receive one' + 'Expected a continuationToken but did not receive one', ); assert.ok( continuationToken !== pagedResult.continuationToken, - 'The newly returned continuationToken should not match the last one received' + 'The newly returned continuationToken should not match the last one received', ); pagedResult.items.forEach((item) => (seen[item.id] = true)); } @@ -271,18 +271,18 @@ describe('The FileTranscriptStore', function () { } return (target[p] = value); }, - } + }, ); while (i--) { continuationToken = pagedResult.continuationToken; pagedResult = await storage.listTranscripts('test', continuationToken); assert.ok( i === 0 || !!pagedResult.continuationToken, - 'Expected a continuationToken but did not receive one' + 'Expected a continuationToken but did not receive one', ); assert.ok( continuationToken !== pagedResult.continuationToken, - 'The newly returned continuationToken should not match the last one received' + 'The newly returned continuationToken should not match the last one received', ); pagedResult.items.forEach((item) => (seen[item.id] = true)); } diff --git a/libraries/botbuilder/tests/inspectionMiddleware.test.js b/libraries/botbuilder/tests/inspectionMiddleware.test.js index fcd1b00dff..197f956490 100644 --- a/libraries/botbuilder/tests/inspectionMiddleware.test.js +++ b/libraries/botbuilder/tests/inspectionMiddleware.test.js @@ -45,14 +45,14 @@ describe('InspectionMiddleware', function () { const inboundExpectation = nock('https://test.com') .post( '/v3/conversations/Convo1/activities', - (activity) => activity.type === 'trace' && activity.value.text == 'hi' + (activity) => activity.type === 'trace' && activity.value.text == 'hi', ) .reply(200, { id: 'test' }); const outboundExpectation = nock('https://test.com') .post( '/v3/conversations/Convo1/activities', - (activity) => activity.type === 'trace' && activity.value.text == 'echo: hi' + (activity) => activity.type === 'trace' && activity.value.text == 'echo: hi', ) .reply(200, { id: 'test' }); @@ -64,7 +64,7 @@ describe('InspectionMiddleware', function () { activity.value.userState && activity.value.userState.x.property == 'hello' && activity.value.conversationState && - activity.value.conversationState.y.property == 'world' + activity.value.conversationState.y.property == 'world', ) .reply(200, { id: 'test' }); @@ -85,7 +85,7 @@ describe('InspectionMiddleware', function () { await inspectionMiddleware.processCommand(turnContext); }, null, - true + true, ); await inspectionAdapter.receiveActivity(openActivity); @@ -109,7 +109,7 @@ describe('InspectionMiddleware', function () { await conversationState.saveChanges(turnContext); }, null, - true + true, ); // IMPORTANT add the InspectionMiddleware to the adapter that is running our bot @@ -129,7 +129,7 @@ describe('InspectionMiddleware', function () { assert(inboundExpectation.isDone(), 'The expectation of a trace message for the inbound activity was not met'); assert( outboundExpectation.isDone(), - 'The expectation of a trace message for the outbound activity was not met' + 'The expectation of a trace message for the outbound activity was not met', ); assert(stateExpectation.isDone(), 'The expectation of a trace message for the bot state was not met'); }); @@ -139,14 +139,14 @@ describe('InspectionMiddleware', function () { const inboundExpectation = nock('https://test.com') .post( '/v3/conversations/Convo1/activities', - (activity) => activity.type === 'trace' && activity.value.text == 'hi' + (activity) => activity.type === 'trace' && activity.value.text == 'hi', ) .reply(200, { id: 'test' }); const outboundExpectation = nock('https://test.com') .post( '/v3/conversations/Convo1/activities', - (activity) => activity.type === 'trace' && activity.value.text == 'echo: hi' + (activity) => activity.type === 'trace' && activity.value.text == 'echo: hi', ) .reply(200, { id: 'test' }); @@ -158,7 +158,7 @@ describe('InspectionMiddleware', function () { activity.value.userState && activity.value.userState.x.property == 'hello' && activity.value.conversationState && - activity.value.conversationState.y.property == 'world' + activity.value.conversationState.y.property == 'world', ) .reply(200, { id: 'test' }); @@ -179,7 +179,7 @@ describe('InspectionMiddleware', function () { await inspectionMiddleware.processCommand(turnContext); }, null, - true + true, ); await inspectionAdapter.receiveActivity(openActivity); @@ -205,7 +205,7 @@ describe('InspectionMiddleware', function () { await conversationState.saveChanges(turnContext); }, null, - true + true, ); // IMPORTANT add the InspectionMiddleware to the adapter that is running our bot @@ -241,7 +241,7 @@ describe('InspectionMiddleware', function () { assert(inboundExpectation.isDone(), 'The expectation of a trace message for the inbound activity was not met'); assert( outboundExpectation.isDone(), - 'The expectation of a trace message for the outbound activity was not met' + 'The expectation of a trace message for the outbound activity was not met', ); assert(stateExpectation.isDone(), 'The expectation of a trace message for the bot state was not met'); }); @@ -251,14 +251,14 @@ describe('InspectionMiddleware', function () { const inboundExpectation = nock('https://test.com') .post( '/v3/conversations/Convo1/activities', - (activity) => activity.type === 'trace' && activity.value.text == 'hi' + (activity) => activity.type === 'trace' && activity.value.text == 'hi', ) .reply(200, { id: 'test' }); const outboundExpectation = nock('https://test.com') .post( '/v3/conversations/Convo1/activities', - (activity) => activity.type === 'trace' && activity.value.text == 'echo: hi' + (activity) => activity.type === 'trace' && activity.value.text == 'echo: hi', ) .reply(200, { id: 'test' }); @@ -270,7 +270,7 @@ describe('InspectionMiddleware', function () { activity.value.userState && activity.value.userState.x.property == 'hello' && activity.value.conversationState && - activity.value.conversationState.y.property == 'world' + activity.value.conversationState.y.property == 'world', ) .reply(200, { id: 'test' }); @@ -291,7 +291,7 @@ describe('InspectionMiddleware', function () { await inspectionMiddleware.processCommand(turnContext); }, null, - true + true, ); await inspectionAdapter.receiveActivity(openActivity); @@ -315,7 +315,7 @@ describe('InspectionMiddleware', function () { await conversationState.saveChanges(turnContext); }, null, - true + true, ); // IMPORTANT add the InspectionMiddleware to the adapter that is running our bot @@ -341,7 +341,7 @@ describe('InspectionMiddleware', function () { assert(inboundExpectation.isDone(), 'The expectation of a trace message for the inbound activity was not met'); assert( outboundExpectation.isDone(), - 'The expectation of a trace message for the outbound activity was not met' + 'The expectation of a trace message for the outbound activity was not met', ); assert(stateExpectation.isDone(), 'The expectation of a trace message for the bot state was not met'); }); @@ -352,14 +352,14 @@ describe('InspectionMiddleware', function () { nock('https://test.com') .post( '/v3/conversations/Convo1/activities', - (activity) => activity.type === 'trace' && activity.value.text == 'hi' + (activity) => activity.type === 'trace' && activity.value.text == 'hi', ) .reply(200, { id: 'test' }); nock('https://test.com') .post( '/v3/conversations/Convo1/activities', - (activity) => activity.type === 'trace' && activity.value.text == 'echo: hi' + (activity) => activity.type === 'trace' && activity.value.text == 'echo: hi', ) .reply(200, { id: 'test' }); @@ -371,7 +371,7 @@ describe('InspectionMiddleware', function () { activity.value.userState && activity.value.userState.x.property == 'hello' && activity.value.conversationState && - activity.value.conversationState.y.property == 'world' + activity.value.conversationState.y.property == 'world', ) .reply(200, { id: 'test' }); @@ -390,7 +390,7 @@ describe('InspectionMiddleware', function () { await inspectionMiddleware.processCommand(turnContext); }, null, - true + true, ); await inspectionAdapter.receiveActivity(openActivity); @@ -412,7 +412,7 @@ describe('InspectionMiddleware', function () { await conversationState.saveChanges(turnContext); }, null, - true + true, ); adapter.use(inspectionMiddleware); @@ -433,14 +433,14 @@ describe('InspectionMiddleware', function () { nock('https://test.com') .post( '/v3/conversations/Convo1/activities', - (activity) => activity.type === 'trace' && activity.value.text == 'hi' + (activity) => activity.type === 'trace' && activity.value.text == 'hi', ) .reply(200, { id: 'test' }); nock('https://test.com') .post( '/v3/conversations/Convo1/activities', - (activity) => activity.type === 'trace' && activity.value.text == 'echo: hi' + (activity) => activity.type === 'trace' && activity.value.text == 'echo: hi', ) .reply(200, { id: 'test' }); @@ -452,7 +452,7 @@ describe('InspectionMiddleware', function () { activity.value.userState && activity.value.userState.x.property == 'hello' && activity.value.conversationState && - activity.value.conversationState.y.property == 'world' + activity.value.conversationState.y.property == 'world', ) .reply(200, { id: 'test' }); @@ -472,7 +472,7 @@ describe('InspectionMiddleware', function () { await inspectionMiddleware.processCommand(turnContext); }, null, - true + true, ); await inspectionAdapter.receiveActivity(openActivity); @@ -493,7 +493,7 @@ describe('InspectionMiddleware', function () { await conversationState.saveChanges(turnContext); }, null, - true + true, ); adapter.use(inspectionMiddleware); @@ -513,14 +513,14 @@ describe('InspectionMiddleware', function () { nock('https://test.com') .post( '/v3/conversations/Convo1/activities', - (activity) => activity.type === 'trace' && activity.value.text == 'hi' + (activity) => activity.type === 'trace' && activity.value.text == 'hi', ) .reply(200, { id: 'test' }); nock('https://test.com') .post( '/v3/conversations/Convo1/activities', - (activity) => activity.type === 'trace' && activity.value.text == 'echo: hi' + (activity) => activity.type === 'trace' && activity.value.text == 'echo: hi', ) .reply(200, { id: 'test' }); @@ -532,7 +532,7 @@ describe('InspectionMiddleware', function () { activity.value.userState && activity.value.userState.x.property == 'hello' && activity.value.conversationState && - activity.value.conversationState.y.property == 'world' + activity.value.conversationState.y.property == 'world', ) .reply(200, { id: 'test' }); @@ -551,7 +551,7 @@ describe('InspectionMiddleware', function () { await inspectionMiddleware.processCommand(turnContext); }, null, - true + true, ); await inspectionAdapter.receiveActivity(openActivity); @@ -563,11 +563,11 @@ describe('InspectionMiddleware', function () { async (turnContext) => { await assert.rejects( inspectionMiddleware.onTurn(turnContext, null), - TypeError('next is not a function', 'next function should be null') + TypeError('next is not a function', 'next function should be null'), ); }, null, - true + true, ); adapter.use(inspectionMiddleware); @@ -641,7 +641,7 @@ describe('InspectionMiddleware', function () { const result = await inspectionMiddleware.attachCommand( '', { openedSessions: { 'session-1': undefined } }, - 'session-1' + 'session-1', ); assert.strictEqual(result, false, 'should be returning false'); }); diff --git a/libraries/botbuilder/tests/skills/skillHandler.test.js b/libraries/botbuilder/tests/skills/skillHandler.test.js index 1a50be399f..a6bc308728 100644 --- a/libraries/botbuilder/tests/skills/skillHandler.test.js +++ b/libraries/botbuilder/tests/skills/skillHandler.test.js @@ -73,7 +73,7 @@ describe('SkillHandler', function () { assert.deepStrictEqual(context.turnState.get(adapter.BotIdentityKey), identity); return true; }) - .and(sinon.match({ activity })) + .and(sinon.match({ activity })), ) .once(); @@ -133,7 +133,7 @@ describe('SkillHandler', function () { expectsGetSkillConversationReference(convId, updatedActivity.serviceUrl); expectsContext((context) => - context.expects('updateActivity').withArgs(sinon.match(updatedActivity)).once().resolves() + context.expects('updateActivity').withArgs(sinon.match(updatedActivity)).once().resolves(), ); await handler.onUpdateActivity(new ClaimsIdentity([]), convId, activityId, updatedActivity); @@ -166,13 +166,13 @@ describe('SkillHandler', function () { assert.deepStrictEqual( context.turnState.get(adapter.BotIdentityKey), identity, - 'cached identity exists' + 'cached identity exists', ); assert.deepStrictEqual( context.turnState.get(handler.SkillConversationReferenceKey), ref, - 'cached conversation ref exists' + 'cached conversation ref exists', ); sandbox.verify(); @@ -186,7 +186,7 @@ describe('SkillHandler', function () { await assert.rejects( handler.inner.processActivity({}, 'convId', 'replyId', {}), - new Error('skillConversationReference not found') + new Error('skillConversationReference not found'), ); sandbox.verify(); @@ -197,7 +197,7 @@ describe('SkillHandler', function () { await assert.rejects( handler.inner.processActivity({}, 'convId', 'replyId', {}), - new Error('conversationReference not found.') + new Error('conversationReference not found.'), ); sandbox.verify(); @@ -233,7 +233,7 @@ describe('SkillHandler', function () { { type: AuthenticationConstants.AppIdClaim, value: '00000000-0000-0000-0000-000000000000' }, { type: AuthenticationConstants.VersionClaim, value: '1.0' }, ], - true + true, ); const skillActivity = { @@ -289,7 +289,7 @@ describe('SkillHandler', function () { { type: AuthenticationConstants.AppIdClaim, value: skillAppId }, { type: AuthenticationConstants.VersionClaim, value: '1.0' }, ], - true + true, ); const skillActivity = { @@ -313,16 +313,16 @@ describe('SkillHandler', function () { assert.strictEqual( fromKey, fromHandlerKey, - 'the keys should return the same cached values' + 'the keys should return the same cached values', ); assert.strictEqual( context.activity.callerId, - `${CallerIdConstants.BotToBotPrefix}${skillAppId}` + `${CallerIdConstants.BotToBotPrefix}${skillAppId}`, ); return true; - }) + }), ) .once(); diff --git a/libraries/botbuilder/tests/skills/skillHttpClient.test.js b/libraries/botbuilder/tests/skills/skillHttpClient.test.js index 3bfd849c82..04008dbc8b 100644 --- a/libraries/botbuilder/tests/skills/skillHttpClient.test.js +++ b/libraries/botbuilder/tests/skills/skillHttpClient.test.js @@ -10,7 +10,7 @@ describe('SkillHttpClient', function () { it('should fail to construct without required parameters', function () { assert.throws( () => new SkillHttpClient(new SimpleCredentialProvider('', '')), - new Error('conversationIdFactory missing') + new Error('conversationIdFactory missing'), ); }); }); diff --git a/libraries/botbuilder/tests/statusCodeError.test.js b/libraries/botbuilder/tests/statusCodeError.test.js index e0e132ec96..5e1c05efbe 100644 --- a/libraries/botbuilder/tests/statusCodeError.test.js +++ b/libraries/botbuilder/tests/statusCodeError.test.js @@ -17,7 +17,7 @@ describe('StatusCodeError', function () { assert.strictEqual( error.statusCode, StatusCodes.NOT_FOUND, - `statusCode should be the code ${StatusCodes.NOT_FOUND}` + `statusCode should be the code ${StatusCodes.NOT_FOUND}`, ); }); @@ -28,7 +28,7 @@ describe('StatusCodeError', function () { assert.strictEqual( error.statusCode, StatusCodes.NOT_FOUND, - `statusCode should be the code ${StatusCodes.NOT_FOUND}` + `statusCode should be the code ${StatusCodes.NOT_FOUND}`, ); }); diff --git a/libraries/botbuilder/tests/streaming/botFrameworkAdapterStreaming.test.js b/libraries/botbuilder/tests/streaming/botFrameworkAdapterStreaming.test.js index e0a7961231..e28ed4d472 100644 --- a/libraries/botbuilder/tests/streaming/botFrameworkAdapterStreaming.test.js +++ b/libraries/botbuilder/tests/streaming/botFrameworkAdapterStreaming.test.js @@ -52,7 +52,7 @@ describe('BotFrameworkAdapter Streaming tests', function () { const adapter = new BotFrameworkAdapter(); adapter.useNamedPipe(async (_) => {}, 'PipeyMcPipeface'); - expect(adapter.streamingServer.disconnect()).to.not.throw; + expect(() => adapter.streamingServer.disconnect()).to.not.throw(); }); it("throws exception when trying to connect to a different named pipe than it's connected to", async function () { @@ -66,7 +66,7 @@ describe('BotFrameworkAdapter Streaming tests', function () { { message: 'This BotFrameworkAdapter instance is already connected to a different stream. Use a new instance to connect to the provided pipeName.', - } + }, ); }); @@ -83,7 +83,7 @@ describe('BotFrameworkAdapter Streaming tests', function () { it('isStreamingConnectionOpen returns false without a streamingServer', function () { const adapter = new BotFrameworkAdapter(); - expect(adapter.isStreamingConnectionOpen).to.be.false; + expect(adapter.isStreamingConnectionOpen).to.equal(false); }); it('sendActivities should throw an error if streaming connection is closed.', async function () { @@ -102,8 +102,8 @@ describe('BotFrameworkAdapter Streaming tests', function () { await assert.rejects( adapter.sendActivities(new TurnContext(adapter, activity), [reply]), new Error( - 'BotFrameworkAdapter.sendActivities(): Unable to send activity as Streaming connection is closed.' - ) + 'BotFrameworkAdapter.sendActivities(): Unable to send activity as Streaming connection is closed.', + ), ); }); @@ -142,7 +142,7 @@ describe('BotFrameworkAdapter Streaming tests', function () { await adapter.useWebSocket(request, realSocket, Buffer.from([]), async (context) => { await bot.run(context); }); - expect(writeSpy.called).to.be.true; + expect(writeSpy.called).to.equal(true); }); it('returns status code 401 when request is not authorized', async function () { @@ -165,13 +165,13 @@ describe('BotFrameworkAdapter Streaming tests', function () { expect(err.message).to.equal('Unauthorized. Is not authenticated'); const socketResponse = MockNetSocket.createNonSuccessResponse( StatusCodes.UNAUTHORIZED, - err.message + err.message, ); - expect(writeSpy.called).to.be.true; - expect(writeSpy.calledWithExactly(socketResponse)).to.be.true; - expect(destroySpy.calledOnceWithExactly()).to.be.true; + expect(writeSpy.called).to.equal(true); + expect(writeSpy.calledWithExactly(socketResponse)).to.equal(true); + expect(destroySpy.calledOnceWithExactly()).to.equal(true); return true; - } + }, ); }); @@ -193,11 +193,11 @@ describe('BotFrameworkAdapter Streaming tests', function () { expect(err.message).to.equal("'authHeader' required."); expect(err.statusCode).to.equal(StatusCodes.BAD_REQUEST); const socketResponse = MockNetSocket.createNonSuccessResponse(StatusCodes.BAD_REQUEST, err.message); - expect(writeSpy.called).to.be.true; - expect(writeSpy.calledWithExactly(socketResponse)).to.be.true; - expect(destroySpy.calledOnceWithExactly()).to.be.true; + expect(writeSpy.called).to.equal(true); + expect(writeSpy.calledWithExactly(socketResponse)).to.equal(true); + expect(destroySpy.calledOnceWithExactly()).to.equal(true); return true; - } + }, ); }); @@ -211,7 +211,7 @@ describe('BotFrameworkAdapter Streaming tests', function () { await assert.rejects(adapter.useWebSocket(request, socket, Buffer.from([]), uncallableLogic), (err) => { expect(err.message).to.equal('Streaming logic needs to be provided to `useWebSocket`'); - expect(useWebSocketSpy.called).to.be.true; + expect(useWebSocketSpy.called).to.equal(true); return true; }); }); @@ -257,7 +257,7 @@ describe('BotFrameworkAdapter Streaming tests', function () { const response = await adapter.processRequest(request); expect(response.statusCode).to.equal(StatusCodes.OK); - expect(response.streams[0].content).to.not.be.undefined; + expect(response.streams[0].content).to.not.equal(undefined); }); it('returns user agent information from cache when a GET hits the version endpoint more than once', async function () { @@ -269,11 +269,11 @@ describe('BotFrameworkAdapter Streaming tests', function () { const response = await adapter.processRequest(request); expect(response.statusCode).to.equal(StatusCodes.OK); - expect(response.streams[0].content).to.not.be.undefined; + expect(response.streams[0].content).to.not.equal(undefined); const response2 = await adapter.processRequest(request); expect(response2.statusCode).to.equal(StatusCodes.OK); - expect(response2.streams[0].content).to.not.be.undefined; + expect(response2.streams[0].content).to.not.equal(undefined); }); it('should return 405 for unsupported methods to valid paths', async function () { @@ -353,7 +353,7 @@ describe('BotFrameworkAdapter Streaming tests', function () { const response = await adapter.processRequest(request); expect(response.statusCode).to.equal(StatusCodes.INTERNAL_SERVER_ERROR); - expect(middlewareCalled).to.be.true; + expect(middlewareCalled).to.equal(true); }); it('executes middleware', async function () { @@ -379,8 +379,8 @@ describe('BotFrameworkAdapter Streaming tests', function () { const response = await adapter.processRequest(request); expect(response.statusCode).to.equal(StatusCodes.NOT_IMPLEMENTED); - expect(runSpy.called).to.be.true; - expect(middlewareCalled).to.be.true; + expect(runSpy.called).to.equal(true); + expect(middlewareCalled).to.equal(true); }); }); @@ -398,7 +398,7 @@ describe('BotFrameworkAdapter Streaming tests', function () { const connection = adapter.createConnectorClient('fakeUrl'); connection.sendRequest({ method: 'POST', url: 'testResultDotCom', body: 'Test body!' }); - expect(writeSpy.called).to.be.true; + expect(writeSpy.called).to.equal(true); }).timeout(2000); describe('private methods', function () { @@ -409,7 +409,7 @@ describe('BotFrameworkAdapter Streaming tests', function () { ]; serviceUrls.forEach((serviceUrl) => { - expect(BotFrameworkAdapter.isStreamingServiceUrl(serviceUrl)).to.be.true; + expect(BotFrameworkAdapter.isStreamingServiceUrl(serviceUrl)).to.equal(true); }); }); @@ -417,7 +417,7 @@ describe('BotFrameworkAdapter Streaming tests', function () { const serviceUrls = ['http://yayay.com', 'HTTPS://yayay.com']; serviceUrls.forEach((serviceUrl) => { - expect(BotFrameworkAdapter.isStreamingServiceUrl(serviceUrl)).to.be.false; + expect(BotFrameworkAdapter.isStreamingServiceUrl(serviceUrl)).to.equal(false); }); }); }); diff --git a/libraries/botbuilder/tests/streaming/mockHttpRequest.js b/libraries/botbuilder/tests/streaming/mockHttpRequest.js index b97aad8300..c9e64f861c 100644 --- a/libraries/botbuilder/tests/streaming/mockHttpRequest.js +++ b/libraries/botbuilder/tests/streaming/mockHttpRequest.js @@ -12,7 +12,7 @@ class MockHttpRequest { 'sec-websocket-protocol': '', }, }, - options + options, ); this.method = config.method; diff --git a/libraries/botbuilder/tests/streaming/mockStreamingRequest.js b/libraries/botbuilder/tests/streaming/mockStreamingRequest.js index ac65f92c07..771532c286 100644 --- a/libraries/botbuilder/tests/streaming/mockStreamingRequest.js +++ b/libraries/botbuilder/tests/streaming/mockStreamingRequest.js @@ -7,7 +7,7 @@ class MockContentStream { { readAsJson: async () => ({ type: ActivityTypes.Invoke, serviceUrl: 'somewhere/', channelId: 'test' }), }, - options + options, ); this.readAsJson = config.readAsJson; @@ -23,7 +23,7 @@ class MockStreamingRequest { path: '/api/messages', streams: [new MockContentStream()], }, - options + options, ); this.verb = config.verb; diff --git a/libraries/botbuilder/tests/streaming/streamingHttpClient.test.js b/libraries/botbuilder/tests/streaming/streamingHttpClient.test.js index 348cacad71..e353583d1d 100644 --- a/libraries/botbuilder/tests/streaming/streamingHttpClient.test.js +++ b/libraries/botbuilder/tests/streaming/streamingHttpClient.test.js @@ -19,7 +19,7 @@ describe('StreamingHttpClient', function () { await assert.rejects( client.sendRequest(), - new Error('StreamingHttpClient.sendRequest(): missing "httpRequest" parameter') + new Error('StreamingHttpClient.sendRequest(): missing "httpRequest" parameter'), ); }); @@ -29,8 +29,8 @@ describe('StreamingHttpClient', function () { await assert.rejects( client.sendRequest({}), new Error( - 'StreamingHttpClient.sendRequest(): Streaming connection is disconnected, and the request could not be sent.' - ) + 'StreamingHttpClient.sendRequest(): Streaming connection is disconnected, and the request could not be sent.', + ), ); }); }); diff --git a/libraries/botbuilder/tests/streaming/tokenResolver.test.js b/libraries/botbuilder/tests/streaming/tokenResolver.test.js index 489cbf5b7d..6dbc32e703 100644 --- a/libraries/botbuilder/tests/streaming/tokenResolver.test.js +++ b/libraries/botbuilder/tests/streaming/tokenResolver.test.js @@ -61,7 +61,7 @@ describe('TokenResolver', function () { assert(!gotToken, 'did not receive token'); await assert.throws( () => TokenResolver.checkForOAuthCards(adapter, context, activity), - new Error("The OAuthPrompt's ConnectionName property is missing a value.", 'did not receive token') + new Error("The OAuthPrompt's ConnectionName property is missing a value.", 'did not receive token'), ); }); diff --git a/libraries/botbuilder/tests/teams/teamsSSOTokenExchangeMiddleware.test.js b/libraries/botbuilder/tests/teams/teamsSSOTokenExchangeMiddleware.test.js index 5f63d31985..31c4fe526f 100644 --- a/libraries/botbuilder/tests/teams/teamsSSOTokenExchangeMiddleware.test.js +++ b/libraries/botbuilder/tests/teams/teamsSSOTokenExchangeMiddleware.test.js @@ -102,7 +102,7 @@ describe('TeamsSSOTokenExchangeMiddleware', function () { }); const adapter = new TeamsSSOAdapter(createConversationReference(), logic).use( - new TeamsSSOTokenExchangeMiddleware(new MemoryStorage(), connectionName) + new TeamsSSOTokenExchangeMiddleware(new MemoryStorage(), connectionName), ); adapter.addExchangeableToken(connectionName, Channels.Msteams, teamsUserId, fakeExchangeableItem, token); @@ -120,7 +120,7 @@ describe('TeamsSSOTokenExchangeMiddleware', function () { }); const adapter = new TeamsSSOAdapter(createConversationReference(), logic).use( - new TeamsSSOTokenExchangeMiddleware(new MemoryStorage(), connectionName) + new TeamsSSOTokenExchangeMiddleware(new MemoryStorage(), connectionName), ); adapter.addExchangeableToken(connectionName, Channels.Msteams, teamsUserId, fakeExchangeableItem, token); @@ -148,7 +148,7 @@ describe('TeamsSSOTokenExchangeMiddleware', function () { // Note: addExchangeableToken omitted so exchange does not take place const adapter = new TeamsSSOAdapter(createConversationReference(), logic).use( - new TeamsSSOTokenExchangeMiddleware(new MemoryStorage(), connectionName) + new TeamsSSOTokenExchangeMiddleware(new MemoryStorage(), connectionName), ); await adapter @@ -177,7 +177,7 @@ describe('TeamsSSOTokenExchangeMiddleware', function () { }); const adapter = new TeamsSSOAdapter(createConversationReference(Channels.Directline), logic).use( - new TeamsSSOTokenExchangeMiddleware(new MemoryStorage(), connectionName) + new TeamsSSOTokenExchangeMiddleware(new MemoryStorage(), connectionName), ); await adapter.send('test').assertReply('processed').startTest(); diff --git a/libraries/botbuilder/tests/teamsActivityHandler.test.js b/libraries/botbuilder/tests/teamsActivityHandler.test.js index 234a2e580e..28b9eff869 100644 --- a/libraries/botbuilder/tests/teamsActivityHandler.test.js +++ b/libraries/botbuilder/tests/teamsActivityHandler.test.js @@ -676,17 +676,17 @@ describe('TeamsActivityHandler', function () { .assertReply((activity) => { assert( activity.type === 'invokeResponse', - `incorrect activity type "${activity.type}", expected "invokeResponse"` + `incorrect activity type "${activity.type}", expected "invokeResponse"`, ); assert( activity.value.status === 400, - `incorrect status code "${activity.value.status}", expected "400"` + `incorrect status code "${activity.value.status}", expected "400"`, ); assert( !activity.value.body, `expected empty body for invokeResponse from fileConsent flow.\nReceived: ${JSON.stringify( - activity.value.body - )}` + activity.value.body, + )}`, ); }) .startTest(); @@ -706,17 +706,17 @@ describe('TeamsActivityHandler', function () { .assertReply((activity) => { assert( activity.type === 'invokeResponse', - `incorrect activity type "${activity.type}", expected "invokeResponse"` + `incorrect activity type "${activity.type}", expected "invokeResponse"`, ); assert( activity.value.status === 400, - `incorrect status code "${activity.value.status}", expected "400"` + `incorrect status code "${activity.value.status}", expected "400"`, ); assert( !activity.value.body, `expected empty body for invokeResponse from fileConsent flow.\nReceived: ${JSON.stringify( - activity.value.body - )}` + activity.value.body, + )}`, ); }) .startTest(); @@ -774,17 +774,17 @@ describe('TeamsActivityHandler', function () { .assertReply((activity) => { assert( activity.type === 'invokeResponse', - `incorrect activity type "${activity.type}", expected "invokeResponse"` + `incorrect activity type "${activity.type}", expected "invokeResponse"`, ); assert( activity.value.status === 501, - `incorrect status code "${activity.value.status}", expected "501"` + `incorrect status code "${activity.value.status}", expected "501"`, ); assert( !activity.value.body, `expected empty body for invokeResponse from fileConsent flow.\nReceived: ${JSON.stringify( - activity.value.body - )}` + activity.value.body, + )}`, ); }) .startTest(); @@ -806,17 +806,17 @@ describe('TeamsActivityHandler', function () { .assertReply((activity) => { assert( activity.type === 'invokeResponse', - `incorrect activity type "${activity.type}", expected "invokeResponse"` + `incorrect activity type "${activity.type}", expected "invokeResponse"`, ); assert( activity.value.status === 501, - `incorrect status code "${activity.value.status}", expected "501"` + `incorrect status code "${activity.value.status}", expected "501"`, ); assert( !activity.value.body, `expected empty body for invokeResponse from fileConsent flow.\nReceived: ${JSON.stringify( - activity.value.body - )}` + activity.value.body, + )}`, ); }) .startTest(); @@ -838,17 +838,17 @@ describe('TeamsActivityHandler', function () { .assertReply((activity) => { assert( activity.type === 'invokeResponse', - `incorrect activity type "${activity.type}", expected "invokeResponse"` + `incorrect activity type "${activity.type}", expected "invokeResponse"`, ); assert( activity.value.status === 501, - `incorrect status code "${activity.value.status}", expected "501"` + `incorrect status code "${activity.value.status}", expected "501"`, ); assert( !activity.value.body, `expected empty body for invokeResponse from fileConsent flow.\nReceived: ${JSON.stringify( - activity.value.body - )}` + activity.value.body, + )}`, ); }) .startTest(); @@ -868,17 +868,17 @@ describe('TeamsActivityHandler', function () { .assertReply((activity) => { assert( activity.type === 'invokeResponse', - `incorrect activity type "${activity.type}", expected "invokeResponse"` + `incorrect activity type "${activity.type}", expected "invokeResponse"`, ); assert( activity.value.status === 501, - `incorrect status code "${activity.value.status}", expected "501"` + `incorrect status code "${activity.value.status}", expected "501"`, ); assert( !activity.value.body, `expected empty body for invokeResponse from fileConsent flow.\nReceived: ${JSON.stringify( - activity.value.body - )}` + activity.value.body, + )}`, ); }) .startTest(); @@ -1211,17 +1211,17 @@ describe('TeamsActivityHandler', function () { .assertReply((activity) => { assert( activity.type === 'invokeResponse', - `incorrect activity type "${activity.type}", expected "invokeResponse"` + `incorrect activity type "${activity.type}", expected "invokeResponse"`, ); assert( activity.value.status === 200, - `incorrect status code "${activity.value.status}", expected "200"` + `incorrect status code "${activity.value.status}", expected "200"`, ); assert( !activity.value.body, `expected empty body for invokeResponse from fileConsent flow.\nReceived: ${JSON.stringify( - activity.value.body - )}` + activity.value.body, + )}`, ); }) .startTest(); @@ -1240,17 +1240,17 @@ describe('TeamsActivityHandler', function () { .assertReply((activity) => { assert( activity.type === 'invokeResponse', - `incorrect activity type "${activity.type}", expected "invokeResponse"` + `incorrect activity type "${activity.type}", expected "invokeResponse"`, ); assert( activity.value.status === 200, - `incorrect status code "${activity.value.status}", expected "200"` + `incorrect status code "${activity.value.status}", expected "200"`, ); assert( !activity.value.body, `expected empty body for invokeResponse from fileConsent flow.\nReceived: ${JSON.stringify( - activity.value.body - )}` + activity.value.body, + )}`, ); }) .startTest(); @@ -1275,17 +1275,17 @@ describe('TeamsActivityHandler', function () { .assertReply((activity) => { assert( activity.type === 'invokeResponse', - `incorrect activity type "${activity.type}", expected "invokeResponse"` + `incorrect activity type "${activity.type}", expected "invokeResponse"`, ); assert( activity.value.status === 200, - `incorrect status code "${activity.value.status}", expected "200"` + `incorrect status code "${activity.value.status}", expected "200"`, ); assert( !activity.value.body, `expected empty body for invokeResponse from fileConsent flow.\nReceived: ${JSON.stringify( - activity.value.body - )}` + activity.value.body, + )}`, ); }) .startTest(); @@ -1481,7 +1481,7 @@ describe('TeamsActivityHandler', function () { assert(fileConsentCardResponse, 'fileConsentCardResponse not found'); assert( fileConsentCalled, - 'handleTeamsFileConsent handler was not called before handleTeamsFileConsentAccept handler' + 'handleTeamsFileConsent handler was not called before handleTeamsFileConsentAccept handler', ); fileConsentAcceptCalled = true; } @@ -1491,7 +1491,7 @@ describe('TeamsActivityHandler', function () { assert(fileConsentCardResponse, 'fileConsentCardResponse not found'); assert( fileConsentCalled, - 'handleTeamsFileConsent handler was not called before handleTeamsFileConsentDecline handler' + 'handleTeamsFileConsent handler was not called before handleTeamsFileConsentDecline handler', ); fileConsentDeclineCalled = true; } @@ -1521,17 +1521,17 @@ describe('TeamsActivityHandler', function () { .assertReply((activity) => { assert( activity.type === 'invokeResponse', - `incorrect activity type "${activity.type}", expected "invokeResponse"` + `incorrect activity type "${activity.type}", expected "invokeResponse"`, ); assert( activity.value.status === 200, - `incorrect status code "${activity.value.status}", expected "200"` + `incorrect status code "${activity.value.status}", expected "200"`, ); assert( !activity.value.body, `expected empty body for invokeResponse from fileConsent flow.\nReceived: ${JSON.stringify( - activity.value.body - )}` + activity.value.body, + )}`, ); }) .then(() => { @@ -1553,17 +1553,17 @@ describe('TeamsActivityHandler', function () { .assertReply((activity) => { assert( activity.type === 'invokeResponse', - `incorrect activity type "${activity.type}", expected "invokeResponse"` + `incorrect activity type "${activity.type}", expected "invokeResponse"`, ); assert( activity.value.status === 200, - `incorrect status code "${activity.value.status}", expected "200"` + `incorrect status code "${activity.value.status}", expected "200"`, ); assert( !activity.value.body, `expected empty body for invokeResponse from fileConsent flow.\nReceived: ${JSON.stringify( - activity.value.body - )}` + activity.value.body, + )}`, ); }) .then(() => { @@ -2574,7 +2574,7 @@ describe('TeamsActivityHandler', function () { .then(() => { assert( ncalls === 1, - 'On ConversationUpdate handler should only be called once, times called: ' + ncalls.toString() + 'On ConversationUpdate handler should only be called once, times called: ' + ncalls.toString(), ); }) .startTest(); diff --git a/libraries/botbuilder/tests/teamsInfo.test.js b/libraries/botbuilder/tests/teamsInfo.test.js index 718d85a8a2..de775d4c31 100644 --- a/libraries/botbuilder/tests/teamsInfo.test.js +++ b/libraries/botbuilder/tests/teamsInfo.test.js @@ -279,7 +279,7 @@ describe('TeamsInfo', function () { it('should error if context is null', async function () { await assert.rejects( TeamsInfo.sendMessageToTeamsChannel(null, teamActivity, 'teamID'), - new Error('TurnContext cannot be null') + new Error('TurnContext cannot be null'), ); }); @@ -288,7 +288,7 @@ describe('TeamsInfo', function () { await assert.rejects( TeamsInfo.sendMessageToTeamsChannel(context, null, 'teamID'), - new Error('Activity cannot be null') + new Error('Activity cannot be null'), ); }); @@ -297,7 +297,7 @@ describe('TeamsInfo', function () { await assert.rejects( TeamsInfo.sendMessageToTeamsChannel(context, teamActivity, ''), - new Error('The teamsChannelId cannot be null or empty') + new Error('The teamsChannelId cannot be null or empty'), ); }); @@ -306,7 +306,7 @@ describe('TeamsInfo', function () { await assert.rejects( TeamsInfo.sendMessageToTeamsChannel(context, teamActivity, null), - new Error('The teamsChannelId cannot be null or empty') + new Error('The teamsChannelId cannot be null or empty'), ); }); }); @@ -317,7 +317,7 @@ describe('TeamsInfo', function () { await assert.rejects( TeamsInfo.getTeamChannels(context), - new Error('This method is only valid within the scope of a MS Teams Team.') + new Error('This method is only valid within the scope of a MS Teams Team.'), ); }); @@ -326,7 +326,7 @@ describe('TeamsInfo', function () { await assert.rejects( TeamsInfo.getTeamChannels(context), - new Error('This method is only valid within the scope of a MS Teams Team.') + new Error('This method is only valid within the scope of a MS Teams Team.'), ); }); @@ -365,7 +365,7 @@ describe('TeamsInfo', function () { // There should be a channel in the conversations returned from the conversations assert( channels.find((channel) => channel.id === '19:generalChannelIdgeneralChannelId@thread.skype'), - 'did not find general channel/team id in response' + 'did not find general channel/team id in response', ); }); @@ -404,7 +404,7 @@ describe('TeamsInfo', function () { // There should be a channel in the conversations returned from the conversations assert( channels.find((channel) => channel.id === '19:ChannelIdgeneralChannelId@thread.skype'), - 'did not find general channel/team id in response' + 'did not find general channel/team id in response', ); }); }); @@ -415,7 +415,7 @@ describe('TeamsInfo', function () { await assert.rejects( TeamsInfo.getTeamDetails(context), - new Error('This method is only valid within the scope of a MS Teams Team.') + new Error('This method is only valid within the scope of a MS Teams Team.'), ); }); @@ -424,7 +424,7 @@ describe('TeamsInfo', function () { await assert.rejects( TeamsInfo.getTeamDetails(context), - new Error('This method is only valid within the scope of a MS Teams Team.') + new Error('This method is only valid within the scope of a MS Teams Team.'), ); }); @@ -474,7 +474,7 @@ describe('TeamsInfo', function () { context.turnState.set(context.adapter.ConnectorClientKey, connectorClient); const fetchedTeamDetails = await TeamsInfo.getTeamDetails( context, - '19:ChannelIdgeneralChannelId@thread.skype' + '19:ChannelIdgeneralChannelId@thread.skype', ); assert(fetchTeamDetailsExpectation.isDone()); @@ -516,7 +516,7 @@ describe('TeamsInfo', function () { assert.deepStrictEqual( fetchedMembers, - members.map((member) => ({ ...member, aadObjectId: member.objectId })) + members.map((member) => ({ ...member, aadObjectId: member.objectId })), ); }); @@ -569,7 +569,7 @@ describe('TeamsInfo', function () { assert.deepStrictEqual( fetchedMembers, - members.map((member) => ({ ...member, aadObjectId: member.objectId })) + members.map((member) => ({ ...member, aadObjectId: member.objectId })), ); }); @@ -612,7 +612,7 @@ describe('TeamsInfo', function () { assert.deepStrictEqual( fetchedMembers, - members.map((member) => ({ ...member, aadObjectId: member.objectId })) + members.map((member) => ({ ...member, aadObjectId: member.objectId })), ); }); @@ -693,7 +693,7 @@ describe('TeamsInfo', function () { await assert.rejects( TeamsInfo.getTeamMember(context), - new Error('This method is only valid within the scope of a MS Teams Team.') + new Error('This method is only valid within the scope of a MS Teams Team.'), ); }); }); @@ -836,7 +836,7 @@ describe('TeamsInfo', function () { it('should throw error for missing meetingId', async function () { await assert.rejects( TeamsInfo.getMeetingInfo({ activity: {} }), - Error('meetingId or TurnContext containing meetingId is required.') + Error('meetingId or TurnContext containing meetingId is required.'), ); }); }); @@ -847,7 +847,7 @@ describe('TeamsInfo', function () { await assert.rejects( TeamsInfo.getTeamMembers(context), - new Error('This method is only valid within the scope of a MS Teams Team.') + new Error('This method is only valid within the scope of a MS Teams Team.'), ); }); @@ -856,7 +856,7 @@ describe('TeamsInfo', function () { await assert.rejects( TeamsInfo.getTeamMembers(context), - new Error('This method is only valid within the scope of a MS Teams Team.') + new Error('This method is only valid within the scope of a MS Teams Team.'), ); }); @@ -899,7 +899,7 @@ describe('TeamsInfo', function () { assert.deepStrictEqual( fetchedMembers, - members.map((member) => ({ ...member, aadObjectId: member.objectId })) + members.map((member) => ({ ...member, aadObjectId: member.objectId })), ); }); @@ -942,7 +942,7 @@ describe('TeamsInfo', function () { assert.deepStrictEqual( fetchedMembers, - members.map((member) => ({ ...member, aadObjectId: member.objectId })) + members.map((member) => ({ ...member, aadObjectId: member.objectId })), ); }); }); @@ -1015,7 +1015,7 @@ describe('TeamsInfo', function () { const sendTeamsMeetingNotification = await TeamsInfo.sendMeetingNotification( context, notification, - meetingId + meetingId, ); assert(sendTeamsMeetingNotificationExpectation.isDone()); @@ -1054,7 +1054,7 @@ describe('TeamsInfo', function () { const sendTeamsMeetingNotification = await TeamsInfo.sendMeetingNotification( context, notification, - meetingId + meetingId, ); assert(sendTeamsMeetingNotificationExpectation.isDone()); @@ -1125,7 +1125,7 @@ describe('TeamsInfo', function () { const sendTeamsMeetingNotificationExpectation = nock('https://smba.trafficmanager.net/amer') .post( `/v1/meetings/${encodeURIComponent(teamActivity.channelData.meeting.id)}/notification`, - notification + notification, ) .matchHeader('Authorization', expectedAuthHeader) .reply(202, {}); @@ -1226,21 +1226,21 @@ describe('TeamsInfo', function () { it('should throw an error if an empty activity is provided', async function () { await assert.rejects( TeamsInfo.sendMessageToListOfUsers(context, null, tenantId, members), - Error('activity is required.') + Error('activity is required.'), ); }); it('should throw an error if an empty member list is provided', async function () { await assert.rejects( TeamsInfo.sendMessageToListOfUsers(context, activity, tenantId, null), - Error('members list is required.') + Error('members list is required.'), ); }); it('should throw an error if an empty tenant id is provided', async function () { await assert.rejects( TeamsInfo.sendMessageToListOfUsers(context, activity, null, members), - Error('tenantId is required.') + Error('tenantId is required.'), ); }); }); @@ -1319,14 +1319,14 @@ describe('TeamsInfo', function () { it('should throw an error if an empty activity is provided', async function () { await assert.rejects( TeamsInfo.sendMessageToAllUsersInTenant(context, null, tenantId), - Error('activity is required.') + Error('activity is required.'), ); }); it('should throw an error if an empty tenant id is provided', async function () { await assert.rejects( TeamsInfo.sendMessageToAllUsersInTenant(context, activity, null), - Error('tenantId is required.') + Error('tenantId is required.'), ); }); }); @@ -1407,21 +1407,21 @@ describe('TeamsInfo', function () { it('should throw an error if an empty activity is provided', async function () { await assert.rejects( TeamsInfo.sendMessageToAllUsersInTeam(context, null, tenantId, teamId), - Error('activity is required.') + Error('activity is required.'), ); }); it('should throw an error if an empty tenant id is provided', async function () { await assert.rejects( TeamsInfo.sendMessageToAllUsersInTeam(context, activity, null, teamId), - Error('tenantId is required.') + Error('tenantId is required.'), ); }); it('should throw an error if an empty team id is provided', async function () { await assert.rejects( TeamsInfo.sendMessageToAllUsersInTeam(context, activity, teamId, null), - Error('teamId is required.') + Error('teamId is required.'), ); }); }); @@ -1514,21 +1514,21 @@ describe('TeamsInfo', function () { it('should throw an error if an empty activity is provided', async function () { await assert.rejects( TeamsInfo.sendMessageToListOfChannels(context, null, tenantId, members), - Error('activity is required.') + Error('activity is required.'), ); }); it('should throw an error if an empty member list is provided', async function () { await assert.rejects( TeamsInfo.sendMessageToListOfChannels(context, activity, tenantId, null), - Error('members list is required.') + Error('members list is required.'), ); }); it('should throw an error if an empty tenant id is provided', async function () { await assert.rejects( TeamsInfo.sendMessageToListOfChannels(context, activity, null, members), - Error('tenantId is required.') + Error('tenantId is required.'), ); }); }); @@ -1716,7 +1716,7 @@ describe('TeamsInfo', function () { it("should error if the context doesn't have an adapter", function () { assert.throws( () => TeamsInfo.getConnectorClient({}), - new Error('This method requires a connector client.') + new Error('This method requires a connector client.'), ); }); @@ -1732,21 +1732,21 @@ describe('TeamsInfo', function () { it('should error if an invalid conversationId is passed in.', async function () { await assert.rejects( TeamsInfo.getMembersInternal({}, undefined), - new Error('The getMembers operation needs a valid conversationId.') + new Error('The getMembers operation needs a valid conversationId.'), ); }); it('should error if an invalid conversationId is passed in.', async function () { await assert.rejects( TeamsInfo.getMemberInternal({}, undefined), - new Error('The getMember operation needs a valid conversationId.') + new Error('The getMember operation needs a valid conversationId.'), ); }); it('should error if an invalid userId is passed in.', async function () { await assert.rejects( TeamsInfo.getMemberInternal({}, 'conversationId', undefined), - new Error('The getMember operation needs a valid userId.') + new Error('The getMember operation needs a valid userId.'), ); }); }); @@ -1764,7 +1764,7 @@ describe('TeamsInfo', function () { it('should error if an invalid conversationId is passed in.', async function () { await assert.rejects( TeamsInfo.getPagedMembersInternal({}, undefined, 'options'), - new Error('The getPagedMembers operation needs a valid conversationId.') + new Error('The getPagedMembers operation needs a valid conversationId.'), ); }); @@ -1802,7 +1802,7 @@ describe('TeamsInfo', function () { assert.strictEqual( getPagedMembers.calledOnce, true, - 'should have called conversations.getConversationPagedMembers' + 'should have called conversations.getConversationPagedMembers', ); }); }); diff --git a/package.json b/package.json index ce3dfe13d9..f06ac09713 100644 --- a/package.json +++ b/package.json @@ -82,6 +82,7 @@ "esbuild-plugin-polyfill-node": "^0.3.0", "https-browserify": "^1.0.0", "eslint": "^9.12.0", + "eslint-plugin-chai-friendly": "^1.0.1", "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.31.0", "eslint-plugin-jsdoc": "^50.3.1", From 3ab6a7bec1405503bd15cd4556424c4e448be68d Mon Sep 17 00:00:00 2001 From: JhontSouth Date: Thu, 24 Oct 2024 11:13:02 -0500 Subject: [PATCH 2/8] Merge branch 'southworks/update/eslint-packages' into southworks/fix/eslint-issues-botbuilder --- libraries/botbuilder/src/activityValidator.ts | 1 + .../botbuilder/src/botFrameworkAdapter.ts | 50 +++++++++++++ .../botbuilder/src/botFrameworkHttpClient.ts | 3 + .../botbuilder/src/channelServiceHandler.ts | 1 + .../src/channelServiceHandlerBase.ts | 27 +++++++ .../botbuilder/src/channelServiceRoutes.ts | 1 + libraries/botbuilder/src/cloudAdapter.ts | 5 ++ libraries/botbuilder/src/eventFactory.ts | 2 + .../botbuilder/src/fileTranscriptStore.ts | 12 ++++ .../botbuilder/src/inspectionMiddleware.ts | 10 +++ .../src/interfaces/connectorClientBuilder.ts | 1 + .../botbuilder/src/interfaces/webRequest.ts | 1 + .../botbuilder/src/interfaces/webResponse.ts | 3 + libraries/botbuilder/src/routeConstants.ts | 1 + .../botbuilder/src/setSpeakMiddleware.ts | 2 + .../sharepoint/sharePointActivityHandler.ts | 6 ++ .../src/skills/cloudSkillHandler.ts | 6 ++ .../botbuilder/src/skills/skillHandler.ts | 6 ++ .../botbuilder/src/skills/skillHttpClient.ts | 4 ++ libraries/botbuilder/src/statusCodeError.ts | 3 +- .../src/streaming/streamingHttpClient.ts | 2 + .../botbuilder/src/streaming/tokenResolver.ts | 1 + .../teams/teamsSSOTokenExchangeMiddleware.ts | 2 + .../botbuilder/src/teamsActivityHandler.ts | 72 +++++++++++++++++++ .../botbuilder/src/teamsActivityHelpers.ts | 7 ++ libraries/botbuilder/src/teamsInfo.ts | 19 +++++ .../tests/botFrameworkAdapter.test.js | 1 + .../tests/channelServiceHandler.test.js | 1 + .../tests/channelServiceRoutes.test.js | 2 + .../botbuilder/tests/cloudAdapter.test.js | 3 + .../tests/fileTranscriptStore.test.js | 7 ++ .../tests/inspectionMiddleware.test.js | 3 + .../tests/skills/cloudSkillHandler.test.js | 2 + .../tests/skills/skillHandler.test.js | 2 + .../teamsSSOTokenExchangeMiddleware.test.js | 1 + .../tests/teamsActivityHandler.test.js | 18 ----- libraries/botbuilder/tests/teamsInfo.test.js | 5 +- yarn.lock | 6 ++ 38 files changed, 278 insertions(+), 21 deletions(-) diff --git a/libraries/botbuilder/src/activityValidator.ts b/libraries/botbuilder/src/activityValidator.ts index d6c34f6c24..d6d6c37978 100644 --- a/libraries/botbuilder/src/activityValidator.ts +++ b/libraries/botbuilder/src/activityValidator.ts @@ -10,6 +10,7 @@ import { Activity, ActivityTimestamps } from 'botbuilder-core'; /** * Validates an [Activity](xref:botbuilder-core.Activity) and formats the timestamp fields. + * * @param activity [Activity](xref:botbuilder-core.Activity) to be validated. * @returns The [Activity](xref:botframework-schema.Activity). */ diff --git a/libraries/botbuilder/src/botFrameworkAdapter.ts b/libraries/botbuilder/src/botFrameworkAdapter.ts index 7db7a334f0..d45f309687 100644 --- a/libraries/botbuilder/src/botFrameworkAdapter.ts +++ b/libraries/botbuilder/src/botFrameworkAdapter.ts @@ -167,6 +167,7 @@ const US_GOV_OAUTH_ENDPOINT = 'https://api.botframework.azure.us'; /** * A [BotAdapter](xref:botbuilder-core.BotAdapter) that can connect a bot to a service endpoint. * Implements [IUserTokenProvider](xref:botbuilder-core.IUserTokenProvider). + * * @remarks * The bot adapter encapsulates authentication processes and sends activities to and receives * activities from the Bot Connector Service. When your bot receives an activity, the adapter @@ -227,6 +228,7 @@ export class BotFrameworkAdapter /** * Creates a new instance of the [BotFrameworkAdapter](xref:botbuilder.BotFrameworkAdapter) class. + * * @param settings Optional. The settings to use for this adapter instance. * @remarks * If the `settings` parameter does not include @@ -314,6 +316,7 @@ export class BotFrameworkAdapter /** * Used in streaming contexts to check if the streaming connection is still open for the bot to send activities. + * * @returns True if the streaming connection is open, otherwise false. */ get isStreamingConnectionOpen(): boolean { @@ -322,6 +325,7 @@ export class BotFrameworkAdapter /** * Asynchronously resumes a conversation with a user, possibly after some time has gone by. + * * @param reference A reference to the conversation to continue. * @param oAuthScope The intended recipient of any sent activities. * @param logic The asynchronous method to call after the adapter middleware runs. @@ -371,6 +375,7 @@ export class BotFrameworkAdapter /** * Asynchronously resumes a conversation with a user, possibly after some time has gone by. + * * @param reference [ConversationReference](xref:botframework-schema.ConversationReference) of the conversation to continue. * @param oAuthScope The intended recipient of any sent activities or the function to call to continue the conversation. * @param logic Optional. The asynchronous method to call after the adapter middleware runs. @@ -436,6 +441,7 @@ export class BotFrameworkAdapter /** * Asynchronously creates and starts a conversation with a user on a channel. + * * @param {Partial} reference A reference for the conversation to create. * @param {(context: TurnContext) => Promise} logic The asynchronous method to call after the adapter middleware runs. * @returns {Promise} a promise representing the asynchronous operation @@ -484,6 +490,7 @@ export class BotFrameworkAdapter /** * Asynchronously creates and starts a conversation with a user on a channel. + * * @param {Partial} reference A reference for the conversation to create. * @param {Partial} parameters Parameters used when creating the conversation * @param {(context: TurnContext) => Promise} logic The asynchronous method to call after the adapter middleware runs. @@ -572,6 +579,7 @@ export class BotFrameworkAdapter * This interface supports the framework and is not intended to be called directly for your code. * Use [TurnContext.deleteActivity](xref:botbuilder-core.TurnContext.deleteActivity) to delete * an activity from your bot code. + * * @param context The context object for the turn. * @param reference Conversation reference information for the activity to delete. * @remarks @@ -597,6 +605,7 @@ export class BotFrameworkAdapter /** * Asynchronously removes a member from the current conversation. + * * @param context The context object for the turn. * @param memberId The ID of the member to remove from the conversation. * @remarks @@ -619,6 +628,7 @@ export class BotFrameworkAdapter /** * Asynchronously lists the members of a given activity. + * * @param context The context object for the turn. * @param activityId Optional. The ID of the activity to get the members of. If not specified, the current activity ID is used. * @returns An array of [ChannelAccount](xref:botframework-schema.ChannelAccount) objects for @@ -654,6 +664,7 @@ export class BotFrameworkAdapter /** * Asynchronously lists the members of the current conversation. + * * @param context The context object for the turn. * @returns An array of [ChannelAccount](xref:botframework-schema.ChannelAccount) objects for * all users currently involved in a conversation. @@ -680,6 +691,7 @@ export class BotFrameworkAdapter /** * For the specified channel, asynchronously gets a page of the conversations in which this bot has participated. + * * @param contextOrServiceUrl The URL of the channel server to query or a * [TurnContext](xref:botbuilder-core.TurnContext) object from a conversation on the channel. * @param continuationToken Optional. The continuation token from the previous page of results. @@ -718,6 +730,7 @@ export class BotFrameworkAdapter /** * Asynchronously attempts to retrieve the token for a user that's in a login flow. + * * @param context The context object for the turn. * @param connectionName The name of the auth connection to use. * @param magicCode Optional. The validation code the user entered. @@ -733,6 +746,7 @@ export class BotFrameworkAdapter ): Promise; /** * Asynchronously attempts to retrieve the token for a user that's in a login flow. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for the turn. * @param connectionName The name of the auth connection to use. * @param magicCode Optional. The validation code the user entered. @@ -771,6 +785,7 @@ export class BotFrameworkAdapter /** * Asynchronously signs out the user from the token server. + * * @param context The context object for the turn. * @param connectionName The name of the auth connection to use. * @param userId The ID of user to sign out. @@ -785,6 +800,7 @@ export class BotFrameworkAdapter ): Promise; /** * Asynchronously signs out the user from the token server. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for the turn. * @param connectionName Optional. The name of the auth connection to use. * @param userId Optional. The ID of the user to sign out. @@ -817,6 +833,7 @@ export class BotFrameworkAdapter /** * Asynchronously gets a sign-in link from the token server that can be sent as part * of a [SigninCard](xref:botframework-schema.SigninCard). + * * @param context The context object for the turn. * @param connectionName The name of the auth connection to use. * @param oAuthAppCredentials AppCredentials for OAuth. @@ -840,6 +857,7 @@ export class BotFrameworkAdapter /** * Asynchronously gets a sign-in link from the token server that can be sent as part * of a [SigninCard](xref:botframework-schema.SigninCard). + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for the turn. * @param connectionName The name of the auth connection to use. * @param oAuthAppCredentials Optional. [AppCredentials](xref:botframework-connector.AppCredentials) for OAuth. @@ -880,6 +898,7 @@ export class BotFrameworkAdapter /** * Asynchronously retrieves the token status for each configured connection for the given user. + * * @param context The context object for the turn. * @param userId Optional. If present, the ID of the user to retrieve the token status for. * Otherwise, the ID of the user who sent the current activity is used. @@ -897,6 +916,7 @@ export class BotFrameworkAdapter ): Promise; /** * Asynchronously retrieves the token status for each configured connection for the given user. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for the turn. * @param userId Optional. If present, the ID of the user to retrieve the token status for. * Otherwise, the ID of the user who sent the current activity is used. @@ -930,6 +950,7 @@ export class BotFrameworkAdapter /** * Asynchronously signs out the user from the token server. + * * @param context The context object for the turn. * @param connectionName The name of the auth connection to use. * @param resourceUrls The list of resource URLs to retrieve tokens for. @@ -949,6 +970,7 @@ export class BotFrameworkAdapter ): Promise<{ [propertyName: string]: TokenResponse }>; /** * Asynchronously signs out the user from the token server. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for the turn. * @param connectionName The name of the auth connection to use. * @param resourceUrls The list of resource URLs to retrieve tokens for. @@ -982,6 +1004,7 @@ export class BotFrameworkAdapter /** * Asynchronously Get the raw signin resource to be sent to the user for signin. + * * @param context The context object for the turn. * @param connectionName The name of the auth connection to use. * @param userId The user id that will be associated with the token. @@ -1030,6 +1053,7 @@ export class BotFrameworkAdapter /** * Asynchronously Performs a token exchange operation such as for single sign-on. + * * @param context Context for the current turn of conversation with the user. * @param connectionName Name of the auth connection to use. * @param userId The user id that will be associated with the token. @@ -1045,6 +1069,7 @@ export class BotFrameworkAdapter ): Promise; /** * Asynchronously Performs a token exchange operation such as for single sign-on. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for the turn. * @param connectionName Name of the auth connection to use. * @param userId The user id that will be associated with the token. @@ -1090,6 +1115,7 @@ export class BotFrameworkAdapter * Asynchronously sends an emulated OAuth card for a channel. * * This method supports the framework and is not intended to be called directly for your code. + * * @param contextOrServiceUrl The URL of the emulator. * @param emulate `true` to send an emulated OAuth card to the emulator; or `false` to not send the card. * @remarks @@ -1103,6 +1129,7 @@ export class BotFrameworkAdapter /** * Asynchronously creates a turn context and runs the middleware pipeline for an incoming activity. + * * @param req An Express or Restify style request object. * @param res An Express or Restify style response object. * @param logic The function to call at the end of the middleware pipeline. @@ -1243,6 +1270,7 @@ export class BotFrameworkAdapter * Asynchronously creates a turn context and runs the middleware pipeline for an incoming activity. * * Use [CloudAdapter.processActivityDirect] instead. + * * @param activity The activity to process. * @param logic The function to call at the end of the middleware pipeline. * @remarks @@ -1291,6 +1319,7 @@ export class BotFrameworkAdapter * This method supports the framework and is not intended to be called directly for your code. * Use the turn context's [sendActivity](xref:botbuilder-core.TurnContext.sendActivity) or * [sendActivities](xref:botbuilder-core.TurnContext.sendActivities) method from your bot code. + * * @param context The context object for the turn. * @param activities The activities to send. * @returns An array of [ResourceResponse](xref:) @@ -1358,6 +1387,7 @@ export class BotFrameworkAdapter * This interface supports the framework and is not intended to be called directly for your code. * Use [TurnContext.updateActivity](xref:botbuilder-core.TurnContext.updateActivity) to update * an activity from your bot code. + * * @param context The context object for the turn. * @param activity The updated version of the activity to replace. * @returns A `Promise` representing the [ResourceResponse](xref:botframework-schema.ResourceResponse) for the operation. @@ -1381,6 +1411,7 @@ export class BotFrameworkAdapter /** * Creates a connector client. + * * @param serviceUrl The client's service URL. * @returns The [ConnectorClient](xref:botbuilder-connector.ConnectorClient) instance. * @remarks @@ -1392,6 +1423,7 @@ export class BotFrameworkAdapter /** * Create a ConnectorClient with a ClaimsIdentity. + * * @remarks * If the ClaimsIdentity contains the claims for a Skills request, create a ConnectorClient for use with Skills. * Derives the correct audience from the ClaimsIdentity, or the instance's credentials property. @@ -1401,6 +1433,7 @@ export class BotFrameworkAdapter async createConnectorClientWithIdentity(serviceUrl: string, identity: ClaimsIdentity): Promise; /** * Create a ConnectorClient with a ClaimsIdentity and an explicit audience. + * * @remarks * If the trimmed audience is not a non-zero length string, the audience will be derived from the ClaimsIdentity or * the instance's credentials property. @@ -1415,6 +1448,7 @@ export class BotFrameworkAdapter ): Promise; /** * Create a [ConnectorClient](xref:botbuilder-connector.ConnectorClient) with a [ClaimsIdentity](xref:botbuilder-connector.ClaimsIdentity). + * * @remarks * If the [ClaimsIdentity](xref:botbuilder-connector.ClaimsIdentity) contains the claims for a Skills request, create a [ConnectorClient](xref:botbuilder-connector.ConnectorClient) for use with Skills. * Derives the correct audience from the [ClaimsIdentity](xref:botbuilder-connector.ClaimsIdentity), or the instance's credentials property. @@ -1537,6 +1571,7 @@ export class BotFrameworkAdapter /** * Returns the correct [OAuthScope](xref:botframework-connector.AppCredentials.OAuthScope) for [AppCredentials](xref:botframework-connector.AppCredentials). + * * @param botAppId The bot's AppId. * @param claims The [Claim](xref:botbuilder-connector.Claim) list to check. * @returns The current credentials' OAuthScope. @@ -1596,6 +1631,7 @@ export class BotFrameworkAdapter /** * Creates an OAuth API client. + * * @param serviceUrl The client's service URL. * @param oAuthAppCredentials AppCredentials for OAuth. * @remarks @@ -1604,6 +1640,7 @@ export class BotFrameworkAdapter protected createTokenApiClient(serviceUrl: string, oAuthAppCredentials?: CoreAppCredentials): TokenApiClient; /** * Creates an OAuth API client. + * * @param serviceUrl The client's service URL. * @param oAuthAppCredentials Optional. The [AppCredentials](xref:botframework-connector.AppCredentials)for OAuth. * @remarks @@ -1619,6 +1656,7 @@ export class BotFrameworkAdapter /** * Allows for the overriding of authentication in unit tests. + * * @param request Received request. * @param authHeader Received authentication header. */ @@ -1655,6 +1693,7 @@ export class BotFrameworkAdapter /** * Generates the CallerId property for the activity based on * https://github.com/microsoft/botframework-obi/blob/main/protocols/botframework-activity/botframework-activity.md#appendix-v---caller-id-values. + * * @param identity The inbound claims. * @returns {Promise} a promise representing the generated callerId. */ @@ -1691,6 +1730,7 @@ export class BotFrameworkAdapter /** * Gets the OAuth API endpoint. + * * @param contextOrServiceUrl The URL of the channel server to query or * a [TurnContext](xref:botbuilder-core.TurnContext). For a turn context, the context's * [activity](xref:botbuilder-core.TurnContext.activity).[serviceUrl](xref:botframework-schema.Activity.serviceUrl) @@ -1713,6 +1753,7 @@ export class BotFrameworkAdapter /** * Checks the environment and can set a flag to emulate OAuth cards. + * * @param context The context object for the turn. * @remarks * Override this in a derived class to control how OAuth cards are emulated for unit testing. @@ -1725,6 +1766,7 @@ export class BotFrameworkAdapter /** * Creates a turn context. + * * @param request An incoming request body. * @returns A new [TurnContext](xref:botbuilder-core.TurnContext) instance. * @remarks @@ -1737,6 +1779,7 @@ export class BotFrameworkAdapter /** * Checks the validity of the request and attempts to map it the correct virtual endpoint, * then generates and returns a response if appropriate. + * * @param request A ReceiveRequest from the connected channel. * @returns A response created by the BotAdapter to be sent to the client that originated the request. */ @@ -1824,6 +1867,7 @@ export class BotFrameworkAdapter /** * Process a web request by applying a logic function. + * * @param req An incoming HTTP [Request](xref:botbuilder.Request) * @param res The corresponding HTTP [Response](xref:botbuilder.Response) * @param logic The logic function to apply @@ -1834,6 +1878,7 @@ export class BotFrameworkAdapter /** * Handle a web socket connection by applying a logic function to * each streaming request. + * * @param req An incoming HTTP [Request](xref:botbuilder.Request) * @param socket The corresponding [INodeSocket](xref:botframework-streaming.INodeSocket) * @param head The corresponding [INodeBuffer](xref:botframework-streaming.INodeBuffer) @@ -1870,6 +1915,7 @@ export class BotFrameworkAdapter /** * Connects the handler to a Named Pipe server and begins listening for incoming requests. + * * @param logic The logic that will handle incoming requests. * @param pipeName The name of the named pipe to use when creating the server. * @param retryCount Number of times to attempt to bind incoming and outgoing pipe @@ -1907,6 +1953,7 @@ export class BotFrameworkAdapter /** * Process the initial request to establish a long lived connection via a streaming server. + * * @param req The connection request. * @param socket The raw socket connection between the bot (server) and channel/caller (client). * @param head The first packet of the upgraded stream. @@ -1974,6 +2021,7 @@ export class BotFrameworkAdapter /** * Connects the handler to a WebSocket server and begins listening for incoming requests. + * * @param socket The socket to use when creating the server. */ private async startWebSocket(socket: ISocket): Promise { @@ -2043,6 +2091,7 @@ export class BotFrameworkAdapter * This can be determined by looking at the ServiceUrl property: * (1) All channels that send messages via http/https are not streaming * (2) Channels that send messages via streaming have a ServiceUrl that does not begin with http/https. + * * @param serviceUrl the serviceUrl provided in the resquest. * @returns True if the serviceUrl is a streaming url, otherwise false. */ @@ -2085,6 +2134,7 @@ function parseRequest(req: WebRequest): Promise { /** * Creates an error message with status code to write to socket, then closes the connection. + * * @param socket The raw socket connection between the bot (server) and channel/caller (client). * @param err The error. If the error includes a status code, it will be included in the message written to the socket. */ diff --git a/libraries/botbuilder/src/botFrameworkHttpClient.ts b/libraries/botbuilder/src/botFrameworkHttpClient.ts index 9ca4c50934..dbcf196cb3 100644 --- a/libraries/botbuilder/src/botFrameworkHttpClient.ts +++ b/libraries/botbuilder/src/botFrameworkHttpClient.ts @@ -37,6 +37,7 @@ export class BotFrameworkHttpClient implements BotFrameworkClient { /** * Creates a new instance of the [BotFrameworkHttpClient](xref:botbuilder.BotFrameworkHttpClient) class + * * @param credentialProvider An instance of [ICredentialProvider](xref:botframework-connector.ICredentialProvider). * @param channelService Optional. The channel service. */ @@ -51,6 +52,7 @@ export class BotFrameworkHttpClient implements BotFrameworkClient { /** * Forwards an activity to another bot. + * * @remarks * @template T The type of body in the InvokeResponse. * @param fromBotId The MicrosoftAppId of the bot sending the activity. @@ -147,6 +149,7 @@ export class BotFrameworkHttpClient implements BotFrameworkClient { /** * Logic to build an [AppCredentials](xref:botframework-connector.AppCredentials) to be used to acquire tokens for this `HttpClient`. + * * @param appId The application id. * @param oAuthScope Optional. The OAuth scope. * @returns The app credentials to be used to acquire tokens. diff --git a/libraries/botbuilder/src/channelServiceHandler.ts b/libraries/botbuilder/src/channelServiceHandler.ts index 0ccac805c6..d58d6bc9f4 100644 --- a/libraries/botbuilder/src/channelServiceHandler.ts +++ b/libraries/botbuilder/src/channelServiceHandler.ts @@ -22,6 +22,7 @@ import { export class ChannelServiceHandler extends ChannelServiceHandlerBase { /** * Initializes a new instance of the ChannelServiceHandler class, using a credential provider. + * * @param credentialProvider The credential provider. * @param authConfig The authentication configuration. * @param channelService A string representing the channel provider. diff --git a/libraries/botbuilder/src/channelServiceHandlerBase.ts b/libraries/botbuilder/src/channelServiceHandlerBase.ts index 8ee7a124ea..575897edd9 100644 --- a/libraries/botbuilder/src/channelServiceHandlerBase.ts +++ b/libraries/botbuilder/src/channelServiceHandlerBase.ts @@ -25,6 +25,7 @@ import { export abstract class ChannelServiceHandlerBase { /** * Sends an [Activity](xref:botframework-schema.Activity) to the end of a conversation. + * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param activity The [Activity](xref:botframework-schema.Activity) to send. @@ -41,6 +42,7 @@ export abstract class ChannelServiceHandlerBase { /** * Sends a reply to an [Activity](xref:botframework-schema.Activity). + * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param activityId The activity Id the reply is to. @@ -59,6 +61,7 @@ export abstract class ChannelServiceHandlerBase { /** * Edits a previously sent existing [Activity](xref:botframework-schema.Activity). + * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param activityId The activity Id to update. @@ -77,6 +80,7 @@ export abstract class ChannelServiceHandlerBase { /** * Deletes an existing [Activity](xref:botframework-schema.Activity). + * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param activityId The activity Id to delete. @@ -88,6 +92,7 @@ export abstract class ChannelServiceHandlerBase { /** * Enumerates the members of an [Activity](xref:botframework-schema.Activity). + * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param activityId The activity Id. @@ -104,6 +109,7 @@ export abstract class ChannelServiceHandlerBase { /** * Creates a new Conversation. + * * @param authHeader The authentication header. * @param parameters [ConversationParameters](xref:botbuilder-core.ConversationParameters) to create the conversation from. * @returns A `Promise` representation for the operation. @@ -118,6 +124,7 @@ export abstract class ChannelServiceHandlerBase { /** * Lists the Conversations in which the bot has participated. + * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param continuationToken A skip or continuation token. @@ -134,6 +141,7 @@ export abstract class ChannelServiceHandlerBase { /** * Enumerates the members of a conversation. + * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @returns The enumerated [ChannelAccount](xref:botframework-schema.ChannelAccount) list. @@ -145,6 +153,7 @@ export abstract class ChannelServiceHandlerBase { /** * Gets the account of a single conversation member. + * * @param authHeader The authentication header. * @param userId The user Id. * @param conversationId The conversation Id. @@ -161,6 +170,7 @@ export abstract class ChannelServiceHandlerBase { /** * Enumerates the members of a conversation one page at a time. + * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param pageSize Suggested page size. @@ -179,6 +189,7 @@ export abstract class ChannelServiceHandlerBase { /** * Deletes a member from a conversation. + * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param memberId Id of the member to delete from this conversation. @@ -190,6 +201,7 @@ export abstract class ChannelServiceHandlerBase { /** * Uploads the historic activities of the conversation. + * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param transcript [Transcript](xref:botframework-schema.Transcript) of activities. @@ -206,6 +218,7 @@ export abstract class ChannelServiceHandlerBase { /** * Stores data in a compliant store when dealing with enterprises. + * * @param authHeader The authentication header. * @param conversationId The conversation Id. * @param attachmentUpload [AttachmentData](xref:botframework-schema.AttachmentData). @@ -222,6 +235,7 @@ export abstract class ChannelServiceHandlerBase { /** * SendToConversation() API for Skill. + * * @remarks * This method allows you to send an activity to the end of a conversation. * This is slightly different from ReplyToActivity(). @@ -254,6 +268,7 @@ export abstract class ChannelServiceHandlerBase { /** * ReplyToActivity() API for Skill. + * * @remarks * This method allows you to reply to an activity. * @@ -289,6 +304,7 @@ export abstract class ChannelServiceHandlerBase { /** * UpdateActivity() API for Skill. + * * @remarks * Edit an existing activity. * @@ -317,6 +333,7 @@ export abstract class ChannelServiceHandlerBase { /** * DeleteActivity() API for Skill. + * * @remarks * Delete an existing activity. * @@ -341,6 +358,7 @@ export abstract class ChannelServiceHandlerBase { /** * GetActivityMembers() API for Skill. + * * @remarks * Enumerate the members of an activity. * @@ -366,6 +384,7 @@ export abstract class ChannelServiceHandlerBase { /** * CreateConversation() API for Skill. + * * @remarks * Create a new Conversation. * @@ -396,6 +415,7 @@ export abstract class ChannelServiceHandlerBase { /** * onGetConversations() API for Skill. + * * @remarks * List the Conversations in which this bot has participated. * @@ -427,6 +447,7 @@ export abstract class ChannelServiceHandlerBase { /** * getConversationMembers() API for Skill. + * * @remarks * Enumerate the members of a conversation. * @@ -449,6 +470,7 @@ export abstract class ChannelServiceHandlerBase { /** * getConversationMember() API for Skill. + * * @remarks * Get the account of a single conversation member. * @@ -473,6 +495,7 @@ export abstract class ChannelServiceHandlerBase { /** * getConversationPagedMembers() API for Skill. + * * @remarks * Enumerate the members of a conversation one page at a time. * @@ -512,6 +535,7 @@ export abstract class ChannelServiceHandlerBase { /** * DeleteConversationMember() API for Skill. + * * @remarks * Deletes a member from a conversation. * @@ -537,6 +561,7 @@ export abstract class ChannelServiceHandlerBase { /** * SendConversationHistory() API for Skill. + * * @remarks * This method allows you to upload the historic activities to the * conversation. @@ -564,6 +589,7 @@ export abstract class ChannelServiceHandlerBase { /** * UploadAttachment() API for Skill. + * * @remarks * Upload an attachment directly into a channel's blob storage. * @@ -591,6 +617,7 @@ export abstract class ChannelServiceHandlerBase { /** * Helper to authenticate the header token and extract the claims. + * * @param authHeader HTTP authorization header * @returns a promise resolving to the authorization header claims */ diff --git a/libraries/botbuilder/src/channelServiceRoutes.ts b/libraries/botbuilder/src/channelServiceRoutes.ts index 7a889e267d..63793d1f49 100644 --- a/libraries/botbuilder/src/channelServiceRoutes.ts +++ b/libraries/botbuilder/src/channelServiceRoutes.ts @@ -43,6 +43,7 @@ export class ChannelServiceRoutes { /** * Registers all Channel Service paths on the provided WebServer. + * * @param server WebServer * @param basePath Optional basePath which is appended before the service's REST API is configured on the WebServer. */ diff --git a/libraries/botbuilder/src/cloudAdapter.ts b/libraries/botbuilder/src/cloudAdapter.ts index 56f4393a66..dc589f5f0e 100644 --- a/libraries/botbuilder/src/cloudAdapter.ts +++ b/libraries/botbuilder/src/cloudAdapter.ts @@ -47,6 +47,7 @@ const ActivityT = z.custom((val) => z.record(z.unknown()).safeParse(va export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAdapter { /** * Initializes a new instance of the [CloudAdapter](xref:botbuilder:CloudAdapter) class. + * * @param botFrameworkAuthentication Optional [BotFrameworkAuthentication](xref:botframework-connector.BotFrameworkAuthentication) instance */ constructor(botFrameworkAuthentication: BotFrameworkAuthentication = BotFrameworkAuthenticationFactory.create()) { @@ -55,6 +56,7 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd /** * Process a web request by applying a logic function. + * * @param req An incoming HTTP [Request](xref:botbuilder.Request) * @param req The corresponding HTTP [Response](xref:botbuilder.Response) * @param logic The logic function to apply @@ -65,6 +67,7 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd /** * Handle a web socket connection by applying a logic function to * each streaming request. + * * @param req An incoming HTTP [Request](xref:botbuilder.Request) * @param socket The corresponding [INodeSocket](xref:botframework-streaming.INodeSocket) * @param head The corresponding [INodeBuffer](xref:botframework-streaming.INodeBuffer) @@ -162,6 +165,7 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd /** * Asynchronously process an activity running the provided logic function. + * * @param authorization The authorization header in the format: "Bearer [longString]" or the AuthenticateRequestResult for this turn. * @param activity The activity to process. * @param logic The logic function to apply. @@ -185,6 +189,7 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd /** * Used to connect the adapter to a named pipe. + * * @param pipeName Pipe name to connect to (note: yields two named pipe servers by appending ".incoming" and ".outgoing" to this name) * @param logic The logic function to call for resulting bot turns. * @param appId The Bot application ID diff --git a/libraries/botbuilder/src/eventFactory.ts b/libraries/botbuilder/src/eventFactory.ts index d9fd437b58..9e0ba5a5f7 100644 --- a/libraries/botbuilder/src/eventFactory.ts +++ b/libraries/botbuilder/src/eventFactory.ts @@ -24,6 +24,7 @@ import { HandoffEventNames } from './handoffEventNames'; export class EventFactory { /** * Create handoff initiation event. + * * @param context The context object for the turn. * @param handoffContext Agent hub-specific context. * @param transcript Transcript of the conversation. @@ -64,6 +65,7 @@ export class EventFactory { /** * Create handoff status event. + * * @param conversation Conversation being handed over. * @param state State, possible values are: "accepted", "failed", "completed". * @param message Additional message for failed handoff. diff --git a/libraries/botbuilder/src/fileTranscriptStore.ts b/libraries/botbuilder/src/fileTranscriptStore.ts index 14fb0562ae..5e481c18c9 100644 --- a/libraries/botbuilder/src/fileTranscriptStore.ts +++ b/libraries/botbuilder/src/fileTranscriptStore.ts @@ -83,6 +83,7 @@ function parseActivity(json: string): Activity { /** * The file transcript store stores transcripts in file system with each activity as a file. + * * @remarks * This class provides an interface to log all incoming and outgoing activities to the filesystem. * It implements the features necessary to work alongside the TranscriptLoggerMiddleware plugin. @@ -102,6 +103,7 @@ export class FileTranscriptStore implements TranscriptStore { /** * Creates an instance of FileTranscriptStore. + * * @param folder Root folder where transcript will be stored. */ constructor(folder: string) { @@ -114,6 +116,7 @@ export class FileTranscriptStore implements TranscriptStore { /** * Log an activity to the transcript. + * * @param activity Activity being logged. * @returns {Promise} a promise representing the asynchronous operation. */ @@ -130,6 +133,7 @@ export class FileTranscriptStore implements TranscriptStore { /** * Get all activities associated with a conversation id (aka get the transcript). + * * @param channelId Channel Id. * @param conversationId Conversation Id. * @param continuationToken (Optional) Continuation token to page through results. @@ -158,6 +162,7 @@ export class FileTranscriptStore implements TranscriptStore { return pagedResult; } + //eslint-disable-next-line security/detect-non-literal-fs-filename const transcriptFolderContents = await readdir(transcriptFolder); const include = includeWhen((fileName) => !continuationToken || parse(fileName).name === continuationToken); const items = transcriptFolderContents.filter( @@ -170,6 +175,7 @@ export class FileTranscriptStore implements TranscriptStore { .slice(0, FileTranscriptStore.PageSize) .sort() .map(async (activityFilename) => { + //eslint-disable-next-line security/detect-non-literal-fs-filename const json = await readFile(join(transcriptFolder, activityFilename), 'utf8'); return parseActivity(json); }), @@ -183,6 +189,7 @@ export class FileTranscriptStore implements TranscriptStore { /** * List all the logged conversations for a given channelId. + * * @param channelId Channel Id. * @param continuationToken (Optional) Continuation token to page through results. * @returns {Promise>} PagedResult of transcripts. @@ -199,6 +206,8 @@ export class FileTranscriptStore implements TranscriptStore { if (!exists) { return pagedResult; } + + //eslint-disable-next-line security/detect-non-literal-fs-filename const channels = await readdir(channelFolder); const items = channels.filter(includeWhen((di) => !continuationToken || di === continuationToken)); pagedResult.items = items @@ -214,6 +223,7 @@ export class FileTranscriptStore implements TranscriptStore { /** * Delete a conversation and all of it's activities. + * * @param channelId Channel Id where conversation took place. * @param conversationId Id of the conversation to delete. * @returns {Promise} A promise representing the asynchronous operation. @@ -234,6 +244,7 @@ export class FileTranscriptStore implements TranscriptStore { /** * Saves the [Activity](xref:botframework-schema.Activity) as a JSON file. + * * @param activity The [Activity](xref:botframework-schema.Activity) to transcript. * @param transcriptPath The path where the transcript will be saved. * @param activityFilename The name for the file. @@ -246,6 +257,7 @@ export class FileTranscriptStore implements TranscriptStore { if (!exists) { await mkdirp(transcriptPath); } + //eslint-disable-next-line security/detect-non-literal-fs-filename return writeFile(join(transcriptPath, activityFilename), json, 'utf8'); } diff --git a/libraries/botbuilder/src/inspectionMiddleware.ts b/libraries/botbuilder/src/inspectionMiddleware.ts index 71ba00161f..0cd579f257 100644 --- a/libraries/botbuilder/src/inspectionMiddleware.ts +++ b/libraries/botbuilder/src/inspectionMiddleware.ts @@ -83,6 +83,7 @@ class TraceActivity { abstract class InterceptionMiddleware implements Middleware { /** * Implement middleware signature + * * @param turnContext {TurnContext} An incoming TurnContext object. * @param next {function} The next delegate function. */ @@ -164,6 +165,7 @@ abstract class InterceptionMiddleware implements Middleware { /** * InspectionMiddleware for emulator inspection of runtime Activities and BotState. + * * @remarks * InspectionMiddleware for emulator inspection of runtime Activities and BotState. * @deprecated This class will be removed in a future version of the framework. @@ -179,6 +181,7 @@ export class InspectionMiddleware extends InterceptionMiddleware { /** * Create the Inspection middleware for sending trace activities out to an emulator session + * * @param inspectionState A state management object for inspection state. * @param userState A state management object for user state. * @param conversationState A state management object for conversation state. @@ -202,6 +205,7 @@ export class InspectionMiddleware extends InterceptionMiddleware { /** * Indentifies open and attach commands and calls the appropriate method. + * * @param turnContext The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @returns True if the command is open or attached, otherwise false. */ @@ -231,6 +235,7 @@ export class InspectionMiddleware extends InterceptionMiddleware { /** * Processes inbound activities. + * * @param turnContext The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param traceActivity The trace activity. * @returns {Promise} A promise representing the asynchronous operation. @@ -254,6 +259,7 @@ export class InspectionMiddleware extends InterceptionMiddleware { /** * Processes outbound activities. + * * @param turnContext The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param traceActivities A collection of trace activities. */ @@ -271,6 +277,7 @@ export class InspectionMiddleware extends InterceptionMiddleware { /** * Processes the state management object. + * * @param turnContext The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. */ protected async traceState(turnContext: TurnContext): Promise { @@ -433,6 +440,7 @@ class InspectionSessionsByStatus { /** * InspectionState for use by the InspectionMiddleware for emulator inspection of runtime Activities and BotState. + * * @remarks * InspectionState for use by the InspectionMiddleware for emulator inspection of runtime Activities and BotState. * @deprecated This class will be removed in a future version of the framework. @@ -440,6 +448,7 @@ class InspectionSessionsByStatus { export class InspectionState extends BotState { /** * Creates a new instance of the [InspectionState](xref:botbuilder.InspectionState) class. + * * @param storage The [Storage](xref:botbuilder-core.Storage) layer this state management object will use to store and retrieve state. */ constructor(storage: Storage) { @@ -450,6 +459,7 @@ export class InspectionState extends BotState { /** * Gets the key to use when reading and writing state to and from storage. + * * @param _turnContext The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @returns The storage key. */ diff --git a/libraries/botbuilder/src/interfaces/connectorClientBuilder.ts b/libraries/botbuilder/src/interfaces/connectorClientBuilder.ts index 1ebfddc7d2..f6cb3bfffb 100644 --- a/libraries/botbuilder/src/interfaces/connectorClientBuilder.ts +++ b/libraries/botbuilder/src/interfaces/connectorClientBuilder.ts @@ -14,6 +14,7 @@ import { ClaimsIdentity, ConnectorClient } from 'botframework-connector'; export interface ConnectorClientBuilder { /** * Creates the connector client asynchronous. + * * @param serviceUrl The service URL. * @param claimsIdentity The claims claimsIdentity. * @param audience The target audience for the ConnectorClient. diff --git a/libraries/botbuilder/src/interfaces/webRequest.ts b/libraries/botbuilder/src/interfaces/webRequest.ts index cbb4a5d363..4ebcabb82f 100644 --- a/libraries/botbuilder/src/interfaces/webRequest.ts +++ b/libraries/botbuilder/src/interfaces/webRequest.ts @@ -41,6 +41,7 @@ export interface WebRequest { * When implemented in a derived class, adds a listener for an event. * The framework uses this method to retrieve the request body when the * [body](xref:botbuilder.WebRequest.body) property is `null` or `undefined`. + * * @param event The event name. * @param args Arguments used to handle the event. * @returns A reference to the request object. diff --git a/libraries/botbuilder/src/interfaces/webResponse.ts b/libraries/botbuilder/src/interfaces/webResponse.ts index ed9b3aa2a3..35d0c0fe6f 100644 --- a/libraries/botbuilder/src/interfaces/webResponse.ts +++ b/libraries/botbuilder/src/interfaces/webResponse.ts @@ -20,6 +20,7 @@ export interface WebResponse { /** * When implemented in a derived class, sends a FIN packet. + * * @param args The arguments for the end event. * @returns A reference to the response object. */ @@ -27,6 +28,7 @@ export interface WebResponse { /** * When implemented in a derived class, sends the response. + * * @param body The response payload. * @returns A reference to the response object. */ @@ -34,6 +36,7 @@ export interface WebResponse { /** * When implemented in a derived class, sets the HTTP status code for the response. + * * @param status The status code to use. * @returns The status code. */ diff --git a/libraries/botbuilder/src/routeConstants.ts b/libraries/botbuilder/src/routeConstants.ts index a68b84e876..476924973e 100644 --- a/libraries/botbuilder/src/routeConstants.ts +++ b/libraries/botbuilder/src/routeConstants.ts @@ -9,6 +9,7 @@ /** * Constants representing the API path that immediately follows the basePath. * These are currently internal but we will re-evaluate making them public, in the future. + * * @example * RouteConstants.Activities = '/v3/conversations/:conversationId/activities'. */ diff --git a/libraries/botbuilder/src/setSpeakMiddleware.ts b/libraries/botbuilder/src/setSpeakMiddleware.ts index 6f6e30f0f2..89276c7eca 100644 --- a/libraries/botbuilder/src/setSpeakMiddleware.ts +++ b/libraries/botbuilder/src/setSpeakMiddleware.ts @@ -38,6 +38,7 @@ function hasTag(tag: string, nodes: unknown[]): boolean { export class SetSpeakMiddleware implements Middleware { /** * Initializes a new instance of the SetSpeakMiddleware class. + * * @param voiceName The SSML voice name attribute value. * @param fallbackToTextForSpeak true if an empty Activity.Speak is populated with Activity.Text. */ @@ -48,6 +49,7 @@ export class SetSpeakMiddleware implements Middleware { /** * Processes an incoming activity. + * * @param turnContext The context object for this turn. * @param next The delegate to call to continue the bot middleware pipeline. * @returns A promise representing the async operation. diff --git a/libraries/botbuilder/src/sharepoint/sharePointActivityHandler.ts b/libraries/botbuilder/src/sharepoint/sharePointActivityHandler.ts index 1f92d286bc..821251e3f8 100644 --- a/libraries/botbuilder/src/sharepoint/sharePointActivityHandler.ts +++ b/libraries/botbuilder/src/sharepoint/sharePointActivityHandler.ts @@ -27,6 +27,7 @@ export class SharePointActivityHandler extends ActivityHandler { * Invoked when an invoke activity is received from the connector. * Invoke activities can be used to communicate many different things. * Invoke activities communicate programmatic commands from a client or channel to a bot. + * * @param context A strongly-typed context object for this turn * @returns A task that represents the work queued to execute */ @@ -81,6 +82,7 @@ export class SharePointActivityHandler extends ActivityHandler { /** * Override this in a derived class to provide logic for when a card view is fetched + * * @param _context - A strongly-typed context object for this turn * @param _aceRequest - The Ace invoke request value payload * @returns A Card View Response for the request @@ -94,6 +96,7 @@ export class SharePointActivityHandler extends ActivityHandler { /** * Override this in a derived class to provide logic for when a quick view is fetched + * * @param _context - A strongly-typed context object for this turn * @param _aceRequest - The Ace invoke request value payload * @returns A Quick View Response for the request @@ -107,6 +110,7 @@ export class SharePointActivityHandler extends ActivityHandler { /** * Override this in a derived class to provide logic for getting configuration pane properties. + * * @param _context - A strongly-typed context object for this turn * @param _aceRequest - The Ace invoke request value payload * @returns A Property Pane Configuration Response for the request @@ -120,6 +124,7 @@ export class SharePointActivityHandler extends ActivityHandler { /** * Override this in a derived class to provide logic for setting configuration pane properties. + * * @param _context - A strongly-typed context object for this turn * @param _aceRequest - The Ace invoke request value payload * @returns A Card view or no-op action response @@ -133,6 +138,7 @@ export class SharePointActivityHandler extends ActivityHandler { /** * Override this in a derived class to provide logic for setting configuration pane properties. + * * @param _context - A strongly-typed context object for this turn * @param _aceRequest - The Ace invoke request value payload * @returns A handle action response diff --git a/libraries/botbuilder/src/skills/cloudSkillHandler.ts b/libraries/botbuilder/src/skills/cloudSkillHandler.ts index b53f94b29e..7e0302b27e 100644 --- a/libraries/botbuilder/src/skills/cloudSkillHandler.ts +++ b/libraries/botbuilder/src/skills/cloudSkillHandler.ts @@ -29,6 +29,7 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { /** * Initializes a new instance of the CloudSkillHandler class. + * * @param adapter An instance of the BotAdapter that will handle the request. * @param logic The Bot logic function * @param conversationIdFactory A SkillConversationIdFactoryBase to unpack the conversation ID and map it to the calling bot. @@ -65,6 +66,7 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { /** * sendToConversation() API for Skill. + * * @remarks * This method allows you to send an activity to the end of a conversation. * @@ -93,6 +95,7 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { /** * replyToActivity() API for Skill. + * * @remarks * This method allows you to reply to an activity. * @@ -124,6 +127,7 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { /** * *UpdateActivity() API for Skill. + * * @remarks * Edit an existing activity. * @@ -148,6 +152,7 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { /** * DeleteActivity() API for Skill. + * * @remarks * Delete an existing activity. * @@ -168,6 +173,7 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { /** * getConversationMember() API for Skill. + * * @remarks * Get the account of a single conversation member. * diff --git a/libraries/botbuilder/src/skills/skillHandler.ts b/libraries/botbuilder/src/skills/skillHandler.ts index 17a6cf56cc..574f31d1f9 100644 --- a/libraries/botbuilder/src/skills/skillHandler.ts +++ b/libraries/botbuilder/src/skills/skillHandler.ts @@ -29,6 +29,7 @@ import { export class SkillHandler extends ChannelServiceHandler { /** * Used to access the CovnersationReference sent from the Skill to the Parent. + * * @remarks * The value is the same as the SkillConversationReferenceKey exported from botbuilder-core. */ @@ -39,6 +40,7 @@ export class SkillHandler extends ChannelServiceHandler { /** * Initializes a new instance of the SkillHandler class. + * * @param adapter An instance of the BotAdapter that will handle the request. * @param bot The ActivityHandlerBase instance. * @param conversationIdFactory A SkillConversationIdFactoryBase to unpack the conversation ID and map it to the calling bot. @@ -82,6 +84,7 @@ export class SkillHandler extends ChannelServiceHandler { /** * sendToConversation() API for Skill. + * * @remarks * This method allows you to send an activity to the end of a conversation. * @@ -110,6 +113,7 @@ export class SkillHandler extends ChannelServiceHandler { /** * replyToActivity() API for Skill. + * * @remarks * This method allows you to reply to an activity. * @@ -141,6 +145,7 @@ export class SkillHandler extends ChannelServiceHandler { /** * *UpdateActivity() API for Skill. + * * @remarks * Edit an existing activity. * @@ -165,6 +170,7 @@ export class SkillHandler extends ChannelServiceHandler { /** * DeleteActivity() API for Skill. + * * @remarks * Delete an existing activity. * diff --git a/libraries/botbuilder/src/skills/skillHttpClient.ts b/libraries/botbuilder/src/skills/skillHttpClient.ts index 22ad0aab6d..fb145bb2de 100644 --- a/libraries/botbuilder/src/skills/skillHttpClient.ts +++ b/libraries/botbuilder/src/skills/skillHttpClient.ts @@ -30,6 +30,7 @@ export class SkillHttpClient extends BotFrameworkHttpClient { /** * Creates a new instance of the [SkillHttpClient](xref:botbuilder-core.SkillHttpClient) class. + * * @param credentialProvider An instance of [ICredentialProvider](xref:botframework-connector.ICredentialProvider). * @param conversationIdFactory An instance of a class derived from [SkillConversationIdFactoryBase](xref:botbuilder-core.SkillConversationIdFactoryBase). * @param channelService Optional. The channel service. @@ -49,6 +50,7 @@ export class SkillHttpClient extends BotFrameworkHttpClient { /** * Uses the SkillConversationIdFactory to create or retrieve a Skill Conversation Id, and sends the activity. + * * @template T The type of body in the InvokeResponse. * @param originatingAudience The OAuth audience scope, used during token retrieval. (Either https://api.botframework.com or bot app id.) * @param fromBotId The MicrosoftAppId of the bot sending the activity. @@ -65,6 +67,7 @@ export class SkillHttpClient extends BotFrameworkHttpClient { ): Promise>; /** * Uses the SkillConversationIdFactory to create or retrieve a Skill Conversation Id, and sends the activity. + * * @deprecated This overload is deprecated. Please use SkillHttpClient.postToSkill() that takes an `originatingAudience`. * @param fromBotId The MicrosoftAppId of the bot sending the activity. * @param toSkill The skill to create the Conversation Id for. @@ -79,6 +82,7 @@ export class SkillHttpClient extends BotFrameworkHttpClient { ): Promise; /** * Uses the `SkillConversationIdFactory` to create or retrieve a Skill Conversation Id, and sends the [Activity](xref:botframework-schema.Activity). + * * @param audienceOrFromBotId The OAuth audience scope, used during token retrieval or the AppId of the bot sending the [Activity](xref:botframework-schema.Activity). * @param fromBotIdOrSkill The AppId of the bot sending the [Activity](xref:botframework-schema.Activity) or the skill to create the Conversation Id for. * @param toSkillOrCallbackUrl The skill to create the Conversation Id for or the callback Url for the skill host. diff --git a/libraries/botbuilder/src/statusCodeError.ts b/libraries/botbuilder/src/statusCodeError.ts index 0f07b87d8e..18d5bc00eb 100644 --- a/libraries/botbuilder/src/statusCodeError.ts +++ b/libraries/botbuilder/src/statusCodeError.ts @@ -14,11 +14,12 @@ import { StatusCodes } from 'botbuilder-core'; export class StatusCodeError extends Error { /** * Creates a new instance of the [StatusCodeError](xref:botbuilder.StatusCodeError) class. + * * @param statusCode The status code. * @param message Optional. The error message. */ constructor( - public readonly statusCode: StatusCodes, + readonly statusCode: StatusCodes, message?: string, ) { super(message); diff --git a/libraries/botbuilder/src/streaming/streamingHttpClient.ts b/libraries/botbuilder/src/streaming/streamingHttpClient.ts index 07aecf08c5..bfe8d35bf7 100644 --- a/libraries/botbuilder/src/streaming/streamingHttpClient.ts +++ b/libraries/botbuilder/src/streaming/streamingHttpClient.ts @@ -17,6 +17,7 @@ export class StreamingHttpClient implements HttpClient { /** * Creates a new streaming Http client. + * * @param server Transport server implementation to be used. */ constructor(server: IStreamingTransportServer) { @@ -30,6 +31,7 @@ export class StreamingHttpClient implements HttpClient { * This function hides the default sendRequest of the HttpClient, replacing it * with a version that takes the WebResource created by the BotFrameworkAdapter * and converting it to a form that can be sent over a streaming transport. + * * @param httpRequest The outgoing request created by the BotframeworkAdapter. * @returns The streaming transport compatible response to send back to the client. */ diff --git a/libraries/botbuilder/src/streaming/tokenResolver.ts b/libraries/botbuilder/src/streaming/tokenResolver.ts index 7fc1e77cfe..9c0b1089f6 100644 --- a/libraries/botbuilder/src/streaming/tokenResolver.ts +++ b/libraries/botbuilder/src/streaming/tokenResolver.ts @@ -31,6 +31,7 @@ export class TokenResolver { /** * Checks if we have token responses from OAuth cards. + * * @param adapter The [BotFrameworkAdapter](xref:botbuilder.BotFrameworkAdapter). * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param activity The [Activity](xref:botframework-schema.Activity) to be checked. diff --git a/libraries/botbuilder/src/teams/teamsSSOTokenExchangeMiddleware.ts b/libraries/botbuilder/src/teams/teamsSSOTokenExchangeMiddleware.ts index 9a5247e1ef..284baf5f06 100644 --- a/libraries/botbuilder/src/teams/teamsSSOTokenExchangeMiddleware.ts +++ b/libraries/botbuilder/src/teams/teamsSSOTokenExchangeMiddleware.ts @@ -71,6 +71,7 @@ const ExchangeToken = z.custom> export class TeamsSSOTokenExchangeMiddleware implements Middleware { /** * Initializes a new instance of the TeamsSSOTokenExchangeMiddleware class. + * * @param storage The [Storage](xref:botbuilder-core.Storage) to use for deduplication * @param oAuthConnectionName The connection name to use for the single sign on token exchange */ @@ -89,6 +90,7 @@ export class TeamsSSOTokenExchangeMiddleware implements Middleware { /** * Called each time the bot receives a new request. + * * @param context Context for current turn of conversation with the user. * @param next Function to call to continue execution to the next step in the middleware chain. */ diff --git a/libraries/botbuilder/src/teamsActivityHandler.ts b/libraries/botbuilder/src/teamsActivityHandler.ts index 40e07e9ab2..38d55d6a8b 100644 --- a/libraries/botbuilder/src/teamsActivityHandler.ts +++ b/libraries/botbuilder/src/teamsActivityHandler.ts @@ -61,6 +61,7 @@ const TeamsMeetingEndT = z /** * Adds support for Microsoft Teams specific events and interactions. + * * @remarks * Developers may handle Message Update, Message Delete, and Conversation Update activities sent from Microsoft Teams via two methods: * 1. Overriding methods starting with `on..` and *not* ending in `..Event()` (e.g. `onTeamsMembersAdded()`), or instead @@ -76,6 +77,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Invoked when an invoke activity is received from the connector. * Invoke activities can be used to communicate many different things. + * * @param context A context object for this turn. * @returns An Invoke Response for the activity. */ @@ -193,6 +195,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Handles a Teams Card Action Invoke activity. + * * @param _context A context object for this turn. * @returns An Invoke Response for the activity. */ @@ -202,6 +205,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Handles a config/fetch invoke activity. + * * @param _context A context object for this turn. * @param _configData The object representing the configuration. * @returns A Config Response for the activity. @@ -212,6 +216,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Handles a config/submit invoke activity. + * * @param _context A context object for this turn. * @param _configData The object representing the configuration. * @returns A Config Response for the activity. @@ -225,6 +230,7 @@ export class TeamsActivityHandler extends ActivityHandler { * `handleTeamsFileConsentAccept` and `handleTeamsFileConsentDecline`. * Developers are not passed a pointer to the next `handleTeamsFileConsent` handler because the _wrapper_ around * the handler will call `onDialogs` handlers after delegating to `handleTeamsFileConsentAccept` or `handleTeamsFileConsentDecline`. + * * @param context A context object for this turn. * @param fileConsentCardResponse Represents the value of the invoke activity sent when the user acts on a file consent card. * @returns A promise that represents the work queued. @@ -245,6 +251,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'fileConsent/invoke' with confirmation from user + * * @remarks * This type of invoke activity occur during the File Consent flow. * @param _context A context object for this turn. @@ -260,6 +267,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'fileConsent/invoke' with decline from user + * * @remarks * This type of invoke activity occur during the File Consent flow. * @param _context A context object for this turn. @@ -275,6 +283,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'actionableMessage/executeAction'. + * * @param _context A context object for this turn. * @param _query The O365 connector card HttpPOST invoke query. * @returns A promise that represents the work queued. @@ -288,6 +297,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Invoked when a signIn invoke activity is received from the connector. + * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -302,6 +312,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'signin/verifyState'. + * * @param _context A context object for this turn. * @param _query Signin state (part of signin action auth flow) verification invoke query. * @returns A promise that represents the work queued. @@ -315,6 +326,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'signin/tokenExchange' + * * @param _context A context object for this turn. * @param _query Signin state (part of signin action auth flow) verification invoke query * @returns A promise that represents the work queued. @@ -328,6 +340,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'composeExtension/onCardButtonClicked' + * * @param _context A context object for this turn. * @param _cardData Object representing the card data. * @returns A promise that represents the work queued. @@ -341,6 +354,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'task/fetch' + * * @param _context A context object for this turn. * @param _taskModuleRequest The task module invoke request value payload. * @returns A Task Module Response for the request. @@ -354,6 +368,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'task/submit' + * * @param _context A context object for this turn. * @param _taskModuleRequest The task module invoke request value payload. * @returns A Task Module Response for the request. @@ -367,6 +382,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'tab/fetch' + * * @param _context A context object for this turn. * @param _tabRequest The tab invoke request value payload. * @returns A Tab Response for the request. @@ -377,6 +393,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'tab/submit' + * * @param _context A context object for this turn. * @param _tabSubmit The tab submit invoke request value payload. * @returns A Tab Response for the request. @@ -387,6 +404,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'composeExtension/queryLink' + * * @remarks * Used in creating a Search-based Message Extension. * @param _context A context object for this turn. @@ -402,6 +420,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with Activity name of 'composeExtension/anonymousQueryLink' + * * @remarks * Used in creating a Search-based Message Extension. * @param _context A context object for this turn. @@ -417,6 +436,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with the name 'composeExtension/query'. + * * @remarks * Used in creating a Search-based Message Extension. * @param _context A context object for this turn. @@ -432,6 +452,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with the name 'composeExtension/selectItem'. + * * @remarks * Used in creating a Search-based Message Extension. * @param _context A context object for this turn. @@ -447,6 +468,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with the name 'composeExtension/submitAction' and dispatches to botMessagePreview-flows as applicable. + * * @remarks * A handler registered through this method does not dispatch to the next handler (either `handleTeamsMessagingExtensionSubmitAction`, `handleTeamsMessagingExtensionBotMessagePreviewEdit`, or `handleTeamsMessagingExtensionBotMessagePreviewSend`). * This method exists for developers to optionally add more logic before the TeamsActivityHandler routes the activity to one of the @@ -475,6 +497,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with the name 'composeExtension/submitAction'. + * * @param _context A context object for this turn. * @param _action The messaging extension action. * @returns The Messaging Extension Action Response for the action. @@ -489,6 +512,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with the name 'composeExtension/submitAction' with the 'botMessagePreview' property present on activity.value. * The value for 'botMessagePreview' is 'edit'. + * * @param _context A context object for this turn. * @param _action The messaging extension action. * @returns The Messaging Extension Action Response for the action. @@ -503,6 +527,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with the name 'composeExtension/submitAction' with the 'botMessagePreview' property present on activity.value. * The value for 'botMessagePreview' is 'send'. + * * @param _context A context object for this turn. * @param _action The messaging extension action. * @returns The Messaging Extension Action Response for the action. @@ -516,6 +541,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with the name 'composeExtension/fetchTask' + * * @param _context A context object for this turn. * @param _action The messaging extension action. * @returns The Messaging Extension Action Response for the action. @@ -529,6 +555,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with the name 'composeExtension/querySettingUrl' + * * @param _context A context object for this turn. * @param _query The Messaging extension query. * @returns The Messaging Extension Action Response for the query. @@ -542,6 +569,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Receives invoke activities with the name 'composeExtension/setting' + * * @param _context A context object for this turn. * @param _settings Object representing the configuration settings. */ @@ -551,6 +579,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Override this method to change the dispatching of ConversationUpdate activities. + * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -611,6 +640,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Override this method to change the dispatching of MessageUpdate activities. + * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -635,6 +665,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Override this method to change the dispatching of MessageDelete activities. + * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -658,6 +689,7 @@ export class TeamsActivityHandler extends ActivityHandler { * Called in `dispatchMessageUpdateActivity()` to trigger the `'TeamsMessageUndelete'` handlers. * Override this in a derived class to provide logic for when a deleted message in a conversation is undeleted. * For example, when the user decides to "undo" a deleted message. + * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -668,6 +700,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Called in `dispatchMessageUpdateActivity()` to trigger the `'TeamsMessageEdit'` handlers. * Override this in a derived class to provide logic for when a message in a conversation is edited. + * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -679,6 +712,7 @@ export class TeamsActivityHandler extends ActivityHandler { * Called in `dispatchMessageDeleteActivity()` to trigger the `'TeamsMessageEdit'` handlers. * Override this in a derived class to provide logic for when a message in a conversation is soft deleted. * This means that the message as the option of being undeleted. + * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -690,6 +724,7 @@ export class TeamsActivityHandler extends ActivityHandler { * Called in `dispatchConversationUpdateActivity()` to trigger the `'TeamsMembersAdded'` handlers. * Override this in a derived class to provide logic for when members other than the bot * join the channel, such as your bot's welcome logic. + * * @remarks * If no handlers are registered for the `'TeamsMembersAdded'` event, the `'MembersAdded'` handlers will run instead. * @param context A context object for this turn. @@ -745,6 +780,7 @@ export class TeamsActivityHandler extends ActivityHandler { * Called in `dispatchConversationUpdateActivity()` to trigger the `'TeamsMembersRemoved'` handlers. * Override this in a derived class to provide logic for when members other than the bot * leave the channel, such as your bot's good-bye logic. + * * @remarks * If no handlers are registered for the `'TeamsMembersRemoved'` event, the `'MembersRemoved'` handlers will run instead. * @param context A context object for this turn. @@ -762,6 +798,7 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Channel Created event activity is received from the connector. * Channel Created corresponds to the user creating a new channel. * Override this in a derived class to provide logic for when a channel is created. + * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -773,6 +810,7 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Channel Deleted event activity is received from the connector. * Channel Deleted corresponds to the user deleting a channel. * Override this in a derived class to provide logic for when a channel is deleted. + * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -784,6 +822,7 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Channel Renamed event activity is received from the connector. * Channel Renamed corresponds to the user renaming a new channel. * Override this in a derived class to provide logic for when a channel is renamed. + * * @param context A context object for this turn. * @returns A promise that represents the work queued. */ @@ -795,6 +834,7 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Team Archived event activity is received from the connector. * Team Archived corresponds to the user archiving a team. * Override this in a derived class to provide logic for when a team is archived. + * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -806,6 +846,7 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Team Deleted event activity is received from the connector. * Team Deleted corresponds to the user deleting a team. * Override this in a derived class to provide logic for when a team is deleted. + * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -817,6 +858,7 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Team Hard Deleted event activity is received from the connector. * Team Hard Deleted corresponds to the user hard-deleting a team. * Override this in a derived class to provide logic for when a team is hard-deleted. + * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -829,6 +871,7 @@ export class TeamsActivityHandler extends ActivityHandler { *Invoked when a Channel Restored event activity is received from the connector. *Channel Restored corresponds to the user restoring a previously deleted channel. *Override this in a derived class to provide logic for when a channel is restored. + * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -840,6 +883,7 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Team Renamed event activity is received from the connector. * Team Renamed corresponds to the user renaming a team. * Override this in a derived class to provide logic for when a team is renamed. + * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -851,6 +895,7 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Team Restored event activity is received from the connector. * Team Restored corresponds to the user restoring a team. * Override this in a derived class to provide logic for when a team is restored. + * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -862,6 +907,7 @@ export class TeamsActivityHandler extends ActivityHandler { * Invoked when a Team Unarchived event activity is received from the connector. * Team Unarchived corresponds to the user unarchiving a team. * Override this in a derived class to provide logic for when a team is unarchived. + * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -872,6 +918,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsMessageUndelete events, such as for when a message in a conversation that is * observed by the bot goes from a soft delete state to the normal state. + * * @param handler A callback to handle the teams undelete message event. * @returns A promise that represents the work queued. */ @@ -884,6 +931,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsMessageEdit events, such as for when a message in a conversation that is * observed by the bot is edited. + * * @param handler A callback to handle the teams edit message event. * @returns A promise that represents the work queued. */ @@ -897,6 +945,7 @@ export class TeamsActivityHandler extends ActivityHandler { * Registers a handler for TeamsMessageSoftDelete events, such as for when a message in a conversation that is * observed by the bot is soft deleted. This means that the deleted message, up to a certain time period, * can be undoed. + * * @param handler A callback to handle the teams edit message event. * @returns A promise that represents the work queued. */ @@ -909,6 +958,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsMembersAdded events, such as for when members other than the bot * join the channel, such as your bot's welcome logic. + * * @param handler A callback to handle the teams members added event. * @returns A promise that represents the work queued. */ @@ -929,6 +979,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsMembersRemoved events, such as for when members other than the bot * leave the channel, such as your bot's good-bye logic. + * * @param handler A callback to handle the teams members removed event. * @returns A promise that represents the work queued. */ @@ -948,6 +999,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsChannelCreated events, such as for when a channel is created. + * * @param handler A callback to handle the teams channel created event. * @returns A promise that represents the work queued. */ @@ -967,6 +1019,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsChannelDeleted events, such as for when a channel is deleted. + * * @param handler A callback to handle the teams channel deleted event. * @returns A promise that represents the work queued. */ @@ -986,6 +1039,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsChannelRenamed events, such as for when a channel is renamed. + * * @param handler A callback to handle the teams channel renamed event. * @returns A promise that represents the work queued. */ @@ -1005,6 +1059,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsTeamArchived events, such as for when a team is archived. + * * @param handler A callback to handle the teams team archived event. * @returns A promise that represents the work queued. */ @@ -1019,6 +1074,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsTeamDeleted events, such as for when a team is deleted. + * * @param handler A callback to handle the teams team deleted event. * @returns A promise that represents the work queued. */ @@ -1033,6 +1089,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsTeamHardDeleted events, such as for when a team is hard-deleted. + * * @param handler A callback to handle the teams team hard deleted event. * @returns A promise that represents the work queued. */ @@ -1047,6 +1104,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsChannelRestored events, such as for when a channel is restored. + * * @param handler A callback to handle the teams channel restored event. * @returns A promise that represents the work queued. */ @@ -1066,6 +1124,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsTeamRenamed events, such as for when a team is renamed. + * * @param handler A callback to handle the teams team renamed event. * @returns A promise that represents the work queued. */ @@ -1080,6 +1139,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsTeamRestored events, such as for when a team is restored. + * * @param handler A callback to handle the teams team restored event. * @returns A promise that represents the work queued. */ @@ -1094,6 +1154,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for TeamsTeamUnarchived events, such as for when a team is unarchived. + * * @param handler A callback to handle the teams team unarchived event. * @returns A promise that represents the work queued. */ @@ -1108,6 +1169,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Runs the _event_ sub-type handlers, as appropriate, and then continues the event emission process. + * * @param context The context object for the current turn. * @returns A promise that represents the work queued. * @remarks @@ -1136,6 +1198,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Invoked when a Meeting Started event activity is received from the connector. * Override this in a derived class to provide logic for when a meeting is started. + * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -1146,6 +1209,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Invoked when a Meeting End event activity is received from the connector. * Override this in a derived class to provide logic for when a meeting is ended. + * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -1156,6 +1220,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Invoked when a read receipt for a previously sent message is received from the connector. * Override this in a derived class to provide logic for when the bot receives a read receipt event. + * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -1166,6 +1231,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Invoked when a Meeting Participant Join event activity is received from the connector. * Override this in a derived class to provide logic for when a meeting participant is joined. + * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -1176,6 +1242,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Invoked when a Meeting Participant Leave event activity is received from the connector. * Override this in a derived class to provide logic for when a meeting participant is left. + * * @param context The context for this turn. * @returns A promise that represents the work queued. */ @@ -1185,6 +1252,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for when a Teams meeting starts. + * * @param handler A callback that handles Meeting Start events. * @returns A promise that represents the work queued. */ @@ -1209,6 +1277,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for when a Teams meeting ends. + * * @param handler A callback that handles Meeting End events. * @returns A promise that represents the work queued. */ @@ -1233,6 +1302,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for when a Read Receipt is sent. + * * @param handler A callback that handles Read Receipt events. * @returns A promise that represents the work queued. */ @@ -1247,6 +1317,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for when a Teams meeting participant join. + * * @param handler A callback that handles Meeting Participant Join events. * @returns A promise that represents the work queued. */ @@ -1271,6 +1342,7 @@ export class TeamsActivityHandler extends ActivityHandler { /** * Registers a handler for when a Teams meeting participant leave. + * * @param handler A callback that handles Meeting Participant Leave events. * @returns A promise that represents the work queued. */ diff --git a/libraries/botbuilder/src/teamsActivityHelpers.ts b/libraries/botbuilder/src/teamsActivityHelpers.ts index 5160855df5..9004f6be8b 100644 --- a/libraries/botbuilder/src/teamsActivityHelpers.ts +++ b/libraries/botbuilder/src/teamsActivityHelpers.ts @@ -20,6 +20,7 @@ function validateActivity(activity: Partial): void { /** * Gets the Team's selected channel id from the current activity. + * * @param activity The current [Activity](xref:botframework-schema.Activity). * @returns The current activity's team's selected channel, or empty string. */ @@ -31,6 +32,7 @@ export function teamsGetSelectedChannelId(activity: Activity): string { /** * Gets the TeamsMeetingInfo object from the current [Activity](xref:botframework-schema.Activity). + * * @param activity The current [Activity](xref:botframework-schema.Activity). * @returns The current [Activity](xref:botframework-schema.Activity)'s team meeting info, or null. */ @@ -46,6 +48,7 @@ export function teamsGetTeamMeetingInfo(activity: Activity): TeamsMeetingInfo | /** * Gets the TenantInfo object from the current [Activity](xref:botframework-schema.Activity). + * * @param activity The current [Activity](xref:botframework-schema.Activity). * @returns The current [Activity](xref:botframework-schema.Activity)'s tenant info, or null. */ @@ -61,6 +64,7 @@ export function teamsGetTenant(activity: Activity): TenantInfo | null { /** * Gets the TeamsInfo object from the current [Activity](xref:botframework-schema.Activity). + * * @param activity The current [Activity](xref:botframework-schema.Activity). * @returns The current [Activity](xref:botframework-schema.Activity)'s team's info, or null. */ @@ -78,6 +82,7 @@ export function teamsGetTeamInfo(activity: Activity): TeamInfo | null { /** * Gets the Team Id from the current [Activity](xref:botframework-schema.Activity). + * * @param activity The current [Activity](xref:botframework-schema.Activity). * @returns The current [Activity](xref:botframework-schema.Activity)'s team's Id, or null. */ @@ -88,6 +93,7 @@ export function teamsGetTeamId(activity: Activity): string | null { /** * Activity helper methods for Teams. + * * @param activity The current [Activity](xref:botframework-schema.Activity). * @returns The current [Activity](xref:botframework-schema.Activity)'s team's channel id, or null. */ @@ -105,6 +111,7 @@ export function teamsGetChannelId(activity: Activity): string | null { /** * Configures the current [Activity](xref:botframework-schema.Activity) to generate a notification within Teams. + * * @param activity The current [Activity](xref:botframework-schema.Activity). * @param alertInMeeting Sent to a meeting chat, this will cause the Teams client to render it in a notification popup as well as in the chat thread. * @param externalResourceUrl Url to external resource. Must be included in manifest's valid domains. diff --git a/libraries/botbuilder/src/teamsInfo.ts b/libraries/botbuilder/src/teamsInfo.ts index b5b0dbed49..11a4ebdbd5 100644 --- a/libraries/botbuilder/src/teamsInfo.ts +++ b/libraries/botbuilder/src/teamsInfo.ts @@ -47,6 +47,7 @@ export class TeamsInfo { /** * Gets the meeting participant for the given meeting id and participant id. This only works in * teams scoped meeting conversations. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param meetingId The meeting ID to fetch * @param participantId The participant ID to fetch @@ -97,6 +98,7 @@ export class TeamsInfo { /** * Gets the information for the given meeting id. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param meetingId The BASE64-encoded id of the Teams meeting. * @returns The [MeetingInfo](xref:botframework-schema.MeetingInfo) fetched @@ -122,6 +124,7 @@ export class TeamsInfo { /** * Gets the details for the given team id. This only works in teams scoped conversations. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param teamId The id of the Teams team. * @returns The [TeamDetails](xref:botbuilder-core.TeamDetails) fetched @@ -137,6 +140,7 @@ export class TeamsInfo { /** * Creates a new thread in a Teams chat and sends an [Activity](xref:botframework-schema.Activity) to that new thread. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param activity The [Activity](xref:botframework-schema.Activity) to send. * @param teamsChannelId The Team's Channel ID, note this is distinct from the Bot Framework activity property with same name. @@ -201,6 +205,7 @@ export class TeamsInfo { /** * Returns a list of channels in a Team. This only works in teams scoped conversations. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param teamId ID of the Teams team. * @returns The list of [ChannelInfo](xref:botframework-schema.ChannelInfo) objects with the conversations. @@ -217,6 +222,7 @@ export class TeamsInfo { /** * Gets the conversation members of a one-on-one or group chat. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @returns The list of [TeamsChannelAccount](xref:botframework-schema.TeamsChannelAccount). * @deprecated Use `getPagedTeamMembers` instead. @@ -234,6 +240,7 @@ export class TeamsInfo { /** * Gets a pagined list of members of one-on-one, group, or team conversation. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param pageSize Suggested number of entries on a page. * @param continuationToken A continuation token. @@ -260,6 +267,7 @@ export class TeamsInfo { /** * Gets the account of a single conversation member. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param userId ID of the user in question. * @returns The [TeamsChannelAccount](xref:botframework-schema.TeamsChannelAccount) of the member. @@ -277,6 +285,7 @@ export class TeamsInfo { /** * Gets the list of [TeamsChannelAccount](xref:botframework-schema.TeamsChannelAccount) within a team. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param teamId ID of the Teams team. * @returns The list of [TeamsChannelAccount](xref:botframework-schema.TeamsChannelAccount) of the members. @@ -292,6 +301,7 @@ export class TeamsInfo { /** * Gets a paginated list of members of a team. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param teamId ID of the Teams team. * @param pageSize The number of entries on the page. @@ -318,6 +328,7 @@ export class TeamsInfo { /** * Gets the account of a member in a teams scoped conversation. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param teamId ID of the Teams team. * @param userId ID of the Teams user. @@ -333,6 +344,7 @@ export class TeamsInfo { /** * Sends a meeting notification to specific users in a Teams meeting. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param notification The meeting notification payload. * @param meetingId Id of the Teams meeting. @@ -361,6 +373,7 @@ export class TeamsInfo { /** * Sends a message to the provided users in the list of Teams members. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param activity The activity to send. * @param tenantId The tenant ID. @@ -388,6 +401,7 @@ export class TeamsInfo { /** * Sends a message to all the users in a tenant. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param activity The activity to send. * @param tenantId The tenant ID. @@ -410,6 +424,7 @@ export class TeamsInfo { /** * Sends a message to all the users in a team. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param activity The activity to send. * @param tenantId The tenant ID. @@ -441,6 +456,7 @@ export class TeamsInfo { /** * Sends a message to the provided list of Teams channels. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param activity The activity to send. * @param tenantId The tenant ID. @@ -472,6 +488,7 @@ export class TeamsInfo { /** * Gets the operation state. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param operationId The operationId to get the state of. * @returns Promise with The state and responses of the operation. @@ -486,6 +503,7 @@ export class TeamsInfo { /** * Gets the failed entries of an executed operation. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param operationId The operationId to get the failed entries of. * @returns Promise with the list of failed entries of the operation. @@ -500,6 +518,7 @@ export class TeamsInfo { /** * Cancels a pending operation. + * * @param context The [TurnContext](xref:botbuilder-core.TurnContext) for this turn. * @param operationId The id of the operation to cancel. * @returns Promise representing the asynchronous operation. diff --git a/libraries/botbuilder/tests/botFrameworkAdapter.test.js b/libraries/botbuilder/tests/botFrameworkAdapter.test.js index 29d1dc3f25..96f5ef0a0d 100644 --- a/libraries/botbuilder/tests/botFrameworkAdapter.test.js +++ b/libraries/botbuilder/tests/botFrameworkAdapter.test.js @@ -256,6 +256,7 @@ function createActivity() { describe('BotFrameworkAdapter', function () { let sandbox; + beforeEach(function () { sandbox = sinon.createSandbox(); }); diff --git a/libraries/botbuilder/tests/channelServiceHandler.test.js b/libraries/botbuilder/tests/channelServiceHandler.test.js index 7ff074a00b..a6ae97d439 100644 --- a/libraries/botbuilder/tests/channelServiceHandler.test.js +++ b/libraries/botbuilder/tests/channelServiceHandler.test.js @@ -41,6 +41,7 @@ describe('ChannelServiceHandler', function () { const handler = new ChannelServiceHandler(CREDENTIALS, AUTH_CONFIG, 'channels'); let sandbox; + beforeEach(function () { sandbox = sinon.createSandbox(); }); diff --git a/libraries/botbuilder/tests/channelServiceRoutes.test.js b/libraries/botbuilder/tests/channelServiceRoutes.test.js index 25a69d31cb..8d830a4ff4 100644 --- a/libraries/botbuilder/tests/channelServiceRoutes.test.js +++ b/libraries/botbuilder/tests/channelServiceRoutes.test.js @@ -31,6 +31,7 @@ class MockResponse { describe('channelServiceRoutes', function () { let sandbox; + beforeEach(function () { sandbox = sinon.createSandbox(); }); @@ -50,6 +51,7 @@ describe('channelServiceRoutes', function () { describe('register()', function () { let channel, server; + beforeEach(function () { const testHandler = sandbox.mock(ChannelServiceHandler); channel = new ChannelServiceRoutes(testHandler); diff --git a/libraries/botbuilder/tests/cloudAdapter.test.js b/libraries/botbuilder/tests/cloudAdapter.test.js index a8674f7bf7..2af3657225 100644 --- a/libraries/botbuilder/tests/cloudAdapter.test.js +++ b/libraries/botbuilder/tests/cloudAdapter.test.js @@ -30,6 +30,7 @@ const noop = () => null; describe('CloudAdapter', function () { let sandbox; + beforeEach(function () { sandbox = sinon.createSandbox({ useFakeTimers: false }); }); @@ -85,6 +86,7 @@ describe('CloudAdapter', function () { const activity = { type: ActivityTypes.Invoke, value: 'invoke' }; const authorization = 'Bearer Authorization'; + it('delegates to connect', async function () { const req = {}; const socket = FakeNodeSocket(); @@ -128,6 +130,7 @@ describe('CloudAdapter', function () { mock.verify(); }); + //eslint-disable-next-line mocha/no-skipped-tests it.skip('throws exception on expired token', async function () { const consoleStub = sandbox.stub(console, 'error'); diff --git a/libraries/botbuilder/tests/fileTranscriptStore.test.js b/libraries/botbuilder/tests/fileTranscriptStore.test.js index dbf7d892a1..4e02d3ca0a 100644 --- a/libraries/botbuilder/tests/fileTranscriptStore.test.js +++ b/libraries/botbuilder/tests/fileTranscriptStore.test.js @@ -12,10 +12,12 @@ const workingFolder = path.join(os.tmpdir(), 'botbuilder-transcript-tests'); describe('The FileTranscriptStore', function () { let storage; const startDate = new Date(); + before(async function () { await fs.remove(workingFolder); storage = new FileTranscriptStore(workingFolder); }); + after(function () { return fs.remove(workingFolder); }); @@ -53,6 +55,7 @@ describe('The FileTranscriptStore', function () { describe('should log activities', function () { const conversationId = 'logActivitySpec'; let activities; + before(function () { activities = createActivities(conversationId, startDate); return Promise.all(activities.map((activity) => storage.logActivity(activity))); @@ -156,11 +159,13 @@ describe('The FileTranscriptStore', function () { describe('should retrieve activities', function () { const conversationId = 'retrieveActivitiesSpec'; let activities; + before(function () { activities = createActivities(conversationId, startDate, 60); storage = new FileTranscriptStore(workingFolder); return Promise.all(activities.map((activity) => storage.logActivity(activity))); }); + after(function () { return fs.remove(workingFolder); }); @@ -245,6 +250,7 @@ describe('The FileTranscriptStore', function () { describe('should list transcripts', function () { let activities; + before(function () { activities = []; let ct = 100; @@ -254,6 +260,7 @@ describe('The FileTranscriptStore', function () { storage = new FileTranscriptStore(workingFolder); return Promise.all(activities.map((activity) => storage.logActivity(activity))); }); + after(function () { return fs.remove(workingFolder); }); diff --git a/libraries/botbuilder/tests/inspectionMiddleware.test.js b/libraries/botbuilder/tests/inspectionMiddleware.test.js index 197f956490..1cb858261a 100644 --- a/libraries/botbuilder/tests/inspectionMiddleware.test.js +++ b/libraries/botbuilder/tests/inspectionMiddleware.test.js @@ -39,6 +39,7 @@ describe('InspectionMiddleware', function () { assert(adapter.activityBuffer[0].type === 'message', 'expected a message activity'); assert(adapter.activityBuffer[0].text === 'hi', "expected text saying 'hi'"); }); + it('should replicate activity data to listening emulator following open and attach', async function () { // set up our expectations in nock - each corresponds to a trace message we expect to receive in the emulator @@ -133,6 +134,7 @@ describe('InspectionMiddleware', function () { ); assert(stateExpectation.isDone(), 'The expectation of a trace message for the bot state was not met'); }); + it('should replicate activity data to listening emulator following open and attach with at mention', async function () { // set up our expectations in nock - each corresponds to a trace message we expect to receive in the emulator @@ -245,6 +247,7 @@ describe('InspectionMiddleware', function () { ); assert(stateExpectation.isDone(), 'The expectation of a trace message for the bot state was not met'); }); + it('should replicate activity data to listening emulator following open and attach within Teams Team', async function () { // set up our expectations in nock - each corresponds to a trace message we expect to receive in the emulator diff --git a/libraries/botbuilder/tests/skills/cloudSkillHandler.test.js b/libraries/botbuilder/tests/skills/cloudSkillHandler.test.js index a46b02b1af..04b4951066 100644 --- a/libraries/botbuilder/tests/skills/cloudSkillHandler.test.js +++ b/libraries/botbuilder/tests/skills/cloudSkillHandler.test.js @@ -13,9 +13,11 @@ describe('CloudSkillHandler', function () { const handler = new CloudSkillHandler(adapter, bot, factory, authConfig); let sandbox; + beforeEach(function () { sandbox = sinon.createSandbox(); }); + afterEach(function () { sandbox.restore(); }); diff --git a/libraries/botbuilder/tests/skills/skillHandler.test.js b/libraries/botbuilder/tests/skills/skillHandler.test.js index a6bc308728..b19700e4e5 100644 --- a/libraries/botbuilder/tests/skills/skillHandler.test.js +++ b/libraries/botbuilder/tests/skills/skillHandler.test.js @@ -27,9 +27,11 @@ describe('SkillHandler', function () { const handler = new SkillHandler(adapter, bot, factory, creds, authConfig); let sandbox; + beforeEach(function () { sandbox = sinon.createSandbox(); }); + afterEach(function () { sandbox.restore(); }); diff --git a/libraries/botbuilder/tests/teams/teamsSSOTokenExchangeMiddleware.test.js b/libraries/botbuilder/tests/teams/teamsSSOTokenExchangeMiddleware.test.js index 31c4fe526f..bde0085cd3 100644 --- a/libraries/botbuilder/tests/teams/teamsSSOTokenExchangeMiddleware.test.js +++ b/libraries/botbuilder/tests/teams/teamsSSOTokenExchangeMiddleware.test.js @@ -194,6 +194,7 @@ describe('TeamsSSOTokenExchangeMiddleware', function () { afterEach(function () { this.sandbox.restore(); }); + it('exchange token with CloudAdapter', async function () { class TestCloudAdapter extends CloudAdapterBase {} const conversation = TestAdapter.createConversation('Convo1'); diff --git a/libraries/botbuilder/tests/teamsActivityHandler.test.js b/libraries/botbuilder/tests/teamsActivityHandler.test.js index 28b9eff869..3f1aa42aca 100644 --- a/libraries/botbuilder/tests/teamsActivityHandler.test.js +++ b/libraries/botbuilder/tests/teamsActivityHandler.test.js @@ -1148,24 +1148,6 @@ describe('TeamsActivityHandler', function () { .startTest(); }); - it('handleTeamsMessagingExtensionConfigurationQuerySettingUrl is not overridden', async function () { - const bot = new TeamsActivityHandler(); - - const adapter = new TestAdapter(async (context) => { - await bot.run(context); - }); - - const taskSubmitActivity = createInvokeActivity('composeExtension/querySettingUrl'); - await adapter - .send(taskSubmitActivity) - .assertReply((activity) => { - assert.strictEqual(activity.type, 'invokeResponse'); - assert.strictEqual(activity.value.status, 501); - assert.strictEqual(activity.value.body, undefined); - }) - .startTest(); - }); - it('handleTeamsMessagingExtensionConfigurationSetting is not overridden', async function () { const bot = new TeamsActivityHandler(); diff --git a/libraries/botbuilder/tests/teamsInfo.test.js b/libraries/botbuilder/tests/teamsInfo.test.js index de775d4c31..9cee971de0 100644 --- a/libraries/botbuilder/tests/teamsInfo.test.js +++ b/libraries/botbuilder/tests/teamsInfo.test.js @@ -1729,14 +1729,14 @@ describe('TeamsInfo', function () { }); describe('getMembersInternal()', function () { - it('should error if an invalid conversationId is passed in.', async function () { + it('getMembers should throw error if an invalid conversationId is passed in.', async function () { await assert.rejects( TeamsInfo.getMembersInternal({}, undefined), new Error('The getMembers operation needs a valid conversationId.'), ); }); - it('should error if an invalid conversationId is passed in.', async function () { + it('getMember should throw error if an invalid conversationId is passed in.', async function () { await assert.rejects( TeamsInfo.getMemberInternal({}, undefined), new Error('The getMember operation needs a valid conversationId.'), @@ -1753,6 +1753,7 @@ describe('TeamsInfo', function () { describe('getPagedMembersInternal()', function () { let sandbox; + beforeEach(function () { sandbox = sinon.createSandbox(); }); diff --git a/yarn.lock b/yarn.lock index be3977e8c6..04246c3240 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7976,6 +7976,11 @@ eslint-module-utils@^2.12.0: dependencies: debug "^3.2.7" +eslint-plugin-chai-friendly@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-chai-friendly/-/eslint-plugin-chai-friendly-1.0.1.tgz#c3290b5294c1145934cf9c07eaa4cec87921d18c" + integrity sha512-dxD/uz1YKJ8U4yah1i+V/p/u+kHRy3YxTPe2nJGqb5lCR+ucan/KIexfZ5+q4X+tkllyMe86EBbAkdlwxNy3oQ== + eslint-plugin-import@^2.31.0: version "2.31.0" resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.31.0.tgz#310ce7e720ca1d9c0bb3f69adfd1c6bdd7d9e0e7" @@ -14367,6 +14372,7 @@ string-argv@~0.3.1: integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg== "string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.2.2, string-width@^4.2.3: + name string-width-cjs version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== From a594ca98c369372b1e7c0425a970d9955bd0ec39 Mon Sep 17 00:00:00 2001 From: JhontSouth Date: Thu, 24 Oct 2024 14:35:11 -0500 Subject: [PATCH 3/8] remove eslint-plugin-chai-friendly package --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index f06ac09713..ce3dfe13d9 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,6 @@ "esbuild-plugin-polyfill-node": "^0.3.0", "https-browserify": "^1.0.0", "eslint": "^9.12.0", - "eslint-plugin-chai-friendly": "^1.0.1", "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.31.0", "eslint-plugin-jsdoc": "^50.3.1", From 700d87b92179c9e27a4d3a77be40e27a88bb9ff4 Mon Sep 17 00:00:00 2001 From: JhontSouth Date: Mon, 28 Oct 2024 09:49:16 -0500 Subject: [PATCH 4/8] remove eslint-plugin-only-warn --- libraries/botbuilder/src/skills/cloudSkillHandler.ts | 2 +- libraries/botbuilder/src/skills/skillHandler.ts | 2 +- libraries/botbuilder/src/teamsActivityHandler.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/botbuilder/src/skills/cloudSkillHandler.ts b/libraries/botbuilder/src/skills/cloudSkillHandler.ts index 7e0302b27e..676368d2a6 100644 --- a/libraries/botbuilder/src/skills/cloudSkillHandler.ts +++ b/libraries/botbuilder/src/skills/cloudSkillHandler.ts @@ -126,7 +126,7 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { /** * - *UpdateActivity() API for Skill. + * UpdateActivity() API for Skill. * * @remarks * Edit an existing activity. diff --git a/libraries/botbuilder/src/skills/skillHandler.ts b/libraries/botbuilder/src/skills/skillHandler.ts index 574f31d1f9..578b381085 100644 --- a/libraries/botbuilder/src/skills/skillHandler.ts +++ b/libraries/botbuilder/src/skills/skillHandler.ts @@ -144,7 +144,7 @@ export class SkillHandler extends ChannelServiceHandler { /** * - *UpdateActivity() API for Skill. + * UpdateActivity() API for Skill. * * @remarks * Edit an existing activity. diff --git a/libraries/botbuilder/src/teamsActivityHandler.ts b/libraries/botbuilder/src/teamsActivityHandler.ts index 38d55d6a8b..43bd322d33 100644 --- a/libraries/botbuilder/src/teamsActivityHandler.ts +++ b/libraries/botbuilder/src/teamsActivityHandler.ts @@ -868,9 +868,9 @@ export class TeamsActivityHandler extends ActivityHandler { /** * - *Invoked when a Channel Restored event activity is received from the connector. - *Channel Restored corresponds to the user restoring a previously deleted channel. - *Override this in a derived class to provide logic for when a channel is restored. + * Invoked when a Channel Restored event activity is received from the connector. + * Channel Restored corresponds to the user restoring a previously deleted channel. + * Override this in a derived class to provide logic for when a channel is restored. * * @param context The context for this turn. * @returns A promise that represents the work queued. From f3bdc4c44d9ab508d7fb085cf214a9a5cb968414 Mon Sep 17 00:00:00 2001 From: JhontSouth Date: Mon, 28 Oct 2024 11:05:15 -0500 Subject: [PATCH 5/8] cast authorization variable --- libraries/botbuilder/src/cloudAdapter.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libraries/botbuilder/src/cloudAdapter.ts b/libraries/botbuilder/src/cloudAdapter.ts index dc589f5f0e..17a2456bb0 100644 --- a/libraries/botbuilder/src/cloudAdapter.ts +++ b/libraries/botbuilder/src/cloudAdapter.ts @@ -177,11 +177,7 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd logic: (context: TurnContext) => Promise, ): Promise { try { - if (typeof authorization === 'string') { - await this.processActivity(authorization, activity, logic); - } else { - await this.processActivity(authorization, activity, logic); - } + await this.processActivity(authorization as any, activity, logic); } catch (err) { throw new Error(`CloudAdapter.processActivityDirect(): ERROR\n ${err.stack}`); } From 0561e4fb34cb21d297b8b22d8b4bea9709ae486c Mon Sep 17 00:00:00 2001 From: JhontSouth Date: Tue, 29 Oct 2024 11:54:27 -0500 Subject: [PATCH 6/8] apply sub-bullet format --- libraries/botbuilder/src/skills/cloudSkillHandler.ts | 4 ++-- libraries/botbuilder/src/skills/skillHandler.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/botbuilder/src/skills/cloudSkillHandler.ts b/libraries/botbuilder/src/skills/cloudSkillHandler.ts index 676368d2a6..0e8e1d4ec8 100644 --- a/libraries/botbuilder/src/skills/cloudSkillHandler.ts +++ b/libraries/botbuilder/src/skills/cloudSkillHandler.ts @@ -73,7 +73,7 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { * This is slightly different from replyToActivity(). * sendToConversation(conversationId) - will append the activity to the end * of the conversation according to the timestamp or semantics of the channel. - * replyToActivity(conversationId,ActivityId) - adds the activity as a reply + * - replyToActivity(conversationId,ActivityId) - adds the activity as a reply * to another activity, if the channel supports it. If the channel does not * support nested replies, replyToActivity falls back to sendToConversation. * @@ -102,7 +102,7 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { * This is slightly different from sendToConversation(). * sendToConversation(conversationId) - will append the activity to the end * of the conversation according to the timestamp or semantics of the channel. - * replyToActivity(conversationId,ActivityId) - adds the activity as a reply + * - replyToActivity(conversationId,ActivityId) - adds the activity as a reply * to another activity, if the channel supports it. If the channel does not * support nested replies, replyToActivity falls back to sendToConversation. * diff --git a/libraries/botbuilder/src/skills/skillHandler.ts b/libraries/botbuilder/src/skills/skillHandler.ts index 578b381085..bfbc306993 100644 --- a/libraries/botbuilder/src/skills/skillHandler.ts +++ b/libraries/botbuilder/src/skills/skillHandler.ts @@ -91,7 +91,7 @@ export class SkillHandler extends ChannelServiceHandler { * This is slightly different from replyToActivity(). * sendToConversation(conversationId) - will append the activity to the end * of the conversation according to the timestamp or semantics of the channel. - * replyToActivity(conversationId,ActivityId) - adds the activity as a reply + * - replyToActivity(conversationId,ActivityId) - adds the activity as a reply * to another activity, if the channel supports it. If the channel does not * support nested replies, replyToActivity falls back to sendToConversation. * @@ -120,7 +120,7 @@ export class SkillHandler extends ChannelServiceHandler { * This is slightly different from sendToConversation(). * sendToConversation(conversationId) - will append the activity to the end * of the conversation according to the timestamp or semantics of the channel. - * replyToActivity(conversationId,ActivityId) - adds the activity as a reply + * - replyToActivity(conversationId,ActivityId) - adds the activity as a reply * to another activity, if the channel supports it. If the channel does not * support nested replies, replyToActivity falls back to sendToConversation. * From cbe7fb3b4e1dfedf7217ccfff7994b2d10a9be7a Mon Sep 17 00:00:00 2001 From: JhontSouth Date: Tue, 29 Oct 2024 12:34:33 -0500 Subject: [PATCH 7/8] apply missing format --- libraries/botbuilder/src/skills/cloudSkillHandler.ts | 4 ++-- libraries/botbuilder/src/skills/skillHandler.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/botbuilder/src/skills/cloudSkillHandler.ts b/libraries/botbuilder/src/skills/cloudSkillHandler.ts index 0e8e1d4ec8..5c1d1939fe 100644 --- a/libraries/botbuilder/src/skills/cloudSkillHandler.ts +++ b/libraries/botbuilder/src/skills/cloudSkillHandler.ts @@ -71,7 +71,7 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { * This method allows you to send an activity to the end of a conversation. * * This is slightly different from replyToActivity(). - * sendToConversation(conversationId) - will append the activity to the end + * - sendToConversation(conversationId) - will append the activity to the end * of the conversation according to the timestamp or semantics of the channel. * - replyToActivity(conversationId,ActivityId) - adds the activity as a reply * to another activity, if the channel supports it. If the channel does not @@ -100,7 +100,7 @@ export class CloudSkillHandler extends CloudChannelServiceHandler { * This method allows you to reply to an activity. * * This is slightly different from sendToConversation(). - * sendToConversation(conversationId) - will append the activity to the end + * - sendToConversation(conversationId) - will append the activity to the end * of the conversation according to the timestamp or semantics of the channel. * - replyToActivity(conversationId,ActivityId) - adds the activity as a reply * to another activity, if the channel supports it. If the channel does not diff --git a/libraries/botbuilder/src/skills/skillHandler.ts b/libraries/botbuilder/src/skills/skillHandler.ts index bfbc306993..3f956a22ba 100644 --- a/libraries/botbuilder/src/skills/skillHandler.ts +++ b/libraries/botbuilder/src/skills/skillHandler.ts @@ -89,7 +89,7 @@ export class SkillHandler extends ChannelServiceHandler { * This method allows you to send an activity to the end of a conversation. * * This is slightly different from replyToActivity(). - * sendToConversation(conversationId) - will append the activity to the end + * - sendToConversation(conversationId) - will append the activity to the end * of the conversation according to the timestamp or semantics of the channel. * - replyToActivity(conversationId,ActivityId) - adds the activity as a reply * to another activity, if the channel supports it. If the channel does not @@ -118,7 +118,7 @@ export class SkillHandler extends ChannelServiceHandler { * This method allows you to reply to an activity. * * This is slightly different from sendToConversation(). - * sendToConversation(conversationId) - will append the activity to the end + * - sendToConversation(conversationId) - will append the activity to the end * of the conversation according to the timestamp or semantics of the channel. * - replyToActivity(conversationId,ActivityId) - adds the activity as a reply * to another activity, if the channel supports it. If the channel does not From 3672096649345d99d98079faaa0e07661f632823 Mon Sep 17 00:00:00 2001 From: JhontSouth Date: Thu, 14 Nov 2024 11:48:08 -0500 Subject: [PATCH 8/8] update yarn.lock --- yarn.lock | 6 ------ 1 file changed, 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index 04246c3240..be3977e8c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7976,11 +7976,6 @@ eslint-module-utils@^2.12.0: dependencies: debug "^3.2.7" -eslint-plugin-chai-friendly@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-chai-friendly/-/eslint-plugin-chai-friendly-1.0.1.tgz#c3290b5294c1145934cf9c07eaa4cec87921d18c" - integrity sha512-dxD/uz1YKJ8U4yah1i+V/p/u+kHRy3YxTPe2nJGqb5lCR+ucan/KIexfZ5+q4X+tkllyMe86EBbAkdlwxNy3oQ== - eslint-plugin-import@^2.31.0: version "2.31.0" resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.31.0.tgz#310ce7e720ca1d9c0bb3f69adfd1c6bdd7d9e0e7" @@ -14372,7 +14367,6 @@ string-argv@~0.3.1: integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg== "string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.2.2, string-width@^4.2.3: - name string-width-cjs version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==