diff --git a/CHANGELOG.md b/CHANGELOG.md index 24470631..ac7ea92f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,62 +1,3 @@ -## [1.3.6](https://github.com/pragmatismo-io/BotServer/compare/1.3.5...1.3.6) (2019-05-27) - - -### Bug Fixes - -* **core.gbapp:** Self-replication on Azure ([5f0fb3b](https://github.com/pragmatismo-io/BotServer/commit/5f0fb3b)) -* **core.gbapp:** Self-replication on Azure ([2509157](https://github.com/pragmatismo-io/BotServer/commit/2509157)) -* **core.gbapp:** Self-replication on Azure ([8850370](https://github.com/pragmatismo-io/BotServer/commit/8850370)) - -## [1.3.5](https://github.com/pragmatismo-io/BotServer/compare/1.3.4...1.3.5) (2019-05-27) - - -### Bug Fixes - -* **core.gbapp:** Self-replication on Azure ([f64cc4c](https://github.com/pragmatismo-io/BotServer/commit/f64cc4c)) - -## [1.3.4](https://github.com/pragmatismo-io/BotServer/compare/1.3.3...1.3.4) (2019-05-27) - - -### Bug Fixes - -* **core.gbapp:** Self-replication on Azure ([e82a813](https://github.com/pragmatismo-io/BotServer/commit/e82a813)) - -## [1.3.3](https://github.com/pragmatismo-io/BotServer/compare/1.3.2...1.3.3) (2019-05-27) - - -### Bug Fixes - -* **core.gbapp:** Self-replication on Azure ([bf602c6](https://github.com/pragmatismo-io/BotServer/commit/bf602c6)) -* **core.gbapp:** Self-replication on Azure ([3cca504](https://github.com/pragmatismo-io/BotServer/commit/3cca504)) -* **core.gbapp:** Self-replication on Azure ([05edafd](https://github.com/pragmatismo-io/BotServer/commit/05edafd)) - -## [1.3.2](https://github.com/pragmatismo-io/BotServer/compare/1.3.1...1.3.2) (2019-05-26) - - -### Bug Fixes - -* **core.gbapp:** Self-replication on Azure. ([2ccae38](https://github.com/pragmatismo-io/BotServer/commit/2ccae38)) -* **core.gbapp:** Self-replication on Azure. ([4b7d29d](https://github.com/pragmatismo-io/BotServer/commit/4b7d29d)) - -## [1.3.1](https://github.com/pragmatismo-io/BotServer/compare/1.3.0...1.3.1) (2019-05-25) - - -### Bug Fixes - -* **core.gbapp:** Azure deployment. ([f1b8eb2](https://github.com/pragmatismo-io/BotServer/commit/f1b8eb2)) -* **core.gbapp:** Azure deployment. ([49e1743](https://github.com/pragmatismo-io/BotServer/commit/49e1743)) -* **core.gbapp:** Azure Deployment. ([f8fab38](https://github.com/pragmatismo-io/BotServer/commit/f8fab38)) -* **core.gbapp:** ESNext in tsconfig.json to match MSFT. ([01b8dd5](https://github.com/pragmatismo-io/BotServer/commit/01b8dd5)) -* **core.gbapp:** Fixing loading of instances. ([bc9c588](https://github.com/pragmatismo-io/BotServer/commit/bc9c588)) -* **core.gbapp:** Investigating BASIC broken. ([f0ec25e](https://github.com/pragmatismo-io/BotServer/commit/f0ec25e)) -* **core.gbapp:** package.json artifacts sync. ([01d34a6](https://github.com/pragmatismo-io/BotServer/commit/01d34a6)) -* **core.gbapp:** Publishing in Azure. ([4d6779e](https://github.com/pragmatismo-io/BotServer/commit/4d6779e)) -* **core.gbapp:** Removing POC code. ([56f46f4](https://github.com/pragmatismo-io/BotServer/commit/56f46f4)) -* **kb.gbapp:** Typo fix. ([ba26578](https://github.com/pragmatismo-io/BotServer/commit/ba26578)) -* **whatsapp.gblib:** Enabling Whatsapp. ([4351b87](https://github.com/pragmatismo-io/BotServer/commit/4351b87)) -* **whatsapp.gblib:** Enabling Whatsapp. ([74f5936](https://github.com/pragmatismo-io/BotServer/commit/74f5936)) -* **whatsapp.lib:** Enabling Whatsapp. ([85249e5](https://github.com/pragmatismo-io/BotServer/commit/85249e5)) - # [1.3.0](https://github.com/pragmatismo-io/BotServer/compare/1.2.2...1.3.0) (2019-05-12) diff --git a/package-lock.json b/package-lock.json index 8a4cf0ac..8d78ccc1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3013,9 +3013,9 @@ "integrity": "sha512-3BWQEbArzHkw49BCdyNxqmSnLzkrL396Q0c+VcdabT3t75wV+dc4bwzSBuLfG0KW+fBjhSR4BXM8IQfnIZU0Vg==" }, "botlib": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/botlib/-/botlib-1.2.0.tgz", - "integrity": "sha512-JXA1LkRR8GEnb2W5/3N6H+aPnJv4b5J2XV9WiHo8zp9gW87i5g/F/wo8drDcqEfSOF2ZpHD3HyEFfbBcUY6C6A==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/botlib/-/botlib-1.2.1.tgz", + "integrity": "sha512-r9mjcag3Ttq3m6p1pewx094Os+dNLDb6rcBiTdGQMFjjeKLzqrLL3NGusYytOGyZek13TKeVciT9aU5ZQGofEQ==", "requires": { "async": "2.6.2", "botbuilder": "4.4.0", diff --git a/package.json b/package.json index 4fa94b62..dfa7f170 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "botserver", - "version": "1.3.6", + "version": "1.3.0", "description": "General Bot Community Edition open-core server.", "main": "./boot.js", "bugs": "https://github.com/pragmatismo-io/BotServer/issues", @@ -65,7 +65,7 @@ "botbuilder-choices": "4.0.0-preview1.2", "botbuilder-dialogs": "4.4.0", "botbuilder-prompts": "4.0.0-preview1.2", - "botlib": "1.2.0", + "botlib": "^1.2.1", "chai": "4.2.0", "child_process": "1.0.2", "chokidar": "3.0.0", diff --git a/packages/core.gbapp/services/GBCoreService.ts b/packages/core.gbapp/services/GBCoreService.ts index ef166609..bb28c303 100644 --- a/packages/core.gbapp/services/GBCoreService.ts +++ b/packages/core.gbapp/services/GBCoreService.ts @@ -39,6 +39,7 @@ import { GBLog, IGBCoreService, IGBInstallationDeployer, IGBInstance, IGBPackage } from 'botlib'; import * as fs from 'fs'; import { Sequelize } from 'sequelize-typescript'; +import { GBServer } from '../../../src/app'; import { GBAdminPackage } from '../../admin.gbapp/index'; import { GBAdminService } from '../../admin.gbapp/services/GBAdminService'; import { GBAnalyticsPackage } from '../../analytics.gblib'; @@ -261,6 +262,20 @@ STORAGE_SYNC=true } } + public installWebHook(isGet: boolean, url: string, callback: any) { + + if (isGet) { + GBServer.globals.server.get(url, (req, res) => { + callback(req, res); + }); + } else { + GBServer.globals.server.post(url, (req, res) => { + callback(req, res); + }); + + } + } + public async saveInstance(fullInstance: any) { const options = { where: {} }; options.where = { botId: fullInstance.botId }; diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index f451e2d4..578cea90 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -47,7 +47,7 @@ const graph = require('@microsoft/microsoft-graph-client'); import { GBError, GBLog, GBMinInstance, IGBCoreService, IGBInstance, IGBPackage } from 'botlib'; import { AzureSearch } from 'pragmatismo-io-framework'; import { GBServer } from '../../../src/app'; -import { GuaribasPackage, GuaribasInstance } from '../models/GBModel'; +import { GuaribasPackage } from '../models/GBModel'; import { GBAdminService } from './../../admin.gbapp/services/GBAdminService'; import { AzureDeployerService } from './../../azuredeployer.gbapp/services/AzureDeployerService'; import { KBService } from './../../kb.gbapp/services/KBService'; @@ -232,7 +232,7 @@ export class GBDeployer { switch (packageType) { case '.gbot': - await this.deployBot(localPath, min.proxyAddress); + await this.deployBot(localPath, GBServer.globals.publicAddress); case '.gbkb': const service = new KBService(this.core.sequelize); @@ -371,6 +371,7 @@ export class GBDeployer { GBLog.info(`Theme (.gbtheme) assets accessible at: /themes/${filenameOnly}.`); } else if (Path.extname(filename) === '.gbkb') { server.use(`/kb/${filenameOnly}/subjects`, express.static(urlJoin(filename, 'subjects'))); + server.use(`/kb/${filenameOnly}/images`, express.static(urlJoin(filename, 'images'))); GBLog.info(`KB (.gbkb) assets accessible at: /kb/${filenameOnly}.`); } else if (Path.extname(filename) === '.gbui') { // Already Handled diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 87b1b299..7d48a084 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -232,7 +232,7 @@ export class GBMinService { */ private async sendInstanceToClient(req, bootInstance: IGBInstance, res: any, webchatToken: any) { let botId = req.params.botId; - if (botId === '[default]'|| botId === undefined) { + if (botId === '[default]' || botId === undefined) { botId = GBConfigService.get('BOT_ID'); } const instance = await this.core.loadInstance(botId); @@ -377,7 +377,7 @@ export class GBMinService { if (p.getDialogs !== undefined) { const dialogs = p.getDialogs(min); dialogs.forEach(dialog => { - min.dialogs.add(new WaterfallDialog(dialog.name, dialog.waterfall)); + min.dialogs.add(new WaterfallDialog(dialog.id, dialog.waterfall)); }); } }, this); @@ -497,6 +497,9 @@ export class GBMinService { min.sandBoxMap[mainMethod].step = step; min.sandBoxMap[mainMethod][mainMethod].bind(min.sandBoxMap[mainMethod]); await min.sandBoxMap[mainMethod][mainMethod](); + } else if (context.activity.text.charAt(0) === '/') { + await step.beginDialog(context.activity.text); + } else if (context.activity.text === 'admin') { await step.beginDialog('/admin'); diff --git a/packages/customer-satisfaction.gbapp/services/CSService.ts b/packages/customer-satisfaction.gbapp/services/CSService.ts index 4ef113e9..74ba2706 100644 --- a/packages/customer-satisfaction.gbapp/services/CSService.ts +++ b/packages/customer-satisfaction.gbapp/services/CSService.ts @@ -54,7 +54,7 @@ export class CSService { instanceId: number, questionTyped: string, questionText: string): Promise { - return GuaribasQuestionAlternate.create({ + return await GuaribasQuestionAlternate.create({ questionTyped: questionTyped, questionText: questionText }); diff --git a/src/app.ts b/src/app.ts index a661e1b3..6485ccc1 100644 --- a/src/app.ts +++ b/src/app.ts @@ -56,6 +56,7 @@ const appPackages: IGBPackage[] = []; */ export class RootData { public publicAddress: string; + public server: any; } /** @@ -74,6 +75,7 @@ export class GBServer { GBServer.globals = new RootData(); const port = GBConfigService.getServerPort(); const server = express(); + GBServer.globals.server = server; server.use(bodyParser.json()); server.use(bodyParser.urlencoded({ extended: true }));