Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/elliptic-6.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ceciliaavila committed Oct 31, 2024
2 parents bef74a8 + 2bdedaa commit 55ea841
Show file tree
Hide file tree
Showing 44 changed files with 1,326 additions and 2,139 deletions.
29 changes: 0 additions & 29 deletions libraries/adaptive-expressions-ie11/babel.config.js

This file was deleted.

23 changes: 3 additions & 20 deletions libraries/adaptive-expressions-ie11/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,11 @@
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"dependencies": {
"adaptive-expressions": "4.1.6",
"clean-webpack-plugin": "^4.0.0",
"core-js": "^3.38.1",
"eslint-plugin-only-warn": "^1.1.0",
"terser-webpack-plugin": "^5.3.10"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.24.7",
"@babel/plugin-transform-runtime": "^7.25.4",
"@babel/preset-env": "^7.25.4",
"@babel/preset-typescript": "^7.24.7",
"@babel/runtime": "^7.25.4",
"babel-loader": "^9.1.3",
"ts-loader": "^9.5.1",
"typescript": "~4.7",
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4"
"adaptive-expressions": "4.1.6"
},
"scripts": {
"build": "webpack",
"build": "npm-run-all clean build:browser",
"build:browser": "tsup --config ../../tsup/browser.config.ts --define.outfile dist/index.js --dts",
"clean": "rimraf dist",
"lint": "eslint ."
},
Expand Down
1 change: 0 additions & 1 deletion libraries/adaptive-expressions-ie11/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../adaptive-expressions/tsconfig.json",
"compilerOptions": {
"target": "es5",
"outDir": "dist",
"rootDir": "./src"
},
Expand Down
55 changes: 0 additions & 55 deletions libraries/adaptive-expressions-ie11/webpack.config.js

This file was deleted.

27 changes: 0 additions & 27 deletions libraries/adaptive-expressions/babel.config.js

This file was deleted.

