@microsoft/teamsfx 4.0.1-alpha.4de215f0f.0 → 4.0.1-alpha.56d6b6109.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -16
- package/package.json +2 -2
package/README.md
CHANGED
@@ -16,15 +16,15 @@ Use the library to:
|
|
16
16
|
|
17
17
|
> Important: Please be advised that access tokens are stored in sessionStorage for you by default. This can make it possible for malicious code in your app (or code pasted into a console on your page) to access APIs at the same privilege level as your client application. Please ensure you only request the minimum necessary scopes from your client application, and perform any sensitive operations from server side code that your client has to authenticate with.
|
18
18
|
|
19
|
-
TeamsFx SDK is pre-configured in scaffolded project using
|
19
|
+
TeamsFx SDK is pre-configured in scaffolded project using Teams Toolkit extension for Visual Studio and vscode, or the `teamsfx` cli from the `teamsfx-cli` npm package.
|
20
20
|
Please check the [README](https://github.com/OfficeDev/TeamsFx/blob/main/packages/vscode-extension/README.md) to see how to create a Teams App project.
|
21
21
|
|
22
22
|
### Prerequisites
|
23
23
|
|
24
24
|
- Node.js version 18 or higher
|
25
25
|
- PNPM version 8 or higher
|
26
|
-
- A project created by the
|
27
|
-
- If your project has installed
|
26
|
+
- A project created by the Teams Toolkit VS Code extension or `teamsfx` CLI tool.
|
27
|
+
- If your project has installed `botbuilder` related [packages](https://github.com/Microsoft/botbuilder-js#packages) as dependencies, ensure they are of the same version and the version `>= 4.18.0`. ([Issue - all of the BOTBUILDER packages should be the same version](https://github.com/BotBuilderCommunity/botbuilder-community-js/issues/57#issuecomment-508538548))
|
28
28
|
|
29
29
|
### Install the `@microsoft/teamsfx` package
|
30
30
|
|
@@ -437,13 +437,13 @@ const token = appCredential.getToken();
|
|
437
437
|
Add `TeamsBotSsoPrompt` to dialog set.
|
438
438
|
|
439
439
|
```ts
|
440
|
-
|
441
|
-
|
442
|
-
|
440
|
+
const { ConversationState, MemoryStorage } = require("botbuilder");
|
441
|
+
const { DialogSet, WaterfallDialog } = require("botbuilder-dialogs");
|
442
|
+
const {
|
443
443
|
TeamsBotSsoPrompt,
|
444
444
|
OnBehalfOfCredentialAuthConfig,
|
445
445
|
TeamsBotSsoPromptSettings,
|
446
|
-
}
|
446
|
+
} = require("@microsoft/teamsfx");
|
447
447
|
|
448
448
|
const convoState = new ConversationState(new MemoryStorage());
|
449
449
|
const dialogState = convoState.createProperty("dialogState");
|
@@ -596,13 +596,13 @@ Also see [Credential](#Credential) for furthur description.
|
|
596
596
|
|
597
597
|
## How to use SDK implemented with `CloudAdapter`
|
598
598
|
|
599
|
-
From
|
599
|
+
From `botbuilder@4.16.0`, `BotFrameworkAdapter` is deprecated, and `CloudAdapter` is recommended to be used instead. You can import `ConversationBot` from `BotBuilderCloudAdapter` to use the latest SDK implemented with `CloudAdapter`.
|
600
600
|
|
601
|
-
1. Install `@microsoft/teamsfx @^
|
601
|
+
1. Install `@microsoft/teamsfx @^2.2.0`, `botbuilder @^4.18.0`, (and `@types/node @^18.0.0` for TS projects) via `npm install` as follows.
|
602
602
|
|
603
603
|
```sh
|
604
604
|
npm install @microsoft/teamsfx
|
605
|
-
npm install
|
605
|
+
npm install botbuilder
|
606
606
|
|
607
607
|
// For TS projects only
|
608
608
|
npm install --save-dev @types/node
|
@@ -612,17 +612,17 @@ From `@microsoft/teamsfx@4.0.0`, `BotBuilderCloudAdapter` has been renamed to `A
|
|
612
612
|
|
613
613
|
```ts
|
614
614
|
import { HelloWorldCommandHandler } from "../helloworldCommandHandler";
|
615
|
-
import {
|
616
|
-
import ConversationBot =
|
615
|
+
import { BotBuilderCloudAdapter } from "@microsoft/teamsfx";
|
616
|
+
import ConversationBot = BotBuilderCloudAdapter.ConversationBot;
|
617
617
|
import config from "./config";
|
618
618
|
|
619
619
|
export const commandBot = new ConversationBot({
|
620
620
|
// The bot id and password to create CloudAdapter.
|
621
621
|
// See https://aka.ms/about-bot-adapter to learn more about adapters.
|
622
622
|
adapterConfig: {
|
623
|
-
|
624
|
-
|
625
|
-
|
623
|
+
MicrosoftAppId: config.botId,
|
624
|
+
MicrosoftAppPassword: config.botPassword,
|
625
|
+
MicrosoftAppType: "MultiTenant",
|
626
626
|
},
|
627
627
|
command: {
|
628
628
|
enabled: true,
|
@@ -665,13 +665,50 @@ From `@microsoft/teamsfx@4.0.0`, `BotBuilderCloudAdapter` has been renamed to `A
|
|
665
665
|
});
|
666
666
|
```
|
667
667
|
|
668
|
+
5. If the project has `responseWrapper.ts`, please update the class `responseWrapper` to the class below.
|
669
|
+
|
670
|
+
```ts
|
671
|
+
import { Response } from "botbuilder";
|
672
|
+
|
673
|
+
// A wrapper to convert Azure Functions Response to Bot Builder's Response.
|
674
|
+
export class ResponseWrapper implements Response {
|
675
|
+
socket: any;
|
676
|
+
originalResponse?: any;
|
677
|
+
headers?: any;
|
678
|
+
body?: any;
|
679
|
+
|
680
|
+
constructor(functionResponse?: { [key: string]: any }) {
|
681
|
+
this.socket = undefined;
|
682
|
+
this.originalResponse = functionResponse;
|
683
|
+
}
|
684
|
+
|
685
|
+
end(...args: any[]) {
|
686
|
+
// do nothing since res.end() is deprecated in Azure Functions.
|
687
|
+
}
|
688
|
+
|
689
|
+
header(name: string, value: any) {
|
690
|
+
this.headers[name] = value;
|
691
|
+
}
|
692
|
+
|
693
|
+
send(body: any) {
|
694
|
+
// record the body to be returned later.
|
695
|
+
this.body = body;
|
696
|
+
this.originalResponse.body = body;
|
697
|
+
}
|
698
|
+
status(status: number) {
|
699
|
+
// call Azure Functions' res.status().
|
700
|
+
return this.originalResponse?.status(status);
|
701
|
+
}
|
702
|
+
}
|
703
|
+
```
|
704
|
+
|
668
705
|
## Next steps
|
669
706
|
|
670
707
|
Please take a look at the [Samples](https://github.com/OfficeDev/TeamsFx-Samples) project for detailed examples on how to use this library.
|
671
708
|
|
672
709
|
## Related projects
|
673
710
|
|
674
|
-
- [Microsoft
|
711
|
+
- [Microsoft Teams Toolkit for Visual Studio Code](https://github.com/OfficeDev/TeamsFx/tree/main/packages/vscode-extension)
|
675
712
|
- [TeamsFx Cli](https://github.com/OfficeDev/TeamsFx/tree/main/packages/cli)
|
676
713
|
|
677
714
|
## Data Collection.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@microsoft/teamsfx",
|
3
|
-
"version": "4.0.1-alpha.
|
3
|
+
"version": "4.0.1-alpha.56d6b6109.0",
|
4
4
|
"description": "Microsoft Teams Framework for Node.js and browser.",
|
5
5
|
"main": "dist/index.node.cjs.js",
|
6
6
|
"browser": "dist/index.esm2017.js",
|
@@ -140,7 +140,7 @@
|
|
140
140
|
"webpack": "^5.62.1",
|
141
141
|
"yargs": "^17.2.1"
|
142
142
|
},
|
143
|
-
"gitHead": "
|
143
|
+
"gitHead": "73564a94dac979da08529e51fcd6e209a7475c99",
|
144
144
|
"publishConfig": {
|
145
145
|
"access": "public"
|
146
146
|
},
|