Compare commits

..

No commits in common. "main" and "2.0.113" have entirely different histories.

342 changed files with 46069 additions and 742942 deletions

2
.deployment Normal file
View file

@ -0,0 +1,2 @@
[config]
command = deploy.cmd

View file

@ -1,46 +0,0 @@
name: GBCI
run: git config --global http.sslVerify false
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: gbo
steps:
- name: Disable SSL verification (temporary)
run: git config --global http.sslVerify false
- uses: actions/checkout@v4
# - name: Setup Node.js
# uses: actions/setup-node@v4
# with:
# node-version: '20'
# cache: 'npm'
- name: Copy files to deployment location
run: |
echo "[General Bots Deployer] Copying files to deploy location..."
sudo rm -rf /opt/gbo/bin/bot/botserver/dist
sudo cp -r ./* /opt/gbo/bin/bot/botserver
- name: Building BotServer
run: |
echo "[General Bots Deployer] Building BotServer..."
# rm -rf /opt/gbo/bin/bot/botserver/node_modules
cd /opt/gbo/bin/bot/botserver
sudo npm ci --production
npm run build-server
npm run build-gbui
- name: Restart Bots Deployer
run: |
echo "[General Bots Deployer] Restarting..."
lxc restart pragmatismo-bot

9
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,9 @@
<!-- File a GitHub issue only for bugs or feature requests related to the code **in this repository**. For other topics you can get more information in the README file. -->
### Observed Results:
<!-- This could be a description, error output, steps to reproduce, a feature missed, etc. -->
### Expected behavior:
<!-- What did you expect to happen? -->

35
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View file

@ -0,0 +1,35 @@
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

7
.github/ISSUE_TEMPLATE/custom.md vendored Normal file
View file

@ -0,0 +1,7 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
---

View file

@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

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.

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
### Changes description
<!-- Describe results, user mentions, screenshots, screencast (gif) -->
### Checklist
Please check if your PR fulfills the following specifications:
- [ ] Tests for the changes have been added
- [ ] Docs have been added/updated
### References
<!-- issues related (for reference or to be closed) and/or links of discuss -->
Closes #N/A

3
.github/invite-contributors.yml vendored Normal file
View file

@ -0,0 +1,3 @@
isOutside: true
# Team Name
team: contributors

44
.github/settings.yml vendored Normal file
View file

@ -0,0 +1,44 @@
repository:
name: botserver
description: botserver
homepage: http://pragmatismo.io/general-bots
topics: node-module
private: false
has_issues: true
has_wiki: false
has_downloads: true
default_branch: develop
allow_squash_merge: true
allow_merge_commit: false
allow_rebase_merge: true
labels:
- name: bug
color: f44336
- name: build
color: 795548
- name: ci
color: fbca04
- name: documentation
color: 607d8b
- name: duplicate
color: 9e9e9e
- name: feature
color: 3f51b5
- name: invalid
color: cddc39
- name: performance
color: 009688
- name: question
color: ff5722
- name: refactor
color: 9c27b0
- name: style
color: 2196f3
- name: test
color: 8bc34a
- name: wontfix
color: ffffff
- name: help wanted
color: 33aa3f
- name: good first issue
color: 7057ff

14
.gitignore vendored
View file

@ -11,8 +11,6 @@
/packages/default.gbui/build
/packages/default.gbui/.env
/packages/default.gbui/node_modules
/packages/default.gbui/package-lock.json
/packages/default.gbui/yarn-lock.json
/work
*.vbs.compiled
*.vbs.js
@ -20,15 +18,3 @@
.env
*.env
.vscode/launch.json
.wwebjs_auth
GB.log
gb.log
GB.log.json
yarn-error.log
yarn-lock.json
logo.svg
screenshot.png
data.db
.wwebjs_cache
*doula*
*botpoc*

View file

@ -1,9 +0,0 @@
{
"extends": [
"development"
],
"hints": {
"typescript-config/strict": "off",
"typescript-config/consistent-casing": "off"
}
}

View file

@ -5,4 +5,4 @@
"arrowParens": "avoid",
"semi": true,
"singleQuote": true
}
}

View file

@ -1,47 +0,0 @@
import { expect, test } from 'vitest';
import { GBServer } from './src/app';
import { RootData } from './src/RootData';
import { GBMinInstance } from 'botlib';
import { Mutex } from 'async-mutex';
export default function init() {
const min = {
packages: null,
appPackages: null,
botId: 'gbtest',
instance: {botId: 'gbtest'},
core: {},
conversationalService: {},
kbService: {},
adminService: {},
deployService: {},
textServices: {},
bot: {},
dialogs: {},
userState: {},
userProfile: {},
whatsAppDirectLine: {},
cbMap: {},
scriptMap: {},
sandBoxMap: {},
gbappServices: {}
}
GBServer.globals = new RootData();
GBServer.globals.server = null;
GBServer.globals.httpsServer = null;
GBServer.globals.webSessions = {};
GBServer.globals.processes = [0, { pid: 1, proc: {step: {}}}];
GBServer.globals.files = {};
GBServer.globals.appPackages = [];
GBServer.globals.sysPackages = [];
GBServer.globals.minInstances = [min];
GBServer.globals.minBoot = min;
GBServer.globals.wwwroot = null;
GBServer.globals.entryPointDialog = null;
GBServer.globals.debuggers = [];
GBServer.globals.indexSemaphore = new Mutex();
GBServer.globals.users = {1: {userId: 1}};
}

31
.travis.yml Normal file
View file

@ -0,0 +1,31 @@
language: node_js
node_js:
- lts/*
notifications:
email: false
before_script:
- npm run build
branches:
only:
- master
- /^greenkeeper/.*$/
except:
- /^v\d+\.\d+\.\d+$/
after_success:
- npm run travis-deploy-once "npm run semantic-release"
- npm pack
deploy:
- provider: pages
skip_cleanup: true
local_dir: docs/reference
github_token: $GITHUB_TOKEN
on:
tags: false
branch: master

26
.vscode/launch.json.template vendored Normal file
View file

@ -0,0 +1,26 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"sourceMaps": true,
"name": "Debug Program",
"program": "${workspaceRoot}/boot.js",
"cwd": "${workspaceRoot}",
"env": {
"NODE_ENV": "development"
},
"args": [
"--no-deprecation"
],
"skipFiles": [
"node_modules/**/*.js"
],
"outFiles": [
"${workspaceRoot}/dist/**/*.js"],
"stopOnEntry": false,
"console": "integratedTerminal"
}
]
}

3
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}

