diff --git a/src/GBService.ts b/src/GBService.ts index 80d4bdb..0e55a5e 100644 --- a/src/GBService.ts +++ b/src/GBService.ts @@ -32,8 +32,4 @@ 'use strict'; -import { GBError } from './GBError'; - -export interface GBServiceCallback { (data: T, error: GBError): void } - export class GBService { } diff --git a/src/IGBConversationalService.ts b/src/IGBConversationalService.ts index b5e79c5..b9aa849 100644 --- a/src/IGBConversationalService.ts +++ b/src/IGBConversationalService.ts @@ -33,16 +33,12 @@ "use strict"; import { GBMinInstance } from "./GBMinInstance"; -import { GBServiceCallback } from "./GBService"; -import { DialogContext } from "botbuilder-dialogs"; export interface IGBConversationalService { sendEvent(dc:any, name: string, value: any); runNLP( dc:any, min: GBMinInstance, - text: string, - cb: GBServiceCallback + text: string ); - } diff --git a/src/IGBCoreService.ts b/src/IGBCoreService.ts index ad87abb..99e47a6 100644 --- a/src/IGBCoreService.ts +++ b/src/IGBCoreService.ts @@ -32,16 +32,17 @@ "use strict"; -import { GBMinInstance } from "./GBMinInstance"; -import { GBServiceCallback } from "./GBService"; import { Sequelize } from "sequelize-typescript"; import { IGBInstance } from "./IGBInstance"; +/** + * This interface defines the core service which is shared among + * bot packages so they can have direct access to base services. + */ export interface IGBCoreService { sequelize: Sequelize; - initDatabase(cb); - syncDatabaseStructure(cb); - loadInstances(cb: GBServiceCallback); - loadInstance(botId: string, cb: GBServiceCallback); - -} + initDatabase(); + syncDatabaseStructure(); + loadInstances(): IGBInstance[]; + loadInstance(botId: string): IGBInstance; +} \ No newline at end of file diff --git a/src/IGBDialog.ts b/src/IGBDialog.ts index 7dc176c..33f70da 100644 --- a/src/IGBDialog.ts +++ b/src/IGBDialog.ts @@ -39,6 +39,5 @@ export class IGBDialog { bot: BotAdapter; service: GBService; constructor(bot: BotAdapter) { - } } diff --git a/src/IGBInstance.ts b/src/IGBInstance.ts index b0f68a2..086c262 100644 --- a/src/IGBInstance.ts +++ b/src/IGBInstance.ts @@ -36,10 +36,9 @@ export interface IGBInstance { botId:string; whoAmIVideo: string; applicationPrincipal: string; - tenant: string; - signUpSignInPolicy: "b2c_1_susi", - clientID: '47cbaa05-dbb4-46f8-8608-da386c5131f1'} - + authenticatorTenant: string; + authenticatorsignUpSignInPolicy: string; + authenticatorClientID: string; instanceId: number; title: string; description: string; diff --git a/src/IGBPackage.ts b/src/IGBPackage.ts index e5c0806..917f198 100644 --- a/src/IGBPackage.ts +++ b/src/IGBPackage.ts @@ -32,29 +32,40 @@ import { IGBCoreService } from './IGBCoreService'; -import { Sequelize, Model } from 'sequelize-typescript'; +import { Sequelize } from 'sequelize-typescript'; import { GBMinInstance } from '.'; -"use strict"; +// TODO: Include "use strict"; in all files. export interface IGBPackage{ - /** Each app has its own set of sys packages. */ + /** + * Each app has its own set of sys packages. + */ sysPackages: IGBPackage[]; - /** Called when a package is being loaded, once per server or at demand. */ + /** + * Called when a package is being loaded, once per server or at demand. + */ loadPackage(core: IGBCoreService, sequelize: Sequelize): void; - /** Called when a package needs to be unloaded. */ + /** + * Called when a package needs to be unloaded. + */ unloadPackage(core: IGBCoreService): void; - /** Called when a new bot instance is loaded. */ + /** + * Called when a new bot instance is loaded. + */ loadBot(min: GBMinInstance): void; - /** Called whenever a bot instance needs to be shutdown. */ + /** + * Called whenever a bot instance needs to be shutdown. + */ unloadBot(min: GBMinInstance): void; - /** Called in each new dc. */ + /** + * Called in each new dc. + */ onNewSession(min: GBMinInstance, dc: any): void; - } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index b7df1cb..6de4c74 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,15 +33,6 @@ 'use strict'; export { Sequelize } from 'sequelize-typescript'; - -import { GBMinInstance } from './GBMinInstance'; -import { GBService } from './GBService'; -import { GBError } from './GBError'; -import { IGBPackage } from './IGBPackage'; -import { IGBDialog } from './IGBDialog'; -import { IGBCoreService } from './IGBCoreService'; -import { IGBConversationalService } from './IGBConversationalService'; - export { IGBConversationalService } from './IGBConversationalService'; export { IGBCoreService } from './IGBCoreService'; export { IGBDialog } from './IGBDialog'; @@ -49,5 +40,4 @@ export { IGBPackage } from './IGBPackage'; export { IGBInstance } from './IGBInstance'; export { GBError, GBERROR_TYPE } from './GBError'; export { GBService } from './GBService'; -export { GBServiceCallback } from './GBService'; export { GBMinInstance } from './GBMinInstance'; diff --git a/test/example.test.ts b/test/example.test.ts deleted file mode 100644 index 5442585..0000000 --- a/test/example.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************\ -| ( )_ _ | -| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ ___ _ | -| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ ` _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) ( ) |( (_) ) | -| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_) (_)`\___/' | -| | | ( )_) | | -| (_) \___/' | -| | -| General Bots Copyright (c) Pragmatismo.io. All rights reserved. | -| Licensed under the AGPL-3.0. | -| | -| According to our dual licensing model, this program can be used either | -| under the terms of the GNU Affero General Public License, version 3, | -| or under a proprietary license. | -| | -| The texts of the GNU Affero General Public License with an additional | -| permission and of our proprietary license can be found at and | -| in the LICENSE file you have received along with this program. | -| | -| This program is distributed in the hope that it will be useful, | -| but WITHOUT ANY WARRANTY; without even the implied warranty of | -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | -| GNU Affero General Public License for more details. | -| | -| "General Bots" is a registered trademark of Pragmatismo.io. | -| The licensing of the program under the AGPLv3 does not imply a | -| trademark license. Therefore any rights, title and interest in | -| our trademarks remain entirely with us. | -| | -\******************************************************************************/ - -'use strict'; - -const assert = require('assert'); - -describe('Array', () => { - describe('#indexOf()', () => { - - it('should return -1 when the value is not present', () => { - assert.equal([1, 2, 3].indexOf(4), -1); - }); - - }); -});