Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into southworks/update/zod…
Browse files Browse the repository at this point in the history
…-botbuilder-core
  • Loading branch information
JhontSouth committed Nov 7, 2023
2 parents e11143e + 7277636 commit a75380e
Show file tree
Hide file tree
Showing 52 changed files with 3,805 additions and 1,768 deletions.
14 changes: 7 additions & 7 deletions libraries/adaptive-expressions-ie11/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
"terser-webpack-plugin": "^4.2.3"
},
"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-decorators": "^7.6.0",
"@babel/plugin-transform-runtime": "^7.6.2",
"@babel/preset-env": "^7.6.3",
"@babel/preset-typescript": "^7.6.0",
"@babel/runtime": "^7.6.3",
"@babel/core": "^7.23.2",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.23.2",
"@babel/plugin-transform-runtime": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/preset-typescript": "^7.23.2",
"@babel/runtime": "^7.23.2",
"babel-loader": "^8.0.6",
"ts-loader": "^7.0.5",
"typescript": "3.5.3",
Expand Down
16 changes: 16 additions & 0 deletions libraries/botbuilder/etc/botbuilder.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
```ts

import { AceRequest } from 'botbuilder-core';
import { Activity } from 'botbuilder-core';
import { ActivityHandler } from 'botbuilder-core';
import { ActivityHandlerBase } from 'botbuilder-core';
Expand All @@ -22,6 +23,7 @@ import { BotFrameworkClient } from 'botbuilder-core';
import { BotFrameworkSkill } from 'botbuilder-core';
import { BotState } from 'botbuilder-core';
import { CancelOperationResponse } from 'botframework-connector';
import { CardViewResponse } from 'botbuilder-core';
import { ChannelAccount } from 'botbuilder-core';
import { ChannelInfo } from 'botbuilder-core';
import { ClaimsIdentity } from 'botframework-connector';
Expand All @@ -39,6 +41,8 @@ import { ConversationState } from 'botbuilder-core';
import { CoreAppCredentials } from 'botbuilder-core';
import { ExtendedUserTokenProvider } from 'botbuilder-core';
import { FileConsentCardResponse } from 'botbuilder-core';
import { GetPropertyPaneConfigurationResponse } from 'botbuilder-core';
import { HandleActionResponse } from 'botbuilder-core';
import { HttpClient } from '@azure/ms-rest-js';
import { HttpOperationResponse } from '@azure/ms-rest-js';
import { ICredentialProvider } from 'botframework-connector';
Expand All @@ -63,9 +67,11 @@ import { O365ConnectorCardActionQuery } from 'botbuilder-core';
import { OnBehalfOf } from 'botbuilder-core';
import { PagedMembersResult } from 'botbuilder-core';
import { PagedResult } from 'botbuilder-core';
import { QuickViewResponse } from 'botbuilder-core';
import { ReadReceiptInfo } from 'botframework-connector';
import { RequestHandler } from 'botframework-streaming';
import { ResourceResponse } from 'botbuilder-core';
import { SetPropertyPaneConfigurationResponse } from 'botbuilder-core';
import { SigninStateVerificationQuery } from 'botbuilder-core';
import { SignInUrlResponse } from 'botframework-connector';
import { SimpleCredentialProvider } from 'botframework-connector';
Expand Down Expand Up @@ -338,6 +344,16 @@ export class SetSpeakMiddleware implements Middleware {
onTurn(turnContext: TurnContext, next: () => Promise<void>): Promise<void>;
}

// @public
export class SharePointActivityHandler extends ActivityHandler {
protected onInvokeActivity(context: TurnContext): Promise<InvokeResponse>;
protected onSharePointTaskGetCardViewAsync(_context: TurnContext, _aceRequest: AceRequest): Promise<CardViewResponse>;
protected onSharePointTaskGetPropertyPaneConfigurationAsync(_context: TurnContext, _aceRequest: AceRequest): Promise<GetPropertyPaneConfigurationResponse>;
protected onSharePointTaskGetQuickViewAsync(_context: TurnContext, _aceRequest: AceRequest): Promise<QuickViewResponse>;
protected onSharePointTaskHandleActionAsync(_context: TurnContext, _aceRequest: AceRequest): Promise<HandleActionResponse>;
protected onSharePointTaskSetPropertyPaneConfigurationAsync(_context: TurnContext, _aceRequest: AceRequest): Promise<SetPropertyPaneConfigurationResponse>;
}

// @public @deprecated (undocumented)
export class SkillHandler extends ChannelServiceHandler {
constructor(adapter: BotAdapter, bot: ActivityHandlerBase, conversationIdFactory: SkillConversationIdFactoryBase, credentialProvider: ICredentialProvider, authConfig: AuthenticationConfiguration, channelService?: string);
Expand Down
1 change: 1 addition & 0 deletions libraries/botbuilder/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ export { HandoffEventNames } from './handoffEventNames';
export { Request, Response, WebRequest, WebResponse } from './interfaces';
export { StatusCodeError } from './statusCodeError';
export { StreamingHttpClient, TokenResolver } from './streaming';
export { SharePointActivityHandler } from './sharepoint/sharePointActivityHandler';
152 changes: 152 additions & 0 deletions libraries/botbuilder/src/sharepoint/sharePointActivityHandler.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
/**
* @module botbuilder
*/
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/

import {
ActivityHandler,
InvokeResponse,
AceRequest,
TurnContext,
CardViewResponse,
QuickViewResponse,
GetPropertyPaneConfigurationResponse,
SetPropertyPaneConfigurationResponse,
HandleActionResponse,
} from 'botbuilder-core';

/**
* The SharePointActivityHandler is derived from ActivityHandler. It adds support for
* the SharePoint specific events and interactions
*/
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
*/
protected async onInvokeActivity(context: TurnContext): Promise<InvokeResponse> {
try {
if (!context.activity.name && context.activity.channelId === 'sharepoint') {
throw new Error('NotImplemented');
} else {
switch (context.activity.name) {
case 'cardExtension/getCardView':
return ActivityHandler.createInvokeResponse(
await this.onSharePointTaskGetCardViewAsync(context, context.activity.value as AceRequest)
);

case 'cardExtension/getQuickView':
return ActivityHandler.createInvokeResponse(
await this.onSharePointTaskGetQuickViewAsync(context, context.activity.value as AceRequest)
);

case 'cardExtension/getPropertyPaneConfiguration':
return ActivityHandler.createInvokeResponse(
await this.onSharePointTaskGetPropertyPaneConfigurationAsync(
context,
context.activity.value as AceRequest
)
);

case 'cardExtension/setPropertyPaneConfiguration':
return ActivityHandler.createInvokeResponse(
await this.onSharePointTaskSetPropertyPaneConfigurationAsync(
context,
context.activity.value as AceRequest
)
);
case 'cardExtension/handleAction':
return ActivityHandler.createInvokeResponse(
await this.onSharePointTaskHandleActionAsync(context, context.activity.value as AceRequest)
);
default:
return super.onInvokeActivity(context);
}
}
} catch (err) {
if (err.message === 'NotImplemented') {
return { status: 501 };
} else if (err.message === 'BadRequest') {
return { status: 400 };
}
throw err;
}
}

/**
* 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
): Promise<CardViewResponse> {
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
): Promise<QuickViewResponse> {
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
): Promise<GetPropertyPaneConfigurationResponse> {
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
): Promise<SetPropertyPaneConfigurationResponse> {
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
): Promise<HandleActionResponse> {
throw new Error('NotImplemented');
}
}
3 changes: 2 additions & 1 deletion libraries/botframework-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
},
"dependencies": {
"uuid": "^8.3.2",
"zod": "~1.11.17"
"zod": "~1.11.17",
"adaptivecards": "1.2.3"
},
"scripts": {
"build": "tsc -b",
Expand Down
3 changes: 3 additions & 0 deletions libraries/botframework-schema/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export { TokenExchangeInvokeResponse } from './tokenExchangeInvokeResponse';
// The Teams schemas was manually added to this library. This file has been updated to export those schemas.
export * from './teams';

// The SharePoint schemas was manually added to this library. This file has been updated to export those schemas.
export * from './sharepoint';

/**
* Attachment View name and size
*/
Expand Down
44 changes: 44 additions & 0 deletions libraries/botframework-schema/src/sharepoint/aceData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

/**
* SharePoint ACE Data object
*/
export interface AceData {
/**
* The card size.
*/
cardSize: AceCardSize;
/**
* The value of this property is stored in the serialized data of the Adaptive Card Extension.
* It can be used to manage versioning of the Adaptive Card Extension.
*
* @remarks - although there is no restriction on the format of this property, it is recommended to use semantic versioning.
*/
dataVersion: string;
/**
* The unique id (Guid) of the ACE.
*/
id: string;
/**
* The title of the ACE.
*/
title: string;
/**
* The icon of the ACE.
*/
iconProperty: string;
/**
* The description of the ACE.
*/
description: string;
/**
* The properties of the ACE.
*/
properties: any;
}

/**
* SharePoint ACE Card Size
*/
export type AceCardSize = 'Medium' | 'Large';
16 changes: 16 additions & 0 deletions libraries/botframework-schema/src/sharepoint/aceRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

/**
* ACE invoke request payload.
*/
export interface AceRequest {
/**
* User ACE request data. Free payload with key-value pairs.
*/
data?: any;
/**
* ACE properties data.
*/
properties?: any;
}
Loading

0 comments on commit a75380e

Please sign in to comment.