30
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,30 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"option": "watch",
"problemMatcher": [
"$tsc-watch"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"problemMatcher": [
"$tsc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

File diff suppressed because it is too large Load diff

View file

@ -1,48 +0,0 @@
# Código de Conduta do Convênio do Colaborador
## Nosso Compromisso
No interesse de promover um ambiente aberto e acolhedor, nós, como colaboradores e mantenedores, nos comprometemos a tornar a participação em nosso projeto e em nossa comunidade uma experiência livre de assédio para todos, independentemente de idade, raça, etnia, origem nacional, ascendência, sexo, sexo identidade ou apresentação, orientação sexual, aparência física, afiliação religiosa, credo, estado civil ou familiar, não tolerará abuso ou assédio discriminatório ou sexual contra qualquer pessoa durante quaisquer atividades relacionadas à conferência, incluindo, entre outros, envio, revisão, tutoriais, oficinas ou eventos sociais. O abuso inclui qualquer ação dirigida a um indivíduo que (a) interfira substancialmente na participação dessa pessoa ou (b) faça com que essa pessoa tema por sua segurança pessoal. Isso inclui ameaças, intimidação, intimidação, perseguição ou outros tipos de abuso. Assédio discriminatório inclui qualquer conduta que discrimine ou denigra um indivíduo com base em idade, raça, etnia, nacionalidade, ascendência, gênero, identidade ou apresentação de gênero, orientação sexual, aparência física, afiliação religiosa, credo, estado civil ou familiar, deficiência , características pessoais ou quaisquer outros fatores diferenciadores, bem como qualquer outra característica protegida por lei no local onde ocorre a atividade da conferência. Assédio sexual inclui (mas não se limita a) investidas sexuais indesejadas repetidas, pedidos de favores sexuais ou outra conduta verbal ou física de natureza sexual, deficiência, características pessoais ou quaisquer outros fatores de diferenciação, bem como qualquer outra característica protegida por lei no local onde a atividade ocorre.
## Nossos Padrões
Exemplos de comportamento que contribuem para criar um ambiente positivo incluem:
* Usando linguagem padrão (sem expressões idiomáticas), acolhedora e inclusiva
* Ser respeitoso com os diferentes pontos de vista e experiências
* Aceitar graciosamente críticas construtivas
* Focar no que é melhor para a comunidade
* Mostrar empatia para com outros membros da comunidade
* Escrever trechos gerais de código para que possam ser amplamente utilizados.
Exemplos de comportamento inaceitável por parte dos participantes incluem:
* O uso de linguagem ou imagens sexualizadas e atenção ou avanços sexuais indesejados
* Trolling, comentários insultuosos/depreciativos e ataques pessoais ou políticos
* Assédio (harassment) público ou privado / perseguição (stalking) / intimidação (bullying) / mobbing (group bullying or gang stalking)
* Publicar informações privadas de outras pessoas, como endereço físico ou eletrônico, sem permissão explícita
* Outra conduta que possa ser razoavelmente considerada inadequada em um ambiente profissional
* Chamar uma pessoa de nome diferente do declarado pela pessoa
## Nossas responsabilidades
Os mantenedores do projeto são responsáveis por esclarecer os padrões de comportamento aceitável e devem tomar ações corretivas apropriadas e justas em resposta a quaisquer instâncias de comportamento inaceitável.
Os mantenedores do projeto têm o direito e a responsabilidade de remover, editar ou rejeitar comentários, confirmações, códigos, edições wiki, problemas e outras contribuições que não estejam alinhadas com este Código de Conduta, ou banir temporária ou permanentemente qualquer colaborador por outros comportamentos que eles considerem inapropriado, ameaçador, ofensivo ou prejudicial.
## Escopo
Este Código de Conduta se aplica tanto em espaços do projeto quanto em espaços públicos quando um indivíduo representa o projeto ou sua comunidade. Exemplos de representação de um projeto ou comunidade incluem o uso de um endereço de e-mail oficial do projeto, postagem por meio de uma conta de mídia social oficial ou atuação como um representante nomeado em um evento online ou offline. A representação de um projeto pode ser posteriormente definida e esclarecida pelos mantenedores do projeto.
## Aplicação
Instâncias de comportamento abusivo, de assédio ou inaceitável podem ser relatadas entrando em contato com a equipe de segurança da Pragmatismo em c. A equipe do projeto analisará e investigará todas as reclamações e responderá da maneira que julgar apropriada às circunstâncias. A equipe do projeto é obrigada a manter a confidencialidade em relação ao relator de um incidente. Mais detalhes sobre políticas de execução específicas podem ser publicados separadamente.
Os mantenedores do projeto que não seguirem ou aplicarem o Código de Conduta de boa fé podem enfrentar repercussões temporárias ou permanentes conforme determinado por outros membros da liderança do projeto.
## Atribuição
Este Código de Conduta foi adaptado do [Acordo do Colaborador][homepage], versão 1.4, disponível em [http://contributor-covenant.org/version/1/4][version] e Código de Conduta ICAPS.
[página inicial]: http://contributor-covenant.org
[versão]: http://contributor-covenant.org/version/1/4/

View file

@ -2,7 +2,7 @@
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, race, ethnicity, national origin, ancestry, gender, gender identity or presentation, sexual orientation, physical appearance, religious affiliation, creed, marital or familial status, will not tolerate abuse or discriminatory or sexual harassment toward any person during any conference-related activities, including but not limited to submission, reviewing, tutorials, workshops, or social events. Abuse includes any action directed at an individual that (a) interferes substantially with that persons participation or (b) causes that person to fear for their personal safety. This includes threats, intimidation, bullying, stalking, or other types of abuse. Discriminatory harassment includes any conduct that discriminates or denigrates an individual on the basis of age, race, ethnicity, national origin, ancestry, gender, gender identity or presentation, sexual orientation, physical appearance, religious affiliation, creed, marital or familial status, disability, personal characteristics, or any other differentiating factors, as well as any other characteristic protected by law in the location where conference activity takes place. Sexual harassment includes (but is not limited to) repeated unwelcome sexual advances, requests for sexual favors, or other verbal or physical conduct of a sexual nature, disability, personal characteristics, or any other differentiating factors, as well as any other characteristic protected by law in the location where activity takes place.
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
@ -19,7 +19,7 @@ Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment / stalking / bullying / mobbing (group bullying or gang stalking)
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
* Call a person other name than that declared by the person
@ -36,14 +36,13 @@ This Code of Conduct applies both within project spaces and in public spaces whe
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the Pragmatismo security team at c. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the Pragmatismo.io security team at security@pragmatismo.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] and ICAPS Code of Conduct.
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View file

@ -32,7 +32,7 @@ In general, things we find useful when reviewing suggestions are:
## Contributing bug fixes
General Bots is current in early preview. We're still accepting contributions in the form of bug fixes.
A bug must have an issue tracking it in the issue tracker that has been approved by the pragmatismo.com.br team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.
A bug must have an issue tracking it in the issue tracker that has been approved by the Pragmatismo.io team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.
## Contributing features
@ -40,7 +40,7 @@ Please open an issue with the `Schema` label to get a discussion started.
## Legal
We appreciate community contributions to code repositories open sourced by pragmatismo.com.br. By signing a contributor license agreement, we ensure that the community is free to use your contributions.
We appreciate community contributions to code repositories open sourced by Pragmatismo.io. By signing a contributor license agreement, we ensure that the community is free to use your contributions.
## Housekeeping

View file

@ -90,59 +90,3 @@ GO
ALTER TABLE dbo.GuaribasUser ADD
agentSystemId nvarchar(255) NULL,
GO
# 2.0.115
ALTER TABLE dbo.GuaribasQuestion ADD
skipIndex bit NULL
GO
# 2.0.116 >
ALTER TABLE dbo.GuaribasInstance ADD
googleBotKey nvarchar(255) NULL,
googleChatApiKey nvarchar(255) NULL,
googleChatSubscriptionName nvarchar(255) NULL,
googleClientEmail nvarchar(255) NULL,
googlePrivateKey nvarchar(4000) NULL,
googleProjectId nvarchar(255) NULL
GO
# 2.0.119
ALTER TABLE dbo.GuaribasInstance ADD
facebookWorkplaceVerifyToken nvarchar(255) NULL,
facebookWorkplaceAppSecret nvarchar(255) NULL,
facebookWorkplaceAccessToken nvarchar(512) NULL
GO
# 2.0.140
/****** Object: Table [dbo].[GuaribasSchedule] Script Date: 25/08/2021 03:53:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GuaribasSchedule]
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [nvarchar](255) NULL,
[schedule] [nvarchar](255) NULL,
[instanceId] [int] NULL,
[createdAt] [datetimeoffset](7) NULL,
[updatedAt] [datetimeoffset](7) NULL
GO
ALTER TABLE dbo.GuaribasInstance ADD botKey nvarchar(64) NULL;
# 2.3.9
GO
ALTER TABLE dbo.GuaribasUser ADD
params nvarchar(4000) NULL
GO

8
FEATURES.md Normal file
View file

@ -0,0 +1,8 @@
# General Bots Features
| Feature | BF | GB |
|----------------------------------------------------------------------------|----|----|
| Use of conversational administration to manage bot packages (Talk to admin | - | X |
| F5 to run on VSCode | - | X |
| Isolated code on packages | - | X |
| Breaking changes protected | - | X |

View file

@ -1,5 +1,5 @@
General Bots is licensed under a dual license. To check which license
edition of General bots you have installed, please ask info@pragmatismo.com.br
edition of General bots you have installed, please ask info@pragmatismo.io
informing your Customer ID.
If you modify this Program, or any covered work, by combining it

7
LOCALIZATION.md Normal file
View file

@ -0,0 +1,7 @@
# Localization in General Bots
## .gbapp
The localization is done by adding a strings.ts file to the root of the .gbapp package.

151
README.md
View file

@ -1,36 +1,20 @@
### Key Facts
- LLM Orchestrator AGPL licensed (to use as custom-label SaaS, contributing back)
- True community governance
- No single corporate control
- 5+ years of stability
- Never changed license
- Enterprise-grad
- Hosted locally or Multicloud
## Contributors
<a href="https://github.com/generalbots/botserver/graphs/contributors">
<img src="https://contrib.rocks/image?repo=generalbots/botserver" />
</a>
## Overview
| Area | Status |
|------------------------------|----------------------------------------------------------------------------------------------------|
| Releases | [![General Bots](https://img.shields.io/npm/dt/botserver.svg?logo=npm&label=botserver)](https://www.npmjs.com/package/botserver/) [![.gbapp lib](https://img.shields.io/npm/dt/botlib.svg?logo=npm&label=botlib)](https://www.npmjs.com/package/botlib/) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)|
| Community | [![StackExchange](https://img.shields.io/stackexchange/stackoverflow/t/generalbots.svg)](https://stackoverflow.com/questions/tagged/generalbots) [![Open-source](https://badges.frapsoft.com/os/v2/open-source.svg)](https://badges.frapsoft.com) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![License](https://img.shields.io/badge/license-AGPL-blue.svg)](https://github.com/GeneralBots/BotServer/blob/master/LICENSE.txt)|
| Management | [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://gitHub.com/GeneralBots/BotServer/graphs/commit-activity) |
| Security | [![Known Vulnerabilities](https://snyk.io/test/github/GeneralBots/BotServer/badge.svg)](https://snyk.io/test/github/GeneralBots/BotServer) |
| Building & Quality | [![Coverage Status](https://coveralls.io/repos/github/GeneralBots/BotServer/badge.svg)](https://coveralls.io/github/GeneralBots/BotServer) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) |
| Packaging | [![forthebadge](https://badge.fury.io/js/botserver.svg)](https://badge.fury.io) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) |
| Samples | [BASIC](https://github.com/GeneralBots/BotServer/tree/master/packages/default.gbdialog) or [![TypeScript](https://badges.frapsoft.com/typescript/code/typescript.svg?v=101)](https://github.com/GeneralBots/AzureADPasswordReset.gbapp)
| [Docker Image](https://github.com/lpicanco/docker-botserver) ![Docker Pulls](https://img.shields.io/docker/pulls/lpicanco/botserver.svg) <br/> *Provided by [@lpicanco](https://github.com/lpicanco/docker-botserver)* |
| Building & Quality | [![Build Status](https://travis-ci.com/GeneralBots/BotServer.svg?branch=master)](https://travis-ci.com/GeneralBots/BotServer) [![Coverage Status](https://coveralls.io/repos/github/GeneralBots/BotServer/badge.svg)](https://coveralls.io/github/GeneralBots/BotServer) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) |
| Packaging | [![forthebadge](https://badge.fury.io/js/botserver.svg)](https://badge.fury.io) [![ZipFile](https://camo.githubusercontent.com/0150c0f148d50fe9750ebc5d313581da699a8c50/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7a69702d646f776e6c6f61642d626c75652e737667)](https://github.com/GeneralBots/BotServer/releases/latest) [![Dependencies](https://david-dm.org/GeneralBots/botserver.svg)](https://david-dm.org) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) |
| Samples | [VBA](https://github.com/GeneralBots/BotServer/tree/master/packages/default.gbdialog) or [![TypeScript](https://badges.frapsoft.com/typescript/code/typescript.svg?v=101)](https://github.com/GeneralBots/AzureADPasswordReset.gbapp)
| [Docker Image](https://github.com/lpicanco/docker-botserver) | ![Docker Automated build](https://img.shields.io/docker/automated/lpicanco/botserver.svg) ![Docker Build Status](https://img.shields.io/docker/build/lpicanco/botserver.svg) ![MicroBadger Size](https://img.shields.io/microbadger/image-size/lpicanco/botserver.svg) ![MicroBadger Layers](https://img.shields.io/microbadger/layers/lpicanco/botserver.svg) ![Docker Pulls](https://img.shields.io/docker/pulls/lpicanco/botserver.svg) <br/> *Provided by [@lpicanco](https://github.com/lpicanco/docker-botserver)* |
# General Bots
General Bots
------------------
![General Bot Logo](https://github.com/GeneralBots/BotServer/blob/main/logo.png?raw=true))
![General Bot Logo](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/logo.png)
General Bot is a strongly typed LLM conversational platform package based chat bot server focused in convention over configuration and code-less approaches, which brings software packages and application server concepts to help parallel bot development.
General Bot is a strongly typed package based chat bot server focused in convention over configuration and code-less approaches, which brings software packages and application server concepts to help parallel bot development.
## What is a Bot Server?
@ -44,115 +28,28 @@ advanced fashion writing custom code in editors like Visual Studio Code, Atom or
Everyone can create bots by just copying and pasting some files and using their
favorite tools from Office (or any text editor) or Photoshop (or any image
editor). LLM and BASIC can be mixed used to build custom dialogs so Bot can be extended just like VBA for Excel.
editor). BASIC can be used to build custom dialogs so Bot can be extended just like VBA for Excel (currently in alpha).
## Getting Started
### Prerequisites
Before you embark on your General Bots journey, ensure you have the following tools installed:
- **Node.js (version 20 or later)**: General Bots leverages the latest features of Node.js to provide a robust and efficient runtime environment. Download it from [nodejs.org](https://nodejs.org/en/download/).
- **Git (latest stable version)**: Essential for version control and collaborating on bot projects. Get it from [git-scm.com](https://git-scm.com/downloads).
### Quick Start Guide
Follow these steps to get your General Bots server up and running:
1. Clone the repository:
```bash
git clone https://github.com/GeneralBots/BotServer
```
This command creates a local copy of the General Bots server repository on your machine.
2. Navigate to the project directory:
```bash
cd BotServer
```
This changes your current directory to the newly cloned BotServer folder.
3. Install dependencies and start the server:
```bash
npm install
npm run start
```
The `npm install` command installs all necessary dependencies for the project. `npm run start` builds your bot server locally and serves it through a development server.
### Accessing Your Bot
Once the server is running, you can access your bot at `http://localhost:4242/`. This local server allows you to interact with your bot and test its functionality in real-time. If you want to publish
without password, define [ADMIN_OPEN_PUBLISH](https://github.com/GeneralBots/BotBook/master/docs/chapter-07-gbot-reference#enviroment-variables-reference) as true in BotServer .env file.
To publish bot packages and initiate a conversation with the bot, use the command:
```
/publish
```
This command prepares your bot packages for use and allows you to start interacting with your bot immediately.
## Development Workflow
### 1. Project Structure
The General Bots server follows a modular architecture designed for flexibility and scalability. Here's an overview of the main directories:
```
BotServer/
├── packages/
│ ├── core.gbapp/ # Core bot functionality
│ ├── kb.gbapp/ # Knowledge base packages
├── src / # Main entry point
└── package.json # Project configuration
```
This structure allows for easy navigation and management of different aspects of your bot project.
### 2. Creating Custom Packages
One of the strengths of General Bots is its extensibility. You can create custom packages to enhance your bot's capabilities:
- **.gbkb (Knowledge Base packages)**: Store and manage your bot's knowledge and responses.
- **.gbtheme (Theme packages)**: Customize the visual appearance of your bot interface.
- **.gbapp (Application packages)**: Add new features and functionalities to your bot.
Each package type has its own structure and purpose, which we'll explore in depth in their respective chapters.
![General Bot Reference Architecture](https://raw.githubusercontent.com/GeneralBots/BotBook/master/images/general-bots-reference-architecture.png)
## Samples
Several samples, including a Bot for AD Password Reset, are avaiable on the [repository list](https://github.com/GeneralBots).
### Using complete General Bots Conversational Data Analytics
![](https://user-images.githubusercontent.com/14840374/178154826-8188029e-b4f4-48aa-bc0d-126307ce5121.png)
```
TALK "General Bots Labs presents FISCAL DATA SHOW BY BASIC"
TALK "Gift Contributions to Reduce the Public Debt API (https://fiscaldata.treasury.gov/datasets/gift-contributions-reduce-debt-held-by-public/gift-contributions-to-reduce-the-public-debt)"
result = GET "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/gift_contributions?page[size]=500"
data = result.data
data = SELECT YEAR(record_date) as Yr, SUM(CAST(contribution_amt AS NUMBER)) AS Amount FROM data GROUP BY YEAR(record_date)
TALK "Demonstration of Gift Contributions with AS IMAGE keyword"
SET THEME dark
png = data as IMAGE
SEND FILE png
DELAY 5
TALK " Demonstration of Gift Contributions CHART keyword"
img = CHART "bar", data
SEND FILE img
```
## Guide
[Read the General Bots BotBook Guide](https://docs.pragmatismo.com.br)
[Read the General Bots BotBook Guide](https://github.com/GeneralBots/BotBook/tree/master/book).
# Videos
7 AI General Bots LLM Templates for Goodness
[https://www.youtube.com/watch?v=KJgvUPXi3Fw](https://www.youtube.com/watch?v=KJgvUPXi3Fw)
Now with the General Bots server you can press F5 on Visual Studio to get a bot factory on your environment* published on November 10th, 2018.
[![General Bot Video](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/video-01-thumb.jpg)](https://www.youtube.com/watch?v=AfKTwljoMOs)
See how easy is to use 'hear' and 'talk' to build Microsoft BOT Framework v4 logic with plain BASIC * published on December 3rd, 2018.
[![See how easy is to use 'hear' and 'talk' to build Microsoft BOT Framework v4 logic with plain BASIC](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/video-02-thumb.jpg)](https://www.youtube.com/watch?v=yX1sF9n9628)
# Contributing
@ -161,14 +58,14 @@ See our [Contribution Guidelines](https://github.com/pragmatismo-io/BotServer/bl
# Reporting Security Issues
Security issues and bugs should be reported privately, via email, to the pragmatismo.com.br Security
team at [security@pragmatismo.com.br](mailto:security@pragmatismo.com.br). You should
Security issues and bugs should be reported privately, via email, to the Pragmatismo.io Security
team at [security@pragmatismo.io](mailto:security@pragmatismo.io). You should
receive a response within 24 hours. If for some reason you do not, please follow up via
email to ensure we received your original message.
# License & Warranty
General Bot Copyright (c) pragmatismo.com.br. All rights reserved.
General Bot 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
@ -184,12 +81,12 @@ 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 Bot" is a registered trademark of pragmatismo.com.br.
"General Bot" 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.
<a href="https://stackoverflow.com/questions/ask?tags=generalbots">:speech_balloon: Ask a question</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://github.com/GeneralBots/BotBook">:book: Read the Docs</a>
Team pictures made with [contrib.rocks](https://contrib.rocks).
General Bots Code Name is [Guaribas](https://en.wikipedia.org/wiki/Guaribas), the name of a city in Brazil, state of Piaui.
[Roberto Mangabeira Unger](http://www.robertounger.com/en/): "No one should have to do work that can be done by a machine".

6
ROADMAP.md Normal file
View file

@ -0,0 +1,6 @@
# Roadmap
| Title | Priority | Release | Status |
|-------------------------------|------------------------------------------------------------------------------------------------------------|---------|--------|
| Isolation of .gbapp per .gbot | Today .gbapp loaded is shared across all bot instances and must be associated to one or more individually. | Medium | 2019Q4 |
| Python based .gbapps | Write conversational login in Python | Low | - |

7
SAMPLES.md Normal file
View file

@ -0,0 +1,7 @@
# General Bots Server Samples
| Sample | Description |
|--------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| [IntranetBotQuickStart-gbai](https://github.com/pragmatismo-io/IntranetBotQuickStart.gbai) | Free modules from General Bots Intranet based bot. |
| [AzureADPasswordReset-gbapp](https://github.com/pragmatismo-io/AzureADPasswordReset.gbapp) | Custom General Bot App (gbapp) for resetting an user password in Azure Active Directory, Office 365, Dynamics 365 or any app published through Azure AD. |
| [ProjectOnline.gbkb](https://github.com/pragmatismo-io/ProjectOnline.gbkb) | The .gbkb file demonstring a Knowledge Base for Pragmatismo.io KBot for Microsoft Project. |

View file

@ -1,61 +0,0 @@
# General Bots Security Policy
## Overview
Request your free IT security evaluation
• Reduce the risk of IT problems
• Plan for problems and deal with them when they happen
• Keep working if something does go wrong
• Protect company, client and employee data
• Keep valuable company information, such as plans and designs, secret
• Meet our legal obligations under the General Data Protection Regulation and other laws
• Meet our professional obligations towards our clients and customers
This IT security policy helps us:
• Rodrigo Rodriguez is the director with overall responsibility for IT security strategy.
• Microsoft is the IT partner organisation we use to help with our planning and support.
• Microsoft is the data protection officer to advise on data protection laws and best practices
Review process
We will review this policy yearly.
In the meantime, if you have any questions, suggestions
or feedback, please contact security@pragmatismo.com.br
We will only classify information which is necessary for the completion of our duties. We will also limit
access to personal data to only those that need it for processing. We classify information into different
categories so that we can ensure that it is protected properly and that we allocate security resources
appropriately:
• Unclassified. This is information that can be made public without any implications for the company,
such as information that is already in the public domain.
• Employee confidential. This includes information such as medical records, pay and so on.
• Company confidential. Such as contracts, source code, business plans, passwords for critical IT
systems, client contact records, accounts etc.
• Client confidential. This includes personally identifiable information such as name or address,
passwords to client systems, client business plans, new product information, market sensitive
information etc.
Employees joining and leaving
We will provide training to new staff and support for existing staff to implement this policy. This includes:
• An initial introduction to IT security, covering the risks, basic security measures, company policies
and where to get help
• Each employee will complete the National Archives Responsible for Information training course
(approximately 75 minutes)
• Training on how to use company systems and security software properly
• On request, a security health check on their computer, tablet or phone
When people leave a project or leave the company, we will promptly revoke their access privileges to
The company will ensure the data protection office is given all appropriate resources to carry out their
tasks and maintain their expert knowledge.
The Data Protection Officer reports directly to the highest level of management and must not carry out
any other tasks that could result in a conflict of interest.
## Reporting a Vulnerability
You can expect to get an update on a reported vulnerability in a day or two.
security@pragmatismo.com.br

View file

@ -1,79 +0,0 @@
# default.gbui
https://github.com/microsoft/BotFramework-WebChat/pull/4524
warning botframework-directlinejs > core-js@3.15.2: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning botframework-webchat > botframework-webchat-component > @emotion/css > @emotion/babel-plugin > @babel/plugin-syntax-jsx@7.18.6" has unmet peer dependency "@babel/core@^7.0.0-0".
warning botframework-webchat > botframework-webchat-component > @emotion/css > @emotion/babel-plugin@11.10.5" has unmet peer dependency "@babel/core@^7.0.0".
warning botframework-webchat > botframework-webchat-component > react-film > core-js@3.12.1: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning botframework-webchat > botframework-webchat-component > react-scroll-to-bottom > core-js@3.18.3: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning botframework-webchat > botframework-webchat-core > redux-devtools-extension@2.13.9: Package moved to @redux-devtools/extension.
warning botframework-webchat > microsoft-cognitiveservices-speech-sdk > asn1.js-rfc2560@5.0.1" has unmet peer dependency "asn1.js@^5.0.0".
warning botframework-webchat > web-speech-cognitive-services@7.1.2" has incorrect peer dependency "microsoft-cognitiveservices-speech-sdk@~1.17.0".
https://github.com/microsoft/powerbi-client-react
warning react-powerbi@0.9.1" has incorrect peer dependency "react@^16.8.0".
warning react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo > stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
warning react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
warning react-scripts > css-minimizer-webpack-plugin > cssnano > cssnano-preset-default > postcss-svgo > svgo > stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
warning react-scripts > eslint-config-react-app > @typescript-eslint/eslint-plugin > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
warning react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5".
warning react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-transform-react-jsx@^7.14.9".
warning react-scripts > jest > @jest/core > jest-config > jest-environment-jsdom > jsdom > w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
warning react-scripts > react-dev-utils > fork-ts-checker-webpack-plugin@6.5.2" has unmet peer dependency "typescript@>= 2.7".
# BotServer
docxtemplater is not working in more modern versions. Stay with 3.9.7.
nodejs/node-gyp#2756
warning npm > node-gyp > make-fetch-happen > cacache > @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
vasyas/typescript-rest-rpc#20
warning typescript-rest-rpc > ts-morph > globby > fast-glob > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
#279
warning tslint@6.1.3: TSLint has been deprecated in favor of ESLint. Please see palantir/tslint#4534 for more information.
AlaSQL/alasql#1541
warning alasql > request@2.88.2: request has been deprecated, see request/request#3142
#281
warning c3-chart-maker > data-forge > promised-mongo > mongodb-core > bson@0.4.23: Fixed a critical issue with BSON serialization documented in CVE-2019-2391, see https://bit.ly/2KcpXdo for more details
#280
warning swagger-client > url > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
bahmutov/ggit#157
warning ban-sensitive-files > ggit > debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (debug-js/debug#797)
#283
warning nexmo > uuid@2.0.3: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
https://github.com/microsoft/botbuilder-js/issues/4370
warning botbuilder-ai > @azure/cognitiveservices-luis-runtime > @azure/ms-rest-js > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
https://github.com/Azure/azure-sdk-for-node/issues/5221
warning ms-rest-azure > request@2.88.2: request has been deprecated, see request/request#3142
https://github.com/MontassarLaribi/ssr-for-bots/issues/1
warning ssr-for-bots > tslint@6.1.3: TSLint has been deprecated in favor of ESLint. Please see palantir/tslint#4534 for more information.
https://github.com/vasyas/typescript-rest-rpc/issues/20
warning typescript-rest-rpc > ts-morph > globby > fast-glob > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
https://github.com/ash-developer/winston-logs-display/issues/8
warning winston-logs-display > jade > transformers@2.1.0: Deprecated, use jstransformer
https://github.com/softwarescales/git-issues/issues/29
warning git-issues > request@2.88.2: request has been deprecated, see request/request#3142
https://github.com/GeneralBots/BotServer/issues/284
warning license-checker > read-installed > readdir-scoped-modules@1.1.0: This functionality has been moved to @npmcli/fs
https://github.com/semantic-release/semantic-release/issues/1260
warning semantic-release > @semantic-release/npm > npm > readdir-scoped-modules@1.1.0: This functionality has been moved to @npmcli/fs
https://github.com/GeneralBots/BotServer/issues/277
warning travis-deploy-once@3.3.0: We recommend to use Travis Build Stages instead

View file

@ -1,14 +0,0 @@
{
"openapi": "3.0.0",
"info": {
"title": "General Bots API",
"description": "General Bots API description in Swagger format",
"version": "1.0"
},
"servers": [
{
"url": "https://generalbots.online/api",
"description": "General Bots Online"
}
]
}

Binary file not shown.

Binary file not shown.

66
boot.js Normal file
View file

@ -0,0 +1,66 @@
#!/usr/bin/env node
const Fs = require('fs');
const Path = require('path');
const { exec } = require('child_process');
var pjson = require('./package.json');
// Displays version of Node JS being used at runtime and others attributes.
console.log(`[GB Runtime] BotServer = v${pjson.version}`);
console.log(`[GB Runtime] BotLib = v${pjson.dependencies.botlib}`);
console.log(`[GB Runtime] BotBuilder (MS) = v${pjson.dependencies.botbuilder}`);
console.log(`[GB Runtime] NodeJS = ${process.version}`);
console.log(`[GB Runtime] platform = ${process.platform}`);
console.log(`[GB Runtime] architecture = ${process.arch}`);
console.log(`[GB Runtime] argv = ${process.argv}`);
console.log(`[GB Runtime] debugPort = ${process.debugPort}`);
var now = () => {
return (new Date()).toISOString().replace(/T/, ' ').replace(/\..+/, '') + ' UTC';
}
try {
var run = () => {
console.log(`[GB Runtime] Initializing General Bots Server...`);
const GBServer = require("./dist/src/app").GBServer
console.log(`[GB Runtime] ${now()} - Running '${GBServer.name}' on '${__dirname}' directory`);
process.env.PWD = __dirname;
GBServer.run();
}
var processDist = () => {
if (!Fs.existsSync('dist')) {
console.log(`${now()} - Compiling...`);
exec(Path.join(__dirname, 'node_modules/.bin/tsc'), (err, stdout, stderr) => {
if (err) {
console.error(err);
return;
}
run();
});
}
else {
run();
}
};
// Installing modules if it has not been done yet.
if (!Fs.existsSync('node_modules')) {
console.log(`${now()} - Installing modules for the first time, please wait...`);
exec('npm install', (err, stdout, stderr) => {
if (err) {
console.error(err);
return;
}
processDist();
});
}
else {
processDist();
}
} catch (e) {
console.log(e);
}

View file

@ -1,57 +0,0 @@
#!/usr/bin/env node
process.stdout.write(`General Bots 5 VM: node@${process.version.replace('v', '')}, ${process.platform} ${process.arch} `);
import fs from 'fs/promises';
import os from 'node:os';
import path from 'path';
import { exec } from 'child_process';
import {GBUtil} from './dist/src/util.js'
// Displays version of Node JS being used at runtime and others attributes.
console.log(`\nLoading General Bots VM...`);
var __dirname = process.env.PWD || process.cwd();
try {
var run = async () => {
import('./dist/src/app.js').then(async (gb)=> {
await gb.GBServer.run()
});
};
var processDist = async () => {
if (!await GBUtil.exists('dist')) {
console.log(`\n`);
console.log(`General Bots: Compiling...`);
exec(path.join(__dirname, 'node_modules/.bin/tsc'), async (err, stdout, stderr) => {
if (err) {
console.error(err);
return;
}
await run();
});
} else {
await run();
}
};
// Installing modules if it has not been done yet.
if (!await GBUtil.exists('node_modules')) {
console.log(`\n`);
console.log(`General Bots: Installing modules for the first time, please wait...`);
exec('npm install', async (err, stdout, stderr) => {
if (err) {
console.error(err);
return;
}
await processDist();
});
} else {
await processDist();
}
} catch (e) {
console.log(e);
}

View file

@ -115,7 +115,7 @@ IF EXIST "%DEPLOYMENT_TARGET%\deploy\default.gbui\package.json" (
popd
)
:: 4. Install TypeScript
:: 4. Install typescript
echo [General Bots Deployer] Transpiling...
call :ExecuteCmd node %DEPLOYMENT_TARGET%\node_modules\typescript\bin\tsc -v
call :ExecuteCmd node %DEPLOYMENT_TARGET%\node_modules\typescript\bin\tsc -p "%DEPLOYMENT_TARGET%"

View file

@ -1,96 +0,0 @@
#!/bin/bash
# ------------------------
# General Bots deployment.
# ------------------------
# Helpers
# -------
exitWithMessageOnError () {
if [ ! $? -eq 0 ]; then
echo "[General Bots Deployer]An error has occurred during web site deployment."
echo $1
exit 1
fi
}
# Prerequisites
# -------------
# Verify node.js installed
hash node 2>/dev/null
exitWithMessageOnError "Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment."
# Setup
# -----
SCRIPT_DIR="${BASH_SOURCE[0]%\\*}"
SCRIPT_DIR="${SCRIPT_DIR%/*}"
ARTIFACTS=$SCRIPT_DIR/../artifacts
KUDU_SYNC_CMD=${KUDU_SYNC_CMD//\"}
if [[ ! -n "$DEPLOYMENT_SOURCE" ]]; then
DEPLOYMENT_SOURCE=$SCRIPT_DIR
fi
if [[ ! -n "$NEXT_MANIFEST_PATH" ]]; then
NEXT_MANIFEST_PATH=$ARTIFACTS/manifest
if [[ ! -n "$PREVIOUS_MANIFEST_PATH" ]]; then
PREVIOUS_MANIFEST_PATH=$NEXT_MANIFEST_PATH
fi
fi
if [[ ! -n "$DEPLOYMENT_TARGET" ]]; then
DEPLOYMENT_TARGET=$ARTIFACTS/wwwroot
else
KUDU_SERVICE=true
fi
if [[ ! -n "$KUDU_SYNC_CMD" ]]; then
# Install kudu sync
echo Installing Kudu Sync
npm install kudusync -g --silent
exitWithMessageOnError "npm failed"
if [[ ! -n "$KUDU_SERVICE" ]]; then
# In case we are running locally this is the correct location of kuduSync
KUDU_SYNC_CMD=kuduSync
else
# In case we are running on kudu service this is the correct location of kuduSync
KUDU_SYNC_CMD=$APPDATA/npm/node_modules/kuduSync/bin/kuduSync
fi
fi
##################################################################################################################################
# Deployment
# ----------
# 1. Install npm packages
if [ -e "$DEPLOYMENT_SOURCE/package.json" ]; then
echo "[General Bots Deployer] Running npm install..."
cd "$DEPLOYMENT_SOURCE"
eval npm install
echo "[General Bots Deployer] OK."
exitWithMessageOnError "npm failed"
cd - > /dev/null
fi
# 2. Install TypeScript
echo "[General Bots Deployer] Transpiling..."
eval ./node_modules/typescript/bin/tsc -v
eval ./node_modules/typescript/bin/tsc -p "$DEPLOYMENT_SOURCE"
echo "[General Bots Deployer] OK."
# 4. KuduSync
if [[ "$IN_PLACE_DEPLOYMENT" -ne "1" ]]; then
"$KUDU_SYNC_CMD" -v 50 -f "$DEPLOYMENT_SOURCE" -t "$DEPLOYMENT_TARGET" -n "$NEXT_MANIFEST_PATH" -p "$PREVIOUS_MANIFEST_PATH" -i ".git;.hg;.deployment;deploy.sh"
exitWithMessageOnError "Kudu Sync failed"
fi
##################################################################################################################################
echo "[General Bots Deployer] Finished successfully."

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 KiB

After

Width:  |  Height:  |  Size: 280 KiB

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,260 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>GBServer | General Bots Open Core</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">General Bots Open Core</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
<input type="checkbox" id="tsd-filter-only-exported" />
<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../globals.html">Globals</a>
</li>
<li>
<a href="../modules/_src_app_.html">&quot;src/app&quot;</a>
</li>
<li>
<a href="_src_app_.gbserver.html">GBServer</a>
</li>
</ul>
<h1>Class GBServer</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>General Bots open-core entry point.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">GBServer</span>
</li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="_src_app_.gbserver.html#globals" class="tsd-kind-icon">globals</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_src_app_.gbserver.html#run" class="tsd-kind-icon">run</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-static">
<a name="globals" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagStatic">Static</span> globals</h3>
<div class="tsd-signature tsd-kind-icon">globals<span class="tsd-signature-symbol">:</span> <a href="_src_app_.rootdata.html" class="tsd-signature-type">RootData</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/GeneralBots/BotServer/blob/163be94/src/app.ts#L74">src/app.ts:74</a></li>
</ul>
</aside>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
<a name="run" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagStatic">Static</span> run</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
<li class="tsd-signature tsd-kind-icon">run<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/GeneralBots/BotServer/blob/163be94/src/app.ts#L80">src/app.ts:80</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p> Program entry-point.</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="globals ">
<a href="../globals.html"><em>Globals</em></a>
</li>
<li class="current tsd-kind-external-module">
<a href="../modules/_src_app_.html">&quot;src/app&quot;</a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
</ul>
<ul class="current">
<li class="current tsd-kind-class tsd-parent-kind-external-module">
<a href="_src_app_.gbserver.html" class="tsd-kind-icon">GBServer</a>
<ul>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-static">
<a href="_src_app_.gbserver.html#globals" class="tsd-kind-icon">globals</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
<a href="_src_app_.gbserver.html#run" class="tsd-kind-icon">run</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
<li class=" tsd-kind-class tsd-parent-kind-external-module">
<a href="_src_app_.rootdata.html" class="tsd-kind-icon">Root<wbr>Data</a>
</li>
<li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a href="../modules/_src_app_.html#path" class="tsd-kind-icon">Path</a>
</li>
<li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a href="../modules/_src_app_.html#bodyparser" class="tsd-kind-icon">body<wbr>Parser</a>
</li>
<li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a href="../modules/_src_app_.html#express" class="tsd-kind-icon">express</a>
</li>
<li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a href="../modules/_src_app_.html#mkdirp" class="tsd-kind-icon">mkdirp</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
<li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
<li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
<li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
<li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li>
<li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
<li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script>
</body>
</html>

351
docs/reference/globals.html Normal file
View file

@ -0,0 +1,351 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>General Bots Open Core</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="assets/js/search.js" data-base=".">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="index.html" class="title">General Bots Open Core</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
<input type="checkbox" id="tsd-filter-only-exported" />
<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="globals.html">Globals</a>
</li>
</ul>
<h1> General Bots Open Core</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>External modules</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_admin_gbapp_dialogs_admindialog_.html" class="tsd-kind-icon">&quot;packages/admin.gbapp/dialogs/<wbr>Admin<wbr>Dialog&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_admin_gbapp_index_.html" class="tsd-kind-icon">&quot;packages/admin.gbapp/index&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_admin_gbapp_models_adminmodel_.html" class="tsd-kind-icon">&quot;packages/admin.gbapp/models/<wbr>Admin<wbr>Model&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_admin_gbapp_services_gbadminservice_.html" class="tsd-kind-icon">&quot;packages/admin.gbapp/services/GBAdmin<wbr>Service&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_admin_gbapp_strings_.html" class="tsd-kind-icon">&quot;packages/admin.gbapp/strings&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_analytics_gblib_index_.html" class="tsd-kind-icon">&quot;packages/analytics.gblib/index&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_analytics_gblib_models_index_.html" class="tsd-kind-icon">&quot;packages/analytics.gblib/models/index&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_azuredeployer_gbapp_dialogs_startdialog_.html" class="tsd-kind-icon">&quot;packages/azuredeployer.gbapp/dialogs/<wbr>Start<wbr>Dialog&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_azuredeployer_gbapp_index_.html" class="tsd-kind-icon">&quot;packages/azuredeployer.gbapp/index&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_azuredeployer_gbapp_services_azuredeployerservice_.html" class="tsd-kind-icon">&quot;packages/azuredeployer.gbapp/services/<wbr>Azure<wbr>Deployer<wbr>Service&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_dialogs_switchbot_.html" class="tsd-kind-icon">&quot;packages/core.gbapp/dialogs/<wbr>Switch<wbr>Bot&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_dialogs_welcomedialog_.html" class="tsd-kind-icon">&quot;packages/core.gbapp/dialogs/<wbr>Welcome<wbr>Dialog&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_dialogs_whoamidialog_.html" class="tsd-kind-icon">&quot;packages/core.gbapp/dialogs/<wbr>Who<wbr>AmIDialog&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_index_.html" class="tsd-kind-icon">&quot;packages/core.gbapp/index&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_models_gbmodel_.html" class="tsd-kind-icon">&quot;packages/core.gbapp/models/GBModel&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbapiservice_.html" class="tsd-kind-icon">&quot;packages/core.gbapp/services/GBAPIService&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbconfigservice_.html" class="tsd-kind-icon">&quot;packages/core.gbapp/services/GBConfig<wbr>Service&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbconversationalservice_.html" class="tsd-kind-icon">&quot;packages/core.gbapp/services/GBConversational<wbr>Service&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbcoreservice_.html" class="tsd-kind-icon">&quot;packages/core.gbapp/services/GBCore<wbr>Service&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbdeployer_.html" class="tsd-kind-icon">&quot;packages/core.gbapp/services/GBDeployer&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbimporterservice_.html" class="tsd-kind-icon">&quot;packages/core.gbapp/services/GBImporter<wbr>Service&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbminservice_.html" class="tsd-kind-icon">&quot;packages/core.gbapp/services/GBMin<wbr>Service&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbvmservice_.html" class="tsd-kind-icon">&quot;packages/core.gbapp/services/GBVMService&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_tscompiler_.html" class="tsd-kind-icon">&quot;packages/core.gbapp/services/TSCompiler&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_strings_.html" class="tsd-kind-icon">&quot;packages/core.gbapp/strings&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_customer_satisfaction_gbapp_dialogs_feedbackdialog_.html" class="tsd-kind-icon">&quot;packages/customer-<wbr>satisfaction.gbapp/dialogs/<wbr>Feedback<wbr>Dialog&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_customer_satisfaction_gbapp_dialogs_qualitydialog_.html" class="tsd-kind-icon">&quot;packages/customer-<wbr>satisfaction.gbapp/dialogs/<wbr>Quality<wbr>Dialog&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_customer_satisfaction_gbapp_index_.html" class="tsd-kind-icon">&quot;packages/customer-<wbr>satisfaction.gbapp/index&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_customer_satisfaction_gbapp_models_index_.html" class="tsd-kind-icon">&quot;packages/customer-<wbr>satisfaction.gbapp/models/index&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_customer_satisfaction_gbapp_services_csservice_.html" class="tsd-kind-icon">&quot;packages/customer-<wbr>satisfaction.gbapp/services/CSService&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_customer_satisfaction_gbapp_strings_.html" class="tsd-kind-icon">&quot;packages/customer-<wbr>satisfaction.gbapp/strings&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_kb_gbapp_dialogs_askdialog_.html" class="tsd-kind-icon">&quot;packages/kb.gbapp/dialogs/<wbr>Ask<wbr>Dialog&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_kb_gbapp_dialogs_faqdialog_.html" class="tsd-kind-icon">&quot;packages/kb.gbapp/dialogs/<wbr>Faq<wbr>Dialog&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_kb_gbapp_dialogs_menudialog_.html" class="tsd-kind-icon">&quot;packages/kb.gbapp/dialogs/<wbr>Menu<wbr>Dialog&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_kb_gbapp_index_.html" class="tsd-kind-icon">&quot;packages/kb.gbapp/index&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_kb_gbapp_models_index_.html" class="tsd-kind-icon">&quot;packages/kb.gbapp/models/index&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_kb_gbapp_services_kbservice_.html" class="tsd-kind-icon">&quot;packages/kb.gbapp/services/KBService&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_kb_gbapp_strings_.html" class="tsd-kind-icon">&quot;packages/kb.gbapp/strings&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_security_gblib_index_.html" class="tsd-kind-icon">&quot;packages/security.gblib/index&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_security_gblib_models_index_.html" class="tsd-kind-icon">&quot;packages/security.gblib/models/index&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_security_gblib_services_secservice_.html" class="tsd-kind-icon">&quot;packages/security.gblib/services/<wbr>Sec<wbr>Service&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_sharepoint_gblib_index_.html" class="tsd-kind-icon">&quot;packages/sharepoint.gblib/index&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_sharepoint_gblib_services_sharepointservice_.html" class="tsd-kind-icon">&quot;packages/sharepoint.gblib/services/<wbr>Share<wbr>Point<wbr>Service&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_whatsapp_gblib_index_.html" class="tsd-kind-icon">&quot;packages/whatsapp.gblib/index&quot;</a></li>
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_whatsapp_gblib_services_whatsappdirectline_.html" class="tsd-kind-icon">&quot;packages/whatsapp.gblib/services/<wbr>Whatsapp<wbr>Direct<wbr>Line&quot;</a></li>
<li class="tsd-kind-external-module"><a href="modules/_src_app_.html" class="tsd-kind-icon">&quot;src/app&quot;</a></li>
</ul>
</section>
</div>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="globals current ">
<a href="globals.html"><em>Globals</em></a>
</li>
<li class="label tsd-is-external">
<span>Internals</span>
</li>
<li class=" tsd-kind-external-module">
<a href="modules/_src_app_.html">&quot;src/app&quot;</a>
</li>
<li class="label tsd-is-external">
<span>Externals</span>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_admin_gbapp_dialogs_admindialog_.html">&quot;packages/admin.gbapp/dialogs/<wbr>Admin<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_admin_gbapp_index_.html">&quot;packages/admin.gbapp/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_admin_gbapp_models_adminmodel_.html">&quot;packages/admin.gbapp/models/<wbr>Admin<wbr>Model&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_admin_gbapp_services_gbadminservice_.html">&quot;packages/admin.gbapp/services/GBAdmin<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_admin_gbapp_strings_.html">&quot;packages/admin.gbapp/strings&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_analytics_gblib_index_.html">&quot;packages/analytics.gblib/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_analytics_gblib_models_index_.html">&quot;packages/analytics.gblib/models/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_azuredeployer_gbapp_dialogs_startdialog_.html">&quot;packages/azuredeployer.gbapp/dialogs/<wbr>Start<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_azuredeployer_gbapp_index_.html">&quot;packages/azuredeployer.gbapp/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_azuredeployer_gbapp_services_azuredeployerservice_.html">&quot;packages/azuredeployer.gbapp/services/<wbr>Azure<wbr>Deployer<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_dialogs_switchbot_.html">&quot;packages/core.gbapp/dialogs/<wbr>Switch<wbr>Bot&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_dialogs_welcomedialog_.html">&quot;packages/core.gbapp/dialogs/<wbr>Welcome<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_dialogs_whoamidialog_.html">&quot;packages/core.gbapp/dialogs/<wbr>Who<wbr>AmIDialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_index_.html">&quot;packages/core.gbapp/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_models_gbmodel_.html">&quot;packages/core.gbapp/models/GBModel&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbapiservice_.html">&quot;packages/core.gbapp/services/GBAPIService&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbconfigservice_.html">&quot;packages/core.gbapp/services/GBConfig<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbconversationalservice_.html">&quot;packages/core.gbapp/services/GBConversational<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbcoreservice_.html">&quot;packages/core.gbapp/services/GBCore<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbdeployer_.html">&quot;packages/core.gbapp/services/GBDeployer&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbimporterservice_.html">&quot;packages/core.gbapp/services/GBImporter<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbminservice_.html">&quot;packages/core.gbapp/services/GBMin<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbvmservice_.html">&quot;packages/core.gbapp/services/GBVMService&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_tscompiler_.html">&quot;packages/core.gbapp/services/TSCompiler&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_strings_.html">&quot;packages/core.gbapp/strings&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_customer_satisfaction_gbapp_dialogs_feedbackdialog_.html">&quot;packages/customer-<wbr>satisfaction.gbapp/dialogs/<wbr>Feedback<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_customer_satisfaction_gbapp_dialogs_qualitydialog_.html">&quot;packages/customer-<wbr>satisfaction.gbapp/dialogs/<wbr>Quality<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_customer_satisfaction_gbapp_index_.html">&quot;packages/customer-<wbr>satisfaction.gbapp/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_customer_satisfaction_gbapp_models_index_.html">&quot;packages/customer-<wbr>satisfaction.gbapp/models/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_customer_satisfaction_gbapp_services_csservice_.html">&quot;packages/customer-<wbr>satisfaction.gbapp/services/CSService&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_customer_satisfaction_gbapp_strings_.html">&quot;packages/customer-<wbr>satisfaction.gbapp/strings&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_kb_gbapp_dialogs_askdialog_.html">&quot;packages/kb.gbapp/dialogs/<wbr>Ask<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_kb_gbapp_dialogs_faqdialog_.html">&quot;packages/kb.gbapp/dialogs/<wbr>Faq<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_kb_gbapp_dialogs_menudialog_.html">&quot;packages/kb.gbapp/dialogs/<wbr>Menu<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_kb_gbapp_index_.html">&quot;packages/kb.gbapp/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_kb_gbapp_models_index_.html">&quot;packages/kb.gbapp/models/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_kb_gbapp_services_kbservice_.html">&quot;packages/kb.gbapp/services/KBService&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_kb_gbapp_strings_.html">&quot;packages/kb.gbapp/strings&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_security_gblib_index_.html">&quot;packages/security.gblib/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_security_gblib_models_index_.html">&quot;packages/security.gblib/models/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_security_gblib_services_secservice_.html">&quot;packages/security.gblib/services/<wbr>Sec<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_sharepoint_gblib_index_.html">&quot;packages/sharepoint.gblib/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_sharepoint_gblib_services_sharepointservice_.html">&quot;packages/sharepoint.gblib/services/<wbr>Share<wbr>Point<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_whatsapp_gblib_index_.html">&quot;packages/whatsapp.gblib/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_whatsapp_gblib_services_whatsappdirectline_.html">&quot;packages/whatsapp.gblib/services/<wbr>Whatsapp<wbr>Direct<wbr>Line&quot;</a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
<li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
<li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
<li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
<li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li>
<li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
<li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="assets/js/search.js"><' + '/script>');</script>
</body>
</html>

View file

@ -4,17 +4,16 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>General Bots Open Core</title>
<meta name="description" content="Documentation for General Bots Open Core">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/main.css">
<script async src="assets/js/search.js" id="search-script"></script>
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="assets/js/search.json" data-base=".">
<div class="table-cell" id="tsd-search" data-index="assets/js/search.js" data-base=".">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
@ -41,6 +40,8 @@
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
<input type="checkbox" id="tsd-filter-only-exported" />
<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
@ -50,7 +51,12 @@
</div>
<div class="tsd-page-title">
<div class="container">
<h1>General Bots Open Core</h1>
<ul class="tsd-breadcrumb">
<li>
<a href="globals.html">Globals</a>
</li>
</ul>
<h1> General Bots Open Core</h1>
</div>
</div>
</header>
@ -58,132 +64,163 @@
<div class="row">
<div class="col-8 col-content">
<div class="tsd-panel tsd-typography">
<table>
<thead>
<tr>
<th>Area</th>
<th>Status</th>
</tr>
</thead>
<tbody><tr>
<td>Releases</td>
<td><a href="https://www.npmjs.com/package/botserver/"><img src="https://img.shields.io/npm/dt/botserver.svg?logo=npm&label=botserver" alt="General Bots"></a> <a href="https://www.npmjs.com/package/botlib/"><img src="https://img.shields.io/npm/dt/botlib.svg?logo=npm&label=botlib" alt=".gbapp lib"></a> <a href="https://github.com/semantic-release/semantic-release"><img src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg" alt="semantic-release"></a></td>
</tr>
<tr>
<td>Community</td>
<td><a href="https://stackoverflow.com/questions/tagged/generalbots"><img src="https://img.shields.io/stackexchange/stackoverflow/t/generalbots.svg" alt="StackExchange"></a> <a href="https://badges.frapsoft.com"><img src="https://badges.frapsoft.com/os/v2/open-source.svg" alt="Open-source"></a> <a href="http://makeapullrequest.com"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" alt="PRs Welcome"></a> <a href="https://github.com/GeneralBots/BotServer/blob/master/LICENSE.txt"><img src="https://img.shields.io/badge/license-AGPL-blue.svg" alt="License"></a></td>
</tr>
<tr>
<td>Management</td>
<td><a href="https://gitHub.com/GeneralBots/BotServer/graphs/commit-activity"><img src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" alt="Maintenance"></a></td>
</tr>
<tr>
<td>Security</td>
<td><a href="https://snyk.io/test/github/GeneralBots/BotServer"><img src="https://snyk.io/test/github/GeneralBots/BotServer/badge.svg" alt="Known Vulnerabilities"></a></td>
</tr>
<tr>
<td>Building &amp; Quality</td>
<td><a href="https://travis-ci.com/GeneralBots/BotServer"><img src="https://travis-ci.com/GeneralBots/BotServer.svg?branch=master" alt="Build Status"></a> <a href="https://coveralls.io/github/GeneralBots/BotServer"><img src="https://coveralls.io/repos/github/GeneralBots/BotServer/badge.svg" alt="Coverage Status"></a> <a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square" alt="code style: prettier"></a></td>
</tr>
<tr>
<td>Packaging</td>
<td><a href="https://badge.fury.io"><img src="https://badge.fury.io/js/botserver.svg" alt="forthebadge"></a> <a href="https://github.com/GeneralBots/BotServer/releases/latest"><img src="https://camo.githubusercontent.com/0150c0f148d50fe9750ebc5d313581da699a8c50/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7a69702d646f776e6c6f61642d626c75652e737667" alt="ZipFile"></a> <a href="https://david-dm.org"><img src="https://david-dm.org/GeneralBots/botserver.svg" alt="Dependencies"></a> <a href="http://commitizen.github.io/cz-cli/"><img src="https://img.shields.io/badge/commitizen-friendly-brightgreen.svg" alt="Commitizen friendly"></a></td>
</tr>
<tr>
<td>Samples</td>
<td><a href="https://github.com/GeneralBots/BotServer/tree/master/packages/default.gbdialog">VBA</a> or <a href="https://github.com/GeneralBots/AzureADPasswordReset.gbapp"><img src="https://badges.frapsoft.com/typescript/code/typescript.svg?v=101" alt="TypeScript"></a></td>
</tr>
<tr>
<td><a href="https://github.com/lpicanco/docker-botserver">Docker Image</a></td>
<td><img src="https://img.shields.io/docker/automated/lpicanco/botserver.svg" alt="Docker Automated build"> <img src="https://img.shields.io/docker/build/lpicanco/botserver.svg" alt="Docker Build Status"> <img src="https://img.shields.io/microbadger/image-size/lpicanco/botserver.svg" alt="MicroBadger Size"> <img src="https://img.shields.io/microbadger/layers/lpicanco/botserver.svg" alt="MicroBadger Layers"> <img src="https://img.shields.io/docker/pulls/lpicanco/botserver.svg" alt="Docker Pulls"> <br/> <em>Provided by <a href="https://github.com/lpicanco/docker-botserver">@lpicanco</a></em></td>
</tr>
</tbody></table>
<a href="#general-bots" id="general-bots" style="color: inherit; text-decoration: none;">
<h2>General Bots</h2>
</a>
<p><img src="https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/logo.png" alt="General Bot Logo"></p>
<p>General Bot is a strongly typed package based chat bot server focused in convention over configuration and code-less approaches, which brings software packages and application server concepts to help parallel bot development.</p>
<a href="#what-is-a-bot-server" id="what-is-a-bot-server" style="color: inherit; text-decoration: none;">
<h2>What is a Bot Server?</h2>
</a>
<p>Bot Server accelerates the process of developing a bot. It provisions all code
base, resources and deployment to the cloud, and gives you templates you can
choose from whenever you need a new bot. The server has a database and service
backend allowing you to further modify your bot package directly by downloading
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.</p>
<p>Everyone can create bots by just copying and pasting some files and using their
favorite tools from Office (or any text editor) or Photoshop (or any image
editor). BASIC can be used to build custom dialogs so Bot can be extended just like VBA for Excel (currently in alpha).</p>
<p><img src="https://raw.githubusercontent.com/GeneralBots/BotBook/master/images/general-bots-reference-architecture.png" alt="General Bot Reference Architecture"></p>
<a href="#samples" id="samples" style="color: inherit; text-decoration: none;">
<h2>Samples</h2>
</a>
<p>Several samples, including a Bot for AD Password Reset, are avaiable on the <a href="https://github.com/GeneralBots">repository list</a>.</p>
<a href="#guide" id="guide" style="color: inherit; text-decoration: none;">
<h2>Guide</h2>
</a>
<p><a href="https://github.com/GeneralBots/BotBook/tree/master/book">Read the General Bots BotBook Guide</a>.</p>
<a href="#videos" id="videos" style="color: inherit; text-decoration: none;">
<h1>Videos</h1>
</a>
<p>Now with the General Bots server you can press F5 on Visual Studio to get a bot factory on your environment* published on November 10th, 2018.</p>
<p><a href="https://www.youtube.com/watch?v=AfKTwljoMOs"><img src="https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/video-01-thumb.jpg" alt="General Bot Video"></a></p>
<p>See how easy is to use &#39;hear&#39; and &#39;talk&#39; to build Microsoft BOT Framework v4 logic with plain BASIC * published on December 3rd, 2018.</p>
<p><a href="https://www.youtube.com/watch?v=yX1sF9n9628"><img src="https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/video-02-thumb.jpg" alt="See how easy is to use &#39;hear&#39; and &#39;talk&#39; to build Microsoft BOT Framework v4 logic with plain BASIC"></a></p>
<a href="#contributing" id="contributing" style="color: inherit; text-decoration: none;">
<h1>Contributing</h1>
</a>
<p>This project welcomes contributions and suggestions.
See our <a href="https://github.com/pragmatismo-io/BotServer/blob/master/CONTRIBUTING.md">Contribution Guidelines</a> for more details.</p>
<a href="#reporting-security-issues" id="reporting-security-issues" style="color: inherit; text-decoration: none;">
<h1>Reporting Security Issues</h1>
</a>
<p>Security issues and bugs should be reported privately, via email, to the Pragmatismo.io Security
team at <a href="mailto:security@pragmatismo.io">security@pragmatismo.io</a>. You should
receive a response within 24 hours. If for some reason you do not, please follow up via
email to ensure we received your original message. </p>
<a href="#license-amp-warranty" id="license-amp-warranty" style="color: inherit; text-decoration: none;">
<h1>License &amp; Warranty</h1>
</a>
<p>General Bot Copyright (c) Pragmatismo.io. All rights reserved.
Licensed under the AGPL-3.0. </p>
<p>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. </p>
<p>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.</p>
<p>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.</p>
<p>&quot;General Bot&quot; 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.</p>
<p><a href="https://stackoverflow.com/questions/ask?tags=generalbots">:speech_balloon: Ask a question</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://github.com/GeneralBots/BotBook">:book: Read the Docs</a></p>
<p>General Bots Code Name is <a href="https://en.wikipedia.org/wiki/Guaribas">Guaribas</a>, the name of a city in Brazil, state of Piaui.
<a href="http://www.robertounger.com/en/">Roberto Mangabeira Unger</a>: &quot;No one should have to do work that can be done by a machine&quot;.</p>
<p><em>This is a General Bots open core package, more information can be found on the <a href="https://github.com/pragmatismo-io/BotServer">BotServer</a> repository.</em></p>
</div>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class=" ">
<a href="modules.html">Exports</a>
<li class="globals ">
<a href="globals.html"><em>Globals</em></a>
</li>
<li class="label tsd-is-external">
<span>Internals</span>
</li>
<li class=" tsd-kind-external-module">
<a href="modules/_src_app_.html">&quot;src/app&quot;</a>
</li>
<li class="label tsd-is-external">
<span>Externals</span>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_admin_gbapp_dialogs_admindialog_.html">&quot;packages/admin.gbapp/dialogs/<wbr>Admin<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_admin_gbapp_index_.html">&quot;packages/admin.gbapp/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_admin_gbapp_models_adminmodel_.html">&quot;packages/admin.gbapp/models/<wbr>Admin<wbr>Model&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_admin_gbapp_services_gbadminservice_.html">&quot;packages/admin.gbapp/services/GBAdmin<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_admin_gbapp_strings_.html">&quot;packages/admin.gbapp/strings&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_analytics_gblib_index_.html">&quot;packages/analytics.gblib/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_analytics_gblib_models_index_.html">&quot;packages/analytics.gblib/models/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_azuredeployer_gbapp_dialogs_startdialog_.html">&quot;packages/azuredeployer.gbapp/dialogs/<wbr>Start<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_azuredeployer_gbapp_index_.html">&quot;packages/azuredeployer.gbapp/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_azuredeployer_gbapp_services_azuredeployerservice_.html">&quot;packages/azuredeployer.gbapp/services/<wbr>Azure<wbr>Deployer<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_dialogs_switchbot_.html">&quot;packages/core.gbapp/dialogs/<wbr>Switch<wbr>Bot&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_dialogs_welcomedialog_.html">&quot;packages/core.gbapp/dialogs/<wbr>Welcome<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_dialogs_whoamidialog_.html">&quot;packages/core.gbapp/dialogs/<wbr>Who<wbr>AmIDialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_index_.html">&quot;packages/core.gbapp/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_models_gbmodel_.html">&quot;packages/core.gbapp/models/GBModel&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbapiservice_.html">&quot;packages/core.gbapp/services/GBAPIService&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbconfigservice_.html">&quot;packages/core.gbapp/services/GBConfig<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbconversationalservice_.html">&quot;packages/core.gbapp/services/GBConversational<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbcoreservice_.html">&quot;packages/core.gbapp/services/GBCore<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbdeployer_.html">&quot;packages/core.gbapp/services/GBDeployer&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbimporterservice_.html">&quot;packages/core.gbapp/services/GBImporter<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbminservice_.html">&quot;packages/core.gbapp/services/GBMin<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_gbvmservice_.html">&quot;packages/core.gbapp/services/GBVMService&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_services_tscompiler_.html">&quot;packages/core.gbapp/services/TSCompiler&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_core_gbapp_strings_.html">&quot;packages/core.gbapp/strings&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_customer_satisfaction_gbapp_dialogs_feedbackdialog_.html">&quot;packages/customer-<wbr>satisfaction.gbapp/dialogs/<wbr>Feedback<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_customer_satisfaction_gbapp_dialogs_qualitydialog_.html">&quot;packages/customer-<wbr>satisfaction.gbapp/dialogs/<wbr>Quality<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_customer_satisfaction_gbapp_index_.html">&quot;packages/customer-<wbr>satisfaction.gbapp/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_customer_satisfaction_gbapp_models_index_.html">&quot;packages/customer-<wbr>satisfaction.gbapp/models/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_customer_satisfaction_gbapp_services_csservice_.html">&quot;packages/customer-<wbr>satisfaction.gbapp/services/CSService&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_customer_satisfaction_gbapp_strings_.html">&quot;packages/customer-<wbr>satisfaction.gbapp/strings&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_kb_gbapp_dialogs_askdialog_.html">&quot;packages/kb.gbapp/dialogs/<wbr>Ask<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_kb_gbapp_dialogs_faqdialog_.html">&quot;packages/kb.gbapp/dialogs/<wbr>Faq<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_kb_gbapp_dialogs_menudialog_.html">&quot;packages/kb.gbapp/dialogs/<wbr>Menu<wbr>Dialog&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_kb_gbapp_index_.html">&quot;packages/kb.gbapp/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_kb_gbapp_models_index_.html">&quot;packages/kb.gbapp/models/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_kb_gbapp_services_kbservice_.html">&quot;packages/kb.gbapp/services/KBService&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_kb_gbapp_strings_.html">&quot;packages/kb.gbapp/strings&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_security_gblib_index_.html">&quot;packages/security.gblib/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_security_gblib_models_index_.html">&quot;packages/security.gblib/models/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_security_gblib_services_secservice_.html">&quot;packages/security.gblib/services/<wbr>Sec<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_sharepoint_gblib_index_.html">&quot;packages/sharepoint.gblib/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_sharepoint_gblib_services_sharepointservice_.html">&quot;packages/sharepoint.gblib/services/<wbr>Share<wbr>Point<wbr>Service&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_whatsapp_gblib_index_.html">&quot;packages/whatsapp.gblib/index&quot;</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="modules/_packages_whatsapp_gblib_services_whatsappdirectline_.html">&quot;packages/whatsapp.gblib/services/<wbr>Whatsapp<wbr>Direct<wbr>Line&quot;</a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
<li class=" tsd-kind-class">
<a href="classes/gbserver.html" class="tsd-kind-icon">GBServer</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/rootdata.html" class="tsd-kind-icon">Root<wbr>Data</a>
</li>
</ul>
</nav>
</div>
@ -194,12 +231,57 @@
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
<li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
<li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
<li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
<li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li>
<li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
<li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</div>
@ -209,5 +291,6 @@
</div>
<div class="overlay"></div>
<script src="assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="assets/js/search.js"><' + '/script>');</script>
</body>
</html>

View file

@ -0,0 +1,275 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>&quot;src/app&quot; | General Bots Open Core</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">General Bots Open Core</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
<input type="checkbox" id="tsd-filter-only-exported" />
<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../globals.html">Globals</a>
</li>
<li>
<a href="_src_app_.html">&quot;src/app&quot;</a>
</li>
</ul>
<h1>External module &quot;src/app&quot;</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
<div class="lead">
<p><br>| ( )_ _ |
| _ _ _ <em>_ _ _ __ <strong>_ _</strong> _ _ | ,</em>)(<em>) <strong>_ _</strong> _ |
| ( &#39;<em>`\ ( &#39;_</em>)/&#39;_` ) /&#39;</em> <code>\/&#39; _</code> _ <code>\ /&#39;_</code> )| | | |/&#39;,<strong>)/&#39; _ <code>\ /&#39;_</code>\ |
| | (<em>) )| | ( (</em>| |( (<em>) || ( ) ( ) |( (</em>| || |_ | |\</strong>, | (˅) |( (<em>) ) |
| | ,__/&#39;(</em>) <code>\__,_)</code>__ |(<em>) (</em>) (<em>)`__,</em>)<code>\__)(_)(____/(_) (_)</code>_<strong>/&#39; |
| | | ( )<em>) | |
| (</em>) _</strong>/&#39; |
| |
| 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. |
| |
| &quot;General Bots&quot; 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. |
| |
\</p>
</div>
</div>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Classes</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-class tsd-parent-kind-external-module"><a href="../classes/_src_app_.gbserver.html" class="tsd-kind-icon">GBServer</a></li>
<li class="tsd-kind-class tsd-parent-kind-external-module"><a href="../classes/_src_app_.rootdata.html" class="tsd-kind-icon">Root<wbr>Data</a></li>
</ul>
</section>
<section class="tsd-index-section tsd-is-not-exported">
<h3>Variables</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"><a href="_src_app_.html#path" class="tsd-kind-icon">Path</a></li>
<li class="tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"><a href="_src_app_.html#bodyparser" class="tsd-kind-icon">body<wbr>Parser</a></li>
<li class="tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"><a href="_src_app_.html#express" class="tsd-kind-icon">express</a></li>
<li class="tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"><a href="_src_app_.html#mkdirp" class="tsd-kind-icon">mkdirp</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-not-exported">
<h2>Variables</h2>
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a name="path" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagLet">Let</span> Path</h3>
<div class="tsd-signature tsd-kind-icon">Path<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> =&nbsp;require(&#x27;path&#x27;)</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/GeneralBots/BotServer/blob/163be94/src/app.ts#L43">src/app.ts:43</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a name="bodyparser" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagConst">Const</span> body<wbr>Parser</h3>
<div class="tsd-signature tsd-kind-icon">body<wbr>Parser<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> =&nbsp;require(&#x27;body-parser&#x27;)</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/GeneralBots/BotServer/blob/163be94/src/app.ts#L40">src/app.ts:40</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a name="express" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagConst">Const</span> express</h3>
<div class="tsd-signature tsd-kind-icon">express<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> =&nbsp;require(&#x27;express&#x27;)</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/GeneralBots/BotServer/blob/163be94/src/app.ts#L39">src/app.ts:39</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a name="mkdirp" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagLet">Let</span> mkdirp</h3>
<div class="tsd-signature tsd-kind-icon">mkdirp<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> =&nbsp;require(&#x27;mkdirp&#x27;)</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/GeneralBots/BotServer/blob/163be94/src/app.ts#L42">src/app.ts:42</a></li>
</ul>
</aside>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="globals ">
<a href="../globals.html"><em>Globals</em></a>
</li>
<li class="current tsd-kind-external-module">
<a href="_src_app_.html">&quot;src/app&quot;</a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
<li class=" tsd-kind-class tsd-parent-kind-external-module">
<a href="../classes/_src_app_.gbserver.html" class="tsd-kind-icon">GBServer</a>
</li>
<li class=" tsd-kind-class tsd-parent-kind-external-module">
<a href="../classes/_src_app_.rootdata.html" class="tsd-kind-icon">Root<wbr>Data</a>
</li>
<li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a href="_src_app_.html#path" class="tsd-kind-icon">Path</a>
</li>
<li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a href="_src_app_.html#bodyparser" class="tsd-kind-icon">body<wbr>Parser</a>
</li>
<li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a href="_src_app_.html#express" class="tsd-kind-icon">express</a>
</li>
<li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a href="_src_app_.html#mkdirp" class="tsd-kind-icon">mkdirp</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
<li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
<li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
<li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
<li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li>
<li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
<li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script>
</body>
</html>

View file

@ -1,382 +0,0 @@
[
{
"extension": "aac",
"description": "AAC audio",
"category": "Music"
},
{
"extension": "abw",
"description": "AbiWord document",
"category": "Document"
},
{
"extension": "arc",
"description": "Archive document (multiple files embedded)",
"category": "Document"
},
{
"extension": "avif",
"description": "AVIF image",
"category": "Image"
},
{
"extension": "avi",
"description": "AVI: Audio Video Interleave",
"category": "Movie"
},
{
"extension": "azw",
"description": "Amazon Kindle eBook format",
"category": "Document"
},
{
"extension": "bin",
"description": "Any kind of binary data",
"category": "Other"
},
{
"extension": "bmp",
"description": "Windows OS/2 Bitmap Graphics",
"category": "Image"
},
{
"extension": "bz",
"description": "BZip archive",
"category": "Other"
},
{
"extension": "bz2",
"description": "BZip2 archive",
"category": "Other"
},
{
"extension": "cda",
"description": "CD audio",
"category": "Music"
},
{
"extension": "csh",
"description": "C-Shell script",
"category": "Executable"
},
{
"extension": "css",
"description": "Cascading Style Sheets (CSS)",
"category": "Other"
},
{
"extension": "csv",
"description": "Comma-separated values (CSV)",
"category": "Document"
},
{
"extension": "doc",
"description": "Microsoft Word",
"category": "Document"
},
{
"extension": "docx",
"description": "Microsoft Word (OpenXML)",
"category": "Document"
},
{
"extension": "eot",
"description": "MS Embedded OpenType fonts",
"category": "Other"
},
{
"extension": "epub",
"description": "Electronic publication (EPUB)",
"category": "Document"
},
{
"extension": "gz",
"description": "GZip Compressed Archive",
"category": "Other"
},
{
"extension": "gif",
"description": "Graphics Interchange Format (GIF)",
"category": "Image"
},
{
"extension": "htm",
"description": "HyperText Markup Language (HTML)",
"category": "Other"
},
{
"extension": "html",
"description": "HyperText Markup Language (HTML)",
"category": "Other"
},
{
"extension": "ico",
"description": "Icon format",
"category": "Image"
},
{
"extension": "ics",
"description": "iCalendar format",
"category": "Document"
},
{
"extension": "jar",
"description": "Java Archive (JAR)",
"category": "Executable"
},
{
"extension": "jpeg",
"description": "JPEG images",
"category": "Image"
},
{
"extension": "jpg",
"description": "JPEG images",
"category": "Image"
},
{
"extension": "js",
"description": "JavaScript",
"category": "Other"
},
{
"extension": "json",
"description": "JSON format",
"category": "Other"
},
{
"extension": "jsonld",
"description": "JSON-LD format",
"category": "Other"
},
{
"extension": "mid",
"description": "Musical Instrument Digital Interface (MIDI)",
"category": "Music"
},
{
"extension": "midi",
"description": "Musical Instrument Digital Interface (MIDI)",
"category": "Music"
},
{
"extension": "mjs",
"description": "JavaScript module",
"category": "Other"
},
{
"extension": "mp3",
"description": "MP3 audio",
"category": "Music"
},
{
"extension": "mp4",
"description": "MP4 video",
"category": "Movie"
},
{
"extension": "mpeg",
"description": "MPEG Video",
"category": "Movie"
},
{
"extension": "mpkg",
"description": "Apple Installer Package",
"category": "Application"
},
{
"extension": "odp",
"description": "OpenDocument presentation document",
"category": "Presentation"
},
{
"extension": "ods",
"description": "OpenDocument spreadsheet document",
"category": "Document"
},
{
"extension": "odt",
"description": "OpenDocument text document",
"category": "Document"
},
{
"extension": "oga",
"description": "OGG audio",
"category": "Music"
},
{
"extension": "ogv",
"description": "OGG video",
"category": "Movie"
},
{
"extension": "ogx",
"description": "OGG",
"category": "Other"
},
{
"extension": "opus",
"description": "Opus audio",
"category": "Music"
},
{
"extension": "otf",
"description": "OpenType font",
"category": "Other"
},
{
"extension": "png",
"description": "Portable Network Graphics",
"category": "Image"
},
{
"extension": "pdf",
"description": "Adobe Portable Document Format (PDF)",
"category": "PDF"
},
{
"extension": "php",
"description": "Hypertext Preprocessor (Personal Home Page)",
"category": "Other"
},
{
"extension": "ppt",
"description": "Microsoft PowerPoint",
"category": "Presentation"
},
{
"extension": "pptx",
"description": "Microsoft PowerPoint (OpenXML)",
"category": "Presentation"
},
{
"extension": "rar",
"description": "RAR archive",
"category": "Other"
},
{
"extension": "rtf",
"description": "Rich Text Format (RTF)",
"category": "Document"
},
{
"extension": "sh",
"description": "Bourne shell script",
"category": "Executable"
},
{
"extension": "svg",
"description": "Scalable Vector Graphics (SVG)",
"category": "Image"
},
{
"extension": "tar",
"description": "Tape Archive (TAR)",
"category": "Other"
},
{
"extension": "tif",
"description": "Tagged Image File Format (TIFF)",
"category": "Image"
},
{
"extension": "tiff",
"description": "Tagged Image File Format (TIFF)",
"category": "Image"
},
{
"extension": "ts",
"description": "MPEG transport stream",
"category": "Movie"
},
{
"extension": "ttf",
"description": "TrueType Font",
"category": "Other"
},
{
"extension": "txt",
"description": "Text, (generally ASCII or ISO 8859-n)",
"category": "Text"
},
{
"extension": "vsd",
"description": "Microsoft Visio",
"category": "Application"
},
{
"extension": "wav",
"description": "Waveform Audio Format",
"category": "Music"
},
{
"extension": "weba",
"description": "WEBM audio",
"category": "Music"
},
{
"extension": "webm",
"description": "WEBM video",
"category": "Movie"
},
{
"extension": "webp",
"description": "WEBP image",
"category": "Image"
},
{
"extension": "woff",
"description": "Web Open Font Format (WOFF)",
"category": "Other"
},
{
"extension": "woff2",
"description": "Web Open Font Format (WOFF)",
"category": "Other"
},
{
"extension": "xhtml",
"description": "XHTML",
"category": "Other"
},
{
"extension": "xls",
"description": "Microsoft Excel",
"category": "Document"
},
{
"extension": "xlsx",
"description": "Microsoft Excel (OpenXML)",
"category": "Document"
},
{
"extension": "xml",
"description": "XML",
"category": "Document"
},
{
"extension": "xul",
"description": "XUL",
"category": "Application"
},
{
"extension": "zip",
"description": "ZIP archive",
"category": "Application"
},
{
"extension": "3gp",
"description": "3GPP audio/video container",
"category": "Movie"
},
{
"extension": "3g2",
"description": "3GPP2 audio/video container",
"category": "Movie"
},
{
"extension": "7z",
"description": "7-zip archive",
"category": "Application"
}
]

View file

@ -3,13 +3,13 @@
ECHO General Bots Command Line
IF EXIST node_modules goto COMPILE
ECHO Installing Packages for the first time use (it may take several minutes)...
ECHO Installing Packages for the first time use...
CALL npm install --silent
:COMPILE
IF EXIST dist goto ALLSET
ECHO Compiling...
npm run build
CALL node_modules\.bin\tsc
:ALLSET
npm run start
node boot.js

View file

@ -1,2 +0,0 @@
echo Starting General Bots...
npm run start

11
greenkeeper.json Normal file
View file

@ -0,0 +1,11 @@
{
"groups": {
"default": {
"packages": [
"package.json",
"packages/default.gbtheme/package.json",
"packages/default.gbui/package.json"
]
}
}
}

BIN
logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

66673
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,8 @@
{
"name": "botserver",
"version": "5.0.0",
"version": "2.0.113",
"description": "General Bot Community Edition open-core server.",
"main": "./boot.mjs",
"type": "module",
"main": "./boot.js",
"bugs": "https://github.com/pragmatismo-io/BotServer/issues",
"homepage": "https://github.com/pragmatismo-io/BotServer/#readme",
"contributors": [
@ -11,36 +10,29 @@
"João Ferreira <joao.parana@gmail.com>",
"Jorge Ramos <jramos@pobox.com>",
"PH <ph.an@outlook.com>",
"Dário Vieira <dario.junior3@gmail.com>",
"Alan Perdomo <alanperdomo@hotmail.com>"
"Dário Vieira <dario.junior3@gmail.com>"
],
"opencv4nodejs": {
"disableAutoBuild": "1"
},
"engines": {
"node": "=22.9.0"
"node": "=10.15.2"
},
"license": "AGPL-3.0",
"preferGlobal": true,
"private": false,
"bin": {
"gbot": "./boot.mjs"
"gbot": "./boot.js"
},
"readme": "README.md",
"repository": {
"type": "git",
"url": "https://github.com/GeneralBots/BotServer.git"
},
"scripts": {
"clean": "shx rm -rf node_modules/ dist/ docs/reference",
"tslint": "tslint --fix ./src/*.ts ./packages/**/*.ts -t verbose",
"build": "npm install && npm run build-server && npm run build-gbui",
"tslint": "tslint --fix ./src/*.ts ./packages/**/*.ts -t verbose -e ./packages/default.gbui/**/* -e ./packages/**/*.gbdialog/**/*",
"build": "npm install && npm run build-server && npm run build-gbui && npm run build-docs",
"build-server": "tsc",
"build-gbui": "cd packages/default.gbui && echo SKIP_PREFLIGHT_CHECK=true >.env && npm install && npm run build",
"build-docs": "typedoc --options typedoc.json src/",
"test": "vitest",
"start": "NODE_NO_WARNINGS=1 node ./boot.mjs --loader ts-node/esm --require ./suppress-node-warnings.cjs",
"debug": "NODE_NO_WARNINGS=1 node ./boot.mjs --loader ts-node/esm --require ./suppress-node-warnings.cjs --inspect",
"start": "node ./boot.js",
"reverse-proxy": "node_modules/.bin/ngrok http 4242",
"watch:build": "tsc --watch",
"posttypedoc": "shx cp .nojekyll docs/reference/.nojekyll",
@ -55,226 +47,90 @@
"semantic-release": "semantic-release",
"commit": "git-cz"
},
"jest": {
"workerIdleMemoryLimit": "4096MB",
"transform": {
".+\\.tsx?$": "ts-jest"
},
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json"
]
},
"dependencies": {
"@azure/arm-appservice": "15.0.0",
"@azure/arm-cognitiveservices": "7.5.0",
"@azure/arm-resources": "5.2.0",
"@azure/arm-search": "3.2.0",
"@azure/arm-sql": "10.0.0",
"@azure/arm-subscriptions": "5.1.0",
"@azure/cognitiveservices-computervision": "8.2.0",
"@azure/keyvault-keys": "4.8.0",
"@azure/ms-rest-js": "2.7.0",
"@azure/msal-node": "2.13.1",
"@azure/openai": "2.0.0-beta.1",
"@azure/search-documents": "12.1.0",
"@azure/storage-blob": "12.24.0",
"@google-cloud/pubsub": "4.7.0",
"@google-cloud/translate": "8.5.0",
"@hubspot/api-client": "11.2.0",
"@koa/cors": "5.0.0",
"@langchain/anthropic": "^0.3.7",
"@langchain/community": "0.2.31",
"@langchain/core": "^0.3.17",
"@langchain/openai": "0.2.8",
"@microsoft/microsoft-graph-client": "3.0.7",
"@nlpjs/basic": "4.27.0",
"@nosferatu500/textract": "3.1.3",
"@push-rpc/core": "1.9.0",
"@push-rpc/http": "1.9.0",
"@push-rpc/openapi": "1.9.0",
"@push-rpc/websocket": "1.9.0",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/exec": "6.0.3",
"@semantic-release/git": "10.0.1",
"@sendgrid/mail": "8.1.3",
"@sequelize/core": "7.0.0-alpha.37",
"@sequelize/postgres": "^7.0.0-alpha.43",
"@types/validator": "13.12.1",
"adm-zip": "0.5.16",
"ai2html": "^0.121.1",
"alasql": "4.5.1",
"@azure/ms-rest-js": "2.1.0",
"@microsoft/microsoft-graph-client": "2.1.1",
"@semantic-release/changelog": "5.0.1",
"@semantic-release/exec": "5.0.0",
"@semantic-release/git": "9.0.0",
"@types/validator": "13.1.0",
"adal-node": "0.2.1",
"any-shell-escape": "0.1.1",
"arraybuffer-to-buffer": "0.0.7",
"async-mutex": "0.5.0",
"async-promises": "0.2.3",
"async-retry": "1.3.3",
"basic-auth": "2.0.1",
"bcrypt": "^5.1.1",
"billboard.js": "3.13.0",
"azure-arm-cognitiveservices": "3.0.0",
"azure-arm-resource": "7.4.0",
"azure-arm-search": "1.3.0-preview",
"azure-arm-sql": "5.7.0",
"azure-arm-website": "5.7.0",
"azure-search-client": "3.1.5",
"bluebird": "3.7.2",
"body-parser": "1.20.2",
"botbuilder": "4.23.0",
"botbuilder-adapter-facebook": "1.0.12",
"botbuilder-ai": "4.23.0",
"botbuilder-dialogs": "4.23.0",
"botframework-connector": "4.23.0",
"botlib": "5.0.0",
"c3-chart-maker": "0.2.8",
"cd": "0.3.3",
"chalk-animation": "2.0.3",
"chatgpt": "5.2.5",
"chrome-remote-interface": "0.33.2",
"cli-progress": "3.12.0",
"body-parser": "1.19.0",
"botbuilder": "4.11.0",
"botbuilder-ai": "4.11.0",
"botbuilder-dialogs": "4.11.0",
"botframework-connector": "4.11.0",
"botlib": "1.7.1",
"cli-spinner": "0.2.10",
"core-js": "3.38.1",
"cors": "2.8.5",
"csv-database": "0.9.2",
"data-forge": "1.10.2",
"date-diff": "1.0.2",
"docximager": "0.0.4",
"docxtemplater": "3.50.0",
"core-js": "3.7.0",
"dotenv-extended": "2.9.0",
"electron": "32.0.1",
"exceljs": "4.4.0",
"express": "4.19.2",
"exceljs": "4.2.0",
"express": "4.17.1",
"express-remove-route": "1.0.0",
"facebook-nodejs-business-sdk": "^20.0.2",
"ffmpeg-static": "5.2.0",
"formidable": "^3.5.1",
"get-image-colors": "4.0.1",
"glob": "^11.0.0",
"google-libphonenumber": "3.2.38",
"googleapis": "143.0.0",
"hnswlib-node": "3.0.0",
"html-to-md": "0.8.6",
"http-proxy": "1.18.1",
"ibm-watson": "9.1.0",
"icojs": "^0.19.4",
"instagram-private-api": "1.46.1",
"iso-639-1": "3.1.3",
"isomorphic-fetch": "3.0.0",
"jimp": "1.6.0",
"js-md5": "0.8.3",
"json-schema-to-zod": "2.4.0",
"jsqr": "^1.4.0",
"just-indent": "0.0.1",
"keyv": "5.0.1",
"koa": "2.15.3",
"koa-body": "6.0.1",
"koa-ratelimit": "5.1.0",
"koa-router": "12.0.1",
"langchain": "0.2.17",
"language-tags": "1.0.9",
"line-replace": "2.0.1",
"livekit-server-sdk": "^2.12.0",
"lodash": "4.17.21",
"luxon": "3.5.0",
"mammoth": "1.8.0",
"mariadb": "3.3.1",
"mime-types": "2.1.35",
"minio": "^8.0.4",
"moment": "2.30.1",
"ms-rest-azure": "3.0.2",
"mysql": "^2.18.1",
"ffmpeg-static": "4.2.7",
"google-libphonenumber": "3.2.15",
"ibm-watson": "5.7.1",
"js-beautify": "1.13.0",
"marked": "1.2.5",
"microsoft-cognitiveservices-speech-sdk": "1.14.1",
"ms-rest-azure": "3.0.0",
"nexmo": "2.9.1",
"ngrok": "5.0.0-beta.2",
"node-cron": "3.0.3",
"node-html-parser": "6.1.13",
"node-nlp": "4.27.0",
"node-tesseract-ocr": "2.2.1",
"nodemailer": "6.10.1",
"nodemon": "^3.1.7",
"npm": "10.8.3",
"open": "10.1.0",
"open-docxtemplater-image-module": "1.0.3",
"openai": "4.57.0",
"pdf-extraction": "1.0.2",
"pdf-parse": "1.1.1",
"pdf-to-png-converter": "3.3.0",
"pdfjs-dist": "4.6.82",
"pg": "^8.13.1",
"phone": "3.1.50",
"pizzip": "3.1.7",
"pptxtemplater": "1.0.5",
"pragmatismo-io-framework": "1.1.1",
"prism-media": "1.3.5",
"public-ip": "7.0.1",
"punycode": "2.3.1",
"puppeteer": "23.2.2",
"puppeteer-extra": "3.3.6",
"puppeteer-extra-plugin-minmax": "1.1.2",
"puppeteer-extra-plugin-stealth": "2.11.2",
"qr-scanner": "1.4.2",
"qrcode": "1.5.4",
"qrcode-reader": "^1.0.4",
"qrcode-terminal": "0.12.0",
"node-cron": "2.0.3",
"opn": "6.0.0",
"phone": "2.4.17",
"pragmatismo-io-framework": "1.0.20",
"prism-media": "1.2.2",
"public-ip": "4.0.2",
"readline": "1.3.0",
"reflect-metadata": "0.2.2",
"rimraf": "6.0.1",
"reflect-metadata": "0.1.13",
"request-promise": "4.2.5",
"request-promise-native": "1.0.8",
"rimraf": "3.0.2",
"safe-buffer": "5.2.1",
"scanf": "1.2.0",
"sequelize": "6.37.3",
"sequelize-cli": "6.6.2",
"sequelize-typescript": "2.1.6",
"simple-git": "3.26.0",
"speakingurl": "14.0.1",
"sqlite3": "5.1.7",
"ssr-for-bots": "1.0.1-c",
"scanf": "1.1.2",
"sequelize": "5.21.5",
"sequelize-typescript": "1.1.0",
"simple-git": "2.23.0",
"speakingurl": "^14.0.1",
"sppull": "2.6.7",
"strict-password-generator": "1.1.2",
"stripe": "^18.0.0",
"super-strong-password-generator": "2.0.2",
"super-strong-password-generator-es": "2.0.2",
"svg2img": "^1.0.0-beta.2",
"swagger-client": "3.29.2",
"swagger-ui-dist": "5.17.14",
"tabulator-tables": "6.2.5",
"tedious": "18.6.1",
"swagger-client": "2.1.18",
"tedious": "9.2.1",
"textract": "2.5.0",
"twilio": "5.2.3",
"twitter-api-v2": "1.17.2",
"typeorm": "0.3.20",
"typescript": "5.5.4",
"url-join": "5.0.0",
"vhost": "3.0.2",
"vm2": "3.9.19",
"vm2-process": "2.1.5",
"typescript": "4.1.2",
"url-join": "4.0.1",
"vbscript-to-typescript": "1.0.8",
"walk-promise": "0.2.0",
"washyourmouthoutwithsoap": "1.0.2",
"webdav-server": "2.6.2",
"webp-converter": "^2.3.3",
"whatsapp-cloud-api": "0.3.1",
"whatsapp-web.js": "1.26.1-alpha.1",
"winston": "3.14.2",
"ws": "8.18.0",
"yaml": "2.5.0",
"yarn": "1.22.22",
"zod-to-json-schema": "3.23.2"
"washyourmouthoutwithsoap": "1.0.2"
},
"devDependencies": {
"@types/lodash": "^4.17.20",
"@types/node": "^24.1.0",
"@types/node-fetch": "^2.6.12",
"@types/qrcode": "1.5.5",
"@types/url-join": "4.0.3",
"@typescript-eslint/eslint-plugin": "8.4.0",
"@typescript-eslint/parser": "8.4.0",
"ban-sensitive-files": "1.10.5",
"commitizen": "4.3.0",
"@types/url-join": "4.0.0",
"@types/winston": "2.4.4",
"ban-sensitive-files": "1.9.14",
"commitizen": "4.2.2",
"cz-conventional-changelog": "3.3.0",
"dependency-check": "4.1.0",
"git-issues": "1.3.1",
"license-checker": "25.0.1",
"ngrok": "3.3.0",
"nsp": "3.2.1",
"prettier-standard": "16.4.1",
"semantic-release": "24.1.0",
"simple-commit-message": "4.1.3",
"semantic-release": "17.2.4",
"simple-commit-message": "4.0.13",
"travis-deploy-once": "5.0.11",
"tslint": "6.1.3",
"tsx": "^4.19.1",
"vitest": "2.0.5"
"ts-node": "9.0.0",
"tslint": "6.1.2",
"tslint-microsoft-contrib": "^6.2.0",
"typedoc": "0.19.2"
},
"eslintConfig": {
"env": {
@ -324,9 +180,6 @@
"release": {
"tagFormat": "${version}",
"debug": true,
"branches": [
"main"
],
"verifyConditions": [
"@semantic-release/github"
],

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -17,11 +19,11 @@
| 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 |
| 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.com.br. |
| "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. |
@ -34,23 +36,20 @@
'use strict';
import crypto from 'crypto';
import urlJoin from 'url-join';
const crypto = require('crypto');
import { WaterfallDialog } from 'botbuilder-dialogs';
import { GBMinInstance, IGBDialog } from 'botlib';
import { GBDeployer } from '../../core.gbapp/services/GBDeployer.js';
import { GBImporter } from '../../core.gbapp/services/GBImporterService.js';
import { Messages } from '../strings.js';
import { GBAdminService } from '../services/GBAdminService.js';
import { GBMinInstance, IGBDialog, GBLog, IGBPackage } from 'botlib';
import urlJoin = require('url-join');
import { GBDeployer } from '../../core.gbapp/services/GBDeployer';
import { GBImporter } from '../../core.gbapp/services/GBImporterService';
import { Messages } from '../strings';
import { GBAdminService } from '../services/GBAdminService';
import { CollectionUtil } from 'pragmatismo-io-framework';
import { SecService } from '../../security.gbapp/services/SecService.js';
import { GBConfigService } from '../../core.gbapp/services/GBConfigService.js';
import { GBServer } from '../../../src/app.js';
import { GBLogEx } from '../../core.gbapp/services/GBLogEx.js';
import { GBUtil } from '../../../src/util.js';
class AdminDialog extends IGBDialog {
/**
* Dialogs for administration tasks.
*/
export class AdminDialog extends IGBDialog {
public static isIntentYes(locale, utterance) {
return utterance.toLowerCase().match(Messages[locale].affirmative_sentences);
}
@ -59,7 +58,15 @@ class AdminDialog extends IGBDialog {
return utterance.toLowerCase().match(Messages[locale].negative_sentences);
}
/**
* Setup dialogs flows and define services call.
*
* @param bot The bot adapter.
* @param min The minimal bot instance data.
*/
public static setup(min: GBMinInstance) {
// Setup services.
const importer = new GBImporter(min.core);
const deployer = new GBDeployer(min.core, importer);
@ -68,26 +75,16 @@ class AdminDialog extends IGBDialog {
min.dialogs.add(
new WaterfallDialog('/admin-auth', [
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) {
return await step.beginDialog('/auth');
} else {
return await step.next(step.options);
}
},
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
const locale = step.context.activity.locale;
const prompt = Messages[locale].authenticate;
return await min.conversationalService.prompt(min, step, prompt);
},
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
const locale = step.context.activity.locale;
const sensitive = step.context.activity['originalText'];
if (await GBUtil.comparePassword( sensitive, min.instance.adminPass)) {
if (step.context.activity['originalText'] === process.env.ADMIN_PASS) {
// TODO: Per bot: min.instance.adminPass
await min.conversationalService.sendText(min, step, Messages[locale].welcome);
return await step.endDialog(true);
@ -102,26 +99,16 @@ class AdminDialog extends IGBDialog {
min.dialogs.add(
new WaterfallDialog('/admin', [
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) {
return await step.beginDialog('/auth');
} else {
return await step.next(step.options);
}
},
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
const locale = step.context.activity.locale;
const prompt = Messages[locale].authenticate;
return await min.conversationalService.prompt(min, step, prompt);
},
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
const locale = step.context.activity.locale;
const sensitive = step.context.activity['originalText'];
const sensitive = step.result;
if (await GBUtil.comparePassword( sensitive, min.instance.adminPass)) {
if (sensitive === min.instance.adminPass) {
await min.conversationalService.sendText(min, step, Messages[locale].welcome);
return await min.conversationalService.prompt(min, step, Messages[locale].which_task);
@ -132,9 +119,9 @@ class AdminDialog extends IGBDialog {
}
},
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
const locale: string = step.context.activity.locale;
const text: string = step.context.activity['originalText'];
// tslint:disable-next-line:no-unsafe-any
const text: string = step.result;
const cmdName = text.split(' ')[0];
await min.conversationalService.sendText(min, step, Messages[locale].working(cmdName));
@ -143,6 +130,36 @@ class AdminDialog extends IGBDialog {
try {
if (text === 'quit') {
return await step.replaceDialog('/');
} else if (cmdName === 'deployPackage' || cmdName === 'dp') {
await GBAdminService.deployPackageCommand(min, text, deployer);
return await step.replaceDialog('/admin', { firstRun: false });
} else if (cmdName === 'redeployPackage' || cmdName === 'rp') {
await min.conversationalService.sendText(min, step, 'The package is being *unloaded*...');
await GBAdminService.undeployPackageCommand(text, min);
await min.conversationalService.sendText(min, step, 'Now, *deploying* package...');
await GBAdminService.deployPackageCommand(min, text, deployer);
await min.conversationalService.sendText(
min,
step,
'Package deployed. Just need to rebuild the index... Doing it right now.'
);
await GBAdminService.rebuildIndexPackageCommand(min, deployer);
await min.conversationalService.sendText(min, step, 'Finished importing of that .gbkb package. Thanks.');
return await step.replaceDialog('/admin', { firstRun: false });
} else if (cmdName === 'undeployPackage' || cmdName === 'up') {
await min.conversationalService.sendText(min, step, 'The package is being *undeployed*...');
await GBAdminService.undeployPackageCommand(text, min);
await min.conversationalService.sendText(min, step, 'Package *undeployed*.');
return await step.replaceDialog('/admin', { firstRun: false });
} else if (cmdName === 'rebuildIndex' || cmdName === 'ri') {
await GBAdminService.rebuildIndexPackageCommand(min, deployer);
return await step.replaceDialog('/admin', { firstRun: false });
} else if (cmdName === 'syncBotServer') {
await GBAdminService.syncBotServerCommand(min, deployer);
return await step.replaceDialog('/admin', { firstRun: false });
} else if (cmdName === 'setupSecurity') {
return await step.beginDialog('/setupSecurity');
} else {
@ -165,15 +182,6 @@ class AdminDialog extends IGBDialog {
min.dialogs.add(
new WaterfallDialog('/install', [
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) {
return await step.beginDialog('/auth');
} else {
return await step.next(step.options);
}
},
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
step.activeDialog.state.options.args = (step.options as any).args;
if (step.activeDialog.state.options.confirm) {
return await step.next('sim');
@ -183,23 +191,17 @@ class AdminDialog extends IGBDialog {
}
},
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
const locale = step.context.activity.locale;
if (AdminDialog.isIntentYes(locale, step.result)) {
const list = min.core.getParam(min.instance, '.gbapp List', null);
const items = list ? list.split(';') : [];
// If the user says yes, starts publishing.
if (AdminDialog.isIntentYes(locale, step.result)) {
step.activeDialog.state.options.args;
for (let i = 0; i < items.length; i++) {
for (let j = 0; j < min.appPackages.length; j++) {
if (items[i] === min.appPackages[j]['name']) {
const element = min.appPackages[i];
await element.onExchangeData(min, 'install', null);
break;
}
}
for (let index = 0; index < min.appPackages.length; index++) {
const element = min.appPackages[index];
await element.onExchangeData(min, 'install', null);
// TODO: Filter just to the .gbapp being installed.
}
} else {
await min.conversationalService.sendText(min, step, Messages[locale].publish_canceled);
@ -208,38 +210,10 @@ class AdminDialog extends IGBDialog {
])
);
min.dialogs.add(
new WaterfallDialog('/logs', [
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) {
return await step.beginDialog('/auth');
} else {
return await step.next(step.options);
}
},
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
const logs = await min.core['getLatestLogs']();
await min.conversationalService.sendText(min, step, logs);
return await step.replaceDialog('/ask', { isReturning: true });
}
]));
min.dialogs.add(
new WaterfallDialog('/publish', [
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) {
return await step.beginDialog('/auth');
} else {
return await step.next(step.options);
}
},
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
step.activeDialog.state.options.confirm = true;
if (step.activeDialog.state.options.confirm || process.env.ADMIN_OPEN_PUBLISH === 'true') {
if (step.activeDialog.state.options.confirm || process.env.ADMIN_OPEN_PUBLISH === "true") {
return await step.next('sim');
} else {
const locale = step.context.activity.locale;
@ -247,9 +221,10 @@ class AdminDialog extends IGBDialog {
}
},
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
const locale = step.context.activity.locale;
// If the user says yes, starts publishing.
if (AdminDialog.isIntentYes(locale, step.result)) {
let from = step.context.activity.from.id;
@ -257,7 +232,7 @@ class AdminDialog extends IGBDialog {
if (step.activeDialog.state.options.firstTime) {
canPublish = true;
} else {
canPublish = AdminDialog.canPublish(min, from) || process.env.ADMIN_OPEN_PUBLISH === 'true';
canPublish = AdminDialog.canPublish(min, from) || process.env.ADMIN_OPEN_PUBLISH === "true";
}
if (!canPublish) {
@ -270,7 +245,6 @@ class AdminDialog extends IGBDialog {
}
},
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
const locale = step.context.activity.locale;
if (!step.result) {
await min.conversationalService.sendText(min, step, Messages[locale].publish_must_be_admin);
@ -289,70 +263,44 @@ class AdminDialog extends IGBDialog {
const packages = [];
let skipError = false;
if (!filename || filename === '') {
if (filename === null || filename === '') {
await min.conversationalService.sendText(min, step, `Starting publishing for ${botId} packages...`);
packages.push(`${botId}.gbot`);
packages.push(`${botId}.gbtheme`);
packages.push(`${botId}.gbdrive`);
packages.push(`${botId}.gbdata`);
packages.push(`${botId}.gbkb`);
packages.push(`${botId}.gbtheme`);
packages.push(`${botId}.gbdialog`);
packages.push(`${botId}.gbot`);
skipError = true;
} else {
await min.conversationalService.sendText(min, step, `Starting publishing for ${filename}...`);
packages.push(filename);
}
await CollectionUtil.asyncForEach(packages, async packageName => {
let cmd1;
try {
let cmd1;
if (packageName.indexOf('.') !== -1) {
cmd1 = `deployPackage ${process.env.STORAGE_SITE} /${process.env.STORAGE_LIBRARY}/${botId}.gbai/${packageName}`;
} else {
cmd1 = `deployPackage ${packageName}`;
}
if ((await (deployer as any).getStoragePackageByName(min.instance.instanceId, packageName)) !== null &&
!process.env.DONT_DOWNLOAD
) {
const cmd2 = `undeployPackage ${packageName}`;
await GBAdminService.undeployPackageCommand(cmd2, min);
}
await GBAdminService.deployPackageCommand(min, cmd1, deployer);
await min.conversationalService.sendText(min, step, `Finished publishing ${packageName}.`);
} catch (error) {
GBLog.error(error);
if (!skipError) {
await min.conversationalService.sendText(min, step, `ERROR: ${error}`);
if (
packageName.toLowerCase() === 'gbdialog' ||
packageName.toLowerCase() === 'gbdrive' ||
packageName.toLowerCase() === 'gbdata' ||
packageName.toLowerCase() === 'gbkb' ||
packageName.toLowerCase() === 'gbot' ||
packageName.toLowerCase() === 'gbtheme'
) {
packageName = `${min.botId}.${packageName}`;
return await step.replaceDialog('/ask', { isReturning: true });
}
}
if (packageName.indexOf('.') !== -1) {
cmd1 = `deployPackage ${process.env.STORAGE_SITE} /${GBConfigService.get('STORAGE_LIBRARY')}/${botId}.gbai/${packageName}`;
} else {
cmd1 = `deployPackage ${packageName}`;
}
if (
(await (deployer as any).getStoragePackageByName(min.instance.instanceId, packageName)) !== null &&
!process.env.DONT_DOWNLOAD
) {
const cmd2 = `undeployPackage ${packageName}`;
await GBAdminService.undeployPackageCommand(cmd2, min);
}
let sec = new SecService();
const member = step.context.activity.from;
const user = await sec.ensureUser(
min,
member.id,
member.name,
'',
'web',
member.name,
null
);
await GBAdminService.deployPackageCommand(min, user, cmd1, deployer);
// .gbot updates severals keys in instantece, so min must be updated.
const activeMin = GBServer.globals.minInstances.find(p=> p.botId === min.botId);
if (activeMin){
min = activeMin;
}
});
await min.conversationalService.sendText(min, step, `Training is finished.`);
await min.conversationalService.sendText(min, step, Messages[locale].publish_success);
if (!step.activeDialog.state.options.confirm) {
return await step.replaceDialog('/ask', { isReturning: true });
} else {
@ -363,22 +311,19 @@ class AdminDialog extends IGBDialog {
);
}
/**
* Check if the specified phone can receive a message by running
* the /broadcast command with specific phone numbers.
* @param phone Phone number to check (eg.: +5521900002233)
*/
public static canPublish(min: GBMinInstance, phone: string): Boolean {
if (process.env.SECURITY_CAN_PUBLISH !== undefined) {
let list = process.env.SECURITY_CAN_PUBLISH.split(';');
const canPublish = min.core.getParam(min.instance, 'Can Publish', null);
if (canPublish) {
list = list.concat(canPublish.split(';'));
}
const list = process.env.SECURITY_CAN_PUBLISH.split(';');
let result = list.includes(phone);
if (!result && min.instance.params) {
const params = JSON.parse(min.instance.params);
if (params) {
return list.includes(params['Can Publish']);
}
return list.includes(params['Can Publish']);
}
return result;
}
@ -388,72 +333,47 @@ class AdminDialog extends IGBDialog {
min.dialogs.add(
new WaterfallDialog('/setupSecurity', [
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
const tokenName = step.activeDialog.state.tokenName = step.options['args'];
if (tokenName) {
step.activeDialog.state.clientId = min.core.getParam<string>(min.instance, `${tokenName} Client ID`, null),
step.activeDialog.state.host = min.core.getParam<string>(min.instance, `${tokenName} Host`, null),
step.activeDialog.state.tenant = min.core.getParam<string>(min.instance, `${tokenName} Tenant`, null)
}
if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) {
return await step.beginDialog('/auth');
} else {
return await step.next(step.options);
}
},
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
if (step.activeDialog.state.tokenName) {
return await step.next(step.options);
}
const locale = step.context.activity.locale;
const prompt = Messages[locale].enter_authenticator_tenant;
return await min.conversationalService.prompt(min, step, prompt);
},
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
if (step.activeDialog.state.tokenName) {
return await step.next(step.options);
}
step.activeDialog.state.authenticatorTenant = step.context.activity['originalText'];
step.activeDialog.state.authenticatorTenant = step.result;
const locale = step.context.activity.locale;
const prompt = Messages[locale].enter_authenticator_authority_host_url;
return await min.conversationalService.prompt(min, step, prompt);
},
async step => {
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
step.activeDialog.state.authenticatorAuthorityHostUrl = step.context.activity['originalText'];
step.activeDialog.state.authenticatorAuthorityHostUrl = step.result;
const tokenName = step.activeDialog.state.tokenName;
min.instance.authenticatorTenant =
step.activeDialog.state.authenticatorTenant;
min.instance.authenticatorAuthorityHostUrl =
step.activeDialog.state.authenticatorAuthorityHostUrl;
if (!tokenName) {
min.instance.authenticatorAuthorityHostUrl = step.activeDialog.state.authenticatorAuthorityHostUrl;
min.instance.authenticatorTenant = step.activeDialog.state.authenticatorTenant;
await min.adminService.updateSecurityInfo(
min.instance.instanceId,
step.activeDialog.state.authenticatorTenant,
step.activeDialog.state.authenticatorAuthorityHostUrl
);
await min.adminService.updateSecurityInfo(
min.instance.instanceId,
tokenName ? step.activeDialog.state.tenant : step.activeDialog.state.authenticatorTenant,
tokenName ? step.activeDialog.state.host : step.activeDialog.state.authenticatorAuthorityHostUrl
);
}
const locale = step.context.activity.locale;
const buf = Buffer.alloc(16);
const state = `${min.instance.instanceId}${crypto.randomFillSync(buf).toString('hex')}`;
min.adminService.setValue(min.instance.instanceId, `${tokenName}AntiCSRFAttackState`, state);
min.adminService.setValue(min.instance.instanceId, 'AntiCSRFAttackState', state);
const redirectUri = urlJoin(process.env.BOT_URL, min.instance.botId,
tokenName ? `/token?value=${tokenName}` : '/token');
const scope = tokenName ? '' : 'https://graph.microsoft.com/.default';
const host = tokenName ? step.activeDialog.state.host : 'https://login.microsoftonline.com'
const tenant = tokenName ? step.activeDialog.state.tenant : min.instance.authenticatorTenant;
const clientId = tokenName ? step.activeDialog.state.clientId : (min.instance.marketplaceId ?
min.instance.marketplaceId : GBConfigService.get('MARKETPLACE_ID'));
const oauth2 = tokenName ? 'oauth' : 'oauth2';
const url = `${host}/${tenant}/${oauth2}/authorize?client_id=${clientId}&response_type=code&redirect_uri=${redirectUri}&scope=${scope}&state=${state}&response_mode=query`;
const redirectUri = urlJoin(
min.instance.botEndpoint,
min.instance.botId,
'/token'
);
const url = `https://login.microsoftonline.com/${step.activeDialog.state.authenticatorTenant
}/oauth2/authorize?client_id=${min.instance.marketplaceId
}&response_type=code&redirect_uri=${redirectUri
}&scope=https://graph.microsoft.com/.default&state=${state}&response_mode=query`;
await min.conversationalService.sendText(min, step, Messages[locale].consent(url));
@ -463,5 +383,3 @@ class AdminDialog extends IGBDialog {
);
}
}
export { AdminDialog };

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -36,10 +38,8 @@
import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
import { Sequelize } from 'sequelize-typescript';
import { AdminDialog } from './dialogs/AdminDialog.js';
import { GuaribasAdmin } from './models/AdminModel.js';
import { GBLogEx } from '../core.gbapp/services/GBLogEx.js';
import { AdminDialog } from './dialogs/AdminDialog';
import { GuaribasAdmin } from './models/AdminModel';
/**
* The package for admin.gbapp.
@ -47,27 +47,28 @@ import { GBLogEx } from '../core.gbapp/services/GBLogEx.js';
export class GBAdminPackage implements IGBPackage {
public sysPackages: IGBPackage[];
public async getDialogs (min: GBMinInstance) {
GBLogEx.verbose(min,`getDialogs called.`);
public async getDialogs(min: GBMinInstance) {
GBLog.verbose(`getDialogs called.`);
}
public async unloadPackage (core: IGBCoreService): Promise<void> {
public async unloadPackage(core: IGBCoreService): Promise<void> {
GBLog.verbose(`unloadPackage called.`);
}
public async unloadBot (min: GBMinInstance): Promise<void> {
GBLogEx.verbose(min,`unloadBot called.`);
public async unloadBot(min: GBMinInstance): Promise<void> {
GBLog.verbose(`unloadBot called.`);
}
public async onNewSession (min: GBMinInstance, step: GBDialogStep): Promise<void> {
GBLogEx.verbose(min, `onNewSession called.`);
public async onNewSession(min: GBMinInstance, step: GBDialogStep): Promise<void> {
GBLog.verbose(`onNewSession called.`);
}
public async onExchangeData (min: GBMinInstance, kind: string, data: any) {
GBLogEx.verbose(min,`onExchangeData called.`);
public async onExchangeData(min: GBMinInstance, kind: string, data: any) {
GBLog.verbose(`onExchangeData called.`);
}
public async loadPackage (core: IGBCoreService, sequelize: Sequelize): Promise<void> {
public async loadPackage(core: IGBCoreService, sequelize: Sequelize): Promise<void> {
core.sequelize.addModels([GuaribasAdmin]);
}
public async loadBot (min: GBMinInstance): Promise<void> {
public async loadBot(min: GBMinInstance): Promise<void> {
AdminDialog.setup(min);
}
}

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -34,27 +36,35 @@
'use strict';
import { Column, CreatedAt, DataType, Model, Table, UpdatedAt } from 'sequelize-typescript';
import {
Column,
CreatedAt,
DataType,
Model,
Table,
UpdatedAt
} from 'sequelize-typescript';
/**
* General settings store.
*/
@Table
export class GuaribasAdmin extends Model<GuaribasAdmin> {
@Column(DataType.INTEGER)
declare instanceId: number;
@Column(DataType.STRING(255))
declare key: string;
@Column
public instanceId: number;
@Column
public key: string;
@Column(DataType.STRING(4000))
declare value: string;
public value: string;
@Column(DataType.DATE)
@Column
@CreatedAt
declare createdAt: Date;
public createdAt: Date;
@Column(DataType.DATE)
@Column
@UpdatedAt
declare updatedAt: Date;
public updatedAt: Date;
}

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -35,26 +37,19 @@
'use strict';
import { AuthenticationContext, TokenResponse } from 'adal-node';
import { GBError, GBLog, GBMinInstance, IGBAdminService, IGBCoreService, IGBDeployer, IGBInstance } from 'botlib';
import { FindOptions } from 'sequelize/types';
import urlJoin from 'url-join';
import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService.js';
import { GuaribasInstance } from '../../core.gbapp/models/GBModel.js';
import { GBConfigService } from '../../core.gbapp/services/GBConfigService.js';
import { GBDeployer } from '../../core.gbapp/services/GBDeployer.js';
import { GBImporter } from '../../core.gbapp/services/GBImporterService.js';
import { GBSharePointService } from '../../sharepoint.gblib/services/SharePointService.js';
import { GuaribasAdmin } from '../models/AdminModel.js';
import msRestAzure from 'ms-rest-azure';
import path from 'path';
import { caseSensitive_Numbs_SpecialCharacters_PW, lowercase_PW } from 'super-strong-password-generator';
import crypto from 'crypto';
import fs from 'fs/promises';
import { GBServer } from '../../../src/app.js';
import { GuaribasUser } from '../../security.gbapp/models/index.js';
import { DialogKeywords } from '../../basic.gblib/services/DialogKeywords.js';
import { GBLogEx } from '../../core.gbapp/services/GBLogEx.js';
import { GBUtil } from '../../../src/util.js';
import { GBLog, GBMinInstance, IGBAdminService, IGBCoreService, IGBDeployer, IGBInstance } from 'botlib';
import urlJoin = require('url-join');
import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService';
import { GuaribasInstance } from '../../core.gbapp/models/GBModel';
import { GBConfigService } from '../../core.gbapp/services/GBConfigService';
import { GBDeployer } from '../../core.gbapp/services/GBDeployer';
import { GBImporter } from '../../core.gbapp/services/GBImporterService';
import { GBSharePointService } from '../../sharepoint.gblib/services/SharePointService';
import { GuaribasAdmin } from '../models/AdminModel';
const Path = require('path');
const msRestAzure = require('ms-rest-azure');
const PasswordGenerator = require('strict-password-generator').default;
const crypto = require("crypto");
/**
* Services for server administration.
@ -72,19 +67,21 @@ export class GBAdminService implements IGBAdminService {
}
public static generateUuid(): string {
return crypto.randomUUID();
return msRestAzure.generateUuid();
}
public static async getNodeVersion() {
public static getNodeVersion() {
const packageJson = urlJoin(process.cwd(), 'package.json');
const pkg = JSON.parse(await fs.readFile(packageJson, 'utf8'));
return pkg.engines.node.replace('=', '');
// tslint:disable-next-line: non-literal-require
const pjson = require(packageJson);
return pjson.engines.node.replace('=', '');
}
public static async getADALTokenFromUsername(username: string, password: string) {
const credentials = await GBAdminService.getADALCredentialsFromUsername(username, password);
return (credentials as any).tokenCache._entries[0].accessToken;
return credentials.tokenCache._entries[0].accessToken;
}
public static async getADALCredentialsFromUsername(username: string, password: string) {
@ -92,52 +89,68 @@ export class GBAdminService implements IGBAdminService {
}
public static getMobileCode() {
return this.getNumberIdentifier(6);
const passwordGenerator = new PasswordGenerator();
const options = {
upperCaseAlpha: false,
lowerCaseAlpha: false,
number: true,
specialCharacter: false,
minimumLength: 6,
maximumLength: 6
};
return passwordGenerator.generatePassword(options);
}
public static getRndPassword(): string {
let password = caseSensitive_Numbs_SpecialCharacters_PW(15);
password = password.replace(/[\@\[\=\:\;\?\"\'\#]/gi, '*');
const passwordGenerator = new PasswordGenerator();
const options = {
upperCaseAlpha: true,
lowerCaseAlpha: true,
number: true,
specialCharacter: true,
minimumLength: 14,
maximumLength: 14
};
let password = passwordGenerator.generatePassword(options);
password = password.replace(/[\@\[\=\:\;\?]/gi, '#');
const removeRepeatedChars = (s, r) => {
let res = '',
last = null,
counter = 0;
s.split('').forEach(char => {
if (char == last) counter++;
else {
counter = 0;
last = char;
}
if (counter < r) res += char;
});
return res;
return password;
}
public static getRndReadableIdentifier() {
const passwordGenerator = new PasswordGenerator();
const options = {
upperCaseAlpha: false,
lowerCaseAlpha: true,
number: false,
specialCharacter: false,
minimumLength: 14,
maximumLength: 14
};
return removeRepeatedChars(password, 1);
return passwordGenerator.generatePassword(options);
}
public static getRndReadableIdentifier(): string {
return lowercase_PW(14);
}
public static getNumberIdentifier() {
const passwordGenerator = new PasswordGenerator();
const options = {
upperCaseAlpha: false,
lowerCaseAlpha: false,
number: true,
specialCharacter: false,
minimumLength: 14,
maximumLength: 14
};
public static getNumberIdentifier(digits: number = 14): string {
if (digits <= 0) {
throw new Error('Number of digits should be greater than 0.');
}
const min = 10 ** (digits - 1);
const max = 10 ** digits - 1;
const randomNumber = Math.floor(Math.random() * (max - min + 1)) + min;
return randomNumber.toString();
return passwordGenerator.generatePassword(options);
}
/**
* @see https://stackoverflow.com/a/52171480
*/
public static getHash(str: string, seed = 0) {
let h1 = 0xdeadbeef ^ seed,
h2 = 0x41c6ce57 ^ seed;
public static getHash(str, seed = 0) {
let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
for (let i = 0, ch; i < str.length; i++) {
ch = str.charCodeAt(i);
h1 = Math.imul(h1 ^ ch, 2654435761);
@ -148,40 +161,56 @@ export class GBAdminService implements IGBAdminService {
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
}
public static async undeployPackageCommand(text: string, min: GBMinInstance) {
public static async undeployPackageCommand(text: any, min: GBMinInstance) {
const packageName = text.split(' ')[1];
const importer = new GBImporter(min.core);
const deployer = new GBDeployer(min.core, importer);
const packagePath = GBUtil.getGBAIPath(min.botId, null, packageName);
const localFolder = path.join('work', packagePath);
const localFolder = Path.join('work', `${min.instance.botId}.gbai`, Path.basename(packageName));
await deployer.undeployPackageFromLocalPath(min.instance, localFolder);
}
public static isSharePointPath(path: string) {
return path.indexOf('sharepoint.com') !== -1;
return path.indexOf('sharepoint.com') > 0;
}
public static async deployPackageCommand(
min: GBMinInstance,
user: GuaribasUser,
text: string,
deployer: IGBDeployer
) {
public static async deployPackageCommand(min: GBMinInstance, text: string, deployer: IGBDeployer) {
const packageName = text.split(' ')[1];
const folderName = text.substring(text.indexOf(packageName) + packageName.length + 1);
const packageType = path.extname(folderName).substr(1);
const gbaiPath = GBUtil.getGBAIPath(min.instance.botId, packageType, null);
const localFolder = path.join('work', gbaiPath);
if (!this.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.deployPackage(min, urlJoin(additionalPath, packageName));
} else {
const siteName = text.split(' ')[1];
const folderName = text.split(' ')[2];
await deployer['deployPackage2'](min, user, localFolder, true);
const s = new GBSharePointService();
const localFolder = Path.join('work', `${min.instance.botId}.gbai`, Path.basename(folderName));
// .gbot packages are handled using storage API, so no download
// of local resources is required.
if (!localFolder.endsWith('.gbot') && !process.env.DONT_DOWNLOAD) {
GBLog.warn(`${GBConfigService.get('CLOUD_USERNAME')} must be authorized on SharePoint related site to download to: ${localFolder}`);
await s.downloadFolder(
localFolder,
siteName,
folderName,
GBConfigService.get('CLOUD_USERNAME'),
GBConfigService.get('CLOUD_PASSWORD')
);
}
await deployer.deployPackage(min, localFolder);
}
}
public static async rebuildIndexPackageCommand(min: GBMinInstance, deployer: GBDeployer) {
const service = await AzureDeployerService.createInstance(deployer);
const searchIndex = min.instance.searchIndex
? min.instance.searchIndex
: GBServer.globals.minBoot.instance.searchIndex;
await deployer.rebuildIndex(min.instance, service.getKBSearchSchema(searchIndex));
public static async rebuildIndexPackageCommand(min: GBMinInstance, deployer: IGBDeployer) {
await deployer.rebuildIndex(
min.instance,
new AzureDeployerService(deployer).getKBSearchSchema(min.instance.searchIndex)
);
}
public static async syncBotServerCommand(min: GBMinInstance, deployer: GBDeployer) {
@ -191,8 +220,8 @@ export class GBAdminService implements IGBAdminService {
}
public async setValue(instanceId: number, key: string, value: string) {
const options = <FindOptions>{ where: {} };
options.where = { key: key, instanceId: instanceId };
const options = { where: {} };
options.where = { key: key };
let admin = await GuaribasAdmin.findOne(options);
if (admin === null) {
admin = new GuaribasAdmin();
@ -208,7 +237,7 @@ export class GBAdminService implements IGBAdminService {
authenticatorTenant: string,
authenticatorAuthorityHostUrl: string
): Promise<IGBInstance> {
const options = <FindOptions>{ where: {} };
const options = { where: {} };
options.where = { instanceId: instanceId };
const item = await GuaribasInstance.findOne(options);
item.authenticatorTenant = authenticatorTenant;
@ -218,120 +247,61 @@ export class GBAdminService implements IGBAdminService {
}
public async getValue(instanceId: number, key: string): Promise<string> {
const options = <FindOptions>{ where: {} };
const options = { where: {} };
options.where = { key: key, instanceId: instanceId };
const obj = await GuaribasAdmin.findOne(options);
return obj.value;
}
public async acquireElevatedToken(
instanceId: number,
root: boolean = false,
tokenName: string = '',
clientId: string = null,
clientSecret: string = null,
host: string = null,
tenant: string = null
): Promise<string> {
if (root) {
const minBoot = GBServer.globals.minBoot;
instanceId = minBoot.instance.instanceId;
}
GBLogEx.info(instanceId, `Acquiring token for instanceId: ${instanceId} ${tokenName} (root: ${root}).`);
public async acquireElevatedToken(instanceId: number): Promise<string> {
// TODO: Use boot bot as base for authentication.
let expiresOnV;
try {
expiresOnV = await this.getValue(instanceId, `${tokenName}expiresOn`);
} catch (error) {
throw new Error(`/setupSecurity is required before running /publish.`);
}
const botId = GBConfigService.get('BOT_ID');
instanceId = (await this.core.loadInstanceByBotId(botId)).instanceId;
return new Promise<string>(async (resolve, reject) => {
const instance = await this.core.loadInstanceById(instanceId);
const expiresOn = new Date(expiresOnV);
const expiresOn = new Date(await this.getValue(instanceId, 'expiresOn'));
if (expiresOn.getTime() > new Date().getTime()) {
const accessToken = await this.getValue(instanceId, `${tokenName}accessToken`);
const accessToken = await this.getValue(instanceId, 'accessToken');
resolve(accessToken);
} else {
if (tokenName && !root) {
const refreshToken = await this.getValue(instanceId, `${tokenName}refreshToken`);
const authorizationUrl = urlJoin(
instance.authenticatorAuthorityHostUrl,
instance.authenticatorTenant,
'/oauth2/authorize'
);
let url = urlJoin(host, tenant, 'oauth/token');
let buff = new Buffer(`${clientId}:${clientSecret}`);
const base64 = buff.toString('base64');
const refreshToken = await this.getValue(instanceId, 'refreshToken');
const resource = 'https://graph.microsoft.com';
const authenticationContext = new AuthenticationContext(authorizationUrl);
const options = {
method: 'POST',
headers: {
Accept: '1.0',
Authorization: `Basic ${base64}`,
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
grant_type: 'refresh_token',
refresh_token: refreshToken
})
};
const result = await fetch(url, options);
if (result.status != 200) {
const text = await result.text();
throw new Error(`acquireElevatedToken refreshing token: ${result.status}: ${result.statusText} ${text}.`);
}
const text = await result.text();
const token = JSON.parse(text);
// Saves token to the database.
await this.setValue(instanceId, `${tokenName}accessToken`, token['access_token']);
await this.setValue(instanceId, `${tokenName}refreshToken`, token['refresh_token']);
await this.setValue(
instanceId,
`${tokenName}expiresOn`,
new Date(Date.now() + token['expires_in'] * 1000).toString()
);
await this.setValue(instanceId, `${tokenName}AntiCSRFAttackState`, null);
resolve(token['access_token']);
} else {
const oauth2 = tokenName ? 'oauth' : 'oauth2';
const authorizationUrl = urlJoin(
tokenName ? host : instance.authenticatorAuthorityHostUrl,
tokenName ? tenant : instance.authenticatorTenant,
`/${oauth2}/authorize`
);
const refreshToken = await this.getValue(instanceId, `${tokenName}refreshToken`);
const resource = tokenName ? '' : 'https://graph.microsoft.com';
const authenticationContext = new AuthenticationContext(authorizationUrl);
authenticationContext.acquireTokenWithRefreshToken(
refreshToken,
tokenName ? clientId : instance.marketplaceId,
tokenName ? clientSecret : instance.marketplacePassword,
resource,
async (err, res) => {
if (err !== null) {
authenticationContext.acquireTokenWithRefreshToken(
refreshToken,
instance.marketplaceId,
instance.marketplacePassword,
resource,
async (err, res) => {
if (err !== null) {
reject(err);
} else {
const token = res as TokenResponse;
try {
await this.setValue(instanceId, 'accessToken', token.accessToken);
await this.setValue(instanceId, 'refreshToken', token.refreshToken);
await this.setValue(instanceId, 'expiresOn', token.expiresOn.toString());
resolve(token.accessToken);
} catch (error) {
reject(err);
} else {
const token = res as TokenResponse;
try {
await this.setValue(instanceId, `${tokenName}accessToken`, token.accessToken);
await this.setValue(instanceId, `${tokenName}refreshToken`, token.refreshToken);
await this.setValue(instanceId, `${tokenName}expiresOn`, token.expiresOn.toString());
resolve(token.accessToken);
} catch (error) {
reject(err);
}
}
}
);
}
}
);
}
});
}
public async publish(min: GBMinInstance, packageName: string, republish: boolean): Promise<void> {}
public async publish(min: GBMinInstance, packageName: string, republish: boolean): Promise<void> { }
}

View file

@ -1,9 +1,9 @@
export const Messages = {
'en-US': {
authenticate: 'Please, authenticate:',
welcome: 'Welcome to pragmatismo.com.br GeneralBots Administration.',
welcome: 'Welcome to Pragmatismo.io GeneralBots Administration.',
which_task: 'Which task do you wanna run now?',
working: command => `I'm working on ${command}...`,
working: (command) => `I'm working on ${command}...`,
finished_working: 'Done.',
unknown_command: text =>
`Well, but ${text} is not a administrative General Bots command, I will try to search for it.`,
@ -12,7 +12,7 @@ export const Messages = {
deployPackage: text => `Deploying package ${text}...`,
redeployPackage: text => `Redeploying package ${text}...`,
packageUndeployed: text => `√ Package ${text} undeployed...`,
consent: url => `Please, consent access to this app at: [Microsoft Online](${url}).`,
consent: (url) => `Please, consent access to this app at: [Microsoft Online](${url}).`,
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): ',
@ -26,9 +26,9 @@ export const Messages = {
},
'pt-BR': {
authenticate: 'Please, authenticate:',
welcome: 'Welcome to pragmatismo.com.br GeneralBots Administration.',
welcome: 'Welcome to Pragmatismo.io GeneralBots Administration.',
which_task: 'Which task do you wanna run now?',
working: command => `I'm working on ${command}...`,
working: (command) => `I'm working on ${command}...`,
finished_working: 'Done.',
unknown_command: text =>
`Well, but ${text} is not a administrative General Bots command, I will try to search for it.`,
@ -37,7 +37,7 @@ export const Messages = {
deployPackage: text => `Deploying package ${text}...`,
redeployPackage: text => `Redeploying package ${text}...`,
packageUndeployed: text => `Package ${text} undeployed...`,
consent: url => `Please, consent access to this app at: [Microsoft Online](${url}).`,
consent: (url) => `Please, consent access to this app at: [Microsoft Online](${url}).`,
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): ',

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -36,33 +38,35 @@
import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
import { Sequelize } from 'sequelize-typescript';
import { GuaribasConversation, GuaribasConversationMessage } from './models/index.js';
import { GuaribasConversation, GuaribasConversationMessage } from './models';
/**
* .gblib Package handler.
*/
export class GBAnalyticsPackage implements IGBPackage {
public sysPackages: IGBPackage[];
public async getDialogs (min: GBMinInstance) {
public async getDialogs(min: GBMinInstance) {
GBLog.verbose(`getDialogs called.`);
}
public async loadPackage (core: IGBCoreService, sequelize: Sequelize): Promise<void> {
public async loadPackage(core: IGBCoreService, sequelize: Sequelize): Promise<void> {
GBLog.verbose(`loadPackage called.`);
core.sequelize.addModels([GuaribasConversation, GuaribasConversationMessage]);
}
public async unloadPackage (core: IGBCoreService): Promise<void> {
public async unloadPackage(core: IGBCoreService): Promise<void> {
GBLog.verbose(`unloadPackage called.`);
}
public async loadBot (min: GBMinInstance): Promise<void> {
public async loadBot(min: GBMinInstance): Promise<void> {
GBLog.verbose(`loadBot called.`);
}
public async unloadBot (min: GBMinInstance): Promise<void> {
public async unloadBot(min: GBMinInstance): Promise<void> {
GBLog.verbose(`unloadBot called.`);
}
public async onNewSession (min: GBMinInstance, step: GBDialogStep): Promise<void> {
public async onNewSession(min: GBMinInstance, step: GBDialogStep): Promise<void> {
GBLog.verbose(`onNewSession called.`);
}
public async onExchangeData (min: GBMinInstance, kind: string, data: any) {
public async onExchangeData(min: GBMinInstance, kind: string, data: any) {
GBLog.verbose(`onExchangeData called.`);
}
}

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -52,61 +54,58 @@ import {
UpdatedAt
} from 'sequelize-typescript';
import { GuaribasChannel, GuaribasInstance } from '../../core.gbapp/models/GBModel.js';
import { GuaribasSubject } from '../../kb.gbapp/models/index.js';
import { GuaribasUser } from '../../security.gbapp/models/index.js';
import { GuaribasChannel, GuaribasInstance } from '../../core.gbapp/models/GBModel';
import { GuaribasSubject } from '../../kb.gbapp/models';
import { GuaribasUser } from '../../security.gbapp/models';
/**
* A conversation that groups many messages.
*/
@Table
export class GuaribasConversation extends Model<GuaribasConversation> {
@PrimaryKey
@AutoIncrement
@Column(DataType.INTEGER)
declare conversationId: number;
@Column
public conversationId: number;
@ForeignKey(() => GuaribasInstance)
@Column(DataType.INTEGER)
declare instanceId: number;
@Column
public instanceId: number;
@ForeignKey(() => GuaribasSubject)
@Column(DataType.INTEGER)
declare startSubjectId: number;
@Column
public startSubjectId: number;
@BelongsTo(() => GuaribasSubject)
declare startSubject: GuaribasSubject;
public startSubject: GuaribasSubject;
@ForeignKey(() => GuaribasChannel)
@Column(DataType.INTEGER)
declare channelId: string;
@Column
public channelId: string;
@Column(DataType.DATE)
declare rateDate: Date;
@Column public rateDate: Date;
@Column(DataType.FLOAT)
declare rate: number;
@Column
public rate: number;
@Column(DataType.STRING(512))
declare feedback: string;
@Column
public feedback: string;
@Column
@CreatedAt
@Column(DataType.DATE)
declare createdAt: Date;
public createdAt: Date;
@Column(DataType.DATE)
@UpdatedAt
declare updatedAt: Date;
@Column(DataType.STRING(255))
declare text: string;
@Column public text: string;
@ForeignKey(() => GuaribasUser)
@Column(DataType.INTEGER)
declare startedByUserId: number;
@Column
public startedByUserId: number;
@BelongsTo(() => GuaribasUser)
declare startedBy: GuaribasUser;
public startedBy: GuaribasUser;
}
/**
@ -114,43 +113,44 @@ export class GuaribasConversation extends Model<GuaribasConversation> {
*/
@Table
export class GuaribasConversationMessage extends Model<GuaribasConversationMessage> {
@PrimaryKey
@AutoIncrement
@Column(DataType.INTEGER)
declare conversationMessageId: number;
@Column
public conversationMessageId: number;
@ForeignKey(() => GuaribasSubject)
@Column(DataType.INTEGER)
declare subjectId: number;
@Column
public subjectId: number;
@Column(DataType.TEXT)
declare content: string;
public content: string;
@Column(DataType.DATE)
@Column
@CreatedAt
declare createdAt: Date;
public createdAt: Date;
@Column(DataType.DATE)
@Column
@UpdatedAt
declare updatedAt: Date;
public updatedAt: Date;
//tslint:disable-next-line:no-use-before-declare
@ForeignKey(() => GuaribasConversation)
@Column(DataType.INTEGER)
declare conversationId: number;
@Column
public conversationId: number;
//tslint:disable-next-line:no-use-before-declare
@BelongsTo(() => GuaribasConversation)
declare conversation: GuaribasConversation;
public conversation: GuaribasConversation;
@ForeignKey(() => GuaribasInstance)
@Column(DataType.INTEGER)
declare instanceId: number;
@Column
public instanceId: number;
@ForeignKey(() => GuaribasUser)
@Column(DataType.INTEGER)
declare userId: number;
@Column
public userId: number;
@BelongsTo(() => GuaribasUser)
declare user: GuaribasUser;
public user: GuaribasUser;
}

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -33,16 +35,18 @@
*/
import { AzureText } from 'pragmatismo-io-framework';
import { FindOptions } from 'sequelize/types';
import { GBServer } from '../../../src/app.js';
import { GuaribasUser } from '../../security.gbapp/models/index.js';
import { GuaribasConversation, GuaribasConversationMessage } from '../models/index.js';
import { GBServer } from '../../../src/app';
import { GuaribasUser } from '../../security.gbapp/models';
import { GuaribasConversation, GuaribasConversationMessage } from '../models';
/**
* Base services for Bot Analytics.
*/
export class AnalyticsService {
public async createConversation (user: GuaribasUser): Promise<GuaribasConversation> {
public async createConversation(
user: GuaribasUser
): Promise<GuaribasConversation> {
const conversation = new GuaribasConversation();
conversation.startedBy = user;
conversation.startedByUserId = user.userId;
@ -51,24 +55,21 @@ export class AnalyticsService {
return await conversation.save();
}
public async updateConversationSuggestion (
instanceId: number,
conversationId: string,
feedback: string,
locale: string
): Promise<number> {
public async updateConversationSuggestion(instanceId: number,
conversationId: string, feedback: string, locale: string): Promise<number> {
const minBoot = GBServer.globals.minBoot as any;
const rate = await AzureText.getSentiment(
minBoot.instance.textAnalyticsKey ? minBoot.instance.textAnalyticsKey : minBoot.instance.textAnalyticsKey,
minBoot.instance.textAnalyticsEndpoint
? minBoot.instance.textAnalyticsEndpoint
: minBoot.instance.textAnalyticsEndpoint,
minBoot.instance.textAnalyticsKey ? minBoot.instance.textAnalyticsKey :
minBoot.instance.textAnalyticsKey,
minBoot.instance.textAnalyticsEndpoint ? minBoot.instance.textAnalyticsEndpoint :
minBoot.instance.textAnalyticsEndpoint,
locale,
feedback
);
const options = <FindOptions>{ where: {} };
options.where = { conversationId: conversationId, instanceId: instanceId };
const options = { where: { } };
options.where = { conversationId: conversationId, instanceId: instanceId };
const item = await GuaribasConversation.findOne(options);
item.feedback = feedback;
@ -77,20 +78,21 @@ export class AnalyticsService {
await item.save();
return rate;
}
public async createMessage (
public async createMessage(
instanceId: number,
conversationId: number,
conversation: GuaribasConversation,
userId: number,
content: string
): Promise<GuaribasConversationMessage> {
const message = GuaribasConversationMessage.build();
message.content = typeof content === 'object' ? JSON.stringify(content) : content;
message.content = content;
message.instanceId = instanceId;
message.userId = userId;
message.conversationId = conversationId;
message.conversationId = conversation.conversationId;
return await message.save();
}

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -35,22 +37,19 @@
'use strict';
import { GBLog, IGBInstallationDeployer, IGBInstance } from 'botlib';
import fs from 'fs/promises';
import { GBAdminService } from '../../../packages/admin.gbapp/services/GBAdminService.js';
import { GBConfigService } from '../../../packages/core.gbapp/services/GBConfigService.js';
import scanf from 'scanf';
import { AzureDeployerService } from '../services/AzureDeployerService.js';
import { GBLogEx } from '../../core.gbapp/services/GBLogEx.js';
import { GBUtil } from '../../../src/util.js';
import * as fs from 'fs';
import { GBAdminService } from '../../../packages/admin.gbapp/services/GBAdminService';
import { GBConfigService } from '../../../packages/core.gbapp/services/GBConfigService';
const scanf = require('scanf');
/**
* Handles command-line dialog for getting info for Boot Bot.
*/
export class StartDialog {
public static async createBaseInstance (deployer, freeTier) {
public static async createBaseInstance(installationDeployer: IGBInstallationDeployer) {
// No .env so asks for cloud credentials to start a new farm.
if (!await GBUtil.exists(`.env`)) {
if (!fs.existsSync(`.env`)) {
process.stdout.write(
'A empty enviroment is detected. To start automatic deploy, please enter some information:\n'
);
@ -74,16 +73,13 @@ export class StartDialog {
// Connects to the cloud and retrieves subscriptions.
const credentials = await GBAdminService.getADALCredentialsFromUsername(username, password);
const list = await installationDeployer.getSubscriptions(credentials);
let subscriptionId: string;
while (subscriptionId === undefined) {
const list = await (new AzureDeployerService()).getSubscriptions(credentials);
subscriptionId = this.retrieveSubscriptionId(list);
}
const installationDeployer = await AzureDeployerService.createInstanceWithADALCredentials(
deployer, freeTier, subscriptionId, credentials);
let location: string;
while (location === undefined) {
location = this.retrieveLocation();
@ -99,8 +95,12 @@ export class StartDialog {
appPassword = this.retrieveAppPassword();
}
let authoringKey: string;
while (authoringKey === undefined) {
authoringKey = this.retrieveAuthoringKey();
}
// Prepares the first instance on bot farm.
const instance = <IGBInstance>{};
instance.botId = botId;
@ -109,14 +109,15 @@ export class StartDialog {
instance.cloudPassword = password;
instance.cloudSubscriptionId = subscriptionId;
instance.cloudLocation = location;
instance.nlpAuthoringKey = authoringKey;
instance.marketplaceId = appId;
instance.marketplacePassword = appPassword;
instance.adminPass = await GBUtil.hashPassword(GBAdminService.getRndPassword());
instance.adminPass = GBAdminService.getRndPassword();
return { instance, credentials, subscriptionId , installationDeployer};
return { instance, credentials, subscriptionId };
}
private static retrieveUsername () {
private static retrieveUsername() {
let value = GBConfigService.get('CLOUD_USERNAME');
if (value === undefined) {
process.stdout.write(`${GBAdminService.GB_PROMPT}CLOUD_USERNAME:`);
@ -126,7 +127,7 @@ export class StartDialog {
return value;
}
private static retrievePassword () {
private static retrievePassword() {
let password = GBConfigService.get('CLOUD_PASSWORD');
if (password === undefined) {
process.stdout.write(`${GBAdminService.GB_PROMPT}CLOUD_PASSWORD:`);
@ -136,7 +137,7 @@ export class StartDialog {
return password;
}
private static retrieveBotId () {
private static retrieveBotId() {
let botId = GBConfigService.get('BOT_ID');
if (botId === undefined) {
process.stdout.write(
@ -151,11 +152,26 @@ cannot start or end with or contain consecutive dashes and having 4 to 42 charac
return botId;
}
/**
*
* Update Manifest in Azure: "signInAudience": "AzureADandPersonalMicrosoftAccount" and "accessTokenAcceptedVersion": 2.
*/
private static retrieveAppId () {
private static retrieveAuthoringKey() {
let authoringKey = GBConfigService.get('NLP_AUTHORING_KEY');
if (authoringKey === undefined) {
process.stdout.write(
`${
GBAdminService.GB_PROMPT
}Due to this opened issue: https://github.com/Microsoft/botbuilder-tools/issues/550\n`
);
process.stdout.write(
`${
GBAdminService.GB_PROMPT
}Please enter your LUIS Authoring Key, get it here: https://www.luis.ai/user/settings and paste it to me:`
);
authoringKey = scanf('%s').replace(/(\n|\r)+$/, '');
}
return authoringKey;
}
private static retrieveAppId() {
let appId = GBConfigService.get('MARKETPLACE_ID');
if (appId === undefined) {
process.stdout.write(
@ -163,7 +179,6 @@ cannot start or end with or contain consecutive dashes and having 4 to 42 charac
please go to https://apps.dev.microsoft.com/portal/register-app to
generate manually an App ID and App Secret.\n`
);
process.stdout.write('Generated Application Id (MARKETPLACE_ID):');
appId = scanf('%s').replace(/(\n|\r)+$/, '');
}
@ -171,7 +186,7 @@ generate manually an App ID and App Secret.\n`
return appId;
}
private static retrieveAppPassword () {
private static retrieveAppPassword() {
let appPassword = GBConfigService.get('MARKETPLACE_SECRET');
if (appPassword === undefined) {
process.stdout.write('Generated Password (MARKETPLACE_SECRET):');
@ -181,16 +196,12 @@ generate manually an App ID and App Secret.\n`
return appPassword;
}
private static retrieveSubscriptionId (list) {
private static retrieveSubscriptionId(list) {
let subscriptionId = GBConfigService.get('CLOUD_SUBSCRIPTIONID');
if (subscriptionId){
return subscriptionId;
}
const map = {};
let index = 1;
list.forEach(element => {
GBLogEx.info(0, `${index}: ${element.displayName} (${element.subscriptionId})`);
GBLog.info(`${index}: ${element.displayName} (${element.subscriptionId})`);
map[index++] = element;
});
let subscriptionIndex;
@ -203,7 +214,7 @@ generate manually an App ID and App Secret.\n`
return subscriptionId;
}
private static retrieveLocation () {
private static retrieveLocation() {
let location = GBConfigService.get('CLOUD_LOCATION');
if (location === undefined) {
process.stdout.write('CLOUD_LOCATION (eg. westus):');

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -41,26 +43,27 @@ import { Sequelize } from 'sequelize-typescript';
* Package for Azure Deployer.
*/
export class GBAzureDeployerPackage implements IGBPackage {
public sysPackages: IGBPackage[];
public async getDialogs (min: GBMinInstance) {
public sysPackages: IGBPackage[];
public async getDialogs(min: GBMinInstance) {
GBLog.verbose(`getDialogs called.`);
}
public async loadPackage (core: IGBCoreService, sequelize: Sequelize): Promise<void> {
public async loadPackage(core: IGBCoreService, sequelize: Sequelize): Promise<void> {
GBLog.verbose(`loadPackage called.`);
}
public async unloadPackage (core: IGBCoreService): Promise<void> {
public async unloadPackage(core: IGBCoreService): Promise<void> {
GBLog.verbose(`unloadPackage called.`);
}
public async loadBot (min: GBMinInstance): Promise<void> {
public async loadBot(min: GBMinInstance): Promise<void> {
GBLog.verbose(`loadBot called.`);
}
public async unloadBot (min: GBMinInstance): Promise<void> {
public async unloadBot(min: GBMinInstance): Promise<void> {
GBLog.verbose(`unloadBot called.`);
}
public async onNewSession (min: GBMinInstance, step: GBDialogStep): Promise<void> {
public async onNewSession(min: GBMinInstance, step: GBDialogStep): Promise<void> {
GBLog.verbose(`onNewSession called.`);
}
public async onExchangeData (min: GBMinInstance, kind: string, data: any) {
public async onExchangeData(min: GBMinInstance, kind: string, data: any) {
GBLog.verbose(`onExchangeData called.`);
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
export const Messages = {
'en-US': {
about_suggestions: 'Suggestions are welcomed and improve my quality...'
about_suggestions: 'Suggestions are welcomed and improve my quality...'
},
'pt-BR': {
about_suggestions: 'Sugestões melhoram muito minha qualidade...'

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -35,62 +37,16 @@
'use strict';
import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
import { GuaribasSchedule } from '../core.gbapp/models/GBModel.js';
import { GuaribasSchedule } from '../core.gbapp/models/GBModel';
import { Sequelize } from 'sequelize-typescript';
import Koa from 'koa';
import cors from '@koa/cors';
import { createKoaHttpMiddleware } from '@push-rpc/http';
import { GBServer } from '../../src/app.js';
import { SocketServer } from '@push-rpc/core';
import * as koaBody from 'koa-body';
import ratelimit from 'koa-ratelimit';
export function createKoaHttpServer(port: number, getRemoteId: (ctx: Koa.Context) => string, opts: {}): SocketServer {
const { onError, onConnection, middleware } = createKoaHttpMiddleware(getRemoteId);
const app = new Koa();
// Apply the rate-limiting middleware
app.use(
ratelimit({
driver: 'memory', // Use 'memory' for in-memory store
duration: 60000, // 1 minute window
errorMessage: 'Slow down your requests',
id: ctx => ctx.ip, // Identify client by IP address
headers: {
remaining: 'X-RateLimit-Remaining',
reset: 'X-RateLimit-Reset',
total: 'X-RateLimit-Limit'
},
max: 100, // Limit each IP to 100 requests per window
disableHeader: false
})
);
app.use(cors({ origin: '*' }));
app.use(koaBody.koaBody({ jsonLimit: '1024mb', textLimit: '1024mb', formLimit: '1024mb', multipart: true }));
app.use(middleware);
const server = app.listen(port);
const SERVER_TIMEOUT = 60 * 60 * 24 * 1000; // Equals to client RPC set.
server.timeout = SERVER_TIMEOUT;
return {
onError,
onConnection,
close(cb) {
server.close(cb);
}
};
}
/**
* Package for core.gbapp.
*/
export class GBBasicPackage implements IGBPackage {
public sysPackages: IGBPackage[];
public CurrentEngineName = 'guaribas-1.0.0';
public CurrentEngineName = "guaribas-1.0.0";
public async loadPackage(core: IGBCoreService, sequelize: Sequelize): Promise<void> {
core.sequelize.addModels([GuaribasSchedule]);
}
@ -111,14 +67,6 @@ export class GBBasicPackage implements IGBPackage {
GBLog.verbose(`onExchangeData called.`);
}
public async loadBot(min: GBMinInstance): Promise<void> {
const botId = min.botId;
GBServer.globals.debuggers[botId] = {};
GBServer.globals.debuggers[botId].state = 0;
GBServer.globals.debuggers[botId].breaks = [];
GBServer.globals.debuggers[botId].stateInfo = 'Stopped';
GBServer.globals.debuggers[botId].childProcess = null;
GBServer.globals.debuggers[botId].client = null;
GBServer.globals.debuggers[botId].conversationId = null;
GBServer.globals.debuggers[botId].watermarkMap = {};
}
}

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -47,29 +49,30 @@ import {
UpdatedAt
} from 'sequelize-typescript';
import { GuaribasInstance } from '../../core.gbapp/models/GBModel.js';
import { GuaribasInstance } from '../../core.gbapp/models/GBModel';
@Table
//tslint:disable-next-line:max-classes-per-file
export class GuaribasSchedule extends Model<GuaribasSchedule> {
@Column(DataType.STRING(255))
name: string;
@Column(DataType.STRING(255))
schedule: string;
@Column
public name: string;
@Column
public schedule: string;
@ForeignKey(() => GuaribasInstance)
@Column(DataType.INTEGER)
instanceId: number;
@Column
public instanceId: number;
@BelongsTo(() => GuaribasInstance)
instance: GuaribasInstance;
public instance: GuaribasInstance;
@Column(DataType.DATE)
@Column
@CreatedAt
declare createdAt: Date;
public createdAt: Date;
@Column(DataType.DATE)
@Column
@UpdatedAt
declare updatedAt: Date;
public updatedAt: Date;
}

View file

@ -1,61 +0,0 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| |
| General Bots Copyright (c) pragmatismo.com.br. 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.com.br. |
| 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. |
| |
\*****************************************************************************/
'use strict';
import { GBSSR }from '../../core.gbapp/services/GBSSR.js';
export class ChartServices {
/**
* Generate chart image screenshot
* @param {object} options billboard.js generation option object
* @param {string} path screenshot image full path with file name
*/
public static async screenshot (args, path) {
const browser = await GBSSR.createBrowser(null);
const page = await browser.newPage();
// load billboard.js assets from CDN.
await page.addStyleTag({ url: 'https://cdn.jsdelivr.net/npm/billboard.js/dist/theme/datalab.min.css' });
await page.addScriptTag({ url: 'https://cdn.jsdelivr.net/npm/billboard.js/dist/billboard.pkgd.min.js' });
await page.evaluate(`bb.generate(${JSON.stringify(args)});`);
const content = await page.$('.bb');
await content.screenshot({
path,
omitBackground: true
});
await page.close();
await browser.close();
}
}

View file

@ -1,216 +0,0 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| |
| General Bots Copyright (c) pragmatismo.com.br. 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.com.br. |
| 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. |
| |
\*****************************************************************************/
'use strict';
import { GBLog, GBMinInstance } from 'botlib';
import { GBServer } from '../../../src/app.js';
import fs from 'fs/promises';
import SwaggerClient from 'swagger-client';
import { spawn } from 'child_process';
import { CodeServices } from '../../llm.gblib/services/CodeServices.js';
import { GBLogEx } from '../../core.gbapp/services/GBLogEx.js';
import { GBUtil } from '../../../src/util.js';
/**
* Web Automation services of conversation to be called by BASIC.
*/
export class DebuggerService {
public async setBreakpoint({ botId, line }) {
GBLogEx.info(botId, `Enabled breakpoint for ${botId} on ${line}.`);
GBServer.globals.debuggers[botId].breaks.push(Number.parseInt(line));
}
public async refactor({ botId, code, change }) {
const service = new CodeServices();
return await service.refactor(code, change);
}
public async resume({ botId }) {
if (GBServer.globals.debuggers[botId].state === 2) {
const client = GBServer.globals.debuggers[botId].client;
await client.Debugger.resume();
GBServer.globals.debuggers[botId].state = 1;
GBServer.globals.debuggers[botId].stateInfo = 'Running (Debug)';
return { status: 'OK' };
} else {
const error = 'Invalid call to resume and state not being debug(2).';
return { error: error };
}
}
public async stop({ botId }) {
GBServer.globals.debuggers[botId].state = 0;
GBServer.globals.debuggers[botId].stateInfo = 'Stopped';
const kill = ref => {
spawn('sh', ['-c', `pkill -9 -f ${ref}`]);
};
kill(GBServer.globals.debuggers[botId].childProcess);
return { status: 'OK' };
}
public async step({ botId }) {
if (GBServer.globals.debuggers[botId].state === 2) {
GBServer.globals.debuggers[botId].stateInfo = 'Break';
const client = GBServer.globals.debuggers[botId].client;
await client.Debugger.stepOver();
return { status: 'OK' };
} else {
const error = 'Invalid call to stepOver and state not being debug(2).';
return { error: error };
}
}
public async getContext({ botId }) {
const conversationsMap = GBServer.globals.debuggers[botId].conversationsMap;
const watermarkMap = GBServer.globals.debuggers[botId].watermarkMap;
const conversationId = conversationsMap[botId];
let messages = [];
const client = GBServer.globals.debuggers[botId].client;
if (client) {
const response = await client.apis.Conversations.Conversations_GetActivities({
conversationId: conversationId,
watermark: watermarkMap[botId]
});
watermarkMap[botId] = response.obj.watermark;
let activities = response.obj.activites;
if (activities && activities.length) {
activities = activities.filter(m => m.from.id === botId && m.type === 'message');
if (activities.length) {
activities.forEach(activity => {
messages.push({ text: activity.text });
GBLogEx.info(botId, `Debugger sending text to API: ${activity.text}`);
});
}
}
}
let messagesText = messages.join('\n');
return {
status: 'OK',
state: GBServer.globals.debuggers[botId].state,
messages: messagesText,
scope: GBServer.globals.debuggers[botId].scope,
scopeInfo: GBServer.globals.debuggers[botId].stateInfo
};
}
public async start({ botId, botApiKey, scriptName }) {
const conversationsMap = GBServer.globals.debuggers[botId].conversationsMap;
let error;
if (!GBServer.globals.debuggers[botId]) {
GBServer.globals.debuggers[botId] = {};
}
if (!scriptName) {
scriptName = 'start';
}
if (GBServer.globals.debuggers[botId].state === 1) {
error = `Cannot DEBUG an already running process. ${botId}`;
return { error: error };
} else if (GBServer.globals.debuggers[botId].state === 2) {
GBLogEx.info(botId, `Releasing execution ${botId} in DEBUG mode.`);
await this.resume({ botId });
return { status: 'OK' };
} else {
GBLogEx.info(botId, `Running ${botId} in DEBUG mode.`);
GBServer.globals.debuggers[botId].state = 1;
GBServer.globals.debuggers[botId].stateInfo = 'Running (Debug)';
let min: GBMinInstance = GBServer.globals.minInstances.filter(p => p.instance.botId === botId)[0];
const client = await GBUtil.getDirectLineClient(min);
GBServer.globals.debuggers[botId].client = client;
const response = await client.apis.Conversations.Conversations_StartConversation();
const conversationId = response.obj.conversationId;
GBServer.globals.debuggers[botId].conversationId = conversationId;
client.apis.Conversations.Conversations_PostActivity({
conversationId: conversationId,
activity: {
textFormat: 'plain',
text: `/calldbg ${scriptName}`,
type: 'message',
from: {
id: 'word',
name: 'word'
}
}
});
return { status: 'OK' };
}
}
public async sendMessage({ botId, botApiKey, text }) {
const conversationsMap = GBServer.globals.debuggers[botId].conversationsMap;
let error;
if (!GBServer.globals.debuggers[botId]) {
GBServer.globals.debuggers[botId] = {};
}
if (GBServer.globals.debuggers[botId].state != 1) {
error = `Cannot sendMessage to an stopped process. ${botId}`;
return { error: error };
}
let min: GBMinInstance = GBServer.globals.minInstances.filter(p => p.instance.botId === botId)[0];
const client = GBServer.globals.debuggers[botId].client;
const conversationId = GBServer.globals.debuggers[botId].conversationId;
client.apis.Conversations.Conversations_PostActivity({
conversationId: conversationId,
activity: {
textFormat: 'plain',
text: text,
type: 'message',
from: {
id: 'word',
name: 'word'
}
}
});
return { status: 'OK' };
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,182 +0,0 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| |
| General Bots Copyright (c) pragmatismo.com.br. 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.com.br. |
| 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. |
| |
\*****************************************************************************/
'use strict';
import path from 'path';
import { GBLog, GBMinInstance } from 'botlib';
import { DialogKeywords } from './DialogKeywords.js';
import { CollectionUtil } from 'pragmatismo-io-framework';
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService.js';
import urlJoin from 'url-join';
import { GBServer } from '../../../src/app.js';
import { GBLogEx } from '../../core.gbapp/services/GBLogEx.js';
import { GBUtil } from '../../../src/util.js';
import fs from 'fs/promises';
import { AzureOpenAI } from 'openai';
import { OpenAIClient } from '@langchain/openai';
/**
* Image processing services of conversation to be called by BASIC.
*/
export class ImageProcessingServices {
/**
* Sharpen the image.
*
* @example file = SHARPEN file
*/
public async sharpen({ pid, file: file }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
GBLogEx.info(min, `Image Processing SHARPEN ${file}.`);
const gbfile = DialogKeywords.getFileByHandle(file);
// TODO: sharp.
return;
}
/**
* SET ORIENTATION VERTICAL
*
* file = MERGE file1, file2, file3
*/
public async mergeImage({ pid, files }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
let paths = [];
await CollectionUtil.asyncForEach(files, async file => {
const gbfile = DialogKeywords.getFileByHandle(file);
paths.push(gbfile.path);
});
const botId = min.instance.botId;
const packagePath = GBUtil.getGBAIPath(min.botId);
// TODO: const img = await joinImages(paths);
const localName = path.join(
'work',
packagePath,
'cache',
`img-mrg${GBAdminService.getRndReadableIdentifier()}.png`
);
const url = urlJoin(GBServer.globals.publicAddress, min.botId, 'cache', path.basename(localName));
// img.toFile(localName);
return { localName: localName, url: url, data: null };
}
/**
* Sharpen the image.
*
* @example file = BLUR file
*/
public async blur({ pid, file: file }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
GBLogEx.info(min, `Image Processing SHARPEN ${file}.`);
const gbfile = DialogKeywords.getFileByHandle(file);
return;
}
public async getImageFromPrompt({ pid, prompt }) {
const { min, user, params } = await DialogKeywords.getProcessInfo(pid);
GBLogEx.info(min, `DALL-E: ${prompt}.`);
const azureOpenAIKey = await min.core.getParam(min.instance, 'Azure Open AI Key', null, true);
const azureOpenAIEndpoint = await min.core.getParam(min.instance, 'Azure Open AI Endpoint', null, true);
const azureOpenAIVersion = await (min.core as any)['getParam'](min.instance, 'Azure Open AI Version', null, true);
const azureOpenAIImageModel = await (min.core as any)['getParam'](min.instance, 'Azure Open AI Image Model', null, true);
if (azureOpenAIKey) {
// Initialize the Azure OpenAI client
const client = new AzureOpenAI({
endpoint: azureOpenAIEndpoint,
deployment: azureOpenAIImageModel,
apiVersion: azureOpenAIVersion,
apiKey: azureOpenAIKey
});
// Make a request to the image generation endpoint
const response = await client.images.generate({
prompt: prompt,
n: 1, // Don't include for DALL-E 3 (always generates 1 image)
style: 'vivid', // optional ('natural' or 'vivid')
size: '1024x1024',
quality: 'standard', // optional
});
const gbaiName = GBUtil.getGBAIPath(min.botId);
const localName = path.join('work', gbaiName, 'cache', `DALL-E${GBAdminService.getRndReadableIdentifier()}.png`);
const url = response.data[0].url;
const res = await fetch(url);
let buf: any = Buffer.from(await res.arrayBuffer());
await fs.writeFile(localName, buf, { encoding: null });
GBLogEx.info(min, `DALL-E: ${url} - ${response.data[0].revised_prompt}.`);
return { localName, url };
}
}
public async getCaptionForImage({ pid, imageUrl }) {
const { min, user, params } = await DialogKeywords.getProcessInfo(pid);
const azureOpenAIKey = await min.core.getParam(min.instance, 'Azure Open AI Key', null);
const azureOpenAITextModel = 'gpt-4'; // Specify GPT-4 model here
const azureOpenAIEndpoint = await min.core.getParam(min.instance, 'Azure Open AI Endpoint', null);
const azureOpenAIVersion = await (min.core as any)['getParam'](min.instance, 'Azure Open AI Version', null, true);
if (azureOpenAIKey && azureOpenAITextModel && imageUrl) {
const client = new AzureOpenAI({
apiVersion: azureOpenAIVersion,
apiKey: azureOpenAIKey,
baseURL: azureOpenAIEndpoint
});
const prompt = `Provide a descriptive caption for the image at the following URL: ${imageUrl}`;
const response = await client.completions.create({
model: azureOpenAITextModel,
prompt: prompt,
max_tokens: 50
});
const caption = response['data'].choices[0].text.trim();
GBLogEx.info(min, `Generated caption: ${caption}`);
return { caption };
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,171 +0,0 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| |
| General Bots Copyright (c) pragmatismo.com.br. 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.com.br. |
| 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. |
| |
\*****************************************************************************/
'use strict';
import { GBLog, GBMinInstance, GBService } from 'botlib';
import { GBServer } from '../../../src/app.js';
import { CollectionUtil } from 'pragmatismo-io-framework';
import { GBVMService } from '../../basic.gblib/services/GBVMService.js';
import { GuaribasSchedule } from '../../core.gbapp/models/GBModel.js';
import cron from 'node-cron';
import { GBLogEx } from '../../core.gbapp/services/GBLogEx.js';
/**
* @fileoverview Schedule Services.
*/
/**
* Basic services for BASIC manipulation.
*/
export class ScheduleServices extends GBService {
public async deleteScheduleIfAny(min: GBMinInstance, name: string) {
let i = 1;
while (i <= 10) {
const task = min['scheduleMap'] ? min['scheduleMap'][name + i] : null;
if (task) {
task.destroy();
}
const id = `${name};${i}`;
delete min['scheduleMap'][id];
const count = await GuaribasSchedule.destroy({
where: {
instanceId: min.instance.instanceId,
name: id
}
});
if (count > 0) {
GBLogEx.info(min, `Removed ${name} SET SCHEDULE and ${count} rows from storage on: ${min.botId}...`);
}
i++;
}
}
/**
* Finds and update user agent information to a next available person.
*/
public async createOrUpdateSchedule(min: GBMinInstance, schedule: string, name: string): Promise<GuaribasSchedule> {
let record = await GuaribasSchedule.findOne({
where: {
instanceId: min.instance.instanceId,
name: name
}
});
if (record === null) {
record = await GuaribasSchedule.create(<GuaribasSchedule>{
instanceId: min.instance.instanceId,
name: name,
schedule: schedule
});
} else {
record.schedule = schedule;
await record.save();
}
this.ScheduleItem(record, min);
return record;
}
/**
* Load all cached schedule from BASIC SET SCHEDULE keyword.
*/
public async scheduleAll() {
let schedules;
try {
schedules = await GuaribasSchedule.findAll();
let i = 0;
let lastName = '';
await CollectionUtil.asyncForEach(schedules, async item => {
if (item.name === lastName) {
item.name = item.name + ++i;
} else {
i = 0;
}
let min: GBMinInstance = GBServer.globals.minInstances.filter(
p => p.instance.instanceId === item.instanceId
)[0];
if (min) {
this.ScheduleItem(item, min);
}
});
} catch (error) {
throw new Error(`Cannot schedule: ${error.message}.`);
}
return schedules;
}
private ScheduleItem(item: GuaribasSchedule, min: GBMinInstance) {
GBLogEx.info(min, `Scheduling ${item.name} on ${min.botId}...`);
try {
const options = {
scheduled: true,
timezone: 'America/Sao_Paulo'
};
const task = min['scheduleMap'][item.name];
if (task) {
task.stop();
min['scheduleMap'][item.name] = null;
}
min['scheduleMap'][item.name] = cron.schedule(
item.schedule,
function () {
const finalData = async () => {
let script = item.name.split(';')[0];
let min: GBMinInstance = GBServer.globals.minInstances.filter(
p => p.instance.instanceId === item.instanceId
)[0];
GBLogEx.info(min, `Running .gbdialog word ${item.name} on:${item.schedule}...`);
const pid = GBVMService.createProcessInfo(null, min, 'batch', null);
await GBVMService.callVM(script, min, null, pid);
};
(async () => {
await finalData();
})();
},
options
);
} catch (error) {
GBLogEx.error(min, `Running .gbdialog word ${item.name} : ${error}...`);
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,103 @@
/*****************************************************************************\
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| 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 General Bots server core.
*/
'use strict';
import { GBLog } from 'botlib';
import * as ts from 'typescript';
/**
* Wrapper for a TypeScript compiler.
*/
export class TSCompiler {
private static shouldIgnoreError(diagnostic) {
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
if (message.indexOf('Cannot find name') >= 0
|| message.indexOf('Cannot find module') >= 0
|| message.indexOf('implicitly has an') >= 0
|| message.indexOf('Cannot invoke an') >= 0
|| message.indexOf('Cannot use imports, exports, or module') >= 0
) {
return true;
}
return false;
}
public compile(
fileNames: string[],
options: ts.CompilerOptions = {
noStrictGenericChecks: true,
noImplicitUseStrict: true,
noEmitOnError: false,
noImplicitAny: true,
target: ts.ScriptTarget.ES5,
module: ts.ModuleKind.None,
moduleResolution: ts.ModuleResolutionKind.Classic,
noEmitHelpers: true,
maxNodeModuleJsDepth: 0,
esModuleInterop: false
}
) {
const program = ts.createProgram(fileNames, options);
const emitResult = program.emit();
const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
allDiagnostics.forEach(diagnostic => {
if (!TSCompiler.shouldIgnoreError(diagnostic)) {
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
if (diagnostic.file !== undefined) {
if (
diagnostic.file.fileName.indexOf('readable-stream') == -1 &&
diagnostic.file.fileName.indexOf('request-promise') == -1
) {
const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
GBLog.error(`BASIC error: ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
}
} else {
GBLog.error(`BASIC error: ${message}`);
}
}
});
return emitResult;
}
}

View file

@ -1,504 +0,0 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| |
| General Bots Copyright (c) pragmatismo.com.br. 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.com.br. |
| 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. |
| |
\*****************************************************************************/
'use strict';
import urlJoin from 'url-join';
import fs from 'fs/promises';
import path from 'path';
import url from 'url';
import { GBLog } from 'botlib';
import { GBServer } from '../../../src/app.js';
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService.js';
import { GBSSR } from '../../core.gbapp/services/GBSSR.js';
import { DialogKeywords } from './DialogKeywords.js';
import { GBDeployer } from '../../core.gbapp/services/GBDeployer.js';
import { Mutex } from 'async-mutex';
import { GBLogEx } from '../../core.gbapp/services/GBLogEx.js';
import { SystemKeywords } from './SystemKeywords.js';
import { GBUtil } from '../../../src/util.js';
/**
* Web Automation services of conversation to be called by BASIC.
*/
export class WebAutomationServices {
static isSelector(name: any) {
return name.startsWith('.') || name.startsWith('#') || name.startsWith('[');
}
public static cyrb53 ({pid, str, seed = 0}) {
let h1 = 0xdeadbeef ^ seed,
h2 = 0x41c6ce57 ^ seed;
for (let i = 0, ch; i < str.length; i++) {
ch = str.charCodeAt(i);
h1 = Math.imul(h1 ^ ch, 2654435761);
h2 = Math.imul(h2 ^ ch, 1597334677);
}
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
};
public async closeHandles({ pid }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
await DialogKeywords.setOption({ pid, name: "filter", value: null });
// Releases previous allocated OPEN semaphores.
let keys = Object.keys(GBServer.globals.webSessions);
for (let i = 0; i < keys.length; i++) {
const session = GBServer.globals.webSessions[keys[i]];
if (session.activePid === pid) {
session.semaphore.release();
GBLogEx.info(min, `Release for PID: ${pid} done.`);
}
}
}
/**
* Returns the page object.
*
* @example OPEN "https://wikipedia.org"
*/
public async openPage({ pid, handle, sessionKind, sessionName, url, username, password }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
GBLogEx.info(min, `Web Automation OPEN ${sessionName ? sessionName : ''} ${url}.`);
// Try to find an existing handle.
let session;
if (handle) {
session = GBServer.globals.webSessions[handle];
}
else if (sessionName) {
let keys = Object.keys(GBServer.globals.webSessions);
for (let i = 0; i < keys.length; i++) {
if (GBServer.globals.webSessions[keys[i]].sessionName === sessionName) {
session = GBServer.globals.webSessions[keys[i]];
handle = keys[i];
break;
}
}
}
let page;
if (session) {
page = session.page;
// Semaphore logic to block multiple entries on the same session.
if (sessionName) {
GBLogEx.info(min, `Acquiring (1) for PID: ${pid}...`);
const release = await session.semaphore.acquire();
GBLogEx.info(min, `Acquire (1) for PID: ${pid} done.`);
try {
session.activePid = pid;
session.release = release;
} catch {
release();
}
}
}
// Creates the page if it is the first time.
let browser;
if (!page) {
browser = await GBSSR.createBrowser(null);
page = (await browser.pages())[0];
if (username || password) {
await page.authenticate({ pid, username: username, password: password });
}
}
// There is no session yet or it is an unamed session.
if ((!session && sessionKind === 'AS') || !sessionName) {
// A new web session is being created.
handle = WebAutomationServices.cyrb53({pid, str:min.botId + url});
session = {};
session.sessionName = sessionName;
session.page = page;
session.browser = browser;
session.semaphore = new Mutex();
session.activePid = pid;
GBServer.globals.webSessions[handle] = session;
// Only uses semaphore logic in named web sessions.
if (sessionName) {
GBLogEx.info(min, `Acquiring (2) for PID: ${pid}...`);
const release = await session.semaphore.acquire();
session.release = release;
GBLogEx.info(min, `Acquire (2) for PID: ${pid} done.`);
}
}
// WITH is only valid in a previously defined session.
if (!session && sessionKind == 'WITH') {
const error = `NULL session for OPEN WITH #${sessionName}.`;
GBLogEx.error(min, error);
}
await page.goto(url);
return handle;
}
public static getPageByHandle(handle) {
return GBServer.globals.webSessions[handle].page;
}
/**
* Find element on page DOM.
*
* @example GET "selector"
*/
public async getBySelector({ handle, selector, pid }) {
const page = WebAutomationServices.getPageByHandle(handle);
const { min, user } = await DialogKeywords.getProcessInfo(pid);
GBLogEx.info(min, `Web Automation GET element: ${selector}.`);
await page.waitForSelector(selector);
let elements = await page.$$(selector);
if (elements && elements.length > 1) {
return elements;
} else {
const el = elements[0];
el['originalSelector'] = selector;
el['href'] = await page.evaluate(e => e.getAttribute('href'), el);
el['value'] = await page.evaluate(e => e.getAttribute('value'), el);
el['name'] = await page.evaluate(e => e.getAttribute('name'), el);
el['class'] = await page.evaluate(e => e.getAttribute('class'), el);
return el;
}
}
/**
* Find element on page DOM.
*
* @example GET page,"frameSelector,"elementSelector"
*/
public async getByFrame({pid, handle, frame, selector }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
const page = WebAutomationServices.getPageByHandle(handle);
GBLogEx.info(min, `Web Automation GET element by frame: ${selector}.`);
await page.waitForSelector(frame);
let frameHandle = await page.$(frame);
const f = await frameHandle.contentFrame();
await f.waitForSelector(selector);
const element = await f.$(selector);
element['originalSelector'] = selector;
element['href'] = await f.evaluate(e => e.getAttribute('href'), element);
element['value'] = await f.evaluate(e => e.getAttribute('value'), element);
element['name'] = await f.evaluate(e => e.getAttribute('name'), element);
element['class'] = await f.evaluate(e => e.getAttribute('class'), element);
element['frame'] = f;
return element;
}
/**
* Simulates a mouse hover an web page element.
*/
public async hover({ pid, handle, selector }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
const page = WebAutomationServices.getPageByHandle(handle);
GBLogEx.info(min, `Web Automation HOVER element: ${selector}.`);
await this.getBySelector({ handle, selector: selector, pid });
await page.hover(selector);
await this.debugStepWeb(pid, page);
}
/**
* Clicks on an element in a web page.
*
* @example CLICK "#idElement"
*/
public async click({ pid, handle, frameOrSelector, selector }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
const page = WebAutomationServices.getPageByHandle(handle);
GBLogEx.info(min, `Web Automation CLICK element: ${frameOrSelector}.`);
if (selector) {
await page.waitForSelector(frameOrSelector);
let frameHandle = await page.$(frameOrSelector);
const f = await frameHandle.contentFrame();
await f.waitForSelector(selector);
await f.click(selector);
} else {
await page.waitForSelector(frameOrSelector);
await page.click(frameOrSelector);
}
await this.debugStepWeb(pid, page);
}
private async debugStepWeb(pid, page) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
let debugWeb, lastDebugWeb; // TODO: Add this to pid bag.
let refresh = true;
if (lastDebugWeb) {
refresh = new Date().getTime() - lastDebugWeb.getTime() > 5000;
}
if (debugWeb && refresh) {
const mobile = min.core.getParam(min.instance, 'Bot Admin Number', null);
const filename = page;
if (mobile) {
await new DialogKeywords().sendFileTo({ pid: pid, mobile, filename, caption: 'General Bots Debugger' });
}
lastDebugWeb = new Date();
}
}
/**
* Press ENTER in a web page,useful for logins.
*
* @example PRESS ENTER ON page
*/
public async pressKey({pid, handle, char, frame }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
const page = WebAutomationServices.getPageByHandle(handle);
GBLogEx.info(min, `Web Automation PRESS ${char} ON element: ${frame}.`);
if (char.toLowerCase() === 'enter') {
char = '\n';
}
if (frame) {
await page.waitForSelector(frame);
let frameHandle = await page.$(frame);
const f = await frameHandle.contentFrame();
await f.keyboard.press(char);
} else {
await page.keyboard.press(char);
}
}
public async linkByText({ pid, handle, text, index }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
const page = WebAutomationServices.getPageByHandle(handle);
GBLogEx.info(min, `Web Automation CLICK LINK TEXT: ${text} ${index}.`);
if (!index) {
index = 1;
}
const els = await page.$x(`//a[contains(.,'${text}')]`);
await els[index - 1].click();
await this.debugStepWeb(pid, page);
}
public async clickButton({ pid, handle, text, index }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
const page = WebAutomationServices.getPageByHandle(handle);
GBLogEx.info(min, `Web Automation CLICK BUTTON: ${text} ${index}.`);
if (!index) {
index = 1;
}
const els = await page.$x(`//button[contains(.,'${text}')]`);
await els[index - 1].click();
await this.debugStepWeb(pid, page);
}
/**
* Returns the screenshot of page or element
*
* @example file = SCREENSHOT "#selector"
*/
public async screenshot({ pid, handle, selector }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
const page = WebAutomationServices.getPageByHandle(handle);
GBLogEx.info(min, `Web Automation SCREENSHOT ${selector}.`);
const gbaiName = GBUtil.getGBAIPath(min.botId);
const localName = path.join('work', gbaiName, 'cache', `screen-${GBAdminService.getRndReadableIdentifier()}.jpg`);
await page.screenshot({ path: localName });
const url = urlJoin(GBServer.globals.publicAddress, min.botId, 'cache', path.basename(localName));
GBLogEx.info(min, `WebAutomation: Screenshot captured at ${url}.`);
return { data: null, localName: localName, url: url };
}
/**
* Types the text into the text field.
*
* @example SET page,"selector","text"
*/
public async setElementText({ pid, handle, selector, text }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
text = `${text}`;
const page = WebAutomationServices.getPageByHandle(handle);
GBLogEx.info(min, `Web Automation TYPE on ${selector}: ${text}.`);
const e = await this.getBySelector({ handle, selector, pid });
await e.click({ clickCount: 3 });
await page.keyboard.press('Backspace');
await e.type(text, { delay: 200 });
await this.debugStepWeb(pid, page);
}
/**
* Performs the download to the .gbdrive Download folder.
*
* @example file = DOWNLOAD element, folder
*/
public async download({ pid, handle, selector, folder }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
const page = WebAutomationServices.getPageByHandle(handle);
const element = await this.getBySelector({ handle, selector, pid });
// https://github.com/GeneralBots/BotServer/issues/311
const container = element['_frame'] ? element['_frame'] : element['_page'];
await page.setRequestInterception(true);
await container.click(element.originalSelector);
const xRequest = await new Promise(resolve => {
page.on('request', interceptedRequest => {
interceptedRequest.abort(); //stop intercepting requests
resolve(interceptedRequest);
});
});
const options = {
encoding: null,
method: xRequest['._method'],
uri: xRequest['_url'],
body: xRequest['_postData'],
headers: xRequest['_headers']
};
const cookies = await page.cookies();
options.headers.Cookie = cookies.map(ck => ck.name + '=' + ck.value).join(';');
GBLogEx.info(min, `DOWNLOADING '${options.uri}...'`);
let local;
let filename;
if (options.uri.indexOf('file://') != -1) {
local = url.fileURLToPath(options.uri);
filename = path.basename(local);
} else {
const getBasenameFormUrl = urlStr => {
const url = new URL(urlStr);
return path.basename(url.pathname);
};
filename = getBasenameFormUrl(options.uri);
}
let result: Buffer;
if (local) {
result = await fs.readFile(local);
} else {
const res = await fetch(options.uri, options);
result = Buffer.from(await res.arrayBuffer());
}
let { baseUrl, client } = await GBDeployer.internalGetDriveClient(min);
const botId = min.instance.botId;
// Normalizes all slashes.
folder = folder.replace(/\\/gi, '/');
// Determines full path at source and destination.
const packagePath = GBUtil.getGBAIPath(min.botId, `gbdrive`);
const root = packagePath;
const dstPath = urlJoin(root, folder, filename);
// Checks if the destination contains subfolders that
// need to be created.
folder = await new SystemKeywords().createFolder(folder);
// Performs the conversion operation getting a reference
// to the source and calling /content on drive API.
let file;
try {
file = await client.api(`${baseUrl}/drive/root:/${dstPath}:/content`).put(result);
} catch (error) {
if (error.code === 'nameAlreadyExists') {
GBLogEx.info(min, `DOWNLOAD destination file already exists: ${dstPath}.`);
}
throw error;
}
return file;
}
private async recursiveFindInFrames(inputFrame, selector) {
const frames = inputFrame.childFrames();
const results = await Promise.all(
frames.map(async frame => {
const el = await frame.$(selector);
if (el) return el;
if (frame.childFrames().length > 0) {
return await this.recursiveFindInFrames(frame, selector);
}
return null;
})
);
return results.find(Boolean);
}
public async getTextOf({ pid, handle, frameOrSelector, selector }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
const page = WebAutomationServices.getPageByHandle(handle);
GBLogEx.info(min, `Web Automation CLICK element: ${frameOrSelector}.`);
if (frameOrSelector) {
const result = await page.$eval(
frameOrSelector,
(ul) => {
let items = "";
for (let i = 0; i < ul.children.length; i++) {
items = `${ul.children[i].textContent}\n`;
}
return items;
}
)
await this.debugStepWeb(pid, page);
return result;
}
}
}

View file

@ -0,0 +1,156 @@
"use strict";
exports.__esModule = true;
var fs_1 = require("fs");
var path = require("path");
function convertFile(file) {
var extension = path.extname(file);
var withoutExtension = file.substr(0, file.length - extension.length);
var targetFile = withoutExtension + ".ts";
var baseName = path.basename(file, extension);
var content = fs_1.readFileSync(file, 'utf8');
var result = convert(content, baseName);
console.log("Writing to \"" + targetFile + "\"...");
fs_1.writeFileSync(targetFile, result);
}
exports.convertFile = convertFile;
function convert(input, name) {
var result = convertImports(input, name);
return result;
}
exports.convert = convert;
function convertImports(input, name) {
var items = [];
var result = input.replace(/<!-- #include file="(.*?\/)?(.*?).asp" -->/gi, function (input, group1, group2) {
var path = group1 || './';
var file = "" + path + group2;
items.push({ name: group2, path: file });
return "<%\n" + group2 + "();\n%>";
});
result = convertCode(result);
result = convertExpressions(result);
result = convertStrings(result);
result = "\nexport function " + name + "() {\n" + result + "\n}";
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
var item = items_1[_i];
result = "import {" + item.name + "} from \"" + item.path + "\"\n" + result;
}
return result;
}
exports.convertImports = convertImports;
function convertCode(input) {
var result = input.replace(/<%([^=][\s\S]*?)%>/gi, function (input, group1) {
var code = group1;
code = convertComments(code);
code = convertIfStatements(code);
code = convertSwitchStatements(code);
code = convertFunctions(code);
code = convertForStatements(code);
code = convertLoops(code);
code = convertPRec(code);
code = convertPLan(code);
return "<%" + code + "%>";
});
return result;
}
exports.convertCode = convertCode;
function convertExpressions(input) {
var result = input.replace(/<%=([\s\S]*?)%>/gi, function (input, group1) {
var content = convertPRec(group1);
content = convertPLan(content);
return "${" + content + "}";
});
return result;
}
exports.convertExpressions = convertExpressions;
function convertStrings(input) {
var result = input.replace(/%>([\s\S]+?)<%/gi, "\nResponse.Write(`$1`);\n");
// Entire document is a string
if (result.indexOf("<%") === -1) {
result = "Response.Write(`" + result + "`);";
}
// Start of the document is a string
var firstIndex = result.indexOf("<%");
if (firstIndex > 0) {
result = "Response.Write(`" + result.substr(0, firstIndex) + "`);\n" + result.substring(firstIndex + 2);
}
result = result.replace(/%>$/, "");
// End of the document is a string
var lastIndex = result.lastIndexOf("%>");
if (lastIndex > -1 && lastIndex < result.length - 2) {
result = result.substr(0, lastIndex) + "\nResponse.Write(`" + result.substr(lastIndex + 3) + "`);";
}
result = result.replace(/^<%/, "");
return result;
}
exports.convertStrings = convertStrings;
function convertComments(input) {
var result = '';
var splitted = input.split(/(".*")/gim);
for (var _i = 0, splitted_1 = splitted; _i < splitted_1.length; _i++) {
var part = splitted_1[_i];
if (part.indexOf("\"") === 0) {
result += part;
}
else {
result += part.replace(/'/gi, "//");
}
}
return result;
}
exports.convertComments = convertComments;
function convertIfStatements(input) {
var result = input.replace(/if +(.*?) +then/gi, function (input, group1) {
var condition = convertConditions(group1);
return "\nif (" + condition + ") {\n";
});
result = result.replace(/end if/gi, "\n}\n");
result = result.replace(/else(?!{)/gi, "\n}\nelse {\n");
return result;
}
exports.convertIfStatements = convertIfStatements;
function convertSwitchStatements(input) {
var result = input.replace(/select case +(.*)/gi, "\nswitch ($1) {\n");
result = result.replace(/end select/gi, "\n}\n");
return result;
}
exports.convertSwitchStatements = convertSwitchStatements;
function convertFunctions(input) {
var result = input.replace(/function +(.*)\((.*)\)/gi, "\n$1 = ($2) => {\n");
result = result.replace(/end function/gi, "\n}\n");
return result;
}
exports.convertFunctions = convertFunctions;
function convertForStatements(input) {
var result = input.replace(/for +(.*to.*)/gi, "\nfor ($1) {\n");
result = result.replace(/^ *next *$/gim, "}\n");
return result;
}
exports.convertForStatements = convertForStatements;
function convertConditions(input) {
var result = input.replace(/ +and +/gi, " && ");
result = result.replace(/ +or +/gi, " || ");
result = result.replace(/ +<> +/gi, " !== ");
result = result.replace(/ += +/gi, " === ");
return result;
}
exports.convertConditions = convertConditions;
function convertLoops(input) {
var result = input.replace(/do while +(.*)/gi, function (input, group1) {
var condition = convertConditions(group1);
return "\nwhile (" + condition + ") {\n";
});
result = result.replace(/^ *loop *$/gim, "}\n");
return result;
}
exports.convertLoops = convertLoops;
function convertPRec(input) {
var result = input.replace(/(p_rec\("\S+?"\))/gi, "$1.Value");
return result;
}
exports.convertPRec = convertPRec;
function convertPLan(input) {
var result = input.replace(/(l_\S+?)\(p_lan\)/gi, "$1[p_lan]");
return result;
}
exports.convertPLan = convertPLan;

View file

@ -1,310 +0,0 @@
import crypto2 from 'crypto';
import { spawn } from 'child_process';
import CDP from 'chrome-remote-interface';
import {} from 'child_process';
import net from 'net';
import { GBLog } from 'botlib';
import { CollectionUtil } from 'pragmatismo-io-framework';
import { GBServer } from '../../../../src/app.js';
import { DebuggerService } from '../DebuggerService.js';
import finalStream from 'final-stream';
import { GBLogEx } from '../../../core.gbapp/services/GBLogEx.js';
const waitUntil = condition => {
if (condition()) {
return Promise.resolve();
}
return new Promise(resolve => {
const interval = setInterval(() => {
if (!condition()) {
return;
}
clearInterval(interval);
resolve(0);
}, 0);
});
};
const systemVariables = [
'AggregateError',
'Array',
'ArrayBuffer',
'Atomics',
'BigInt',
'BigInt64Array',
'BigUint64Array',
'Boolean',
'DataView',
'Date',
'Error',
'EvalError',
'FinalizationRegistry',
'Float32Array',
'Float64Array',
'Function',
'Headers',
'Infinity',
'Int16Array',
'Int32Array',
'Int8Array',
'Intl',
'JSON',
'Map',
'Math',
'NaN',
'Number',
'Object',
'Promise',
'Proxy',
'RangeError',
'ReferenceError',
'Reflect',
'RegExp',
'Request',
'Response',
'Set',
'SharedArrayBuffer',
'String',
'Symbol',
'SyntaxError',
'TypeError',
'URIError',
'Uint16Array',
'Uint32Array',
'Uint8Array',
'Uint8ClampedArray',
'VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL',
'WeakMap',
'WeakRef',
'WeakSet',
'WebAssembly',
'__defineGetter__',
'__defineSetter__',
'__lookupGetter__',
'__lookupSetter__',
'__proto__',
'clearImmediate',
'clearInterval',
'clearTimeout',
'console',
'constructor',
'decodeURI',
'decodeURIComponent',
'dss',
'encodeURI',
'encodeURIComponent',
'escape',
'eval',
'fetch',
'global',
'globalThis',
'hasOwnProperty',
'isFinite',
'isNaN',
'isPrototypeOf',
'parseFloat',
'parseInt',
'process',
'propertyIsEnumerable',
'setImmediate',
'setInterval',
'setTimeout',
'toLocaleString',
'toString',
'undefined',
'unescape',
'valueOf'
];
export const createVm2Pool = ({ min, max, ...limits }) => {
limits = Object.assign(
{
cpu: 100,
memory: 2000,
time: 4000
},
limits
);
let limitError = null;
const ref = crypto2.randomBytes(20).toString('hex');
const kill = x => {
spawn('sh', ['-c', `pkill -9 -f ${ref}`]);
};
let stderrCache = '';
const run = async (code: any, scope: any) => {
// Configure environment variables
const env = Object.assign({}, process.env, {
NODE_ENV: 'production',
NODE_OPTIONS: '' // Clear NODE_OPTIONS if needed
});
const childProcess = spawn(
'/usr/bin/cpulimit',
[
'-ql',
limits.cpu,
'--',
'node',
`${limits.debug ? '--inspect=' + limits.debuggerPort : ''}`,
`--experimental-fetch`,
`--max-old-space-size=${limits.memory}`,
limits.script,
ref
],
{ cwd: limits.cwd, shell: true, env: env }
);
childProcess.stdout.on('data', data => {
childProcess['socket'] = childProcess['socket'] || data.toString().trim();
});
childProcess.stderr.on('data', data => {
stderrCache = stderrCache + data.toString();
if (stderrCache.includes('failed: address already in use')) {
limitError = stderrCache;
kill(process);
GBServer.globals.debuggers[limits.botId].state = 0;
GBServer.globals.debuggers[limits.botId].stateInfo = stderrCache;
} else if (
stderrCache.includes('FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory')
) {
limitError = 'code execution exceeed allowed memory';
kill(process);
GBServer.globals.debuggers[limits.botId].state = 0;
GBServer.globals.debuggers[limits.botId].stateInfo = 'Fail';
} else if (stderrCache.includes('Debugger attached.')) {
GBLogEx.info(min, `General Bots Debugger attached to Node .gbdialog process for ${limits.botId}.`);
}
});
let socket = null;
await waitUntil(() => childProcess['socket']);
GBServer.globals.debuggers[limits.botId].childProcess = ref;
// Only attach if called by debugger/run.
if (limits.debug) {
const debug = async () => {
return new Promise((resolve, reject) => {
CDP(async client => {
const { Debugger, Runtime } = client;
try {
GBServer.globals.debuggers[limits.botId].client = client;
await client.Debugger.paused(async ({ callFrames, reason, hitBreakpoints }) => {
const frame = callFrames[0];
// Build variable list ignoring system variables of script.
const scopeObjectId = frame.scopeChain[2].object.objectId;
const variables = await Runtime.getProperties({ objectId: scopeObjectId });
let variablesText = '';
if (variables && variables.result) {
await CollectionUtil.asyncForEach(variables.result, async v => {
if (!systemVariables.filter(x => x === v.name)[0]) {
if (v.value.value) {
variablesText = `${variablesText} \n ${v.name}: ${v.value.value}`;
}
}
});
}
GBServer.globals.debuggers[limits.botId].scope = variablesText;
GBLogEx.info(min, `Breakpoint variables: ${variablesText}`); // (zero-based)
// Processes breakpoint hits.
if (hitBreakpoints.length >= 1) {
GBLogEx.info(min, `Break at line ${frame.location.lineNumber + 1}`); // (zero-based)
GBServer.globals.debuggers[limits.botId].state = 2;
GBServer.globals.debuggers[limits.botId].stateInfo = 'Break';
} else {
GBLog.verbose(`Configuring breakpoints if any for ${limits.botId}...`);
// Waits for debugger and setup breakpoints.
await CollectionUtil.asyncForEach(GBServer.globals.debuggers[limits.botId].breaks, async brk => {
try {
const { breakpointId } = await client.Debugger.setBreakpoint({
location: {
scriptId: frame.location.scriptId,
lineNumber: brk
}
});
GBLogEx.info(min, `BASIC break defined ${breakpointId} for ${limits.botId}`);
} catch (error) {
GBLogEx.info(min, `BASIC error defining ${brk} for ${limits.botId}. ${error}`);
}
});
await client.Debugger.resume();
}
});
await client.Runtime.runIfWaitingForDebugger();
await client.Debugger.enable();
await client.Runtime.enable();
resolve(1);
} catch (error) {
GBLog.error(error);
kill(childProcess);
GBServer.globals.debuggers[limits.botId].state = 0;
GBServer.globals.debuggers[limits.botId].stateInfo = 'Stopped';
}
}).on('error', err => {
console.error(err);
kill(childProcess);
GBServer.globals.debuggers[limits.botId].state = 0;
GBServer.globals.debuggers[limits.botId].stateInfo = 'Stopped';
reject(err);
});
});
};
await debug();
}
socket = net.createConnection(childProcess['socket']);
socket.write(JSON.stringify({ code, scope }) + '\n');
const timer = setTimeout(() => {
limitError = 'code execution took too long and was killed';
kill(childProcess);
GBServer.globals.debuggers[limits.botId].state = 0;
GBServer.globals.debuggers[limits.botId].stateInfo = limitError;
}, limits.time);
try {
let data = await finalStream(socket);
data = JSON.parse(data);
if (!data.length) {
return null;
}
if (data.error) {
throw new Error(data.error);
}
return data.result;
} catch (error) {
throw new Error(limitError || error);
} finally {
kill(childProcess);
GBServer.globals.debuggers[limits.botId].state = 0;
GBServer.globals.debuggers[limits.botId].stateInfo = 'Stopped';
clearTimeout(timer);
}
};
return {
run
};
};

View file

@ -1,67 +0,0 @@
import { VMScript, NodeVM } from 'vm2';
import crypto1 from 'crypto';
import net1 from 'net';
const evaluate = async (script, scope) => {
const vm = new NodeVM({
allowAsync: true,
sandbox: {},
console: 'inherit',
wrapper: 'none',
require: {
builtin: ['stream', 'http', 'https', 'url', 'buffer', 'zlib', 'isomorphic-fetch', 'punycode', 'encoding', 'net'],
root: ['./'],
external: true,
context: 'sandbox'
}
});
const s = new VMScript(script, scope);
return await vm.run(script, scope);
};
const socketName = crypto1.randomBytes(20).toString('hex');
const server = net1.createServer(socket => {
const buffer = [];
const sync = async () => {
const request = buffer.join('').toString();
console.log(request);
if (request.includes('\n')) {
try {
const { code, scope } = JSON.parse(request);
const result = await evaluate(code, {
...scope,
module: null
});
console.log(JSON.stringify({ result }));
socket.write(JSON.stringify({ result }) + '\n');
socket.end();
} catch (error) {
console.log(`RUNTIME: ${error.message}, ${error.stack}`);
socket.write(JSON.stringify({ error: error.message }) + '\n');
socket.end();
}
}
};
socket.on('error', err => {
console.log(err);
});
socket.on('data', data => {
buffer.push(data);
sync();
});
});
server.on('listening', () => {
console.log(`/tmp/vm2-${socketName}.sock`);
});
server.listen(`/tmp/vm2-${socketName}.sock`);

View file

@ -1,10 +1,9 @@
export const Messages = {
'en-US': {
affirmative_sentences: /^(\bsim\b|\bs\b|\bpositivo\b|\bafirmativo\b|\bclaro\b|\bevidente\b|\bsem dúvida\b|\bconfirmo\b|\bconfirmar\b|\bconfirmado\b|\buhum\b|\bsi\b|\by\b|\byes\b|\bsure\b)/i,
choices: 'Please, select one:'
},
'pt-BR': {
affirmative_sentences: /^(\bsim\b|\bs\b|\bpositivo\b|\bafirmativo\b|\bclaro\b|\bevidente\b|\bsem dúvida\b|\bconfirmo\b|\bconfirmar\b|\bconfirmado\b|\buhum\b|\bsi\b|\by\b|\byes\b|\bsure\b)/i,
choices: 'Por favor, selecione:'
}
};

View file

@ -1,16 +0,0 @@
import { expect, test } from 'vitest';
import { DialogKeywords } from '../services/DialogKeywords';
import init from '../../../.test-init'
init();
const dk = new DialogKeywords();
const pid = 1;
test('TOLIST', async () => {
const obj = [{a:1, b:2}, {a:2, b:4}];
expect(await dk.getToLst({ pid, array: obj, member:'a' }))
.toBe("1,2");
});

View file

@ -1,43 +0,0 @@
import { GBVMService } from '../services/GBVMService';
import { expect, test } from 'vitest'
test('Default', () => {
const args = GBVMService.getSetScheduleKeywordArgs(`
SET SCHEDULE "0 0 */1 * * *"
SET SCHEDULE "0 0 */3 * * *"
SET SCHEDULE "0 0 */2 * * *"
SET SCHEDULE "0 0 */2 * * *"
SET SCHEDULE "0 0 */3 * * *"
`);
expect(args.length).toBe(5);
});
test('Compare', () => {
expect(GBVMService.compare(1,1)).toBeTruthy();
expect(GBVMService.compare({a:1},{a:1})).toBeTruthy();
expect(GBVMService.compare({a:1},{a:2})).toBeFalsy();
expect(GBVMService.compare({a:1, b:2},{a:1, b:2})).toBeTruthy();
});
test('Parse Storage Field', async () => {
const s = new GBVMService();
expect(await s.parseField('name STRING(30)')).toStrictEqual({name: 'name', definition: {
allowNull: true,
unique: false, primaryKey: false,
size: 30,
autoIncrement: false,
type:"STRING"
}});
});

View file

@ -1,36 +0,0 @@
import { GBVMService } from '../services/GBVMService';
import { expect, test } from 'vitest';
import { SystemKeywords } from '../services/SystemKeywords';
const s = new SystemKeywords();
const pid = 1;
test('APPEND', async () => {
expect(await s.append({ pid, args: [1, 1, 1, 1] })).toStrictEqual([1, 1, 1, 1]);
expect(await s.append({ pid, args: [1] })).toStrictEqual([1]);
expect(await s.append({ pid, args: [] })).toStrictEqual([]);
expect(await s.append({ pid, args: null })).toStrictEqual([]);
});
test('COMPARE', () => {
expect(GBVMService.compare(1, 1)).toBeTruthy();
expect(GBVMService.compare({ a: 1 }, { a: 1 })).toBeTruthy();
expect(GBVMService.compare({ a: 1 }, { a: 2 })).toBeFalsy();
expect(GBVMService.compare({ a: 1, b: 2 }, { a: 1, b: 2 })).toBeTruthy();
});
test('Parse Storage Field', async () => {
const s = new GBVMService();
expect(await s.parseField('name STRING(30)')).toStrictEqual({
name: 'name',
definition: {
allowNull: true,
unique: false,
primaryKey: false,
size: 30,
autoIncrement: false,
type: 'STRING'
}
});
});

View file

@ -6,7 +6,7 @@
"title": "Default General Bot",
"description": "Default General Bot",
"whoAmIVideo": "TODO.mp4",
"author": "pragmatismo.com.br",
"author": "pragmatismo.io",
"license": "AGPL",
"engineName": "guaribas-1.0.0"
}

View file

@ -2,6 +2,7 @@
"enabledAdmin": "true",
"searchScore": ".45",
"nlpScore": ".80",
"nlpVsSearch": ".4",
"state":"active",
"autoPackageSync": "gbdialog, gbot, gbtheme"
}

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -36,17 +38,14 @@
import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
import { Sequelize } from 'sequelize-typescript';
import { ConsoleDirectLine } from './services/ConsoleDirectLine';
/**
* Package for whatsapp.gblib
* Package for console.glib.
*/
export class GBTeamsPackage implements IGBPackage {
export class GBConsolePackage implements IGBPackage {
public sysPackages: IGBPackage[];
public async loadBot(min: GBMinInstance): Promise<void> {
GBLog.verbose(`loadBot called.`);
}
public channel: ConsoleDirectLine;
public async getDialogs(min: GBMinInstance) {
GBLog.verbose(`getDialogs called.`);
}
@ -65,4 +64,7 @@ export class GBTeamsPackage implements IGBPackage {
public async onExchangeData(min: GBMinInstance, kind: string, data: any) {
GBLog.verbose(`onExchangeData called.`);
}
public async loadBot(min: GBMinInstance): Promise<void> {
this.channel = new ConsoleDirectLine(min.instance.webchatKey);
}
}

View file

@ -0,0 +1,176 @@
const Swagger = require('swagger-client');
const rp = require('request-promise');
import { GBLog, GBService } from 'botlib';
/**
* Bot simulator in terminal window.
*/
export class ConsoleDirectLine extends GBService {
public pollInterval: number = 1000;
public directLineSecret: string = '';
public directLineClientName: string = 'DirectLineClient';
public directLineSpecUrl: string = 'https://docs.botframework.com/en-us/restapi/directline3/swagger.json';
constructor(directLineSecret: string) {
super();
this.directLineSecret = directLineSecret;
// tslint:disable-next-line:no-unsafe-any
const directLineClient = rp(this.directLineSpecUrl)
.then((spec: string) => {
// tslint:disable-next-line:no-unsafe-any
return new Swagger({
spec: JSON.parse(spec.trim()),
usePromise: true
});
})
.then(client => {
// tslint:disable-next-line:no-unsafe-any
client.clientAuthorizations.add(
'AuthorizationBotConnector',
// tslint:disable-next-line:no-unsafe-any
new Swagger.ApiKeyAuthorization('Authorization', `Bearer ${directLineSecret}`, 'header')
);
return client;
})
.catch(err => {
GBLog.error(`Error initializing DirectLine client ${err}`);
});
const _this_ = this;
// tslint:disable-next-line:no-unsafe-any
directLineClient.then(client => {
// tslint:disable-next-line:no-unsafe-any
client.Conversations.Conversations_StartConversation()
.then(response => {
// tslint:disable-next-line:no-unsafe-any
return response.obj.conversationId;
})
.then(conversationId => {
_this_.sendMessagesFromConsole(client, conversationId);
_this_.pollMessages(client, conversationId);
})
.catch(err => {
GBLog.error(`Error starting conversation ${err}`);
});
});
}
public sendMessagesFromConsole(client, conversationId) {
const _this_ = this;
process.stdin.resume();
const stdin = process.stdin;
process.stdout.write('Command> ');
stdin.addListener('data', e => {
// tslint:disable-next-line:no-unsafe-any
const input: string = e.toString().trim();
if (input !== undefined) {
// exit
if (input.toLowerCase() === 'exit') {
return process.exit();
}
// tslint:disable-next-line:no-unsafe-any
client.Conversations.Conversations_PostActivity({
conversationId: conversationId,
activity: {
textFormat: 'plain',
text: input,
type: 'message',
from: {
id: _this_.directLineClientName,
name: _this_.directLineClientName
}
}
}).catch(err => {
GBLog.error(`Error sending message: ${err}`);
});
process.stdout.write('Command> ');
}
});
}
public pollMessages(client, conversationId) {
const _this_ = this;
GBLog.info(`Starting polling message for conversationId: ${conversationId}`);
let watermark;
setInterval(() => {
// tslint:disable-next-line:no-unsafe-any
client.Conversations.Conversations_GetActivities({ conversationId: conversationId, watermark: watermark })
.then(response => {
// tslint:disable-next-line:no-unsafe-any
watermark = response.obj.watermark;
// tslint:disable-next-line:no-unsafe-any
return response.obj.activities;
})
.then(_this_.printMessages, _this_.directLineClientName);
// tslint:disable-next-line:align
}, this.pollInterval);
}
// tslint:disable:no-unsafe-any
public printMessages(activities, directLineClientName) {
if (activities && activities.length) {
// ignore own messages
activities = activities.filter(m => {
return m.from.id !== directLineClientName;
});
if (activities.length) {
// print other messages
activities.forEach(activity => {
GBLog.info(activity.text);
// tslint:disable-next-line:align
}, this);
process.stdout.write('Command> ');
}
}
}
// tslint:enable:no-unsafe-any
// tslint:disable:no-unsafe-any
public printMessage(activity) {
if (activity.text) {
GBLog.info(activity.text);
}
if (activity.attachments) {
activity.attachments.forEach(attachment => {
switch (attachment.contentType) {
case 'application/vnd.microsoft.card.hero':
this.renderHeroCard(attachment);
break;
case 'image/png':
GBLog.info(`Opening the requested image ${attachment.contentUrl}`);
open(attachment.contentUrl);
break;
default:
GBLog.info(`Unknown contentType: ${attachment.contentType}`);
break;
}
});
}
}
// tslint:enable:no-unsafe-any
// tslint:disable:no-unsafe-any
public renderHeroCard(attachment) {
const width = 70;
const contentLine = content => {
return `${' '.repeat((width - content.length) / 2)}content${' '.repeat((width - content.length) / 2)}`;
};
GBLog.info(`/${'*'.repeat(width + 1)}`);
GBLog.info(`*${contentLine(attachment.content.title)}*`);
GBLog.info(`*${' '.repeat(width)}*`);
GBLog.info(`*${contentLine(attachment.content.text)}*`);
GBLog.info(`${'*'.repeat(width + 1)}/`);
}
// tslint:enable:no-unsafe-any
}

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -37,10 +39,10 @@
import { BotAdapter } from 'botbuilder';
import { WaterfallDialog } from 'botbuilder-dialogs';
import { GBMinInstance, IGBDialog } from 'botlib';
import { Messages } from '../strings.js';
import { SecService } from '../../security.gbapp/services/SecService.js';
import { GBServer } from '../../../src/app.js';
import { GBConversationalService } from '../services/GBConversationalService.js';
import { Messages } from '../strings';
import { SecService } from '../../security.gbapp/services/SecService';
import { GBServer } from '../../../src/app';
import { GBConversationalService } from '../services/GBConversationalService';
/**
* Dialog for the bot explains about itself.
*/
@ -51,24 +53,16 @@ export class BroadcastDialog extends IGBDialog {
* @param bot The bot adapter.
* @param min The minimal bot instance data.
*/
public static setup (bot: BotAdapter, min: GBMinInstance) {
public static setup(bot: BotAdapter, min: GBMinInstance) {
min.dialogs.add(
new WaterfallDialog('/gb-broadcast', [
async step => {
if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) {
return await step.beginDialog('/auth');
} else {
return await step.next(step.options);
}
},
async step => {
const locale = step.context.activity.locale;
return await min.conversationalService.prompt(min, step, 'Type the message and the broadcast will start.');
},
async step => {
// DISABLED: await min.conversationalService['broadcast'](min, step.result);
await min.conversationalService['broadcast'](min, step.result);
return await step.next();
}
])

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -37,10 +39,10 @@
import { BotAdapter } from 'botbuilder';
import { WaterfallDialog } from 'botbuilder-dialogs';
import { GBMinInstance, IGBDialog } from 'botlib';
import { Messages } from '../strings.js';
import { SecService } from '../../security.gbapp/services/SecService.js';
import { GBServer } from '../../../src/app.js';
import { GBConversationalService } from '../services/GBConversationalService.js';
import { Messages } from '../strings';
import { SecService } from '../../security.gbapp/services/SecService';
import { GBServer } from '../../../src/app';
import { GBConversationalService } from '../services/GBConversationalService';
import { CollectionUtil } from 'pragmatismo-io-framework';
/**
* Dialog for the bot explains about itself.
@ -52,62 +54,55 @@ export class LanguageDialog extends IGBDialog {
* @param bot The bot adapter.
* @param min The minimal bot instance data.
*/
public static setup (bot: BotAdapter, min: GBMinInstance) {
min.dialogs.add(
new WaterfallDialog('/language', [
async step => {
if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) {
return await step.beginDialog('/auth');
} else {
return await step.next(step.options);
public static setup(bot: BotAdapter, min: GBMinInstance) {
min.dialogs.add(new WaterfallDialog('/language', [
async step => {
const locale = step.context.activity.locale;
return await min.conversationalService.prompt(min, step,
Messages[locale].which_language);
},
async step => {
const locale = step.context.activity.locale;
const user = await min.userProfile.get(step.context, {});
const list = [
{ name: 'english', code: 'en' },
{ name: 'inglês', code: 'en' },
{ name: 'portuguese', code: 'pt' },
{ name: 'português', code: 'pt' },
{ name: 'français', code: 'fr' },
{ name: 'francês', code: 'fr' },
{ name: 'french', code: 'fr' },
{ name: 'português', code: 'pt' },
{ name: 'spanish', code: 'es' },
{ name: 'espanõl', code: 'es' },
{ name: 'espanhol', code: 'es' },
{ name: 'german', code: 'de' },
{ name: 'deutsch', code: 'de' },
{ name: 'alemão', code: 'de' }
];
let translatorLocale = null;
const text = step.context.activity['originalText'];
await CollectionUtil.asyncForEach(list, async item => {
if (GBConversationalService.kmpSearch(text.toLowerCase(), item.name.toLowerCase()) != -1 ||
GBConversationalService.kmpSearch(text.toLowerCase(), item.code.toLowerCase()) != -1) {
translatorLocale = item.code;
}
},
});
async step => {
const locale = step.context.activity.locale;
let sec = new SecService();
user.systemUser = await sec.updateUserLocale(user.systemUser.userId, translatorLocale);
return await min.conversationalService.prompt(min, step, Messages[locale].which_language);
},
async step => {
const locale = step.context.activity.locale;
await min.userProfile.set(step.context, user);
await min.conversationalService.sendText(min, step,
Messages[locale].language_chosen);
const list = [
{ name: 'english', code: 'en' },
{ name: 'inglês', code: 'en' },
{ name: 'portuguese', code: 'pt' },
{ name: 'português', code: 'pt' },
{ name: 'français', code: 'fr' },
{ name: 'francês', code: 'fr' },
{ name: 'french', code: 'fr' },
{ name: 'português', code: 'pt' },
{ name: 'spanish', code: 'es' },
{ name: 'espanõl', code: 'es' },
{ name: 'espanhol', code: 'es' },
{ name: 'german', code: 'de' },
{ name: 'deutsch', code: 'de' },
{ name: 'alemão', code: 'de' }
];
let translatorLocale = null;
const text = step.context.activity['originalText'];
await CollectionUtil.asyncForEach(list, async item => {
if (
GBConversationalService.kmpSearch(text.toLowerCase(), item.name.toLowerCase()) != -1 ||
GBConversationalService.kmpSearch(text.toLowerCase(), item.code.toLowerCase()) != -1
) {
translatorLocale = item.code;
}
});
let sec = new SecService();
let user = await sec.getUserFromSystemId(step.context.activity.from.id);
user = await sec.updateUserLocale(user.userId, translatorLocale);
await min.conversationalService.sendText(min, step, Messages[locale].language_chosen);
await step.replaceDialog('/ask', { firstTime: true });
}
])
);
await step.replaceDialog('/ask', { firstTime: true });
}
]));
}
}

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -37,10 +39,10 @@
import { BotAdapter } from 'botbuilder';
import { WaterfallDialog } from 'botbuilder-dialogs';
import { GBMinInstance, IGBDialog } from 'botlib';
import { GBServer } from '../../../src/app.js';
import { SecService } from '../../security.gbapp/services/SecService.js';
import { GBConversationalService } from '../services/GBConversationalService.js';
import { Messages } from '../strings.js';
import { GBServer } from '../../../src/app';
import { SecService } from '../../security.gbapp/services/SecService';
import { GBConversationalService } from '../services/GBConversationalService';
import { Messages } from '../strings';
/**
* Dialog for the bot explains about itself.
*/
@ -51,33 +53,24 @@ export class SwitchBotDialog extends IGBDialog {
* @param bot The bot adapter.
* @param min The minimal bot instance data.
*/
public static setup (bot: BotAdapter, min: GBMinInstance) {
min.dialogs.add(
new WaterfallDialog('/bot', [
async step => {
if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) {
return await step.beginDialog('/auth');
} else {
return await step.next(step.options);
}
},
public static setup(bot: BotAdapter, min: GBMinInstance) {
min.dialogs.add(new WaterfallDialog('/bot', [
async step => {
const locale = step.context.activity.locale;
async step => {
const locale = step.context.activity.locale;
return await min.conversationalService.prompt(min, step, 'Qual seria o código de ativação?');
},
async step => {
const sec = new SecService();
const from = step.context.activity.from.id;
const botId = step.result;
const instance = await min.core.loadInstanceByBotId(botId);
await sec.updateUserInstance(from, instance.instanceId);
await min.conversationalService.sendText(min, step, `Opa, vamos lá!`);
return await min.conversationalService.prompt (min, step, 'Qual seria o código de ativação?');
},
async step => {
const sec = new SecService();
const from = step.context.activity.from.id;
const botId = step.result;
const instance = await min.core.loadInstanceByBotId(botId);
await sec.updateUserInstance(from, instance.instanceId);
await min.conversationalService.sendText(min, step, `Opa, vamos lá!`);
return await step.next();
}
])
);
return await step.next();
}
]));
}
}

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -37,10 +39,9 @@
import { BotAdapter } from 'botbuilder';
import { WaterfallDialog } from 'botbuilder-dialogs';
import { GBMinInstance, IGBDialog } from 'botlib';
import { GBServer } from '../../../src/app.js';
import { Messages } from '../strings.js';
import { GBLogEx } from '../services/GBLogEx.js';
import { GBConfigService } from '../services/GBConfigService.js';
import { GBServer } from '../../../src/app';
import { GBConversationalService } from '../services/GBConversationalService';
import { Messages } from '../strings';
/**
* Dialog for Welcoming people.
@ -52,58 +53,48 @@ export class WelcomeDialog extends IGBDialog {
* @param bot The bot adapter.
* @param min The minimal bot instance data.
*/
public static setup (bot: BotAdapter, min: GBMinInstance) {
min.dialogs.add(
new WaterfallDialog('/', [
async step => {
if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) {
return await step.beginDialog('/auth');
} else {
return await step.next(step.options);
}
},
async step => {
if (
GBServer.globals.entryPointDialog !== null &&
min.instance.botId === GBConfigService.get('BOT_ID')
) {
return step.replaceDialog(GBServer.globals.entryPointDialog);
}
public static setup(bot: BotAdapter, min: GBMinInstance) {
const locale = step.context.activity.locale;
min.dialogs.add(new WaterfallDialog('/', [
async step => {
if (
// TODO: https://github.com/GeneralBots/BotServer/issues/9 !user.once &&
step.context.activity.channelId === 'webchat' &&
min.core.getParam<boolean>(min.instance, 'HelloGoodX', true) === 'true'
) {
// user.once = true;
const a = new Date();
const date = a.getHours();
const msg =
date < 12
? Messages[locale].good_morning
: date < 18
if (GBServer.globals.entryPointDialog !== null &&
min.instance.botId === process.env.BOT_ID &&
step.context.activity.channelId === 'webchat') {
return step.replaceDialog(GBServer.globals.entryPointDialog);
}
const user = await min.userProfile.get(step.context, {});
const locale = step.context.activity.locale;
if (!user.once && step.context.activity.channelId === 'webchat'
&& min.core.getParam<boolean>(min.instance, 'HelloGoodX', true) === "true") {
user.once = true;
await min.userProfile.set(step.context, user);
const a = new Date();
const date = a.getHours();
const msg =
date < 12
? Messages[locale].good_morning
: date < 18
? Messages[locale].good_evening
: Messages[locale].good_night;
await min.conversationalService.sendText(min, step, Messages[locale].hi(msg));
await min.conversationalService.sendText(min, step, Messages[locale].hi(msg));
await step.replaceDialog('/ask', { firstTime: true });
await step.replaceDialog('/ask', { firstTime: true });
if (
step.context.activity !== undefined &&
step.context.activity.type === 'message' &&
step.context.activity.text !== ''
) {
GBLogEx.info(min, `/answer being called from WelcomeDialog.`);
await step.replaceDialog('/answer', { query: step.context.activity.text });
}
if (
step.context.activity !== undefined &&
step.context.activity.type === 'message' &&
step.context.activity.text !== ''
) {
await step.replaceDialog('/answer', { query: step.context.activity.text });
}
return await step.next();
}
])
);
return await step.next();
}
]));
}
}

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -37,8 +39,8 @@
import { BotAdapter } from 'botbuilder';
import { WaterfallDialog } from 'botbuilder-dialogs';
import { GBMinInstance, IGBDialog } from 'botlib';
import { GBConversationalService } from '../services/GBConversationalService.js';
import { Messages } from '../strings.js';
import { GBConversationalService } from '../services/GBConversationalService';
import { Messages } from '../strings';
/**
* Dialog for the bot explains about itself.
*/
@ -49,34 +51,24 @@ export class WhoAmIDialog extends IGBDialog {
* @param bot The bot adapter.
* @param min The minimal bot instance data.
*/
public static setup (bot: BotAdapter, min: GBMinInstance) {
min.dialogs.add(
new WaterfallDialog('/whoAmI', [
async step => {
if (step.context.activity.channelId !== 'msteams' && process.env.ENABLE_AUTH) {
return await step.beginDialog('/auth');
} else {
return await step.next(step.options);
}
},
public static setup(bot: BotAdapter, min: GBMinInstance) {
min.dialogs.add(new WaterfallDialog('/whoAmI', [
async step => {
const locale = step.context.activity.locale;
await min.conversationalService.sendText(min, step, `${min.instance.description}`);
async step => {
const locale = step.context.activity.locale;
await min.conversationalService.sendText(min, step, `${min.instance.description}`);
if (min.instance.whoAmIVideo !== undefined) {
await min.conversationalService.sendText(min, step, Messages[locale].show_video);
await min.conversationalService.sendEvent(min, step, 'play', {
playerType: 'video',
data: min.instance.whoAmIVideo.trim()
});
}
await step.replaceDialog('/ask', { isReturning: true });
return await step.next();
if (min.instance.whoAmIVideo !== undefined) {
await min.conversationalService.sendText(min, step, Messages[locale].show_video);
await min.conversationalService.sendEvent(min, step, 'play', {
playerType: 'video',
data: min.instance.whoAmIVideo.trim()
});
}
])
);
await step.replaceDialog('/ask', { isReturning: true });
return await step.next();
}
]));
}
}

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -36,12 +38,12 @@
import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
import { Sequelize } from 'sequelize-typescript';
import { BroadcastDialog } from './dialogs/BroadcastDialog.js';
import { LanguageDialog } from './dialogs/LanguageDialog.js';
import { SwitchBotDialog } from './dialogs/SwitchBot.js';
import { WelcomeDialog } from './dialogs/WelcomeDialog.js';
import { WhoAmIDialog } from './dialogs/WhoAmIDialog.js';
import { GuaribasApplications, GuaribasChannel, GuaribasInstance, GuaribasLog, GuaribasPackage } from './models/GBModel.js';
import { BroadcastDialog } from './dialogs/BroadcastDialog';
import { LanguageDialog } from './dialogs/LanguageDialog';
import { SwitchBotDialog } from './dialogs/SwitchBot';
import { WelcomeDialog } from './dialogs/WelcomeDialog';
import { WhoAmIDialog } from './dialogs/WhoAmIDialog';
import { GuaribasChannel, GuaribasException, GuaribasInstance, GuaribasPackage } from './models/GBModel';
/**
* Package for core.gbapp.
@ -50,27 +52,27 @@ export class GBCorePackage implements IGBPackage {
public sysPackages: IGBPackage[];
public CurrentEngineName = 'guaribas-1.0.0';
public async loadPackage (core: IGBCoreService, sequelize: Sequelize): Promise<void> {
core.sequelize.addModels([GuaribasInstance, GuaribasPackage, GuaribasChannel, GuaribasLog, GuaribasApplications]);
public async loadPackage(core: IGBCoreService, sequelize: Sequelize): Promise<void> {
core.sequelize.addModels([GuaribasInstance, GuaribasPackage, GuaribasChannel, GuaribasException]);
}
public async getDialogs (min: GBMinInstance) {
public async getDialogs(min: GBMinInstance) {
GBLog.verbose(`getDialogs called.`);
}
public async unloadPackage (core: IGBCoreService): Promise<void> {
public async unloadPackage(core: IGBCoreService): Promise<void> {
GBLog.verbose(`unloadPackage called.`);
}
public async unloadBot (min: GBMinInstance): Promise<void> {
public async unloadBot(min: GBMinInstance): Promise<void> {
GBLog.verbose(`unloadBot called.`);
}
public async onNewSession (min: GBMinInstance, step: GBDialogStep): Promise<void> {
public async onNewSession(min: GBMinInstance, step: GBDialogStep): Promise<void> {
GBLog.verbose(`onNewSession called.`);
}
public async onExchangeData (min: GBMinInstance, kind: string, data: any) {
public async onExchangeData(min: GBMinInstance, kind: string, data: any) {
GBLog.verbose(`onExchangeData called.`);
}
public async loadBot (min: GBMinInstance): Promise<void> {
public async loadBot(min: GBMinInstance): Promise<void> {
WelcomeDialog.setup(min.bot, min);
WhoAmIDialog.setup(min.bot, min);
SwitchBotDialog.setup(min.bot, min);

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -45,4 +47,4 @@ import {
Table,
UpdatedAt
} from 'sequelize-typescript';
import { GuaribasInstance } from './GBModel.js';
import { GuaribasInstance } from './GBModel';

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -53,216 +55,194 @@ import { IGBInstance } from 'botlib';
* Base instance data for a bot.
*/
@Table
export class GuaribasInstance extends Model<GuaribasInstance> implements IGBInstance {
export class GuaribasInstance extends Model<GuaribasInstance>
implements IGBInstance {
@PrimaryKey
@AutoIncrement
@Column(DataType.INTEGER)
declare instanceId: number;
@Column
public instanceId: number;
@Column(DataType.STRING(255))
declare botEndpoint: string;
@Column
public botEndpoint: string;
@Column(DataType.STRING(255))
declare whoAmIVideo: string;
@Column
public whoAmIVideo: string;
@Column(DataType.STRING(255))
declare botId: string;
@Column
public botId: string;
@Column(DataType.STRING(255))
declare title: string;
@Column
public title: string;
@Column({ type: DataType.STRING(16) })
declare activationCode: string;
public activationCode: string;
@Column(DataType.STRING(255))
declare description: string;
@Column
public description: string;
@Column({ type: DataType.STRING(16) })
declare state: string;
public state: string;
declare version: string;
@Column
public version: string;
@Column(DataType.STRING(64))
declare botKey: string;
@Column
public enabledAdmin: boolean;
@Column(DataType.STRING(255))
declare enabledAdmin: boolean;
@Column
public engineName: string;
@Column(DataType.STRING(255))
declare engineName: string;
@Column
public marketplaceId: string;
@Column(DataType.STRING(255))
declare marketplaceId: string;
@Column
public textAnalyticsKey: string;
@Column(DataType.STRING(255))
declare textAnalyticsKey: string;
@Column(DataType.STRING(255))
declare textAnalyticsEndpoint: string;
@Column
public textAnalyticsEndpoint: string;
@Column({ type: DataType.STRING(64) })
declare translatorKey: string;
public translatorKey: string;
@Column
@Column({ type: DataType.STRING(128) })
declare translatorEndpoint: string;
public translatorEndpoint: string;
@Column(DataType.STRING(255))
declare marketplacePassword: string;
@Column
public marketplacePassword: string;
@Column(DataType.STRING(255))
declare webchatKey: string;
@Column
public webchatKey: string;
@Column(DataType.STRING(255))
declare authenticatorTenant: string;
@Column
public authenticatorTenant: string;
@Column(DataType.STRING(255))
declare authenticatorAuthorityHostUrl: string;
@Column
public authenticatorAuthorityHostUrl: string;
@Column(DataType.STRING(255))
declare cloudSubscriptionId: string;
@Column
public cloudSubscriptionId: string;
@Column(DataType.STRING(255))
declare cloudUsername: string;
@Column
public cloudUsername: string;
@Column(DataType.STRING(255))
declare cloudPassword: string;
@Column
public cloudPassword: string;
@Column(DataType.STRING(255))
declare cloudLocation: string;
@Column
public cloudLocation: string;
@Column(DataType.STRING(255))
declare googleBotKey: string;
@Column
public whatsappBotKey: string;
@Column(DataType.STRING(255))
declare googleChatApiKey: string;
@Column
public whatsappServiceKey: string;
@Column(DataType.STRING(255))
declare googleChatSubscriptionName: string;
@Column
public whatsappServiceNumber: string;
@Column(DataType.STRING(255))
declare googleClientEmail: string;
@Column
public whatsappServiceUrl: string;
@Column({ type: DataType.STRING(4000) })
declare googlePrivateKey: string;
@Column
public smsKey: string;
@Column(DataType.STRING(255))
declare googleProjectId: string;
@Column
public smsSecret: string;
@Column({ type: DataType.STRING(255) })
declare facebookWorkplaceVerifyToken: string;
@Column
public smsServiceNumber: string;
@Column({ type: DataType.STRING(255) })
declare facebookWorkplaceAppSecret: string;
@Column
public speechKey: string;
@Column
public speechEndpoint: string;
@Column
public spellcheckerKey: string;
@Column
public spellcheckerEndpoint: string;
@Column
public theme: string;
@Column
public ui: string;
@Column
public kb: string;
@Column
public nlpAppId: string;
@Column
public nlpKey: string;
@Column
@Column({ type: DataType.STRING(512) })
declare facebookWorkplaceAccessToken: string;
public nlpEndpoint: string;
@Column(DataType.STRING(255))
declare whatsappBotKey: string;
@Column
public nlpAuthoringKey: string;
@Column(DataType.STRING(255))
declare whatsappServiceKey: string;
@Column
public deploymentPaths: string;
@Column(DataType.STRING(255))
declare whatsappServiceNumber: string;
@Column
public searchHost: string;
@Column(DataType.STRING(255))
declare whatsappServiceUrl: string;
@Column
public searchKey: string;
@Column(DataType.STRING(255))
declare smsKey: string;
@Column
public searchIndex: string;
@Column(DataType.STRING(255))
declare smsSecret: string;
@Column
public searchIndexer: string;
@Column(DataType.STRING(255))
declare smsServiceNumber: string;
@Column
public storageUsername: string;
@Column(DataType.STRING(255))
declare speechKey: string;
@Column
public storagePassword: string;
@Column(DataType.STRING(255))
declare speechEndpoint: string;
@Column
public storageName: string;
@Column(DataType.STRING(255))
declare spellcheckerKey: string;
@Column
public storageServer: string;
@Column(DataType.STRING(255))
declare spellcheckerEndpoint: string;
@Column
public storageDialect: string;
@Column(DataType.STRING(255))
declare theme: string;
@Column
public storagePath: string;
@Column(DataType.STRING(255))
declare ui: string;
@Column(DataType.STRING(255))
declare kb: string;
@Column(DataType.STRING(255))
declare nlpAppId: string;
@Column(DataType.STRING(255))
declare nlpKey: string;
@Column({ type: DataType.STRING(512) })
declare nlpEndpoint: string;
@Column(DataType.STRING(255))
declare nlpAuthoringKey: string;
@Column(DataType.STRING(255))
declare deploymentPaths: string;
@Column(DataType.STRING(255))
declare searchHost: string;
@Column(DataType.STRING(255))
declare searchKey: string;
@Column(DataType.STRING(255))
declare searchIndex: string;
@Column(DataType.STRING(255))
declare searchIndexer: string;
@Column(DataType.STRING(255))
declare storageUsername: string;
@Column(DataType.STRING(255))
declare storagePassword: string;
@Column(DataType.STRING(255))
declare storageName: string;
@Column(DataType.STRING(255))
declare storageServer: string;
@Column(DataType.STRING(255))
declare storageDialect: string;
@Column(DataType.STRING(255))
declare storagePath: string;
@Column(DataType.STRING(255))
declare adminPass: string;
@Column
public adminPass: string;
@Column(DataType.FLOAT)
declare searchScore: number;
public nlpVsSearch: number; // TODO: Remove field.
@Column(DataType.FLOAT)
declare nlpScore: number;
public searchScore: number;
@Column(DataType.DATE)
@Column(DataType.FLOAT)
public nlpScore: number;
@Column
@CreatedAt
declare createdAt: Date;
public createdAt: Date;
@Column(DataType.DATE)
@Column
@UpdatedAt
declare updatedAt: Date;
public updatedAt: Date;
@Column(DataType.STRING(4000))
declare params: string;
public params: string;
}
/**
@ -272,29 +252,29 @@ export class GuaribasInstance extends Model<GuaribasInstance> implements IGBInst
export class GuaribasPackage extends Model<GuaribasPackage> {
@PrimaryKey
@AutoIncrement
@Column(DataType.INTEGER)
declare packageId: number;
@Column
public packageId: number;
@Column(DataType.STRING(255))
declare packageName: string;
@Column
public packageName: string;
@ForeignKey(() => GuaribasInstance)
@Column(DataType.INTEGER)
declare instanceId: number;
@Column
public instanceId: number;
@BelongsTo(() => GuaribasInstance)
declare instance: GuaribasInstance;
public instance: GuaribasInstance;
@Column(DataType.DATE)
@Column
@CreatedAt
declare createdAt: Date;
public createdAt: Date;
@Column(DataType.DATE)
@Column
@UpdatedAt
declare updatedAt: Date;
public updatedAt: Date;
@Column({ type: DataType.STRING(512) })
declare custom: string;
public custom: string;
}
/**
@ -304,19 +284,19 @@ export class GuaribasPackage extends Model<GuaribasPackage> {
export class GuaribasChannel extends Model<GuaribasChannel> {
@PrimaryKey
@AutoIncrement
@Column(DataType.INTEGER)
declare channelId: number;
@Column
public channelId: number;
@Column(DataType.STRING(255))
declare title: string;
@Column
public title: string;
@Column(DataType.DATE)
@Column
@CreatedAt
declare createdAt: Date;
public createdAt: Date;
@Column(DataType.DATE)
@Column
@UpdatedAt
declare updatedAt: Date;
public updatedAt: Date;
}
/**
@ -324,77 +304,76 @@ export class GuaribasChannel extends Model<GuaribasChannel> {
*/
@Table
//tslint:disable-next-line:max-classes-per-file
export class GuaribasLog extends Model<GuaribasLog> {
export class GuaribasException extends Model<GuaribasException> {
@PrimaryKey
@AutoIncrement
@Column(DataType.INTEGER)
declare logId: number;
@Column
public exceptionId: number;
@Column(DataType.STRING(1024))
declare message: string;
@Column
public message: string;
@Column(DataType.STRING(1))
declare kind: string;
@ForeignKey(() => GuaribasInstance)
@Column(DataType.INTEGER)
declare instanceId: number;
@Column
public instanceId: number;
@BelongsTo(() => GuaribasInstance)
declare instance: GuaribasInstance;
public instance: GuaribasInstance;
@Column(DataType.DATE)
@Column
@CreatedAt
declare createdAt: Date;
public createdAt: Date;
@Column(DataType.DATE)
@Column
@UpdatedAt
declare updatedAt: Date;
public updatedAt: Date;
}
@Table
//tslint:disable-next-line:max-classes-per-file
export class GuaribasApplications extends Model<GuaribasApplications> {
@Column(DataType.STRING(255))
declare name: string;
@Column
public name: string;
@ForeignKey(() => GuaribasInstance)
@Column(DataType.INTEGER)
declare instanceId: number;
@Column
public instanceId: number;
@BelongsTo(() => GuaribasInstance)
declare instance: GuaribasInstance;
public instance: GuaribasInstance;
@Column(DataType.DATE)
@Column
@CreatedAt
declare createdAt: Date;
public createdAt: Date;
@Column(DataType.DATE)
@Column
@UpdatedAt
declare updatedAt: Date;
public updatedAt: Date;
}
@Table
//tslint:disable-next-line:max-classes-per-file
export class GuaribasSchedule extends Model<GuaribasSchedule> {
@Column(DataType.STRING(255))
declare name: string;
@Column(DataType.STRING(255))
declare schedule: string;
@Column
public name: string;
@Column
public schedule: string;
@ForeignKey(() => GuaribasInstance)
@Column(DataType.INTEGER)
declare instanceId: number;
@Column
public instanceId: number;
@BelongsTo(() => GuaribasInstance)
declare instance: GuaribasInstance;
public instance: GuaribasInstance;
@Column(DataType.DATE)
@Column
@CreatedAt
declare createdAt: Date;
public createdAt: Date;
@Column(DataType.DATE)
@Column
@UpdatedAt
declare updatedAt: Date;
public updatedAt: Date;
}

View file

@ -1,11 +1,13 @@
/*****************************************************************************\
| ® |
| |
| |
| |
| |
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) pragmatismo.com.br. All rights reserved. |
| 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 |
@ -21,7 +23,7 @@
| 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.com.br. |
| "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. |
@ -31,8 +33,6 @@
'use strict';
import { GBLog } from 'botlib';
import * as en from 'dotenv-extended';
import path from 'path';
/**
* @fileoverview General Bots server core.
@ -58,7 +58,7 @@ export class GBConfigService {
public static init(): any {
try {
en.load({
require('dotenv-extended').load({
encoding: 'utf8',
silent: true,
path: '.env',
@ -77,38 +77,19 @@ export class GBConfigService {
}
}
public static get(key: string) {
public static get(key: string): string | undefined {
let value = GBConfigService.tryGet(key);
if (!value) {
if (value === undefined) {
switch (key) {
case 'PORT':
value = this.getServerPort();
break;
case 'GBVM':
value = true;
break;
case 'STORAGE_NAME':
value = null;
break;
case 'WEBDAV_USERNAME':
value = null;
break;
case 'WEBDAV_PASSWORD':
value = null;
break;
case 'CLOUD_USERNAME':
value = undefined;
break;
case 'CLOUD_PASSWORD':
case 'BOT_ID':
value = undefined;
break;
case 'STORAGE_LIBRARY':
value = path.join(process.env.PWD, 'templates');
break;
case 'BOT_ID':
value = 'default';
case 'CLOUD_PASSWORD':
value = undefined;
break;
case 'CLOUD_SUBSCRIPTIONID':
value = undefined;
@ -119,18 +100,17 @@ export class GBConfigService {
case 'MARKETPLACE_ID':
value = undefined;
break;
case 'LOG_ON_STORAGE':
value = false;
break;
case 'MARKETPLACE_SECRET':
value = undefined;
break;
case 'STORAGE_DIALECT':
value = 'sqlite';
case 'NLP_AUTHORING_KEY':
value = undefined;
break;
case 'STORAGE_FILE':
value = './data.db';
case 'STORAGE_DIALECT':
value = undefined;
break;
case 'STORAGE_STORAGE':
value = './guaribas.sqlite';
break;
case 'GBKB_AUTO_DEPLOY':
value = false;
@ -139,7 +119,7 @@ export class GBConfigService {
value = undefined;
break;
case 'STORAGE_SYNC':
value = 'true';
value = 'false';
break;
case 'STORAGE_SYNC_ALTER':
value = 'false';
@ -177,18 +157,6 @@ export class GBConfigService {
case 'ENABLE_SPELLING_CHECKER':
value = false;
break;
case 'DEV_GBAI':
value = undefined;
break;
case 'FREE_TIER':
value = true;
break;
case 'BOT_URL':
value = 'http://localhost:4242';
break;
case 'STORAGE_SERVER':
value = undefined;
break;
default:
GBLog.warn(`Invalid key on .env file: '${key}'`);
break;

File diff suppressed because it is too large Load diff

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