diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..240a8c3f4 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text=auto +*.js eol=lf +*.ts eol=lf diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..847c9dbaa --- /dev/null +++ b/.prettierrc @@ -0,0 +1,8 @@ +{ + "trailingComma": "all", + "tabWidth": 2, + "printWidth": 80, + "arrowParens": "avoid", + "semi": true, + "singleQuote": true +} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 2cef5d7f4..b654df34a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/package-lock.json b/package-lock.json index 582bd2e71..659e29870 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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" } diff --git a/package.json b/package.json index b22142d41..48900fa35 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/admin.gbapp/dialogs/AdminDialog.ts b/packages/admin.gbapp/dialogs/AdminDialog.ts index e3e10506d..2831a7332 100644 --- a/packages/admin.gbapp/dialogs/AdminDialog.ts +++ b/packages/admin.gbapp/dialogs/AdminDialog.ts @@ -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"; diff --git a/packages/admin.gbapp/index.ts b/packages/admin.gbapp/index.ts index 6e4ccc062..a7e22288b 100644 --- a/packages/admin.gbapp/index.ts +++ b/packages/admin.gbapp/index.ts @@ -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); } } diff --git a/packages/admin.gbapp/models/AdminModel.ts b/packages/admin.gbapp/models/AdminModel.ts index 9c847417a..f0f439b7b 100644 --- a/packages/admin.gbapp/models/AdminModel.ts +++ b/packages/admin.gbapp/models/AdminModel.ts @@ -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, diff --git a/packages/admin.gbapp/services/GBAdminService.ts b/packages/admin.gbapp/services/GBAdminService.ts index 97f3d3827..0011198d9 100644 --- a/packages/admin.gbapp/services/GBAdminService.ts +++ b/packages/admin.gbapp/services/GBAdminService.ts @@ -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"; diff --git a/packages/analytics.gblib/index.ts b/packages/analytics.gblib/index.ts index 0c8398e35..9e6cdfbc8 100644 --- a/packages/analytics.gblib/index.ts +++ b/packages/analytics.gblib/index.ts @@ -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") diff --git a/packages/analytics.gblib/models/index.ts b/packages/analytics.gblib/models/index.ts index c50c2d156..eea895b23 100644 --- a/packages/analytics.gblib/models/index.ts +++ b/packages/analytics.gblib/models/index.ts @@ -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, diff --git a/packages/analytics.gblib/services/AnalyticsService.ts b/packages/analytics.gblib/services/AnalyticsService.ts index 286cb2bc9..5ab71ec00 100644 --- a/packages/analytics.gblib/services/AnalyticsService.ts +++ b/packages/analytics.gblib/services/AnalyticsService.ts @@ -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" diff --git a/packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts b/packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts index a27a0765c..4bc6b6444 100644 --- a/packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts +++ b/packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts @@ -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); - } + }, ]); } } diff --git a/packages/azuredeployer.gbapp/index.ts b/packages/azuredeployer.gbapp/index.ts index 0989366a9..93f60ac97 100644 --- a/packages/azuredeployer.gbapp/index.ts +++ b/packages/azuredeployer.gbapp/index.ts @@ -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 {} } diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index 9bb4bba36..f6c30475b 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -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 { diff --git a/packages/console.gblib/index.ts b/packages/console.gblib/index.ts index 8fff52204..0a14dc553 100644 --- a/packages/console.gblib/index.ts +++ b/packages/console.gblib/index.ts @@ -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") diff --git a/packages/console.gblib/services/ConsoleDirectLine.ts b/packages/console.gblib/services/ConsoleDirectLine.ts index cb748266f..fc8dccc49 100644 --- a/packages/console.gblib/services/ConsoleDirectLine.ts +++ b/packages/console.gblib/services/ConsoleDirectLine.ts @@ -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. | diff --git a/packages/core.gbapp/dialogs/WelcomeDialog.ts b/packages/core.gbapp/dialogs/WelcomeDialog.ts index fc126c0c1..890057b95 100644 --- a/packages/core.gbapp/dialogs/WelcomeDialog.ts +++ b/packages/core.gbapp/dialogs/WelcomeDialog.ts @@ -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"; diff --git a/packages/core.gbapp/dialogs/WhoAmIDialog.ts b/packages/core.gbapp/dialogs/WhoAmIDialog.ts index 32cef8f97..02027c271 100644 --- a/packages/core.gbapp/dialogs/WhoAmIDialog.ts +++ b/packages/core.gbapp/dialogs/WhoAmIDialog.ts @@ -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"; diff --git a/packages/core.gbapp/index.ts b/packages/core.gbapp/index.ts index 34161403f..a1b70bdda 100644 --- a/packages/core.gbapp/index.ts +++ b/packages/core.gbapp/index.ts @@ -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") diff --git a/packages/core.gbapp/models/GBModel.ts b/packages/core.gbapp/models/GBModel.ts index 4e03da282..0c6c8f09c 100644 --- a/packages/core.gbapp/models/GBModel.ts +++ b/packages/core.gbapp/models/GBModel.ts @@ -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 { diff --git a/packages/core.gbapp/services/GBConfigService.ts b/packages/core.gbapp/services/GBConfigService.ts index b67911521..2bdc308c9 100644 --- a/packages/core.gbapp/services/GBConfigService.ts +++ b/packages/core.gbapp/services/GBConfigService.ts @@ -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; } } diff --git a/packages/core.gbapp/services/GBConversationalService.ts b/packages/core.gbapp/services/GBConversationalService.ts index 30ba6e92a..c50ce2c23 100644 --- a/packages/core.gbapp/services/GBConversationalService.ts +++ b/packages/core.gbapp/services/GBConversationalService.ts @@ -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 { - 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 diff --git a/packages/core.gbapp/services/GBCoreService.ts b/packages/core.gbapp/services/GBCoreService.ts index 57df034ee..574e73faa 100644 --- a/packages/core.gbapp/services/GBCoreService.ts +++ b/packages/core.gbapp/services/GBCoreService.ts @@ -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 { + 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 { + return GuaribasInstance.findAll({}); + } + + /** + * Loads just one Bot instance by its internal Id. + */ + public async loadInstanceById(instanceId: string): Promise { + const options = { where: { instanceId: instanceId } }; + return GuaribasInstance.findOne(options); + } + + /** + * Loads just one Bot instance. + */ + public async loadInstance(botId: string): Promise { + 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 { + 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 { - return GuaribasInstance.findAll({}); - } - - /** - * Loads just one Bot instance by its internal Id. - */ - async loadInstanceById(instanceId: string): Promise { - let options = { where: { instanceId: instanceId } }; - return GuaribasInstance.findOne(options); - } - - /** - * Loads just one Bot instance. - */ - async loadInstance(botId: string): Promise { - 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 { - let proxyAddress: string; - const ngrok = require("ngrok"); - return await ngrok.connect({port:port}); - } } diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index d76b6c284..d68452edf 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -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 ) { 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]; diff --git a/packages/core.gbapp/services/GBImporter.ts b/packages/core.gbapp/services/GBImporter.ts index 02794ecd3..e3dbcf92d 100644 --- a/packages/core.gbapp/services/GBImporter.ts +++ b/packages/core.gbapp/services/GBImporter.ts @@ -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") diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 7424b2446..92b6701a0 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -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"); diff --git a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts index b1e88585f..e0722dd25 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts @@ -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"; diff --git a/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts index b64afeeac..5fce580f5 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts @@ -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"; diff --git a/packages/customer-satisfaction.gbapp/index.ts b/packages/customer-satisfaction.gbapp/index.ts index 752f9af47..f4714b729 100644 --- a/packages/customer-satisfaction.gbapp/index.ts +++ b/packages/customer-satisfaction.gbapp/index.ts @@ -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' diff --git a/packages/customer-satisfaction.gbapp/models/index.ts b/packages/customer-satisfaction.gbapp/models/index.ts index 65d64ee59..2dc1ab347 100644 --- a/packages/customer-satisfaction.gbapp/models/index.ts +++ b/packages/customer-satisfaction.gbapp/models/index.ts @@ -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, diff --git a/packages/customer-satisfaction.gbapp/services/CSService.ts b/packages/customer-satisfaction.gbapp/services/CSService.ts index 08b2e1147..71dcec632 100644 --- a/packages/customer-satisfaction.gbapp/services/CSService.ts +++ b/packages/customer-satisfaction.gbapp/services/CSService.ts @@ -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. | diff --git a/packages/default.gbui/src/GBUIApp.js b/packages/default.gbui/src/GBUIApp.js index 05e96fb22..191989c78 100644 --- a/packages/default.gbui/src/GBUIApp.js +++ b/packages/default.gbui/src/GBUIApp.js @@ -318,7 +318,7 @@ class GBUIApp extends React.Component { gbCss = ; function getToken() { - return new Promise((resolve, reject) => { + return new Promise((resolve: any, reject: any): any => { resolve(token); }); } diff --git a/packages/kb.gbapp/dialogs/AskDialog.ts b/packages/kb.gbapp/dialogs/AskDialog.ts index 5272d2c92..415d5d430 100644 --- a/packages/kb.gbapp/dialogs/AskDialog.ts +++ b/packages/kb.gbapp/dialogs/AskDialog.ts @@ -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"; diff --git a/packages/kb.gbapp/dialogs/FaqDialog.ts b/packages/kb.gbapp/dialogs/FaqDialog.ts index 85ce946d7..4f9991764 100644 --- a/packages/kb.gbapp/dialogs/FaqDialog.ts +++ b/packages/kb.gbapp/dialogs/FaqDialog.ts @@ -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" diff --git a/packages/kb.gbapp/index.ts b/packages/kb.gbapp/index.ts index 9371e0f4e..1bf4fa4ed 100644 --- a/packages/kb.gbapp/index.ts +++ b/packages/kb.gbapp/index.ts @@ -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") diff --git a/packages/kb.gbapp/models/index.ts b/packages/kb.gbapp/models/index.ts index b69bea388..df86b8446 100644 --- a/packages/kb.gbapp/models/index.ts +++ b/packages/kb.gbapp/models/index.ts @@ -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 { @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 { @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 { @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; } diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index 2253a0bb6..19b19bbb1 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -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. | diff --git a/packages/security.gblib/index.ts b/packages/security.gblib/index.ts index a191e8bb1..b698262f1 100644 --- a/packages/security.gblib/index.ts +++ b/packages/security.gblib/index.ts @@ -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") diff --git a/packages/security.gblib/models/index.ts b/packages/security.gblib/models/index.ts index 090c2eebc..22a58d0de 100644 --- a/packages/security.gblib/models/index.ts +++ b/packages/security.gblib/models/index.ts @@ -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, diff --git a/packages/security.gblib/services/SecService.ts b/packages/security.gblib/services/SecService.ts index 1f8044662..a3faacf44 100644 --- a/packages/security.gblib/services/SecService.ts +++ b/packages/security.gblib/services/SecService.ts @@ -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. | diff --git a/packages/whatsapp.gblib/index.ts b/packages/whatsapp.gblib/index.ts index 14ad1b0ea..5d100d9cf 100644 --- a/packages/whatsapp.gblib/index.ts +++ b/packages/whatsapp.gblib/index.ts @@ -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") diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index 8d8f8c034..f27a24be4 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -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. | diff --git a/src/app.ts b/src/app.ts index a14f5224b..73f13646c 100644 --- a/src/app.ts +++ b/src/app.ts @@ -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"); diff --git a/src/logger.ts b/src/logger.ts index f39289c59..b934b918a 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -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. | diff --git a/tslint.json b/tslint.json index 1b82fd749..99e6879ad 100644 --- a/tslint.json +++ b/tslint.json @@ -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+\\*"}] } }