diff --git a/package-lock.json b/package-lock.json index 1dcf4a4..7cda13c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "botlib", - "version": "0.1.16", + "version": "0.1.22", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -511,7 +511,7 @@ }, "axios": { "version": "0.18.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/axios/-/axios-0.18.0.tgz", "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", "requires": { "follow-redirects": "^1.3.0", @@ -576,17 +576,17 @@ "dependencies": { "sax": { "version": "0.5.8", - "resolved": "https://registry.npmjs.org/sax/-/sax-0.5.8.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/sax/-/sax-0.5.8.tgz", "integrity": "sha1-1HLbIo6zMcJQaw6MFVJK25OdEsE=" }, "underscore": { "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/underscore/-/underscore-1.8.3.tgz", "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" }, "xml2js": { "version": "0.2.8", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.2.8.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/xml2js/-/xml2js-0.2.8.tgz", "integrity": "sha1-m4FpCTFjH/CdGVdUn69U9PmAs8I=", "requires": { "sax": "0.5.x" @@ -679,7 +679,7 @@ }, "binary-search-bounds": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/binary-search-bounds/-/binary-search-bounds-2.0.3.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/binary-search-bounds/-/binary-search-bounds-2.0.3.tgz", "integrity": "sha1-X/hhbW3SylOIvIWy1iZuK52lAtw=" }, "bluebird": { @@ -1217,7 +1217,7 @@ }, "browserify-mime": { "version": "1.2.9", - "resolved": "https://registry.npmjs.org/browserify-mime/-/browserify-mime-1.2.9.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/browserify-mime/-/browserify-mime-1.2.9.tgz", "integrity": "sha1-rrGvKN5sDXpqLOQK22j/GEIq8x8=" }, "buffer-equal-constant-time": { @@ -1525,7 +1525,7 @@ }, "deep-equal": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/deep-equal/-/deep-equal-1.0.1.tgz", "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=" }, "define-properties": { @@ -1626,12 +1626,12 @@ "dependencies": { "semaphore": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/semaphore/-/semaphore-1.0.5.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/semaphore/-/semaphore-1.0.5.tgz", "integrity": "sha1-tJJXbmavGT25XWXiXsU/Xxl5jWA=" }, "underscore": { "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/underscore/-/underscore-1.8.3.tgz", "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" } } @@ -2317,7 +2317,7 @@ }, "hash-base": { "version": "3.0.4", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/hash-base/-/hash-base-3.0.4.tgz", "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", "requires": { "inherits": "^2.0.1", @@ -2363,7 +2363,7 @@ }, "html-entities": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.2.1.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/html-entities/-/html-entities-1.2.1.tgz", "integrity": "sha1-DfKTUfByEWNRXfueVUPl9u7VFi8=" }, "http-signature": { @@ -2411,7 +2411,7 @@ }, "int64-buffer": { "version": "0.1.10", - "resolved": "https://registry.npmjs.org/int64-buffer/-/int64-buffer-0.1.10.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/int64-buffer/-/int64-buffer-0.1.10.tgz", "integrity": "sha1-J3siiofZWtd30HwTgyAiQGpHNCM=" }, "interpret": { @@ -2639,7 +2639,7 @@ }, "json-edm-parser": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/json-edm-parser/-/json-edm-parser-0.1.2.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/json-edm-parser/-/json-edm-parser-0.1.2.tgz", "integrity": "sha1-HmCw/vG8CvZ7wNFG393lSGzWFbQ=", "requires": { "jsonparse": "~1.2.0" @@ -2671,7 +2671,7 @@ }, "jsonparse": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.2.0.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/jsonparse/-/jsonparse-1.2.0.tgz", "integrity": "sha1-XAxWhRBxYOcv50ib3eoLRMK8Z70=" }, "jsonwebtoken": { @@ -2898,7 +2898,7 @@ }, "md5.js": { "version": "1.3.4", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/md5.js/-/md5.js-1.3.4.tgz", "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", "requires": { "hash-base": "^3.0.0", @@ -3622,12 +3622,12 @@ }, "priorityqueuejs": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/priorityqueuejs/-/priorityqueuejs-1.0.0.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/priorityqueuejs/-/priorityqueuejs-1.0.0.tgz", "integrity": "sha1-LuTyPCVgkT4IwHzlzN1t498sWvg=" }, "process-nextick-args": { "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/process-nextick-args/-/process-nextick-args-1.0.7.tgz", "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" }, "progress": { @@ -3638,7 +3638,7 @@ }, "propagate": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/propagate/-/propagate-1.0.0.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/propagate/-/propagate-1.0.0.tgz", "integrity": "sha1-AMLa7t2iDofjeCs0Stuhzd1q1wk=" }, "pseudomap": { @@ -3679,7 +3679,7 @@ }, "readable-stream": { "version": "2.0.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/readable-stream/-/readable-stream-2.0.6.tgz", "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", "requires": { "core-util-is": "~1.0.0", @@ -3760,7 +3760,7 @@ }, "request-promise-core": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.1.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/request-promise-core/-/request-promise-core-1.1.1.tgz", "integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=", "requires": { "lodash": "^4.13.1" @@ -3768,7 +3768,7 @@ }, "request-promise-native": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/request-promise-native/-/request-promise-native-1.0.5.tgz", "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", "requires": { "request-promise-core": "1.1.1", @@ -4258,7 +4258,7 @@ }, "stealthy-require": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/stealthy-require/-/stealthy-require-1.1.1.tgz", "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" }, "string-width": { @@ -4273,7 +4273,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" }, "stringstream": { @@ -4855,7 +4855,7 @@ }, "xmlbuilder": { "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "resolved": "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/xmlbuilder/-/xmlbuilder-9.0.7.tgz", "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" }, "xmldom": { diff --git a/package.json b/package.json index dbfb0d2..2f94766 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "botlib", - "version": "0.1.19", + "version": "0.1.22", "description": "General Bot base library for building Node.js TypeScript Apps packages (.gbapp) and Libray packages (.gblib)", "main": "dist/index.js", - "types": "dist/index.d.ts", + "types": "dist/index", "homepage": "http://www.generalbot.com", "contributors": [ "Rodrigo Rodriguez ", diff --git a/src/GBMinInstance.ts b/src/GBMinInstance.ts index 3f6603d..02d8302 100644 --- a/src/GBMinInstance.ts +++ b/src/GBMinInstance.ts @@ -52,8 +52,10 @@ export class GBMinInstance { dialogs: DialogSet; userState: UserState; userProfile: any; + cbMap: {}; scriptMap: {}; + sandBoxMap: {}; constructor() { this.packages = []; diff --git a/src/IGBAdminService.ts b/src/IGBAdminService.ts index 3a92045..ee3693b 100644 --- a/src/IGBAdminService.ts +++ b/src/IGBAdminService.ts @@ -32,8 +32,18 @@ "use strict" +import { IGBInstance } from "./IGBinstance"; + export interface IGBAdminService { - putValue(key: string, value: string); - getValue(key: string) + + getValue(instanceId: number, key: string): any; acquireElevatedToken(instanceId):Promise; + updateSecurityInfo( + instanceId: number, + authenticatorTenant: string, + authenticatorAuthorityHostUrl: string, + authenticatorClientId: string, + authenticatorClientSecret: string + ): Promise ; + setValue(instanceId: number, key: string, value: string): void; } \ No newline at end of file diff --git a/src/IGBConversationalService.ts b/src/IGBConversationalService.ts index 437ba5d..ea63f02 100644 --- a/src/IGBConversationalService.ts +++ b/src/IGBConversationalService.ts @@ -30,15 +30,11 @@ | | \*****************************************************************************/ -"use strict" +"use strict"; -import { GBMinInstance } from "./GBMinInstance" +import { GBMinInstance } from "./GBMinInstance"; export interface IGBConversationalService { - sendEvent(step:any, name: string, value: any) - runNLP( - step:any, - min: GBMinInstance, - text: string - ) + sendEvent(step: any, name: string, value: any); + routeNLP(step: any, min: GBMinInstance, text: string): Promise; } diff --git a/src/IGBCoreService.ts b/src/IGBCoreService.ts index d4c1136..26265d8 100644 --- a/src/IGBCoreService.ts +++ b/src/IGBCoreService.ts @@ -34,7 +34,7 @@ import { Sequelize } from "sequelize-typescript" import { IGBInstance } from "./IGBInstance" -import { IGBAdminService } from "./IGBAdminService"; +import { IGBInstallationDeployer } from "./IGBInstallationDeployer"; /** * This interface defines the core service which is shared among @@ -42,8 +42,19 @@ import { IGBAdminService } from "./IGBAdminService"; */ export interface IGBCoreService { sequelize: Sequelize - initDatabase() syncDatabaseStructure() - loadInstances(): IGBInstance[] - loadInstance(botId: string): IGBInstance + loadInstances(): Promise ; + loadInstance(botId: string): Promise ; + loadInstanceById(instanceId: number): Promise; + initStorage(): Promise; + createBootInstance(core: IGBCoreService, installationDeployer: IGBInstallationDeployer, proxyAddress: string); + ensureAdminIsSecured(); + loadSysPackages(core: IGBCoreService); + ensureProxy(port): Promise; + ensureInstances(instances: IGBInstance[], bootInstance: any, core: IGBCoreService); + checkStorage(azureDeployer: IGBInstallationDeployer); + saveInstance(fullInstance: any); + loadAllInstances(core: IGBCoreService, azureDeployer: IGBInstallationDeployer, proxyAddress: string); + openBrowserInDevelopment() + } \ No newline at end of file diff --git a/src/IGBInstallationDeployer.ts b/src/IGBInstallationDeployer.ts new file mode 100644 index 0000000..51d47f3 --- /dev/null +++ b/src/IGBInstallationDeployer.ts @@ -0,0 +1,58 @@ +/*****************************************************************************\ +| ( )_ _ | +| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | +| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | +| | | ( )_) | | +| (_) \___/' | +| | +| 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"; + +import { IGBInstance } from "./IGBInstance"; + +export interface IGBInstallationDeployer { + updateBotProxy(botId: string, group: string, endpoint: string); + getSubscriptions(credentials); + getKBSearchSchema(indexName); + openStorageFirewall(groupName, serverName); + deployFarm( + proxyAddress: string, + instance: IGBInstance, + credentials, + subscriptionId: string + ): Promise; + deployToCloud( + title: string, + username: string, + password: string, + cloudLocation: string, + authoringKey: string, + appId: string, + appPassword: string, + subscriptionId: string + ); +} diff --git a/src/index.ts b/src/index.ts index f0c7e57..2cd2846 100644 --- a/src/index.ts +++ b/src/index.ts @@ -42,3 +42,4 @@ export { GBError, GBERROR_TYPE } from './GBError' export { GBService } from './GBService' export { GBMinInstance } from './GBMinInstance' export { IGBAdminService } from './IGBAdminService' +export { IGBInstallationDeployer } from './IGBInstallationDeployer' diff --git a/tsconfig.json b/tsconfig.json index a28a655..53ae958 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "allowJs": false, "baseUrl": "./", - "declaration": false, + "declaration": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "skipLibCheck": true,