Skip to content

Commit

Permalink
fix(general): tslint being applied in all sources.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Mar 9, 2019
1 parent e9bed77 commit 8fec26c
Show file tree
Hide file tree
Showing 62 changed files with 1,167 additions and 732 deletions.
618 changes: 495 additions & 123 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@
"azure-arm-website": "5.7.0",
"bluebird": "^3.5.3",
"body-parser": "1.18.3",
"botbuilder": "4.3.2",
"botbuilder-ai": "4.3.2",
"botbuilder-azure": "4.3.2",
"botbuilder": "4.1.7",
"botbuilder-ai": "4.2.0",
"botbuilder-azure": "4.2.0",
"botbuilder-choices": "4.0.0-preview1.2",
"botbuilder-dialogs": "4.3.2",
"botbuilder-dialogs": "4.2.0",
"botbuilder-prompts": "4.0.0-preview1.2",
"botlib": "^0.1.21",
"chai": "4.2.0",
Expand Down
14 changes: 6 additions & 8 deletions packages/admin.gbapp/dialogs/AdminDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
Expand Down Expand Up @@ -38,7 +38,7 @@

import { WaterfallDialog } from 'botbuilder-dialogs';
import { GBMinInstance, IGBDialog } from 'botlib';
import UrlJoin = require('url-join');
import urlJoin = require('url-join');
import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService';
import { GBConfigService } from '../../core.gbapp/services/GBConfigService';
import { GBDeployer } from '../../core.gbapp/services/GBDeployer';
Expand All @@ -53,7 +53,7 @@ export class AdminDialog extends IGBDialog {
const packageName = text.split(' ')[1];
const importer = new GBImporter(min.core);
const deployer = new GBDeployer(min.core, importer);
await deployer.undeployPackageFromLocalPath(min.instance, UrlJoin('packages', packageName));
await deployer.undeployPackageFromLocalPath(min.instance, urlJoin('packages', packageName));
}

public static isSharePointPath(path: string) {
Expand All @@ -63,14 +63,12 @@ export class AdminDialog extends IGBDialog {
public static async deployPackageCommand(min: GBMinInstance, text: string, deployer: GBDeployer) {
const packageName = text.split(' ')[1];

if (AdminDialog.isSharePointPath(packageName)) {
await deployer.deployFromSharePoint(min.instance.instanceId, packageName);
} else {
if (!AdminDialog.isSharePointPath(packageName)) {
const additionalPath = GBConfigService.get('ADDITIONAL_DEPLOY_PATH');
if (additionalPath !== undefined) {
throw new Error('ADDITIONAL_DEPLOY_PATH is not set and deployPackage was called.');
}
await deployer.deployPackageFromLocalPath(min, UrlJoin(additionalPath, packageName));
await deployer.deployPackage(min, urlJoin(additionalPath, packageName));
}
}

Expand Down Expand Up @@ -207,7 +205,7 @@ export class AdminDialog extends IGBDialog {

const url = `https://login.microsoftonline.com/${
min.instance.authenticatorTenant
}/oauth2/authorize?client_id=${min.instance.authenticatorClientId}&response_type=code&redirect_uri=${UrlJoin(
}/oauth2/authorize?client_id=${min.instance.authenticatorClientId}&response_type=code&redirect_uri=${urlJoin(
min.instance.botEndpoint,
min.instance.botId,
'/token'
Expand Down
25 changes: 18 additions & 7 deletions packages/admin.gbapp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
Expand Down Expand Up @@ -36,18 +36,29 @@

'use strict';

import { GBMinInstance, IGBCoreService, IGBPackage, GBDialogStep } from 'botlib';
import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
import { Sequelize } from 'sequelize-typescript';
import { AdminDialog } from './dialogs/AdminDialog';
import { GuaribasAdmin } from './models/AdminModel';

/**
* The package for admin.gbapp.
*/
export class GBAdminPackage implements IGBPackage {
public sysPackages: IGBPackage[] = undefined;
public sysPackages: IGBPackage[];

public unloadPackage(core: IGBCoreService): void {}
public getDialogs(min: GBMinInstance) {}
public unloadBot(min: GBMinInstance): void {}
public onNewSession(min: GBMinInstance, step: GBDialogStep): void {}
public getDialogs(min: GBMinInstance) {
GBLog.verbose(`getDialogs called.`);
}
public unloadPackage(core: IGBCoreService): void {
GBLog.verbose(`unloadPackage called.`);
}
public unloadBot(min: GBMinInstance): void {
GBLog.verbose(`unloadBot called.`);
}
public onNewSession(min: GBMinInstance, step: GBDialogStep): void {
GBLog.verbose(`onNewSession called.`);
}

public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {
core.sequelize.addModels([GuaribasAdmin]);
Expand Down
5 changes: 4 additions & 1 deletion packages/admin.gbapp/models/AdminModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
Expand Down Expand Up @@ -45,6 +45,9 @@ import {
UpdatedAt
} from 'sequelize-typescript';

/**
* General settings store.
*/
@Table
export class GuaribasAdmin extends Model<GuaribasAdmin> {

Expand Down
15 changes: 7 additions & 8 deletions packages/admin.gbapp/services/GBAdminService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
Expand Down Expand Up @@ -37,8 +37,8 @@
'use strict';

import { AuthenticationContext, TokenResponse } from 'adal-node';
import { IGBAdminService, IGBCoreService } from 'botlib';
import UrlJoin = require('url-join');
import { IGBAdminService, IGBCoreService, IGBInstance } from 'botlib';
import urlJoin = require('url-join');
import { GuaribasInstance } from '../../core.gbapp/models/GBModel';
import { GuaribasAdmin } from '../models/AdminModel';
const msRestAzure = require('ms-rest-azure');
Expand Down Expand Up @@ -70,7 +70,6 @@ export class GBAdminService implements IGBAdminService {
}

public static async getADALCredentialsFromUsername(username: string, password: string) {

return await msRestAzure.loginWithUsernamePassword(username, password);
}

Expand Down Expand Up @@ -101,7 +100,7 @@ export class GBAdminService implements IGBAdminService {
maximumLength: 14
};

return passwordGenerator.generatePassword(options);
return passwordGenerator.generatePassword(options);
}

public async setValue(instanceId: number, key: string, value: string) {
Expand All @@ -123,7 +122,7 @@ export class GBAdminService implements IGBAdminService {
authenticatorAuthorityHostUrl: string,
authenticatorClientId: string,
authenticatorClientSecret: string
): Promise<GuaribasInstance> {
): Promise<IGBInstance> {
const options = { where: {} };
options.where = { instanceId: instanceId };
const item = await GuaribasInstance.findOne(options);
Expand All @@ -135,7 +134,7 @@ export class GBAdminService implements IGBAdminService {
return item.save();
}

public async getValue(instanceId: number, key: string) {
public async getValue(instanceId: number, key: string): Promise<string> {
const options = { where: {} };
options.where = { key: key, instanceId: instanceId };
const obj = await GuaribasAdmin.findOne(options);
Expand All @@ -152,7 +151,7 @@ export class GBAdminService implements IGBAdminService {
const accessToken = await this.getValue(instanceId, 'accessToken');
resolve(accessToken);
} else {
const authorizationUrl = UrlJoin(
const authorizationUrl = urlJoin(
instance.authenticatorAuthorityHostUrl,
instance.authenticatorTenant,
'/oauth2/authorize'
Expand Down
3 changes: 2 additions & 1 deletion packages/admin.gbapp/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export const Messages = {
wrong_password: 'Sorry, wrong password. Please, try again.',
enter_authenticator_tenant: 'Enter the Authenticator Tenant (eg.: domain.onmicrosoft.com):',
enter_authenticator_authority_host_url: 'Enter the Authority Host URL (eg.: https://login.microsoftonline.com): ',
enter_authenticator_client_id: 'Enter the Client Id [Application Id](https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview) GUID:',
enter_authenticator_client_id: `Enter the Client Id GUID: Get from
[this url](https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview)`,
enter_authenticator_client_secret: 'Enter the Client Secret:'
},
'pt-BR': {
Expand Down
6 changes: 3 additions & 3 deletions packages/analytics.gblib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
Expand Down Expand Up @@ -36,14 +36,14 @@

'use strict';

import { GBDialogStep, GBMinInstance, IGBCoreService, IGBPackage, GBLog } from 'botlib';
import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
import { Sequelize } from 'sequelize-typescript';

/**
* .gblib Package handler.
*/
export class GBAnalyticsPackage implements IGBPackage {
public sysPackages: IGBPackage[] = undefined;
public sysPackages: IGBPackage[];
public getDialogs(min: GBMinInstance) {
GBLog.verbose(`getDialogs called.`);
}
Expand Down
82 changes: 45 additions & 37 deletions packages/analytics.gblib/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
Expand Down Expand Up @@ -65,86 +65,94 @@ import { GuaribasChannel, GuaribasInstance } from '../../core.gbapp/models/GBMod
import { GuaribasSubject } from '../../kb.gbapp/models';
import { GuaribasUser } from '../../security.gblib/models';

/**
* A single message in a conversation.
*/
@Table
export class GuaribasConversation extends Model<GuaribasConversation> {
export class GuaribasConversationMessage extends Model<GuaribasConversationMessage> {

@PrimaryKey
@AutoIncrement
@Column
public conversationId: number;
public conversationMessageId: number;

@ForeignKey(() => GuaribasSubject)
@Column
public startSubjectId: number;
public subjectId: number;

@BelongsTo(() => GuaribasSubject)
public startSubject: GuaribasSubject;
@Column(DataType.TEXT)
public content: string;

@ForeignKey(() => GuaribasChannel)
@Column
public channelId: string;

@Column public rateDate: Date;
@CreatedAt
public createdAt: Date;

@Column(DataType.FLOAT)
@Column
public rate: number;
@UpdatedAt
public updatedAt: Date;

//tslint:disable-next-line:no-use-before-declare
@ForeignKey(() => GuaribasConversation)
@Column
@CreatedAt
public createdAt: Date;
public conversationId: number;

@Column public text: string;
//tslint:disable-next-line:no-use-before-declare
@BelongsTo(() => GuaribasConversation)
public conversation: GuaribasConversation;

@HasMany(() => GuaribasConversationMessage)
public conversationMessage: GuaribasConversationMessage[];
@ForeignKey(() => GuaribasInstance)
@Column
public instanceId: number;

@ForeignKey(() => GuaribasUser)
@Column
public startedByUserId: number;
public userId: number;

@BelongsTo(() => GuaribasUser)
public startedBy: GuaribasUser;
public user: GuaribasUser;
}

/**
* A conversation that groups many messages.
*/
@Table
export class GuaribasConversationMessage extends Model<GuaribasConversationMessage> {
export class GuaribasConversation extends Model<GuaribasConversation> {

@PrimaryKey
@AutoIncrement
@Column
public conversationMessageId: number;
public conversationId: number;

@ForeignKey(() => GuaribasSubject)
@Column
public subjectId: number;
public startSubjectId: number;

@Column(DataType.TEXT)
public content: string;
@BelongsTo(() => GuaribasSubject)
public startSubject: GuaribasSubject;

@ForeignKey(() => GuaribasChannel)
@Column
@CreatedAt
public createdAt: Date;
public channelId: string;

@Column public rateDate: Date;

@Column(DataType.FLOAT)
@Column
@UpdatedAt
public updatedAt: Date;
public rate: number;

@ForeignKey(() => GuaribasConversation)
@Column
public conversationId: number;
@CreatedAt
public createdAt: Date;

@BelongsTo(() => GuaribasConversation)
public conversation: GuaribasConversation;
@Column public text: string;

@ForeignKey(() => GuaribasInstance)
@Column
public instanceId: number;
@HasMany(() => GuaribasConversationMessage)
public conversationMessage: GuaribasConversationMessage[];

@ForeignKey(() => GuaribasUser)
@Column
public userId: number;
public startedByUserId: number;

@BelongsTo(() => GuaribasUser)
public user: GuaribasUser;
public startedBy: GuaribasUser;
}

0 comments on commit 8fec26c

Please sign in to comment.