New promises and compiling.

This commit is contained in:
Rodrigo Rodriguez 2018-09-09 14:40:09 -03:00
parent 33a62fde01
commit 9466a214b7
8 changed files with 33 additions and 86 deletions

View file

@ -32,8 +32,4 @@
'use strict';
import { GBError } from './GBError';
export interface GBServiceCallback<T> { (data: T, error: GBError): void }
export class GBService { }

View file

@ -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<any>
text: string
);
}

View file

@ -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<IGBInstance[]>);
loadInstance(botId: string, cb: GBServiceCallback<IGBInstance>);
}
initDatabase();
syncDatabaseStructure();
loadInstances(): IGBInstance[];
loadInstance(botId: string): IGBInstance;
}

View file

@ -39,6 +39,5 @@ export class IGBDialog {
bot: BotAdapter;
service: GBService;
constructor(bot: BotAdapter) {
}
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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';

View file

@ -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);
});
});
});