Skip to content

Commit

Permalink
Merge branch 'leugene/issue4599' of https://github.com/microsoft/BotF…
Browse files Browse the repository at this point in the history
…ramework-Composer into leugene/issue4599
  • Loading branch information
LouisEugeneMSFT committed Nov 2, 2020
2 parents 6d0e5c6 + a304d1f commit c0bceb3
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 142 deletions.
2 changes: 1 addition & 1 deletion Composer/cypress/integration/NotificationPage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ context('Notification Page', () => {
cy.findByTestId('LeftNav-CommandBarButtonNotifications').click();

cy.findByTestId('notifications-table-view').within(() => {
cy.findAllByText('__testtodobotwithluissample.en-us.lu').should('exist').first().dblclick();
cy.findAllByText('__TestToDoBotWithLuisSample.en-us.lu').should('exist').first().dblclick();
});

cy.findAllByText('__TestToDoBotWithLuisSample').should('exist');
Expand Down
2 changes: 0 additions & 2 deletions Composer/cypress/integration/ToDoBot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ context('ToDo Bot', () => {
before(() => {
cy.visit('/home');
cy.createBot('TodoSample');
cy.findByTestId('WelcomeModalCloseIcon').click();
cy.findByText('Yes').click();
});

it('can open the main dialog', () => {
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/lib/indexers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"rimraf": "^2.6.3"
},
"dependencies": {
"@microsoft/bf-lu": "^4.11.0-dev.20201025.69cf2b9",
"@microsoft/bf-lu": "^4.11.0-rc.20201030.a9f9b96",
"adaptive-expressions": "^4.11.0-dev.20201013.d5458bf",
"botbuilder-lg": "4.11.0-dev.20201010.6e4a99e",
"lodash": "^4.17.19"
Expand Down
3 changes: 1 addition & 2 deletions Composer/packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@
"@bfc/lu-languageserver": "*",
"@bfc/shared": "*",
"@microsoft/bf-dispatcher": "^4.11.0-beta.20201016.393c6b2",
"@microsoft/bf-lu": "^4.11.0-rc.20201028.6f4722f",
"@microsoft/bf-generate-library": "^4.10.0-daily.20201026.178799",
"@microsoft/bf-orchestrator": "4.11.0-beta.20201013.20d7917",
"@microsoft/bf-lu": "^4.11.0-rc.20201030.a9f9b96",
"archiver": "^5.0.2",
"axios": "^0.19.2",
"azure-storage": "^2.10.3",
Expand Down
36 changes: 19 additions & 17 deletions Composer/packages/server/src/models/bot/botProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ export class BotProject implements IBotProject {
return files;
}

public get rootDialogId() {
const mainDialogFile = this.dialogFiles.find((file) => !file.relativePath.includes('/'));

return Path.basename(mainDialogFile?.name ?? '', '.dialog');
}

public get formDialogSchemaFiles() {
const files: FileInfo[] = [];
this.files.forEach((file) => {
Expand Down Expand Up @@ -350,24 +356,20 @@ export class BotProject implements IBotProject {
public updateBotInfo = async (name: string, description: string, preserveRoot = false) => {
const mainDialogFile = this.dialogFiles.find((file) => !file.relativePath.includes('/'));
if (!mainDialogFile) return;
const botName = name.trim().toLowerCase();

const botName = name.trim();

const { relativePath } = mainDialogFile;
const content = JSON.parse(mainDialogFile.content);
if (!content.$designer) return;
const oldDesigner = content.$designer;
let newDesigner;
if (oldDesigner && oldDesigner.id) {
newDesigner = {
...oldDesigner,
name,
description,
};
} else {
newDesigner = getNewDesigner(name, description);
}
content.$designer = newDesigner;
content.id = name;
const updatedContent = autofixReferInDialog(botName, JSON.stringify(content, null, 2));

const { $designer } = content;

content.$designer = $designer?.id ? { ...$designer, name, description } : getNewDesigner(botName, description);

content.id = preserveRoot ? Path.basename(mainDialogFile.name, '.dialog') : botName;

const updatedContent = autofixReferInDialog(content.id, JSON.stringify(content, null, 2));

await this._updateFile(relativePath, updatedContent);

for (const botProjectFile of this.botProjectFiles) {
Expand Down Expand Up @@ -434,7 +436,7 @@ export class BotProject implements IBotProject {
this._validateFileContent(name, content);
const botName = this.name;
const defaultLocale = this.settings?.defaultLanguage || defaultLanguage;
const relativePath = defaultFilePath(botName, defaultLocale, filename);
const relativePath = defaultFilePath(botName, defaultLocale, filename, this.rootDialogId);
const file = this.files.get(filename);
if (file) {
throw new Error(`${filename} dialog already exist`);
Expand Down
18 changes: 12 additions & 6 deletions Composer/packages/server/src/models/bot/botStructure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ export const parseFileName = (name: string, defaultLocale: string) => {
export const isRecognizer = (fileName: string) => fileName.endsWith('.lu.dialog') || fileName.endsWith('.qna.dialog');
export const isCrossTrainConfig = (fileName: string) => fileName.endsWith('cross-train.config.json');

export const defaultFilePath = (botName: string, defaultLocale: string, filename: string): string => {
export const defaultFilePath = (
botName: string,
defaultLocale: string,
filename: string,
rootDialogId = ''
): string => {
const BOTNAME = botName.toLowerCase();
const CommonFileId = 'common';

Expand All @@ -86,8 +91,8 @@ export const defaultFilePath = (botName: string, defaultLocale: string, filename

// now recognizer extension is .lu.dialog or .qna.dialog
if (isRecognizer(filename)) {
const isRoot = filename.startsWith(botName.toLowerCase());
const dialogId = filename.slice(0, filename.indexOf('.'));
const dialogId = filename.split('.')[0];
const isRoot = filename.startsWith(botName) || (rootDialogId && filename.startsWith(rootDialogId));
if (isRoot) {
return templateInterpolate(BotStructureTemplate.recognizer, {
RECOGNIZERNAME: filename,
Expand Down Expand Up @@ -170,14 +175,15 @@ export const defaultFilePath = (botName: string, defaultLocale: string, filename
// when create/saveAs bot, serialize entry dialog/lg/lu
export const serializeFiles = async (fileStorage, rootPath, botName, preserveRoot = false) => {
const entryPatterns = [
templateInterpolate(BotStructureTemplate.lg, { LOCALE: '*', BOTNAME: '*' }),
templateInterpolate(BotStructureTemplate.lu, { LOCALE: '*', BOTNAME: '*' }),
templateInterpolate(BotStructureTemplate.qna, { LOCALE: '*', BOTNAME: '*' }),
templateInterpolate(BotStructureTemplate.dialogSchema, { BOTNAME: '*' }),
templateInterpolate(BotStructureTemplate.botProject, { BOTNAME: '*' }),
];

if (!preserveRoot) {
entryPatterns.push(templateInterpolate(BotStructureTemplate.entry, { BOTNAME: '*' }));
entryPatterns.push(templateInterpolate(BotStructureTemplate.lg, { LOCALE: '*', BOTNAME: '*' }));
entryPatterns.push(templateInterpolate(BotStructureTemplate.lu, { LOCALE: '*', BOTNAME: '*' }));
entryPatterns.push(templateInterpolate(BotStructureTemplate.qna, { LOCALE: '*', BOTNAME: '*' }));
}

for (const pattern of entryPatterns) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@bfc/indexers": "*",
"@bfc/shared": "*",
"@microsoft/bf-cli-command": "^4.10.0-preview.141651",
"@microsoft/bf-lu": "^4.11.0-dev.20201013.7ccb128",
"@microsoft/bf-lu": "^4.11.0-rc.20201030.a9f9b96",
"express": "^4.15.2",
"monaco-languageclient": "^0.10.0",
"normalize-url": "^2.0.1",
Expand Down
103 changes: 21 additions & 82 deletions Composer/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -881,9 +881,9 @@
js-tokens "^4.0.0"

"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.10.4", "@babel/parser@^7.10.5", "@babel/parser@^7.11.3", "@babel/parser@^7.11.5", "@babel/parser@^7.2.2", "@babel/parser@^7.3.4", "@babel/parser@^7.4.0", "@babel/parser@^7.7.0", "@babel/parser@^7.7.4", "@babel/parser@^7.7.5", "@babel/parser@^7.8.6", "@babel/parser@^7.9.0", "@babel/parser@^7.9.6":
version "7.11.5"
resolved "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/@babel/parser/-/@babel/parser-7.11.5.tgz#c7ff6303df71080ec7a4f5b8c003c58f1cf51037"
integrity sha1-x/9jA99xCA7HpPW4wAPFjxz1EDc=
version "7.12.3"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.3.tgz#a305415ebe7a6c7023b40b5122a0662d928334cd"
integrity sha512-kFsOS0IbsuhO5ojF8Hc8z/8vEIOkylVBrjiZUbLTE3XFe0Qi+uu6HjzQixkFaqr0ZPAMZcBVxEwmsnsLPZ2Xsw==

"@babel/plugin-proposal-async-generator-functions@^7.2.0":
version "7.2.0"
Expand Down Expand Up @@ -3011,28 +3011,6 @@
seedrandom "~3.0.5"
swagger-parser "^8.0.4"

"@microsoft/bf-lu@^4.11.0-dev.20201013.7ccb128":
version "4.11.0-dev.20201013.7ccb128"
resolved "https://registry.yarnpkg.com/@microsoft/bf-lu/-/bf-lu-4.11.0-dev.20201013.7ccb128.tgz#9dbb5043d3f7a384d1449c73fd984016b5115ca4"
integrity sha512-xaG5yDxtdwNNfYa6cs9wmCGTN6K6d2sh8jfGvMt7dqs26My3c6Sus03VF74sRrp2OQXnbBLqZPVY1qzLKnjoJg==
dependencies:
"@azure/cognitiveservices-luis-authoring" "4.0.0-preview.1"
"@azure/ms-rest-azure-js" "2.0.1"
"@types/node-fetch" "~2.5.5"
antlr4 "^4.7.2"
chalk "2.4.1"
console-stream "^0.1.1"
deep-equal "^1.0.1"
delay "^4.3.0"
fs-extra "^8.1.0"
get-stdin "^6.0.0"
globby "^10.0.1"
intercept-stdout "^0.1.2"
lodash "^4.17.19"
node-fetch "~2.6.0"
semver "^5.5.1"
tslib "^2.0.3"

"@microsoft/bf-lu@^4.11.0-dev.20201015.a41c691":
version "4.11.0-dev.20201016.24ec3b9"
resolved "https://botbuilder.myget.org/F/botframework-cli/npm/@microsoft/bf-lu/-/@microsoft/bf-lu-4.11.0-dev.20201016.24ec3b9.tgz#a0f3880087978ff09236510e25ffcf085cbeee5a"
Expand All @@ -3055,32 +3033,10 @@
semver "^5.5.1"
tslib "^2.0.3"

"@microsoft/bf-lu@^4.11.0-dev.20201025.69cf2b9":
version "4.11.0-rc.20201026.e06ad47"
resolved "https://registry.yarnpkg.com/@microsoft/bf-lu/-/bf-lu-4.11.0-rc.20201026.e06ad47.tgz#a7664b94c9ec75d12e5d11205075a935928587b0"
integrity sha512-Ysjv6Nnr0caxsSNWCafO9Kngb7gqCP5tq8mhUBM3FzsyOcmvfg5VVwTLZSYmogjM/tcr6WxqXQw2y7QG7NKB1A==
dependencies:
"@azure/cognitiveservices-luis-authoring" "4.0.0-preview.1"
"@azure/ms-rest-azure-js" "2.0.1"
"@types/node-fetch" "~2.5.5"
antlr4 "^4.7.2"
chalk "2.4.1"
console-stream "^0.1.1"
deep-equal "^1.0.1"
delay "^4.3.0"
fs-extra "^8.1.0"
get-stdin "^6.0.0"
globby "^10.0.1"
intercept-stdout "^0.1.2"
lodash "^4.17.19"
node-fetch "~2.6.0"
semver "^5.5.1"
tslib "^2.0.3"

"@microsoft/bf-lu@^4.11.0-rc.20201028.6f4722f":
version "4.11.0-rc.20201028.6f4722f"
resolved "https://registry.yarnpkg.com/@microsoft/bf-lu/-/bf-lu-4.11.0-rc.20201028.6f4722f.tgz#76e28d6737184f4915d11f6d59b3d2468c9ab947"
integrity sha512-KMVS6I/F6pMyTb5M65raBrYmglRGkcGeKRmxld1XErTKtdz7aNF007BGug/ISJn3JIDZJ5FExIqPy27ns438oQ==
"@microsoft/bf-lu@^4.11.0-rc.20201030.a9f9b96":
version "4.11.0-rc.20201030.a9f9b96"
resolved "https://registry.yarnpkg.com/@microsoft/bf-lu/-/bf-lu-4.11.0-rc.20201030.a9f9b96.tgz#9fcb2a18d66bcef74eabc98f06df4574215c402f"
integrity sha512-+VFZUGQdH+1lwuSxE9G2lOqO6KPevvhijKyX8N93/I+VxwfHuCF/BZ439MseT3+vJ9OzATfkeccqgOuI/kNBlQ==
dependencies:
"@azure/cognitiveservices-luis-authoring" "4.0.0-preview.1"
"@azure/ms-rest-azure-js" "2.0.1"
Expand Down Expand Up @@ -3121,23 +3077,6 @@
semver "^5.5.1"
tslib "^2.0.3"

"@microsoft/bf-orchestrator@4.11.0-beta.20201013.20d7917":
version "4.11.0-beta.20201013.20d7917"
resolved "https://registry.yarnpkg.com/@microsoft/bf-orchestrator/-/bf-orchestrator-4.11.0-beta.20201013.20d7917.tgz#525e167625ce2c64f079d937aeb7495a07a7a1d0"
integrity sha512-J5yobTheQuE+gme1R30xIIlCU9xVaiHLUrXyI6xZnT922EYEGsn7qAWfeuP0AM6b5JgD4exAOwHf02ggOIZmGQ==
dependencies:
"@microsoft/bf-dispatcher" "4.11.0-beta.20201013.20d7917"
"@microsoft/bf-lu" next
"@types/fs-extra" "~8.1.0"
"@types/node-fetch" "~2.5.5"
fast-text-encoding "^1.0.3"
fs-extra "~9.0.0"
node-7z-forall "~1.0.5"
node-fetch "~2.6.0"
orchestrator-core beta
read-text-file "~1.1.0"
tslib "^1.10.0"

"@microsoft/load-themed-styles@^1.10.26":
version "1.10.39"
resolved "https://registry.yarnpkg.com/@microsoft/load-themed-styles/-/load-themed-styles-1.10.39.tgz#23024bfa264a01ab2f05a9fda9c97c1f90ef80d8"
Expand Down Expand Up @@ -8745,8 +8684,8 @@ elegant-spinner@^1.0.1:

elliptic@^6.0.0, elliptic@^6.5.3:
version "6.5.3"
resolved "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6"
integrity sha1-y1nrLv2vc6C9eMzXAVpirW4Pk9Y=
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6"
integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==
dependencies:
bn.js "^4.4.0"
brorand "^1.0.1"
Expand Down Expand Up @@ -12848,8 +12787,8 @@ killable@^1.0.1:

kind-of@^2.0.1, kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0, kind-of@^4.0.0, kind-of@^5.0.0, kind-of@^6.0.0, kind-of@^6.0.2, kind-of@^6.0.3:
version "6.0.3"
resolved "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"
integrity sha1-B8BQNKbDSfoG4k+jWqdttFgM5N0=
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"
integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==

kleur@^3.0.2:
version "3.0.2"
Expand Down Expand Up @@ -13263,8 +13202,8 @@ lodash.uniq@^4.5.0:

"lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0:
version "4.17.20"
resolved "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha1-tEqbYpe8tpjxxRo1RaKzs2jVnFI=
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==

log-driver@^1.2.7:
version "1.2.7"
Expand Down Expand Up @@ -13791,8 +13730,8 @@ mixin-object@^2.0.1:

mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.2, mkdirp@^0.5.3, mkdirp@^0.5.4, mkdirp@^1.0.3, mkdirp@~0.5.1:
version "0.5.5"
resolved "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def"
integrity sha1-2Rzv1i0UNsoPQWIOJRKI1CAJne8=
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def"
integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==
dependencies:
minimist "^1.2.5"

Expand Down Expand Up @@ -17289,8 +17228,8 @@ select-hose@^2.0.0:

selfsigned@1.10.8, selfsigned@^1.10.7:
version "1.10.8"
resolved "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/selfsigned/-/selfsigned-1.10.8.tgz#0d17208b7d12c33f8eac85c41835f27fc3d81a30"
integrity sha1-DRcgi30Swz+OrIXEGDXyf8PYGjA=
resolved "https://registry.yarnpkg.com/selfsigned/-/selfsigned-1.10.8.tgz#0d17208b7d12c33f8eac85c41835f27fc3d81a30"
integrity sha512-2P4PtieJeEwVgTU9QEcwIRDQ/mXJLX8/+I3ur+Pg16nS8oNbrGxEso9NyYWy8NAmXiNl4dlAp5MwoNeCWzON4w==
dependencies:
node-forge "^0.10.0"

Expand Down Expand Up @@ -17433,8 +17372,8 @@ set-blocking@^2.0.0, set-blocking@~2.0.0:

set-value@^0.4.3, set-value@^2.0.0, set-value@^3.0.2:
version "3.0.2"
resolved "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/set-value/-/set-value-3.0.2.tgz#74e8ecd023c33d0f77199d415409a40f21e61b90"
integrity sha1-dOjs0CPDPQ93GZ1BVAmkDyHmG5A=
resolved "https://registry.yarnpkg.com/set-value/-/set-value-3.0.2.tgz#74e8ecd023c33d0f77199d415409a40f21e61b90"
integrity sha512-npjkVoz+ank0zjlV9F47Fdbjfj/PfXyVhZvGALWsyIYU/qrMzpi6avjKW3/7KeSU2Df3I46BrN1xOI1+6vW0hA==
dependencies:
is-plain-object "^2.0.4"

Expand Down Expand Up @@ -18456,8 +18395,8 @@ terminal-link@^2.0.0:

terser-webpack-plugin@2.3.7, terser-webpack-plugin@^1.4.3, terser-webpack-plugin@^2.3.7:
version "2.3.8"
resolved "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz#894764a19b0743f2f704e7c2a848c5283a696724"
integrity sha1-iUdkoZsHQ/L3BOfCqEjFKDppZyQ=
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz#894764a19b0743f2f704e7c2a848c5283a696724"
integrity sha512-/fKw3R+hWyHfYx7Bv6oPqmk4HGQcrWLtV3X6ggvPuwPNHSnzvVV51z6OaaCOus4YLjutYGOz3pEpbhe6Up2s1w==
dependencies:
cacache "^13.0.1"
find-cache-dir "^3.3.1"
Expand Down
7 changes: 5 additions & 2 deletions azure-pipelines-static-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@

# Run this job every night at midnight on the main branch
# Run this job every night at midnight (PST) on the main branch
schedules:
- cron: "0 0 * * *"
- cron: "0 7 * * *"
displayName: Nightly static analysis build
branches:
include:
- main

# Do not run PR validation
pr: none

# Semmle task only works on Windows
pool:
vmImage: 'windows-latest'
Expand Down
2 changes: 1 addition & 1 deletion extensions/azurePublish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@bfc/indexers": "../../Composer/packages/lib/indexers",
"@bfc/shared": "../../Composer/packages/lib/shared",
"@botframework-composer/types": "0.0.1",
"@microsoft/bf-lu": "4.11.0-dev.20201005.7e5e1b8",
"@microsoft/bf-lu": "^4.11.0-rc.20201030.a9f9b96",
"@microsoft/bf-luis-cli": "^4.10.0-dev.20200721.8bb21ac",
"@types/archiver": "3.1.0",
"@types/fs-extra": "8.1.0",
Expand Down
Loading

0 comments on commit c0bceb3

Please sign in to comment.