Skip to content

Commit

Permalink
fix: #4566 Refactor Teams config fetch & submit typings (#4570)
Browse files Browse the repository at this point in the history
* Cleanup types for Teams config fetch & submit

* Compat update

* botbuilder test:compat

---------

Co-authored-by: Corina Gum <>
Co-authored-by: Tracy Boehrer <trboehre@microsoft.com>
  • Loading branch information
corinagum and Tracy Boehrer authored Nov 14, 2023
1 parent e0e656b commit 60824fe
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 31 deletions.
6 changes: 2 additions & 4 deletions libraries/botbuilder/etc/botbuilder.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { BatchFailedEntriesResponse } from 'botbuilder-core';
import { BatchOperationResponse } from 'botbuilder-core';
import { BatchOperationStateResponse } from 'botbuilder-core';
import { BotAdapter } from 'botbuilder-core';
import { BotConfigAuth } from 'botbuilder-core';
import { BotFrameworkAuthentication } from 'botframework-connector';
import { BotFrameworkClient } from 'botbuilder-core';
import { BotFrameworkSkill } from 'botbuilder-core';
Expand All @@ -29,7 +28,6 @@ import { ChannelInfo } from 'botbuilder-core';
import { ClaimsIdentity } from 'botframework-connector';
import { CloudAdapterBase } from 'botbuilder-core';
import { ConfigResponse } from 'botbuilder-core';
import { ConfigTaskResponse } from 'botbuilder-core';
import { ConnectorClient } from 'botframework-connector';
import { ConnectorClientOptions } from 'botframework-connector';
import { ConversationAccount } from 'botbuilder-core';
Expand Down Expand Up @@ -392,8 +390,8 @@ export class TeamsActivityHandler extends ActivityHandler {
protected handleTeamsAnonymousAppBasedLinkQuery(_context: TurnContext, _query: AppBasedLinkQuery): Promise<MessagingExtensionResponse>;
protected handleTeamsAppBasedLinkQuery(_context: TurnContext, _query: AppBasedLinkQuery): Promise<MessagingExtensionResponse>;
protected handleTeamsCardActionInvoke(_context: TurnContext): Promise<InvokeResponse>;
protected handleTeamsConfigFetch(_context: TurnContext, _configData: any): Promise<ConfigResponse<BotConfigAuth | ConfigTaskResponse>>;
protected handleTeamsConfigSubmit(_context: TurnContext, _configData: any): Promise<ConfigResponse<BotConfigAuth | ConfigTaskResponse>>;
protected handleTeamsConfigFetch(_context: TurnContext, _configData: any): Promise<ConfigResponse>;
protected handleTeamsConfigSubmit(_context: TurnContext, _configData: any): Promise<ConfigResponse>;
protected handleTeamsFileConsent(context: TurnContext, fileConsentCardResponse: FileConsentCardResponse): Promise<void>;
protected handleTeamsFileConsentAccept(_context: TurnContext, _fileConsentCardResponse: FileConsentCardResponse): Promise<void>;
protected handleTeamsFileConsentDecline(_context: TurnContext, _fileConsentCardResponse: FileConsentCardResponse): Promise<void>;
Expand Down
14 changes: 3 additions & 11 deletions libraries/botbuilder/src/teamsActivityHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
import {
ActivityHandler,
AppBasedLinkQuery,
BotConfigAuth,
ChannelInfo,
Channels,
ConfigResponse,
ConfigTaskResponse,
FileConsentCardResponse,
InvokeResponse,
MeetingEndEventDetails,
MeetingParticipantsEventDetails,
MeetingStartEventDetails,
MessagingExtensionAction,
MessagingExtensionActionResponse,
Expand All @@ -35,7 +34,6 @@ import {
tokenExchangeOperationName,
TurnContext,
verifyStateOperationName,
MeetingParticipantsEventDetails,
} from 'botbuilder-core';
import { ReadReceiptInfo } from 'botframework-connector';
import { TeamsInfo } from './teamsInfo';
Expand Down Expand Up @@ -212,10 +210,7 @@ export class TeamsActivityHandler extends ActivityHandler {
* @param _configData The object representing the configuration.
* @returns A Config Response for the activity.
*/
protected async handleTeamsConfigFetch(
_context: TurnContext,
_configData: any
): Promise<ConfigResponse<BotConfigAuth | ConfigTaskResponse>> {
protected async handleTeamsConfigFetch(_context: TurnContext, _configData: any): Promise<ConfigResponse> {
throw new Error('NotImplemented');
}

Expand All @@ -226,10 +221,7 @@ export class TeamsActivityHandler extends ActivityHandler {
* @param _configData The object representing the configuration.
* @returns A Config Response for the activity.
*/
protected async handleTeamsConfigSubmit(
_context: TurnContext,
_configData: any
): Promise<ConfigResponse<BotConfigAuth | ConfigTaskResponse>> {
protected async handleTeamsConfigSubmit(_context: TurnContext, _configData: any): Promise<ConfigResponse> {
throw new Error('NotImplemented');
}

Expand Down
11 changes: 3 additions & 8 deletions libraries/botframework-schema/etc/botframework-schema.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -652,20 +652,15 @@ export interface CommandValue<T = unknown> {
data?: T;
}

// @public (undocumented)
export interface ConfigAuthResponse extends ConfigResponse<BotConfigAuth> {
}

// @public
export interface ConfigResponse<T> {
export interface ConfigResponse {
cacheInfo?: CacheInfo;
config: T;
config: ConfigResponseConfig;
responseType: 'config';
}

// @public (undocumented)
export interface ConfigTaskResponse extends ConfigResponse<TaskModuleResponse> {
}
export type ConfigResponseConfig = BotConfigAuth | TaskModuleResponse;

// @public
export interface ConfirmationDialog {
Expand Down
12 changes: 4 additions & 8 deletions libraries/botframework-schema/src/teams/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ export interface BotConfigAuth {
type: 'auth';
}

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ConfigAuthResponse extends ConfigResponse<BotConfigAuth> {}
export type ConfigResponseConfig = BotConfigAuth | TaskModuleResponse;

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ConfigTaskResponse extends ConfigResponse<TaskModuleResponse> {}
/**
* @interface
* An interface representing ChannelInfo.
Expand All @@ -53,16 +50,15 @@ export interface ChannelInfo {
* @interface
* An interface container for the Config response payload
*/
export interface ConfigResponse<T> {
export interface ConfigResponse {
/**
* @member {CacheInfo} [cacheInfo] The data of the ConfigResponse cache, including cache type and cache duration.
*/
cacheInfo?: CacheInfo;
/**
* @template T
* @member {T} [config] The response to a configuration message.
* @member {ConfigResponseConfig} [config] The ConfigResponse config of BotConfigAuth or TaskModuleResponse
*/
config: T;
config: ConfigResponseConfig;
/**
* @member {string} [responseType] The type of response 'config'.
*/
Expand Down

0 comments on commit 60824fe

Please sign in to comment.