7 changes: 4 additions & 3 deletions libraries/adaptive-expressions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@
"typescript": "~4.7"
},
"scripts": {
"build": "npm-run-all build:src build:tests build:browser",
"build:src": "tsc -b",
"build:tests": "tsc -p tests/tsconfig.json",
"build": "npm-run-all build:src build:tests",
"browserify": "browserify lib/browser.js -s AEL --debug -p esmify -t [ babelify --extensions .js,.mjs --global ] | exorcist lib/browser.js.map | sponge lib/browser.js",
"postbuild": "rimraf --glob lib/browser.* && shx cp lib/index.js lib/browser.js && yarn browserify",
"build:browser": "npm-run-all build:browser:clean build:browser:run",
"build:browser:clean": "rimraf --glob lib/browser.*",
"build:browser:run": "tsup --config ../../tsup/browser.config.ts",
"clean": "rimraf lib tsconfig.tsbuildinfo",
"depcheck": "depcheck --config ../../.depcheckrc --ignores sinon,@types/xmldom",
"build-docs": "typedoc --theme markdown --entryPoint adaptive-expressions --excludePrivate --includeDeclarations --ignoreCompilerErrors --module amd --out ..\\..\\doc\\adaptive-expressions .\\lib\\index.d.ts --hideGenerator --name \"Bot Builder SDK - Expression\" --readme none",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ export async function makeApp(
const adapter = services.mustMakeInstance<BotFrameworkHttpAdapter>('adapter');

try {
// TODO: Fix INodeSocket type. Related issue https://github.com/microsoft/botbuilder-js/issues/4684.
await adapter.process(req, socket as any, head, async (context) => {
await adapter.process(req, socket, head, async (context) => {
await bot.run(context);
});
} catch (err: any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ export async function makeServer(
const adapter = services.mustMakeInstance<BotFrameworkHttpAdapter>('adapter');

try {
// TODO: Fix INodeSocket type. Related issue https://github.com/microsoft/botbuilder-js/issues/4684.
await adapter.process(req, socket as any, head, async (context) => {
await adapter.process(req, socket, head, async (context) => {
await bot.run(context);
});
} catch (err: any) {
Expand Down
65 changes: 33 additions & 32 deletions libraries/botbuilder-dialogs/src/skillDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
ConversationReference,
DeliveryModes,
ExpectedReplies,
ExtendedUserTokenProvider,
OAuthCard,
SkillConversationIdFactoryOptions,
StatusCodes,
Expand All @@ -30,6 +29,7 @@ import { DialogContext } from './dialogContext';
import { DialogEvents } from './dialogEvents';
import { SkillDialogOptions } from './skillDialogOptions';
import { TurnPath } from './memory/turnPath';
import * as UserTokenAccess from './prompts/userTokenAccess';

/**
* A specialized Dialog that can wrap remote calls to a skill.
Expand Down Expand Up @@ -333,45 +333,46 @@ export class SkillDialog extends Dialog<Partial<BeginSkillDialogOptions>> {
activity: Activity,
connectionName: string
): Promise<boolean> {
if (!connectionName || !('exchangeToken' in context.adapter)) {
// The adapter may choose not to support token exchange, in which case we fallback to showing skill's OAuthCard to the user.
if (!connectionName) {
return false;
}

const oAuthCardAttachment: Attachment = (activity.attachments || []).find(
(c) => c.contentType === CardFactory.contentTypes.oauthCard
);
if (oAuthCardAttachment) {
const tokenExchangeProvider: ExtendedUserTokenProvider = (context.adapter as unknown) as ExtendedUserTokenProvider;
const oAuthCard: OAuthCard = oAuthCardAttachment.content;

const uri = oAuthCard && oAuthCard.tokenExchangeResource && oAuthCard.tokenExchangeResource.uri;
if (uri) {
try {
const result: TokenResponse = await tokenExchangeProvider.exchangeToken(
context,
connectionName,
context.activity.from.id,
{ uri }
);

if (result && result.token) {
// If token above is null or undefined, then SSO has failed and we return false.
// If not, send an invoke to the skill with the token.
return await this.sendTokenExchangeInvokeToSkill(
activity,
oAuthCard.tokenExchangeResource.id,
oAuthCard.connectionName,
result.token
);
}
} catch {
// Failures in token exchange are not fatal. They simply mean that the user needs to be shown the skill's OAuthCard.
return false;
}
if (!oAuthCardAttachment) {
return false;
}

const oAuthCard: OAuthCard = oAuthCardAttachment.content;
const uri = oAuthCard && oAuthCard.tokenExchangeResource && oAuthCard.tokenExchangeResource.uri;

if (!uri) {
return false;
}

try {
const result: TokenResponse = await UserTokenAccess.exchangeToken(
context,
{ title: 'Sign In', connectionName: connectionName },
{ uri }
);

if (!result || !result.token) {
// If token above is null or undefined, then SSO has failed and we return false.
return false;
}
// If not, send an invoke to the skill with the token.
return await this.sendTokenExchangeInvokeToSkill(
activity,
oAuthCard.tokenExchangeResource.id,
oAuthCard.connectionName,
result.token
);
} catch {
// Failures in token exchange are not fatal. They simply mean that the user needs to be shown the skill's OAuthCard.
return false;
}
return false;
}

/**
Expand Down
3 changes: 3 additions & 0 deletions libraries/botbuilder/etc/botbuilder.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { HttpClient } from '@azure/core-http';
import { HttpOperationResponse } from '@azure/core-http';
import { ICredentialProvider } from 'botframework-connector';
import { INodeBuffer } from 'botframework-streaming';
import { INodeDuplex } from 'botframework-streaming';
import { INodeSocket } from 'botframework-streaming';
import { InvokeResponse } from 'botbuilder-core';
import { IReceiveRequest } from 'botframework-streaming';
Expand Down Expand Up @@ -187,6 +188,7 @@ export interface BotFrameworkAdapterSettings {
export interface BotFrameworkHttpAdapter {
process(req: Request_2, res: Response_2, logic: (context: TurnContext) => Promise<void>): Promise<void>;
process(req: Request_2, socket: INodeSocket, head: INodeBuffer, logic: (context: TurnContext) => Promise<void>): Promise<void>;
process(req: Request_2, socket: INodeDuplex, head: INodeBuffer, logic: (context: TurnContext) => Promise<void>): Promise<void>;
}

// @public @deprecated (undocumented)
Expand Down Expand Up @@ -250,6 +252,7 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd
connectNamedPipe(pipeName: string, logic: (context: TurnContext) => Promise<void>, appId: string, audience: string, callerId?: string, retryCount?: number): Promise<void>;
process(req: Request_2, res: Response_2, logic: (context: TurnContext) => Promise<void>): Promise<void>;
process(req: Request_2, socket: INodeSocket, head: INodeBuffer, logic: (context: TurnContext) => Promise<void>): Promise<void>;
process(req: Request_2, socket: INodeDuplex, head: INodeBuffer, logic: (context: TurnContext) => Promise<void>): Promise<void>;
processActivityDirect(authorization: string | AuthenticateRequestResult, activity: Activity, logic: (context: TurnContext) => Promise<void>): Promise<void>;
}

Expand Down
13 changes: 12 additions & 1 deletion libraries/botbuilder/src/botFrameworkHttpAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import type { INodeBuffer, INodeSocket } from 'botframework-streaming';
import type { INodeBuffer, INodeDuplex, INodeSocket } from 'botframework-streaming';
import type { Request, Response } from './interfaces';
import type { TurnContext } from 'botbuilder-core';

Expand All @@ -26,4 +26,15 @@ export interface BotFrameworkHttpAdapter {
head: INodeBuffer,
logic: (context: TurnContext) => Promise<void>
): Promise<void>;

/**
* Handle a web socket connection by applying a logic callback function to
* each streaming request.
*/
process(
req: Request,
socket: INodeDuplex,
head: INodeBuffer,
logic: (context: TurnContext) => Promise<void>
): Promise<void>;
}
20 changes: 19 additions & 1 deletion libraries/botbuilder/src/cloudAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
import {
INodeBuffer,
INodeSocket,
INodeDuplex,
IReceiveRequest,
IReceiveResponse,
IStreamingTransportServer,
Expand Down Expand Up @@ -80,12 +81,29 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd
logic: (context: TurnContext) => Promise<void>
): Promise<void>;

/**
* 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 [INodeDuplex](xref:botframework-streaming.INodeDuplex)
* @param head The corresponding [INodeBuffer](xref:botframework-streaming.INodeBuffer)
* @param logic The logic function to apply
* @returns a promise representing the asynchronous operation.
*/
async process(
req: Request,
socket: INodeDuplex,
head: INodeBuffer,
logic: (context: TurnContext) => Promise<void>
): Promise<void>;

/**
* @internal
*/
async process(
req: Request,
resOrSocket: Response | INodeSocket,
resOrSocket: Response | INodeSocket | INodeDuplex,
logicOrHead: ((context: TurnContext) => Promise<void>) | INodeBuffer,
maybeLogic?: (context: TurnContext) => Promise<void>
): Promise<void> {
Expand Down
1 change: 0 additions & 1 deletion libraries/botframework-connector/esbuild.inject.js

This file was deleted.

Loading

0 comments on commit 55ea841

Please sign in to comment.