Skip to content

Commit

Permalink
Stevenic/merge master (#1413)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Stevenic authored and chon219 committed Nov 14, 2019
1 parent 20f9f57 commit bb7ee4e
Show file tree
Hide file tree
Showing 104 changed files with 7,379 additions and 27,157 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"libraries/botbuilder-dialogs",
"libraries/botbuilder-dialogs-adaptive",
"libraries/botbuilder-dialogs-declarative",
"libraries/botbuilder-lg",
"libraries/botbuilder-testing",
"libraries/botbuilder-lg",
"libraries/botframework-config",
"libraries/botframework-connector",
"libraries/botframework-expressions",
Expand Down
196 changes: 0 additions & 196 deletions libraries/botbuilder-azure/package-lock.json

This file was deleted.

2 changes: 1 addition & 1 deletion libraries/botbuilder-dialogs-adaptive/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@types/node": "^10.12.18",
"botbuilder-core": "~4.1.6",
"botbuilder-dialogs": "~4.1.6",
"botframework-expressions": "~4.5.0",
"botframework-expressions": "~4.1.6",
"botframework-connector": "~4.1.6",
"botframework-schema": "~4.1.6",
"jsonpath": "^1.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class LogAction extends DialogCommand {
const data = Object.assign({
utterance: dc.context.activity.text || ''
}, dc.state, options);
const msg = format(this.template, data);
const msg = format(this.template, dc);

// Log to console and send trace if needed
console.log(msg);
Expand Down
21 changes: 10 additions & 11 deletions libraries/botbuilder-dialogs-adaptive/src/activityProperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import * as stringTemplate from './stringTemplate';

export class ActivityProperty {
private _value: Partial<Activity>|string;
private _textTemplate: (data: object) => string;
private _textTemplate: (dc: DialogContext) => string;
private _speak: string;
private _speakTemplate: (data: object) => string;
private _speakTemplate: (dc: DialogContext) => string;

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

public format(dc: DialogContext, extraData?: object, override?: Partial<Activity>|string): Partial<Activity> {
// Format basic activity
const data = Object.assign({}, dc.state, extraData);
let activity: Partial<Activity>;
if (override) {
activity = this.formatOverride(override, data);
activity = this.formatOverride(override, dc);
} else if (typeof this._value === 'string') {
activity = {
type: ActivityTypes.Message,
text: this._textTemplate(data)
text: this._textTemplate(dc)
}
} else if (typeof this._value === 'object') {
if (this._value.type === ActivityTypes.Message && this._textTemplate) {
activity = Object.assign({}, this._value, {
text: this._textTemplate(data)
text: this._textTemplate(dc)
});
} else {
activity = this._value;
Expand All @@ -89,9 +88,9 @@ export class ActivityProperty {
// Apply speak and inputHints
if (activity.type === ActivityTypes.Message) {
if (activity.speak) {
activity.speak = stringTemplate.format(activity.speak, data);
activity.speak = stringTemplate.format(activity.speak, dc);
} else if (this._speakTemplate) {
activity.speak = this._speakTemplate(data);
activity.speak = this._speakTemplate(dc);
}
if (this.inputHint && !activity.inputHint) {
activity.inputHint = this.inputHint;
Expand All @@ -101,15 +100,15 @@ export class ActivityProperty {
return activity;
}

private formatOverride(override: Partial<Activity>|string, data: object): Partial<Activity> {
private formatOverride(override: Partial<Activity>|string, dc: DialogContext): Partial<Activity> {
if (typeof override === 'string') {
return {
type: ActivityTypes.Message,
text: stringTemplate.format(override, data)
text: stringTemplate.format(override, dc)
};
} else if (override.type === ActivityTypes.Message && override.text) {
return Object.assign({}, override, {
text: stringTemplate.format(override.text, data)
text: stringTemplate.format(override.text, dc)
});
} else {
return override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { RecognizerResult } from 'botbuilder-core';
import { OnDialogEvent } from './onDialogEvent';
import { AdaptiveEventNames, SequenceContext } from '../sequenceContext';
import { DialogEvent, Dialog, DialogContextState } from 'botbuilder-dialogs';
import { DialogEvent, Dialog } from 'botbuilder-dialogs';

/**
* This rule is triggered when a message is received and the recognized intents & entities match a
Expand Down Expand Up @@ -36,7 +35,7 @@ export class OnIntent extends OnDialogEvent {
// Ensure all intents, entities, and properties exist.
const memory = sequence.state;
for(let i = 0; i < this.matches.length; i++) {
const value = DialogContextState.queryMemory(memory, this.matches[i], 1);
const value = sequence.state.getValue(this.matches[i]);
if (!Array.isArray(value) || value.length == 0 || value[0] == undefined) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { DialogContextVisibleState, DialogStateManager } from "botbuilder-dialogs";
import { DialogStateManager } from "botbuilder-dialogs";
import { ExpressionEngine, Expression } from 'botframework-expressions';

export type ExpressionDelegate<T> = (state: DialogContextVisibleState) => T;
export type ExpressionDelegate<T> = (state: object) => T;
export type ExpressionPropertyValue<T> = string|Expression|ExpressionDelegate<T>;

export class ExpressionProperty<T> {
Expand Down Expand Up @@ -40,7 +40,7 @@ export class ExpressionProperty<T> {
this._expression = engine.parse(this._value);
break;
case 'function':
this._expression = Expression.Lambda(this._value);
//this._expression = Expression.Lambda(this._value);
break;
default:
this._expression = this._value;
Expand Down
26 changes: 12 additions & 14 deletions libraries/botbuilder-dialogs-adaptive/src/stringTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import * as jsonpath from 'jsonpath';
import { DialogContextState } from 'botbuilder-dialogs';
import { DialogContext } from 'botbuilder-dialogs';

/**
* @private
Expand All @@ -17,9 +16,9 @@ import { DialogContextState } from 'botbuilder-dialogs';
* any valid JSONPath expression.
* @param template String template to compile.
*/
export function compile(template: string): (data: object) => string {
export function compile(template: string): (dc: DialogContext) => string {
// Break template into chunks.
const chunks: ((data: object) => string)[] = [];
const chunks: ((dc: DialogContext) => string)[] = [];
let buffer = '';
let inSlot = false;
for (let i = 0; i < template.length; i++) {
Expand Down Expand Up @@ -57,9 +56,9 @@ export function compile(template: string): (data: object) => string {
}

// Return stitching function
return (data: object) => {
return (dc: DialogContext) => {
let output = '';
chunks.forEach((fn) => output += fn(data));
chunks.forEach((fn) => output += fn(dc));
return output;
};
}
Expand All @@ -74,18 +73,17 @@ export function compile(template: string): (data: object) => string {
* @param template String template to compile.
* @param data The data used to fill the template slots.
*/
export function format(template: string, data: object): string {
return compile(template)(data);
export function format(template: string, dc: DialogContext): string {
return compile(template)(dc);
}

function textLiteral(buffer: string): (data: object) => string {
return (data) => buffer;
function textLiteral(buffer: string): (dc: DialogContext) => string {
return (dc) => buffer;
}

function textSlot(path: string): (data: object) => string {
path = DialogContextState.resolvePath(path);
return (data) => {
const value = jsonpath.value(data, path);
function textSlot(path: string): (dc: DialogContext) => string {
return (dc) => {
const value = dc.state.getValue(path);
switch (typeof value) {
case 'object':
return JSON.stringify(value);
Expand Down
Loading

0 comments on commit bb7ee4e

Please sign in to comment.