Merge remote-tracking branch 'remotes/origin/master' into MigrationToBotFmwV4

This commit is contained in:
Rodrigo Rodriguez 2018-09-01 12:49:38 -03:00
commit 3f9b289499
104 changed files with 1124 additions and 1349 deletions

2
.github/ISSUE_TEMPLATE/requirement vendored Normal file
View file

@ -0,0 +1,2 @@
**Description**
A clear and concise description of what the requirement is.

View file

@ -1,5 +1,6 @@
![General Bot Logo](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/logo.png)
Welcome to General Bot Community Edition
----------------
@ -11,6 +12,17 @@ Everyone can create bots by just copying and pasting some files and using their
favorite tools like Excel (or any text editor) or Photoshop (or any image
editor).
Package Quick Reference
------------
|Whatsapp|Web|Core|KB|
|----|-----|----|----|
|[whatsapp.gblib](https://github.com/pragmatismo-io/BotServer/tree/master/deploy/whatsapp.gblib)|[default.gbui](https://github.com/pragmatismo-io/BotServer/tree/master/deploy/default.gbui)|[core.gbapp](https://github.com/pragmatismo-io/BotServer/tree/master/deploy/core.gbapp)|[kb.gbapp](https://github.com/pragmatismo-io/BotServer/tree/master/deploy/kb.gbapp)|
Package Architecture
--------------------
![General Bot Logo](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-stack.png)
### What is Bot Server?
Bot Server accelerates the process of developing a bot. It provisions all code
@ -21,11 +33,23 @@ a zip file, editing and uploading it back to the server (deploying process) with
no code. The Bot Server also provides a framework to develop bot packages in a more
advanced fashion writing custom code in editors like Visual Studio Code, Atom or Brackets.
![General Bots Block Architecture](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-block-architecture.png)
### The same build process for everyone
GeneralBots aims to delivery bots in azure in a very easy and fast fashion. Use
Office tools like Word or Excel to edit your Bot - using code (JavaScript or TypeScript) just to empower custom requirements.
#### Use Excel for Quick edits
![General Bots Inside Excel can enable bot production the masses](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-inside-excel-can-enable-bot-production-to-the-masses.png)
#### Use Visual Studio for a complete .gbai package building system
![General Bots Inside Visual Studio Code provides a complete artificial intelligence based conversational platform](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-inside-visual-studio-code-provides-a-complete-artificial-intelligence-based-conversational-platform.png)
How To
------
@ -72,6 +96,11 @@ Note:
* Whenever you are ready to turn your open-source bot ideas in form of .gbapp (source-code) and artifacts like .gbkb, .gbtheme, .gbot or the .gbai full package read [CONTRIBUTING.md](https://github.com/pragmatismo-io/BotServer/blob/master/CONTRIBUTING.md) about performing Pull Requests (PR) and creating other public custom packages repositories of your own personal or organization General Bot Community Edition powered packages.
### Running unit tests
1. Enter the BotServer root folder.
2. Run tests by `npm test`.
### Just copy the source code to your machine
1. [Download] the Zip file of (https://codeload.github.com/pragmatismo-io/BotServer/zip/master)
@ -89,6 +118,7 @@ the UI application itself (HTML & JS).
Package Types
-------------
### .gbai
Embraces all packages types (content, logic & conversation) into a pluggable bot
@ -166,8 +196,8 @@ here is a list of admin commands related to deploying .gb* files.
### Credits & Inspiration
* Rodrigo Rodriguez (me@rodrigorodriguez.com) - Coding, Docs & Architecture.
* David Lerner (david.lerner@hotmail.com) - UI, UX & Theming
* Eduardo Romeiro (eromeirosp@outlook.com) - Content & UX
* David Lerner (david.lerner@hotmail.com) - UI, UX & Theming.
* Eduardo Romeiro (eromeirosp@outlook.com) - Content & UX.
* Jorge Ramos (jramos@pobox.com) - Coding, Docs & Architecture.
Powered by Microsoft [BOT Framework](https://dev.botframework.com/) and [Azure](http://www.azure.com).

View file

@ -1,5 +1,16 @@
# Release History
## Version 0.0.31
- FIX: Updated dependencies versions.
## Version 0.0.30
- FIX: Packages updated.
- NEW: DATABASE_SYNC_ALTER environment parameter.
- NEW: DATABASE_SYNC_FORCE environment parameter.
- NEW: Define constraint names in MSSQL.
## Version 0.0.29
- NEW: Added STT and TTS capabilities to default.gbui.

View file

@ -33,6 +33,7 @@
"use strict";
const UrlJoin = require("url-join");
import { AzureSearch } from "pragmatismo-io-framework";
const { DialogSet, TextPrompt, NumberPrompt } = require('botbuilder-dialogs');
const { createTextPrompt, createNumberPrompt } = require('botbuilder-prompts');

View file

@ -30,30 +30,31 @@
| |
\*****************************************************************************/
"use strict";
'use strict';
const UrlJoin = require('url-join');
const UrlJoin = require("url-join");
import { AdminDialog } from './dialogs/AdminDialog';
import { GBMinInstance, IGBPackage } from "botlib";
import { GBMinInstance, IGBPackage, IGBCoreService } from 'botlib';
import { Sequelize } from 'sequelize-typescript';
import { IGBCoreService } from 'botlib';
export class GBAdminPackage implements IGBPackage {
sysPackages: IGBPackage[] = null;
loadPackage(core: IGBCoreService, sequelize: Sequelize): void {
}
unloadPackage(core: IGBCoreService): void {
unloadPackage(core: IGBCoreService): void {
}
loadBot(min: GBMinInstance): void {
AdminDialog.setup(min.bot, min);
}
unloadBot(min: GBMinInstance): void {
}
onNewSession(min: GBMinInstance, dc: any): void {
onNewSession(min: GBMinInstance, dc: any): void {
}
}

View file

@ -30,17 +30,17 @@
| |
\*****************************************************************************/
"use strict";
import {
Sequelize,
DataTypes,
DataTypeUUIDv4,
DataTypeDate,
DataTypeDecimal
} from "sequelize";
import {
Sequelize,
Table,
Column,
Model,
@ -56,13 +56,14 @@ import {
PrimaryKey,
AutoIncrement
} from "sequelize-typescript";
import { GuaribasSubject } from "../../kb.gbapp/models";
import { GuaribasUser } from "../../security.gblib/models";
import { GuaribasChannel, GuaribasInstance } from "../../core.gbapp/models/GBModel";
@Table
export class GuaribasConversation extends Model<GuaribasConversation> {
@PrimaryKey
@AutoIncrement
@Column
@ -81,15 +82,13 @@ export class GuaribasConversation extends Model<GuaribasConversation> {
@Column rateDate: Date;
@Column({
type: DataType.FLOAT
})
@Column(DataType.FLOAT)
@Column
rate: number;
@Column
@CreatedAt
creationDate: Date;
createdAt: Date;
@Column text: string;
@ -106,6 +105,7 @@ export class GuaribasConversation extends Model<GuaribasConversation> {
@Table
export class GuaribasConversationMessage extends Model<GuaribasConversationMessage> {
@PrimaryKey
@AutoIncrement
@Column
@ -115,16 +115,16 @@ export class GuaribasConversationMessage extends Model<GuaribasConversationMessa
@Column
subjectId: number;
@Column({ type: DataType.TEXT })
@Column(DataType.TEXT)
content: string;
@Column
@CreatedAt
creationDate: Date;
createdAt: Date;
@Column
@UpdatedAt
updatedOn: Date;
updatedAt: Date;
@ForeignKey(() => GuaribasConversation)
@Column

View file

@ -34,13 +34,11 @@
const UrlJoin = require("url-join");
import { GBMinInstance, IGBPackage, IGBCoreService } from "botlib";
import { Sequelize } from "sequelize-typescript";
import { Sequelize } from 'sequelize-typescript';
import { ConsoleDirectLine } from "./services/ConsoleDirectLine";
export class GBConsolePackage implements IGBPackage {
sysPackages: IGBPackage[] = null;
channel: ConsoleDirectLine;
@ -49,7 +47,6 @@ export class GBConsolePackage implements IGBPackage {
}
unloadPackage(core: IGBCoreService): void {
}
loadBot(min: GBMinInstance): void {
@ -57,9 +54,8 @@ export class GBConsolePackage implements IGBPackage {
}
unloadBot(min: GBMinInstance): void {
}
onNewSession(min: GBMinInstance, dc: any): void {
onNewSession(min: GBMinInstance, dc: any): void {
}
}

View file

@ -33,170 +33,190 @@
"use strict";
import {
Sequelize,
DataTypes,
DataTypeUUIDv4,
DataTypeDate,
DataTypeDecimal
DataTypes,
DataTypeUUIDv4,
DataTypeDate,
DataTypeDecimal
} from "sequelize";
import {
Table,
Column,
Model,
HasMany,
BelongsTo,
BelongsToMany,
Length,
ForeignKey,
CreatedAt,
UpdatedAt,
DataType,
IsUUID,
PrimaryKey,
AutoIncrement
} from "sequelize-typescript";
import { IGBInstance } from "botlib";
import {
Sequelize,
Table,
Column,
Model,
HasMany,
BelongsTo,
BelongsToMany,
Length,
ForeignKey,
CreatedAt,
UpdatedAt,
DataType,
IsUUID,
PrimaryKey,
AutoIncrement
} from "sequelize-typescript";
import { IGBInstance } from "botlib";
@Table
export class GuaribasInstance extends Model<GuaribasInstance> implements IGBInstance {
@Column
whoAmIVideo: string;
@PrimaryKey
@AutoIncrement
@Column
instanceId: number;
@PrimaryKey
@AutoIncrement
@Column
instanceId: number;
@Column
whoAmIVideo: string;
@Column botId: string;
@Column botId: string;
@Column title: string;
@Column title: string;
@Column description: string;
@Column description: string;
@Column version: string;
@Column version: string;
@Column enabledAdmin: boolean;
@Column enabledAdmin: boolean;
/* Services section on bot.json */
/* Services section on bot.json */
@Column engineName: string;
@Column engineName: string;
@Column marketplaceId: string;
@Column marketplaceId: string;
@Column textAnalyticsKey: string;
@Column textAnalyticsKey: string;
@Column marketplacePassword: string;
@Column marketplacePassword: string;
@Column webchatKey: string;
@Column webchatKey: string;
@Column whatsappBotKey: string;
@Column whatsappBotKey: string;
@Column whatsappServiceKey: string;
@Column whatsappServiceKey: string;
@Column whatsappServiceNumber: string;
@Column whatsappServiceNumber: string;
@Column whatsappServiceUrl: string;
@Column whatsappServiceUrl: string;
@Column whatsappServiceWebhookUrl: string;
@Column whatsappServiceWebhookUrl: string;
@Column speechKey: string;
@Column speechKey: string;
@Column spellcheckerKey: string;
@Column spellcheckerKey: string;
@Column theme: string;
@Column theme: string;
@Column ui: string;
@Column ui: string;
@Column kb: string;
@Column kb: string;
@Column
nlpAppId: string;
@Column(DataType.STRING(512)) nlpServerUrl: string;
@Column
nlpSubscriptionKey: string;
@Column
nlpAppId: string;
@Column
@Column({ type: DataType.STRING(512) })
nlpServerUrl: string;
@Column
nlpSubscriptionKey: string;
@Column searchHost: string;
@Column
@Column({ type: DataType.STRING(512) })
nlpServerUrl: string;
@Column searchKey: string;
@Column searchHost: string;
@Column searchIndex: string;
@Column searchKey: string;
@Column searchIndexer: string;
@Column searchIndex: string;
/* Settings section of bot.json */
@Column searchIndexer: string;
@Column({
type: DataType.FLOAT
})
nlpVsSearch: number;
/* Settings section of bot.json */
@Column({
type: DataType.FLOAT
})
searchScore: number;
@Column(DataType.FLOAT) nlpVsSearch: number;
@Column({
type: DataType.FLOAT
})
nlpScore: number;
@Column(DataType.FLOAT) searchScore: number;
@Column
@CreatedAt
creationDate: Date;
@Column(DataType.FLOAT) nlpScore: number;
@Column
@UpdatedAt
updatedOn: Date;
@Column
@CreatedAt
createdAt: Date;
@Column
@UpdatedAt
updatedAt: Date;
}
@Table
export class GuaribasPackage extends Model<GuaribasPackage> {
@PrimaryKey
@AutoIncrement
@Column
packageId: number;
@PrimaryKey
@AutoIncrement
@Column
packageId: number;
@Column
packageName: string;
@Column
packageName: string;
@ForeignKey(() => GuaribasInstance)
@Column
instanceId: number;
@ForeignKey(() => GuaribasInstance)
@Column
instanceId: number;
@BelongsTo(() => GuaribasInstance)
instance: GuaribasInstance;
@Column
@CreatedAt
createdAt: Date;
@Column
@UpdatedAt
updatedAt: Date;
}
@Table
export class GuaribasChannel extends Model<GuaribasChannel> {
@PrimaryKey
@AutoIncrement
@Column
channelId: number;
@Column title: string;
@PrimaryKey
@AutoIncrement
@Column
channelId: number;
@Column title: string;
@Column
@CreatedAt
createdAt: Date;
@Column
@UpdatedAt
updatedAt: Date;
}
@Table
export class GuaribasException extends Model<GuaribasException> {
@PrimaryKey
@AutoIncrement
@Column
exceptionId: number;
@PrimaryKey
@AutoIncrement
@Column
exceptionId: number;
@Column message: string;
@Column message: string;
@ForeignKey(() => GuaribasInstance)
@Column
instanceId: number;
@ForeignKey(() => GuaribasInstance)
@Column
instanceId: number;
@Column
@CreatedAt
creationDate: Date;
@BelongsTo(() => GuaribasInstance)
instance: GuaribasInstance;
@Column
@CreatedAt
createdAt: Date;
@Column
@UpdatedAt
updatedAt: Date;
}

View file

@ -49,7 +49,7 @@ export class GBConfigService {
}
}
static get(key: string): any {
static get(key: string): string | undefined {
let value = process.env["container:" + key];
if (!value) {
@ -71,9 +71,19 @@ export class GBConfigService {
break;
case "DATABASE_SYNC":
case "DATABASE_SYNC_ALTER":
case "DATABASE_SYNC_FORCE":
value = "false";
break;
case "DATABASE_LOGGING":
value = "false";
break;
case "DATABASE_ENCRYPT":
value = "true";
break;
default:
logger.trace(
`Guaribas General Error: Invalid key on .env file: '${key}'`

View file

@ -41,7 +41,7 @@ const UrlJoin = require("url-join");
const Walk = require("fs-walk");
const logger = require("../../../src/logger");
import { Sequelize } from "sequelize-typescript";
import { Sequelize } from 'sequelize-typescript';
import { Promise } from "bluebird";
import { GBConfigService } from "./GBConfigService";
import { DataTypeUUIDv1 } from "sequelize";
@ -56,9 +56,13 @@ export class GBCoreService implements IGBCoreService {
public sequelize: Sequelize;
private queryGenerator: any;
private createTableQuery: (tableName, attributes, options) => string;
private changeColumnQuery: (tableName, attributes) => string;
/** Dialect used. Tested: mssql and sqlite. */
dialect: string;
private dialect: string;
constructor() {
this.dialect = GBConfigService.get("DATABASE_DIALECT");
@ -67,11 +71,11 @@ export class GBCoreService implements IGBCoreService {
/** Get config and connect to storage. */
initDatabase(cb) {
let host = "";
let database = "";
let username = "";
let password = "";
let storage = "";
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("DATABASE_HOST");
@ -82,14 +86,11 @@ export class GBCoreService implements IGBCoreService {
storage = GBConfigService.get("DATABASE_STORAGE");
}
let value = GBConfigService.get("DATABASE_LOGGING");
let logging: boolean | Function = false;
let logging = (GBConfigService.get("DATABASE_LOGGING") === "true")
? (str: string) => { logger.trace(str); }
: false;
if (value && value == "1") {
logging = (str) => {
logger.trace(str);
};
}
let encrypt = (GBConfigService.get("DATABASE_ENCRYPT") === "true");
this.sequelize = new Sequelize({
host: host,
@ -100,9 +101,8 @@ export class GBCoreService implements IGBCoreService {
operatorsAliases: false,
dialect: this.dialect,
storage: storage,
dialectOptions: {
encrypt: true
encrypt: encrypt
},
pool: {
max: 32,
@ -110,26 +110,106 @@ export class GBCoreService implements IGBCoreService {
idle: 40000,
evict: 40000,
acquire: 40000
}
},
});
cb();
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);
}
setImmediate(cb);
}
private createTableQueryOverride(tableName, attributes, options): string {
let sql: string = this.createTableQuery.apply(this.queryGenerator,
[tableName, attributes, options]);
// let sql: string = '' +
// 'IF OBJECT_ID(\'[UserGroup]\', \'U\') IS NULL\n' +
// 'CREATE TABLE [UserGroup] (\n' +
// ' [id] INTEGER NOT NULL IDENTITY(1,1),\n' +
// ' [userId] INTEGER NULL,\n' +
// ' [groupId] INTEGER NULL,\n' +
// ' [instanceId] INTEGER NULL,\n' +
// ' PRIMARY KEY ([id1], [id2]),\n' +
// ' FOREIGN KEY ([userId1], [userId2], [userId3]) REFERENCES [User] ([userId1], [userId2], [userId3]) ON DELETE NO ACTION,\n' +
// ' FOREIGN KEY ([groupId1], [groupId2]) REFERENCES [Group] ([groupId1], [groupId1]) ON DELETE NO ACTION,\n' +
// ' FOREIGN KEY ([instanceId]) REFERENCES [Instance] ([instanceId]) ON DELETE NO ACTION);';
const re1 = /CREATE\s+TABLE\s+\[([^\]]*)\]/;
const matches = re1.exec(sql);
if (matches) {
const table = matches[1];
const re2 = /PRIMARY\s+KEY\s+\(\[[^\]]*\](?:,\s*\[[^\]]*\])*\)/;
sql = sql.replace(re2, (match: string, ...args: any[]): string => {
return 'CONSTRAINT [' + table + '_pk] ' + match;
});
const re3 = /FOREIGN\s+KEY\s+\((\[[^\]]*\](?:,\s*\[[^\]]*\])*)\)/g;
const re4 = /\[([^\]]*)\]/g;
sql = sql.replace(re3, (match: string, ...args: any[]): string => {
const fkcols = args[0];
let fkname = table;
let matches = re4.exec(fkcols);
while (matches != null) {
fkname += '_' + matches[1];
matches = re4.exec(fkcols);
}
return 'CONSTRAINT [' + fkname + '_fk] FOREIGN KEY (' + fkcols + ')';
});
}
return sql;
}
private changeColumnQueryOverride(tableName, attributes): string {
let sql: string = this.changeColumnQuery.apply(this.queryGenerator,
[tableName, attributes]);
// let sql = '' +
// 'ALTER TABLE [UserGroup]\n' +
// ' ADD CONSTRAINT [invalid1] FOREIGN KEY ([userId1], [userId2], [userId3]) REFERENCES [User] ([userId1], [userId2], [userId3]) ON DELETE NO ACTION,\n' +
// ' CONSTRAINT [invalid2] FOREIGN KEY ([groupId1], [groupId2]) REFERENCES [Group] ([groupId1], [groupId2]) ON DELETE NO ACTION, \n' +
// ' CONSTRAINT [invalid3] FOREIGN KEY ([instanceId1]) REFERENCES [Instance] ([instanceId1]) ON DELETE NO ACTION;\n';
const re1 = /ALTER\s+TABLE\s+\[([^\]]*)\]/;
const matches = re1.exec(sql);
if (matches) {
const table = matches[1];
const re2 = /(ADD\s+)?CONSTRAINT\s+\[([^\]]*)\]\s+FOREIGN\s+KEY\s+\((\[[^\]]*\](?:,\s*\[[^\]]*\])*)\)/g;
const re3 = /\[([^\]]*)\]/g;
sql = sql.replace(re2, (match: string, ...args: any[]): string => {
const fkcols = args[2];
let fkname = table;
let matches = re3.exec(fkcols);
while (matches != null) {
fkname += '_' + matches[1];
matches = re3.exec(fkcols);
}
return (args[0] ? args[0] : '') + 'CONSTRAINT [' + fkname + '_fk] FOREIGN KEY (' + fkcols + ')';
});
}
return sql;
}
syncDatabaseStructure(cb) {
if (GBConfigService.get("DATABASE_SYNC") === "true") {
const alter = (GBConfigService.get("DATABASE_SYNC_ALTER") === "true");
const force = (GBConfigService.get("DATABASE_SYNC_FORCE") === "true");
logger.trace("Syncing database...");
this.sequelize.sync().then(value => {
this.sequelize.sync({
alter: alter,
force: force
}).then(value => {
logger.trace("Database synced.");
cb();
});
}
else {
}, err => logger.error(err));
} else {
logger.trace("Database synchronization is disabled.");
cb();
}
}
/**
* Loads all items to start several listeners.
* @param cb Instances loaded or error info.
@ -149,8 +229,8 @@ export class GBCoreService implements IGBCoreService {
if (reason.message.indexOf("no such table: GuaribasInstance") != -1) {
cb([], null);
} else {
cb(null, reason);
logger.trace(`GuaribasServiceError: ${reason}`);
cb(null, reason);
}
});
}

View file

@ -46,7 +46,7 @@ import { KBService } from './../../kb.gbapp/services/KBService';
import { GBImporter } from "./GBImporter";
import { GBCoreService } from "./GBCoreService";
import { GBServiceCallback, IGBCoreService, IGBInstance } from "botlib";
import { Sequelize } from "sequelize-typescript";
import { Sequelize } from 'sequelize-typescript';
import { Promise } from "bluebird";
import { GBConfigService } from "./GBConfigService";
import { DataTypeUUIDv1 } from "sequelize";

View file

@ -41,7 +41,7 @@ const Walk = require("fs-walk");
const logger = require("../../../src/logger");
import { KBService } from './../../kb.gbapp/services/KBService';
import { Sequelize } from "sequelize-typescript";
import { Sequelize } from 'sequelize-typescript';
import { Promise } from "bluebird";
import Fs = require("fs");
import Path = require("path");

View file

@ -33,13 +33,14 @@
"use strict";
import {
Sequelize,
DataTypes,
DataTypeUUIDv4,
DataTypeDate,
DataTypeDecimal
} from "sequelize";
import {
Sequelize,
Table,
Column,
Model,
@ -55,6 +56,7 @@ import {
PrimaryKey,
AutoIncrement
} from "sequelize-typescript";
import { GuaribasInstance } from "../../core.gbapp/models/GBModel";
@Table

View file

@ -1430,21 +1430,21 @@
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
},
"botframework-directlinejs": {
"version": "0.9.15",
"resolved": "https://registry.npmjs.org/botframework-directlinejs/-/botframework-directlinejs-0.9.15.tgz",
"integrity": "sha512-uDD5LMCckFKCl8Qr6TMnHjEcl1bKp/MTvlvzRsthvEoNTlzSLo7j8wHLlNYcisr3vPaMx+XAcBniUQjwBLImjQ==",
"version": "0.9.16",
"resolved": "https://registry.npmjs.org/botframework-directlinejs/-/botframework-directlinejs-0.9.16.tgz",
"integrity": "sha512-HcIgeGUBH8zYy2ydlNTgS5GaOkK2BFcfkfSxgVWnF2nV0eIIE2nOepHfAYVtv70zQSX0dU9CedUNgQW343AA6Q==",
"requires": {
"rxjs": "5.4.3"
}
},
"botframework-webchat": {
"version": "0.13.1",
"resolved": "https://registry.npmjs.org/botframework-webchat/-/botframework-webchat-0.13.1.tgz",
"integrity": "sha512-hF80h8xxvic8vgH0FnLY+zAgs17mAf4YKG8+Z0EP8MGXE4KhwCnLwntklhc0WUUY7afoOu+14yc4NBksVOSWuA==",
"version": "0.14.3-master.2cc3c75",
"resolved": "https://registry.npmjs.org/botframework-webchat/-/botframework-webchat-0.14.3-master.2cc3c75.tgz",
"integrity": "sha512-aJmxAd2oPef9Jih1Ws+ebWJi1lHnCkC3OKawaAVCL6+yu7YeTqrCcPws9G2d8uUiqUzLJ9bvfKdCA2kDlpAe/A==",
"requires": {
"adaptivecards": "1.0.0",
"bluebird": "3.5.1",
"botframework-directlinejs": "0.9.15",
"botframework-directlinejs": "0.9.16",
"core-js": "2.4.1",
"jspeech": "0.1.1",
"markdown-it": "8.3.1",
@ -1455,7 +1455,7 @@
"redux": "3.7.2",
"redux-observable": "0.13.0",
"rxjs": "5.4.3",
"simple-update-in": "1.2.0",
"simple-update-in": "1.3.0",
"tslib": "1.7.1"
},
"dependencies": {
@ -9876,9 +9876,9 @@
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
},
"simple-update-in": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/simple-update-in/-/simple-update-in-1.2.0.tgz",
"integrity": "sha512-a6s2H/Px+TXHlJG6FvBpVQU4qnz2BFjMzPfuzdqnGabKUntbIeRknTasCwlWKrXhD1QBSPZ9XoiGF8EpRLjpiQ=="
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/simple-update-in/-/simple-update-in-1.3.0.tgz",
"integrity": "sha512-XQdzyPAjHeqcBDJfUBKgfnurtE9Z/PC7Jh73DAiNlS4vMkdVTrtNpg5GJEGSDOtJ5LPQdZ/BWTx5GNzsP89mlA=="
},
"slash": {
"version": "1.0.0",

View file

@ -33,13 +33,14 @@
"use strict";
import {
Sequelize,
DataTypes,
DataTypeUUIDv4,
DataTypeDate,
DataTypeDecimal
} from "sequelize";
import {
Sequelize,
Table,
Column,
Model,
@ -59,7 +60,6 @@ import {
import { GuaribasUser } from "../../security.gblib/models";
import { GuaribasInstance, GuaribasPackage } from "../../core.gbapp/models/GBModel";
@Table
export class GuaribasSubject extends Model<GuaribasSubject> {
@PrimaryKey
@ -84,7 +84,7 @@ export class GuaribasSubject extends Model<GuaribasSubject> {
@BelongsTo(() => GuaribasSubject, "parentSubjectId")
parentSubject: GuaribasSubject;
@HasMany(() => GuaribasSubject, {foreignKey: "parentSubjectId"})
@HasMany(() => GuaribasSubject, { foreignKey: "parentSubjectId" })
childrenSubjects: GuaribasSubject[];
@ForeignKey(() => GuaribasInstance)
@ -107,10 +107,8 @@ export class GuaribasSubject extends Model<GuaribasSubject> {
@BelongsTo(() => GuaribasPackage)
package: GuaribasPackage;
}
@Table
export class GuaribasQuestion extends Model<GuaribasQuestion> {
@PrimaryKey
@ -118,42 +116,42 @@ export class GuaribasQuestion extends Model<GuaribasQuestion> {
@Column
questionId: number;
@Column({ type: DataType.STRING(64) })
@Column(DataType.STRING(64))
@Column
subject1: string;
@Column({ type: DataType.STRING(64) })
@Column(DataType.STRING(64))
@Column
subject2: string;
@Column({ type: DataType.STRING(64) })
@Column(DataType.STRING(64))
@Column
subject3: string;
@Column({ type: DataType.STRING(64) })
@Column(DataType.STRING(64))
@Column
subject4: string;
@Column({ type: DataType.STRING(1024) })
@Column(DataType.STRING(1024))
@Column
keywords: string;
@Column({ type: DataType.STRING(512) })
@Column(DataType.STRING(512))
from: string;
@Column({ type: DataType.STRING(512) })
@Column(DataType.STRING(512))
to: string;
@Column({ type: DataType.TEXT })
@Column(DataType.TEXT)
content: string;
@Column
@CreatedAt
creationDate: Date;
createdAt: Date;
@Column
@UpdatedAt
updatedOn: Date;
updatedAt: Date;
@ForeignKey(() => GuaribasAnswer)
@Column
@ -189,16 +187,16 @@ export class GuaribasAnswer extends Model<GuaribasAnswer> {
@Column
format: string;
@Column({ type: DataType.TEXT })
@Column(DataType.TEXT)
content: string;
@Column
@CreatedAt
creationDate: Date;
createdAt: Date;
@Column
@UpdatedAt
updatedOn: Date;
updatedAt: Date;
@HasMany(() => GuaribasQuestion)
questions: GuaribasQuestion[];

View file

@ -30,17 +30,17 @@
| |
\*****************************************************************************/
"use strict";
import {
Sequelize,
DataTypes,
DataTypeUUIDv4,
DataTypeDate,
DataTypeDecimal
} from "sequelize";
import {
Sequelize,
Table,
Column,
Model,
@ -56,8 +56,8 @@ import {
PrimaryKey,
AutoIncrement
} from "sequelize-typescript";
import { GuaribasInstance } from "../../core.gbapp/models/GBModel";
import { GuaribasInstance } from "../../core.gbapp/models/GBModel";
@Table
export class GuaribasUser extends Model<GuaribasUser> {
@ -75,18 +75,15 @@ export class GuaribasUser extends Model<GuaribasUser> {
@Column email: string;
@Column({ type: DataType.STRING(512) })
@Column
@Column(DataType.STRING(512))
internalAddress: string;
@ForeignKey(() =>
GuaribasInstance)
@ForeignKey(() => GuaribasInstance)
@Column
instanceId: number;
@BelongsTo(() => GuaribasInstance)
instance: GuaribasInstance;
}
@Table
@ -100,12 +97,11 @@ export class GuaribasGroup extends Model<GuaribasGroup> {
@Column
displayName: string;
@ForeignKey(() => GuaribasInstance)
@Column
instanceId: number;
@BelongsTo(() => GuaribasInstance )
@BelongsTo(() => GuaribasInstance)
instance: GuaribasInstance;
}

View file

@ -204,7 +204,7 @@ export class WhatsappDirectLine extends GBService {
// Ignore own messages.
// TODO: this.botId instead of "general-bot-9672a8d3"
activities = activities.filter((m) => { return m.from.id === "general-bot-9672a8d3" && m.type === "message" });
activities = activities.filter((m) => { return (m.from.id === "GeneralBot-Netshoes") && m.type === "message" });
if (activities.length) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,013 KiB

View file

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View file

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View file

Before

Width:  |  Height:  |  Size: 480 B

After

Width:  |  Height:  |  Size: 480 B

View file

Before

Width:  |  Height:  |  Size: 855 B

After

Width:  |  Height:  |  Size: 855 B

Some files were not shown because too many files have changed in this diff Show more