fix(general): tslint being applied in all sources.

This commit is contained in:
Rodrigo Rodriguez 2019-03-08 17:08:42 -03:00
parent 3ec2f53f7d
commit fe3877c97d
6 changed files with 122 additions and 16 deletions

5
src/GBDialogStep.ts Normal file
View file

@ -0,0 +1,5 @@
import { WaterfallStepContext } from "botbuilder-dialogs";
export class GBDialogStep extends WaterfallStepContext {
}

20
src/GBLog.ts Normal file
View file

@ -0,0 +1,20 @@
const logger = require("./logger");
export class GBLog {
public static error(params): void {
logger.error(params);
}
public static warn(params): void {
logger.warn(params);
}
public static info(params): void {
logger.info(params);
}
public static trace(params): void {
logger.trace(params);
}
public static verbose(params): void {
logger.verbose(params);
}
}

View file

@ -33,8 +33,10 @@
"use strict"; "use strict";
import { GBMinInstance } from "./GBMinInstance"; import { GBMinInstance } from "./GBMinInstance";
import { GBDialogStep } from "./GBDialogStep";
export interface IGBConversationalService { export interface IGBConversationalService {
sendEvent(step: any, name: string, value: any); sendEvent(step: GBDialogStep, name: string, value: string);
routeNLP(step: any, min: GBMinInstance, text: string): Promise<boolean>; routeNLP(step: GBDialogStep, min: GBMinInstance, text: string): Promise<boolean>;
getCurrentLanguage(step: GBDialogStep);
} }

View file

@ -34,6 +34,7 @@
import { IGBCoreService } from './IGBCoreService' import { IGBCoreService } from './IGBCoreService'
import { Sequelize } from 'sequelize-typescript' import { Sequelize } from 'sequelize-typescript'
import { GBMinInstance } from '.' import { GBMinInstance } from '.'
import { GBDialogStep } from './GBDialogStep';
// TODO: Include "use strict" in all files. // TODO: Include "use strict" in all files.
@ -70,7 +71,7 @@ export interface IGBPackage{
unloadBot(min: GBMinInstance): void unloadBot(min: GBMinInstance): void
/** /**
* Called in each new step. * Called in each new session.
*/ */
onNewSession(min: GBMinInstance, step: any): void onNewSession(min: GBMinInstance, step: GBDialogStep): void
} }

View file

@ -30,16 +30,18 @@
| | | |
\******************************************************************************/ \******************************************************************************/
'use strict' "use strict";
export { Sequelize } from 'sequelize-typescript' export { Sequelize } from "sequelize-typescript";
export { IGBConversationalService } from './IGBConversationalService' export { IGBConversationalService } from "./IGBConversationalService";
export { IGBCoreService } from './IGBCoreService' export { IGBCoreService } from "./IGBCoreService";
export { IGBDialog } from './IGBDialog' export { IGBDialog } from "./IGBDialog";
export { IGBPackage } from './IGBPackage' export { IGBPackage } from "./IGBPackage";
export { IGBInstance } from './IGBInstance' export { IGBInstance } from "./IGBInstance";
export { GBError, GBERROR_TYPE } from './GBError' export { GBError, GBERROR_TYPE } from "./GBError";
export { GBService } from './GBService' export { GBService } from "./GBService";
export { GBMinInstance } from './GBMinInstance' export { GBMinInstance } from "./GBMinInstance";
export { IGBAdminService } from './IGBAdminService' export { IGBAdminService } from "./IGBAdminService";
export { IGBInstallationDeployer } from './IGBInstallationDeployer' export { IGBInstallationDeployer } from "./IGBInstallationDeployer";
export { GBDialogStep } from "./GBDialogStep";
export { GBLog } from "./GBLog";

76
src/logger.ts Normal file
View file

@ -0,0 +1,76 @@
/*****************************************************************************\
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) Pragmatismo.io. All rights reserved. |
| Licensed under the AGPL-3.0. |
| |
| According to our dual licensing model, this program can be used either |
| under the terms of the GNU Affero General Public License, version 3, |
| or under a proprietary license. |
| |
| The texts of the GNU Affero General Public License with an additional |
| permission and of our proprietary license can be found at and |
| in the LICENSE file you have received along with this program. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY, without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU Affero General Public License for more details. |
| |
| "General Bots" is a registered trademark of Pragmatismo.io. |
| The licensing of the program under the AGPLv3 does not imply a |
| trademark license. Therefore any rights, title and interest in |
| our trademarks remain entirely with us. |
| |
\*****************************************************************************/
/**
* @fileoverview Logging support.
*/
const { createLogger, format, transports } = require('winston');
const config = {
levels: {
error: 0,
debug: 1,
warn: 2,
data: 3,
info: 4,
verbose: 5,
silly: 6,
custom: 7
},
colors: {
error: 'red',
debug: 'blue',
warn: 'yellow',
data: 'grey',
info: 'green',
verbose: 'cyan',
silly: 'magenta',
custom: 'yellow'
}
};
const logger = createLogger({
format: format.combine(
format.colorize(),
format.simple(),
format.label({ label: 'GeneralBots' }),
format.timestamp(),
format.printf(nfo => {
return `${nfo.timestamp} [${nfo.label}] ${nfo.level}: ${nfo.message}`;
})
),
levels: config.levels,
transports: [new transports.Console()]
});
module.exports = logger;