diff --git a/libraries/botbuilder-ai/package.json b/libraries/botbuilder-ai/package.json index 34399ce363..dca1386f21 100644 --- a/libraries/botbuilder-ai/package.json +++ b/libraries/botbuilder-ai/package.json @@ -20,12 +20,13 @@ "main": "./lib/index.js", "typings": "./lib/index.d.ts", "dependencies": { + "@azure/cognitiveservices-luis-runtime": "^1.2.0", + "@azure/ms-rest-js": "^1.6.0", "@microsoft/recognizers-text-date-time": "1.1.2", "@types/html-entities": "^1.2.16", "@types/node": "^10.12.18", "@types/request-promise-native": "^1.0.10", - "azure-cognitiveservices-luis-runtime": "^1.0.0", - "botbuilder": "~4.1.6", + "botbuilder-core": "~4.1.6", "html-entities": "^1.2.1", "moment": "^2.20.1", "ms-rest": "^2.3.6", @@ -37,6 +38,7 @@ "devDependencies": { "@types/mocha": "^2.2.47", "codelyzer": "^4.1.0", + "fs-extra": "^7.0.1", "mocha": "^5.2.0", "nock": "^10.0.1", "nyc": "^11.4.1", @@ -52,6 +54,6 @@ }, "files": [ "/lib", - "/src" + "/src" ] } diff --git a/libraries/botbuilder-ai/src/luisRecognizer.ts b/libraries/botbuilder-ai/src/luisRecognizer.ts index f40ae5ef5e..8bffbaa581 100644 --- a/libraries/botbuilder-ai/src/luisRecognizer.ts +++ b/libraries/botbuilder-ai/src/luisRecognizer.ts @@ -5,9 +5,9 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ -import { LUISRuntimeClient as LuisClient, LUISRuntimeModels as LuisModels } from 'azure-cognitiveservices-luis-runtime'; -import { RecognizerResult, TurnContext } from 'botbuilder'; -import * as msRest from 'ms-rest'; +import { LUISRuntimeClient as LuisClient, LUISRuntimeModels as LuisModels } from '@azure/cognitiveservices-luis-runtime'; +import { RecognizerResult, TurnContext } from 'botbuilder-core'; +import * as msRest from "@azure/ms-rest-js"; import * as os from 'os'; import * as Url from 'url-parse'; @@ -159,7 +159,7 @@ export class LuisRecognizer { // Create client const creds: msRest.TokenCredentials = new msRest.TokenCredentials(this.application.endpointKey); const baseUri: string = this.application.endpoint || 'https://westus.api.cognitive.microsoft.com'; - this.luisClient = new LuisClient(creds, baseUri); + this.luisClient = new LuisClient(baseUri, creds); } /** @@ -298,8 +298,8 @@ export class LuisRecognizer { // If the `error` received is a azure-cognitiveservices-luis-runtime error, // it may have a `response` property and `response.statusCode`. // If these properties exist, we should populate the error with a correct and informative error message. - if ((error as any).response && (error as any).response.statusCode) { - switch ((error as any).response.statusCode) { + if ((error as any).response && (error as any).response.status) { + switch ((error as any).response.status) { case 400: error.message = [ `Response 400: The request's body or parameters are incorrect,`, @@ -326,7 +326,7 @@ export class LuisRecognizer { break; default: error.message = [ - `Response ${(error as any).response.statusCode}: Unexpected status code received.`, + `Response ${(error as any).response.status}: Unexpected status code received.`, `Please verify that your LUIS application is properly setup.` ].join(' '); } diff --git a/libraries/botbuilder-ai/src/qnaMaker.ts b/libraries/botbuilder-ai/src/qnaMaker.ts index 5df045f330..7a8b991cee 100644 --- a/libraries/botbuilder-ai/src/qnaMaker.ts +++ b/libraries/botbuilder-ai/src/qnaMaker.ts @@ -5,7 +5,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ -import { Activity, TurnContext } from 'botbuilder'; +import { Activity, TurnContext } from 'botbuilder-core'; import * as entities from 'html-entities'; import * as os from 'os'; const pjson: any = require('../package.json'); diff --git a/libraries/botbuilder-ai/tests/luisRecognizer.test.js b/libraries/botbuilder-ai/tests/luisRecognizer.test.js index ea1b80adf8..e3729ddf9c 100644 --- a/libraries/botbuilder-ai/tests/luisRecognizer.test.js +++ b/libraries/botbuilder-ai/tests/luisRecognizer.test.js @@ -1,7 +1,7 @@ const assert = require('assert'); const fs = require('fs-extra'); const nock = require('nock'); -const { TestAdapter, TurnContext } = require('botbuilder'); +const { TestAdapter, TurnContext } = require('botbuilder-core'); const { LuisRecognizer } = require('../'); const luisAppId = '38330cad-f768-4619-96f9-69ea333e594b'; diff --git a/libraries/botbuilder-ai/tests/qnaMaker.test.js b/libraries/botbuilder-ai/tests/qnaMaker.test.js index d0dc76db01..a3112bb760 100644 --- a/libraries/botbuilder-ai/tests/qnaMaker.test.js +++ b/libraries/botbuilder-ai/tests/qnaMaker.test.js @@ -1,5 +1,5 @@ const assert = require('assert'); -const { TestAdapter, TurnContext } = require('botbuilder'); +const { TestAdapter, TurnContext } = require('botbuilder-core'); const { QnAMaker } = require('../'); const nock = require('nock'); const fs = require('fs'); diff --git a/libraries/botbuilder/package.json b/libraries/botbuilder/package.json index 4ec32f8a01..70cb027a87 100644 --- a/libraries/botbuilder/package.json +++ b/libraries/botbuilder/package.json @@ -48,6 +48,6 @@ }, "files": [ "/lib", - "/src" - ] -} \ No newline at end of file + "/src" + ] +} diff --git a/package-lock.json b/package-lock.json index 9ce506cc01..aa90c29bc1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3,6 +3,37 @@ "requires": true, "lockfileVersion": 1, "dependencies": { + "@azure/cognitiveservices-luis-runtime": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@azure/cognitiveservices-luis-runtime/-/cognitiveservices-luis-runtime-1.2.0.tgz", + "integrity": "sha512-Ti+gUK+NXkFxSZYHMoOqCHXTp27gjcEZjUFdrLqKHri94BNMaaterVHlwdZgJKzvTvbKfQ7B3mjirs04GJKojQ==", + "requires": { + "@azure/ms-rest-js": "^1.6.0", + "tslib": "^1.9.3" + }, + "dependencies": { + "@azure/ms-rest-js": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-1.7.0.tgz", + "integrity": "sha512-iQbAoTqJgBMdcK29oz3bFDaS3QnEbfI1NcKmE4PS5nrTtfKsz6zoLeAhr8fwIPA1H1kYHlcHIsQqb69B9pJ70Q==", + "requires": { + "@types/tunnel": "0.0.0", + "axios": "^0.18.0", + "form-data": "^2.3.2", + "tough-cookie": "^2.4.3", + "tslib": "^1.9.2", + "tunnel": "0.0.6", + "uuid": "^3.2.1", + "xml2js": "^0.4.19" + } + }, + "tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" + } + } + }, "@azure/ms-rest-js": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-1.2.6.tgz", @@ -309,6 +340,14 @@ "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.5.tgz", "integrity": "sha512-SCcK7mvGi3+ZNz833RRjFIxrn4gI1PPR3NtuIS+6vMkvmsGjosqTJwRt5bAEFLRz+wtJMWv8+uOnZf2hi2QXTg==" }, + "@types/tunnel": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/@types/tunnel/-/tunnel-0.0.0.tgz", + "integrity": "sha512-FGDp0iBRiBdPjOgjJmn1NH0KDLN+Z8fRmo+9J7XGBhubq1DPrGrbmG4UTlGzrpbCpesMqD0sWkzi27EYkOMHyg==", + "requires": { + "@types/node": "*" + } + }, "@types/uuid": { "version": "3.4.4", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.4.tgz",