fix(core.gbapp): New async interfaces for .gbapps.

This commit is contained in:
Rodrigo Rodriguez 2020-04-02 19:02:32 -03:00
parent 610b0d20c7
commit d869028ffc
4 changed files with 12 additions and 10 deletions

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "botlib",
"version": "1.4.4",
"version": "1.5.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -1,6 +1,6 @@
{
"name": "botlib",
"version": "1.4.4",
"version": "1.5.0",
"description": "General Bot base library for building Node.js TypeScript Apps packages (.gbapp) and Libray packages (.gblib)",
"main": "dist/index.js",
"types": "dist/index",
@ -9,7 +9,8 @@
"Rodrigo Rodriguez <me@rodrigorodriguez.com>",
"João Antonio Ferreira <joao.parana@gmail.com>",
"Jorge Ramos <jramos@pobox.com>",
"PH <ph.an@outlook.com>"
"PH <ph.an@outlook.com>",
"Dário Vieira <dario.junior3@gmail.com>"
],
"license": "AGPL-3.0",
"repository": {

View file

@ -35,6 +35,7 @@
import { Sequelize } from "sequelize-typescript"
import { IGBInstance } from "./IGBInstance"
import { IGBInstallationDeployer } from "./IGBInstallationDeployer";
import { IGBPackage } from "./IGBPackage";
/**
* This interface defines the core service which is shared among
@ -50,7 +51,7 @@ export interface IGBCoreService {
initStorage(): Promise<any>;
createBootInstance(core: IGBCoreService, installationDeployer: IGBInstallationDeployer, proxyAddress: string);
ensureAdminIsSecured();
loadSysPackages(core: IGBCoreService);
loadSysPackages(core: IGBCoreService): Promise<IGBPackage[]>;
ensureProxy(port): Promise<string>;
ensureInstances(instances: IGBInstance[], bootInstance: any, core: IGBCoreService);
checkStorage(azureDeployer: IGBInstallationDeployer);

View file

@ -48,30 +48,30 @@ export interface IGBPackage{
/**
* Called when a package is being loaded, once per server or at demand.
*/
loadPackage(core: IGBCoreService, sequelize: Sequelize): void
loadPackage(core: IGBCoreService, sequelize: Sequelize): Promise<void>
/**
* Called when a package needs to be unloaded.
*/
unloadPackage(core: IGBCoreService): void
unloadPackage(core: IGBCoreService): Promise<void>
/**
* Called when a new bot instance is loaded.
*/
getDialogs(min: GBMinInstance)
getDialogs(min: GBMinInstance)
/**
* Called when a new bot instance is loaded.
*/
loadBot(min: GBMinInstance): void
loadBot(min: GBMinInstance): Promise<void>
/**
* Called whenever a bot instance needs to be shutdown.
*/
unloadBot(min: GBMinInstance): void
unloadBot(min: GBMinInstance): Promise<void>
/**
* Called in each new session.
*/
onNewSession(min: GBMinInstance, step: GBDialogStep): void
onNewSession(min: GBMinInstance, step: GBDialogStep): Promise<void>
}