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", "name": "botlib",
"version": "1.4.4", "version": "1.5.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View file

@ -1,6 +1,6 @@
{ {
"name": "botlib", "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)", "description": "General Bot base library for building Node.js TypeScript Apps packages (.gbapp) and Libray packages (.gblib)",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index", "types": "dist/index",
@ -9,7 +9,8 @@
"Rodrigo Rodriguez <me@rodrigorodriguez.com>", "Rodrigo Rodriguez <me@rodrigorodriguez.com>",
"João Antonio Ferreira <joao.parana@gmail.com>", "João Antonio Ferreira <joao.parana@gmail.com>",
"Jorge Ramos <jramos@pobox.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", "license": "AGPL-3.0",
"repository": { "repository": {

View file

@ -35,6 +35,7 @@
import { Sequelize } from "sequelize-typescript" import { Sequelize } from "sequelize-typescript"
import { IGBInstance } from "./IGBInstance" import { IGBInstance } from "./IGBInstance"
import { IGBInstallationDeployer } from "./IGBInstallationDeployer"; import { IGBInstallationDeployer } from "./IGBInstallationDeployer";
import { IGBPackage } from "./IGBPackage";
/** /**
* This interface defines the core service which is shared among * This interface defines the core service which is shared among
@ -50,7 +51,7 @@ export interface IGBCoreService {
initStorage(): Promise<any>; initStorage(): Promise<any>;
createBootInstance(core: IGBCoreService, installationDeployer: IGBInstallationDeployer, proxyAddress: string); createBootInstance(core: IGBCoreService, installationDeployer: IGBInstallationDeployer, proxyAddress: string);
ensureAdminIsSecured(); ensureAdminIsSecured();
loadSysPackages(core: IGBCoreService); loadSysPackages(core: IGBCoreService): Promise<IGBPackage[]>;
ensureProxy(port): Promise<string>; ensureProxy(port): Promise<string>;
ensureInstances(instances: IGBInstance[], bootInstance: any, core: IGBCoreService); ensureInstances(instances: IGBInstance[], bootInstance: any, core: IGBCoreService);
checkStorage(azureDeployer: IGBInstallationDeployer); 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. * 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. * 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. * Called when a new bot instance is loaded.
*/ */
getDialogs(min: GBMinInstance) getDialogs(min: GBMinInstance)
/** /**
* Called when a new bot instance is loaded. * 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. * Called whenever a bot instance needs to be shutdown.
*/ */
unloadBot(min: GBMinInstance): void unloadBot(min: GBMinInstance): Promise<void>
/** /**
* Called in each new session. * Called in each new session.
*/ */
onNewSession(min: GBMinInstance, step: GBDialogStep): void onNewSession(min: GBMinInstance, step: GBDialogStep): Promise<void>
} }