Skip to content

Commit 48fa038

Browse files
authored
Stevenic/merge master (#1413)
* Add IReceiveResponse to exports * Finish updating turnContext.ts * add reply to channel bot (#1269) * delete unused packages, update lerna & package.jsons * Fix names of Messaging Extension projects (#1272) * add tests and mocks for TeamsInfo (#1274) * Merging in changes from pr 1102 * Type definition fix: OAuthPromptState (#1157) * Change PromptState.state type to `any` - Fixes #1155 Fix of #1155 * fix typedoc vulnerability * delete unused doc references * Add some tests for teamsCreateConversation * synced with new dotnet changes * added all tests * + copyright * touch * [Teams] Lint Teams scenarios, minor refactor (#1283) * add tslint.json, lint actionBasedMessagingExtension * lint actionBasedMessagingExtension-fetchTask * refactor actionBasedMessagingExtension index.ts files * lint activityUpdateAndDelete * lint AdaptiveCards * lint cardBotframework scenario * added test recordings * disable failure if no emulator * added no emulator warning * Tests and changes * more tests * oauthcard tests * [Teams] add more TeamsInfo tests (#1275) * add more TeamsInfo tests * update TeamsActivityHandler, add tests * implemented @christopheranderson suggestions * DNM: test to see if recordings used by pipeline * DNM: try again * fixed test recordings * added comment for instanceId replacement * Let WebSocketClient take in a disconnection callback * relax the rules for what counts as a well formed guid * Streaming: Rename botframework-streaming-extensions -> botframework-streaming * Streaming: Move BotFrameworkStreamingAdapter to botbuilder module * Streaming: integrate streaming into botFrameworkAdapter though useWebSocket and useNamedPipe methods * move nock to devDependency (#1297) * Streaming: temporary move for lower case folders * add test for nil guid header id * Streaming: directory casing rename part 2 * Streaming: directory renaming last part * simplified upsert call * Streaming: rename all files and references to proper casing * Streaming: reference streaming without the 'lib' postfix * normalize azure blob timestamp properties to be iso1806 format 2018-12-31T00:00:00.000Z * remove console debug statement in unit test * Removing unused libraries (#1298) * removing browser-compat libs (#1300) * add TeamsActivityHandler BadRequest tests * add Teams ConversationUpdate tests * add TeamsActivityHandler NotImplemented tests * change typing and name of param in onTeamsMessagingExtensionFetchTask * Streaming: Javascript style comments and documentation * Streaming: Remove unnecessary logger, use http response and body to report error info * Streaming: fix quotes * Streaming: Improve comments and error messages * Streaming: refactor StreamingHttpClient to a separate file * Streaming: update tests to richer error messages * Streaming: add more validations and test fixes * Streaming: remove obsolete package from lerna.json and fix documentation refs * Change ts compiler output from es5 to es6 * Transfer integration bot to js repo * [Teams] Part of Teams Hackathon Feedback (#1308) * add more TeamsInfo tests * add more tests, clean lint, fix bugs, add missing method * TeamsActivityHandler.onTurnActivity() doesn't stamp over InvokeResponses * onTeamsTaskModuleFetch & onTeamsTaskModuleSubmit send a TaskModuleResponse * fix adaptive cards bot * fix taskModuleBot * fix messagingExtensionAuthBot * [Teams] Add teamsTenantFilteringMiddleware to roster bot scenario (#1311) * add teamsTenantFilteringMiddleware to roster bot scenario * fix curly braces * Missing link unfurling scenario (#1313) * added linkunfurling back * updated code to match update on handler * Addressed PR comments from stevengum * Hide WebSocket connection behind ProcessActivity * Change ProcessActivity to accept Union Types and introduce Type Guard to determine if a Request has been passed in. * Better name. Maybe. * [Teams] Rename onTeams*-Invoke methods to handleTeams*, add TeamsInfo.getTeamMembers (#1315) * add getTeamMembers, add teamsId as parameter in TeamsInfo.getTeam*() * rename onTeams*-Invoke methods to handleTeams* * Adds createChildContext method to ComponentDialog * Update manifest.json combined manifest * Streaming: remove isFromStreamingConnection out of TurnContext since it will need to be there forever. duplicating for now. We'll unify in 4.7 along with other refactors * Import directly from library instead of third hand * fix WebSocketServer.onConnectionDisconnected, fix in StreamingAdapter tests * move isFromStreamingConnection() tests to BFStreamingAdapter tests * fix bug in processRequest() * Remove library specific implementation of websocket handling * revert changing protecteds to privates * Further cleanup websocket connection * Update tests * Remove no longer used import * Use const GET instead of string GET * fix removed internal export * Final fixes to websocket connection for DLS compatibility. * merge scenarios * WIP, part way through dialogContext.ts * Fix malformatted user agent JSON * Add recording support for Roster API * Fix proxy to support Roster calls * Fix manifest domains * updated bot with more scenarios * Update integrationBot.ts removed bad lines * Finish updating DialogContext * added BF cards + conversationupdate * Add all settings for VSCode debugger * added messagereactionbot * added office365card * Update activityHandler.ts WIP * added roster * added searchbasedmessagingextension scenario * [Streaming] create NodeWebSocketFactory, refactor code, new tests (#1331) * create NodeWebSocketFactory, refactor code, new tests * Set connected to true after connecting. * Fix missing ActivityLog * Update README for script, add initial recordings, cleanup nock helper * Fix validation for post. * Add channel add and delete events. Add more comments to nock-helper * Add member add-remove from groupchat, more cleanup for nock-helper * More updates * [Streaming] Add working ws websocket implementation for Node environment (#1334) * add working ws websocket impl * remove unused constants * More scenarios * Update typeDoc comments for ActivityHandler and ActivityHandlerBase * More updates * minor refactoring fileupload bot and added file handler for integration bot * removed console.log * Update README.md * updated readme/manifest * Update manifest.json * Updating all libraries to output es6 * copy edits * QnaMaker: Rename Prompt -> QnAMakerPrompt * added task module invocation, updated readme * added promptCultureModels - parity w/ dotnet * fixed tests * added tests for custom defaultChoices * removed unnecessary overrides * update root package.json, streaming package.json * [Streaming] Auth and browser compatibility fixes, linting, refactoring (#1338) * patch auth in streaming to send token to channel * apply PR feedback for BotFrameworkAdapter * move ws server construction to wsNodeWebSocket constructor for browser compat * cleanup and cache serviceUrl in authenticateConnection * drop teams specific send * Finish updating typeDoc comments for dialogContext.ts * expand ChannelAccount to TeamsChannelAccount * [Streaming] Pull out streaming bits from botbuilder and move to botframework-streaming (#1348) * cleanup bf-streaming package.json * move streaming code and tests to botframework-streaming * remove @azure/ms-rest-js dependency from botbuilder * Update cardFactory.ts Update hero card helper to add optional tap parameter * cr fk * updated searchbased scenario to match c# (with tap/select handler) * final update updated integrationbot with searchbasedmessaging extension handlers and updated manifest for file upload bot (works only in personal chat) * Update README.md * set bot id to empty guid per andrew's request * helper to send a trace activity (#1355) * added local teamsCreateConversation helper (#1357) * [QnAMaker] Active learning low score variation multiplier value (#1359) Active learning low score variation multiplier value - PreviousLowScoreVariationMultiplier to 0.7 - MaxLowScoreVariationMultiplier to 1.0 * Fixed passing of CosmosClientOptions * add random to transcript generated ids and set sent activity.id (#1344) * add random to transcript generated ids and set sent activity.id * cleanup and add test * always set activity.id to resourceResponse.id in logger when present * added test for CosmosClientOptions * updated test recordings * remove .js and .ts from .gitignore, change *.map to *.js.map (#1365) * Fix integrationBot to match C# (#1379) * remove typescript devDependency and engine from bf-streaming (#1392) * [Teams] Call defaultNextEvent after .invoke activity is processed (#1390) * call defaultNextEvent after .invoke activity is processed * call the method returned from defaultNextEvent, and add unit test * Add LG/Expression library (#1381) * init lg library * refine code * fix deploy error * fix test coverage * remove xPath and xml functions (#1385) * [expression] add capability of handling null in string related built-in functions (#1395) * handling null in string related builtin functions * remove redundent character * remove tslint * fix errors and warnings with eslint * fix ChoicePrompt none style when set via options (#1373) * Add Botbuilder-lg to version update command * Update package.json * Update package.json * Update package.json * Parity ChoicePrompt fix with dotnet (#1400) * parity ChoicePrompt fix with dotnet * added confirmPrompt test for null locale * Stevenic/4.6 dialog parity (#1384) * Added new DialogStateManager * Added defaultValue to getValue * Added state manager tests * Latest changes * Ported DialogStateManager from C3 * More robust path parsing... * Added event emitting support Also implemented logic to cascade cancel to parent dialogs * Updated dialog set to support auto id's and dependencies also replaced "null" with "undefined" htroughout code * Updated unit tests * Added unit test for scopes and path resolvers Fixed issues as detected. * Added a bunch of dialog state tests * Added additional unit tests - Increased code coverage for DialogStateManager - Fixed issue detected from unit tests. * Tweaked settings test * Made DialogContainer.dialogs public * Fixed code review comment. * update package.json (#1402) * [Functional-test] Add chrome browser functional tests (#1389) * Add browser-functional-tests - Add browser echo-bot sample - Setup Nightwatch to run with Chrome - Add script to run the tests * Add copyright headers * Add missing async * Fixed build breaks from merge
1 parent b4c7a86 commit 48fa038

File tree

104 files changed

+7379
-27157
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+7379
-27157
lines changed

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"libraries/botbuilder-dialogs",
1111
"libraries/botbuilder-dialogs-adaptive",
1212
"libraries/botbuilder-dialogs-declarative",
13-
"libraries/botbuilder-lg",
1413
"libraries/botbuilder-testing",
14+
"libraries/botbuilder-lg",
1515
"libraries/botframework-config",
1616
"libraries/botframework-connector",
1717
"libraries/botframework-expressions",

libraries/botbuilder-azure/package-lock.json

Lines changed: 0 additions & 196 deletions
This file was deleted.

libraries/botbuilder-dialogs-adaptive/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@types/node": "^10.12.18",
3131
"botbuilder-core": "~4.1.6",
3232
"botbuilder-dialogs": "~4.1.6",
33-
"botframework-expressions": "~4.5.0",
33+
"botframework-expressions": "~4.1.6",
3434
"botframework-connector": "~4.1.6",
3535
"botframework-schema": "~4.1.6",
3636
"jsonpath": "^1.0.0"

libraries/botbuilder-dialogs-adaptive/src/actions/logAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class LogAction extends DialogCommand {
6262
const data = Object.assign({
6363
utterance: dc.context.activity.text || ''
6464
}, dc.state, options);
65-
const msg = format(this.template, data);
65+
const msg = format(this.template, dc);
6666

6767
// Log to console and send trace if needed
6868
console.log(msg);

libraries/botbuilder-dialogs-adaptive/src/activityProperty.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import * as stringTemplate from './stringTemplate';
1111

1212
export class ActivityProperty {
1313
private _value: Partial<Activity>|string;
14-
private _textTemplate: (data: object) => string;
14+
private _textTemplate: (dc: DialogContext) => string;
1515
private _speak: string;
16-
private _speakTemplate: (data: object) => string;
16+
private _speakTemplate: (dc: DialogContext) => string;
1717

1818
public get displayLabel(): string {
1919
if (typeof this._value === 'object') {
@@ -65,19 +65,18 @@ export class ActivityProperty {
6565

6666
public format(dc: DialogContext, extraData?: object, override?: Partial<Activity>|string): Partial<Activity> {
6767
// Format basic activity
68-
const data = Object.assign({}, dc.state, extraData);
6968
let activity: Partial<Activity>;
7069
if (override) {
71-
activity = this.formatOverride(override, data);
70+
activity = this.formatOverride(override, dc);
7271
} else if (typeof this._value === 'string') {
7372
activity = {
7473
type: ActivityTypes.Message,
75-
text: this._textTemplate(data)
74+
text: this._textTemplate(dc)
7675
}
7776
} else if (typeof this._value === 'object') {
7877
if (this._value.type === ActivityTypes.Message && this._textTemplate) {
7978
activity = Object.assign({}, this._value, {
80-
text: this._textTemplate(data)
79+
text: this._textTemplate(dc)
8180
});
8281
} else {
8382
activity = this._value;
@@ -89,9 +88,9 @@ export class ActivityProperty {
8988
// Apply speak and inputHints
9089
if (activity.type === ActivityTypes.Message) {
9190
if (activity.speak) {
92-
activity.speak = stringTemplate.format(activity.speak, data);
91+
activity.speak = stringTemplate.format(activity.speak, dc);
9392
} else if (this._speakTemplate) {
94-
activity.speak = this._speakTemplate(data);
93+
activity.speak = this._speakTemplate(dc);
9594
}
9695
if (this.inputHint && !activity.inputHint) {
9796
activity.inputHint = this.inputHint;
@@ -101,15 +100,15 @@ export class ActivityProperty {
101100
return activity;
102101
}
103102

104-
private formatOverride(override: Partial<Activity>|string, data: object): Partial<Activity> {
103+
private formatOverride(override: Partial<Activity>|string, dc: DialogContext): Partial<Activity> {
105104
if (typeof override === 'string') {
106105
return {
107106
type: ActivityTypes.Message,
108-
text: stringTemplate.format(override, data)
107+
text: stringTemplate.format(override, dc)
109108
};
110109
} else if (override.type === ActivityTypes.Message && override.text) {
111110
return Object.assign({}, override, {
112-
text: stringTemplate.format(override.text, data)
111+
text: stringTemplate.format(override.text, dc)
113112
});
114113
} else {
115114
return override;

libraries/botbuilder-dialogs-adaptive/src/conditions/onIntent.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
* Copyright (c) Microsoft Corporation. All rights reserved.
66
* Licensed under the MIT License.
77
*/
8-
import { RecognizerResult } from 'botbuilder-core';
98
import { OnDialogEvent } from './onDialogEvent';
109
import { AdaptiveEventNames, SequenceContext } from '../sequenceContext';
11-
import { DialogEvent, Dialog, DialogContextState } from 'botbuilder-dialogs';
10+
import { DialogEvent, Dialog } from 'botbuilder-dialogs';
1211

1312
/**
1413
* This rule is triggered when a message is received and the recognized intents & entities match a
@@ -36,7 +35,7 @@ export class OnIntent extends OnDialogEvent {
3635
// Ensure all intents, entities, and properties exist.
3736
const memory = sequence.state;
3837
for(let i = 0; i < this.matches.length; i++) {
39-
const value = DialogContextState.queryMemory(memory, this.matches[i], 1);
38+
const value = sequence.state.getValue(this.matches[i]);
4039
if (!Array.isArray(value) || value.length == 0 || value[0] == undefined) {
4140
return false;
4241
}

libraries/botbuilder-dialogs-adaptive/src/expressionProperty.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
* Copyright (c) Microsoft Corporation. All rights reserved.
77
* Licensed under the MIT License.
88
*/
9-
import { DialogContextVisibleState, DialogStateManager } from "botbuilder-dialogs";
9+
import { DialogStateManager } from "botbuilder-dialogs";
1010
import { ExpressionEngine, Expression } from 'botframework-expressions';
1111

12-
export type ExpressionDelegate<T> = (state: DialogContextVisibleState) => T;
12+
export type ExpressionDelegate<T> = (state: object) => T;
1313
export type ExpressionPropertyValue<T> = string|Expression|ExpressionDelegate<T>;
1414

1515
export class ExpressionProperty<T> {
@@ -40,7 +40,7 @@ export class ExpressionProperty<T> {
4040
this._expression = engine.parse(this._value);
4141
break;
4242
case 'function':
43-
this._expression = Expression.Lambda(this._value);
43+
//this._expression = Expression.Lambda(this._value);
4444
break;
4545
default:
4646
this._expression = this._value;

libraries/botbuilder-dialogs-adaptive/src/stringTemplate.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
* Copyright (c) Microsoft Corporation. All rights reserved.
66
* Licensed under the MIT License.
77
*/
8-
import * as jsonpath from 'jsonpath';
9-
import { DialogContextState } from 'botbuilder-dialogs';
8+
import { DialogContext } from 'botbuilder-dialogs';
109

1110
/**
1211
* @private
@@ -17,9 +16,9 @@ import { DialogContextState } from 'botbuilder-dialogs';
1716
* any valid JSONPath expression.
1817
* @param template String template to compile.
1918
*/
20-
export function compile(template: string): (data: object) => string {
19+
export function compile(template: string): (dc: DialogContext) => string {
2120
// Break template into chunks.
22-
const chunks: ((data: object) => string)[] = [];
21+
const chunks: ((dc: DialogContext) => string)[] = [];
2322
let buffer = '';
2423
let inSlot = false;
2524
for (let i = 0; i < template.length; i++) {
@@ -57,9 +56,9 @@ export function compile(template: string): (data: object) => string {
5756
}
5857

5958
// Return stitching function
60-
return (data: object) => {
59+
return (dc: DialogContext) => {
6160
let output = '';
62-
chunks.forEach((fn) => output += fn(data));
61+
chunks.forEach((fn) => output += fn(dc));
6362
return output;
6463
};
6564
}
@@ -74,18 +73,17 @@ export function compile(template: string): (data: object) => string {
7473
* @param template String template to compile.
7574
* @param data The data used to fill the template slots.
7675
*/
77-
export function format(template: string, data: object): string {
78-
return compile(template)(data);
76+
export function format(template: string, dc: DialogContext): string {
77+
return compile(template)(dc);
7978
}
8079

81-
function textLiteral(buffer: string): (data: object) => string {
82-
return (data) => buffer;
80+
function textLiteral(buffer: string): (dc: DialogContext) => string {
81+
return (dc) => buffer;
8382
}
8483

85-
function textSlot(path: string): (data: object) => string {
86-
path = DialogContextState.resolvePath(path);
87-
return (data) => {
88-
const value = jsonpath.value(data, path);
84+
function textSlot(path: string): (dc: DialogContext) => string {
85+
return (dc) => {
86+
const value = dc.state.getValue(path);
8987
switch (typeof value) {
9088
case 'object':
9189
return JSON.stringify(value);

0 commit comments

Comments
 (0)