TSLint fixing.
This commit is contained in:
parent
60b935189f
commit
ca565b890a
46 changed files with 497 additions and 384 deletions
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
* text=auto
|
||||
*.js eol=lf
|
||||
*.ts eol=lf
|
8
.prettierrc
Normal file
8
.prettierrc
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"trailingComma": "all",
|
||||
"tabWidth": 2,
|
||||
"printWidth": 80,
|
||||
"arrowParens": "avoid",
|
||||
"semi": true,
|
||||
"singleQuote": true
|
||||
}
|
|
@ -17,7 +17,7 @@ script:
|
|||
- npm run clean
|
||||
- npm run build
|
||||
- npm run build-docs
|
||||
- npm run tslit
|
||||
- npm run tslint
|
||||
- npm run coveralls
|
||||
|
||||
branches:
|
||||
|
|
31
package-lock.json
generated
31
package-lock.json
generated
|
@ -2391,7 +2391,8 @@
|
|||
"builtin-modules": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
|
||||
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8="
|
||||
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
|
||||
"dev": true
|
||||
},
|
||||
"bytes": {
|
||||
"version": "3.0.0",
|
||||
|
@ -3287,7 +3288,8 @@
|
|||
"esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||
"integrity": "sha1-E7BM2z5sXRnfkatph6hpVhmwqnE="
|
||||
"integrity": "sha1-E7BM2z5sXRnfkatph6hpVhmwqnE=",
|
||||
"dev": true
|
||||
},
|
||||
"estraverse": {
|
||||
"version": "4.2.0",
|
||||
|
@ -4893,6 +4895,16 @@
|
|||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
|
||||
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls="
|
||||
},
|
||||
"js-yaml": {
|
||||
"version": "3.12.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz",
|
||||
"integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"argparse": "^1.0.7",
|
||||
"esprima": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"jsbn": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
||||
|
@ -8607,6 +8619,7 @@
|
|||
"version": "5.11.0",
|
||||
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.11.0.tgz",
|
||||
"integrity": "sha1-mPMMAurjzecAYgHkwzywi0hYHu0=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-code-frame": "^6.22.0",
|
||||
"builtin-modules": "^1.1.1",
|
||||
|
@ -8620,17 +8633,6 @@
|
|||
"semver": "^5.3.0",
|
||||
"tslib": "^1.8.0",
|
||||
"tsutils": "^2.27.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"js-yaml": {
|
||||
"version": "3.12.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz",
|
||||
"integrity": "sha1-6u1lbsg0TxD1J8a/obbiJE3hZ9E=",
|
||||
"requires": {
|
||||
"argparse": "^1.0.7",
|
||||
"esprima": "^4.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tslint-microsoft-contrib": {
|
||||
|
@ -8656,7 +8658,8 @@
|
|||
"tsutils": {
|
||||
"version": "2.29.0",
|
||||
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz",
|
||||
"integrity": "sha1-MrSIUBRnrL7dS4VJhnOggSrKC5k=",
|
||||
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"tslib": "^1.8.1"
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"tslint": "tslint ./packages/*/src/**/*.ts -t verbose",
|
||||
"tslint": "tslint ./src ./packages/**/*.ts -t verbose",
|
||||
"build": "tsc",
|
||||
"build-docs": "typedoc --options typedoc.json src/",
|
||||
"test": "nyc --reporter=html --reporter=text mocha -r ts-node/register packages/**/*.test.ts ",
|
||||
|
@ -89,7 +89,6 @@
|
|||
"swagger-client": "3.8.22",
|
||||
"tedious": "3.0.1",
|
||||
"ts-node": "7.0.1",
|
||||
"tslint": "^5.11.0",
|
||||
"typedoc": "0.13.0",
|
||||
"typedoc-plugin-external-module-name": "^1.1.3",
|
||||
"typedoc-plugin-markdown": "^1.1.18",
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const UrlJoin = require("url-join");
|
||||
import { GBMinInstance } from "botlib";
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,35 +30,27 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
'use strict'
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
const UrlJoin = require('url-join')
|
||||
'use strict';
|
||||
|
||||
import { AdminDialog } from './dialogs/AdminDialog'
|
||||
import { GBMinInstance, IGBPackage, IGBCoreService } from 'botlib'
|
||||
import urlJoin = require('url-join');
|
||||
|
||||
import { Sequelize } from 'sequelize-typescript'
|
||||
import { GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
|
||||
import { Sequelize } from 'sequelize-typescript';
|
||||
import { AdminDialog } from './dialogs/AdminDialog';
|
||||
import { GuaribasAdmin } from './models/AdminModel';
|
||||
|
||||
export class GBAdminPackage implements IGBPackage {
|
||||
sysPackages: IGBPackage[] = null
|
||||
public sysPackages: IGBPackage[] = null;
|
||||
|
||||
loadPackage(core: IGBCoreService, sequelize: Sequelize): void {
|
||||
core.sequelize.addModels([
|
||||
GuaribasAdmin
|
||||
])
|
||||
public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {
|
||||
core.sequelize.addModels([GuaribasAdmin]);
|
||||
}
|
||||
|
||||
unloadPackage(core: IGBCoreService): void {
|
||||
}
|
||||
|
||||
loadBot(min: GBMinInstance): void {
|
||||
AdminDialog.setup(min.bot, min)
|
||||
}
|
||||
|
||||
unloadBot(min: GBMinInstance): void {
|
||||
}
|
||||
|
||||
onNewSession(min: GBMinInstance, step: any): void {
|
||||
public loadBot(min: GBMinInstance): void {
|
||||
AdminDialog.setup(min.bot, min);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import {
|
||||
Table,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { GuaribasAdmin } from "../models/AdminModel";
|
||||
import { IGBCoreService } from "botlib";
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict"
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
const UrlJoin = require("url-join")
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict"
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
import {
|
||||
DataTypes,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,6 +30,10 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
import { GuaribasUser } from "../../security.gblib/models"
|
||||
import { GuaribasConversation, GuaribasConversationMessage } from "../models"
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,38 +30,40 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
import { GBMinInstance } from "botlib";
|
||||
import { IGBDialog } from "botlib";
|
||||
import { BotAdapter } from "botbuilder";
|
||||
import { Messages } from "../strings";
|
||||
'use strict';
|
||||
|
||||
import { BotAdapter } from 'botbuilder';
|
||||
import { GBMinInstance } from 'botlib';
|
||||
import { IGBDialog } from 'botlib';
|
||||
import { Messages } from '../strings';
|
||||
|
||||
export class BotFarmDialog extends IGBDialog {
|
||||
|
||||
|
||||
/**
|
||||
* Setup dialogs flows and define services call.
|
||||
*
|
||||
* @param bot The bot adapter.
|
||||
* @param min The minimal bot instance data.
|
||||
*/
|
||||
static setup(bot: BotAdapter, min: GBMinInstance) {
|
||||
min.dialogs.add("/createBotFarm", [
|
||||
public static setup(bot: BotAdapter, min: GBMinInstance) {
|
||||
min.dialogs.add('/createBotFarm', [
|
||||
async step => {
|
||||
let locale = step.context.activity.locale;
|
||||
await step.prompt("choicePrompt", Messages[locale].what_about_me, [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5"
|
||||
const locale = step.context.activity.locale;
|
||||
await step.prompt('choicePrompt', Messages[locale].what_about_me, [
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
]);
|
||||
},
|
||||
async step => {
|
||||
let locale = step.context.activity.locale;
|
||||
const locale = step.context.activity.locale;
|
||||
await step.context.sendActivity(Messages[locale].thanks);
|
||||
}
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,32 +30,25 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict"
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
const UrlJoin = require("url-join")
|
||||
import { GBMinInstance, IGBPackage, IGBCoreService } from "botlib"
|
||||
import { Sequelize } from "sequelize-typescript"
|
||||
'use strict';
|
||||
|
||||
const UrlJoin = require('url-join');
|
||||
import { GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
|
||||
import { Sequelize } from 'sequelize-typescript';
|
||||
|
||||
export class GBWhatsappPackage implements IGBPackage {
|
||||
public sysPackages: IGBPackage[] = null;
|
||||
|
||||
sysPackages: IGBPackage[] = null
|
||||
public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {}
|
||||
|
||||
loadPackage(core: IGBCoreService, sequelize: Sequelize): void {
|
||||
}
|
||||
public unloadPackage(core: IGBCoreService): void {}
|
||||
|
||||
unloadPackage(core: IGBCoreService): void {
|
||||
public loadBot(min: GBMinInstance): void {}
|
||||
|
||||
}
|
||||
|
||||
loadBot(min: GBMinInstance): void {
|
||||
|
||||
}
|
||||
|
||||
unloadBot(min: GBMinInstance): void {
|
||||
|
||||
}
|
||||
onNewSession(min: GBMinInstance, step: any): void {
|
||||
|
||||
}
|
||||
public unloadBot(min: GBMinInstance): void {}
|
||||
public onNewSession(min: GBMinInstance, step: any): void {}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { GBService, IGBInstance } from "botlib";
|
||||
import {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict"
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
const UrlJoin = require("url-join")
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { IGBDialog } from "botlib";
|
||||
import { GBMinInstance } from "botlib";
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { IGBDialog } from "botlib";
|
||||
import { GBMinInstance } from "botlib";
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict"
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
const UrlJoin = require("url-join")
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
import {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -33,6 +33,10 @@
|
|||
const logger = require("../../../src/logger");
|
||||
import * as fs from "fs";
|
||||
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
export class GBConfigService {
|
||||
|
@ -98,9 +102,7 @@ export class GBConfigService {
|
|||
value = "true";
|
||||
break;
|
||||
default:
|
||||
logger.warn(
|
||||
`Invalid key on .env file: '${key}'`
|
||||
);
|
||||
logger.warn(`Invalid key on .env file: '${key}'`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const logger = require("../../../src/logger");
|
||||
|
||||
|
@ -75,7 +79,7 @@ export class GBConversationalService implements IGBConversationalService {
|
|||
mobile: string,
|
||||
text: string
|
||||
): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve: any, reject: any): any => {
|
||||
const nexmo = new Nexmo({
|
||||
apiKey: min.instance.smsKey,
|
||||
apiSecret: min.instance.smsSecret
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -34,26 +34,21 @@
|
|||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
const logger = require("../../../src/logger");
|
||||
import { Sequelize } from "sequelize-typescript";
|
||||
import * as fs from "fs";
|
||||
import { GBConfigService } from "./GBConfigService";
|
||||
import { IGBInstance, IGBCoreService } from "botlib";
|
||||
import { GuaribasInstance } from "../models/GBModel";
|
||||
import { GBAdminService } from "../../admin.gbapp/services/GBAdminService";
|
||||
const processExists = require("process-exists");
|
||||
const TextDecoder = require("util").TextDecoder;
|
||||
import { IGBCoreService, IGBInstance } from 'botlib';
|
||||
import * as fs from 'fs';
|
||||
import processExists = require('process-exists');
|
||||
import { Sequelize } from 'sequelize-typescript';
|
||||
import logger = require('../../../src/logger');
|
||||
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService';
|
||||
import { GuaribasInstance } from '../models/GBModel';
|
||||
import { GBConfigService } from './GBConfigService';
|
||||
|
||||
/**
|
||||
* Core service layer.
|
||||
*/
|
||||
export class GBCoreService implements IGBCoreService {
|
||||
isCloudSetup() {
|
||||
return GBConfigService.tryGet("STORAGE_DIALECT");
|
||||
}
|
||||
|
||||
/**
|
||||
* Data access layer instance.
|
||||
*/
|
||||
|
@ -72,12 +67,16 @@ export class GBCoreService implements IGBCoreService {
|
|||
/**
|
||||
* Custom create table query.
|
||||
*/
|
||||
private createTableQuery: (tableName, attributes, options) => string;
|
||||
private createTableQuery: (
|
||||
tableName: string,
|
||||
attributes: any,
|
||||
options: any,
|
||||
) => string;
|
||||
|
||||
/**
|
||||
* Custom change column query.
|
||||
*/
|
||||
private changeColumnQuery: (tableName, attributes) => string;
|
||||
private changeColumnQuery: (tableName: string, attributes: any) => string;
|
||||
|
||||
/**
|
||||
* Dialect used. Tested: mssql and sqlite.
|
||||
|
@ -94,75 +93,149 @@ export class GBCoreService implements IGBCoreService {
|
|||
/**
|
||||
* Gets database config and connect to storage.
|
||||
*/
|
||||
async initDatabase() {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
this.dialect = GBConfigService.get("STORAGE_DIALECT");
|
||||
public async initDatabase(): Promise<any> {
|
||||
return new Promise(
|
||||
(resolve: any, reject: any): any => {
|
||||
try {
|
||||
this.dialect = GBConfigService.get('STORAGE_DIALECT');
|
||||
|
||||
let host: string | undefined;
|
||||
let database: string | undefined;
|
||||
let username: string | undefined;
|
||||
let password: string | undefined;
|
||||
let storage: string | undefined;
|
||||
let host: string | undefined;
|
||||
let database: string | undefined;
|
||||
let username: string | undefined;
|
||||
let password: string | undefined;
|
||||
let storage: string | undefined;
|
||||
|
||||
if (this.dialect === "mssql") {
|
||||
host = GBConfigService.get("STORAGE_SERVER");
|
||||
database = GBConfigService.get("STORAGE_NAME");
|
||||
username = GBConfigService.get("STORAGE_USERNAME");
|
||||
password = GBConfigService.get("STORAGE_PASSWORD");
|
||||
} else if (this.dialect === "sqlite") {
|
||||
storage = GBConfigService.get("STORAGE_STORAGE");
|
||||
} else {
|
||||
reject(`Unknown dialect: ${this.dialect}.`);
|
||||
}
|
||||
|
||||
let logging =
|
||||
GBConfigService.get("STORAGE_LOGGING") === "true"
|
||||
? (str: string) => {
|
||||
logger.info(str);
|
||||
}
|
||||
: false;
|
||||
|
||||
let encrypt = GBConfigService.get("STORAGE_ENCRYPT") === "true";
|
||||
|
||||
this.sequelize = new Sequelize({
|
||||
host: host,
|
||||
database: database,
|
||||
username: username,
|
||||
password: password,
|
||||
logging: logging,
|
||||
operatorsAliases: false,
|
||||
dialect: this.dialect,
|
||||
storage: storage,
|
||||
dialectOptions: {
|
||||
encrypt: encrypt
|
||||
},
|
||||
pool: {
|
||||
max: 32,
|
||||
min: 8,
|
||||
idle: 40000,
|
||||
evict: 40000,
|
||||
acquire: 40000
|
||||
if (this.dialect === 'mssql') {
|
||||
host = GBConfigService.get('STORAGE_SERVER');
|
||||
database = GBConfigService.get('STORAGE_NAME');
|
||||
username = GBConfigService.get('STORAGE_USERNAME');
|
||||
password = GBConfigService.get('STORAGE_PASSWORD');
|
||||
} else if (this.dialect === 'sqlite') {
|
||||
storage = GBConfigService.get('STORAGE_STORAGE');
|
||||
} else {
|
||||
reject(`Unknown dialect: ${this.dialect}.`);
|
||||
}
|
||||
});
|
||||
|
||||
if (this.dialect === "mssql") {
|
||||
this.queryGenerator = this.sequelize.getQueryInterface().QueryGenerator;
|
||||
this.createTableQuery = this.queryGenerator.createTableQuery;
|
||||
this.queryGenerator.createTableQuery = (
|
||||
tableName,
|
||||
attributes,
|
||||
options
|
||||
) => this.createTableQueryOverride(tableName, attributes, options);
|
||||
this.changeColumnQuery = this.queryGenerator.changeColumnQuery;
|
||||
this.queryGenerator.changeColumnQuery = (tableName, attributes) =>
|
||||
this.changeColumnQueryOverride(tableName, attributes);
|
||||
const logging: any =
|
||||
GBConfigService.get('STORAGE_LOGGING') === 'true'
|
||||
? (str: string): void => {
|
||||
logger.info(str);
|
||||
}
|
||||
: false;
|
||||
|
||||
const encrypt: boolean =
|
||||
GBConfigService.get('STORAGE_ENCRYPT') === 'true';
|
||||
|
||||
this.sequelize = new Sequelize({
|
||||
host: host,
|
||||
database: database,
|
||||
username: username,
|
||||
password: password,
|
||||
logging: logging,
|
||||
operatorsAliases: false,
|
||||
dialect: this.dialect,
|
||||
storage: storage,
|
||||
dialectOptions: {
|
||||
encrypt: encrypt,
|
||||
},
|
||||
pool: {
|
||||
max: 32,
|
||||
min: 8,
|
||||
idle: 40000,
|
||||
evict: 40000,
|
||||
acquire: 40000,
|
||||
},
|
||||
});
|
||||
|
||||
if (this.dialect === 'mssql') {
|
||||
this.queryGenerator = this.sequelize.getQueryInterface().QueryGenerator;
|
||||
this.createTableQuery = this.queryGenerator.createTableQuery;
|
||||
this.queryGenerator.createTableQuery = (
|
||||
tableName,
|
||||
attributes,
|
||||
options,
|
||||
) => this.createTableQueryOverride(tableName, attributes, options);
|
||||
this.changeColumnQuery = this.queryGenerator.changeColumnQuery;
|
||||
this.queryGenerator.changeColumnQuery = (tableName, attributes) =>
|
||||
this.changeColumnQueryOverride(tableName, attributes);
|
||||
}
|
||||
resolve();
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
resolve();
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
public async syncDatabaseStructure() {
|
||||
if (GBConfigService.get('STORAGE_SYNC') === 'true') {
|
||||
const alter = GBConfigService.get('STORAGE_SYNC_ALTER') === 'true';
|
||||
const force = GBConfigService.get('STORAGE_SYNC_FORCE') === 'true';
|
||||
logger.info('Syncing database...');
|
||||
return this.sequelize.sync({
|
||||
alter: alter,
|
||||
force: force,
|
||||
});
|
||||
} else {
|
||||
const msg = 'Database synchronization is disabled.';
|
||||
logger.info(msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all items to start several listeners.
|
||||
*/
|
||||
public async loadInstances(): Promise<IGBInstance> {
|
||||
return GuaribasInstance.findAll({});
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads just one Bot instance by its internal Id.
|
||||
*/
|
||||
public async loadInstanceById(instanceId: string): Promise<IGBInstance> {
|
||||
const options = { where: { instanceId: instanceId } };
|
||||
return GuaribasInstance.findOne(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads just one Bot instance.
|
||||
*/
|
||||
public async loadInstance(botId: string): Promise<IGBInstance> {
|
||||
const options = { where: {} };
|
||||
|
||||
if (botId !== '[default]') {
|
||||
options.where = { botId: botId };
|
||||
}
|
||||
|
||||
return GuaribasInstance.findOne(options);
|
||||
}
|
||||
|
||||
public async writeEnv(instance: IGBInstance) {
|
||||
const env =
|
||||
`ADDITIONAL_DEPLOY_PATH=\n` +
|
||||
`ADMIN_PASS=${instance.adminPass}\n` +
|
||||
`CLOUD_SUBSCRIPTIONID=${instance.cloudSubscriptionId}\n` +
|
||||
`CLOUD_LOCATION=${instance.cloudLocation}\n` +
|
||||
`CLOUD_GROUP=${instance.botId}\n` +
|
||||
`CLOUD_USERNAME=${instance.cloudUsername}\n` +
|
||||
`CLOUD_PASSWORD=${instance.cloudPassword}\n` +
|
||||
`MARKETPLACE_ID=${instance.marketplaceId}\n` +
|
||||
`MARKETPLACE_SECRET=${instance.marketplacePassword}\n` +
|
||||
`NLP_AUTHORING_KEY=${instance.nlpAuthoringKey}\n` +
|
||||
`STORAGE_DIALECT=${instance.storageDialect}\n` +
|
||||
`STORAGE_SERVER=${instance.storageServer}.database.windows.net\n` +
|
||||
`STORAGE_NAME=${instance.storageName}\n` +
|
||||
`STORAGE_USERNAME=${instance.storageUsername}\n` +
|
||||
`STORAGE_PASSWORD=${instance.storagePassword}\n` +
|
||||
`STORAGE_SYNC=true\n`;
|
||||
|
||||
fs.writeFileSync('.env', env);
|
||||
}
|
||||
|
||||
public async ensureProxy(port): Promise<string> {
|
||||
let proxyAddress: string;
|
||||
const ngrok = require('ngrok');
|
||||
return await ngrok.connect({ port: port });
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -184,7 +257,7 @@ export class GBCoreService implements IGBCoreService {
|
|||
let sql: string = this.createTableQuery.apply(this.queryGenerator, [
|
||||
tableName,
|
||||
attributes,
|
||||
options
|
||||
options,
|
||||
]);
|
||||
const re1 = /CREATE\s+TABLE\s+\[([^\]]*)\]/;
|
||||
const matches = re1.exec(sql);
|
||||
|
@ -194,8 +267,8 @@ export class GBCoreService implements IGBCoreService {
|
|||
sql = sql.replace(
|
||||
re2,
|
||||
(match: string, ...args: any[]): string => {
|
||||
return "CONSTRAINT [" + table + "_pk] " + match;
|
||||
}
|
||||
return 'CONSTRAINT [' + table + '_pk] ' + match;
|
||||
},
|
||||
);
|
||||
const re3 = /FOREIGN\s+KEY\s+\((\[[^\]]*\](?:,\s*\[[^\]]*\])*)\)/g;
|
||||
const re4 = /\[([^\]]*)\]/g;
|
||||
|
@ -206,11 +279,11 @@ export class GBCoreService implements IGBCoreService {
|
|||
let fkname = table;
|
||||
let matches = re4.exec(fkcols);
|
||||
while (matches != null) {
|
||||
fkname += "_" + matches[1];
|
||||
fkname += '_' + matches[1];
|
||||
matches = re4.exec(fkcols);
|
||||
}
|
||||
return "CONSTRAINT [" + fkname + "_fk] FOREIGN KEY (" + fkcols + ")";
|
||||
}
|
||||
return 'CONSTRAINT [' + fkname + '_fk] FOREIGN KEY (' + fkcols + ')';
|
||||
},
|
||||
);
|
||||
}
|
||||
return sql;
|
||||
|
@ -227,7 +300,7 @@ export class GBCoreService implements IGBCoreService {
|
|||
private changeColumnQueryOverride(tableName, attributes): string {
|
||||
let sql: string = this.changeColumnQuery.apply(this.queryGenerator, [
|
||||
tableName,
|
||||
attributes
|
||||
attributes,
|
||||
]);
|
||||
const re1 = /ALTER\s+TABLE\s+\[([^\]]*)\]/;
|
||||
const matches = re1.exec(sql);
|
||||
|
@ -242,91 +315,20 @@ export class GBCoreService implements IGBCoreService {
|
|||
let fkname = table;
|
||||
let matches = re3.exec(fkcols);
|
||||
while (matches != null) {
|
||||
fkname += "_" + matches[1];
|
||||
fkname += '_' + matches[1];
|
||||
matches = re3.exec(fkcols);
|
||||
}
|
||||
return (
|
||||
(args[0] ? args[0] : "") +
|
||||
"CONSTRAINT [" +
|
||||
(args[0] ? args[0] : '') +
|
||||
'CONSTRAINT [' +
|
||||
fkname +
|
||||
"_fk] FOREIGN KEY (" +
|
||||
'_fk] FOREIGN KEY (' +
|
||||
fkcols +
|
||||
")"
|
||||
')'
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
return sql;
|
||||
}
|
||||
|
||||
async syncDatabaseStructure() {
|
||||
if (GBConfigService.get("STORAGE_SYNC") === "true") {
|
||||
const alter = GBConfigService.get("STORAGE_SYNC_ALTER") === "true";
|
||||
const force = GBConfigService.get("STORAGE_SYNC_FORCE") === "true";
|
||||
logger.info("Syncing database...");
|
||||
return this.sequelize.sync({
|
||||
alter: alter,
|
||||
force: force
|
||||
});
|
||||
} else {
|
||||
let msg = "Database synchronization is disabled.";
|
||||
logger.info(msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all items to start several listeners.
|
||||
*/
|
||||
async loadInstances(): Promise<IGBInstance> {
|
||||
return GuaribasInstance.findAll({});
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads just one Bot instance by its internal Id.
|
||||
*/
|
||||
async loadInstanceById(instanceId: string): Promise<IGBInstance> {
|
||||
let options = { where: { instanceId: instanceId } };
|
||||
return GuaribasInstance.findOne(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads just one Bot instance.
|
||||
*/
|
||||
async loadInstance(botId: string): Promise<IGBInstance> {
|
||||
let options = { where: {} };
|
||||
|
||||
if (botId != "[default]") {
|
||||
options.where = { botId: botId };
|
||||
}
|
||||
|
||||
return GuaribasInstance.findOne(options);
|
||||
}
|
||||
|
||||
public async writeEnv(instance: IGBInstance) {
|
||||
let env =
|
||||
`ADDITIONAL_DEPLOY_PATH=\n` +
|
||||
`ADMIN_PASS=${instance.adminPass}\n` +
|
||||
`CLOUD_SUBSCRIPTIONID=${instance.cloudSubscriptionId}\n` +
|
||||
`CLOUD_LOCATION=${instance.cloudLocation}\n` +
|
||||
`CLOUD_GROUP=${instance.botId}\n` +
|
||||
`CLOUD_USERNAME=${instance.cloudUsername}\n` +
|
||||
`CLOUD_PASSWORD=${instance.cloudPassword}\n` +
|
||||
`MARKETPLACE_ID=${instance.marketplaceId}\n`+
|
||||
`MARKETPLACE_SECRET=${instance.marketplacePassword}\n`+
|
||||
`NLP_AUTHORING_KEY=${instance.nlpAuthoringKey}\n`+
|
||||
`STORAGE_DIALECT=${instance.storageDialect}\n` +
|
||||
`STORAGE_SERVER=${instance.storageServer}.database.windows.net\n` +
|
||||
`STORAGE_NAME=${instance.storageName}\n` +
|
||||
`STORAGE_USERNAME=${instance.storageUsername}\n` +
|
||||
`STORAGE_PASSWORD=${instance.storagePassword}\n` +
|
||||
`STORAGE_SYNC=true\n`;
|
||||
|
||||
fs.writeFileSync(".env", env);
|
||||
}
|
||||
|
||||
public async ensureProxy(port): Promise<string> {
|
||||
let proxyAddress: string;
|
||||
const ngrok = require("ngrok");
|
||||
return await ngrok.connect({port:port});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const logger = require("../../../src/logger");
|
||||
const Path = require("path");
|
||||
|
@ -72,7 +76,7 @@ export class GBDeployer {
|
|||
appPackages: Array<IGBPackage>
|
||||
) {
|
||||
let _this = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve: any, reject: any): any => {
|
||||
let totalPackages = 0;
|
||||
let additionalPath = GBConfigService.get("ADDITIONAL_DEPLOY_PATH");
|
||||
let paths = [GBDeployer.deployFolder];
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -31,7 +31,11 @@
|
|||
\*****************************************************************************/
|
||||
|
||||
|
||||
"use strict"
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
const UrlJoin = require("url-join")
|
||||
import Fs = require("fs")
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const { DialogSet, TextPrompt } = require("botbuilder-dialogs");
|
||||
const UrlJoin = require("url-join");
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { CSService } from "../services/CSService";
|
||||
import { AzureText } from "pragmatismo-io-framework";
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { IGBDialog } from "botlib";
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict"
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
const UrlJoin = require("url-join")
|
||||
import { GuaribasQuestionAlternate } from './models/index'
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict"
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
import {
|
||||
DataTypes,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
|
|
@ -318,7 +318,7 @@ class GBUIApp extends React.Component {
|
|||
gbCss = <GBCss instance={this.state.instance} />;
|
||||
|
||||
function getToken() {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve: any, reject: any): any => {
|
||||
resolve(token);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { IGBDialog } from "botlib";
|
||||
import { AzureText } from "pragmatismo-io-framework";
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict"
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
import { KBService } from './../services/KBService'
|
||||
import { IGBDialog } from "botlib"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict"
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
const UrlJoin = require("url-join")
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,85 +30,85 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict"
|
||||
|
||||
import {
|
||||
DataTypes,
|
||||
DataTypeUUIDv4,
|
||||
DataTypeDate,
|
||||
DataTypeDecimal
|
||||
} from "sequelize"
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import {
|
||||
AutoIncrement,
|
||||
BelongsTo,
|
||||
Column,
|
||||
CreatedAt,
|
||||
DataType,
|
||||
ForeignKey,
|
||||
HasMany,
|
||||
HasOne,
|
||||
IsUUID,
|
||||
Length,
|
||||
Model,
|
||||
PrimaryKey,
|
||||
Sequelize,
|
||||
Table,
|
||||
Column,
|
||||
Model,
|
||||
HasMany,
|
||||
BelongsTo,
|
||||
BelongsToMany,
|
||||
Length,
|
||||
ForeignKey,
|
||||
CreatedAt,
|
||||
UpdatedAt,
|
||||
DataType,
|
||||
IsUUID,
|
||||
PrimaryKey,
|
||||
AutoIncrement,
|
||||
HasOne
|
||||
} from "sequelize-typescript"
|
||||
UpdatedAt
|
||||
} from 'sequelize-typescript';
|
||||
|
||||
import { GuaribasUser } from "../../security.gblib/models"
|
||||
import { GuaribasInstance, GuaribasPackage } from "../../core.gbapp/models/GBModel"
|
||||
import {
|
||||
GuaribasInstance,
|
||||
GuaribasPackage
|
||||
} from '../../core.gbapp/models/GBModel';
|
||||
import { GuaribasUser } from '../../security.gblib/models';
|
||||
|
||||
@Table
|
||||
export class GuaribasSubject extends Model<GuaribasSubject> {
|
||||
@PrimaryKey
|
||||
@AutoIncrement
|
||||
@Column
|
||||
subjectId: number
|
||||
public subjectId: number;
|
||||
|
||||
@Column internalId: string
|
||||
@Column public internalId: string;
|
||||
|
||||
@Column title: string
|
||||
@Column public title: string;
|
||||
|
||||
@Column(DataType.STRING(512))
|
||||
@Column description: string
|
||||
@Column
|
||||
public description: string;
|
||||
|
||||
@Column from: string
|
||||
@Column public from: string;
|
||||
|
||||
@Column to: string
|
||||
@Column public to: string;
|
||||
|
||||
@ForeignKey(() => GuaribasSubject)
|
||||
@Column
|
||||
parentSubjectId: number
|
||||
public parentSubjectId: number;
|
||||
|
||||
@BelongsTo(() => GuaribasSubject, "parentSubjectId")
|
||||
parentSubject: GuaribasSubject
|
||||
@BelongsTo(() => GuaribasSubject, 'parentSubjectId')
|
||||
public parentSubject: GuaribasSubject;
|
||||
|
||||
@HasMany(() => GuaribasSubject, { foreignKey: "parentSubjectId" })
|
||||
childrenSubjects: GuaribasSubject[]
|
||||
@HasMany(() => GuaribasSubject, { foreignKey: 'parentSubjectId' })
|
||||
public childrenSubjects: GuaribasSubject[];
|
||||
|
||||
@ForeignKey(() => GuaribasInstance)
|
||||
@Column
|
||||
instanceId: number
|
||||
public instanceId: number;
|
||||
|
||||
@BelongsTo(() => GuaribasInstance)
|
||||
instance: GuaribasInstance
|
||||
public instance: GuaribasInstance;
|
||||
|
||||
@ForeignKey(() => GuaribasUser)
|
||||
@Column
|
||||
responsibleUserId: number
|
||||
public responsibleUserId: number;
|
||||
|
||||
@BelongsTo(() => GuaribasUser)
|
||||
responsibleUser: GuaribasUser
|
||||
public responsibleUser: GuaribasUser;
|
||||
|
||||
@ForeignKey(() => GuaribasPackage)
|
||||
@Column
|
||||
packageId: number
|
||||
public packageId: number;
|
||||
|
||||
@BelongsTo(() => GuaribasPackage)
|
||||
package: GuaribasPackage
|
||||
public package: GuaribasPackage;
|
||||
}
|
||||
|
||||
@Table
|
||||
|
@ -116,62 +116,62 @@ export class GuaribasQuestion extends Model<GuaribasQuestion> {
|
|||
@PrimaryKey
|
||||
@AutoIncrement
|
||||
@Column
|
||||
questionId: number
|
||||
public questionId: number;
|
||||
|
||||
@Column(DataType.STRING(64))
|
||||
@Column
|
||||
subject1: string
|
||||
public subject1: string;
|
||||
|
||||
@Column(DataType.STRING(64))
|
||||
@Column
|
||||
subject2: string
|
||||
public subject2: string;
|
||||
|
||||
@Column(DataType.STRING(64))
|
||||
@Column
|
||||
subject3: string
|
||||
public subject3: string;
|
||||
|
||||
@Column(DataType.STRING(64))
|
||||
@Column
|
||||
subject4: string
|
||||
public subject4: string;
|
||||
|
||||
@Column(DataType.STRING(1024))
|
||||
@Column
|
||||
keywords: string
|
||||
public keywords: string;
|
||||
|
||||
@Column(DataType.STRING(512))
|
||||
from: string
|
||||
public from: string;
|
||||
|
||||
@Column(DataType.STRING(512))
|
||||
to: string
|
||||
public to: string;
|
||||
|
||||
@Column(DataType.TEXT)
|
||||
content: string
|
||||
public content: string;
|
||||
|
||||
@Column
|
||||
@CreatedAt
|
||||
createdAt: Date
|
||||
public createdAt: Date;
|
||||
|
||||
@Column
|
||||
@UpdatedAt
|
||||
updatedAt: Date
|
||||
public updatedAt: Date;
|
||||
|
||||
@ForeignKey(() => GuaribasAnswer)
|
||||
@Column
|
||||
answerId: number
|
||||
public answerId: number;
|
||||
|
||||
@BelongsTo(() => GuaribasInstance)
|
||||
instance: GuaribasInstance
|
||||
public instance: GuaribasInstance;
|
||||
|
||||
@ForeignKey(() => GuaribasInstance)
|
||||
@Column
|
||||
instanceId: number
|
||||
public instanceId: number;
|
||||
|
||||
@ForeignKey(() => GuaribasPackage)
|
||||
@Column
|
||||
packageId: number
|
||||
public packageId: number;
|
||||
|
||||
@BelongsTo(() => GuaribasPackage)
|
||||
package: GuaribasPackage
|
||||
public package: GuaribasPackage;
|
||||
}
|
||||
|
||||
@Table
|
||||
|
@ -179,53 +179,52 @@ export class GuaribasAnswer extends Model<GuaribasAnswer> {
|
|||
@PrimaryKey
|
||||
@AutoIncrement
|
||||
@Column
|
||||
answerId: number
|
||||
public answerId: number;
|
||||
|
||||
@Length({ min: 0, max: 512 })
|
||||
@Column
|
||||
media: string
|
||||
public media: string;
|
||||
|
||||
@Length({ min: 0, max: 12 })
|
||||
@Column
|
||||
format: string
|
||||
public format: string;
|
||||
|
||||
@Column(DataType.TEXT)
|
||||
content: string
|
||||
public content: string;
|
||||
|
||||
@Column
|
||||
@CreatedAt
|
||||
createdAt: Date
|
||||
public createdAt: Date;
|
||||
|
||||
@Column
|
||||
@UpdatedAt
|
||||
updatedAt: Date
|
||||
public updatedAt: Date;
|
||||
|
||||
@HasMany(() => GuaribasQuestion)
|
||||
questions: GuaribasQuestion[]
|
||||
public questions: GuaribasQuestion[];
|
||||
|
||||
@HasOne(() => GuaribasQuestion)
|
||||
prev: GuaribasQuestion
|
||||
public prev: GuaribasQuestion;
|
||||
|
||||
@HasOne(() => GuaribasQuestion)
|
||||
next: GuaribasQuestion
|
||||
public next: GuaribasQuestion;
|
||||
|
||||
@ForeignKey(() => GuaribasQuestion)
|
||||
@Column
|
||||
nextId: number
|
||||
public nextId: number;
|
||||
|
||||
@ForeignKey(() => GuaribasQuestion)
|
||||
@Column
|
||||
prevId: number
|
||||
public prevId: number;
|
||||
|
||||
@ForeignKey(() => GuaribasInstance)
|
||||
@Column
|
||||
instanceId: number
|
||||
public instanceId: number;
|
||||
|
||||
@ForeignKey(() => GuaribasPackage)
|
||||
@Column
|
||||
packageId: number
|
||||
public packageId: number;
|
||||
|
||||
@BelongsTo(() => GuaribasPackage)
|
||||
package: GuaribasPackage
|
||||
|
||||
public package: GuaribasPackage;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict"
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
const UrlJoin = require("url-join")
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict"
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
import {
|
||||
DataTypes,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -30,7 +30,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict"
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
const UrlJoin = require("url-join")
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
@ -31,7 +31,11 @@
|
|||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const logger = require("./logger");
|
||||
const express = require("express");
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
| |
|
||||
| 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. |
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
"no-parameter-properties": false,
|
||||
"no-reserved-keywords": false,
|
||||
"no-unnecessary-class":false,
|
||||
"no-require-imports": false,
|
||||
"function-name": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-return-await": false,
|
||||
|
@ -32,6 +33,7 @@
|
|||
"no-parameter-reassignment":false,
|
||||
"export-name":false,
|
||||
"no-relative-imports": false,
|
||||
"no-backbone-get-set-outside-model": false,
|
||||
"max-line-length": [true,{"limit":80,"ignore-pattern":"^\\s+\\*"}]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue