fix(general): tslint being applied in all sources.
This commit is contained in:
parent
5d08457bef
commit
cd5189d0c8
28 changed files with 90 additions and 58 deletions
|
@ -38,7 +38,6 @@
|
|||
"ban": "ban",
|
||||
"issues": "git-issues",
|
||||
"license": "license-checker --production --onlyunknown --csv",
|
||||
"pretslint": "npm run pretty",
|
||||
"pretty": "prettier-standard 'src/*.ts' 'packages/**/*.ts'",
|
||||
"secure": "nsp check",
|
||||
"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";",
|
||||
|
|
|
@ -40,12 +40,12 @@ const UrlJoin = require('url-join');
|
|||
import { BotAdapter } from 'botbuilder';
|
||||
import { WaterfallDialog } from 'botbuilder-dialogs';
|
||||
import { GBMinInstance, IGBDialog } from 'botlib';
|
||||
import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService';
|
||||
import { GBConfigService } from '../../core.gbapp/services/GBConfigService';
|
||||
import { GBDeployer } from '../../core.gbapp/services/GBDeployer';
|
||||
import { GBImporter } from '../../core.gbapp/services/GBImporterService';
|
||||
import { GBAdminService } from '../services/GBAdminService';
|
||||
import { Messages } from '../strings';
|
||||
import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService';
|
||||
|
||||
/**
|
||||
* Dialogs for administration tasks.
|
||||
|
@ -157,6 +157,7 @@ export class AdminDialog extends IGBDialog {
|
|||
return await step.replaceDialog('/admin', { firstRun: false });
|
||||
} else if (cmdName === 'addConnection') {
|
||||
await AdminDialog.addConnectionCommand(min, text);
|
||||
|
||||
return await step.replaceDialog('/admin', { firstRun: false });
|
||||
} else if (cmdName === 'undeployPackage') {
|
||||
await AdminDialog.undeployPackageCommand(text, min);
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
import {
|
||||
Column,
|
||||
CreatedAt,
|
||||
DataType,
|
||||
Model,
|
||||
Table,
|
||||
UpdatedAt,
|
||||
DataType
|
||||
UpdatedAt
|
||||
} from 'sequelize-typescript';
|
||||
|
||||
@Table
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
'use strict';
|
||||
|
||||
import { AuthenticationContext, TokenResponse } from 'adal-node';
|
||||
import { IGBCoreService, IGBAdminService } from 'botlib';
|
||||
import { IGBAdminService, IGBCoreService } from 'botlib';
|
||||
import { GuaribasInstance } from '../../core.gbapp/models/GBModel';
|
||||
import { GuaribasAdmin } from '../models/AdminModel';
|
||||
const UrlJoin = require('url-join');
|
||||
|
@ -88,6 +88,7 @@ export class GBAdminService implements IGBAdminService {
|
|||
};
|
||||
let password = passwordGenerator.generatePassword(options);
|
||||
password = password.replace(/[\@\[\=\:\;\?]/g, '#');
|
||||
|
||||
return password;
|
||||
}
|
||||
|
||||
|
@ -102,6 +103,7 @@ export class GBAdminService implements IGBAdminService {
|
|||
maximumLength: 14
|
||||
};
|
||||
const name = passwordGenerator.generatePassword(options);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
import { BotAdapter } from 'botbuilder';
|
||||
import { GBMinInstance } from 'botlib';
|
||||
import { IGBDialog } from 'botlib';
|
||||
import { Messages } from '../strings';
|
||||
import { WaterfallDialog } from 'botlib/node_modules/botbuilder-dialogs';
|
||||
import { Messages } from '../strings';
|
||||
|
||||
export class BotFarmDialog extends IGBDialog {
|
||||
/**
|
||||
|
|
|
@ -136,6 +136,7 @@ export class StartDialog {
|
|||
process.stdout.write(`${GBAdminService.GB_PROMPT}CLOUD_PASSWORD:`);
|
||||
password = scanf('%s').replace(/(\n|\r)+$/, '');
|
||||
}
|
||||
|
||||
return password;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ import { SearchManagementClient } from 'azure-arm-search';
|
|||
import { SqlManagementClient } from 'azure-arm-sql';
|
||||
import { WebSiteManagementClient } from 'azure-arm-website';
|
||||
import { AppServicePlan } from 'azure-arm-website/lib/models';
|
||||
import { IGBInstance, IGBInstallationDeployer } from 'botlib';
|
||||
import { IGBInstallationDeployer, IGBInstance } from 'botlib';
|
||||
import { HttpMethods, ServiceClient, WebResource } from 'ms-rest-js';
|
||||
import { GBAdminService } from '../../../packages/admin.gbapp/services/GBAdminService';
|
||||
import { GBCorePackage } from '../../../packages/core.gbapp';
|
||||
|
@ -77,6 +77,19 @@ export class AzureDeployerService implements IGBInstallationDeployer {
|
|||
this.deployer = deployer;
|
||||
}
|
||||
|
||||
private static createRequestObject(url: string, accessToken: string, verb: HttpMethods, body: string) {
|
||||
const req = new WebResource();
|
||||
req.method = verb;
|
||||
req.url = url;
|
||||
req.headers = {};
|
||||
req.headers['Content-Type'] = 'application/json';
|
||||
req.headers['accept-language'] = '*';
|
||||
req.headers.Authorization = 'Bearer ' + accessToken;
|
||||
req.body = body;
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
public async getSubscriptions(credentials) {
|
||||
const subscriptionClient = new SubscriptionClient.default(credentials);
|
||||
|
||||
|
@ -228,19 +241,6 @@ export class AzureDeployerService implements IGBInstallationDeployer {
|
|||
await storageClient.firewallRules.createOrUpdate(groupName, serverName, 'gb', params);
|
||||
}
|
||||
|
||||
private static createRequestObject(url: string, accessToken: string, verb: HttpMethods, body: string) {
|
||||
const req = new WebResource();
|
||||
req.method = verb;
|
||||
req.url = url;
|
||||
req.headers = {};
|
||||
req.headers['Content-Type'] = 'application/json';
|
||||
req.headers['accept-language'] = '*';
|
||||
req.headers.Authorization = 'Bearer ' + accessToken;
|
||||
req.body = body;
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
public async deployFarm(
|
||||
proxyAddress: string,
|
||||
instance: IGBInstance,
|
||||
|
@ -344,6 +344,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
|
|||
);
|
||||
|
||||
spinner.stop();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
@ -385,7 +386,6 @@ export class AzureDeployerService implements IGBInstallationDeployer {
|
|||
this.accessToken = credentials.tokenCache._entries[0].accessToken;
|
||||
}
|
||||
|
||||
|
||||
private async createStorageServer(group, name, administratorLogin, administratorPassword, serverName, location) {
|
||||
const params = {
|
||||
location: location,
|
||||
|
@ -471,6 +471,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
|
|||
const res = await httpClient.sendRequest(req);
|
||||
if (!(res.bodyAsJson as any).id) {
|
||||
reject(res.bodyAsText);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -588,6 +589,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
|
|||
|
||||
private async createDeployGroup(name, location) {
|
||||
const params = { location: location };
|
||||
|
||||
return this.resourceClient.resourceGroups.createOrUpdate(name, params);
|
||||
}
|
||||
|
||||
|
@ -610,6 +612,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
|
|||
location: location,
|
||||
serverFarmId: farmId
|
||||
};
|
||||
|
||||
return this.webSiteClient.webApps.createOrUpdate(group, name, parameters);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ import { Sequelize } from 'sequelize-typescript';
|
|||
import { ConsoleDirectLine } from './services/ConsoleDirectLine';
|
||||
|
||||
export class GBConsolePackage implements IGBPackage {
|
||||
|
||||
|
||||
public sysPackages: IGBPackage[] = undefined;
|
||||
public channel: ConsoleDirectLine;
|
||||
public getDialogs(min: GBMinInstance) {}
|
||||
|
|
|
@ -64,6 +64,7 @@ export class ConsoleDirectLine extends GBService {
|
|||
.then(function (client) {
|
||||
client.clientAuthorizations.add('AuthorizationBotConnector',
|
||||
new Swagger.ApiKeyAuthorization('Authorization', 'Bearer ' + directLineSecret, 'header'));
|
||||
|
||||
return client;
|
||||
})
|
||||
.catch(function (err) {
|
||||
|
@ -129,7 +130,7 @@ export class ConsoleDirectLine extends GBService {
|
|||
setInterval(function () {
|
||||
client.Conversations.Conversations_GetActivities({ conversationId: conversationId, watermark: watermark })
|
||||
.then(function (response) {
|
||||
watermark = response.obj.watermark; // use watermark so subsequent requests skip old messages
|
||||
watermark = response.obj.watermark;
|
||||
return response.obj.activities;
|
||||
})
|
||||
.then(_this_.printMessages, _this_.directLineClientName);
|
||||
|
|
|
@ -54,7 +54,7 @@ import { IGBInstance } from 'botlib';
|
|||
@Table
|
||||
export class GuaribasInstance extends Model<GuaribasInstance>
|
||||
implements IGBInstance {
|
||||
|
||||
|
||||
@PrimaryKey
|
||||
@AutoIncrement
|
||||
@Column
|
||||
|
|
|
@ -112,6 +112,7 @@ export class GBConfigService {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -120,6 +121,7 @@ export class GBConfigService {
|
|||
if (!value) {
|
||||
value = process.env[key];
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -420,10 +420,12 @@ STORAGE_SYNC=true
|
|||
fkname += '_' + matches[1];
|
||||
matches = re4.exec(fkcols);
|
||||
}
|
||||
|
||||
return 'CONSTRAINT [' + fkname + '_fk] FOREIGN KEY (' + fkcols + ')';
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return sql;
|
||||
}
|
||||
|
||||
|
@ -453,10 +455,12 @@ STORAGE_SYNC=true
|
|||
fkname += '_' + matches[1];
|
||||
matches = re3.exec(fkcols);
|
||||
}
|
||||
|
||||
return (args[0] ? args[0] : '') + 'CONSTRAINT [' + fkname + '_fk] FOREIGN KEY (' + fkcols + ')';
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return sql;
|
||||
}
|
||||
|
||||
|
|
|
@ -224,6 +224,7 @@ export class GBDeployer {
|
|||
// PACKAGE: Put in package logic.
|
||||
case '.gbkb':
|
||||
const service = new KBService(this.core.sequelize);
|
||||
|
||||
return service.deployKb(this.core, this, localPath);
|
||||
|
||||
case '.gbui':
|
||||
|
@ -231,6 +232,7 @@ export class GBDeployer {
|
|||
|
||||
case '.gbdialog':
|
||||
const vm = new GBVMService();
|
||||
|
||||
return vm.loadDialogPackage(localPath, min, this.core, this);
|
||||
|
||||
default:
|
||||
|
@ -257,6 +259,7 @@ export class GBDeployer {
|
|||
|
||||
case '.gbkb':
|
||||
const service = new KBService(this.core.sequelize);
|
||||
|
||||
return service.undeployKbFromStorage(instance, this, p.packageId);
|
||||
|
||||
case '.gbui':
|
||||
|
@ -307,6 +310,7 @@ export class GBDeployer {
|
|||
|
||||
public async getPackageByName(instanceId: number, packageName: string): Promise<GuaribasPackage> {
|
||||
const where = { packageName: packageName, instanceId: instanceId };
|
||||
|
||||
return GuaribasPackage.findOne({
|
||||
where: where
|
||||
});
|
||||
|
@ -436,6 +440,7 @@ export class GBDeployer {
|
|||
appPackagesProcessed++;
|
||||
}
|
||||
});
|
||||
|
||||
return appPackagesProcessed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ export class GBImporter {
|
|||
|
||||
packageJson = { ...packageJson, ...settings, ...servicesJson };
|
||||
|
||||
if (botId){
|
||||
if (botId) {
|
||||
packageJson.botId = botId;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ const AuthenticationContext = require('adal-node').AuthenticationContext;
|
|||
import { AutoSaveStateMiddleware, BotFrameworkAdapter, ConversationState, MemoryStorage, UserState } from 'botbuilder';
|
||||
|
||||
import { ConfirmPrompt, WaterfallDialog } from 'botbuilder-dialogs';
|
||||
import { GBMinInstance, IGBAdminService, IGBConversationalService, IGBCoreService, IGBPackage, IGBInstance } from 'botlib';
|
||||
import { GBMinInstance, IGBAdminService, IGBConversationalService, IGBCoreService, IGBInstance, IGBPackage } from 'botlib';
|
||||
import { GBAnalyticsPackage } from '../../analytics.gblib';
|
||||
import { GBCorePackage } from '../../core.gbapp';
|
||||
import { GBCustomerSatisfactionPackage } from '../../customer-satisfaction.gbapp';
|
||||
|
@ -266,11 +266,13 @@ export class GBMinService {
|
|||
|
||||
try {
|
||||
const json = await request(options);
|
||||
|
||||
return Promise.resolve(JSON.parse(json));
|
||||
} catch (error) {
|
||||
const msg = `[botId:${
|
||||
instance.botId
|
||||
}] Error calling Direct Line client, verify Bot endpoint on the cloud. Error is: ${error}.`;
|
||||
|
||||
return Promise.reject(new Error(msg));
|
||||
}
|
||||
}
|
||||
|
@ -296,6 +298,7 @@ export class GBMinService {
|
|||
return await request(options);
|
||||
} catch (error) {
|
||||
const msg = `Error calling Speech to Text client. Error is: ${error}.`;
|
||||
|
||||
return Promise.reject(new Error(msg));
|
||||
}
|
||||
}
|
||||
|
@ -351,21 +354,21 @@ export class GBMinService {
|
|||
if (sysPackage.name === 'GBWhatsappPackage') {
|
||||
const url = '/instances/:botId/whatsapp';
|
||||
server.post(url, (req, res) => {
|
||||
p['channel'].received(req, res);
|
||||
p.channel.received(req, res);
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
}, this);
|
||||
|
||||
appPackages.forEach(p => {
|
||||
p.sysPackages = sysPackages;
|
||||
p.loadBot(min);
|
||||
if (p.getDialogs !== undefined) {
|
||||
let dialogs = p.getDialogs(min);
|
||||
const dialogs = p.getDialogs(min);
|
||||
dialogs.forEach(dialog => {
|
||||
min.dialogs.add(new WaterfallDialog(dialog.name, dialog.waterfall));
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
}, this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -476,10 +479,10 @@ export class GBMinService {
|
|||
private async processMessageActivity(context, min: GBMinInstance, step: any) {
|
||||
// Direct script invoking by itent name.
|
||||
|
||||
let isVMCall = Object.keys(min.scriptMap).find(key => min.scriptMap[key] === context.activity.text) !== undefined;
|
||||
const isVMCall = Object.keys(min.scriptMap).find(key => min.scriptMap[key] === context.activity.text) !== undefined;
|
||||
|
||||
if (isVMCall) {
|
||||
let mainMethod = context.activity.text;
|
||||
const mainMethod = context.activity.text;
|
||||
|
||||
min.sandBoxMap[mainMethod].context = context;
|
||||
min.sandBoxMap[mainMethod].step = step;
|
||||
|
|
|
@ -33,19 +33,19 @@
|
|||
'use strict';
|
||||
|
||||
import { WaterfallDialog } from 'botbuilder-dialogs';
|
||||
import { GBMinInstance, IGBCoreService, GBService } from 'botlib';
|
||||
import { GBMinInstance, GBService, IGBCoreService } from 'botlib';
|
||||
import * as fs from 'fs';
|
||||
import GBAPIService from './GBAPIService';
|
||||
import GBAPIService from './GBAPIService';
|
||||
import { GBDeployer } from './GBDeployer';
|
||||
import { TSCompiler } from './TSCompiler';
|
||||
import GBAPIService from './GBAPIService';
|
||||
import DialogClass from './GBAPIService';
|
||||
|
||||
const walkPromise = require('walk-promise');
|
||||
const logger = require('../../../src/logger');
|
||||
const vm = require('vm');
|
||||
const UrlJoin = require('url-join');
|
||||
const vb2ts = require('vbscript-to-typescript/dist/converter');
|
||||
let beautify = require('js-beautify').js;
|
||||
const beautify = require('js-beautify').js;
|
||||
|
||||
/**
|
||||
* @fileoverview Virtualization services for emulation of BASIC.
|
||||
|
@ -250,7 +250,7 @@ export class GBVMService extends GBService {
|
|||
min.dialogs.add(
|
||||
new WaterfallDialog('/hear', [
|
||||
async step => {
|
||||
step.activeDialog.state.cbId = step.options['id'];
|
||||
step.activeDialog.state.cbId = step.options.id;
|
||||
|
||||
return await step.prompt('textPrompt', {});
|
||||
},
|
||||
|
|
|
@ -41,7 +41,6 @@ const logger = require('../../../src/logger');
|
|||
|
||||
export class TSCompiler {
|
||||
|
||||
|
||||
private static shouldIgnoreError(diagnostic) {
|
||||
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ describe('Load function', () => {
|
|||
try {
|
||||
// const service = new GBVMService();
|
||||
// TODO: service.loadJS('invalid.file', null, null, null, null);
|
||||
|
||||
|
||||
} catch (error) {
|
||||
expect(error).to.equal(0);
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ export class FeedbackDialog extends IGBDialog {
|
|||
new WaterfallDialog('/feedbackNumber', [
|
||||
async step => {
|
||||
const locale = step.context.activity.locale;
|
||||
|
||||
// TODO: Migrate to 4.*+ await step.prompt("choicePrompt", Messages[locale].what_about_me, [
|
||||
// "1",
|
||||
// "2",
|
||||
|
@ -73,6 +74,7 @@ export class FeedbackDialog extends IGBDialog {
|
|||
const user = await min.userProfile.get(context, {});
|
||||
await service.updateConversationRate(user.conversation, rate);
|
||||
await step.context.sendActivity(Messages[locale].thanks);
|
||||
|
||||
return await step.next();
|
||||
}
|
||||
])
|
||||
|
@ -84,7 +86,7 @@ export class FeedbackDialog extends IGBDialog {
|
|||
const locale = step.context.activity.locale;
|
||||
|
||||
await step.context.sendActivity(Messages[locale].about_suggestions);
|
||||
step.activeDialog.state.cbId = step.options['id'];
|
||||
step.activeDialog.state.cbId = step.options.id;
|
||||
|
||||
return await step.prompt('textPrompt', Messages[locale].what_about_service);
|
||||
},
|
||||
|
@ -93,8 +95,8 @@ export class FeedbackDialog extends IGBDialog {
|
|||
const locale = step.context.activity.locale;
|
||||
const rate = await AzureText.getSentiment(
|
||||
min.instance.textAnalyticsKey,
|
||||
min.instance.textAnalyticsEndpoint,
|
||||
min.conversationalService.getCurrentLanguage(step),
|
||||
min.instance.textAnalyticsEndpoint,
|
||||
min.conversationalService.getCurrentLanguage(step),
|
||||
step.result
|
||||
);
|
||||
|
||||
|
@ -105,6 +107,7 @@ export class FeedbackDialog extends IGBDialog {
|
|||
|
||||
// TODO: Record.
|
||||
}
|
||||
|
||||
return await step.replaceDialog('/ask', { isReturning: true });
|
||||
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ export class QualityDialog extends IGBDialog {
|
|||
);
|
||||
await step.replaceDialog('/ask', { isReturning: true });
|
||||
}
|
||||
|
||||
return await step.next();
|
||||
}
|
||||
]));
|
||||
|
|
|
@ -62,6 +62,7 @@ export class CSService {
|
|||
rate: number
|
||||
): Promise<GuaribasConversation> {
|
||||
conversation.rate = rate;
|
||||
|
||||
return conversation.save();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,8 +59,8 @@ export class AskDialog extends IGBDialog {
|
|||
min.dialogs.add(
|
||||
new WaterfallDialog('/answerEvent', [
|
||||
async step => {
|
||||
if (step.options && step.options['questionId']) {
|
||||
const question = await service.getQuestionById(min.instance.instanceId, step.options['questionId']);
|
||||
if (step.options && step.options.questionId) {
|
||||
const question = await service.getQuestionById(min.instance.instanceId, step.options.questionId);
|
||||
const answer = await service.getAnswerById(min.instance.instanceId, question.answerId);
|
||||
|
||||
// Sends the answer to all outputs, including projector.
|
||||
|
@ -69,6 +69,7 @@ export class AskDialog extends IGBDialog {
|
|||
|
||||
await step.replaceDialog('/ask', { isReturning: true });
|
||||
}
|
||||
|
||||
return await step.next();
|
||||
}
|
||||
])
|
||||
|
@ -78,7 +79,7 @@ export class AskDialog extends IGBDialog {
|
|||
new WaterfallDialog('/answer', [
|
||||
async step => {
|
||||
const user = await min.userProfile.get(step.context, {});
|
||||
let text = step.options['query'];
|
||||
let text = step.options.query;
|
||||
if (!text) {
|
||||
throw new Error(`/answer being called with no args query text.`);
|
||||
}
|
||||
|
@ -91,9 +92,9 @@ export class AskDialog extends IGBDialog {
|
|||
|
||||
// Handle extra text from FAQ.
|
||||
|
||||
if (step.options && step.options['query']) {
|
||||
text = step.options['query'];
|
||||
} else if (step.options && step.options['fromFaq']) {
|
||||
if (step.options && step.options.query) {
|
||||
text = step.options.query;
|
||||
} else if (step.options && step.options.fromFaq) {
|
||||
await step.context.sendActivity(Messages[locale].going_answer);
|
||||
}
|
||||
|
||||
|
@ -155,10 +156,12 @@ export class AskDialog extends IGBDialog {
|
|||
// Sends the answer to all outputs, including projector.
|
||||
|
||||
await service.sendAnswer(min.conversationalService, step, resultsB.answer);
|
||||
|
||||
return await step.replaceDialog('/ask', { isReturning: true });
|
||||
} else {
|
||||
if (!(await min.conversationalService.routeNLP(step, min, text))) {
|
||||
await step.context.sendActivity(Messages[locale].did_not_find);
|
||||
|
||||
return await step.replaceDialog('/ask', { isReturning: true });
|
||||
}
|
||||
}
|
||||
|
@ -180,9 +183,9 @@ export class AskDialog extends IGBDialog {
|
|||
|
||||
// Three forms of asking.
|
||||
|
||||
if (step.options && step.options['firstTime']) {
|
||||
if (step.options && step.options.firstTime) {
|
||||
text = Messages[locale].ask_first_time;
|
||||
} else if (step.options && step.options['isReturning']) {
|
||||
} else if (step.options && step.options.isReturning) {
|
||||
text = Messages[locale].anything_else;
|
||||
} else if (user.subjects.length > 0) {
|
||||
text = Messages[locale].which_question;
|
||||
|
@ -193,6 +196,7 @@ export class AskDialog extends IGBDialog {
|
|||
if (text.length > 0) {
|
||||
return await step.prompt('textPrompt', text);
|
||||
}
|
||||
|
||||
return await step.next();
|
||||
},
|
||||
async step => {
|
||||
|
@ -205,6 +209,5 @@ export class AskDialog extends IGBDialog {
|
|||
])
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ export class FaqDialog extends IGBDialog {
|
|||
data: data.slice(0, 10)
|
||||
});
|
||||
|
||||
await step.context.sendActivity(Messages[locale].see_faq); // TODO: RND messages.
|
||||
await step.context.sendActivity(Messages[locale].see_faq);
|
||||
return await step.next();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ export class MenuDialog extends IGBDialog {
|
|||
const locale = step.context.activity.locale;
|
||||
let rootSubjectId = null;
|
||||
|
||||
if (step.options && step.options['data']) {
|
||||
const subject = step.options['data'];
|
||||
if (step.options && step.options.data) {
|
||||
const subject = step.options.data;
|
||||
|
||||
// If there is a shortcut specified as subject destination, go there.
|
||||
|
||||
|
@ -72,6 +72,7 @@ export class MenuDialog extends IGBDialog {
|
|||
const dialog = subject.to.split(':')[1];
|
||||
await step.replaceDialog('/' + dialog);
|
||||
await step.endDialog();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -156,6 +157,7 @@ export class MenuDialog extends IGBDialog {
|
|||
|
||||
const user = await min.userProfile.get(step.context, {});
|
||||
user.isAsking = true;
|
||||
|
||||
return await step.next();
|
||||
}
|
||||
]));
|
||||
|
|
|
@ -49,11 +49,11 @@ import { Messages } from '../strings';
|
|||
import { IGBConversationalService, IGBCoreService, IGBInstance } from 'botlib';
|
||||
import { AzureSearch } from 'pragmatismo-io-framework';
|
||||
import { Sequelize } from 'sequelize-typescript';
|
||||
import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService';
|
||||
import { GuaribasPackage } from '../../core.gbapp/models/GBModel';
|
||||
import { GBDeployer } from '../../core.gbapp/services/GBDeployer';
|
||||
import { GuaribasAnswer, GuaribasQuestion, GuaribasSubject } from '../models';
|
||||
import { GBConfigService } from './../../core.gbapp/services/GBConfigService';
|
||||
import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService';
|
||||
|
||||
export class KBServiceSearchResults {
|
||||
public answer: GuaribasAnswer;
|
||||
|
@ -433,6 +433,7 @@ export class KBService {
|
|||
}
|
||||
});
|
||||
};
|
||||
|
||||
return doIt(subjects.children, null);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,9 +45,9 @@ import { WhatsappDirectLine } from './services/WhatsappDirectLine';
|
|||
|
||||
export class GBWhatsappPackage implements IGBPackage {
|
||||
public sysPackages: IGBPackage[] = undefined;
|
||||
public getDialogs(min: GBMinInstance) {}
|
||||
|
||||
public channel: WhatsappDirectLine;
|
||||
public getDialogs(min: GBMinInstance) {}
|
||||
|
||||
public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {}
|
||||
|
||||
|
|
|
@ -142,12 +142,13 @@ export class WhatsappDirectLine extends GBService {
|
|||
})
|
||||
.then(response => {
|
||||
this.watermark = response.obj.watermark;
|
||||
|
||||
return response.obj.activities;
|
||||
})
|
||||
.then(activities => {
|
||||
this.printMessages(activities, conversationId, from, fromName);
|
||||
});
|
||||
}, this.pollInterval);
|
||||
}, this.pollInterval);
|
||||
}
|
||||
|
||||
public printMessages(activities, conversationId, from, fromName) {
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
const logger = require('./logger');
|
||||
const express = require('express');
|
||||
const bodyParser = require('body-parser');
|
||||
import { IGBInstance, IGBPackage, IGBCoreService } from 'botlib';
|
||||
import { IGBCoreService, IGBInstance, IGBPackage } from 'botlib';
|
||||
import { GBAdminService } from '../packages/admin.gbapp/services/GBAdminService';
|
||||
import { AzureDeployerService } from '../packages/azuredeployer.gbapp/services/AzureDeployerService';
|
||||
import { GuaribasInstance } from '../packages/core.gbapp/models/GBModel';
|
||||
|
|
Loading…
Add table
Reference in a new issue