@microsoft/teamsfx 4.0.1-alpha.994ca2892.0 → 4.0.1-alpha.b38cae5e8.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.
Files changed (2) hide show
  1. package/README.md +53 -16
  2. 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 Microsoft 365 Agents Toolkit extension for Visual Studio and vscode, or the `atk` cli from the `@microsoft/m365agentstoolkit-cli` npm package.
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 Microsoft 365 Agents Toolkit VS Code extension or `atk` CLI tool.
27
- - If your project has installed `@microsoft/agents-hosting` related [packages](https://github.com/microsoft/Agents-for-js) as dependencies, ensure they are of the same version.
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
- import { ConversationState, MemoryStorage } from "@microsoft/agents-hosting";
441
- import { DialogSet, WaterfallDialog } from "@microsoft/agents-hosting-dialogs";
442
- import {
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
- } from "@microsoft/teamsfx";
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 `@microsoft/teamsfx@4.0.0`, `BotBuilderCloudAdapter` has been renamed to `AgentBuilderCloudAdapter`. You can import `ConversationBot` from `AgentBuilderCloudAdapter` to use the latest SDK implemented with `CloudAdapter`.
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 @^4.0.0`, `@microsoft/agents-hosting @^0.2.14`, (and `@types/node @^18.0.0` for TS projects) via `npm install` as follows.
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 @microsoft/agents-hosting@^0.2.14
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 { AgentBuilderCloudAdapter } from "@microsoft/teamsfx";
616
- import ConversationBot = AgentBuilderCloudAdapter.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
- clientId: config.MicrosoftAppId,
624
- clientSecret: config.MicrosoftAppPassword,
625
- issuers: [],
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 Microsoft 365 Agents Toolkit for Visual Studio Code](https://github.com/OfficeDev/TeamsFx/tree/main/packages/vscode-extension)
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.994ca2892.0",
3
+ "version": "4.0.1-alpha.b38cae5e8.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": "83caa99f739c05ff5bce4a7910b8a11f561359f9",
143
+ "gitHead": "e8e7f11e8dceffbd8ceecceffd7289adb262bae2",
144
144
  "publishConfig": {
145
145
  "access": "public"
146
146
  },