botserver/packages/core.gbapp/models/GBModel.ts

401 lines
10 KiB
TypeScript
Raw Normal View History

2018-04-21 02:59:30 -03:00
/*****************************************************************************\
2024-01-09 17:40:48 -03:00
| ® |
| |
| |
| |
| |
2018-04-21 02:59:30 -03:00
| |
| General Bots Copyright (c) pragmatismo.cloud. All rights reserved. |
2018-04-21 02:59:30 -03:00
| Licensed under the AGPL-3.0. |
2018-11-11 19:09:18 -02:00
| |
2018-04-21 02:59:30 -03:00
| 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, |
2018-09-11 19:40:53 -03:00
| but WITHOUT ANY WARRANTY, without even the implied warranty of |
2018-04-21 02:59:30 -03:00
| 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.cloud. |
2018-04-21 02:59:30 -03:00
| 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. |
| |
\*****************************************************************************/
2018-11-11 19:09:18 -02:00
/**
* @fileoverview General Bots server core.
*/
'use strict';
2018-04-21 02:59:30 -03:00
import {
AutoIncrement,
BelongsTo,
Column,
CreatedAt,
DataType,
ForeignKey,
Model,
PrimaryKey,
Table,
UpdatedAt
} from 'sequelize-typescript';
2018-04-21 02:59:30 -03:00
import { IGBInstance } from 'botlib';
2018-04-21 02:59:30 -03:00
/**
* Base instance data for a bot.
*/
2018-04-21 02:59:30 -03:00
@Table
2022-11-19 23:34:58 -03:00
export class GuaribasInstance extends Model<GuaribasInstance> implements IGBInstance {
@PrimaryKey
@AutoIncrement
2022-01-03 13:11:21 -03:00
@Column(DataType.INTEGER)
2022-12-12 16:10:17 -03:00
declare instanceId: number;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare botEndpoint: string;
2018-09-04 15:09:52 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare whoAmIVideo: string;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare botId: string;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare title: string;
2018-04-21 02:59:30 -03:00
@Column({ type: DataType.STRING(16) })
declare activationCode: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare description: string;
2018-04-21 02:59:30 -03:00
@Column({ type: DataType.STRING(16) })
declare state: string;
declare version: string;
2018-04-21 02:59:30 -03:00
2022-11-11 21:35:05 -03:00
@Column(DataType.STRING(64))
declare botKey: string;
2022-11-11 21:35:05 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare enabledAdmin: boolean;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare engineName: string;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare marketplaceId: string;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare textAnalyticsKey: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare textAnalyticsEndpoint: string;
2018-04-21 02:59:30 -03:00
@Column({ type: DataType.STRING(64) })
declare translatorKey: string;
@Column({ type: DataType.STRING(128) })
declare translatorEndpoint: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare marketplacePassword: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare webchatKey: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare authenticatorTenant: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare authenticatorAuthorityHostUrl: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare cloudSubscriptionId: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare cloudUsername: string;
2018-10-25 18:13:51 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare cloudPassword: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare cloudLocation: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare googleBotKey: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare googleChatApiKey: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare googleChatSubscriptionName: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare googleClientEmail: string;
@Column({ type: DataType.STRING(4000) })
declare googlePrivateKey: string;
2022-11-19 23:34:58 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare googleProjectId: string;
2022-11-19 23:34:58 -03:00
2021-07-06 13:18:38 -03:00
@Column({ type: DataType.STRING(255) })
declare facebookWorkplaceVerifyToken: string;
2021-07-06 13:18:38 -03:00
@Column({ type: DataType.STRING(255) })
declare facebookWorkplaceAppSecret: string;
2021-07-06 13:18:38 -03:00
@Column({ type: DataType.STRING(512) })
declare facebookWorkplaceAccessToken: string;
2022-11-19 23:34:58 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare whatsappBotKey: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare whatsappServiceKey: string;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare whatsappServiceNumber: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare whatsappServiceUrl: string;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare smsKey: string;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare smsSecret: string;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare smsServiceNumber: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare speechKey: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare speechEndpoint: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare spellcheckerKey: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare spellcheckerEndpoint: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare theme: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare ui: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare kb: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare nlpAppId: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare nlpKey: string;
@Column({ type: DataType.STRING(512) })
declare nlpEndpoint: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare nlpAuthoringKey: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare deploymentPaths: string;
2018-10-25 18:13:51 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare searchHost: string;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare searchKey: string;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare searchIndex: string;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare searchIndexer: string;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare storageUsername: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare storagePassword: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare storageName: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare storageServer: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare storageDialect: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare storagePath: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare adminPass: string;
2018-10-25 18:13:51 -03:00
@Column(DataType.FLOAT)
declare searchScore: number;
2018-04-21 02:59:30 -03:00
@Column(DataType.FLOAT)
declare nlpScore: number;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.DATE)
@CreatedAt
declare createdAt: Date;
2022-01-03 13:11:21 -03:00
@Column(DataType.DATE)
@UpdatedAt
declare updatedAt: Date;
@Column(DataType.STRING(4000))
declare params: string;
2018-04-21 02:59:30 -03:00
}
/**
* Each packaged listed for use in a bot instance.
*/
2018-04-21 02:59:30 -03:00
@Table
export class GuaribasPackage extends Model<GuaribasPackage> {
@PrimaryKey
@AutoIncrement
2022-01-03 13:42:12 -03:00
@Column(DataType.INTEGER)
declare packageId: number;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare packageName: string;
@ForeignKey(() => GuaribasInstance)
2022-01-03 13:11:21 -03:00
@Column(DataType.INTEGER)
declare instanceId: number;
2018-04-21 02:59:30 -03:00
@BelongsTo(() => GuaribasInstance)
declare instance: GuaribasInstance;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.DATE)
@CreatedAt
declare createdAt: Date;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.DATE)
@UpdatedAt
declare updatedAt: Date;
@Column({ type: DataType.STRING(512) })
declare custom: string;
2018-04-21 02:59:30 -03:00
}
/**
* A bot channel.
*/
2018-04-21 02:59:30 -03:00
@Table
export class GuaribasChannel extends Model<GuaribasChannel> {
@PrimaryKey
@AutoIncrement
2022-01-03 13:42:12 -03:00
@Column(DataType.INTEGER)
declare channelId: number;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare title: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.DATE)
@CreatedAt
declare createdAt: Date;
2022-01-03 13:11:21 -03:00
@Column(DataType.DATE)
@UpdatedAt
declare updatedAt: Date;
2018-04-21 02:59:30 -03:00
}
/**
* An exception that has been thrown.
*/
2018-04-21 02:59:30 -03:00
@Table
//tslint:disable-next-line:max-classes-per-file
2023-02-12 14:31:21 -03:00
export class GuaribasLog extends Model<GuaribasLog> {
@PrimaryKey
@AutoIncrement
@Column(DataType.INTEGER)
2023-02-12 14:31:21 -03:00
declare logId: number;
2018-04-21 02:59:30 -03:00
2023-02-12 14:31:21 -03:00
@Column(DataType.STRING(1024))
declare message: string;
2018-04-21 02:59:30 -03:00
2023-02-12 14:31:21 -03:00
@Column(DataType.STRING(1))
declare kind: string;
@ForeignKey(() => GuaribasInstance)
2022-01-03 13:11:21 -03:00
@Column(DataType.INTEGER)
declare instanceId: number;
2018-04-21 02:59:30 -03:00
@BelongsTo(() => GuaribasInstance)
declare instance: GuaribasInstance;
2022-01-03 13:11:21 -03:00
@Column(DataType.DATE)
@CreatedAt
declare createdAt: Date;
2018-04-21 02:59:30 -03:00
2022-01-03 13:11:21 -03:00
@Column(DataType.DATE)
@UpdatedAt
declare updatedAt: Date;
}
@Table
//tslint:disable-next-line:max-classes-per-file
export class GuaribasApplications extends Model<GuaribasApplications> {
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare name: string;
@ForeignKey(() => GuaribasInstance)
2022-01-03 13:11:21 -03:00
@Column(DataType.INTEGER)
declare instanceId: number;
@BelongsTo(() => GuaribasInstance)
declare instance: GuaribasInstance;
2022-01-03 13:11:21 -03:00
@Column(DataType.DATE)
@CreatedAt
declare createdAt: Date;
2022-01-03 13:11:21 -03:00
@Column(DataType.DATE)
@UpdatedAt
declare updatedAt: Date;
}
@Table
//tslint:disable-next-line:max-classes-per-file
export class GuaribasSchedule extends Model<GuaribasSchedule> {
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare name: string;
2022-01-03 13:11:21 -03:00
@Column(DataType.STRING(255))
declare schedule: string;
@ForeignKey(() => GuaribasInstance)
2022-01-03 13:11:21 -03:00
@Column(DataType.INTEGER)
declare instanceId: number;
@BelongsTo(() => GuaribasInstance)
declare instance: GuaribasInstance;
2022-01-03 13:11:21 -03:00
@Column(DataType.DATE)
@CreatedAt
declare createdAt: Date;
2022-01-03 13:11:21 -03:00
@Column(DataType.DATE)
@UpdatedAt
declare updatedAt: Date;
}